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/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/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/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