Loading packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +11 −4 Original line number Diff line number Diff line Loading @@ -94,8 +94,10 @@ import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.dagger.qualifiers.Background; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.dump.DumpManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.shared.system.TaskStackChangeListener; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.util.Assert; import com.android.systemui.util.RingerModeTracker; Loading Loading @@ -219,6 +221,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab private final Context mContext; private final boolean mIsPrimaryUser; private final StatusBarStateController mStatusBarStateController; HashMap<Integer, SimData> mSimDatas = new HashMap<>(); HashMap<Integer, ServiceState> mServiceStates = new HashMap<Integer, ServiceState>(); Loading Loading @@ -1521,7 +1524,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab BroadcastDispatcher broadcastDispatcher, DumpManager dumpManager, RingerModeTracker ringerModeTracker, @Background Executor backgroundExecutor) { @Background Executor backgroundExecutor, StatusBarStateController statusBarStateController) { mContext = context; mSubscriptionManager = SubscriptionManager.from(context); mDeviceProvisioned = isDeviceProvisionedInSettingsDb(); Loading @@ -1529,6 +1533,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab mBackgroundExecutor = backgroundExecutor; mBroadcastDispatcher = broadcastDispatcher; mRingerModeTracker = ringerModeTracker; mStatusBarStateController = statusBarStateController; dumpManager.registerDumpable(getClass().getName(), this); mHandler = new Handler(mainLooper) { Loading Loading @@ -1855,8 +1860,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab boolean shouldListenForFace = shouldListenForFace(); if (mFaceRunningState == BIOMETRIC_STATE_RUNNING && !shouldListenForFace) { stopListeningForFace(); } else if (mFaceRunningState != BIOMETRIC_STATE_RUNNING && shouldListenForFace) { } else if (mFaceRunningState != BIOMETRIC_STATE_RUNNING && shouldListenForFace) { startListeningForFace(); } } Loading Loading @@ -1894,7 +1898,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab * If face auth is allows to scan on this exact moment. */ public boolean shouldListenForFace() { final boolean awakeKeyguard = mKeyguardIsVisible && mDeviceInteractive && !mGoingToSleep; final boolean statusBarShadeLocked = mStatusBarStateController.getState() == StatusBarState.SHADE_LOCKED; final boolean awakeKeyguard = mKeyguardIsVisible && mDeviceInteractive && !mGoingToSleep && !statusBarShadeLocked; final int user = getCurrentUser(); final int strongAuth = mStrongAuthTracker.getStrongAuthForUser(user); final boolean isLockDown = Loading packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java +15 −1 Original line number Diff line number Diff line Loading @@ -76,6 +76,8 @@ import com.android.keyguard.KeyguardUpdateMonitor.BiometricAuthenticated; import com.android.systemui.SysuiTestCase; import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.dump.DumpManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.util.RingerModeTracker; Loading Loading @@ -141,6 +143,8 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { private RingerModeTracker mRingerModeTracker; @Mock private LiveData<Integer> mRingerModeLiveData; @Mock private StatusBarStateController mStatusBarStateController; // Direct executor private Executor mBackgroundExecutor = Runnable::run; private TestableLooper mTestableLooper; Loading Loading @@ -417,6 +421,16 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { verify(mFaceManager).authenticate(any(), any(), anyInt(), any(), any(), anyInt()); } @Test public void skipsAuthentication_whenStatusBarShadeLocked() { when(mStatusBarStateController.getState()).thenReturn(StatusBarState.SHADE_LOCKED); mKeyguardUpdateMonitor.dispatchStartedWakingUp(); mTestableLooper.processAllMessages(); mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(true); verify(mFaceManager, never()).authenticate(any(), any(), anyInt(), any(), any(), anyInt()); } @Test public void skipsAuthentication_whenEncryptedKeyguard() { when(mStrongAuthTracker.getStrongAuthForUser(anyInt())).thenReturn( Loading Loading @@ -715,7 +729,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { super(context, TestableLooper.get(KeyguardUpdateMonitorTest.this).getLooper(), mBroadcastDispatcher, mDumpManager, mRingerModeTracker, mBackgroundExecutor); mRingerModeTracker, mBackgroundExecutor, mStatusBarStateController); mStrongAuthTracker = KeyguardUpdateMonitorTest.this.mStrongAuthTracker; } Loading Loading
packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +11 −4 Original line number Diff line number Diff line Loading @@ -94,8 +94,10 @@ import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.dagger.qualifiers.Background; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.dump.DumpManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.shared.system.TaskStackChangeListener; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.util.Assert; import com.android.systemui.util.RingerModeTracker; Loading Loading @@ -219,6 +221,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab private final Context mContext; private final boolean mIsPrimaryUser; private final StatusBarStateController mStatusBarStateController; HashMap<Integer, SimData> mSimDatas = new HashMap<>(); HashMap<Integer, ServiceState> mServiceStates = new HashMap<Integer, ServiceState>(); Loading Loading @@ -1521,7 +1524,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab BroadcastDispatcher broadcastDispatcher, DumpManager dumpManager, RingerModeTracker ringerModeTracker, @Background Executor backgroundExecutor) { @Background Executor backgroundExecutor, StatusBarStateController statusBarStateController) { mContext = context; mSubscriptionManager = SubscriptionManager.from(context); mDeviceProvisioned = isDeviceProvisionedInSettingsDb(); Loading @@ -1529,6 +1533,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab mBackgroundExecutor = backgroundExecutor; mBroadcastDispatcher = broadcastDispatcher; mRingerModeTracker = ringerModeTracker; mStatusBarStateController = statusBarStateController; dumpManager.registerDumpable(getClass().getName(), this); mHandler = new Handler(mainLooper) { Loading Loading @@ -1855,8 +1860,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab boolean shouldListenForFace = shouldListenForFace(); if (mFaceRunningState == BIOMETRIC_STATE_RUNNING && !shouldListenForFace) { stopListeningForFace(); } else if (mFaceRunningState != BIOMETRIC_STATE_RUNNING && shouldListenForFace) { } else if (mFaceRunningState != BIOMETRIC_STATE_RUNNING && shouldListenForFace) { startListeningForFace(); } } Loading Loading @@ -1894,7 +1898,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab * If face auth is allows to scan on this exact moment. */ public boolean shouldListenForFace() { final boolean awakeKeyguard = mKeyguardIsVisible && mDeviceInteractive && !mGoingToSleep; final boolean statusBarShadeLocked = mStatusBarStateController.getState() == StatusBarState.SHADE_LOCKED; final boolean awakeKeyguard = mKeyguardIsVisible && mDeviceInteractive && !mGoingToSleep && !statusBarShadeLocked; final int user = getCurrentUser(); final int strongAuth = mStrongAuthTracker.getStrongAuthForUser(user); final boolean isLockDown = Loading
packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java +15 −1 Original line number Diff line number Diff line Loading @@ -76,6 +76,8 @@ import com.android.keyguard.KeyguardUpdateMonitor.BiometricAuthenticated; import com.android.systemui.SysuiTestCase; import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.dump.DumpManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.util.RingerModeTracker; Loading Loading @@ -141,6 +143,8 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { private RingerModeTracker mRingerModeTracker; @Mock private LiveData<Integer> mRingerModeLiveData; @Mock private StatusBarStateController mStatusBarStateController; // Direct executor private Executor mBackgroundExecutor = Runnable::run; private TestableLooper mTestableLooper; Loading Loading @@ -417,6 +421,16 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { verify(mFaceManager).authenticate(any(), any(), anyInt(), any(), any(), anyInt()); } @Test public void skipsAuthentication_whenStatusBarShadeLocked() { when(mStatusBarStateController.getState()).thenReturn(StatusBarState.SHADE_LOCKED); mKeyguardUpdateMonitor.dispatchStartedWakingUp(); mTestableLooper.processAllMessages(); mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(true); verify(mFaceManager, never()).authenticate(any(), any(), anyInt(), any(), any(), anyInt()); } @Test public void skipsAuthentication_whenEncryptedKeyguard() { when(mStrongAuthTracker.getStrongAuthForUser(anyInt())).thenReturn( Loading Loading @@ -715,7 +729,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { super(context, TestableLooper.get(KeyguardUpdateMonitorTest.this).getLooper(), mBroadcastDispatcher, mDumpManager, mRingerModeTracker, mBackgroundExecutor); mRingerModeTracker, mBackgroundExecutor, mStatusBarStateController); mStrongAuthTracker = KeyguardUpdateMonitorTest.this.mStrongAuthTracker; } Loading