Loading packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +22 −18 Original line number Diff line number Diff line Loading @@ -94,7 +94,7 @@ import javax.inject.Inject; * Controls the indications and error messages shown on the Keyguard */ @SysUISingleton public class KeyguardIndicationController implements KeyguardStateController.Callback { public class KeyguardIndicationController { private static final String TAG = "KeyguardIndication"; private static final boolean DEBUG_CHARGING_SPEED = false; Loading Loading @@ -206,7 +206,7 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal mKeyguardUpdateMonitor.registerCallback(getKeyguardCallback()); mKeyguardUpdateMonitor.registerCallback(mTickReceiver); mStatusBarStateController.addCallback(mStatusBarStateListener); mKeyguardStateController.addCallback(this); mKeyguardStateController.addCallback(mKeyguardStateCallback); mStatusBarStateListener.onDozingChanged(mStatusBarStateController.isDozing()); } Loading Loading @@ -827,11 +827,6 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal mRotateTextViewController.dump(fd, pw, args); } @Override public void onUnlockedChanged() { updateIndication(false); } protected class BaseKeyguardCallback extends KeyguardUpdateMonitorCallback { public static final int HIDE_DELAY_MS = 5000; Loading Loading @@ -890,10 +885,7 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal mStatusBarKeyguardViewManager.showBouncerMessage(helpString, mInitialTextColorState); } else if (mKeyguardUpdateMonitor.isScreenOn()) { if (biometricSourceType == BiometricSourceType.FACE && shouldSuppressFaceMsgAndShowTryFingerprintMsg()) { // suggest trying fingerprint showTransientIndication(R.string.keyguard_try_fingerprint); if (biometricSourceType == BiometricSourceType.FACE && shouldSuppressFaceMsg()) { return; } showTransientIndication(helpString, false /* isError */, showSwipeToUnlock); Loading @@ -911,11 +903,9 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal return; } if (biometricSourceType == BiometricSourceType.FACE && shouldSuppressFaceMsgAndShowTryFingerprintMsg() && shouldSuppressFaceMsg() && !mStatusBarKeyguardViewManager.isBouncerShowing() && mKeyguardUpdateMonitor.isScreenOn()) { // suggest trying fingerprint showTransientIndication(R.string.keyguard_try_fingerprint); return; } if (msgId == FaceManager.FACE_ERROR_TIMEOUT) { Loading Loading @@ -966,11 +956,9 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal || msgId == FingerprintManager.FINGERPRINT_ERROR_USER_CANCELED); } private boolean shouldSuppressFaceMsgAndShowTryFingerprintMsg() { // For dual biometric, don't show face auth messages unless face auth was explicitly // requested by the user. private boolean shouldSuppressFaceMsg() { // For dual biometric, don't show face auth messages return mKeyguardUpdateMonitor.isFingerprintDetectionRunning() && !mKeyguardUpdateMonitor.isFaceAuthUserRequested() && mKeyguardUpdateMonitor.isUnlockingWithBiometricAllowed( true /* isStrongBiometric */); } Loading Loading @@ -1068,4 +1056,20 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal updateIndication(false); } }; private KeyguardStateController.Callback mKeyguardStateCallback = new KeyguardStateController.Callback() { @Override public void onUnlockedChanged() { updateIndication(false); } @Override public void onKeyguardShowingChanged() { if (!mKeyguardStateController.isShowing()) { mTopIndicationView.clearMessages(); mLockScreenIndicationView.clearMessages(); } } }; } packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardIndicationTextView.java +8 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,14 @@ public class KeyguardIndicationTextView extends TextView { super(context, attrs, defStyleAttr, defStyleRes); } /** * Clears message queue. */ public void clearMessages() { mMessages.clear(); mKeyguardIndicationInfo.clear(); } /** * Changes the text with an animation and makes sure a single indication is shown long enough. */ Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java +9 −2 Original line number Diff line number Diff line Loading @@ -154,6 +154,9 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { private ArgumentCaptor<BroadcastReceiver> mBroadcastReceiverCaptor; @Captor private ArgumentCaptor<KeyguardIndication> mKeyguardIndicationCaptor; @Captor private ArgumentCaptor<KeyguardStateController.Callback> mKeyguardStateControllerCallbackCaptor; private KeyguardStateController.Callback mKeyguardStateControllerCallback; private StatusBarStateController.StateListener mStatusBarStateListener; private BroadcastReceiver mBroadcastReceiver; private FakeExecutor mExecutor = new FakeExecutor(new FakeSystemClock()); Loading Loading @@ -223,6 +226,10 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { mController.mRotateTextViewController = mRotateTextViewController; mController.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager); clearInvocations(mIBatteryStats); verify(mKeyguardStateController).addCallback( mKeyguardStateControllerCallbackCaptor.capture()); mKeyguardStateControllerCallback = mKeyguardStateControllerCallbackCaptor.getValue(); } @Test Loading Loading @@ -529,7 +536,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { reset(mKeyguardUpdateMonitor); when(mKeyguardUpdateMonitor.isUserUnlocked(anyInt())).thenReturn(true); when(mKeyguardUpdateMonitor.getUserHasTrust(anyInt())).thenReturn(false); mController.onUnlockedChanged(); mKeyguardStateControllerCallback.onUnlockedChanged(); verifyIndicationMessage(INDICATION_TYPE_RESTING, restingIndication); } Loading Loading @@ -572,7 +579,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { @Test public void updateMonitor_listener() { createController(); verify(mKeyguardStateController).addCallback(eq(mController)); verify(mKeyguardStateController).addCallback(any()); verify(mKeyguardUpdateMonitor, times(2)).registerCallback(any()); } Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +22 −18 Original line number Diff line number Diff line Loading @@ -94,7 +94,7 @@ import javax.inject.Inject; * Controls the indications and error messages shown on the Keyguard */ @SysUISingleton public class KeyguardIndicationController implements KeyguardStateController.Callback { public class KeyguardIndicationController { private static final String TAG = "KeyguardIndication"; private static final boolean DEBUG_CHARGING_SPEED = false; Loading Loading @@ -206,7 +206,7 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal mKeyguardUpdateMonitor.registerCallback(getKeyguardCallback()); mKeyguardUpdateMonitor.registerCallback(mTickReceiver); mStatusBarStateController.addCallback(mStatusBarStateListener); mKeyguardStateController.addCallback(this); mKeyguardStateController.addCallback(mKeyguardStateCallback); mStatusBarStateListener.onDozingChanged(mStatusBarStateController.isDozing()); } Loading Loading @@ -827,11 +827,6 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal mRotateTextViewController.dump(fd, pw, args); } @Override public void onUnlockedChanged() { updateIndication(false); } protected class BaseKeyguardCallback extends KeyguardUpdateMonitorCallback { public static final int HIDE_DELAY_MS = 5000; Loading Loading @@ -890,10 +885,7 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal mStatusBarKeyguardViewManager.showBouncerMessage(helpString, mInitialTextColorState); } else if (mKeyguardUpdateMonitor.isScreenOn()) { if (biometricSourceType == BiometricSourceType.FACE && shouldSuppressFaceMsgAndShowTryFingerprintMsg()) { // suggest trying fingerprint showTransientIndication(R.string.keyguard_try_fingerprint); if (biometricSourceType == BiometricSourceType.FACE && shouldSuppressFaceMsg()) { return; } showTransientIndication(helpString, false /* isError */, showSwipeToUnlock); Loading @@ -911,11 +903,9 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal return; } if (biometricSourceType == BiometricSourceType.FACE && shouldSuppressFaceMsgAndShowTryFingerprintMsg() && shouldSuppressFaceMsg() && !mStatusBarKeyguardViewManager.isBouncerShowing() && mKeyguardUpdateMonitor.isScreenOn()) { // suggest trying fingerprint showTransientIndication(R.string.keyguard_try_fingerprint); return; } if (msgId == FaceManager.FACE_ERROR_TIMEOUT) { Loading Loading @@ -966,11 +956,9 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal || msgId == FingerprintManager.FINGERPRINT_ERROR_USER_CANCELED); } private boolean shouldSuppressFaceMsgAndShowTryFingerprintMsg() { // For dual biometric, don't show face auth messages unless face auth was explicitly // requested by the user. private boolean shouldSuppressFaceMsg() { // For dual biometric, don't show face auth messages return mKeyguardUpdateMonitor.isFingerprintDetectionRunning() && !mKeyguardUpdateMonitor.isFaceAuthUserRequested() && mKeyguardUpdateMonitor.isUnlockingWithBiometricAllowed( true /* isStrongBiometric */); } Loading Loading @@ -1068,4 +1056,20 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal updateIndication(false); } }; private KeyguardStateController.Callback mKeyguardStateCallback = new KeyguardStateController.Callback() { @Override public void onUnlockedChanged() { updateIndication(false); } @Override public void onKeyguardShowingChanged() { if (!mKeyguardStateController.isShowing()) { mTopIndicationView.clearMessages(); mLockScreenIndicationView.clearMessages(); } } }; }
packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardIndicationTextView.java +8 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,14 @@ public class KeyguardIndicationTextView extends TextView { super(context, attrs, defStyleAttr, defStyleRes); } /** * Clears message queue. */ public void clearMessages() { mMessages.clear(); mKeyguardIndicationInfo.clear(); } /** * Changes the text with an animation and makes sure a single indication is shown long enough. */ Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java +9 −2 Original line number Diff line number Diff line Loading @@ -154,6 +154,9 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { private ArgumentCaptor<BroadcastReceiver> mBroadcastReceiverCaptor; @Captor private ArgumentCaptor<KeyguardIndication> mKeyguardIndicationCaptor; @Captor private ArgumentCaptor<KeyguardStateController.Callback> mKeyguardStateControllerCallbackCaptor; private KeyguardStateController.Callback mKeyguardStateControllerCallback; private StatusBarStateController.StateListener mStatusBarStateListener; private BroadcastReceiver mBroadcastReceiver; private FakeExecutor mExecutor = new FakeExecutor(new FakeSystemClock()); Loading Loading @@ -223,6 +226,10 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { mController.mRotateTextViewController = mRotateTextViewController; mController.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager); clearInvocations(mIBatteryStats); verify(mKeyguardStateController).addCallback( mKeyguardStateControllerCallbackCaptor.capture()); mKeyguardStateControllerCallback = mKeyguardStateControllerCallbackCaptor.getValue(); } @Test Loading Loading @@ -529,7 +536,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { reset(mKeyguardUpdateMonitor); when(mKeyguardUpdateMonitor.isUserUnlocked(anyInt())).thenReturn(true); when(mKeyguardUpdateMonitor.getUserHasTrust(anyInt())).thenReturn(false); mController.onUnlockedChanged(); mKeyguardStateControllerCallback.onUnlockedChanged(); verifyIndicationMessage(INDICATION_TYPE_RESTING, restingIndication); } Loading Loading @@ -572,7 +579,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { @Test public void updateMonitor_listener() { createController(); verify(mKeyguardStateController).addCallback(eq(mController)); verify(mKeyguardStateController).addCallback(any()); verify(mKeyguardUpdateMonitor, times(2)).registerCallback(any()); } Loading