Loading core/java/android/hardware/biometrics/IBiometricEnabledOnKeyguardCallback.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -22,5 +22,5 @@ import android.hardware.biometrics.BiometricSourceType; * @hide */ oneway interface IBiometricEnabledOnKeyguardCallback { void onChanged(in BiometricSourceType type, boolean enabled); void onChanged(in BiometricSourceType type, boolean enabled, int userId); } No newline at end of file packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +10 −8 Original line number Diff line number Diff line Loading @@ -377,14 +377,15 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { } }; private boolean mFaceSettingEnabledForUser; private SparseBooleanArray mFaceSettingEnabledForUser = new SparseBooleanArray(); private BiometricManager mBiometricManager; private IBiometricEnabledOnKeyguardCallback mBiometricEnabledCallback = new IBiometricEnabledOnKeyguardCallback.Stub() { @Override public void onChanged(BiometricSourceType type, boolean enabled) throws RemoteException { public void onChanged(BiometricSourceType type, boolean enabled, int userId) throws RemoteException { if (type == BiometricSourceType.FACE) { mFaceSettingEnabledForUser = enabled; mFaceSettingEnabledForUser.put(userId, enabled); updateFaceListeningState(); } } Loading Loading @@ -1711,7 +1712,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { // instance of KeyguardUpdateMonitor for each user but KeyguardUpdateMonitor is user-aware. return (mBouncer || mAuthInterruptActive || awakeKeyguard || shouldListenForFaceAssistant()) && !mSwitchingUser && !isFaceDisabled(user) && becauseCannotSkipBouncer && !mKeyguardGoingAway && mFaceSettingEnabledForUser && !mLockIconPressed && !mKeyguardGoingAway && mFaceSettingEnabledForUser.get(user) && !mLockIconPressed && strongAuthAllowsScanning && mIsPrimaryUser && !mSecureCameraLaunched; } Loading Loading @@ -1783,13 +1784,14 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { } /** * If face hardware is available and user has enrolled. Not considering encryption or * lockdown state. * If face hardware is available, user has enrolled and enabled auth via setting. * Not considering encryption or lock down state. */ public boolean isUnlockWithFacePossible(int userId) { return mFaceManager != null && mFaceManager.isHardwareDetected() && !isFaceDisabled(userId) && mFaceManager.hasEnrolledTemplates(userId); && mFaceManager.hasEnrolledTemplates(userId) && mFaceSettingEnabledForUser.get(userId); } private void stopListeningForFingerprint() { Loading Loading @@ -2657,7 +2659,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { pw.println(" possible=" + isUnlockWithFacePossible(userId)); pw.println(" strongAuthFlags=" + Integer.toHexString(strongAuthFlags)); pw.println(" trustManaged=" + getUserTrustIsManaged(userId)); pw.println(" enabledByUser=" + mFaceSettingEnabledForUser); pw.println(" enabledByUser=" + mFaceSettingEnabledForUser.get(userId)); pw.println(" mSecureCameraLaunched=" + mSecureCameraLaunched); } } Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java +8 −4 Original line number Diff line number Diff line Loading @@ -107,6 +107,9 @@ public class UnlockMethodCache { mListeners.remove(listener); } /** * If there are faces enrolled and user enabled face auth on keyguard. */ public boolean isUnlockingWithFacePossible() { return mIsUnlockingWithFacePossible; } Loading @@ -119,15 +122,16 @@ public class UnlockMethodCache { || (Build.IS_DEBUGGABLE && DEBUG_AUTH_WITH_ADB && mDebugUnlocked); boolean trustManaged = mKeyguardUpdateMonitor.getUserTrustIsManaged(user); boolean trusted = mKeyguardUpdateMonitor.getUserHasTrust(user); boolean hasEnrolledFaces = mKeyguardUpdateMonitor.isUnlockWithFacePossible(user); boolean changed = secure != mSecure || canSkipBouncer != mCanSkipBouncer || trustManaged != mTrustManaged || mIsUnlockingWithFacePossible != hasEnrolledFaces; boolean isUnlockingWithFacePossible = mKeyguardUpdateMonitor.isUnlockWithFacePossible(user); boolean changed = secure != mSecure || canSkipBouncer != mCanSkipBouncer || trustManaged != mTrustManaged || mIsUnlockingWithFacePossible != isUnlockingWithFacePossible; if (changed || updateAlways) { mSecure = secure; mCanSkipBouncer = canSkipBouncer; mTrusted = trusted; mTrustManaged = trustManaged; mIsUnlockingWithFacePossible = hasEnrolledFaces; mIsUnlockingWithFacePossible = isUnlockingWithFacePossible; notifyListeners(); } Trace.endSection(); Loading packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -103,7 +103,8 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { when(context.getPackageManager()).thenReturn(mPackageManager); doAnswer(invocation -> { IBiometricEnabledOnKeyguardCallback callback = invocation.getArgument(0); callback.onChanged(BiometricSourceType.FACE, true /* enabled */); callback.onChanged(BiometricSourceType.FACE, true /* enabled */, KeyguardUpdateMonitor.getCurrentUser()); return null; }).when(mBiometricManager).registerEnabledOnKeyguardCallback(any()); when(mFaceManager.isHardwareDetected()).thenReturn(true); Loading services/core/java/com/android/server/biometrics/BiometricService.java +6 −5 Original line number Diff line number Diff line Loading @@ -521,8 +521,8 @@ public class BiometricService extends SystemService { List<EnabledOnKeyguardCallback> callbacks = mEnabledOnKeyguardCallbacks; for (int i = 0; i < callbacks.size(); i++) { callbacks.get(i).notify(BiometricSourceType.FACE, mFaceEnabledOnKeyguard.getOrDefault(userId, DEFAULT_KEYGUARD_ENABLED)); mFaceEnabledOnKeyguard.getOrDefault(userId, DEFAULT_KEYGUARD_ENABLED), userId); } } } Loading @@ -540,9 +540,9 @@ public class BiometricService extends SystemService { } } void notify(BiometricSourceType sourceType, boolean enabled) { void notify(BiometricSourceType sourceType, boolean enabled, int userId) { try { mCallback.onChanged(sourceType, enabled); mCallback.onChanged(sourceType, enabled, userId); } catch (DeadObjectException e) { Slog.w(TAG, "Death while invoking notify", e); mEnabledOnKeyguardCallbacks.remove(this); Loading Loading @@ -796,7 +796,8 @@ public class BiometricService extends SystemService { mEnabledOnKeyguardCallbacks.add(new EnabledOnKeyguardCallback(callback)); try { callback.onChanged(BiometricSourceType.FACE, mSettingObserver.getFaceEnabledOnKeyguard()); mSettingObserver.getFaceEnabledOnKeyguard(), UserHandle.getCallingUserId()); } catch (RemoteException e) { Slog.w(TAG, "Remote exception", e); } Loading Loading
core/java/android/hardware/biometrics/IBiometricEnabledOnKeyguardCallback.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -22,5 +22,5 @@ import android.hardware.biometrics.BiometricSourceType; * @hide */ oneway interface IBiometricEnabledOnKeyguardCallback { void onChanged(in BiometricSourceType type, boolean enabled); void onChanged(in BiometricSourceType type, boolean enabled, int userId); } No newline at end of file
packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +10 −8 Original line number Diff line number Diff line Loading @@ -377,14 +377,15 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { } }; private boolean mFaceSettingEnabledForUser; private SparseBooleanArray mFaceSettingEnabledForUser = new SparseBooleanArray(); private BiometricManager mBiometricManager; private IBiometricEnabledOnKeyguardCallback mBiometricEnabledCallback = new IBiometricEnabledOnKeyguardCallback.Stub() { @Override public void onChanged(BiometricSourceType type, boolean enabled) throws RemoteException { public void onChanged(BiometricSourceType type, boolean enabled, int userId) throws RemoteException { if (type == BiometricSourceType.FACE) { mFaceSettingEnabledForUser = enabled; mFaceSettingEnabledForUser.put(userId, enabled); updateFaceListeningState(); } } Loading Loading @@ -1711,7 +1712,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { // instance of KeyguardUpdateMonitor for each user but KeyguardUpdateMonitor is user-aware. return (mBouncer || mAuthInterruptActive || awakeKeyguard || shouldListenForFaceAssistant()) && !mSwitchingUser && !isFaceDisabled(user) && becauseCannotSkipBouncer && !mKeyguardGoingAway && mFaceSettingEnabledForUser && !mLockIconPressed && !mKeyguardGoingAway && mFaceSettingEnabledForUser.get(user) && !mLockIconPressed && strongAuthAllowsScanning && mIsPrimaryUser && !mSecureCameraLaunched; } Loading Loading @@ -1783,13 +1784,14 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { } /** * If face hardware is available and user has enrolled. Not considering encryption or * lockdown state. * If face hardware is available, user has enrolled and enabled auth via setting. * Not considering encryption or lock down state. */ public boolean isUnlockWithFacePossible(int userId) { return mFaceManager != null && mFaceManager.isHardwareDetected() && !isFaceDisabled(userId) && mFaceManager.hasEnrolledTemplates(userId); && mFaceManager.hasEnrolledTemplates(userId) && mFaceSettingEnabledForUser.get(userId); } private void stopListeningForFingerprint() { Loading Loading @@ -2657,7 +2659,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { pw.println(" possible=" + isUnlockWithFacePossible(userId)); pw.println(" strongAuthFlags=" + Integer.toHexString(strongAuthFlags)); pw.println(" trustManaged=" + getUserTrustIsManaged(userId)); pw.println(" enabledByUser=" + mFaceSettingEnabledForUser); pw.println(" enabledByUser=" + mFaceSettingEnabledForUser.get(userId)); pw.println(" mSecureCameraLaunched=" + mSecureCameraLaunched); } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java +8 −4 Original line number Diff line number Diff line Loading @@ -107,6 +107,9 @@ public class UnlockMethodCache { mListeners.remove(listener); } /** * If there are faces enrolled and user enabled face auth on keyguard. */ public boolean isUnlockingWithFacePossible() { return mIsUnlockingWithFacePossible; } Loading @@ -119,15 +122,16 @@ public class UnlockMethodCache { || (Build.IS_DEBUGGABLE && DEBUG_AUTH_WITH_ADB && mDebugUnlocked); boolean trustManaged = mKeyguardUpdateMonitor.getUserTrustIsManaged(user); boolean trusted = mKeyguardUpdateMonitor.getUserHasTrust(user); boolean hasEnrolledFaces = mKeyguardUpdateMonitor.isUnlockWithFacePossible(user); boolean changed = secure != mSecure || canSkipBouncer != mCanSkipBouncer || trustManaged != mTrustManaged || mIsUnlockingWithFacePossible != hasEnrolledFaces; boolean isUnlockingWithFacePossible = mKeyguardUpdateMonitor.isUnlockWithFacePossible(user); boolean changed = secure != mSecure || canSkipBouncer != mCanSkipBouncer || trustManaged != mTrustManaged || mIsUnlockingWithFacePossible != isUnlockingWithFacePossible; if (changed || updateAlways) { mSecure = secure; mCanSkipBouncer = canSkipBouncer; mTrusted = trusted; mTrustManaged = trustManaged; mIsUnlockingWithFacePossible = hasEnrolledFaces; mIsUnlockingWithFacePossible = isUnlockingWithFacePossible; notifyListeners(); } Trace.endSection(); Loading
packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -103,7 +103,8 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { when(context.getPackageManager()).thenReturn(mPackageManager); doAnswer(invocation -> { IBiometricEnabledOnKeyguardCallback callback = invocation.getArgument(0); callback.onChanged(BiometricSourceType.FACE, true /* enabled */); callback.onChanged(BiometricSourceType.FACE, true /* enabled */, KeyguardUpdateMonitor.getCurrentUser()); return null; }).when(mBiometricManager).registerEnabledOnKeyguardCallback(any()); when(mFaceManager.isHardwareDetected()).thenReturn(true); Loading
services/core/java/com/android/server/biometrics/BiometricService.java +6 −5 Original line number Diff line number Diff line Loading @@ -521,8 +521,8 @@ public class BiometricService extends SystemService { List<EnabledOnKeyguardCallback> callbacks = mEnabledOnKeyguardCallbacks; for (int i = 0; i < callbacks.size(); i++) { callbacks.get(i).notify(BiometricSourceType.FACE, mFaceEnabledOnKeyguard.getOrDefault(userId, DEFAULT_KEYGUARD_ENABLED)); mFaceEnabledOnKeyguard.getOrDefault(userId, DEFAULT_KEYGUARD_ENABLED), userId); } } } Loading @@ -540,9 +540,9 @@ public class BiometricService extends SystemService { } } void notify(BiometricSourceType sourceType, boolean enabled) { void notify(BiometricSourceType sourceType, boolean enabled, int userId) { try { mCallback.onChanged(sourceType, enabled); mCallback.onChanged(sourceType, enabled, userId); } catch (DeadObjectException e) { Slog.w(TAG, "Death while invoking notify", e); mEnabledOnKeyguardCallbacks.remove(this); Loading Loading @@ -796,7 +796,8 @@ public class BiometricService extends SystemService { mEnabledOnKeyguardCallbacks.add(new EnabledOnKeyguardCallback(callback)); try { callback.onChanged(BiometricSourceType.FACE, mSettingObserver.getFaceEnabledOnKeyguard()); mSettingObserver.getFaceEnabledOnKeyguard(), UserHandle.getCallingUserId()); } catch (RemoteException e) { Slog.w(TAG, "Remote exception", e); } Loading