From 3822f89d643380f709679eede198cece64caba75 Mon Sep 17 00:00:00 2001 From: Evan Laird Date: Thu, 9 Dec 2021 14:33:13 -0500 Subject: [PATCH] Change SBKVM to use notification shade window instead of status bar It's not clear to me that this code was strictly incorrect, but the former `StatusBarKeyguardViewManager#getRootViewImpl()` method referenced the StatusBar view. This code was written at a time when the notification shade (and thus keyguard) was hosted in that window. However with the change to split out NotificationShade into its own window, this is no longer the host view for KeyguardViewMediator to care about. This change replaces the use of StatusBar#getViewRootImpl to instead use the NotificationShade window's viewRootImpl. Also remove unused fields from SBKVM Test: atest SystemUITests Bug: 209005990 Change-Id: I752fd920cce8dc2be1ef7f3f6644741f3a0899fb --- .../phone/StatusBarKeyguardViewManager.java | 8 +------- .../StatusBarKeyguardViewManagerTest.java | 20 +++---------------- 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java index b84e6e6f37ccd..a4aeae9c0307f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -111,8 +111,6 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb private final NavigationModeController mNavigationModeController; private final NotificationShadeWindowController mNotificationShadeWindowController; private final KeyguardBouncer.Factory mKeyguardBouncerFactory; - private final WakefulnessLifecycle mWakefulnessLifecycle; - private final UnlockedScreenOffAnimationController mUnlockedScreenOffAnimationController; private final KeyguardMessageAreaController.Factory mKeyguardMessageAreaFactory; private KeyguardMessageAreaController mKeyguardMessageAreaController; private final Lazy mShadeController; @@ -244,8 +242,6 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb KeyguardStateController keyguardStateController, NotificationMediaManager notificationMediaManager, KeyguardBouncer.Factory keyguardBouncerFactory, - WakefulnessLifecycle wakefulnessLifecycle, - UnlockedScreenOffAnimationController unlockedScreenOffAnimationController, KeyguardMessageAreaController.Factory keyguardMessageAreaFactory, Lazy shadeController) { mContext = context; @@ -260,8 +256,6 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb mStatusBarStateController = sysuiStatusBarStateController; mDockManager = dockManager; mKeyguardBouncerFactory = keyguardBouncerFactory; - mWakefulnessLifecycle = wakefulnessLifecycle; - mUnlockedScreenOffAnimationController = unlockedScreenOffAnimationController; mKeyguardMessageAreaFactory = keyguardMessageAreaFactory; mShadeController = shadeController; } @@ -1155,7 +1149,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb @Override public ViewRootImpl getViewRootImpl() { - return mStatusBar.getStatusBarView().getViewRootImpl(); + return mNotificationShadeWindowController.getNotificationShadeView().getViewRootImpl(); } public void launchPendingWakeupAction() { diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java index c5bdfed6082bb..cbaa460d711bc 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java @@ -43,9 +43,6 @@ import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.ViewMediatorCallback; import com.android.systemui.SysuiTestCase; import com.android.systemui.dock.DockManager; -import com.android.systemui.dump.DumpManager; -import com.android.systemui.keyguard.DismissCallbackRegistry; -import com.android.systemui.keyguard.WakefulnessLifecycle; import com.android.systemui.navigationbar.NavigationModeController; import com.android.systemui.plugins.ActivityStarter.OnDismissAction; import com.android.systemui.statusbar.NotificationMediaManager; @@ -79,9 +76,7 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { @Mock private NotificationPanelViewController mNotificationPanelView; @Mock - private BiometricUnlockController mBiometrucUnlockController; - @Mock - private DismissCallbackRegistry mDismissCallbackRegistry; + private BiometricUnlockController mBiometricUnlockController; @Mock private SysuiStatusBarStateController mStatusBarStateController; @Mock @@ -97,15 +92,12 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { @Mock private KeyguardBouncer mBouncer; @Mock - private UnlockedScreenOffAnimationController mUnlockedScreenOffAnimationController; - @Mock private StatusBarKeyguardViewManager.AlternateAuthInterceptor mAlternateAuthInterceptor; @Mock private KeyguardMessageArea mKeyguardMessageArea; @Mock private ShadeController mShadeController; - private WakefulnessLifecycle mWakefulnessLifecycle; private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager; @Before @@ -117,10 +109,6 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { .thenReturn(mBouncer); when(mStatusBar.getBouncerContainer()).thenReturn(mContainer); when(mContainer.findViewById(anyInt())).thenReturn(mKeyguardMessageArea); - mWakefulnessLifecycle = new WakefulnessLifecycle( - getContext(), - null, - mock(DumpManager.class)); mStatusBarKeyguardViewManager = new StatusBarKeyguardViewManager( getContext(), mViewMediatorCallback, @@ -134,15 +122,13 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { mKeyguardStateController, mock(NotificationMediaManager.class), mKeyguardBouncerFactory, - mWakefulnessLifecycle, - mUnlockedScreenOffAnimationController, mKeyguardMessageAreaFactory, () -> mShadeController); mStatusBarKeyguardViewManager.registerStatusBar( mStatusBar, mNotificationPanelView, new PanelExpansionStateManager(), - mBiometrucUnlockController, + mBiometricUnlockController, mNotificationContainer, mBypassController); mStatusBarKeyguardViewManager.show(null); @@ -261,7 +247,7 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { @Test public void onPanelExpansionChanged_neverTranslatesBouncerWhenWakeAndUnlock() { - when(mBiometrucUnlockController.getMode()) + when(mBiometricUnlockController.getMode()) .thenReturn(BiometricUnlockController.MODE_WAKE_AND_UNLOCK); mStatusBarKeyguardViewManager.onPanelExpansionChanged( /* fraction= */ KeyguardBouncer.EXPANSION_VISIBLE,