Merge "Fix issues with SUW on fingerprint devices"
diff --git a/src/com/android/settings/biometrics/BiometricsEnrollEnrolling.java b/src/com/android/settings/biometrics/BiometricsEnrollEnrolling.java
index 17a933b..f131e35 100644
--- a/src/com/android/settings/biometrics/BiometricsEnrollEnrolling.java
+++ b/src/com/android/settings/biometrics/BiometricsEnrollEnrolling.java
@@ -60,6 +60,8 @@
 
     @Override
     protected void onStop() {
+        super.onStop();
+
         if (mSidecar != null) {
             mSidecar.setListener(null);
         }
@@ -78,6 +80,12 @@
     }
 
     @Override
+    protected boolean shouldFinishWhenBackgrounded() {
+        // Prevent super.onStop() from finishing, since we handle this in our onStop().
+        return false;
+    }
+
+    @Override
     public void onBackPressed() {
         if (mSidecar != null) {
             mSidecar.setListener(null);
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
index 8194878..3831b07 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
@@ -217,13 +217,15 @@
 
     private void stopIconAnimation() {
         mAnimationCancelled = true;
-        mIconAnimationDrawable.stop();
+        if (mIconAnimationDrawable != null) {
+            mIconAnimationDrawable.stop();
+        }
     }
 
     @Override
     protected void onStop() {
-        stopIconAnimation();
         super.onStop();
+        stopIconAnimation();
     }
 
     private void animateProgress(int progress) {
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensor.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensor.java
index 9508268..dbedb4a 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensor.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensor.java
@@ -115,10 +115,10 @@
 
     @Override
     protected void onStop() {
+        super.onStop();
         if (mAnimation != null) {
             mAnimation.pauseAnimation();
         }
-        super.onStop();
     }
 
     @Override