From 1fb1192d4b8e43f47d63730f4295eb2814fc7c49 Mon Sep 17 00:00:00 2001 From: Justin Weir Date: Mon, 17 Jul 2023 12:14:53 -0400 Subject: [PATCH 1/5] Remove getShadeViewController calls Bug: 288868098 Test: updated and ran affected test Change-Id: Ibd10284d5821be5d29431cd08fbeebca06e1c212 --- .../com/android/systemui/accessibility/SystemActions.java | 7 +++++-- .../android/systemui/accessibility/SystemActionsTest.java | 6 +++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java b/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java index 2f6a68c3ff8dd..03ad132c452c1 100644 --- a/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java +++ b/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java @@ -54,6 +54,7 @@ import com.android.systemui.recents.Recents; import com.android.systemui.settings.DisplayTracker; import com.android.systemui.settings.UserTracker; import com.android.systemui.shade.ShadeController; +import com.android.systemui.shade.ShadeViewController; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.NotificationShadeWindowController; import com.android.systemui.statusbar.phone.CentralSurfaces; @@ -188,6 +189,7 @@ public class SystemActions implements CoreStartable { private final Lazy> mCentralSurfacesOptionalLazy; private final NotificationShadeWindowController mNotificationShadeController; private final ShadeController mShadeController; + private final Lazy mShadeViewController; private final StatusBarWindowCallback mNotificationShadeCallback; private boolean mDismissNotificationShadeActionRegistered; @@ -196,12 +198,14 @@ public class SystemActions implements CoreStartable { UserTracker userTracker, NotificationShadeWindowController notificationShadeController, ShadeController shadeController, + Lazy shadeViewController, Lazy> centralSurfacesOptionalLazy, Optional recentsOptional, DisplayTracker displayTracker) { mContext = context; mUserTracker = userTracker; mShadeController = shadeController; + mShadeViewController = shadeViewController; mRecentsOptional = recentsOptional; mDisplayTracker = displayTracker; mReceiver = new SystemActionsBroadcastReceiver(); @@ -330,8 +334,7 @@ public class SystemActions implements CoreStartable { final Optional centralSurfacesOptional = mCentralSurfacesOptionalLazy.get(); if (centralSurfacesOptional.isPresent() - && centralSurfacesOptional.get().getShadeViewController() != null - && centralSurfacesOptional.get().getShadeViewController().isPanelExpanded() + && mShadeViewController.get().isPanelExpanded() && !centralSurfacesOptional.get().isKeyguardShowing()) { if (!mDismissNotificationShadeActionRegistered) { mA11yManager.registerSystemAction( diff --git a/packages/SystemUI/tests/src/com/android/systemui/accessibility/SystemActionsTest.java b/packages/SystemUI/tests/src/com/android/systemui/accessibility/SystemActionsTest.java index 025c88c362039..576f689a16d0f 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/accessibility/SystemActionsTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/accessibility/SystemActionsTest.java @@ -39,6 +39,7 @@ import com.android.systemui.recents.Recents; import com.android.systemui.settings.FakeDisplayTracker; import com.android.systemui.settings.UserTracker; import com.android.systemui.shade.ShadeController; +import com.android.systemui.shade.ShadeViewController; import com.android.systemui.statusbar.NotificationShadeWindowController; import com.android.systemui.statusbar.phone.CentralSurfaces; @@ -65,6 +66,8 @@ public class SystemActionsTest extends SysuiTestCase { @Mock private ShadeController mShadeController; @Mock + private ShadeViewController mShadeViewController; + @Mock private Lazy> mCentralSurfacesOptionalLazy; @Mock private Optional mRecentsOptional; @@ -82,7 +85,8 @@ public class SystemActionsTest extends SysuiTestCase { mContext.addMockSystemService(TelecomManager.class, mTelecomManager); mContext.addMockSystemService(InputManager.class, mInputManager); mSystemActions = new SystemActions(mContext, mUserTracker, mNotificationShadeController, - mShadeController, mCentralSurfacesOptionalLazy, mRecentsOptional, mDisplayTracker); + mShadeController, () -> mShadeViewController, mCentralSurfacesOptionalLazy, + mRecentsOptional, mDisplayTracker); } @Test From 06db41a823c7b3929f82ddc166f3d500e8ae6e85 Mon Sep 17 00:00:00 2001 From: Justin Weir Date: Mon, 17 Jul 2023 16:32:50 -0400 Subject: [PATCH 2/5] Remove getShadeViewController calls Bug: 288868098 Test: updated and ran affected test Change-Id: I5b10c8f05749afea3a1ca0b43b3f6cefd0aa71e0 --- .../systemui/dreams/touch/ShadeTouchHandler.java | 10 ++++------ .../systemui/dreams/touch/ShadeTouchHandlerTest.java | 4 +--- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/dreams/touch/ShadeTouchHandler.java b/packages/SystemUI/src/com/android/systemui/dreams/touch/ShadeTouchHandler.java index 99451f2ee1b96..6f05e83b22baa 100644 --- a/packages/SystemUI/src/com/android/systemui/dreams/touch/ShadeTouchHandler.java +++ b/packages/SystemUI/src/com/android/systemui/dreams/touch/ShadeTouchHandler.java @@ -37,12 +37,15 @@ import javax.inject.Named; */ public class ShadeTouchHandler implements DreamTouchHandler { private final Optional mSurfaces; + private final ShadeViewController mShadeViewController; private final int mInitiationHeight; @Inject ShadeTouchHandler(Optional centralSurfaces, + ShadeViewController shadeViewController, @Named(NOTIFICATION_SHADE_GESTURE_INITIATION_HEIGHT) int initiationHeight) { mSurfaces = centralSurfaces; + mShadeViewController = shadeViewController; mInitiationHeight = initiationHeight; } @@ -54,12 +57,7 @@ public class ShadeTouchHandler implements DreamTouchHandler { } session.registerInputListener(ev -> { - final ShadeViewController viewController = - mSurfaces.map(CentralSurfaces::getShadeViewController).orElse(null); - - if (viewController != null) { - viewController.handleExternalTouch((MotionEvent) ev); - } + mShadeViewController.handleExternalTouch((MotionEvent) ev); if (ev instanceof MotionEvent) { if (((MotionEvent) ev).getAction() == MotionEvent.ACTION_UP) { diff --git a/packages/SystemUI/tests/src/com/android/systemui/dreams/touch/ShadeTouchHandlerTest.java b/packages/SystemUI/tests/src/com/android/systemui/dreams/touch/ShadeTouchHandlerTest.java index 872c0794ce646..2b9821406feaa 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/dreams/touch/ShadeTouchHandlerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/dreams/touch/ShadeTouchHandlerTest.java @@ -61,10 +61,8 @@ public class ShadeTouchHandlerTest extends SysuiTestCase { @Before public void setup() { MockitoAnnotations.initMocks(this); - mTouchHandler = new ShadeTouchHandler(Optional.of(mCentralSurfaces), + mTouchHandler = new ShadeTouchHandler(Optional.of(mCentralSurfaces), mShadeViewController, TOUCH_HEIGHT); - when(mCentralSurfaces.getShadeViewController()) - .thenReturn(mShadeViewController); } /** From 5d0589110ad6f13e3c55bb0e8c410397c1ce5da8 Mon Sep 17 00:00:00 2001 From: Justin Weir Date: Tue, 18 Jul 2023 17:01:49 -0400 Subject: [PATCH 3/5] Remove getShadeViewController calls Bug: 288868098 Test: updated and ran affected test Change-Id: Ief8dc9782d07cfc52832dc24b3e3b5249d68a79a --- .../statusbar/phone/CentralSurfacesImpl.java | 2 +- .../phone/ScreenOffAnimationController.kt | 15 +++++++++++--- .../UnlockedScreenOffAnimationController.kt | 20 +++++++++++-------- .../unfold/FoldAodAnimationController.kt | 13 ++++++++---- ...nlockedScreenOffAnimationControllerTest.kt | 4 +--- .../unfold/FoldAodAnimationControllerTest.kt | 3 +-- 6 files changed, 36 insertions(+), 21 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java index c3c9a61df2ea0..79148fd67ceb3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java @@ -1326,7 +1326,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { } }); - mScreenOffAnimationController.initialize(this, mLightRevealScrim); + mScreenOffAnimationController.initialize(this, mShadeSurface, mLightRevealScrim); updateLightRevealScrimVisibility(); mShadeSurface.initDependencies( diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScreenOffAnimationController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScreenOffAnimationController.kt index c8174669cc653..89c3a02f94019 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScreenOffAnimationController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScreenOffAnimationController.kt @@ -18,6 +18,7 @@ package com.android.systemui.statusbar.phone import android.view.View import com.android.systemui.dagger.SysUISingleton import com.android.systemui.keyguard.WakefulnessLifecycle +import com.android.systemui.shade.ShadeViewController import com.android.systemui.statusbar.LightRevealScrim import com.android.systemui.unfold.FoldAodAnimationController import com.android.systemui.unfold.SysUIUnfoldComponent @@ -37,8 +38,12 @@ class ScreenOffAnimationController @Inject constructor( private val animations: List = listOfNotNull(foldToAodAnimation, unlockedScreenOffAnimation) - fun initialize(centralSurfaces: CentralSurfaces, lightRevealScrim: LightRevealScrim) { - animations.forEach { it.initialize(centralSurfaces, lightRevealScrim) } + fun initialize( + centralSurfaces: CentralSurfaces, + shadeViewController: ShadeViewController, + lightRevealScrim: LightRevealScrim, + ) { + animations.forEach { it.initialize(centralSurfaces, shadeViewController, lightRevealScrim) } wakefulnessLifecycle.addObserver(this) } @@ -197,7 +202,11 @@ class ScreenOffAnimationController @Inject constructor( } interface ScreenOffAnimation { - fun initialize(centralSurfaces: CentralSurfaces, lightRevealScrim: LightRevealScrim) {} + fun initialize( + centralSurfaces: CentralSurfaces, + shadeViewController: ShadeViewController, + lightRevealScrim: LightRevealScrim, + ) {} /** * Called when started going to sleep, should return true if the animation will be played diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationController.kt index 96a4d900c1602..7e9172da18174 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationController.kt @@ -20,6 +20,7 @@ import com.android.app.animation.Interpolators import com.android.systemui.dagger.SysUISingleton import com.android.systemui.keyguard.KeyguardViewMediator import com.android.systemui.keyguard.WakefulnessLifecycle +import com.android.systemui.shade.ShadeViewController import com.android.systemui.statusbar.CircleReveal import com.android.systemui.statusbar.LightRevealScrim import com.android.systemui.statusbar.NotificationShadeWindowController @@ -66,7 +67,8 @@ class UnlockedScreenOffAnimationController @Inject constructor( private val powerManager: PowerManager, private val handler: Handler = Handler() ) : WakefulnessLifecycle.Observer, ScreenOffAnimation { - private lateinit var mCentralSurfaces: CentralSurfaces + private lateinit var centralSurfaces: CentralSurfaces + private lateinit var shadeViewController: ShadeViewController /** * Whether or not [initialize] has been called to provide us with the StatusBar, * NotificationPanelViewController, and LightRevealSrim so that we can run the unlocked screen @@ -126,7 +128,7 @@ class UnlockedScreenOffAnimationController @Inject constructor( lightRevealAnimator.start() } - val animatorDurationScaleObserver = object : ContentObserver(null) { + private val animatorDurationScaleObserver = object : ContentObserver(null) { override fun onChange(selfChange: Boolean) { updateAnimatorDurationScale() } @@ -134,11 +136,13 @@ class UnlockedScreenOffAnimationController @Inject constructor( override fun initialize( centralSurfaces: CentralSurfaces, + shadeViewController: ShadeViewController, lightRevealScrim: LightRevealScrim ) { this.initialized = true this.lightRevealScrim = lightRevealScrim - this.mCentralSurfaces = centralSurfaces + this.centralSurfaces = centralSurfaces + this.shadeViewController = shadeViewController updateAnimatorDurationScale() globalSettings.registerContentObserver( @@ -198,7 +202,7 @@ class UnlockedScreenOffAnimationController @Inject constructor( // Tell the CentralSurfaces to become keyguard for real - we waited on that // since it is slow and would have caused the animation to jank. - mCentralSurfaces.updateIsKeyguard() + centralSurfaces.updateIsKeyguard() // Run the callback given to us by the KeyguardVisibilityHelper. after.run() @@ -251,7 +255,7 @@ class UnlockedScreenOffAnimationController @Inject constructor( // even if we're going from SHADE to SHADE or KEYGUARD to KEYGUARD, since we might have // changed parts of the UI (such as showing AOD in the shade) without actually changing // the StatusBarState. This ensures that the UI definitely reflects the desired state. - mCentralSurfaces.updateIsKeyguard(true /* forceStateChange */) + centralSurfaces.updateIsKeyguard(true /* forceStateChange */) } } @@ -280,7 +284,7 @@ class UnlockedScreenOffAnimationController @Inject constructor( // Show AOD. That'll cause the KeyguardVisibilityHelper to call // #animateInKeyguard. - mCentralSurfaces.shadeViewController.showAodUi() + shadeViewController.showAodUi() } }, (ANIMATE_IN_KEYGUARD_DELAY * animatorDurationScale).toLong()) @@ -328,8 +332,8 @@ class UnlockedScreenOffAnimationController @Inject constructor( // We currently draw both the light reveal scrim, and the AOD UI, in the shade. If it's // already expanded and showing notifications/QS, the animation looks really messy. For now, // disable it if the notification panel is expanded. - if ((!this::mCentralSurfaces.isInitialized || - mCentralSurfaces.shadeViewController.isPanelExpanded) && + if ((!this::centralSurfaces.isInitialized || + shadeViewController.isPanelExpanded) && // Status bar might be expanded because we have started // playing the animation already !isAnimationPlaying() diff --git a/packages/SystemUI/src/com/android/systemui/unfold/FoldAodAnimationController.kt b/packages/SystemUI/src/com/android/systemui/unfold/FoldAodAnimationController.kt index cbe402017c415..098d51e94fc72 100644 --- a/packages/SystemUI/src/com/android/systemui/unfold/FoldAodAnimationController.kt +++ b/packages/SystemUI/src/com/android/systemui/unfold/FoldAodAnimationController.kt @@ -31,6 +31,7 @@ import com.android.systemui.keyguard.WakefulnessLifecycle import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor import com.android.systemui.lifecycle.repeatWhenAttached import com.android.systemui.shade.ShadeFoldAnimator +import com.android.systemui.shade.ShadeViewController import com.android.systemui.statusbar.LightRevealScrim import com.android.systemui.statusbar.phone.CentralSurfaces import com.android.systemui.statusbar.phone.ScreenOffAnimation @@ -62,7 +63,7 @@ constructor( private val keyguardInteractor: Lazy, ) : CallbackController, ScreenOffAnimation, WakefulnessLifecycle.Observer { - private lateinit var centralSurfaces: CentralSurfaces + private lateinit var shadeViewController: ShadeViewController private var isFolded = false private var isFoldHandled = true @@ -87,8 +88,12 @@ constructor( ) } - override fun initialize(centralSurfaces: CentralSurfaces, lightRevealScrim: LightRevealScrim) { - this.centralSurfaces = centralSurfaces + override fun initialize( + centralSurfaces: CentralSurfaces, + shadeViewController: ShadeViewController, + lightRevealScrim: LightRevealScrim, + ) { + this.shadeViewController = shadeViewController deviceStateManager.registerCallback(mainExecutor, FoldListener()) wakefulnessLifecycle.addObserver(this) @@ -128,7 +133,7 @@ constructor( } private fun getShadeFoldAnimator(): ShadeFoldAnimator = - centralSurfaces.shadeViewController.shadeFoldAnimator + shadeViewController.shadeFoldAnimator private fun setAnimationState(playing: Boolean) { shouldPlayAnimation = playing diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationControllerTest.kt index 2e9a6909e402b..e76f26d8128e7 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationControllerTest.kt @@ -97,9 +97,7 @@ class UnlockedScreenOffAnimationControllerTest : SysuiTestCase() { powerManager, handler = handler ) - controller.initialize(centralSurfaces, lightRevealScrim) - `when`(centralSurfaces.shadeViewController).thenReturn( - shadeViewController) + controller.initialize(centralSurfaces, shadeViewController, lightRevealScrim) // Screen off does not run if the panel is expanded, so we should say it's collapsed to test // screen off. diff --git a/packages/SystemUI/tests/src/com/android/systemui/unfold/FoldAodAnimationControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/unfold/FoldAodAnimationControllerTest.kt index 813597a8b5769..7f990a446aafb 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/unfold/FoldAodAnimationControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/unfold/FoldAodAnimationControllerTest.kt @@ -101,7 +101,6 @@ class FoldAodAnimationControllerTest : SysuiTestCase() { whenever(viewGroup.viewTreeObserver).thenReturn(viewTreeObserver) whenever(wakefulnessLifecycle.lastSleepReason) .thenReturn(PowerManager.GO_TO_SLEEP_REASON_DEVICE_FOLD) - whenever(centralSurfaces.shadeViewController).thenReturn(shadeViewController) whenever(shadeFoldAnimator.startFoldToAodAnimation(any(), any(), any())).then { val onActionStarted = it.arguments[0] as Runnable onActionStarted.run() @@ -124,7 +123,7 @@ class FoldAodAnimationControllerTest : SysuiTestCase() { latencyTracker, { keyguardInteractor }, ) - .apply { initialize(centralSurfaces, lightRevealScrim) } + .apply { initialize(centralSurfaces, shadeViewController, lightRevealScrim) } verify(deviceStateManager).registerCallback(any(), foldStateListenerCaptor.capture()) From 59b2e81d3014b97fa11a93cda972ceeee1392290 Mon Sep 17 00:00:00 2001 From: Justin Weir Date: Wed, 19 Jul 2023 10:45:08 -0400 Subject: [PATCH 4/5] Remove getShadeViewController calls Bug: 288868098 Test: updated and ran affected test Change-Id: Ie99aaf892fa20dbf9379e749ec83d384d973f038 --- .../systemui/navigationbar/NavigationBar.java | 16 ++++++++++------ .../navigationbar/NavigationBarTest.java | 4 +++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java index 682335e0b419a..e134f7c10b9b4 100644 --- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java +++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java @@ -133,6 +133,7 @@ import com.android.systemui.settings.DisplayTracker; import com.android.systemui.settings.UserContextProvider; import com.android.systemui.settings.UserTracker; import com.android.systemui.shade.ShadeController; +import com.android.systemui.shade.ShadeViewController; import com.android.systemui.shared.navigationbar.RegionSamplingHelper; import com.android.systemui.shared.recents.utilities.Utilities; import com.android.systemui.shared.rotation.RotationButton; @@ -199,6 +200,7 @@ public class NavigationBar extends ViewController implements private final SysUiState mSysUiFlagsContainer; private final Lazy> mCentralSurfacesOptionalLazy; private final ShadeController mShadeController; + private final ShadeViewController mShadeViewController; private final NotificationRemoteInputManager mNotificationRemoteInputManager; private final OverviewProxyService mOverviewProxyService; private final NavigationModeController mNavigationModeController; @@ -523,6 +525,7 @@ public class NavigationBar extends ViewController implements @Inject NavigationBar( NavigationBarView navigationBarView, + ShadeController shadeController, NavigationBarFrame navigationBarFrame, @Nullable Bundle savedState, @DisplayId Context context, @@ -541,7 +544,7 @@ public class NavigationBar extends ViewController implements Optional pipOptional, Optional recentsOptional, Lazy> centralSurfacesOptionalLazy, - ShadeController shadeController, + ShadeViewController shadeViewController, NotificationRemoteInputManager notificationRemoteInputManager, NotificationShadeDepthController notificationShadeDepthController, @Main Handler mainHandler, @@ -577,6 +580,7 @@ public class NavigationBar extends ViewController implements mSysUiFlagsContainer = sysUiFlagsContainer; mCentralSurfacesOptionalLazy = centralSurfacesOptionalLazy; mShadeController = shadeController; + mShadeViewController = shadeViewController; mNotificationRemoteInputManager = notificationRemoteInputManager; mOverviewProxyService = overviewProxyService; mNavigationModeController = navigationModeController; @@ -739,8 +743,7 @@ public class NavigationBar extends ViewController implements final Display display = mView.getDisplay(); mView.setComponents(mRecentsOptional); if (mCentralSurfacesOptionalLazy.get().isPresent()) { - mView.setComponents( - mCentralSurfacesOptionalLazy.get().get().getShadeViewController()); + mView.setComponents(mShadeViewController); } mView.setDisabledFlags(mDisabledFlags1, mSysUiFlagsContainer); mView.setOnVerticalChangedListener(this::onVerticalChanged); @@ -1341,9 +1344,10 @@ public class NavigationBar extends ViewController implements } private void onVerticalChanged(boolean isVertical) { - Optional cs = mCentralSurfacesOptionalLazy.get(); - if (cs.isPresent() && cs.get().getShadeViewController() != null) { - cs.get().getShadeViewController().setQsScrimEnabled(!isVertical); + // This check can probably be safely removed. It only remained to reduce regression + // risk for a broad change that removed the CentralSurfaces reference in the if block + if (mCentralSurfacesOptionalLazy.get().isPresent()) { + mShadeViewController.setQsScrimEnabled(!isVertical); } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/navigationbar/NavigationBarTest.java b/packages/SystemUI/tests/src/com/android/systemui/navigationbar/NavigationBarTest.java index 25d494cee5e87..cbfad56ed6178 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/navigationbar/NavigationBarTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/navigationbar/NavigationBarTest.java @@ -94,6 +94,7 @@ import com.android.systemui.settings.UserContextProvider; import com.android.systemui.settings.UserTracker; import com.android.systemui.shade.NotificationShadeWindowView; import com.android.systemui.shade.ShadeController; +import com.android.systemui.shade.ShadeViewController; import com.android.systemui.shared.rotation.RotationButtonController; import com.android.systemui.shared.system.TaskStackChangeListeners; import com.android.systemui.statusbar.CommandQueue; @@ -467,6 +468,7 @@ public class NavigationBarTest extends SysuiTestCase { when(deviceProvisionedController.isDeviceProvisioned()).thenReturn(true); return spy(new NavigationBar( mNavigationBarView, + mock(ShadeController.class), mNavigationBarFrame, null, context, @@ -485,7 +487,7 @@ public class NavigationBarTest extends SysuiTestCase { Optional.of(mock(Pip.class)), Optional.of(mock(Recents.class)), () -> Optional.of(mCentralSurfaces), - mock(ShadeController.class), + mock(ShadeViewController.class), mock(NotificationRemoteInputManager.class), mock(NotificationShadeDepthController.class), mHandler, From ca91fe8bbf83f72a89d0325d3127b945ed918f11 Mon Sep 17 00:00:00 2001 From: Justin Weir Date: Wed, 19 Jul 2023 11:30:23 -0400 Subject: [PATCH 5/5] Delete CentralSurfaces.getShadeViewController Fixes: 288868098 Test: updated and ran affected tests Change-Id: Ic169e34e058abee5dd76aa0cb860c5f1965916a1 --- .../recents/OverviewProxyService.java | 24 +++++++------------ .../statusbar/phone/ActivityStarterImpl.kt | 4 +++- .../statusbar/phone/CentralSurfaces.java | 4 ---- .../statusbar/phone/CentralSurfacesImpl.java | 3 +-- .../recents/OverviewProxyServiceTest.kt | 3 +++ .../phone/ActivityStarterImplTest.kt | 3 +++ .../phone/PhoneStatusBarViewControllerTest.kt | 8 ------- 7 files changed, 19 insertions(+), 30 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java index 207cc13982790..a737a8bca5850 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java +++ b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java @@ -78,7 +78,6 @@ import com.android.internal.annotations.VisibleForTesting; import com.android.internal.app.AssistUtils; import com.android.internal.app.IVoiceInteractionSessionListener; import com.android.internal.logging.UiEventLogger; -import com.android.internal.policy.ScreenDecorationsUtils; import com.android.internal.util.ScreenshotHelper; import com.android.internal.util.ScreenshotRequest; import com.android.systemui.Dumpable; @@ -143,6 +142,7 @@ public class OverviewProxyService implements CallbackController> mCentralSurfacesOptionalLazy; + private final Lazy mShadeViewControllerLazy; private SysUiState mSysUiState; private final Handler mHandler; private final Lazy mNavBarControllerLazy; @@ -201,11 +201,7 @@ public class OverviewProxyService implements CallbackController { if (event.getActionMasked() == ACTION_DOWN) { - ShadeViewController shadeViewController = - centralSurfaces.getShadeViewController(); - if (shadeViewController != null) { - shadeViewController.startExpandLatencyTracking(); - } + mShadeViewControllerLazy.get().startExpandLatencyTracking(); } mHandler.post(() -> { int action = event.getActionMasked(); @@ -552,8 +548,10 @@ public class OverviewProxyService implements CallbackController navBarControllerLazy, Lazy> centralSurfacesOptionalLazy, + Lazy shadeViewControllerLazy, NavigationModeController navModeController, - NotificationShadeWindowController statusBarWinController, SysUiState sysUiState, + NotificationShadeWindowController statusBarWinController, + SysUiState sysUiState, UserTracker userTracker, ScreenLifecycle screenLifecycle, WakefulnessLifecycle wakefulnessLifecycle, @@ -573,6 +571,7 @@ public class OverviewProxyService implements CallbackController