Don't collapse the shade when SHOW_BOUNCER

It's not necessary to track showing a pending
bouncer to show since showing the bouncer now
wakes up the device. It's also not necessary
to collapse the notification panel when
showing the bouncer from an unlock attempt.
This is also an old code path.

Test: atest SystemUITests
Test: MODE_SHOW_BOUNCER from AoD and display off
Test: On a device that supports rear fingerprint
  1. enroll fp
  2. restart device
  3. attempt to authenticate from screen off
  4. see bouncer appears (no regression)
Test:
  1. on device with udfps, expand the shade and
tap on a clickable notification to see the udfps bouncer
  2. Fail udfps 3 times so that the primary bouncer appears
  Observe: the primary bouncer appears instead of going back to LS
Bug: 240637815

Change-Id: I5fcd53c4942a855d15dc1c11e22995761a69741c
This commit is contained in:
Beverly
2022-09-09 16:57:40 +00:00
committed by Beverly Tai
parent b218fd8ffd
commit f59c777ff8
2 changed files with 5 additions and 59 deletions

View File

@@ -52,14 +52,11 @@ import com.android.systemui.biometrics.AuthController;
import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.dump.DumpManager; import com.android.systemui.dump.DumpManager;
import com.android.systemui.keyguard.KeyguardUnlockAnimationController;
import com.android.systemui.keyguard.KeyguardViewMediator; import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.keyguard.ScreenLifecycle; import com.android.systemui.keyguard.ScreenLifecycle;
import com.android.systemui.keyguard.WakefulnessLifecycle; import com.android.systemui.keyguard.WakefulnessLifecycle;
import com.android.systemui.log.SessionTracker; import com.android.systemui.log.SessionTracker;
import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.shade.ShadeController;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.NotificationMediaManager; import com.android.systemui.statusbar.NotificationMediaManager;
import com.android.systemui.statusbar.NotificationShadeWindowController; import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.VibratorHelper; import com.android.systemui.statusbar.VibratorHelper;
@@ -153,7 +150,6 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
private final Handler mHandler; private final Handler mHandler;
private final KeyguardBypassController mKeyguardBypassController; private final KeyguardBypassController mKeyguardBypassController;
private PowerManager.WakeLock mWakeLock; private PowerManager.WakeLock mWakeLock;
private final com.android.systemui.shade.ShadeController mShadeController;
private final KeyguardUpdateMonitor mUpdateMonitor; private final KeyguardUpdateMonitor mUpdateMonitor;
private final DozeParameters mDozeParameters; private final DozeParameters mDozeParameters;
private final KeyguardStateController mKeyguardStateController; private final KeyguardStateController mKeyguardStateController;
@@ -167,7 +163,6 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
private KeyguardViewMediator mKeyguardViewMediator; private KeyguardViewMediator mKeyguardViewMediator;
private ScrimController mScrimController; private ScrimController mScrimController;
private PendingAuthenticated mPendingAuthenticated = null; private PendingAuthenticated mPendingAuthenticated = null;
private boolean mPendingShowBouncer;
private boolean mHasScreenTurnedOnSinceAuthenticating; private boolean mHasScreenTurnedOnSinceAuthenticating;
private boolean mFadedAwayAfterWakeAndUnlock; private boolean mFadedAwayAfterWakeAndUnlock;
private BiometricModeListener mBiometricModeListener; private BiometricModeListener mBiometricModeListener;
@@ -259,13 +254,11 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
); );
} }
private KeyguardUnlockAnimationController mKeyguardUnlockAnimationController;
private final ScreenOffAnimationController mScreenOffAnimationController; private final ScreenOffAnimationController mScreenOffAnimationController;
@Inject @Inject
public BiometricUnlockController(DozeScrimController dozeScrimController, public BiometricUnlockController(DozeScrimController dozeScrimController,
KeyguardViewMediator keyguardViewMediator, ScrimController scrimController, KeyguardViewMediator keyguardViewMediator, ScrimController scrimController,
ShadeController shadeController,
NotificationShadeWindowController notificationShadeWindowController, NotificationShadeWindowController notificationShadeWindowController,
KeyguardStateController keyguardStateController, Handler handler, KeyguardStateController keyguardStateController, Handler handler,
KeyguardUpdateMonitor keyguardUpdateMonitor, KeyguardUpdateMonitor keyguardUpdateMonitor,
@@ -278,13 +271,11 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
ScreenLifecycle screenLifecycle, ScreenLifecycle screenLifecycle,
AuthController authController, AuthController authController,
StatusBarStateController statusBarStateController, StatusBarStateController statusBarStateController,
KeyguardUnlockAnimationController keyguardUnlockAnimationController,
SessionTracker sessionTracker, SessionTracker sessionTracker,
LatencyTracker latencyTracker, LatencyTracker latencyTracker,
ScreenOffAnimationController screenOffAnimationController, ScreenOffAnimationController screenOffAnimationController,
VibratorHelper vibrator) { VibratorHelper vibrator) {
mPowerManager = powerManager; mPowerManager = powerManager;
mShadeController = shadeController;
mUpdateMonitor = keyguardUpdateMonitor; mUpdateMonitor = keyguardUpdateMonitor;
mDozeParameters = dozeParameters; mDozeParameters = dozeParameters;
mUpdateMonitor.registerCallback(this); mUpdateMonitor.registerCallback(this);
@@ -306,7 +297,6 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
mMetricsLogger = metricsLogger; mMetricsLogger = metricsLogger;
mAuthController = authController; mAuthController = authController;
mStatusBarStateController = statusBarStateController; mStatusBarStateController = statusBarStateController;
mKeyguardUnlockAnimationController = keyguardUnlockAnimationController;
mSessionTracker = sessionTracker; mSessionTracker = sessionTracker;
mScreenOffAnimationController = screenOffAnimationController; mScreenOffAnimationController = screenOffAnimationController;
mVibratorHelper = vibrator; mVibratorHelper = vibrator;
@@ -462,22 +452,13 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
break; break;
case MODE_UNLOCK_COLLAPSING: case MODE_UNLOCK_COLLAPSING:
Trace.beginSection("MODE_UNLOCK_COLLAPSING"); Trace.beginSection("MODE_UNLOCK_COLLAPSING");
if (!wasDeviceInteractive) { mKeyguardViewController.notifyKeyguardAuthenticated(
mPendingShowBouncer = true; false /* strongAuth */);
} else {
mPendingShowBouncer = false;
mKeyguardViewController.notifyKeyguardAuthenticated(
false /* strongAuth */);
}
Trace.endSection(); Trace.endSection();
break; break;
case MODE_SHOW_BOUNCER: case MODE_SHOW_BOUNCER:
Trace.beginSection("MODE_SHOW_BOUNCER"); Trace.beginSection("MODE_SHOW_BOUNCER");
if (!wasDeviceInteractive) { mKeyguardViewController.showBouncer(true);
mPendingShowBouncer = true;
} else {
showBouncer();
}
Trace.endSection(); Trace.endSection();
break; break;
case MODE_WAKE_AND_UNLOCK_FROM_DREAM: case MODE_WAKE_AND_UNLOCK_FROM_DREAM:
@@ -515,15 +496,6 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
} }
} }
private void showBouncer() {
if (mMode == MODE_SHOW_BOUNCER) {
mKeyguardViewController.showBouncer(true);
}
mShadeController.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE, true /* force */,
false /* delayed */, BIOMETRIC_COLLAPSE_SPEEDUP_FACTOR);
mPendingShowBouncer = false;
}
public boolean hasPendingAuthentication() { public boolean hasPendingAuthentication() {
return mPendingAuthenticated != null return mPendingAuthenticated != null
&& mUpdateMonitor && mUpdateMonitor
@@ -741,13 +713,6 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
@VisibleForTesting @VisibleForTesting
final WakefulnessLifecycle.Observer mWakefulnessObserver = final WakefulnessLifecycle.Observer mWakefulnessObserver =
new WakefulnessLifecycle.Observer() { new WakefulnessLifecycle.Observer() {
@Override
public void onFinishedWakingUp() {
if (mPendingShowBouncer) {
BiometricUnlockController.this.showBouncer();
}
}
@Override @Override
public void onStartedGoingToSleep() { public void onStartedGoingToSleep() {
resetMode(); resetMode();

View File

@@ -20,7 +20,6 @@ import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyFloat;
import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.anyString;
@@ -45,13 +44,11 @@ import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.systemui.SysuiTestCase; import com.android.systemui.SysuiTestCase;
import com.android.systemui.biometrics.AuthController; import com.android.systemui.biometrics.AuthController;
import com.android.systemui.dump.DumpManager; import com.android.systemui.dump.DumpManager;
import com.android.systemui.keyguard.KeyguardUnlockAnimationController;
import com.android.systemui.keyguard.KeyguardViewMediator; import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.keyguard.ScreenLifecycle; import com.android.systemui.keyguard.ScreenLifecycle;
import com.android.systemui.keyguard.WakefulnessLifecycle; import com.android.systemui.keyguard.WakefulnessLifecycle;
import com.android.systemui.log.SessionTracker; import com.android.systemui.log.SessionTracker;
import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.shade.ShadeController;
import com.android.systemui.statusbar.NotificationMediaManager; import com.android.systemui.statusbar.NotificationMediaManager;
import com.android.systemui.statusbar.NotificationShadeWindowController; import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.VibratorHelper; import com.android.systemui.statusbar.VibratorHelper;
@@ -90,8 +87,6 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
@Mock @Mock
private BiometricUnlockController.BiometricModeListener mBiometricModeListener; private BiometricUnlockController.BiometricModeListener mBiometricModeListener;
@Mock @Mock
private ShadeController mShadeController;
@Mock
private KeyguardStateController mKeyguardStateController; private KeyguardStateController mKeyguardStateController;
@Mock @Mock
private Handler mHandler; private Handler mHandler;
@@ -112,8 +107,6 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
@Mock @Mock
private StatusBarStateController mStatusBarStateController; private StatusBarStateController mStatusBarStateController;
@Mock @Mock
private KeyguardUnlockAnimationController mKeyguardUnlockAnimationController;
@Mock
private SessionTracker mSessionTracker; private SessionTracker mSessionTracker;
@Mock @Mock
private LatencyTracker mLatencyTracker; private LatencyTracker mLatencyTracker;
@@ -137,12 +130,12 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
when(mVibratorHelper.hasVibrator()).thenReturn(true); when(mVibratorHelper.hasVibrator()).thenReturn(true);
mDependency.injectTestDependency(NotificationMediaManager.class, mMediaManager); mDependency.injectTestDependency(NotificationMediaManager.class, mMediaManager);
mBiometricUnlockController = new BiometricUnlockController(mDozeScrimController, mBiometricUnlockController = new BiometricUnlockController(mDozeScrimController,
mKeyguardViewMediator, mScrimController, mShadeController, mKeyguardViewMediator, mScrimController,
mNotificationShadeWindowController, mKeyguardStateController, mHandler, mNotificationShadeWindowController, mKeyguardStateController, mHandler,
mUpdateMonitor, res.getResources(), mKeyguardBypassController, mDozeParameters, mUpdateMonitor, res.getResources(), mKeyguardBypassController, mDozeParameters,
mMetricsLogger, mDumpManager, mPowerManager, mMetricsLogger, mDumpManager, mPowerManager,
mNotificationMediaManager, mWakefulnessLifecycle, mScreenLifecycle, mNotificationMediaManager, mWakefulnessLifecycle, mScreenLifecycle,
mAuthController, mStatusBarStateController, mKeyguardUnlockAnimationController, mAuthController, mStatusBarStateController,
mSessionTracker, mLatencyTracker, mScreenOffAnimationController, mVibratorHelper); mSessionTracker, mLatencyTracker, mScreenOffAnimationController, mVibratorHelper);
mBiometricUnlockController.setKeyguardViewController(mStatusBarKeyguardViewManager); mBiometricUnlockController.setKeyguardViewController(mStatusBarKeyguardViewManager);
mBiometricUnlockController.setBiometricModeListener(mBiometricModeListener); mBiometricUnlockController.setBiometricModeListener(mBiometricModeListener);
@@ -167,8 +160,6 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT, mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT,
BiometricSourceType.FINGERPRINT, false /* isStrongBiometric */); BiometricSourceType.FINGERPRINT, false /* isStrongBiometric */);
verify(mStatusBarKeyguardViewManager).showBouncer(anyBoolean()); verify(mStatusBarKeyguardViewManager).showBouncer(anyBoolean());
verify(mShadeController).animateCollapsePanels(anyInt(), anyBoolean(), anyBoolean(),
anyFloat());
assertThat(mBiometricUnlockController.getMode()) assertThat(mBiometricUnlockController.getMode())
.isEqualTo(BiometricUnlockController.MODE_SHOW_BOUNCER); .isEqualTo(BiometricUnlockController.MODE_SHOW_BOUNCER);
assertThat(mBiometricUnlockController.getBiometricType()) assertThat(mBiometricUnlockController.getBiometricType())
@@ -246,8 +237,6 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT, mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT,
BiometricSourceType.FACE, true /* isStrongBiometric */); BiometricSourceType.FACE, true /* isStrongBiometric */);
verify(mShadeController, never()).animateCollapsePanels(anyInt(), anyBoolean(),
anyBoolean(), anyFloat());
verify(mStatusBarKeyguardViewManager, never()).notifyKeyguardAuthenticated(anyBoolean()); verify(mStatusBarKeyguardViewManager, never()).notifyKeyguardAuthenticated(anyBoolean());
assertThat(mBiometricUnlockController.getMode()) assertThat(mBiometricUnlockController.getMode())
.isEqualTo(BiometricUnlockController.MODE_NONE); .isEqualTo(BiometricUnlockController.MODE_NONE);
@@ -298,10 +287,6 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT, mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT,
BiometricSourceType.FACE, true /* isStrongBiometric */); BiometricSourceType.FACE, true /* isStrongBiometric */);
// Wake up before showing the bouncer
verify(mStatusBarKeyguardViewManager, never()).showBouncer(anyBoolean());
mBiometricUnlockController.mWakefulnessObserver.onFinishedWakingUp();
verify(mStatusBarKeyguardViewManager).showBouncer(anyBoolean()); verify(mStatusBarKeyguardViewManager).showBouncer(anyBoolean());
assertThat(mBiometricUnlockController.getMode()) assertThat(mBiometricUnlockController.getMode())
.isEqualTo(BiometricUnlockController.MODE_SHOW_BOUNCER); .isEqualTo(BiometricUnlockController.MODE_SHOW_BOUNCER);
@@ -332,8 +317,6 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
BiometricSourceType.FACE, true /* isStrongBiometric */); BiometricSourceType.FACE, true /* isStrongBiometric */);
verify(mStatusBarKeyguardViewManager, never()).showBouncer(anyBoolean()); verify(mStatusBarKeyguardViewManager, never()).showBouncer(anyBoolean());
verify(mShadeController, never()).animateCollapsePanels(anyInt(), anyBoolean(),
anyBoolean(), anyFloat());
assertThat(mBiometricUnlockController.getMode()) assertThat(mBiometricUnlockController.getMode())
.isEqualTo(BiometricUnlockController.MODE_NONE); .isEqualTo(BiometricUnlockController.MODE_NONE);
} }
@@ -383,8 +366,6 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT, mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT,
BiometricSourceType.FACE, true /* isStrongBiometric */); BiometricSourceType.FACE, true /* isStrongBiometric */);
verify(mShadeController, never()).animateCollapsePanels(anyInt(), anyBoolean(),
anyBoolean(), anyFloat());
assertThat(mBiometricUnlockController.getMode()) assertThat(mBiometricUnlockController.getMode())
.isEqualTo(BiometricUnlockController.MODE_ONLY_WAKE); .isEqualTo(BiometricUnlockController.MODE_ONLY_WAKE);
} }