diff options
| author | 2022-11-16 22:25:30 +0000 | |
|---|---|---|
| committer | 2022-11-16 22:25:30 +0000 | |
| commit | 3c3ac139abc37c67c1345f95de8161fe2c74e986 (patch) | |
| tree | 8e6909fbc6a9c2c89a708ad68f4bead108b0b3a1 | |
| parent | d16866aaf3d36e48df586ab9e8c4a36afd8fa67f (diff) | |
| parent | 278272cd3b1cffd3670945b05aa678d9d356f1fb (diff) | |
Merge "Update lock screen messages to match UX expectations." into tm-qpr-dev
3 files changed, 57 insertions, 45 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewController.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewController.java index f84a5e39163f..9235e10209d4 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewController.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewController.java @@ -375,7 +375,7 @@ public class KeyguardIndicationRotateTextViewController extends public static final int INDICATION_TYPE_ALIGNMENT = 4; public static final int INDICATION_TYPE_TRANSIENT = 5; public static final int INDICATION_TYPE_TRUST = 6; - public static final int INDICATION_TYPE_RESTING = 7; + public static final int INDICATION_TYPE_PERSISTENT_UNLOCK_MESSAGE = 7; public static final int INDICATION_TYPE_USER_LOCKED = 8; public static final int INDICATION_TYPE_REVERSE_CHARGING = 10; public static final int INDICATION_TYPE_BIOMETRIC_MESSAGE = 11; @@ -390,7 +390,7 @@ public class KeyguardIndicationRotateTextViewController extends INDICATION_TYPE_ALIGNMENT, INDICATION_TYPE_TRANSIENT, INDICATION_TYPE_TRUST, - INDICATION_TYPE_RESTING, + INDICATION_TYPE_PERSISTENT_UNLOCK_MESSAGE, INDICATION_TYPE_USER_LOCKED, INDICATION_TYPE_REVERSE_CHARGING, INDICATION_TYPE_BIOMETRIC_MESSAGE, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java index d21f2abea513..0f27420e22b0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java @@ -36,7 +36,7 @@ import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewCont import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_DISCLOSURE; import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_LOGOUT; import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_OWNER_INFO; -import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_RESTING; +import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_PERSISTENT_UNLOCK_MESSAGE; import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_TRUST; import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_USER_LOCKED; import static com.android.systemui.keyguard.ScreenLifecycle.SCREEN_ON; @@ -161,7 +161,7 @@ public class KeyguardIndicationController { private BroadcastReceiver mBroadcastReceiver; private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager; - private String mRestingIndication; + private String mPersistentUnlockMessage; private String mAlignmentIndication; private CharSequence mTrustGrantedIndication; private CharSequence mTransientIndication; @@ -379,7 +379,7 @@ public class KeyguardIndicationController { updateLockScreenTrustMsg(userId, getTrustGrantedIndication(), getTrustManagedIndication()); updateLockScreenAlignmentMsg(); updateLockScreenLogoutView(); - updateLockScreenRestingMsg(); + updateLockScreenPersistentUnlockMsg(); } private void updateOrganizedOwnedDevice() { @@ -485,7 +485,8 @@ public class KeyguardIndicationController { } private void updateLockScreenUserLockedMsg(int userId) { - if (!mKeyguardUpdateMonitor.isUserUnlocked(userId)) { + if (!mKeyguardUpdateMonitor.isUserUnlocked(userId) + || mKeyguardUpdateMonitor.isEncryptedOrLockdown(userId)) { mRotateTextViewController.updateIndication( INDICATION_TYPE_USER_LOCKED, new KeyguardIndication.Builder() @@ -590,18 +591,17 @@ public class KeyguardIndicationController { } } - private void updateLockScreenRestingMsg() { - if (!TextUtils.isEmpty(mRestingIndication) - && !mRotateTextViewController.hasIndications()) { + private void updateLockScreenPersistentUnlockMsg() { + if (!TextUtils.isEmpty(mPersistentUnlockMessage)) { mRotateTextViewController.updateIndication( - INDICATION_TYPE_RESTING, + INDICATION_TYPE_PERSISTENT_UNLOCK_MESSAGE, new KeyguardIndication.Builder() - .setMessage(mRestingIndication) + .setMessage(mPersistentUnlockMessage) .setTextColor(mInitialTextColorState) .build(), - false); + true); } else { - mRotateTextViewController.hideIndication(INDICATION_TYPE_RESTING); + mRotateTextViewController.hideIndication(INDICATION_TYPE_PERSISTENT_UNLOCK_MESSAGE); } } @@ -684,11 +684,8 @@ public class KeyguardIndicationController { } } - /** - * Sets the indication that is shown if nothing else is showing. - */ - public void setRestingIndication(String restingIndication) { - mRestingIndication = restingIndication; + private void setPersistentUnlockMessage(String persistentUnlockMessage) { + mPersistentUnlockMessage = persistentUnlockMessage; updateDeviceEntryIndication(false); } @@ -1122,6 +1119,9 @@ public class KeyguardIndicationController { public void onLockedOutStateChanged(BiometricSourceType biometricSourceType) { if (biometricSourceType == FACE && !mKeyguardUpdateMonitor.isFaceLockedOut()) { mFaceLockedOutThisAuthSession = false; + } else if (biometricSourceType == FINGERPRINT) { + setPersistentUnlockMessage(mKeyguardUpdateMonitor.isFingerprintLockedOut() + ? mContext.getString(R.string.keyguard_unlock) : ""); } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java index a64722a3c4bc..c280ec8c4ec8 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java @@ -32,10 +32,9 @@ import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewCont import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_DISCLOSURE; import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_LOGOUT; import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_OWNER_INFO; -import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_RESTING; +import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_PERSISTENT_UNLOCK_MESSAGE; import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_TRANSIENT; import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_TRUST; -import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_USER_LOCKED; import static com.android.systemui.keyguard.ScreenLifecycle.SCREEN_OFF; import static com.android.systemui.keyguard.ScreenLifecycle.SCREEN_ON; import static com.android.systemui.keyguard.ScreenLifecycle.SCREEN_TURNING_ON; @@ -831,31 +830,6 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { } @Test - public void updateMonitor_listenerUpdatesIndication() { - createController(); - String restingIndication = "Resting indication"; - reset(mKeyguardUpdateMonitor); - - mController.setVisible(true); - verifyIndicationMessage(INDICATION_TYPE_USER_LOCKED, - mContext.getString(com.android.internal.R.string.lockscreen_storage_locked)); - - reset(mRotateTextViewController); - when(mKeyguardUpdateMonitor.getUserHasTrust(anyInt())).thenReturn(true); - when(mKeyguardUpdateMonitor.isUserUnlocked(anyInt())).thenReturn(true); - mController.setRestingIndication(restingIndication); - verifyHideIndication(INDICATION_TYPE_USER_LOCKED); - verifyIndicationMessage(INDICATION_TYPE_RESTING, restingIndication); - - reset(mRotateTextViewController); - reset(mKeyguardUpdateMonitor); - when(mKeyguardUpdateMonitor.isUserUnlocked(anyInt())).thenReturn(true); - when(mKeyguardUpdateMonitor.getUserHasTrust(anyInt())).thenReturn(false); - mKeyguardStateControllerCallback.onUnlockedChanged(); - verifyIndicationMessage(INDICATION_TYPE_RESTING, restingIndication); - } - - @Test public void onRefreshBatteryInfo_computesChargingTime() throws RemoteException { createController(); BatteryStatus status = new BatteryStatus(BatteryManager.BATTERY_STATUS_CHARGING, @@ -1491,6 +1465,44 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { } @Test + public void onFpLockoutStateChanged_whenFpIsLockedOut_showsPersistentMessage() { + createController(); + mController.setVisible(true); + when(mKeyguardUpdateMonitor.isFingerprintLockedOut()).thenReturn(true); + + mKeyguardUpdateMonitorCallback.onLockedOutStateChanged(BiometricSourceType.FINGERPRINT); + + verifyIndicationShown(INDICATION_TYPE_PERSISTENT_UNLOCK_MESSAGE, + mContext.getString(R.string.keyguard_unlock)); + } + + @Test + public void onFpLockoutStateChanged_whenFpIsNotLockedOut_showsPersistentMessage() { + createController(); + mController.setVisible(true); + clearInvocations(mRotateTextViewController); + when(mKeyguardUpdateMonitor.isFingerprintLockedOut()).thenReturn(false); + + mKeyguardUpdateMonitorCallback.onLockedOutStateChanged(BiometricSourceType.FINGERPRINT); + + verifyHideIndication(INDICATION_TYPE_PERSISTENT_UNLOCK_MESSAGE); + } + + @Test + public void onVisibilityChange_showsPersistentMessage_ifFpIsLockedOut() { + createController(); + mController.setVisible(false); + when(mKeyguardUpdateMonitor.isFingerprintLockedOut()).thenReturn(true); + mKeyguardUpdateMonitorCallback.onLockedOutStateChanged(BiometricSourceType.FINGERPRINT); + clearInvocations(mRotateTextViewController); + + mController.setVisible(true); + + verifyIndicationShown(INDICATION_TYPE_PERSISTENT_UNLOCK_MESSAGE, + mContext.getString(R.string.keyguard_unlock)); + } + + @Test public void onBiometricError_whenFaceIsLocked_onMultipleLockOutErrors_showUnavailableMessage() { createController(); onFaceLockoutError("first lockout"); |