Merge "Hide alternateBouncer onTrustChanges, not biometricAuth" into udc-dev am: 423b9e591e

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/24005115

Change-Id: I1bc92f53a90714b8cd966efffb80dcb0e64e5768
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Beverly Tai
2023-07-14 13:55:38 +00:00
committed by Automerger Merge Worker
2 changed files with 27 additions and 17 deletions

View File

@@ -51,6 +51,7 @@ import com.android.keyguard.KeyguardSecurityModel;
import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.keyguard.KeyguardViewController; import com.android.keyguard.KeyguardViewController;
import com.android.keyguard.TrustGrantFlags;
import com.android.keyguard.ViewMediatorCallback; import com.android.keyguard.ViewMediatorCallback;
import com.android.systemui.biometrics.domain.interactor.UdfpsOverlayInteractor; import com.android.systemui.biometrics.domain.interactor.UdfpsOverlayInteractor;
import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.SysUISingleton;
@@ -305,6 +306,16 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
@Nullable private TaskbarDelegate mTaskbarDelegate; @Nullable private TaskbarDelegate mTaskbarDelegate;
private final KeyguardUpdateMonitorCallback mUpdateMonitorCallback = private final KeyguardUpdateMonitorCallback mUpdateMonitorCallback =
new KeyguardUpdateMonitorCallback() { new KeyguardUpdateMonitorCallback() {
@Override
public void onTrustGrantedForCurrentUser(
boolean dismissKeyguard,
boolean newlyUnlocked,
@NonNull TrustGrantFlags flags,
@Nullable String message
) {
updateAlternateBouncerShowing(mAlternateBouncerInteractor.maybeHide());
}
@Override @Override
public void onEmergencyCallAction() { public void onEmergencyCallAction() {
// Since we won't get a setOccluded call we have to reset the view manually such that // Since we won't get a setOccluded call we have to reset the view manually such that
@@ -430,7 +441,6 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
mDockManager.addListener(mDockEventListener); mDockManager.addListener(mDockEventListener);
mIsDocked = mDockManager.isDocked(); mIsDocked = mDockManager.isDocked();
} }
mKeyguardStateController.addCallback(mKeyguardStateControllerCallback);
} }
/** Register a callback, to be invoked by the Predictive Back system. */ /** Register a callback, to be invoked by the Predictive Back system. */
@@ -1564,14 +1574,6 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|| mode == KeyguardSecurityModel.SecurityMode.SimPuk; || mode == KeyguardSecurityModel.SecurityMode.SimPuk;
} }
private KeyguardStateController.Callback mKeyguardStateControllerCallback =
new KeyguardStateController.Callback() {
@Override
public void onUnlockedChanged() {
updateAlternateBouncerShowing(mAlternateBouncerInteractor.maybeHide());
}
};
/** /**
* Delegate used to send show and hide events to an alternate authentication method instead of * Delegate used to send show and hide events to an alternate authentication method instead of
* the regular pin/pattern/password bouncer. * the regular pin/pattern/password bouncer.

View File

@@ -35,6 +35,7 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import android.service.trust.TrustAgentService;
import android.testing.AndroidTestingRunner; import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper; import android.testing.TestableLooper;
import android.view.MotionEvent; import android.view.MotionEvent;
@@ -57,6 +58,8 @@ import com.android.keyguard.KeyguardMessageArea;
import com.android.keyguard.KeyguardMessageAreaController; import com.android.keyguard.KeyguardMessageAreaController;
import com.android.keyguard.KeyguardSecurityModel; import com.android.keyguard.KeyguardSecurityModel;
import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.keyguard.TrustGrantFlags;
import com.android.keyguard.ViewMediatorCallback; import com.android.keyguard.ViewMediatorCallback;
import com.android.systemui.SysuiTestCase; import com.android.systemui.SysuiTestCase;
import com.android.systemui.biometrics.domain.interactor.UdfpsOverlayInteractor; import com.android.systemui.biometrics.domain.interactor.UdfpsOverlayInteractor;
@@ -84,7 +87,6 @@ import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.SysuiStatusBarStateController; import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.unfold.SysUIUnfoldComponent; import com.android.systemui.unfold.SysUIUnfoldComponent;
import com.google.common.truth.Truth; import com.google.common.truth.Truth;
@@ -153,7 +155,7 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
@Captor @Captor
private ArgumentCaptor<OnBackInvokedCallback> mBackCallbackCaptor; private ArgumentCaptor<OnBackInvokedCallback> mBackCallbackCaptor;
@Captor @Captor
private ArgumentCaptor<KeyguardStateController.Callback> mKeyguardStateControllerCallback; private ArgumentCaptor<KeyguardUpdateMonitorCallback> mKeyguardUpdateMonitorCallback;
@Before @Before
@@ -925,18 +927,24 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
} }
@Test @Test
public void onDeviceUnlocked_hideAlternateBouncerAndClearMessageArea() { public void onTrustChanged_hideAlternateBouncerAndClearMessageArea() {
// GIVEN keyguard update monitor callback is registered
verify(mKeyguardUpdateMonitor).registerCallback(mKeyguardUpdateMonitorCallback.capture());
reset(mKeyguardUpdateMonitor); reset(mKeyguardUpdateMonitor);
reset(mKeyguardMessageAreaController); reset(mKeyguardMessageAreaController);
// GIVEN keyguard state controller callback is registered
verify(mKeyguardStateController).addCallback(mKeyguardStateControllerCallback.capture());
// GIVEN alternate bouncer state = not visible // GIVEN alternate bouncer state = not visible
when(mAlternateBouncerInteractor.isVisibleState()).thenReturn(false); when(mAlternateBouncerInteractor.isVisibleState()).thenReturn(false);
// WHEN the device is unlocked // WHEN the device is trusted by active unlock
mKeyguardStateControllerCallback.getValue().onUnlockedChanged(); mKeyguardUpdateMonitorCallback.getValue().onTrustGrantedForCurrentUser(
true,
true,
new TrustGrantFlags(TrustAgentService.FLAG_GRANT_TRUST_DISMISS_KEYGUARD
| TrustAgentService.FLAG_GRANT_TRUST_TEMPORARY_AND_RENEWABLE),
null
);
// THEN the false visibility state is propagated to the keyguardUpdateMonitor // THEN the false visibility state is propagated to the keyguardUpdateMonitor
verify(mKeyguardUpdateMonitor).setAlternateBouncerShowing(eq(false)); verify(mKeyguardUpdateMonitor).setAlternateBouncerShowing(eq(false));