Hide message on bouncer only if face auth actually runs am: 1b45430325
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20226171 Change-Id: Ib64cd7aef9a2b5c932c54afc5d48fdf570d1ca86 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -219,13 +219,16 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
private SwipeListener mSwipeListener = new SwipeListener() {
|
private final SwipeListener mSwipeListener = new SwipeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onSwipeUp() {
|
public void onSwipeUp() {
|
||||||
if (!mUpdateMonitor.isFaceDetectionRunning()) {
|
if (!mUpdateMonitor.isFaceDetectionRunning()) {
|
||||||
mUpdateMonitor.requestFaceAuth(true, FaceAuthApiRequestReason.SWIPE_UP_ON_BOUNCER);
|
boolean didFaceAuthRun = mUpdateMonitor.requestFaceAuth(true,
|
||||||
|
FaceAuthApiRequestReason.SWIPE_UP_ON_BOUNCER);
|
||||||
mKeyguardSecurityCallback.userActivity();
|
mKeyguardSecurityCallback.userActivity();
|
||||||
showMessage(null, null);
|
if (didFaceAuthRun) {
|
||||||
|
showMessage(null, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (mUpdateMonitor.isFaceEnrolled()) {
|
if (mUpdateMonitor.isFaceEnrolled()) {
|
||||||
mUpdateMonitor.requestActiveUnlock(
|
mUpdateMonitor.requestActiveUnlock(
|
||||||
@@ -234,7 +237,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private ConfigurationController.ConfigurationListener mConfigurationListener =
|
private final ConfigurationController.ConfigurationListener mConfigurationListener =
|
||||||
new ConfigurationController.ConfigurationListener() {
|
new ConfigurationController.ConfigurationListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onThemeChanged() {
|
public void onThemeChanged() {
|
||||||
|
|||||||
@@ -2366,11 +2366,13 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
|||||||
* @param userInitiatedRequest true if the user explicitly requested face auth
|
* @param userInitiatedRequest true if the user explicitly requested face auth
|
||||||
* @param reason One of the reasons {@link FaceAuthApiRequestReason} on why this API is being
|
* @param reason One of the reasons {@link FaceAuthApiRequestReason} on why this API is being
|
||||||
* invoked.
|
* invoked.
|
||||||
|
* @return current face auth detection state, true if it is running.
|
||||||
*/
|
*/
|
||||||
public void requestFaceAuth(boolean userInitiatedRequest,
|
public boolean requestFaceAuth(boolean userInitiatedRequest,
|
||||||
@FaceAuthApiRequestReason String reason) {
|
@FaceAuthApiRequestReason String reason) {
|
||||||
mLogger.logFaceAuthRequested(userInitiatedRequest, reason);
|
mLogger.logFaceAuthRequested(userInitiatedRequest, reason);
|
||||||
updateFaceListeningState(BIOMETRIC_ACTION_START, apiRequestReasonToUiEvent(reason));
|
updateFaceListeningState(BIOMETRIC_ACTION_START, apiRequestReasonToUiEvent(reason));
|
||||||
|
return isFaceDetectionRunning();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3933,20 +3933,19 @@ public final class NotificationPanelViewController {
|
|||||||
mShadeLog.v("onMiddleClicked on Keyguard, mDozingOnDown: false");
|
mShadeLog.v("onMiddleClicked on Keyguard, mDozingOnDown: false");
|
||||||
// Try triggering face auth, this "might" run. Check
|
// Try triggering face auth, this "might" run. Check
|
||||||
// KeyguardUpdateMonitor#shouldListenForFace to see when face auth won't run.
|
// KeyguardUpdateMonitor#shouldListenForFace to see when face auth won't run.
|
||||||
mUpdateMonitor.requestFaceAuth(true,
|
boolean didFaceAuthRun = mUpdateMonitor.requestFaceAuth(true,
|
||||||
FaceAuthApiRequestReason.NOTIFICATION_PANEL_CLICKED);
|
FaceAuthApiRequestReason.NOTIFICATION_PANEL_CLICKED);
|
||||||
|
|
||||||
mLockscreenGestureLogger.write(MetricsEvent.ACTION_LS_HINT,
|
if (didFaceAuthRun) {
|
||||||
0 /* lengthDp - N/A */, 0 /* velocityDp - N/A */);
|
|
||||||
mLockscreenGestureLogger
|
|
||||||
.log(LockscreenUiEvent.LOCKSCREEN_LOCK_SHOW_HINT);
|
|
||||||
if (!mUpdateMonitor.isFaceDetectionRunning()) {
|
|
||||||
startUnlockHintAnimation();
|
|
||||||
}
|
|
||||||
if (mUpdateMonitor.isFaceEnrolled()) {
|
|
||||||
mUpdateMonitor.requestActiveUnlock(
|
mUpdateMonitor.requestActiveUnlock(
|
||||||
ActiveUnlockConfig.ACTIVE_UNLOCK_REQUEST_ORIGIN.UNLOCK_INTENT,
|
ActiveUnlockConfig.ACTIVE_UNLOCK_REQUEST_ORIGIN.UNLOCK_INTENT,
|
||||||
"lockScreenEmptySpaceTap");
|
"lockScreenEmptySpaceTap");
|
||||||
|
} else {
|
||||||
|
mLockscreenGestureLogger.write(MetricsEvent.ACTION_LS_HINT,
|
||||||
|
0 /* lengthDp - N/A */, 0 /* velocityDp - N/A */);
|
||||||
|
mLockscreenGestureLogger
|
||||||
|
.log(LockscreenUiEvent.LOCKSCREEN_LOCK_SHOW_HINT);
|
||||||
|
startUnlockHintAnimation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -146,6 +146,8 @@ public class KeyguardSecurityContainerControllerTest extends SysuiTestCase {
|
|||||||
|
|
||||||
@Captor
|
@Captor
|
||||||
private ArgumentCaptor<KeyguardUpdateMonitorCallback> mKeyguardUpdateMonitorCallback;
|
private ArgumentCaptor<KeyguardUpdateMonitorCallback> mKeyguardUpdateMonitorCallback;
|
||||||
|
@Captor
|
||||||
|
private ArgumentCaptor<KeyguardSecurityContainer.SwipeListener> mSwipeListenerArgumentCaptor;
|
||||||
|
|
||||||
private Configuration mConfiguration;
|
private Configuration mConfiguration;
|
||||||
|
|
||||||
@@ -475,6 +477,64 @@ public class KeyguardSecurityContainerControllerTest extends SysuiTestCase {
|
|||||||
verify(mKeyguardUpdateMonitor, never()).getUserHasTrust(anyInt());
|
verify(mKeyguardUpdateMonitor, never()).getUserHasTrust(anyInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void onSwipeUp_whenFaceDetectionIsNotRunning_initiatesFaceAuth() {
|
||||||
|
KeyguardSecurityContainer.SwipeListener registeredSwipeListener =
|
||||||
|
getRegisteredSwipeListener();
|
||||||
|
when(mKeyguardUpdateMonitor.isFaceDetectionRunning()).thenReturn(false);
|
||||||
|
setupGetSecurityView();
|
||||||
|
|
||||||
|
registeredSwipeListener.onSwipeUp();
|
||||||
|
|
||||||
|
verify(mKeyguardUpdateMonitor).requestFaceAuth(true,
|
||||||
|
FaceAuthApiRequestReason.SWIPE_UP_ON_BOUNCER);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void onSwipeUp_whenFaceDetectionIsRunning_doesNotInitiateFaceAuth() {
|
||||||
|
KeyguardSecurityContainer.SwipeListener registeredSwipeListener =
|
||||||
|
getRegisteredSwipeListener();
|
||||||
|
when(mKeyguardUpdateMonitor.isFaceDetectionRunning()).thenReturn(true);
|
||||||
|
|
||||||
|
registeredSwipeListener.onSwipeUp();
|
||||||
|
|
||||||
|
verify(mKeyguardUpdateMonitor, never())
|
||||||
|
.requestFaceAuth(true,
|
||||||
|
FaceAuthApiRequestReason.SWIPE_UP_ON_BOUNCER);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void onSwipeUp_whenFaceDetectionIsTriggered_hidesBouncerMessage() {
|
||||||
|
KeyguardSecurityContainer.SwipeListener registeredSwipeListener =
|
||||||
|
getRegisteredSwipeListener();
|
||||||
|
when(mKeyguardUpdateMonitor.requestFaceAuth(true,
|
||||||
|
FaceAuthApiRequestReason.SWIPE_UP_ON_BOUNCER)).thenReturn(true);
|
||||||
|
setupGetSecurityView();
|
||||||
|
|
||||||
|
registeredSwipeListener.onSwipeUp();
|
||||||
|
|
||||||
|
verify(mKeyguardPasswordViewControllerMock).showMessage(null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void onSwipeUp_whenFaceDetectionIsNotTriggered_retainsBouncerMessage() {
|
||||||
|
KeyguardSecurityContainer.SwipeListener registeredSwipeListener =
|
||||||
|
getRegisteredSwipeListener();
|
||||||
|
when(mKeyguardUpdateMonitor.requestFaceAuth(true,
|
||||||
|
FaceAuthApiRequestReason.SWIPE_UP_ON_BOUNCER)).thenReturn(false);
|
||||||
|
setupGetSecurityView();
|
||||||
|
|
||||||
|
registeredSwipeListener.onSwipeUp();
|
||||||
|
|
||||||
|
verify(mKeyguardPasswordViewControllerMock, never()).showMessage(null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private KeyguardSecurityContainer.SwipeListener getRegisteredSwipeListener() {
|
||||||
|
mKeyguardSecurityContainerController.onViewAttached();
|
||||||
|
verify(mView).setSwipeListener(mSwipeListenerArgumentCaptor.capture());
|
||||||
|
return mSwipeListenerArgumentCaptor.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
private void setupConditionsToEnableSideFpsHint() {
|
private void setupConditionsToEnableSideFpsHint() {
|
||||||
attachView();
|
attachView();
|
||||||
setSideFpsHintEnabledFromResources(true);
|
setSideFpsHintEnabledFromResources(true);
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import static android.telephony.SubscriptionManager.NAME_SOURCE_CARRIER_ID;
|
|||||||
|
|
||||||
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.SOME_AUTH_REQUIRED_AFTER_USER_REQUEST;
|
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.SOME_AUTH_REQUIRED_AFTER_USER_REQUEST;
|
||||||
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_BOOT;
|
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_BOOT;
|
||||||
|
import static com.android.keyguard.FaceAuthApiRequestReason.NOTIFICATION_PANEL_CLICKED;
|
||||||
import static com.android.keyguard.KeyguardUpdateMonitor.DEFAULT_CANCEL_SIGNAL_TIMEOUT;
|
import static com.android.keyguard.KeyguardUpdateMonitor.DEFAULT_CANCEL_SIGNAL_TIMEOUT;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
@@ -647,6 +648,36 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
|||||||
KeyguardUpdateMonitor.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_TIMEOUT);
|
KeyguardUpdateMonitor.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void requestFaceAuth_whenFaceAuthWasStarted_returnsTrue() throws RemoteException {
|
||||||
|
// This satisfies all the preconditions to run face auth.
|
||||||
|
keyguardNotGoingAway();
|
||||||
|
currentUserIsPrimary();
|
||||||
|
currentUserDoesNotHaveTrust();
|
||||||
|
biometricsNotDisabledThroughDevicePolicyManager();
|
||||||
|
biometricsEnabledForCurrentUser();
|
||||||
|
userNotCurrentlySwitching();
|
||||||
|
bouncerFullyVisibleAndNotGoingToSleep();
|
||||||
|
mTestableLooper.processAllMessages();
|
||||||
|
|
||||||
|
boolean didFaceAuthRun = mKeyguardUpdateMonitor.requestFaceAuth(true,
|
||||||
|
NOTIFICATION_PANEL_CLICKED);
|
||||||
|
|
||||||
|
assertThat(didFaceAuthRun).isTrue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void requestFaceAuth_whenFaceAuthWasNotStarted_returnsFalse() throws RemoteException {
|
||||||
|
// This ensures face auth won't run.
|
||||||
|
biometricsDisabledForCurrentUser();
|
||||||
|
mTestableLooper.processAllMessages();
|
||||||
|
|
||||||
|
boolean didFaceAuthRun = mKeyguardUpdateMonitor.requestFaceAuth(true,
|
||||||
|
NOTIFICATION_PANEL_CLICKED);
|
||||||
|
|
||||||
|
assertThat(didFaceAuthRun).isFalse();
|
||||||
|
}
|
||||||
|
|
||||||
private void testStrongAuthExceptOnBouncer(int strongAuth) {
|
private void testStrongAuthExceptOnBouncer(int strongAuth) {
|
||||||
when(mKeyguardBypassController.canBypass()).thenReturn(true);
|
when(mKeyguardBypassController.canBypass()).thenReturn(true);
|
||||||
mKeyguardUpdateMonitor.setKeyguardBypassController(mKeyguardBypassController);
|
mKeyguardUpdateMonitor.setKeyguardBypassController(mKeyguardBypassController);
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package com.android.systemui.shade;
|
|||||||
|
|
||||||
import static android.content.res.Configuration.ORIENTATION_PORTRAIT;
|
import static android.content.res.Configuration.ORIENTATION_PORTRAIT;
|
||||||
|
|
||||||
|
import static com.android.keyguard.FaceAuthApiRequestReason.NOTIFICATION_PANEL_CLICKED;
|
||||||
import static com.android.keyguard.KeyguardClockSwitch.LARGE;
|
import static com.android.keyguard.KeyguardClockSwitch.LARGE;
|
||||||
import static com.android.keyguard.KeyguardClockSwitch.SMALL;
|
import static com.android.keyguard.KeyguardClockSwitch.SMALL;
|
||||||
import static com.android.systemui.shade.ShadeExpansionStateManagerKt.STATE_CLOSED;
|
import static com.android.systemui.shade.ShadeExpansionStateManagerKt.STATE_CLOSED;
|
||||||
@@ -1606,7 +1607,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
|
|||||||
mNotificationPanelViewController.mStatusBarStateListener;
|
mNotificationPanelViewController.mStatusBarStateListener;
|
||||||
statusBarStateListener.onStateChanged(KEYGUARD);
|
statusBarStateListener.onStateChanged(KEYGUARD);
|
||||||
mNotificationPanelViewController.setDozing(false, false);
|
mNotificationPanelViewController.setDozing(false, false);
|
||||||
when(mUpdateMonitor.isFaceDetectionRunning()).thenReturn(false);
|
when(mUpdateMonitor.requestFaceAuth(true, NOTIFICATION_PANEL_CLICKED)).thenReturn(false);
|
||||||
|
|
||||||
// This sets the dozing state that is read when onMiddleClicked is eventually invoked.
|
// This sets the dozing state that is read when onMiddleClicked is eventually invoked.
|
||||||
mTouchHandler.onTouch(mock(View.class), mDownMotionEvent);
|
mTouchHandler.onTouch(mock(View.class), mDownMotionEvent);
|
||||||
@@ -1621,7 +1622,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
|
|||||||
mNotificationPanelViewController.mStatusBarStateListener;
|
mNotificationPanelViewController.mStatusBarStateListener;
|
||||||
statusBarStateListener.onStateChanged(KEYGUARD);
|
statusBarStateListener.onStateChanged(KEYGUARD);
|
||||||
mNotificationPanelViewController.setDozing(false, false);
|
mNotificationPanelViewController.setDozing(false, false);
|
||||||
when(mUpdateMonitor.isFaceDetectionRunning()).thenReturn(true);
|
when(mUpdateMonitor.requestFaceAuth(true, NOTIFICATION_PANEL_CLICKED)).thenReturn(true);
|
||||||
|
|
||||||
// This sets the dozing state that is read when onMiddleClicked is eventually invoked.
|
// This sets the dozing state that is read when onMiddleClicked is eventually invoked.
|
||||||
mTouchHandler.onTouch(mock(View.class), mDownMotionEvent);
|
mTouchHandler.onTouch(mock(View.class), mDownMotionEvent);
|
||||||
|
|||||||
Reference in New Issue
Block a user