diff options
| author | 2023-07-21 20:37:56 +0000 | |
|---|---|---|
| committer | 2023-07-21 20:37:56 +0000 | |
| commit | 9cca231873f81c09fe2009cd12174e0c5b74798f (patch) | |
| tree | 7d339a8af954009500c54732292e2c847507f998 | |
| parent | eae7134dde0df61d3384d4cb70bb2e1d15c92199 (diff) | |
| parent | ca91fe8bbf83f72a89d0325d3127b945ed918f11 (diff) | |
Merge changes from topic "b288868098_delGetSvc" into udc-qpr-dev
* changes:
Delete CentralSurfaces.getShadeViewController
Remove getShadeViewController calls
Remove getShadeViewController calls
Remove getShadeViewController calls
Remove getShadeViewController calls
18 files changed, 83 insertions, 70 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java b/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java index 2f6a68c3ff8d..03ad132c452c 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<Optional<CentralSurfaces>> mCentralSurfacesOptionalLazy; private final NotificationShadeWindowController mNotificationShadeController; private final ShadeController mShadeController; + private final Lazy<ShadeViewController> 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> shadeViewController, Lazy<Optional<CentralSurfaces>> centralSurfacesOptionalLazy, Optional<Recents> 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<CentralSurfaces> 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/src/com/android/systemui/dreams/touch/ShadeTouchHandler.java b/packages/SystemUI/src/com/android/systemui/dreams/touch/ShadeTouchHandler.java index 99451f2ee1b9..6f05e83b22ba 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<CentralSurfaces> mSurfaces; + private final ShadeViewController mShadeViewController; private final int mInitiationHeight; @Inject ShadeTouchHandler(Optional<CentralSurfaces> 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/src/com/android/systemui/navigationbar/NavigationBar.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java index 682335e0b419..e134f7c10b9b 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<NavigationBarView> implements private final SysUiState mSysUiFlagsContainer; private final Lazy<Optional<CentralSurfaces>> 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<NavigationBarView> implements @Inject NavigationBar( NavigationBarView navigationBarView, + ShadeController shadeController, NavigationBarFrame navigationBarFrame, @Nullable Bundle savedState, @DisplayId Context context, @@ -541,7 +544,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements Optional<Pip> pipOptional, Optional<Recents> recentsOptional, Lazy<Optional<CentralSurfaces>> centralSurfacesOptionalLazy, - ShadeController shadeController, + ShadeViewController shadeViewController, NotificationRemoteInputManager notificationRemoteInputManager, NotificationShadeDepthController notificationShadeDepthController, @Main Handler mainHandler, @@ -577,6 +580,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements mSysUiFlagsContainer = sysUiFlagsContainer; mCentralSurfacesOptionalLazy = centralSurfacesOptionalLazy; mShadeController = shadeController; + mShadeViewController = shadeViewController; mNotificationRemoteInputManager = notificationRemoteInputManager; mOverviewProxyService = overviewProxyService; mNavigationModeController = navigationModeController; @@ -739,8 +743,7 @@ public class NavigationBar extends ViewController<NavigationBarView> 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<NavigationBarView> implements } private void onVerticalChanged(boolean isVertical) { - Optional<CentralSurfaces> 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/src/com/android/systemui/recents/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java index 207cc1398279..a737a8bca585 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<OverviewProxyLis private final Executor mMainExecutor; private final ShellInterface mShellInterface; private final Lazy<Optional<CentralSurfaces>> mCentralSurfacesOptionalLazy; + private final Lazy<ShadeViewController> mShadeViewControllerLazy; private SysUiState mSysUiState; private final Handler mHandler; private final Lazy<NavigationBarController> mNavBarControllerLazy; @@ -201,11 +201,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis // TODO move this logic to message queue mCentralSurfacesOptionalLazy.get().ifPresent(centralSurfaces -> { 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<OverviewProxyLis ShellInterface shellInterface, Lazy<NavigationBarController> navBarControllerLazy, Lazy<Optional<CentralSurfaces>> centralSurfacesOptionalLazy, + Lazy<ShadeViewController> 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<OverviewProxyLis mMainExecutor = mainExecutor; mShellInterface = shellInterface; mCentralSurfacesOptionalLazy = centralSurfacesOptionalLazy; + mShadeViewControllerLazy = shadeViewControllerLazy; mHandler = new Handler(); mNavBarControllerLazy = navBarControllerLazy; mStatusBarWinController = statusBarWinController; @@ -677,13 +676,10 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis mNavBarControllerLazy.get().getDefaultNavigationBar(); final NavigationBarView navBarView = mNavBarControllerLazy.get().getNavigationBarView(mContext.getDisplayId()); - final ShadeViewController panelController = - mCentralSurfacesOptionalLazy.get() - .map(CentralSurfaces::getShadeViewController) - .orElse(null); if (SysUiState.DEBUG) { Log.d(TAG_OPS, "Updating sysui state flags: navBarFragment=" + navBarFragment - + " navBarView=" + navBarView + " panelController=" + panelController); + + " navBarView=" + navBarView + + " shadeViewController=" + mShadeViewControllerLazy.get()); } if (navBarFragment != null) { @@ -692,9 +688,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis if (navBarView != null) { navBarView.updateDisabledSystemUiStateFlags(mSysUiState); } - if (panelController != null) { - panelController.updateSystemUiStateFlags(); - } + mShadeViewControllerLazy.get().updateSystemUiStateFlags(); if (mStatusBarWinController != null) { mStatusBarWinController.notifyStateChangedCallbacks(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterImpl.kt index 26b51a95acad..dcd18dd7d1bf 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterImpl.kt @@ -45,6 +45,7 @@ import com.android.systemui.plugins.ActivityStarter import com.android.systemui.plugins.ActivityStarter.OnDismissAction import com.android.systemui.settings.UserTracker import com.android.systemui.shade.ShadeController +import com.android.systemui.shade.ShadeViewController import com.android.systemui.statusbar.NotificationLockscreenUserManager import com.android.systemui.statusbar.NotificationShadeWindowController import com.android.systemui.statusbar.SysuiStatusBarStateController @@ -69,6 +70,7 @@ constructor( private val biometricUnlockControllerLazy: Lazy<BiometricUnlockController>, private val keyguardViewMediatorLazy: Lazy<KeyguardViewMediator>, private val shadeControllerLazy: Lazy<ShadeController>, + private val shadeViewControllerLazy: Lazy<ShadeViewController>, private val statusBarKeyguardViewManagerLazy: Lazy<StatusBarKeyguardViewManager>, private val notifShadeWindowControllerLazy: Lazy<NotificationShadeWindowController>, private val activityLaunchAnimator: ActivityLaunchAnimator, @@ -896,7 +898,7 @@ constructor( if (dismissShade) { return StatusBarLaunchAnimatorController( animationController, - it.shadeViewController, + shadeViewControllerLazy.get(), shadeControllerLazy.get(), notifShadeWindowControllerLazy.get(), isLaunchForActivity diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java index acd6e49fe8c1..5c28be3bc678 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java @@ -44,7 +44,6 @@ import com.android.systemui.display.data.repository.DisplayMetricsRepository; import com.android.systemui.navigationbar.NavigationBarView; import com.android.systemui.plugins.ActivityStarter.OnDismissAction; import com.android.systemui.qs.QSPanelController; -import com.android.systemui.shade.ShadeViewController; import com.android.systemui.shared.system.RemoteAnimationRunnerCompat; import com.android.systemui.statusbar.NotificationPresenter; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; @@ -195,9 +194,6 @@ public interface CentralSurfaces extends Dumpable, LifecycleOwner { @Override Lifecycle getLifecycle(); - /** */ - ShadeViewController getShadeViewController(); - /** Get the Keyguard Message Area that displays auth messages. */ AuthKeyguardMessageArea getKeyguardMessageArea(); 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 c3c9a61df2ea..6eeb25fdeb9e 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( @@ -1677,8 +1677,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { Trace.endSection(); } - @Override - public ShadeViewController getShadeViewController() { + protected ShadeViewController getShadeViewController() { return mShadeSurface; } 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 c8174669cc65..89c3a02f9401 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<ScreenOffAnimation> = 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 96a4d900c160..7e9172da1817 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 cbe402017c41..098d51e94fc7 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<KeyguardInteractor>, ) : CallbackController<FoldAodAnimationStatus>, 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/accessibility/SystemActionsTest.java b/packages/SystemUI/tests/src/com/android/systemui/accessibility/SystemActionsTest.java index 025c88c36203..576f689a16d0 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<Optional<CentralSurfaces>> mCentralSurfacesOptionalLazy; @Mock private Optional<Recents> 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 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 872c0794ce64..2b9821406fea 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); } /** 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 25d494cee5e8..cbfad56ed617 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, diff --git a/packages/SystemUI/tests/src/com/android/systemui/recents/OverviewProxyServiceTest.kt b/packages/SystemUI/tests/src/com/android/systemui/recents/OverviewProxyServiceTest.kt index 355c4b667333..6bb13eacc135 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/recents/OverviewProxyServiceTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/recents/OverviewProxyServiceTest.kt @@ -38,6 +38,7 @@ import com.android.systemui.navigationbar.NavigationModeController import com.android.systemui.recents.OverviewProxyService.ACTION_QUICKSTEP import com.android.systemui.settings.FakeDisplayTracker import com.android.systemui.settings.UserTracker +import com.android.systemui.shade.ShadeViewController import com.android.systemui.shared.recents.IOverviewProxy import com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_WAKEFULNESS_MASK import com.android.systemui.shared.system.QuickStepContract.WAKEFULNESS_ASLEEP @@ -93,6 +94,7 @@ class OverviewProxyServiceTest : SysuiTestCase() { @Mock private lateinit var shellInterface: ShellInterface @Mock private lateinit var navBarController: NavigationBarController @Mock private lateinit var centralSurfaces: CentralSurfaces + @Mock private lateinit var shadeViewController: ShadeViewController @Mock private lateinit var navModeController: NavigationModeController @Mock private lateinit var statusBarWinController: NotificationShadeWindowController @Mock private lateinit var userTracker: UserTracker @@ -132,6 +134,7 @@ class OverviewProxyServiceTest : SysuiTestCase() { shellInterface, Lazy { navBarController }, Lazy { Optional.of(centralSurfaces) }, + Lazy { shadeViewController }, navModeController, statusBarWinController, sysUiState, diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ActivityStarterImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ActivityStarterImplTest.kt index 5e0e140563cd..68f2728c9ace 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ActivityStarterImplTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ActivityStarterImplTest.kt @@ -30,6 +30,7 @@ import com.android.systemui.keyguard.WakefulnessLifecycle import com.android.systemui.plugins.ActivityStarter.OnDismissAction import com.android.systemui.settings.UserTracker import com.android.systemui.shade.ShadeController +import com.android.systemui.shade.ShadeViewController import com.android.systemui.statusbar.NotificationLockscreenUserManager import com.android.systemui.statusbar.NotificationShadeWindowController import com.android.systemui.statusbar.SysuiStatusBarStateController @@ -65,6 +66,7 @@ class ActivityStarterImplTest : SysuiTestCase() { @Mock private lateinit var biometricUnlockController: BiometricUnlockController @Mock private lateinit var keyguardViewMediator: KeyguardViewMediator @Mock private lateinit var shadeController: ShadeController + @Mock private lateinit var shadeViewController: ShadeViewController @Mock private lateinit var statusBarKeyguardViewManager: StatusBarKeyguardViewManager @Mock private lateinit var activityLaunchAnimator: ActivityLaunchAnimator @Mock private lateinit var lockScreenUserManager: NotificationLockscreenUserManager @@ -91,6 +93,7 @@ class ActivityStarterImplTest : SysuiTestCase() { Lazy { biometricUnlockController }, Lazy { keyguardViewMediator }, Lazy { shadeController }, + Lazy { shadeViewController }, Lazy { statusBarKeyguardViewManager }, Lazy { notifShadeWindowController }, activityLaunchAnimator, diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewControllerTest.kt index c8ec1bf4af9f..28193db01013 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewControllerTest.kt @@ -140,8 +140,6 @@ class PhoneStatusBarViewControllerTest : SysuiTestCase() { @Test fun handleTouchEventFromStatusBar_viewNotEnabled_returnsTrueAndNoViewEvent() { `when`(centralSurfacesImpl.commandQueuePanelsEnabled).thenReturn(true) - `when`(centralSurfacesImpl.shadeViewController) - .thenReturn(shadeViewController) `when`(shadeViewController.isViewEnabled).thenReturn(false) val returnVal = view.onTouchEvent( MotionEvent.obtain(0L, 0L, MotionEvent.ACTION_DOWN, 0f, 0f, 0)) @@ -152,8 +150,6 @@ class PhoneStatusBarViewControllerTest : SysuiTestCase() { @Test fun handleTouchEventFromStatusBar_viewNotEnabledButIsMoveEvent_viewReceivesEvent() { `when`(centralSurfacesImpl.commandQueuePanelsEnabled).thenReturn(true) - `when`(centralSurfacesImpl.shadeViewController) - .thenReturn(shadeViewController) `when`(shadeViewController.isViewEnabled).thenReturn(false) val event = MotionEvent.obtain(0L, 0L, MotionEvent.ACTION_MOVE, 0f, 0f, 0) @@ -165,8 +161,6 @@ class PhoneStatusBarViewControllerTest : SysuiTestCase() { @Test fun handleTouchEventFromStatusBar_panelAndViewEnabled_viewReceivesEvent() { `when`(centralSurfacesImpl.commandQueuePanelsEnabled).thenReturn(true) - `when`(centralSurfacesImpl.shadeViewController) - .thenReturn(shadeViewController) `when`(shadeViewController.isViewEnabled).thenReturn(true) val event = MotionEvent.obtain(0L, 0L, MotionEvent.ACTION_DOWN, 0f, 2f, 0) @@ -178,8 +172,6 @@ class PhoneStatusBarViewControllerTest : SysuiTestCase() { @Test fun handleTouchEventFromStatusBar_topEdgeTouch_viewNeverReceivesEvent() { `when`(centralSurfacesImpl.commandQueuePanelsEnabled).thenReturn(true) - `when`(centralSurfacesImpl.shadeViewController) - .thenReturn(shadeViewController) `when`(shadeViewController.isFullyCollapsed).thenReturn(true) val event = MotionEvent.obtain(0L, 0L, MotionEvent.ACTION_DOWN, 0f, 0f, 0) 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 2e9a6909e402..e76f26d8128e 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 813597a8b576..7f990a446aaf 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()) |