Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ae16e55d authored by Kevin Chyn's avatar Kevin Chyn
Browse files

Fix setting crash when removing screenlock with fp

If a phone is operating slower than normal, when removing screen lock,
it's possible for the user to go back to settings page while removal
is still in progress. The removal callback will crash ChooseLockGeneric

Fixes: 37329856
Test: in fpc_tee_hal.c, make do_remove slow (5s). set up lockscreen, fingerprint,
then set lockscreen to none or swipe. do device rotations, go back to lock screen,
and then try to enroll fingerprint

Change-Id: I6da131a0001b22d06e359401f2ca1c6496c071ca
parent 2a3a92b5
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -129,6 +129,7 @@ public class ChooseLockGeneric extends SettingsActivity {
        private boolean mHideDrawer = false;
        private ManagedLockPasswordProvider mManagedPasswordProvider;
        private boolean mIsSetNewPassword = false;
        private UserManager mUserManager;

        protected boolean mForFingerprint = false;

@@ -166,6 +167,7 @@ public class ChooseLockGeneric extends SettingsActivity {
                    ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT, false);
            mForChangeCredRequiredForBoot = getArguments() != null && getArguments().getBoolean(
                    ChooseLockSettingsHelper.EXTRA_KEY_FOR_CHANGE_CRED_REQUIRED_FOR_BOOT);
            mUserManager = UserManager.get(getActivity());

            if (savedInstanceState != null) {
                mPasswordConfirmed = savedInstanceState.getBoolean(PASSWORD_CONFIRMED);
@@ -751,11 +753,10 @@ public class ChooseLockGeneric extends SettingsActivity {
            if (mFingerprintManager != null && mFingerprintManager.isHardwareDetected()) {
                mFingerprintManager.setActiveUser(UserHandle.myUserId());
            }
            final UserManager um = UserManager.get(getActivity());
            boolean hasChildProfile = false;
            if (!um.getUserInfo(parentUserId).isManagedProfile()) {
            if (!mUserManager.getUserInfo(parentUserId).isManagedProfile()) {
                // Current user is primary profile, remove work profile fingerprints if necessary
                final List<UserInfo> profiles = um.getProfiles(parentUserId);
                final List<UserInfo> profiles = mUserManager.getProfiles(parentUserId);
                final int profilesSize = profiles.size();
                for (int i = 0; i < profilesSize; i++) {
                    final UserInfo userInfo = profiles.get(i);