Merge "Add explaination strings to bouncer if biometrics timeout" into tm-qpr-dev am: cf49d6f46f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20129790 Change-Id: Ic06c36f91f45da08ffd3c7d9b2f298d6781fd1ae Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -201,13 +201,13 @@
|
|||||||
<string name="kg_prompt_reason_restart_password">Password required after device restarts</string>
|
<string name="kg_prompt_reason_restart_password">Password required after device restarts</string>
|
||||||
|
|
||||||
<!-- An explanation text that the pattern needs to be solved since the user hasn't used strong authentication since quite some time. [CHAR LIMIT=80] -->
|
<!-- An explanation text that the pattern needs to be solved since the user hasn't used strong authentication since quite some time. [CHAR LIMIT=80] -->
|
||||||
<string name="kg_prompt_reason_timeout_pattern">Pattern required for additional security</string>
|
<string name="kg_prompt_reason_timeout_pattern">For additional security, use pattern instead</string>
|
||||||
|
|
||||||
<!-- An explanation text that the pin needs to be entered since the user hasn't used strong authentication since quite some time. [CHAR LIMIT=80] -->
|
<!-- An explanation text that the pin needs to be entered since the user hasn't used strong authentication since quite some time. [CHAR LIMIT=80] -->
|
||||||
<string name="kg_prompt_reason_timeout_pin">PIN required for additional security</string>
|
<string name="kg_prompt_reason_timeout_pin">For additional security, use PIN instead</string>
|
||||||
|
|
||||||
<!-- An explanation text that the password needs to be entered since the user hasn't used strong authentication since quite some time. [CHAR LIMIT=80] -->
|
<!-- An explanation text that the password needs to be entered since the user hasn't used strong authentication since quite some time. [CHAR LIMIT=80] -->
|
||||||
<string name="kg_prompt_reason_timeout_password">Password required for additional security</string>
|
<string name="kg_prompt_reason_timeout_password">For additional security, use password instead</string>
|
||||||
|
|
||||||
<!-- An explanation text that the credential needs to be entered because a device admin has
|
<!-- An explanation text that the credential needs to be entered because a device admin has
|
||||||
locked the device. [CHAR LIMIT=80] -->
|
locked the device. [CHAR LIMIT=80] -->
|
||||||
|
|||||||
@@ -1428,6 +1428,16 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void notifyNonStrongBiometricStateChanged(int userId) {
|
||||||
|
Assert.isMainThread();
|
||||||
|
for (int i = 0; i < mCallbacks.size(); i++) {
|
||||||
|
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
|
||||||
|
if (cb != null) {
|
||||||
|
cb.onNonStrongBiometricAllowedChanged(userId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void dispatchErrorMessage(CharSequence message) {
|
private void dispatchErrorMessage(CharSequence message) {
|
||||||
Assert.isMainThread();
|
Assert.isMainThread();
|
||||||
for (int i = 0; i < mCallbacks.size(); i++) {
|
for (int i = 0; i < mCallbacks.size(); i++) {
|
||||||
@@ -1778,11 +1788,14 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
|||||||
|
|
||||||
public static class StrongAuthTracker extends LockPatternUtils.StrongAuthTracker {
|
public static class StrongAuthTracker extends LockPatternUtils.StrongAuthTracker {
|
||||||
private final Consumer<Integer> mStrongAuthRequiredChangedCallback;
|
private final Consumer<Integer> mStrongAuthRequiredChangedCallback;
|
||||||
|
private final Consumer<Integer> mNonStrongBiometricAllowedChanged;
|
||||||
|
|
||||||
public StrongAuthTracker(Context context,
|
public StrongAuthTracker(Context context,
|
||||||
Consumer<Integer> strongAuthRequiredChangedCallback) {
|
Consumer<Integer> strongAuthRequiredChangedCallback,
|
||||||
|
Consumer<Integer> nonStrongBiometricAllowedChanged) {
|
||||||
super(context);
|
super(context);
|
||||||
mStrongAuthRequiredChangedCallback = strongAuthRequiredChangedCallback;
|
mStrongAuthRequiredChangedCallback = strongAuthRequiredChangedCallback;
|
||||||
|
mNonStrongBiometricAllowedChanged = nonStrongBiometricAllowedChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUnlockingWithBiometricAllowed(boolean isStrongBiometric) {
|
public boolean isUnlockingWithBiometricAllowed(boolean isStrongBiometric) {
|
||||||
@@ -1800,6 +1813,14 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
|||||||
public void onStrongAuthRequiredChanged(int userId) {
|
public void onStrongAuthRequiredChanged(int userId) {
|
||||||
mStrongAuthRequiredChangedCallback.accept(userId);
|
mStrongAuthRequiredChangedCallback.accept(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(b/247091681): Renaming the inappropriate onIsNonStrongBiometricAllowedChanged
|
||||||
|
// callback wording for Weak/Convenience idle timeout constraint that only allow
|
||||||
|
// Strong-Auth
|
||||||
|
@Override
|
||||||
|
public void onIsNonStrongBiometricAllowedChanged(int userId) {
|
||||||
|
mNonStrongBiometricAllowedChanged.accept(userId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void handleStartedWakingUp() {
|
protected void handleStartedWakingUp() {
|
||||||
@@ -1948,7 +1969,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
|||||||
mSubscriptionManager = subscriptionManager;
|
mSubscriptionManager = subscriptionManager;
|
||||||
mTelephonyListenerManager = telephonyListenerManager;
|
mTelephonyListenerManager = telephonyListenerManager;
|
||||||
mDeviceProvisioned = isDeviceProvisionedInSettingsDb();
|
mDeviceProvisioned = isDeviceProvisionedInSettingsDb();
|
||||||
mStrongAuthTracker = new StrongAuthTracker(context, this::notifyStrongAuthStateChanged);
|
mStrongAuthTracker = new StrongAuthTracker(context, this::notifyStrongAuthStateChanged,
|
||||||
|
this::notifyNonStrongBiometricStateChanged);
|
||||||
mBackgroundExecutor = backgroundExecutor;
|
mBackgroundExecutor = backgroundExecutor;
|
||||||
mBroadcastDispatcher = broadcastDispatcher;
|
mBroadcastDispatcher = broadcastDispatcher;
|
||||||
mInteractionJankMonitor = interactionJankMonitor;
|
mInteractionJankMonitor = interactionJankMonitor;
|
||||||
|
|||||||
@@ -291,4 +291,9 @@ public class KeyguardUpdateMonitorCallback {
|
|||||||
* Called when the notification shade is expanded or collapsed.
|
* Called when the notification shade is expanded or collapsed.
|
||||||
*/
|
*/
|
||||||
public void onShadeExpandedChanged(boolean expanded) { }
|
public void onShadeExpandedChanged(boolean expanded) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the non-strong biometric state changed.
|
||||||
|
*/
|
||||||
|
public void onNonStrongBiometricAllowedChanged(int userId) { }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -794,6 +794,8 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
|
|||||||
KeyguardUpdateMonitor.StrongAuthTracker strongAuthTracker =
|
KeyguardUpdateMonitor.StrongAuthTracker strongAuthTracker =
|
||||||
mUpdateMonitor.getStrongAuthTracker();
|
mUpdateMonitor.getStrongAuthTracker();
|
||||||
int strongAuth = strongAuthTracker.getStrongAuthForUser(currentUser);
|
int strongAuth = strongAuthTracker.getStrongAuthForUser(currentUser);
|
||||||
|
boolean allowedNonStrongAfterIdleTimeout =
|
||||||
|
strongAuthTracker.isNonStrongBiometricAllowedAfterIdleTimeout(currentUser);
|
||||||
|
|
||||||
if (any && !strongAuthTracker.hasUserAuthenticatedSinceBoot()) {
|
if (any && !strongAuthTracker.hasUserAuthenticatedSinceBoot()) {
|
||||||
return KeyguardSecurityView.PROMPT_REASON_RESTART;
|
return KeyguardSecurityView.PROMPT_REASON_RESTART;
|
||||||
@@ -812,6 +814,8 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
|
|||||||
} else if (any && (strongAuth
|
} else if (any && (strongAuth
|
||||||
& STRONG_AUTH_REQUIRED_AFTER_NON_STRONG_BIOMETRICS_TIMEOUT) != 0) {
|
& STRONG_AUTH_REQUIRED_AFTER_NON_STRONG_BIOMETRICS_TIMEOUT) != 0) {
|
||||||
return KeyguardSecurityView.PROMPT_REASON_NON_STRONG_BIOMETRIC_TIMEOUT;
|
return KeyguardSecurityView.PROMPT_REASON_NON_STRONG_BIOMETRIC_TIMEOUT;
|
||||||
|
} else if (any && !allowedNonStrongAfterIdleTimeout) {
|
||||||
|
return KeyguardSecurityView.PROMPT_REASON_NON_STRONG_BIOMETRIC_TIMEOUT;
|
||||||
}
|
}
|
||||||
return KeyguardSecurityView.PROMPT_REASON_NONE;
|
return KeyguardSecurityView.PROMPT_REASON_NONE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,6 +91,11 @@ public class KeyguardBouncer {
|
|||||||
mBouncerPromptReason = mCallback.getBouncerPromptReason();
|
mBouncerPromptReason = mCallback.getBouncerPromptReason();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNonStrongBiometricAllowedChanged(int userId) {
|
||||||
|
mBouncerPromptReason = mCallback.getBouncerPromptReason();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
private final Runnable mRemoveViewRunnable = this::removeView;
|
private final Runnable mRemoveViewRunnable = this::removeView;
|
||||||
private final KeyguardBypassController mKeyguardBypassController;
|
private final KeyguardBypassController mKeyguardBypassController;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package com.android.systemui.keyguard;
|
|||||||
import static android.view.WindowManagerPolicyConstants.OFF_BECAUSE_OF_USER;
|
import static android.view.WindowManagerPolicyConstants.OFF_BECAUSE_OF_USER;
|
||||||
|
|
||||||
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_DPM_LOCK_NOW;
|
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_DPM_LOCK_NOW;
|
||||||
|
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_NON_STRONG_BIOMETRICS_TIMEOUT;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
@@ -228,6 +229,28 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
|
|||||||
mViewMediator.mViewMediatorCallback.getBouncerPromptReason());
|
mViewMediator.mViewMediatorCallback.getBouncerPromptReason());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testBouncerPrompt_nonStrongIdleTimeout() {
|
||||||
|
// GIVEN trust agents enabled and biometrics are enrolled
|
||||||
|
when(mUpdateMonitor.isTrustUsuallyManaged(anyInt())).thenReturn(true);
|
||||||
|
when(mUpdateMonitor.isUnlockingWithBiometricsPossible(anyInt())).thenReturn(true);
|
||||||
|
|
||||||
|
// WHEN the strong auth reason is STRONG_AUTH_REQUIRED_AFTER_NON_STRONG_BIOMETRICS_TIMEOUT
|
||||||
|
KeyguardUpdateMonitor.StrongAuthTracker strongAuthTracker =
|
||||||
|
mock(KeyguardUpdateMonitor.StrongAuthTracker.class);
|
||||||
|
when(mUpdateMonitor.getStrongAuthTracker()).thenReturn(strongAuthTracker);
|
||||||
|
when(strongAuthTracker.hasUserAuthenticatedSinceBoot()).thenReturn(true);
|
||||||
|
when(strongAuthTracker.isNonStrongBiometricAllowedAfterIdleTimeout(
|
||||||
|
anyInt())).thenReturn(false);
|
||||||
|
when(strongAuthTracker.getStrongAuthForUser(anyInt())).thenReturn(
|
||||||
|
STRONG_AUTH_REQUIRED_AFTER_NON_STRONG_BIOMETRICS_TIMEOUT);
|
||||||
|
|
||||||
|
// THEN the bouncer prompt reason should return
|
||||||
|
// STRONG_AUTH_REQUIRED_AFTER_NON_STRONG_BIOMETRICS_TIMEOUT
|
||||||
|
assertEquals(KeyguardSecurityView.PROMPT_REASON_NON_STRONG_BIOMETRIC_TIMEOUT,
|
||||||
|
mViewMediator.mViewMediatorCallback.getBouncerPromptReason());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testHideSurfaceBehindKeyguardMarksKeyguardNotGoingAway() {
|
public void testHideSurfaceBehindKeyguardMarksKeyguardNotGoingAway() {
|
||||||
mViewMediator.hideSurfaceBehindKeyguard();
|
mViewMediator.hideSurfaceBehindKeyguard();
|
||||||
|
|||||||
Reference in New Issue
Block a user