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
This commit is contained in:
Justin Weir
2023-07-21 20:37:56 +00:00
committed by Android (Google) Code Review
18 changed files with 83 additions and 70 deletions

View File

@@ -54,6 +54,7 @@ import com.android.systemui.recents.Recents;
import com.android.systemui.settings.DisplayTracker; import com.android.systemui.settings.DisplayTracker;
import com.android.systemui.settings.UserTracker; import com.android.systemui.settings.UserTracker;
import com.android.systemui.shade.ShadeController; import com.android.systemui.shade.ShadeController;
import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.NotificationShadeWindowController; import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.phone.CentralSurfaces; import com.android.systemui.statusbar.phone.CentralSurfaces;
@@ -188,6 +189,7 @@ public class SystemActions implements CoreStartable {
private final Lazy<Optional<CentralSurfaces>> mCentralSurfacesOptionalLazy; private final Lazy<Optional<CentralSurfaces>> mCentralSurfacesOptionalLazy;
private final NotificationShadeWindowController mNotificationShadeController; private final NotificationShadeWindowController mNotificationShadeController;
private final ShadeController mShadeController; private final ShadeController mShadeController;
private final Lazy<ShadeViewController> mShadeViewController;
private final StatusBarWindowCallback mNotificationShadeCallback; private final StatusBarWindowCallback mNotificationShadeCallback;
private boolean mDismissNotificationShadeActionRegistered; private boolean mDismissNotificationShadeActionRegistered;
@@ -196,12 +198,14 @@ public class SystemActions implements CoreStartable {
UserTracker userTracker, UserTracker userTracker,
NotificationShadeWindowController notificationShadeController, NotificationShadeWindowController notificationShadeController,
ShadeController shadeController, ShadeController shadeController,
Lazy<ShadeViewController> shadeViewController,
Lazy<Optional<CentralSurfaces>> centralSurfacesOptionalLazy, Lazy<Optional<CentralSurfaces>> centralSurfacesOptionalLazy,
Optional<Recents> recentsOptional, Optional<Recents> recentsOptional,
DisplayTracker displayTracker) { DisplayTracker displayTracker) {
mContext = context; mContext = context;
mUserTracker = userTracker; mUserTracker = userTracker;
mShadeController = shadeController; mShadeController = shadeController;
mShadeViewController = shadeViewController;
mRecentsOptional = recentsOptional; mRecentsOptional = recentsOptional;
mDisplayTracker = displayTracker; mDisplayTracker = displayTracker;
mReceiver = new SystemActionsBroadcastReceiver(); mReceiver = new SystemActionsBroadcastReceiver();
@@ -330,8 +334,7 @@ public class SystemActions implements CoreStartable {
final Optional<CentralSurfaces> centralSurfacesOptional = final Optional<CentralSurfaces> centralSurfacesOptional =
mCentralSurfacesOptionalLazy.get(); mCentralSurfacesOptionalLazy.get();
if (centralSurfacesOptional.isPresent() if (centralSurfacesOptional.isPresent()
&& centralSurfacesOptional.get().getShadeViewController() != null && mShadeViewController.get().isPanelExpanded()
&& centralSurfacesOptional.get().getShadeViewController().isPanelExpanded()
&& !centralSurfacesOptional.get().isKeyguardShowing()) { && !centralSurfacesOptional.get().isKeyguardShowing()) {
if (!mDismissNotificationShadeActionRegistered) { if (!mDismissNotificationShadeActionRegistered) {
mA11yManager.registerSystemAction( mA11yManager.registerSystemAction(

View File

@@ -37,12 +37,15 @@ import javax.inject.Named;
*/ */
public class ShadeTouchHandler implements DreamTouchHandler { public class ShadeTouchHandler implements DreamTouchHandler {
private final Optional<CentralSurfaces> mSurfaces; private final Optional<CentralSurfaces> mSurfaces;
private final ShadeViewController mShadeViewController;
private final int mInitiationHeight; private final int mInitiationHeight;
@Inject @Inject
ShadeTouchHandler(Optional<CentralSurfaces> centralSurfaces, ShadeTouchHandler(Optional<CentralSurfaces> centralSurfaces,
ShadeViewController shadeViewController,
@Named(NOTIFICATION_SHADE_GESTURE_INITIATION_HEIGHT) int initiationHeight) { @Named(NOTIFICATION_SHADE_GESTURE_INITIATION_HEIGHT) int initiationHeight) {
mSurfaces = centralSurfaces; mSurfaces = centralSurfaces;
mShadeViewController = shadeViewController;
mInitiationHeight = initiationHeight; mInitiationHeight = initiationHeight;
} }
@@ -54,12 +57,7 @@ public class ShadeTouchHandler implements DreamTouchHandler {
} }
session.registerInputListener(ev -> { session.registerInputListener(ev -> {
final ShadeViewController viewController = mShadeViewController.handleExternalTouch((MotionEvent) ev);
mSurfaces.map(CentralSurfaces::getShadeViewController).orElse(null);
if (viewController != null) {
viewController.handleExternalTouch((MotionEvent) ev);
}
if (ev instanceof MotionEvent) { if (ev instanceof MotionEvent) {
if (((MotionEvent) ev).getAction() == MotionEvent.ACTION_UP) { if (((MotionEvent) ev).getAction() == MotionEvent.ACTION_UP) {

View File

@@ -133,6 +133,7 @@ import com.android.systemui.settings.DisplayTracker;
import com.android.systemui.settings.UserContextProvider; import com.android.systemui.settings.UserContextProvider;
import com.android.systemui.settings.UserTracker; import com.android.systemui.settings.UserTracker;
import com.android.systemui.shade.ShadeController; import com.android.systemui.shade.ShadeController;
import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.shared.navigationbar.RegionSamplingHelper; import com.android.systemui.shared.navigationbar.RegionSamplingHelper;
import com.android.systemui.shared.recents.utilities.Utilities; import com.android.systemui.shared.recents.utilities.Utilities;
import com.android.systemui.shared.rotation.RotationButton; import com.android.systemui.shared.rotation.RotationButton;
@@ -199,6 +200,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
private final SysUiState mSysUiFlagsContainer; private final SysUiState mSysUiFlagsContainer;
private final Lazy<Optional<CentralSurfaces>> mCentralSurfacesOptionalLazy; private final Lazy<Optional<CentralSurfaces>> mCentralSurfacesOptionalLazy;
private final ShadeController mShadeController; private final ShadeController mShadeController;
private final ShadeViewController mShadeViewController;
private final NotificationRemoteInputManager mNotificationRemoteInputManager; private final NotificationRemoteInputManager mNotificationRemoteInputManager;
private final OverviewProxyService mOverviewProxyService; private final OverviewProxyService mOverviewProxyService;
private final NavigationModeController mNavigationModeController; private final NavigationModeController mNavigationModeController;
@@ -523,6 +525,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
@Inject @Inject
NavigationBar( NavigationBar(
NavigationBarView navigationBarView, NavigationBarView navigationBarView,
ShadeController shadeController,
NavigationBarFrame navigationBarFrame, NavigationBarFrame navigationBarFrame,
@Nullable Bundle savedState, @Nullable Bundle savedState,
@DisplayId Context context, @DisplayId Context context,
@@ -541,7 +544,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
Optional<Pip> pipOptional, Optional<Pip> pipOptional,
Optional<Recents> recentsOptional, Optional<Recents> recentsOptional,
Lazy<Optional<CentralSurfaces>> centralSurfacesOptionalLazy, Lazy<Optional<CentralSurfaces>> centralSurfacesOptionalLazy,
ShadeController shadeController, ShadeViewController shadeViewController,
NotificationRemoteInputManager notificationRemoteInputManager, NotificationRemoteInputManager notificationRemoteInputManager,
NotificationShadeDepthController notificationShadeDepthController, NotificationShadeDepthController notificationShadeDepthController,
@Main Handler mainHandler, @Main Handler mainHandler,
@@ -577,6 +580,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
mSysUiFlagsContainer = sysUiFlagsContainer; mSysUiFlagsContainer = sysUiFlagsContainer;
mCentralSurfacesOptionalLazy = centralSurfacesOptionalLazy; mCentralSurfacesOptionalLazy = centralSurfacesOptionalLazy;
mShadeController = shadeController; mShadeController = shadeController;
mShadeViewController = shadeViewController;
mNotificationRemoteInputManager = notificationRemoteInputManager; mNotificationRemoteInputManager = notificationRemoteInputManager;
mOverviewProxyService = overviewProxyService; mOverviewProxyService = overviewProxyService;
mNavigationModeController = navigationModeController; mNavigationModeController = navigationModeController;
@@ -739,8 +743,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
final Display display = mView.getDisplay(); final Display display = mView.getDisplay();
mView.setComponents(mRecentsOptional); mView.setComponents(mRecentsOptional);
if (mCentralSurfacesOptionalLazy.get().isPresent()) { if (mCentralSurfacesOptionalLazy.get().isPresent()) {
mView.setComponents( mView.setComponents(mShadeViewController);
mCentralSurfacesOptionalLazy.get().get().getShadeViewController());
} }
mView.setDisabledFlags(mDisabledFlags1, mSysUiFlagsContainer); mView.setDisabledFlags(mDisabledFlags1, mSysUiFlagsContainer);
mView.setOnVerticalChangedListener(this::onVerticalChanged); mView.setOnVerticalChangedListener(this::onVerticalChanged);
@@ -1341,9 +1344,10 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
} }
private void onVerticalChanged(boolean isVertical) { private void onVerticalChanged(boolean isVertical) {
Optional<CentralSurfaces> cs = mCentralSurfacesOptionalLazy.get(); // This check can probably be safely removed. It only remained to reduce regression
if (cs.isPresent() && cs.get().getShadeViewController() != null) { // risk for a broad change that removed the CentralSurfaces reference in the if block
cs.get().getShadeViewController().setQsScrimEnabled(!isVertical); if (mCentralSurfacesOptionalLazy.get().isPresent()) {
mShadeViewController.setQsScrimEnabled(!isVertical);
} }
} }

View File

@@ -78,7 +78,6 @@ import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.app.AssistUtils; import com.android.internal.app.AssistUtils;
import com.android.internal.app.IVoiceInteractionSessionListener; import com.android.internal.app.IVoiceInteractionSessionListener;
import com.android.internal.logging.UiEventLogger; import com.android.internal.logging.UiEventLogger;
import com.android.internal.policy.ScreenDecorationsUtils;
import com.android.internal.util.ScreenshotHelper; import com.android.internal.util.ScreenshotHelper;
import com.android.internal.util.ScreenshotRequest; import com.android.internal.util.ScreenshotRequest;
import com.android.systemui.Dumpable; import com.android.systemui.Dumpable;
@@ -143,6 +142,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
private final Executor mMainExecutor; private final Executor mMainExecutor;
private final ShellInterface mShellInterface; private final ShellInterface mShellInterface;
private final Lazy<Optional<CentralSurfaces>> mCentralSurfacesOptionalLazy; private final Lazy<Optional<CentralSurfaces>> mCentralSurfacesOptionalLazy;
private final Lazy<ShadeViewController> mShadeViewControllerLazy;
private SysUiState mSysUiState; private SysUiState mSysUiState;
private final Handler mHandler; private final Handler mHandler;
private final Lazy<NavigationBarController> mNavBarControllerLazy; private final Lazy<NavigationBarController> mNavBarControllerLazy;
@@ -201,11 +201,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
// TODO move this logic to message queue // TODO move this logic to message queue
mCentralSurfacesOptionalLazy.get().ifPresent(centralSurfaces -> { mCentralSurfacesOptionalLazy.get().ifPresent(centralSurfaces -> {
if (event.getActionMasked() == ACTION_DOWN) { if (event.getActionMasked() == ACTION_DOWN) {
ShadeViewController shadeViewController = mShadeViewControllerLazy.get().startExpandLatencyTracking();
centralSurfaces.getShadeViewController();
if (shadeViewController != null) {
shadeViewController.startExpandLatencyTracking();
}
} }
mHandler.post(() -> { mHandler.post(() -> {
int action = event.getActionMasked(); int action = event.getActionMasked();
@@ -552,8 +548,10 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
ShellInterface shellInterface, ShellInterface shellInterface,
Lazy<NavigationBarController> navBarControllerLazy, Lazy<NavigationBarController> navBarControllerLazy,
Lazy<Optional<CentralSurfaces>> centralSurfacesOptionalLazy, Lazy<Optional<CentralSurfaces>> centralSurfacesOptionalLazy,
Lazy<ShadeViewController> shadeViewControllerLazy,
NavigationModeController navModeController, NavigationModeController navModeController,
NotificationShadeWindowController statusBarWinController, SysUiState sysUiState, NotificationShadeWindowController statusBarWinController,
SysUiState sysUiState,
UserTracker userTracker, UserTracker userTracker,
ScreenLifecycle screenLifecycle, ScreenLifecycle screenLifecycle,
WakefulnessLifecycle wakefulnessLifecycle, WakefulnessLifecycle wakefulnessLifecycle,
@@ -573,6 +571,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
mMainExecutor = mainExecutor; mMainExecutor = mainExecutor;
mShellInterface = shellInterface; mShellInterface = shellInterface;
mCentralSurfacesOptionalLazy = centralSurfacesOptionalLazy; mCentralSurfacesOptionalLazy = centralSurfacesOptionalLazy;
mShadeViewControllerLazy = shadeViewControllerLazy;
mHandler = new Handler(); mHandler = new Handler();
mNavBarControllerLazy = navBarControllerLazy; mNavBarControllerLazy = navBarControllerLazy;
mStatusBarWinController = statusBarWinController; mStatusBarWinController = statusBarWinController;
@@ -677,13 +676,10 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
mNavBarControllerLazy.get().getDefaultNavigationBar(); mNavBarControllerLazy.get().getDefaultNavigationBar();
final NavigationBarView navBarView = final NavigationBarView navBarView =
mNavBarControllerLazy.get().getNavigationBarView(mContext.getDisplayId()); mNavBarControllerLazy.get().getNavigationBarView(mContext.getDisplayId());
final ShadeViewController panelController =
mCentralSurfacesOptionalLazy.get()
.map(CentralSurfaces::getShadeViewController)
.orElse(null);
if (SysUiState.DEBUG) { if (SysUiState.DEBUG) {
Log.d(TAG_OPS, "Updating sysui state flags: navBarFragment=" + navBarFragment Log.d(TAG_OPS, "Updating sysui state flags: navBarFragment=" + navBarFragment
+ " navBarView=" + navBarView + " panelController=" + panelController); + " navBarView=" + navBarView
+ " shadeViewController=" + mShadeViewControllerLazy.get());
} }
if (navBarFragment != null) { if (navBarFragment != null) {
@@ -692,9 +688,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
if (navBarView != null) { if (navBarView != null) {
navBarView.updateDisabledSystemUiStateFlags(mSysUiState); navBarView.updateDisabledSystemUiStateFlags(mSysUiState);
} }
if (panelController != null) { mShadeViewControllerLazy.get().updateSystemUiStateFlags();
panelController.updateSystemUiStateFlags();
}
if (mStatusBarWinController != null) { if (mStatusBarWinController != null) {
mStatusBarWinController.notifyStateChangedCallbacks(); mStatusBarWinController.notifyStateChangedCallbacks();
} }

View File

@@ -45,6 +45,7 @@ import com.android.systemui.plugins.ActivityStarter
import com.android.systemui.plugins.ActivityStarter.OnDismissAction import com.android.systemui.plugins.ActivityStarter.OnDismissAction
import com.android.systemui.settings.UserTracker import com.android.systemui.settings.UserTracker
import com.android.systemui.shade.ShadeController import com.android.systemui.shade.ShadeController
import com.android.systemui.shade.ShadeViewController
import com.android.systemui.statusbar.NotificationLockscreenUserManager import com.android.systemui.statusbar.NotificationLockscreenUserManager
import com.android.systemui.statusbar.NotificationShadeWindowController import com.android.systemui.statusbar.NotificationShadeWindowController
import com.android.systemui.statusbar.SysuiStatusBarStateController import com.android.systemui.statusbar.SysuiStatusBarStateController
@@ -69,6 +70,7 @@ constructor(
private val biometricUnlockControllerLazy: Lazy<BiometricUnlockController>, private val biometricUnlockControllerLazy: Lazy<BiometricUnlockController>,
private val keyguardViewMediatorLazy: Lazy<KeyguardViewMediator>, private val keyguardViewMediatorLazy: Lazy<KeyguardViewMediator>,
private val shadeControllerLazy: Lazy<ShadeController>, private val shadeControllerLazy: Lazy<ShadeController>,
private val shadeViewControllerLazy: Lazy<ShadeViewController>,
private val statusBarKeyguardViewManagerLazy: Lazy<StatusBarKeyguardViewManager>, private val statusBarKeyguardViewManagerLazy: Lazy<StatusBarKeyguardViewManager>,
private val notifShadeWindowControllerLazy: Lazy<NotificationShadeWindowController>, private val notifShadeWindowControllerLazy: Lazy<NotificationShadeWindowController>,
private val activityLaunchAnimator: ActivityLaunchAnimator, private val activityLaunchAnimator: ActivityLaunchAnimator,
@@ -896,7 +898,7 @@ constructor(
if (dismissShade) { if (dismissShade) {
return StatusBarLaunchAnimatorController( return StatusBarLaunchAnimatorController(
animationController, animationController,
it.shadeViewController, shadeViewControllerLazy.get(),
shadeControllerLazy.get(), shadeControllerLazy.get(),
notifShadeWindowControllerLazy.get(), notifShadeWindowControllerLazy.get(),
isLaunchForActivity isLaunchForActivity

View File

@@ -44,7 +44,6 @@ import com.android.systemui.display.data.repository.DisplayMetricsRepository;
import com.android.systemui.navigationbar.NavigationBarView; import com.android.systemui.navigationbar.NavigationBarView;
import com.android.systemui.plugins.ActivityStarter.OnDismissAction; import com.android.systemui.plugins.ActivityStarter.OnDismissAction;
import com.android.systemui.qs.QSPanelController; import com.android.systemui.qs.QSPanelController;
import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.shared.system.RemoteAnimationRunnerCompat; import com.android.systemui.shared.system.RemoteAnimationRunnerCompat;
import com.android.systemui.statusbar.NotificationPresenter; import com.android.systemui.statusbar.NotificationPresenter;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
@@ -195,9 +194,6 @@ public interface CentralSurfaces extends Dumpable, LifecycleOwner {
@Override @Override
Lifecycle getLifecycle(); Lifecycle getLifecycle();
/** */
ShadeViewController getShadeViewController();
/** Get the Keyguard Message Area that displays auth messages. */ /** Get the Keyguard Message Area that displays auth messages. */
AuthKeyguardMessageArea getKeyguardMessageArea(); AuthKeyguardMessageArea getKeyguardMessageArea();

View File

@@ -1326,7 +1326,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
} }
}); });
mScreenOffAnimationController.initialize(this, mLightRevealScrim); mScreenOffAnimationController.initialize(this, mShadeSurface, mLightRevealScrim);
updateLightRevealScrimVisibility(); updateLightRevealScrimVisibility();
mShadeSurface.initDependencies( mShadeSurface.initDependencies(
@@ -1677,8 +1677,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
Trace.endSection(); Trace.endSection();
} }
@Override protected ShadeViewController getShadeViewController() {
public ShadeViewController getShadeViewController() {
return mShadeSurface; return mShadeSurface;
} }

View File

@@ -18,6 +18,7 @@ package com.android.systemui.statusbar.phone
import android.view.View import android.view.View
import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.keyguard.WakefulnessLifecycle import com.android.systemui.keyguard.WakefulnessLifecycle
import com.android.systemui.shade.ShadeViewController
import com.android.systemui.statusbar.LightRevealScrim import com.android.systemui.statusbar.LightRevealScrim
import com.android.systemui.unfold.FoldAodAnimationController import com.android.systemui.unfold.FoldAodAnimationController
import com.android.systemui.unfold.SysUIUnfoldComponent import com.android.systemui.unfold.SysUIUnfoldComponent
@@ -37,8 +38,12 @@ class ScreenOffAnimationController @Inject constructor(
private val animations: List<ScreenOffAnimation> = private val animations: List<ScreenOffAnimation> =
listOfNotNull(foldToAodAnimation, unlockedScreenOffAnimation) listOfNotNull(foldToAodAnimation, unlockedScreenOffAnimation)
fun initialize(centralSurfaces: CentralSurfaces, lightRevealScrim: LightRevealScrim) { fun initialize(
animations.forEach { it.initialize(centralSurfaces, lightRevealScrim) } centralSurfaces: CentralSurfaces,
shadeViewController: ShadeViewController,
lightRevealScrim: LightRevealScrim,
) {
animations.forEach { it.initialize(centralSurfaces, shadeViewController, lightRevealScrim) }
wakefulnessLifecycle.addObserver(this) wakefulnessLifecycle.addObserver(this)
} }
@@ -197,7 +202,11 @@ class ScreenOffAnimationController @Inject constructor(
} }
interface ScreenOffAnimation { 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 * Called when started going to sleep, should return true if the animation will be played

View File

@@ -20,6 +20,7 @@ import com.android.app.animation.Interpolators
import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.keyguard.KeyguardViewMediator import com.android.systemui.keyguard.KeyguardViewMediator
import com.android.systemui.keyguard.WakefulnessLifecycle import com.android.systemui.keyguard.WakefulnessLifecycle
import com.android.systemui.shade.ShadeViewController
import com.android.systemui.statusbar.CircleReveal import com.android.systemui.statusbar.CircleReveal
import com.android.systemui.statusbar.LightRevealScrim import com.android.systemui.statusbar.LightRevealScrim
import com.android.systemui.statusbar.NotificationShadeWindowController import com.android.systemui.statusbar.NotificationShadeWindowController
@@ -66,7 +67,8 @@ class UnlockedScreenOffAnimationController @Inject constructor(
private val powerManager: PowerManager, private val powerManager: PowerManager,
private val handler: Handler = Handler() private val handler: Handler = Handler()
) : WakefulnessLifecycle.Observer, ScreenOffAnimation { ) : 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, * Whether or not [initialize] has been called to provide us with the StatusBar,
* NotificationPanelViewController, and LightRevealSrim so that we can run the unlocked screen * NotificationPanelViewController, and LightRevealSrim so that we can run the unlocked screen
@@ -126,7 +128,7 @@ class UnlockedScreenOffAnimationController @Inject constructor(
lightRevealAnimator.start() lightRevealAnimator.start()
} }
val animatorDurationScaleObserver = object : ContentObserver(null) { private val animatorDurationScaleObserver = object : ContentObserver(null) {
override fun onChange(selfChange: Boolean) { override fun onChange(selfChange: Boolean) {
updateAnimatorDurationScale() updateAnimatorDurationScale()
} }
@@ -134,11 +136,13 @@ class UnlockedScreenOffAnimationController @Inject constructor(
override fun initialize( override fun initialize(
centralSurfaces: CentralSurfaces, centralSurfaces: CentralSurfaces,
shadeViewController: ShadeViewController,
lightRevealScrim: LightRevealScrim lightRevealScrim: LightRevealScrim
) { ) {
this.initialized = true this.initialized = true
this.lightRevealScrim = lightRevealScrim this.lightRevealScrim = lightRevealScrim
this.mCentralSurfaces = centralSurfaces this.centralSurfaces = centralSurfaces
this.shadeViewController = shadeViewController
updateAnimatorDurationScale() updateAnimatorDurationScale()
globalSettings.registerContentObserver( globalSettings.registerContentObserver(
@@ -198,7 +202,7 @@ class UnlockedScreenOffAnimationController @Inject constructor(
// Tell the CentralSurfaces to become keyguard for real - we waited on that // Tell the CentralSurfaces to become keyguard for real - we waited on that
// since it is slow and would have caused the animation to jank. // 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. // Run the callback given to us by the KeyguardVisibilityHelper.
after.run() 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 // 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 // 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. // 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 // Show AOD. That'll cause the KeyguardVisibilityHelper to call
// #animateInKeyguard. // #animateInKeyguard.
mCentralSurfaces.shadeViewController.showAodUi() shadeViewController.showAodUi()
} }
}, (ANIMATE_IN_KEYGUARD_DELAY * animatorDurationScale).toLong()) }, (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 // 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, // already expanded and showing notifications/QS, the animation looks really messy. For now,
// disable it if the notification panel is expanded. // disable it if the notification panel is expanded.
if ((!this::mCentralSurfaces.isInitialized || if ((!this::centralSurfaces.isInitialized ||
mCentralSurfaces.shadeViewController.isPanelExpanded) && shadeViewController.isPanelExpanded) &&
// Status bar might be expanded because we have started // Status bar might be expanded because we have started
// playing the animation already // playing the animation already
!isAnimationPlaying() !isAnimationPlaying()

View File

@@ -31,6 +31,7 @@ import com.android.systemui.keyguard.WakefulnessLifecycle
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor
import com.android.systemui.lifecycle.repeatWhenAttached import com.android.systemui.lifecycle.repeatWhenAttached
import com.android.systemui.shade.ShadeFoldAnimator import com.android.systemui.shade.ShadeFoldAnimator
import com.android.systemui.shade.ShadeViewController
import com.android.systemui.statusbar.LightRevealScrim import com.android.systemui.statusbar.LightRevealScrim
import com.android.systemui.statusbar.phone.CentralSurfaces import com.android.systemui.statusbar.phone.CentralSurfaces
import com.android.systemui.statusbar.phone.ScreenOffAnimation import com.android.systemui.statusbar.phone.ScreenOffAnimation
@@ -62,7 +63,7 @@ constructor(
private val keyguardInteractor: Lazy<KeyguardInteractor>, private val keyguardInteractor: Lazy<KeyguardInteractor>,
) : CallbackController<FoldAodAnimationStatus>, ScreenOffAnimation, WakefulnessLifecycle.Observer { ) : CallbackController<FoldAodAnimationStatus>, ScreenOffAnimation, WakefulnessLifecycle.Observer {
private lateinit var centralSurfaces: CentralSurfaces private lateinit var shadeViewController: ShadeViewController
private var isFolded = false private var isFolded = false
private var isFoldHandled = true private var isFoldHandled = true
@@ -87,8 +88,12 @@ constructor(
) )
} }
override fun initialize(centralSurfaces: CentralSurfaces, lightRevealScrim: LightRevealScrim) { override fun initialize(
this.centralSurfaces = centralSurfaces centralSurfaces: CentralSurfaces,
shadeViewController: ShadeViewController,
lightRevealScrim: LightRevealScrim,
) {
this.shadeViewController = shadeViewController
deviceStateManager.registerCallback(mainExecutor, FoldListener()) deviceStateManager.registerCallback(mainExecutor, FoldListener())
wakefulnessLifecycle.addObserver(this) wakefulnessLifecycle.addObserver(this)
@@ -128,7 +133,7 @@ constructor(
} }
private fun getShadeFoldAnimator(): ShadeFoldAnimator = private fun getShadeFoldAnimator(): ShadeFoldAnimator =
centralSurfaces.shadeViewController.shadeFoldAnimator shadeViewController.shadeFoldAnimator
private fun setAnimationState(playing: Boolean) { private fun setAnimationState(playing: Boolean) {
shouldPlayAnimation = playing shouldPlayAnimation = playing

View File

@@ -39,6 +39,7 @@ import com.android.systemui.recents.Recents;
import com.android.systemui.settings.FakeDisplayTracker; import com.android.systemui.settings.FakeDisplayTracker;
import com.android.systemui.settings.UserTracker; import com.android.systemui.settings.UserTracker;
import com.android.systemui.shade.ShadeController; import com.android.systemui.shade.ShadeController;
import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.statusbar.NotificationShadeWindowController; import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.phone.CentralSurfaces; import com.android.systemui.statusbar.phone.CentralSurfaces;
@@ -65,6 +66,8 @@ public class SystemActionsTest extends SysuiTestCase {
@Mock @Mock
private ShadeController mShadeController; private ShadeController mShadeController;
@Mock @Mock
private ShadeViewController mShadeViewController;
@Mock
private Lazy<Optional<CentralSurfaces>> mCentralSurfacesOptionalLazy; private Lazy<Optional<CentralSurfaces>> mCentralSurfacesOptionalLazy;
@Mock @Mock
private Optional<Recents> mRecentsOptional; private Optional<Recents> mRecentsOptional;
@@ -82,7 +85,8 @@ public class SystemActionsTest extends SysuiTestCase {
mContext.addMockSystemService(TelecomManager.class, mTelecomManager); mContext.addMockSystemService(TelecomManager.class, mTelecomManager);
mContext.addMockSystemService(InputManager.class, mInputManager); mContext.addMockSystemService(InputManager.class, mInputManager);
mSystemActions = new SystemActions(mContext, mUserTracker, mNotificationShadeController, mSystemActions = new SystemActions(mContext, mUserTracker, mNotificationShadeController,
mShadeController, mCentralSurfacesOptionalLazy, mRecentsOptional, mDisplayTracker); mShadeController, () -> mShadeViewController, mCentralSurfacesOptionalLazy,
mRecentsOptional, mDisplayTracker);
} }
@Test @Test

View File

@@ -61,10 +61,8 @@ public class ShadeTouchHandlerTest extends SysuiTestCase {
@Before @Before
public void setup() { public void setup() {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
mTouchHandler = new ShadeTouchHandler(Optional.of(mCentralSurfaces), mTouchHandler = new ShadeTouchHandler(Optional.of(mCentralSurfaces), mShadeViewController,
TOUCH_HEIGHT); TOUCH_HEIGHT);
when(mCentralSurfaces.getShadeViewController())
.thenReturn(mShadeViewController);
} }
/** /**

View File

@@ -94,6 +94,7 @@ import com.android.systemui.settings.UserContextProvider;
import com.android.systemui.settings.UserTracker; import com.android.systemui.settings.UserTracker;
import com.android.systemui.shade.NotificationShadeWindowView; import com.android.systemui.shade.NotificationShadeWindowView;
import com.android.systemui.shade.ShadeController; import com.android.systemui.shade.ShadeController;
import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.shared.rotation.RotationButtonController; import com.android.systemui.shared.rotation.RotationButtonController;
import com.android.systemui.shared.system.TaskStackChangeListeners; import com.android.systemui.shared.system.TaskStackChangeListeners;
import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.CommandQueue;
@@ -467,6 +468,7 @@ public class NavigationBarTest extends SysuiTestCase {
when(deviceProvisionedController.isDeviceProvisioned()).thenReturn(true); when(deviceProvisionedController.isDeviceProvisioned()).thenReturn(true);
return spy(new NavigationBar( return spy(new NavigationBar(
mNavigationBarView, mNavigationBarView,
mock(ShadeController.class),
mNavigationBarFrame, mNavigationBarFrame,
null, null,
context, context,
@@ -485,7 +487,7 @@ public class NavigationBarTest extends SysuiTestCase {
Optional.of(mock(Pip.class)), Optional.of(mock(Pip.class)),
Optional.of(mock(Recents.class)), Optional.of(mock(Recents.class)),
() -> Optional.of(mCentralSurfaces), () -> Optional.of(mCentralSurfaces),
mock(ShadeController.class), mock(ShadeViewController.class),
mock(NotificationRemoteInputManager.class), mock(NotificationRemoteInputManager.class),
mock(NotificationShadeDepthController.class), mock(NotificationShadeDepthController.class),
mHandler, mHandler,

View File

@@ -38,6 +38,7 @@ import com.android.systemui.navigationbar.NavigationModeController
import com.android.systemui.recents.OverviewProxyService.ACTION_QUICKSTEP import com.android.systemui.recents.OverviewProxyService.ACTION_QUICKSTEP
import com.android.systemui.settings.FakeDisplayTracker import com.android.systemui.settings.FakeDisplayTracker
import com.android.systemui.settings.UserTracker import com.android.systemui.settings.UserTracker
import com.android.systemui.shade.ShadeViewController
import com.android.systemui.shared.recents.IOverviewProxy 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.SYSUI_STATE_WAKEFULNESS_MASK
import com.android.systemui.shared.system.QuickStepContract.WAKEFULNESS_ASLEEP 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 shellInterface: ShellInterface
@Mock private lateinit var navBarController: NavigationBarController @Mock private lateinit var navBarController: NavigationBarController
@Mock private lateinit var centralSurfaces: CentralSurfaces @Mock private lateinit var centralSurfaces: CentralSurfaces
@Mock private lateinit var shadeViewController: ShadeViewController
@Mock private lateinit var navModeController: NavigationModeController @Mock private lateinit var navModeController: NavigationModeController
@Mock private lateinit var statusBarWinController: NotificationShadeWindowController @Mock private lateinit var statusBarWinController: NotificationShadeWindowController
@Mock private lateinit var userTracker: UserTracker @Mock private lateinit var userTracker: UserTracker
@@ -132,6 +134,7 @@ class OverviewProxyServiceTest : SysuiTestCase() {
shellInterface, shellInterface,
Lazy { navBarController }, Lazy { navBarController },
Lazy { Optional.of(centralSurfaces) }, Lazy { Optional.of(centralSurfaces) },
Lazy { shadeViewController },
navModeController, navModeController,
statusBarWinController, statusBarWinController,
sysUiState, sysUiState,

View File

@@ -30,6 +30,7 @@ import com.android.systemui.keyguard.WakefulnessLifecycle
import com.android.systemui.plugins.ActivityStarter.OnDismissAction import com.android.systemui.plugins.ActivityStarter.OnDismissAction
import com.android.systemui.settings.UserTracker import com.android.systemui.settings.UserTracker
import com.android.systemui.shade.ShadeController import com.android.systemui.shade.ShadeController
import com.android.systemui.shade.ShadeViewController
import com.android.systemui.statusbar.NotificationLockscreenUserManager import com.android.systemui.statusbar.NotificationLockscreenUserManager
import com.android.systemui.statusbar.NotificationShadeWindowController import com.android.systemui.statusbar.NotificationShadeWindowController
import com.android.systemui.statusbar.SysuiStatusBarStateController import com.android.systemui.statusbar.SysuiStatusBarStateController
@@ -65,6 +66,7 @@ class ActivityStarterImplTest : SysuiTestCase() {
@Mock private lateinit var biometricUnlockController: BiometricUnlockController @Mock private lateinit var biometricUnlockController: BiometricUnlockController
@Mock private lateinit var keyguardViewMediator: KeyguardViewMediator @Mock private lateinit var keyguardViewMediator: KeyguardViewMediator
@Mock private lateinit var shadeController: ShadeController @Mock private lateinit var shadeController: ShadeController
@Mock private lateinit var shadeViewController: ShadeViewController
@Mock private lateinit var statusBarKeyguardViewManager: StatusBarKeyguardViewManager @Mock private lateinit var statusBarKeyguardViewManager: StatusBarKeyguardViewManager
@Mock private lateinit var activityLaunchAnimator: ActivityLaunchAnimator @Mock private lateinit var activityLaunchAnimator: ActivityLaunchAnimator
@Mock private lateinit var lockScreenUserManager: NotificationLockscreenUserManager @Mock private lateinit var lockScreenUserManager: NotificationLockscreenUserManager
@@ -91,6 +93,7 @@ class ActivityStarterImplTest : SysuiTestCase() {
Lazy { biometricUnlockController }, Lazy { biometricUnlockController },
Lazy { keyguardViewMediator }, Lazy { keyguardViewMediator },
Lazy { shadeController }, Lazy { shadeController },
Lazy { shadeViewController },
Lazy { statusBarKeyguardViewManager }, Lazy { statusBarKeyguardViewManager },
Lazy { notifShadeWindowController }, Lazy { notifShadeWindowController },
activityLaunchAnimator, activityLaunchAnimator,

View File

@@ -140,8 +140,6 @@ class PhoneStatusBarViewControllerTest : SysuiTestCase() {
@Test @Test
fun handleTouchEventFromStatusBar_viewNotEnabled_returnsTrueAndNoViewEvent() { fun handleTouchEventFromStatusBar_viewNotEnabled_returnsTrueAndNoViewEvent() {
`when`(centralSurfacesImpl.commandQueuePanelsEnabled).thenReturn(true) `when`(centralSurfacesImpl.commandQueuePanelsEnabled).thenReturn(true)
`when`(centralSurfacesImpl.shadeViewController)
.thenReturn(shadeViewController)
`when`(shadeViewController.isViewEnabled).thenReturn(false) `when`(shadeViewController.isViewEnabled).thenReturn(false)
val returnVal = view.onTouchEvent( val returnVal = view.onTouchEvent(
MotionEvent.obtain(0L, 0L, MotionEvent.ACTION_DOWN, 0f, 0f, 0)) MotionEvent.obtain(0L, 0L, MotionEvent.ACTION_DOWN, 0f, 0f, 0))
@@ -152,8 +150,6 @@ class PhoneStatusBarViewControllerTest : SysuiTestCase() {
@Test @Test
fun handleTouchEventFromStatusBar_viewNotEnabledButIsMoveEvent_viewReceivesEvent() { fun handleTouchEventFromStatusBar_viewNotEnabledButIsMoveEvent_viewReceivesEvent() {
`when`(centralSurfacesImpl.commandQueuePanelsEnabled).thenReturn(true) `when`(centralSurfacesImpl.commandQueuePanelsEnabled).thenReturn(true)
`when`(centralSurfacesImpl.shadeViewController)
.thenReturn(shadeViewController)
`when`(shadeViewController.isViewEnabled).thenReturn(false) `when`(shadeViewController.isViewEnabled).thenReturn(false)
val event = MotionEvent.obtain(0L, 0L, MotionEvent.ACTION_MOVE, 0f, 0f, 0) val event = MotionEvent.obtain(0L, 0L, MotionEvent.ACTION_MOVE, 0f, 0f, 0)
@@ -165,8 +161,6 @@ class PhoneStatusBarViewControllerTest : SysuiTestCase() {
@Test @Test
fun handleTouchEventFromStatusBar_panelAndViewEnabled_viewReceivesEvent() { fun handleTouchEventFromStatusBar_panelAndViewEnabled_viewReceivesEvent() {
`when`(centralSurfacesImpl.commandQueuePanelsEnabled).thenReturn(true) `when`(centralSurfacesImpl.commandQueuePanelsEnabled).thenReturn(true)
`when`(centralSurfacesImpl.shadeViewController)
.thenReturn(shadeViewController)
`when`(shadeViewController.isViewEnabled).thenReturn(true) `when`(shadeViewController.isViewEnabled).thenReturn(true)
val event = MotionEvent.obtain(0L, 0L, MotionEvent.ACTION_DOWN, 0f, 2f, 0) val event = MotionEvent.obtain(0L, 0L, MotionEvent.ACTION_DOWN, 0f, 2f, 0)
@@ -178,8 +172,6 @@ class PhoneStatusBarViewControllerTest : SysuiTestCase() {
@Test @Test
fun handleTouchEventFromStatusBar_topEdgeTouch_viewNeverReceivesEvent() { fun handleTouchEventFromStatusBar_topEdgeTouch_viewNeverReceivesEvent() {
`when`(centralSurfacesImpl.commandQueuePanelsEnabled).thenReturn(true) `when`(centralSurfacesImpl.commandQueuePanelsEnabled).thenReturn(true)
`when`(centralSurfacesImpl.shadeViewController)
.thenReturn(shadeViewController)
`when`(shadeViewController.isFullyCollapsed).thenReturn(true) `when`(shadeViewController.isFullyCollapsed).thenReturn(true)
val event = MotionEvent.obtain(0L, 0L, MotionEvent.ACTION_DOWN, 0f, 0f, 0) val event = MotionEvent.obtain(0L, 0L, MotionEvent.ACTION_DOWN, 0f, 0f, 0)

View File

@@ -97,9 +97,7 @@ class UnlockedScreenOffAnimationControllerTest : SysuiTestCase() {
powerManager, powerManager,
handler = handler handler = handler
) )
controller.initialize(centralSurfaces, lightRevealScrim) controller.initialize(centralSurfaces, shadeViewController, lightRevealScrim)
`when`(centralSurfaces.shadeViewController).thenReturn(
shadeViewController)
// Screen off does not run if the panel is expanded, so we should say it's collapsed to test // Screen off does not run if the panel is expanded, so we should say it's collapsed to test
// screen off. // screen off.

View File

@@ -101,7 +101,6 @@ class FoldAodAnimationControllerTest : SysuiTestCase() {
whenever(viewGroup.viewTreeObserver).thenReturn(viewTreeObserver) whenever(viewGroup.viewTreeObserver).thenReturn(viewTreeObserver)
whenever(wakefulnessLifecycle.lastSleepReason) whenever(wakefulnessLifecycle.lastSleepReason)
.thenReturn(PowerManager.GO_TO_SLEEP_REASON_DEVICE_FOLD) .thenReturn(PowerManager.GO_TO_SLEEP_REASON_DEVICE_FOLD)
whenever(centralSurfaces.shadeViewController).thenReturn(shadeViewController)
whenever(shadeFoldAnimator.startFoldToAodAnimation(any(), any(), any())).then { whenever(shadeFoldAnimator.startFoldToAodAnimation(any(), any(), any())).then {
val onActionStarted = it.arguments[0] as Runnable val onActionStarted = it.arguments[0] as Runnable
onActionStarted.run() onActionStarted.run()
@@ -124,7 +123,7 @@ class FoldAodAnimationControllerTest : SysuiTestCase() {
latencyTracker, latencyTracker,
{ keyguardInteractor }, { keyguardInteractor },
) )
.apply { initialize(centralSurfaces, lightRevealScrim) } .apply { initialize(centralSurfaces, shadeViewController, lightRevealScrim) }
verify(deviceStateManager).registerCallback(any(), foldStateListenerCaptor.capture()) verify(deviceStateManager).registerCallback(any(), foldStateListenerCaptor.capture())