Loading packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +9 −0 Original line number Diff line number Diff line Loading @@ -2067,6 +2067,15 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab return mIsUdfpsEnrolled; } /** * @return if udfps is available on this device. will return true even if the user hasn't * enrolled udfps. */ public boolean isUdfpsAvailable() { return mAuthController.getUdfpsProps() != null && !mAuthController.getUdfpsProps().isEmpty(); } /** * @return true if there's at least one face enrolled */ Loading packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +29 −12 Original line number Diff line number Diff line Loading @@ -77,6 +77,7 @@ import com.android.systemui.keyguard.KeyguardIndication; import com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.statusbar.phone.KeyguardIndicationTextView; import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; import com.android.systemui.statusbar.policy.KeyguardStateController; Loading @@ -100,7 +101,7 @@ public class KeyguardIndicationController { private static final boolean DEBUG_CHARGING_SPEED = false; private static final int MSG_HIDE_TRANSIENT = 1; private static final int MSG_SWIPE_UP_TO_UNLOCK = 2; private static final int MSG_SHOW_ACTION_TO_UNLOCK = 2; private static final long TRANSIENT_BIOMETRIC_ERROR_TIMEOUT = 1300; private static final float BOUNCE_ANIMATION_FINAL_Y = 0f; Loading @@ -121,6 +122,7 @@ public class KeyguardIndicationController { private final LockPatternUtils mLockPatternUtils; private final IActivityManager mIActivityManager; private final FalsingManager mFalsingManager; private final KeyguardBypassController mKeyguardBypassController; protected KeyguardIndicationRotateTextViewController mRotateTextViewController; private BroadcastReceiver mBroadcastReceiver; Loading Loading @@ -175,7 +177,8 @@ public class KeyguardIndicationController { @Main DelayableExecutor executor, FalsingManager falsingManager, LockPatternUtils lockPatternUtils, IActivityManager iActivityManager) { IActivityManager iActivityManager, KeyguardBypassController keyguardBypassController) { mContext = context; mBroadcastDispatcher = broadcastDispatcher; mDevicePolicyManager = devicePolicyManager; Loading @@ -191,6 +194,7 @@ public class KeyguardIndicationController { mLockPatternUtils = lockPatternUtils; mIActivityManager = iActivityManager; mFalsingManager = falsingManager; mKeyguardBypassController = keyguardBypassController; } Loading Loading @@ -593,7 +597,7 @@ public class KeyguardIndicationController { mTransientIndication = transientIndication; mHideTransientMessageOnScreenOff = hideOnScreenOff && transientIndication != null; mHandler.removeMessages(MSG_HIDE_TRANSIENT); mHandler.removeMessages(MSG_SWIPE_UP_TO_UNLOCK); mHandler.removeMessages(MSG_SHOW_ACTION_TO_UNLOCK); if (mDozing && !TextUtils.isEmpty(mTransientIndication)) { // Make sure this doesn't get stuck and burns in. Acquire wakelock until its cleared. mWakeLock.setAcquired(true); Loading Loading @@ -785,29 +789,37 @@ public class KeyguardIndicationController { public void handleMessage(Message msg) { if (msg.what == MSG_HIDE_TRANSIENT) { hideTransientIndication(); } else if (msg.what == MSG_SWIPE_UP_TO_UNLOCK) { showSwipeUpToUnlock(); } else if (msg.what == MSG_SHOW_ACTION_TO_UNLOCK) { showActionToUnlock(); } } }; private void showSwipeUpToUnlock() { /** * Show message on the keyguard for how the user can unlock/enter their device. */ public void showActionToUnlock() { if (mDozing) { return; } if (mStatusBarKeyguardViewManager.isBouncerShowing()) { if (mStatusBarKeyguardViewManager.isShowingAlternateAuth()) { return; // udfps affordance is highlighted, no need to surface face auth error } else { return; // udfps affordance is highlighted, no need to show action to unlock } else if (mKeyguardUpdateMonitor.isFaceEnrolled()) { String message = mContext.getString(R.string.keyguard_retry); mStatusBarKeyguardViewManager.showBouncerMessage(message, mInitialTextColorState); } } else if (mKeyguardUpdateMonitor.isScreenOn()) { if (mKeyguardUpdateMonitor.isUdfpsAvailable()) { showTransientIndication(mContext.getString(R.string.keyguard_unlock_press), false /* isError */, true /* hideOnScreenOff */); } else { showTransientIndication(mContext.getString(R.string.keyguard_unlock), false /* isError */, true /* hideOnScreenOff */); } } } public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { pw.println("KeyguardIndicationController:"); Loading Loading @@ -894,7 +906,7 @@ public class KeyguardIndicationController { showTransientIndication(helpString, false /* isError */, showSwipeToUnlock); } if (showSwipeToUnlock) { mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_SWIPE_UP_TO_UNLOCK), mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_SHOW_ACTION_TO_UNLOCK), TRANSIENT_BIOMETRIC_ERROR_TIMEOUT); } } Loading Loading @@ -928,7 +940,7 @@ public class KeyguardIndicationController { ); } else { // suggest swiping up to unlock (try face auth again or swipe up to bouncer) showSwipeUpToUnlock(); showActionToUnlock(); } } else if (mStatusBarKeyguardViewManager.isBouncerShowing()) { mStatusBarKeyguardViewManager.showBouncerMessage(errString, mInitialTextColorState); Loading Loading @@ -1010,6 +1022,11 @@ public class KeyguardIndicationController { boolean isStrongBiometric) { super.onBiometricAuthenticated(userId, biometricSourceType, isStrongBiometric); mHandler.sendEmptyMessage(MSG_HIDE_TRANSIENT); if (biometricSourceType == BiometricSourceType.FACE && !mKeyguardBypassController.canBypass()) { mHandler.sendEmptyMessage(MSG_SHOW_ACTION_TO_UNLOCK); } } @Override Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +1 −1 Original line number Diff line number Diff line Loading @@ -3979,7 +3979,7 @@ public class StatusBar extends SystemUI implements DemoMode, public void onUnlockHintStarted() { mFalsingCollector.onUnlockHintStarted(); mKeyguardIndicationController.showTransientIndication(R.string.keyguard_unlock); mKeyguardIndicationController.showActionToUnlock(); } public void onHintFinished() { Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java +6 −1 Original line number Diff line number Diff line Loading @@ -81,6 +81,7 @@ import com.android.systemui.keyguard.KeyguardIndication; import com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.statusbar.phone.KeyguardIndicationTextView; import com.android.systemui.statusbar.phone.LockIcon; import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; Loading Loading @@ -146,6 +147,8 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { private LockPatternUtils mLockPatternUtils; @Mock private IActivityManager mIActivityManager; @Mock private KeyguardBypassController mKeyguardBypassController; @Captor private ArgumentCaptor<DockManager.AlignmentStateListener> mAlignmentListener; @Captor Loading Loading @@ -216,7 +219,8 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { mController = new KeyguardIndicationController(mContext, mWakeLockBuilder, mKeyguardStateController, mStatusBarStateController, mKeyguardUpdateMonitor, mDockManager, mBroadcastDispatcher, mDevicePolicyManager, mIBatteryStats, mUserManager, mExecutor, mFalsingManager, mLockPatternUtils, mIActivityManager); mUserManager, mExecutor, mFalsingManager, mLockPatternUtils, mIActivityManager, mKeyguardBypassController); mController.init(); mController.setIndicationArea(mIndicationArea); verify(mStatusBarStateController).addCallback(mStatusBarStateListenerCaptor.capture()); Loading Loading @@ -507,6 +511,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { createController(); String message = mContext.getString(R.string.keyguard_retry); when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(true); when(mKeyguardUpdateMonitor.isFaceEnrolled()).thenReturn(true); mController.setVisible(true); mController.getKeyguardCallback().onBiometricError(FaceManager.FACE_ERROR_TIMEOUT, Loading Loading
packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +9 −0 Original line number Diff line number Diff line Loading @@ -2067,6 +2067,15 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab return mIsUdfpsEnrolled; } /** * @return if udfps is available on this device. will return true even if the user hasn't * enrolled udfps. */ public boolean isUdfpsAvailable() { return mAuthController.getUdfpsProps() != null && !mAuthController.getUdfpsProps().isEmpty(); } /** * @return true if there's at least one face enrolled */ Loading
packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +29 −12 Original line number Diff line number Diff line Loading @@ -77,6 +77,7 @@ import com.android.systemui.keyguard.KeyguardIndication; import com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.statusbar.phone.KeyguardIndicationTextView; import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; import com.android.systemui.statusbar.policy.KeyguardStateController; Loading @@ -100,7 +101,7 @@ public class KeyguardIndicationController { private static final boolean DEBUG_CHARGING_SPEED = false; private static final int MSG_HIDE_TRANSIENT = 1; private static final int MSG_SWIPE_UP_TO_UNLOCK = 2; private static final int MSG_SHOW_ACTION_TO_UNLOCK = 2; private static final long TRANSIENT_BIOMETRIC_ERROR_TIMEOUT = 1300; private static final float BOUNCE_ANIMATION_FINAL_Y = 0f; Loading @@ -121,6 +122,7 @@ public class KeyguardIndicationController { private final LockPatternUtils mLockPatternUtils; private final IActivityManager mIActivityManager; private final FalsingManager mFalsingManager; private final KeyguardBypassController mKeyguardBypassController; protected KeyguardIndicationRotateTextViewController mRotateTextViewController; private BroadcastReceiver mBroadcastReceiver; Loading Loading @@ -175,7 +177,8 @@ public class KeyguardIndicationController { @Main DelayableExecutor executor, FalsingManager falsingManager, LockPatternUtils lockPatternUtils, IActivityManager iActivityManager) { IActivityManager iActivityManager, KeyguardBypassController keyguardBypassController) { mContext = context; mBroadcastDispatcher = broadcastDispatcher; mDevicePolicyManager = devicePolicyManager; Loading @@ -191,6 +194,7 @@ public class KeyguardIndicationController { mLockPatternUtils = lockPatternUtils; mIActivityManager = iActivityManager; mFalsingManager = falsingManager; mKeyguardBypassController = keyguardBypassController; } Loading Loading @@ -593,7 +597,7 @@ public class KeyguardIndicationController { mTransientIndication = transientIndication; mHideTransientMessageOnScreenOff = hideOnScreenOff && transientIndication != null; mHandler.removeMessages(MSG_HIDE_TRANSIENT); mHandler.removeMessages(MSG_SWIPE_UP_TO_UNLOCK); mHandler.removeMessages(MSG_SHOW_ACTION_TO_UNLOCK); if (mDozing && !TextUtils.isEmpty(mTransientIndication)) { // Make sure this doesn't get stuck and burns in. Acquire wakelock until its cleared. mWakeLock.setAcquired(true); Loading Loading @@ -785,29 +789,37 @@ public class KeyguardIndicationController { public void handleMessage(Message msg) { if (msg.what == MSG_HIDE_TRANSIENT) { hideTransientIndication(); } else if (msg.what == MSG_SWIPE_UP_TO_UNLOCK) { showSwipeUpToUnlock(); } else if (msg.what == MSG_SHOW_ACTION_TO_UNLOCK) { showActionToUnlock(); } } }; private void showSwipeUpToUnlock() { /** * Show message on the keyguard for how the user can unlock/enter their device. */ public void showActionToUnlock() { if (mDozing) { return; } if (mStatusBarKeyguardViewManager.isBouncerShowing()) { if (mStatusBarKeyguardViewManager.isShowingAlternateAuth()) { return; // udfps affordance is highlighted, no need to surface face auth error } else { return; // udfps affordance is highlighted, no need to show action to unlock } else if (mKeyguardUpdateMonitor.isFaceEnrolled()) { String message = mContext.getString(R.string.keyguard_retry); mStatusBarKeyguardViewManager.showBouncerMessage(message, mInitialTextColorState); } } else if (mKeyguardUpdateMonitor.isScreenOn()) { if (mKeyguardUpdateMonitor.isUdfpsAvailable()) { showTransientIndication(mContext.getString(R.string.keyguard_unlock_press), false /* isError */, true /* hideOnScreenOff */); } else { showTransientIndication(mContext.getString(R.string.keyguard_unlock), false /* isError */, true /* hideOnScreenOff */); } } } public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { pw.println("KeyguardIndicationController:"); Loading Loading @@ -894,7 +906,7 @@ public class KeyguardIndicationController { showTransientIndication(helpString, false /* isError */, showSwipeToUnlock); } if (showSwipeToUnlock) { mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_SWIPE_UP_TO_UNLOCK), mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_SHOW_ACTION_TO_UNLOCK), TRANSIENT_BIOMETRIC_ERROR_TIMEOUT); } } Loading Loading @@ -928,7 +940,7 @@ public class KeyguardIndicationController { ); } else { // suggest swiping up to unlock (try face auth again or swipe up to bouncer) showSwipeUpToUnlock(); showActionToUnlock(); } } else if (mStatusBarKeyguardViewManager.isBouncerShowing()) { mStatusBarKeyguardViewManager.showBouncerMessage(errString, mInitialTextColorState); Loading Loading @@ -1010,6 +1022,11 @@ public class KeyguardIndicationController { boolean isStrongBiometric) { super.onBiometricAuthenticated(userId, biometricSourceType, isStrongBiometric); mHandler.sendEmptyMessage(MSG_HIDE_TRANSIENT); if (biometricSourceType == BiometricSourceType.FACE && !mKeyguardBypassController.canBypass()) { mHandler.sendEmptyMessage(MSG_SHOW_ACTION_TO_UNLOCK); } } @Override Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +1 −1 Original line number Diff line number Diff line Loading @@ -3979,7 +3979,7 @@ public class StatusBar extends SystemUI implements DemoMode, public void onUnlockHintStarted() { mFalsingCollector.onUnlockHintStarted(); mKeyguardIndicationController.showTransientIndication(R.string.keyguard_unlock); mKeyguardIndicationController.showActionToUnlock(); } public void onHintFinished() { Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java +6 −1 Original line number Diff line number Diff line Loading @@ -81,6 +81,7 @@ import com.android.systemui.keyguard.KeyguardIndication; import com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.statusbar.phone.KeyguardIndicationTextView; import com.android.systemui.statusbar.phone.LockIcon; import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; Loading Loading @@ -146,6 +147,8 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { private LockPatternUtils mLockPatternUtils; @Mock private IActivityManager mIActivityManager; @Mock private KeyguardBypassController mKeyguardBypassController; @Captor private ArgumentCaptor<DockManager.AlignmentStateListener> mAlignmentListener; @Captor Loading Loading @@ -216,7 +219,8 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { mController = new KeyguardIndicationController(mContext, mWakeLockBuilder, mKeyguardStateController, mStatusBarStateController, mKeyguardUpdateMonitor, mDockManager, mBroadcastDispatcher, mDevicePolicyManager, mIBatteryStats, mUserManager, mExecutor, mFalsingManager, mLockPatternUtils, mIActivityManager); mUserManager, mExecutor, mFalsingManager, mLockPatternUtils, mIActivityManager, mKeyguardBypassController); mController.init(); mController.setIndicationArea(mIndicationArea); verify(mStatusBarStateController).addCallback(mStatusBarStateListenerCaptor.capture()); Loading Loading @@ -507,6 +511,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { createController(); String message = mContext.getString(R.string.keyguard_retry); when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(true); when(mKeyguardUpdateMonitor.isFaceEnrolled()).thenReturn(true); mController.setVisible(true); mController.getKeyguardCallback().onBiometricError(FaceManager.FACE_ERROR_TIMEOUT, Loading