Loading src/com/android/settings/biometrics2/data/repository/AccessibilityRepository.java +21 −0 Original line number Diff line number Diff line Loading @@ -16,8 +16,12 @@ package com.android.settings.biometrics2.data.repository; import android.view.View; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; import androidx.annotation.NonNull; /** * This repository is used to call all APIs in {@link AccessibilityManager} */ Loading @@ -44,4 +48,21 @@ public class AccessibilityRepository { public boolean isEnabled() { return mAccessibilityManager.isEnabled(); } /** * Sends an {@link AccessibilityEvent}. * * @param event The event to send. * * @throws IllegalStateException if accessibility is not enabled. * * <strong>Note:</strong> The preferred mechanism for sending custom accessibility * events is through calling * {@link android.view.ViewParent#requestSendAccessibilityEvent(View, AccessibilityEvent)} * instead of this method to allow predecessors to augment/filter events sent by * their descendants. */ public void sendAccessibilityEvent(@NonNull AccessibilityEvent event) { mAccessibilityManager.sendAccessibilityEvent(event); } } src/com/android/settings/biometrics2/ui/view/FingerprintEnrollEnrollingRfpsFragment.java +0 −6 Original line number Diff line number Diff line Loading @@ -410,12 +410,6 @@ public class FingerprintEnrollEnrollingRfpsFragment extends Fragment { } } @Override public void onDestroy() { // TODO stopListenOrientationEvent(); super.onDestroy(); } private void animateProgress(int progress) { if (mProgressAnim != null) { mProgressAnim.cancel(); Loading src/com/android/settings/biometrics2/ui/view/FingerprintEnrollEnrollingSfpsFragment.java +239 −245 File changed.Preview size limit exceeded, changes collapsed. Show changes src/com/android/settings/biometrics2/ui/view/FingerprintEnrollFindRfpsFragment.java +48 −10 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.hardware.fingerprint.FingerprintManager; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.Surface; import android.view.View; import android.view.ViewGroup; Loading @@ -32,6 +33,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentActivity; import androidx.lifecycle.LiveData; import androidx.lifecycle.Observer; import androidx.lifecycle.ViewModelProvider; Loading @@ -39,6 +41,7 @@ import com.android.settings.R; import com.android.settings.biometrics.fingerprint.FingerprintFindSensorAnimation; import com.android.settings.biometrics2.ui.model.EnrollmentProgress; import com.android.settings.biometrics2.ui.model.EnrollmentStatusMessage; import com.android.settings.biometrics2.ui.viewmodel.DeviceRotationViewModel; import com.android.settings.biometrics2.ui.viewmodel.FingerprintEnrollFindSensorViewModel; import com.android.settings.biometrics2.ui.viewmodel.FingerprintEnrollProgressViewModel; Loading Loading @@ -67,12 +70,23 @@ public class FingerprintEnrollFindRfpsFragment extends Fragment { private FingerprintEnrollFindSensorViewModel mViewModel; private FingerprintEnrollProgressViewModel mProgressViewModel; private DeviceRotationViewModel mRotationViewModel; private View mView; private GlifLayout mGlifLayout; private FooterBarMixin mFooterBarMixin; private final OnClickListener mOnSkipClickListener = (v) -> mViewModel.onSkipButtonClick(); @Nullable private FingerprintFindSensorAnimation mAnimation; @Surface.Rotation private int mLastRotation = -1; private final Observer<Integer> mRotationObserver = rotation -> { if (DEBUG) { Log.d(TAG, "rotationObserver " + rotation); } if (rotation != null) { onRotationChanged(rotation); } }; private final Observer<EnrollmentProgress> mProgressObserver = progress -> { if (DEBUG) { Loading @@ -85,15 +99,10 @@ public class FingerprintEnrollFindRfpsFragment extends Fragment { private final Observer<EnrollmentStatusMessage> mLastCancelMessageObserver = errorMessage -> { if (DEBUG) { Log.d(TAG, "mErrorMessageObserver(" + errorMessage + ")"); Log.d(TAG, "mLastCancelMessageObserver(" + errorMessage + ")"); } if (errorMessage != null) { if (errorMessage.getMsgId() == FingerprintManager.FINGERPRINT_ERROR_CANCELED) { mProgressViewModel.clearProgressLiveData(); mViewModel.onStartButtonClick(); } else { Log.e(TAG, "mErrorMessageObserver(" + errorMessage + ")"); } onLastCancelMessage(errorMessage); } }; Loading Loading @@ -144,6 +153,10 @@ public class FingerprintEnrollFindRfpsFragment extends Fragment { @Override public void onResume() { final LiveData<Integer> rotationLiveData = mRotationViewModel.getLiveData(); mLastRotation = rotationLiveData.getValue(); rotationLiveData.observe(this, mRotationObserver); if (mAnimation != null) { if (DEBUG) { Log.d(TAG, "onResume(), start animation"); Loading Loading @@ -198,15 +211,39 @@ public class FingerprintEnrollFindRfpsFragment extends Fragment { return; } if (waitForLastCancelErrMsg) { mProgressViewModel.clearErrorMessageLiveData(); // Prevent got previous error message mProgressViewModel.getErrorMessageLiveData().observe(this, mLastCancelMessageObserver); } mProgressViewModel.getProgressLiveData().removeObserver(mProgressObserver); final boolean cancelResult = mProgressViewModel.cancelEnrollment(); if (!cancelResult) { Log.e(TAG, "stopLookingForFingerprint(), failed to cancel enrollment"); } } if (waitForLastCancelErrMsg) { mProgressViewModel.getErrorMessageLiveData().observe(this, mLastCancelMessageObserver); private void onRotationChanged(@Surface.Rotation int newRotation) { if (DEBUG) { Log.d(TAG, "onRotationChanged() from " + mLastRotation + " to " + newRotation); } if (newRotation % 2 != mLastRotation % 2) { // Fragment is going to be recreated, just stopLookingForFingerprint() here. stopLookingForFingerprint(true); } } private void onLastCancelMessage(@NonNull EnrollmentStatusMessage errorMessage) { if (errorMessage.getMsgId() == FingerprintManager.FINGERPRINT_ERROR_CANCELED) { final EnrollmentProgress progress = mProgressViewModel.getProgressLiveData().getValue(); mProgressViewModel.clearProgressLiveData(); mProgressViewModel.getErrorMessageLiveData().removeObserver(mLastCancelMessageObserver); if (progress != null && !progress.isInitialStep()) { mViewModel.onStartButtonClick(); } } else { Log.e(TAG, "mErrorMessageObserver(" + errorMessage + ")"); } } Loading @@ -227,6 +264,7 @@ public class FingerprintEnrollFindRfpsFragment extends Fragment { final ViewModelProvider provider = new ViewModelProvider(activity); mViewModel = provider.get(FingerprintEnrollFindSensorViewModel.class); mProgressViewModel = provider.get(FingerprintEnrollProgressViewModel.class); mRotationViewModel = provider.get(DeviceRotationViewModel.class); super.onAttach(context); } } src/com/android/settings/biometrics2/ui/view/FingerprintEnrollFindSfpsFragment.java +58 −23 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static android.hardware.fingerprint.FingerprintManager.ENROLL_FIND_SENSOR import android.app.Activity; import android.content.Context; import android.hardware.fingerprint.FingerprintManager; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; Loading @@ -39,6 +40,7 @@ import androidx.lifecycle.ViewModelProvider; import com.android.settings.R; import com.android.settings.biometrics2.ui.model.EnrollmentProgress; import com.android.settings.biometrics2.ui.model.EnrollmentStatusMessage; import com.android.settings.biometrics2.ui.viewmodel.DeviceFoldedViewModel; import com.android.settings.biometrics2.ui.viewmodel.DeviceRotationViewModel; import com.android.settings.biometrics2.ui.viewmodel.FingerprintEnrollFindSensorViewModel; Loading Loading @@ -75,30 +77,36 @@ public class FingerprintEnrollFindSfpsFragment extends Fragment { private DeviceRotationViewModel mRotationViewModel; private DeviceFoldedViewModel mFoldedViewModel; private GlifLayout mView; private FooterBarMixin mFooterBarMixin; private final OnClickListener mOnSkipClickListener = (v) -> mViewModel.onSkipButtonClick(); private LottieAnimationView mIllustrationLottie; @Surface.Rotation private int mAnimationRotation = -1; private final Observer<Integer> mRotationObserver = rotation -> { if (DEBUG) { Log.d(TAG, "rotationObserver " + rotation); } if (rotation == null) { return; } if (rotation != null) { onRotationChanged(rotation); } }; @Surface.Rotation private int mAnimationRotation = -1; private View mView; private GlifLayout mGlifLayout; private FooterBarMixin mFooterBarMixin; private final OnClickListener mOnSkipClickListener = (v) -> mViewModel.onSkipButtonClick(); private LottieAnimationView mIllustrationLottie; private final Observer<EnrollmentProgress> mProgressObserver = progress -> { if (DEBUG) { Log.d(TAG, "mProgressObserver(" + progress + ")"); } if (progress != null && !progress.isInitialStep()) { mViewModel.onStartButtonClick(); stopLookingForFingerprint(true); } }; private final Observer<EnrollmentStatusMessage> mLastCancelMessageObserver = errorMessage -> { if (DEBUG) { Log.d(TAG, "mLastCancelMessageObserver(" + errorMessage + ")"); } if (errorMessage != null) { onLastCancelMessage(errorMessage); } }; Loading @@ -107,10 +115,10 @@ public class FingerprintEnrollFindSfpsFragment extends Fragment { public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { final Context context = inflater.getContext(); mView = inflater.inflate(R.layout.sfps_enroll_find_sensor_layout, container, false); mGlifLayout = mView.findViewById(R.id.setup_wizard_layout); mView = (GlifLayout) inflater.inflate(R.layout.sfps_enroll_find_sensor_layout, container, false); mIllustrationLottie = mView.findViewById(R.id.illustration_lottie); mFooterBarMixin = mGlifLayout.getMixin(FooterBarMixin.class); mFooterBarMixin = mView.getMixin(FooterBarMixin.class); mFooterBarMixin.setSecondaryButton( new FooterButton.Builder(context) .setText(R.string.security_settings_fingerprint_enroll_enrolling_skip) Loading @@ -125,7 +133,7 @@ public class FingerprintEnrollFindSfpsFragment extends Fragment { public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); final Activity activity = getActivity(); final GlifLayoutHelper glifLayoutHelper = new GlifLayoutHelper(activity, mGlifLayout); final GlifLayoutHelper glifLayoutHelper = new GlifLayoutHelper(activity, mView); glifLayoutHelper.setHeaderText(R.string.security_settings_sfps_enroll_find_sensor_title); glifLayoutHelper.setDescriptionText( getText(R.string.security_settings_sfps_enroll_find_sensor_message)); Loading @@ -136,11 +144,14 @@ public class FingerprintEnrollFindSfpsFragment extends Fragment { public void onStart() { super.onStart(); final boolean isEnrolling = mProgressViewModel.isEnrolling(); if (DEBUG) { Log.d(TAG, "onStart(), start looking for fingerprint"); Log.d(TAG, "onStart(), isEnrolling:" + isEnrolling); } if (!isEnrolling) { startLookingForFingerprint(); } } @Override public void onResume() { Loading @@ -159,10 +170,13 @@ public class FingerprintEnrollFindSfpsFragment extends Fragment { @Override public void onStop() { super.onStop(); final boolean isEnrolling = mProgressViewModel.isEnrolling(); if (DEBUG) { Log.d(TAG, "onStop(), stop looking for fingerprint"); Log.d(TAG, "onStop(), isEnrolling:" + isEnrolling); } if (isEnrolling) { stopLookingForFingerprint(false); } stopLookingForFingerprint(); } private void startLookingForFingerprint() { Loading @@ -180,13 +194,19 @@ public class FingerprintEnrollFindSfpsFragment extends Fragment { } } private void stopLookingForFingerprint() { private void stopLookingForFingerprint(boolean waitForLastCancelErrMsg) { if (!mProgressViewModel.isEnrolling()) { Log.d(TAG, "stopLookingForFingerprint(), failed because isEnrolling is false before" + " stopping"); return; } if (waitForLastCancelErrMsg) { mProgressViewModel.clearErrorMessageLiveData(); // Prevent got previous error message mProgressViewModel.getErrorMessageLiveData().observe(this, mLastCancelMessageObserver); } mProgressViewModel.getProgressLiveData().removeObserver(mProgressObserver); final boolean cancelResult = mProgressViewModel.cancelEnrollment(); if (!cancelResult) { Loading @@ -199,10 +219,25 @@ public class FingerprintEnrollFindSfpsFragment extends Fragment { Log.d(TAG, "onRotationChanged() from " + mAnimationRotation + " to " + newRotation); } if ((newRotation + 2) % 4 == mAnimationRotation) { // Fragment not changed, we just need to play correct rotation animation playLottieAnimation(newRotation); } else if (newRotation % 2 != mAnimationRotation % 2) { // Fragment is going to be recreated, just stopLookingForFingerprint() here. stopLookingForFingerprint(true); } } private void onLastCancelMessage(@NonNull EnrollmentStatusMessage errorMessage) { if (errorMessage.getMsgId() == FingerprintManager.FINGERPRINT_ERROR_CANCELED) { final EnrollmentProgress progress = mProgressViewModel.getProgressLiveData().getValue(); mProgressViewModel.clearProgressLiveData(); mProgressViewModel.getErrorMessageLiveData().removeObserver(mLastCancelMessageObserver); if (progress != null && !progress.isInitialStep()) { mViewModel.onStartButtonClick(); } } else { Log.e(TAG, "mErrorMessageObserver(" + errorMessage + ")"); } // Fragment will be re-created if it's changed between landscape and portrait, so no need to // handle other cases. } private void playLottieAnimation(@Surface.Rotation int rotation) { Loading Loading
src/com/android/settings/biometrics2/data/repository/AccessibilityRepository.java +21 −0 Original line number Diff line number Diff line Loading @@ -16,8 +16,12 @@ package com.android.settings.biometrics2.data.repository; import android.view.View; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; import androidx.annotation.NonNull; /** * This repository is used to call all APIs in {@link AccessibilityManager} */ Loading @@ -44,4 +48,21 @@ public class AccessibilityRepository { public boolean isEnabled() { return mAccessibilityManager.isEnabled(); } /** * Sends an {@link AccessibilityEvent}. * * @param event The event to send. * * @throws IllegalStateException if accessibility is not enabled. * * <strong>Note:</strong> The preferred mechanism for sending custom accessibility * events is through calling * {@link android.view.ViewParent#requestSendAccessibilityEvent(View, AccessibilityEvent)} * instead of this method to allow predecessors to augment/filter events sent by * their descendants. */ public void sendAccessibilityEvent(@NonNull AccessibilityEvent event) { mAccessibilityManager.sendAccessibilityEvent(event); } }
src/com/android/settings/biometrics2/ui/view/FingerprintEnrollEnrollingRfpsFragment.java +0 −6 Original line number Diff line number Diff line Loading @@ -410,12 +410,6 @@ public class FingerprintEnrollEnrollingRfpsFragment extends Fragment { } } @Override public void onDestroy() { // TODO stopListenOrientationEvent(); super.onDestroy(); } private void animateProgress(int progress) { if (mProgressAnim != null) { mProgressAnim.cancel(); Loading
src/com/android/settings/biometrics2/ui/view/FingerprintEnrollEnrollingSfpsFragment.java +239 −245 File changed.Preview size limit exceeded, changes collapsed. Show changes
src/com/android/settings/biometrics2/ui/view/FingerprintEnrollFindRfpsFragment.java +48 −10 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.hardware.fingerprint.FingerprintManager; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.Surface; import android.view.View; import android.view.ViewGroup; Loading @@ -32,6 +33,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentActivity; import androidx.lifecycle.LiveData; import androidx.lifecycle.Observer; import androidx.lifecycle.ViewModelProvider; Loading @@ -39,6 +41,7 @@ import com.android.settings.R; import com.android.settings.biometrics.fingerprint.FingerprintFindSensorAnimation; import com.android.settings.biometrics2.ui.model.EnrollmentProgress; import com.android.settings.biometrics2.ui.model.EnrollmentStatusMessage; import com.android.settings.biometrics2.ui.viewmodel.DeviceRotationViewModel; import com.android.settings.biometrics2.ui.viewmodel.FingerprintEnrollFindSensorViewModel; import com.android.settings.biometrics2.ui.viewmodel.FingerprintEnrollProgressViewModel; Loading Loading @@ -67,12 +70,23 @@ public class FingerprintEnrollFindRfpsFragment extends Fragment { private FingerprintEnrollFindSensorViewModel mViewModel; private FingerprintEnrollProgressViewModel mProgressViewModel; private DeviceRotationViewModel mRotationViewModel; private View mView; private GlifLayout mGlifLayout; private FooterBarMixin mFooterBarMixin; private final OnClickListener mOnSkipClickListener = (v) -> mViewModel.onSkipButtonClick(); @Nullable private FingerprintFindSensorAnimation mAnimation; @Surface.Rotation private int mLastRotation = -1; private final Observer<Integer> mRotationObserver = rotation -> { if (DEBUG) { Log.d(TAG, "rotationObserver " + rotation); } if (rotation != null) { onRotationChanged(rotation); } }; private final Observer<EnrollmentProgress> mProgressObserver = progress -> { if (DEBUG) { Loading @@ -85,15 +99,10 @@ public class FingerprintEnrollFindRfpsFragment extends Fragment { private final Observer<EnrollmentStatusMessage> mLastCancelMessageObserver = errorMessage -> { if (DEBUG) { Log.d(TAG, "mErrorMessageObserver(" + errorMessage + ")"); Log.d(TAG, "mLastCancelMessageObserver(" + errorMessage + ")"); } if (errorMessage != null) { if (errorMessage.getMsgId() == FingerprintManager.FINGERPRINT_ERROR_CANCELED) { mProgressViewModel.clearProgressLiveData(); mViewModel.onStartButtonClick(); } else { Log.e(TAG, "mErrorMessageObserver(" + errorMessage + ")"); } onLastCancelMessage(errorMessage); } }; Loading Loading @@ -144,6 +153,10 @@ public class FingerprintEnrollFindRfpsFragment extends Fragment { @Override public void onResume() { final LiveData<Integer> rotationLiveData = mRotationViewModel.getLiveData(); mLastRotation = rotationLiveData.getValue(); rotationLiveData.observe(this, mRotationObserver); if (mAnimation != null) { if (DEBUG) { Log.d(TAG, "onResume(), start animation"); Loading Loading @@ -198,15 +211,39 @@ public class FingerprintEnrollFindRfpsFragment extends Fragment { return; } if (waitForLastCancelErrMsg) { mProgressViewModel.clearErrorMessageLiveData(); // Prevent got previous error message mProgressViewModel.getErrorMessageLiveData().observe(this, mLastCancelMessageObserver); } mProgressViewModel.getProgressLiveData().removeObserver(mProgressObserver); final boolean cancelResult = mProgressViewModel.cancelEnrollment(); if (!cancelResult) { Log.e(TAG, "stopLookingForFingerprint(), failed to cancel enrollment"); } } if (waitForLastCancelErrMsg) { mProgressViewModel.getErrorMessageLiveData().observe(this, mLastCancelMessageObserver); private void onRotationChanged(@Surface.Rotation int newRotation) { if (DEBUG) { Log.d(TAG, "onRotationChanged() from " + mLastRotation + " to " + newRotation); } if (newRotation % 2 != mLastRotation % 2) { // Fragment is going to be recreated, just stopLookingForFingerprint() here. stopLookingForFingerprint(true); } } private void onLastCancelMessage(@NonNull EnrollmentStatusMessage errorMessage) { if (errorMessage.getMsgId() == FingerprintManager.FINGERPRINT_ERROR_CANCELED) { final EnrollmentProgress progress = mProgressViewModel.getProgressLiveData().getValue(); mProgressViewModel.clearProgressLiveData(); mProgressViewModel.getErrorMessageLiveData().removeObserver(mLastCancelMessageObserver); if (progress != null && !progress.isInitialStep()) { mViewModel.onStartButtonClick(); } } else { Log.e(TAG, "mErrorMessageObserver(" + errorMessage + ")"); } } Loading @@ -227,6 +264,7 @@ public class FingerprintEnrollFindRfpsFragment extends Fragment { final ViewModelProvider provider = new ViewModelProvider(activity); mViewModel = provider.get(FingerprintEnrollFindSensorViewModel.class); mProgressViewModel = provider.get(FingerprintEnrollProgressViewModel.class); mRotationViewModel = provider.get(DeviceRotationViewModel.class); super.onAttach(context); } }
src/com/android/settings/biometrics2/ui/view/FingerprintEnrollFindSfpsFragment.java +58 −23 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static android.hardware.fingerprint.FingerprintManager.ENROLL_FIND_SENSOR import android.app.Activity; import android.content.Context; import android.hardware.fingerprint.FingerprintManager; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; Loading @@ -39,6 +40,7 @@ import androidx.lifecycle.ViewModelProvider; import com.android.settings.R; import com.android.settings.biometrics2.ui.model.EnrollmentProgress; import com.android.settings.biometrics2.ui.model.EnrollmentStatusMessage; import com.android.settings.biometrics2.ui.viewmodel.DeviceFoldedViewModel; import com.android.settings.biometrics2.ui.viewmodel.DeviceRotationViewModel; import com.android.settings.biometrics2.ui.viewmodel.FingerprintEnrollFindSensorViewModel; Loading Loading @@ -75,30 +77,36 @@ public class FingerprintEnrollFindSfpsFragment extends Fragment { private DeviceRotationViewModel mRotationViewModel; private DeviceFoldedViewModel mFoldedViewModel; private GlifLayout mView; private FooterBarMixin mFooterBarMixin; private final OnClickListener mOnSkipClickListener = (v) -> mViewModel.onSkipButtonClick(); private LottieAnimationView mIllustrationLottie; @Surface.Rotation private int mAnimationRotation = -1; private final Observer<Integer> mRotationObserver = rotation -> { if (DEBUG) { Log.d(TAG, "rotationObserver " + rotation); } if (rotation == null) { return; } if (rotation != null) { onRotationChanged(rotation); } }; @Surface.Rotation private int mAnimationRotation = -1; private View mView; private GlifLayout mGlifLayout; private FooterBarMixin mFooterBarMixin; private final OnClickListener mOnSkipClickListener = (v) -> mViewModel.onSkipButtonClick(); private LottieAnimationView mIllustrationLottie; private final Observer<EnrollmentProgress> mProgressObserver = progress -> { if (DEBUG) { Log.d(TAG, "mProgressObserver(" + progress + ")"); } if (progress != null && !progress.isInitialStep()) { mViewModel.onStartButtonClick(); stopLookingForFingerprint(true); } }; private final Observer<EnrollmentStatusMessage> mLastCancelMessageObserver = errorMessage -> { if (DEBUG) { Log.d(TAG, "mLastCancelMessageObserver(" + errorMessage + ")"); } if (errorMessage != null) { onLastCancelMessage(errorMessage); } }; Loading @@ -107,10 +115,10 @@ public class FingerprintEnrollFindSfpsFragment extends Fragment { public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { final Context context = inflater.getContext(); mView = inflater.inflate(R.layout.sfps_enroll_find_sensor_layout, container, false); mGlifLayout = mView.findViewById(R.id.setup_wizard_layout); mView = (GlifLayout) inflater.inflate(R.layout.sfps_enroll_find_sensor_layout, container, false); mIllustrationLottie = mView.findViewById(R.id.illustration_lottie); mFooterBarMixin = mGlifLayout.getMixin(FooterBarMixin.class); mFooterBarMixin = mView.getMixin(FooterBarMixin.class); mFooterBarMixin.setSecondaryButton( new FooterButton.Builder(context) .setText(R.string.security_settings_fingerprint_enroll_enrolling_skip) Loading @@ -125,7 +133,7 @@ public class FingerprintEnrollFindSfpsFragment extends Fragment { public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); final Activity activity = getActivity(); final GlifLayoutHelper glifLayoutHelper = new GlifLayoutHelper(activity, mGlifLayout); final GlifLayoutHelper glifLayoutHelper = new GlifLayoutHelper(activity, mView); glifLayoutHelper.setHeaderText(R.string.security_settings_sfps_enroll_find_sensor_title); glifLayoutHelper.setDescriptionText( getText(R.string.security_settings_sfps_enroll_find_sensor_message)); Loading @@ -136,11 +144,14 @@ public class FingerprintEnrollFindSfpsFragment extends Fragment { public void onStart() { super.onStart(); final boolean isEnrolling = mProgressViewModel.isEnrolling(); if (DEBUG) { Log.d(TAG, "onStart(), start looking for fingerprint"); Log.d(TAG, "onStart(), isEnrolling:" + isEnrolling); } if (!isEnrolling) { startLookingForFingerprint(); } } @Override public void onResume() { Loading @@ -159,10 +170,13 @@ public class FingerprintEnrollFindSfpsFragment extends Fragment { @Override public void onStop() { super.onStop(); final boolean isEnrolling = mProgressViewModel.isEnrolling(); if (DEBUG) { Log.d(TAG, "onStop(), stop looking for fingerprint"); Log.d(TAG, "onStop(), isEnrolling:" + isEnrolling); } if (isEnrolling) { stopLookingForFingerprint(false); } stopLookingForFingerprint(); } private void startLookingForFingerprint() { Loading @@ -180,13 +194,19 @@ public class FingerprintEnrollFindSfpsFragment extends Fragment { } } private void stopLookingForFingerprint() { private void stopLookingForFingerprint(boolean waitForLastCancelErrMsg) { if (!mProgressViewModel.isEnrolling()) { Log.d(TAG, "stopLookingForFingerprint(), failed because isEnrolling is false before" + " stopping"); return; } if (waitForLastCancelErrMsg) { mProgressViewModel.clearErrorMessageLiveData(); // Prevent got previous error message mProgressViewModel.getErrorMessageLiveData().observe(this, mLastCancelMessageObserver); } mProgressViewModel.getProgressLiveData().removeObserver(mProgressObserver); final boolean cancelResult = mProgressViewModel.cancelEnrollment(); if (!cancelResult) { Loading @@ -199,10 +219,25 @@ public class FingerprintEnrollFindSfpsFragment extends Fragment { Log.d(TAG, "onRotationChanged() from " + mAnimationRotation + " to " + newRotation); } if ((newRotation + 2) % 4 == mAnimationRotation) { // Fragment not changed, we just need to play correct rotation animation playLottieAnimation(newRotation); } else if (newRotation % 2 != mAnimationRotation % 2) { // Fragment is going to be recreated, just stopLookingForFingerprint() here. stopLookingForFingerprint(true); } } private void onLastCancelMessage(@NonNull EnrollmentStatusMessage errorMessage) { if (errorMessage.getMsgId() == FingerprintManager.FINGERPRINT_ERROR_CANCELED) { final EnrollmentProgress progress = mProgressViewModel.getProgressLiveData().getValue(); mProgressViewModel.clearProgressLiveData(); mProgressViewModel.getErrorMessageLiveData().removeObserver(mLastCancelMessageObserver); if (progress != null && !progress.isInitialStep()) { mViewModel.onStartButtonClick(); } } else { Log.e(TAG, "mErrorMessageObserver(" + errorMessage + ")"); } // Fragment will be re-created if it's changed between landscape and portrait, so no need to // handle other cases. } private void playLottieAnimation(@Surface.Rotation int rotation) { Loading