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

Commit 647e4b82 authored by Brian Colonna's avatar Brian Colonna Committed by Android Git Automerger
Browse files

am df6db6ad: am 3f1375e5: Merge "Enabling Face Unlock for user switching (bug...

am df6db6ad: am 3f1375e5: Merge "Enabling Face Unlock for user switching (bug 8495282)" into jb-mr2-dev

* commit 'df6db6ad':
  Enabling Face Unlock for user switching (bug 8495282)
parents 18197ec4 df6db6ad
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -150,7 +150,9 @@ public class KeyguardFaceUnlockView extends LinearLayout implements KeyguardSecu
    public void onResume(int reason) {
        if (DEBUG) Log.d(TAG, "onResume()");
        mIsShowing = KeyguardUpdateMonitor.getInstance(mContext).isKeyguardVisible();
        if (!KeyguardUpdateMonitor.getInstance(mContext).isSwitchingUser()) {
          maybeStartBiometricUnlock();
        }
        KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mUpdateCallback);

        // Registers a callback which handles stopping the biometric unlock and restarting it in
@@ -267,6 +269,14 @@ public class KeyguardFaceUnlockView extends LinearLayout implements KeyguardSecu
            // mLockPatternUtils.setCurrentUser(userId);
        }

        @Override
        public void onUserSwitchComplete(int userId) {
            if (DEBUG) Log.d(TAG, "onUserSwitchComplete(" + userId + ")");
            if (mBiometricUnlock != null) {
                maybeStartBiometricUnlock();
            }
        }

        @Override
        public void onKeyguardVisibilityChanged(boolean showing) {
            if (DEBUG) Log.d(TAG, "onKeyguardVisibilityChanged(" + showing + ")");
+8 −1
Original line number Diff line number Diff line
@@ -122,6 +122,8 @@ public class KeyguardUpdateMonitor {
            mCallbacks = Lists.newArrayList();
    private ContentObserver mDeviceProvisionedObserver;

    private boolean mSwitchingUser;

    private final Handler mHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
@@ -459,11 +461,13 @@ public class KeyguardUpdateMonitor {
                        public void onUserSwitching(int newUserId, IRemoteCallback reply) {
                            mHandler.sendMessage(mHandler.obtainMessage(MSG_USER_SWITCHING,
                                    newUserId, 0, reply));
                            mSwitchingUser = true;
                        }
                        @Override
                        public void onUserSwitchComplete(int newUserId) throws RemoteException {
                            mHandler.sendMessage(mHandler.obtainMessage(MSG_USER_SWITCH_COMPLETE,
                                    newUserId));
                            mSwitchingUser = false;
                        }
                    });
        } catch (RemoteException e) {
@@ -527,7 +531,6 @@ public class KeyguardUpdateMonitor {
                cb.onUserSwitching(userId);
            }
        }
        setAlternateUnlockEnabled(false);
        try {
            reply.sendResult(null);
        } catch (RemoteException e) {
@@ -731,6 +734,10 @@ public class KeyguardUpdateMonitor {
        return mKeyguardIsVisible;
    }

    public boolean isSwitchingUser() {
        return mSwitchingUser;
    }

    private static boolean isBatteryUpdateInteresting(BatteryStatus old, BatteryStatus current) {
        final boolean nowPluggedIn = current.isPluggedIn();
        final boolean wasPluggedIn = old.isPluggedIn();
+3 −2
Original line number Diff line number Diff line
@@ -324,8 +324,9 @@ public class KeyguardViewMediator {
                mSwitchingUser = true;
                resetStateLocked(null);
                adjustStatusBarLocked();
                // Disable face unlock when the user switches.
                KeyguardUpdateMonitor.getInstance(mContext).setAlternateUnlockEnabled(false);
                // When we switch users we want to bring the new user to the biometric unlock even
                // if the current user has gone to the backup.
                KeyguardUpdateMonitor.getInstance(mContext).setAlternateUnlockEnabled(true);
            }
        }