Merge changes from topic "b249277686_shadeCs" into udc-qpr-dev
* changes:
Move shade code out of CentralSurfaces
Move shade code out of CentralSurfaces
diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/ActivityStarter.java b/packages/SystemUI/plugin/src/com/android/systemui/plugins/ActivityStarter.java
index 2baeaf6..9cc87fd 100644
--- a/packages/SystemUI/plugin/src/com/android/systemui/plugins/ActivityStarter.java
+++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/ActivityStarter.java
@@ -133,6 +133,9 @@
boolean willAnimateOnKeyguard,
@Nullable String customMessage);
+ /** Whether we should animate an activity launch. */
+ boolean shouldAnimateLaunch(boolean isActivityIntent);
+
interface Callback {
void onActivityStarted(int resultCode);
}
diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java b/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java
index 4158390..eebc1f0 100644
--- a/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java
+++ b/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java
@@ -485,13 +485,11 @@
}
private void handleNotifications() {
- mCentralSurfacesOptionalLazy.get().ifPresent(
- CentralSurfaces::animateExpandNotificationsPanel);
+ mShadeController.animateExpandShade();
}
private void handleQuickSettings() {
- mCentralSurfacesOptionalLazy.get().ifPresent(
- centralSurfaces -> centralSurfaces.animateExpandSettingsPanel(null));
+ mShadeController.animateExpandQs();
}
private void handlePowerDialog() {
diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialogLite.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialogLite.java
index 2807107..c71775b 100644
--- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialogLite.java
+++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialogLite.java
@@ -125,6 +125,7 @@
import com.android.systemui.plugins.GlobalActionsPanelPlugin;
import com.android.systemui.scrim.ScrimDrawable;
import com.android.systemui.settings.UserTracker;
+import com.android.systemui.shade.ShadeController;
import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.VibratorHelper;
import com.android.systemui.statusbar.phone.CentralSurfaces;
@@ -250,6 +251,7 @@
protected Handler mMainHandler;
private int mSmallestScreenWidthDp;
private final Optional<CentralSurfaces> mCentralSurfacesOptional;
+ private final ShadeController mShadeController;
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
private final DialogLaunchAnimator mDialogLaunchAnimator;
@@ -360,6 +362,7 @@
@Main Handler handler,
PackageManager packageManager,
Optional<CentralSurfaces> centralSurfacesOptional,
+ ShadeController shadeController,
KeyguardUpdateMonitor keyguardUpdateMonitor,
DialogLaunchAnimator dialogLaunchAnimator) {
mContext = context;
@@ -392,6 +395,7 @@
mMainHandler = handler;
mSmallestScreenWidthDp = resources.getConfiguration().smallestScreenWidthDp;
mCentralSurfacesOptional = centralSurfacesOptional;
+ mShadeController = shadeController;
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
mDialogLaunchAnimator = dialogLaunchAnimator;
@@ -700,7 +704,9 @@
mAdapter, mOverflowAdapter, mSysuiColorExtractor, mStatusBarService,
mLightBarController,
mNotificationShadeWindowController, this::onRefresh, mKeyguardShowing,
- mPowerAdapter, mUiEventLogger, mCentralSurfacesOptional, mKeyguardUpdateMonitor,
+ mPowerAdapter, mUiEventLogger, mCentralSurfacesOptional,
+ mShadeController,
+ mKeyguardUpdateMonitor,
mLockPatternUtils);
dialog.setOnDismissListener(this);
@@ -2205,6 +2211,7 @@
private UiEventLogger mUiEventLogger;
private GestureDetector mGestureDetector;
private Optional<CentralSurfaces> mCentralSurfacesOptional;
+ private final ShadeController mShadeController;
private KeyguardUpdateMonitor mKeyguardUpdateMonitor;
private LockPatternUtils mLockPatternUtils;
private float mWindowDimAmount;
@@ -2278,6 +2285,7 @@
Runnable onRefreshCallback, boolean keyguardShowing,
MyPowerOptionsAdapter powerAdapter, UiEventLogger uiEventLogger,
Optional<CentralSurfaces> centralSurfacesOptional,
+ ShadeController shadeController,
KeyguardUpdateMonitor keyguardUpdateMonitor,
LockPatternUtils lockPatternUtils) {
// We set dismissOnDeviceLock to false because we have a custom broadcast receiver to
@@ -2295,6 +2303,7 @@
mKeyguardShowing = keyguardShowing;
mUiEventLogger = uiEventLogger;
mCentralSurfacesOptional = centralSurfacesOptional;
+ mShadeController = shadeController;
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
mLockPatternUtils = lockPatternUtils;
mGestureDetector = new GestureDetector(mContext, mGestureListener);
@@ -2342,12 +2351,10 @@
mUiEventLogger.log(GlobalActionsEvent.GA_CLOSE_TAP_OUTSIDE);
if (mCentralSurfacesOptional.map(CentralSurfaces::isKeyguardShowing).orElse(false)) {
// match existing lockscreen behavior to open QS when swiping from status bar
- mCentralSurfacesOptional.ifPresent(
- centralSurfaces -> centralSurfaces.animateExpandSettingsPanel(null));
+ mShadeController.animateExpandQs();
} else {
// otherwise, swiping down should expand notification shade
- mCentralSurfacesOptional.ifPresent(
- centralSurfaces -> centralSurfaces.animateExpandNotificationsPanel());
+ mShadeController.animateExpandShade();
}
dismiss();
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java b/packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java
index 59b94b7..d2568ac 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java
@@ -52,8 +52,8 @@
import com.android.systemui.qs.pipeline.domain.interactor.PanelInteractor;
import com.android.systemui.settings.UserFileManager;
import com.android.systemui.settings.UserTracker;
+import com.android.systemui.shade.ShadeController;
import com.android.systemui.statusbar.phone.AutoTileManager;
-import com.android.systemui.statusbar.phone.CentralSurfaces;
import com.android.systemui.tuner.TunerService;
import com.android.systemui.tuner.TunerService.Tunable;
import com.android.systemui.util.settings.SecureSettings;
@@ -66,7 +66,6 @@
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Objects;
-import java.util.Optional;
import java.util.Set;
import java.util.concurrent.Executor;
import java.util.function.Predicate;
@@ -108,7 +107,7 @@
private AutoTileManager mAutoTiles;
private final ArrayList<QSFactory> mQsFactories = new ArrayList<>();
private int mCurrentUser;
- private final Optional<CentralSurfaces> mCentralSurfacesOptional;
+ private final ShadeController mShadeController;
private Context mUserContext;
private UserTracker mUserTracker;
private SecureSettings mSecureSettings;
@@ -129,7 +128,7 @@
PluginManager pluginManager,
TunerService tunerService,
Provider<AutoTileManager> autoTiles,
- Optional<CentralSurfaces> centralSurfacesOptional,
+ ShadeController shadeController,
QSLogger qsLogger,
UserTracker userTracker,
SecureSettings secureSettings,
@@ -148,7 +147,7 @@
mUserFileManager = userFileManager;
mFeatureFlags = featureFlags;
- mCentralSurfacesOptional = centralSurfacesOptional;
+ mShadeController = shadeController;
mQsFactories.add(defaultFactory);
pluginManager.addPluginListener(this, QSFactory.class, true);
@@ -209,17 +208,17 @@
@Override
public void collapsePanels() {
- mCentralSurfacesOptional.ifPresent(CentralSurfaces::postAnimateCollapsePanels);
+ mShadeController.postAnimateCollapseShade();
}
@Override
public void forceCollapsePanels() {
- mCentralSurfacesOptional.ifPresent(CentralSurfaces::postAnimateForceCollapsePanels);
+ mShadeController.postAnimateForceCollapseShade();
}
@Override
public void openPanels() {
- mCentralSurfacesOptional.ifPresent(CentralSurfaces::postAnimateOpenPanels);
+ mShadeController.postAnimateExpandQs();
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/qs/pipeline/domain/interactor/PanelInteractor.kt b/packages/SystemUI/src/com/android/systemui/qs/pipeline/domain/interactor/PanelInteractor.kt
index 260caa7..fa6de8d 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/pipeline/domain/interactor/PanelInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/pipeline/domain/interactor/PanelInteractor.kt
@@ -16,8 +16,7 @@
package com.android.systemui.qs.pipeline.domain.interactor
import com.android.systemui.dagger.SysUISingleton
-import com.android.systemui.statusbar.phone.CentralSurfaces
-import java.util.Optional
+import com.android.systemui.shade.ShadeController
import javax.inject.Inject
/** Encapsulates business logic for interacting with the QS panel. */
@@ -37,17 +36,17 @@
class PanelInteractorImpl
@Inject
constructor(
- private val centralSurfaces: Optional<CentralSurfaces>,
+ private val shadeController: ShadeController,
) : PanelInteractor {
override fun collapsePanels() {
- centralSurfaces.ifPresent { it.postAnimateCollapsePanels() }
+ shadeController.postAnimateCollapseShade()
}
override fun forceCollapsePanels() {
- centralSurfaces.ifPresent { it.postAnimateForceCollapsePanels() }
+ shadeController.postAnimateForceCollapseShade()
}
override fun openPanels() {
- centralSurfaces.ifPresent { it.postAnimateOpenPanels() }
+ shadeController.postAnimateExpandQs()
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
index bb38b30..e7dde66 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
@@ -360,7 +360,7 @@
@Override
public void toggleNotificationPanel() {
verifyCallerAndClearCallingIdentityPostMain("toggleNotificationPanel", () ->
- mCentralSurfacesOptionalLazy.get().ifPresent(CentralSurfaces::togglePanel));
+ mCommandQueue.togglePanel());
}
private boolean verifyCaller(String reason) {
diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeController.java b/packages/SystemUI/src/com/android/systemui/shade/ShadeController.java
index d0a3cbb..29c4acc 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/ShadeController.java
+++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeController.java
@@ -38,23 +38,38 @@
/** Collapse the shade instantly with no animation. */
void instantCollapseShade();
- /** See {@link #animateCollapsePanels(int, boolean, boolean, float)}. */
+ /** See {@link #animateCollapseShade(int, boolean, boolean, float)}. */
void animateCollapseShade();
- /** See {@link #animateCollapsePanels(int, boolean, boolean, float)}. */
+ /** See {@link #animateCollapseShade(int, boolean, boolean, float)}. */
void animateCollapseShade(int flags);
- /** See {@link #animateCollapsePanels(int, boolean, boolean, float)}. */
+ /** See {@link #animateCollapseShade(int, boolean, boolean, float)}. */
void animateCollapseShadeForced();
- /** See {@link #animateCollapsePanels(int, boolean, boolean, float)}. */
- void animateCollapseShadeDelayed();
+ /** See {@link #animateCollapseShade(int, boolean, boolean, float)}. */
+ void animateCollapseShadeForcedDelayed();
/**
* Collapse the shade animated, showing the bouncer when on {@link StatusBarState#KEYGUARD} or
* dismissing status bar when on {@link StatusBarState#SHADE}.
*/
- void animateCollapsePanels(int flags, boolean force, boolean delayed, float speedUpFactor);
+ void animateCollapseShade(int flags, boolean force, boolean delayed, float speedUpFactor);
+
+ /** Expand the shade with an animation. */
+ void animateExpandShade();
+
+ /** Expand the shade with quick settings expanded with an animation. */
+ void animateExpandQs();
+
+ /** Posts a request to collapse the shade. */
+ void postAnimateCollapseShade();
+
+ /** Posts a request to force collapse the shade. */
+ void postAnimateForceCollapseShade();
+
+ /** Posts a request to expand the shade to quick settings. */
+ void postAnimateExpandQs();
/**
* If the shade is not fully expanded, collapse it animated.
@@ -115,6 +130,9 @@
*/
void collapseShade(boolean animate);
+ /** Calls #collapseShade if already on the main thread. If not, posts a call to it. */
+ void collapseOnMainThread();
+
/** Makes shade expanded but not visible. */
void makeExpandedInvisible();
@@ -127,8 +145,11 @@
/** Handle status bar touch event. */
void onStatusBarTouch(MotionEvent event);
- /** Called when the shade finishes collapsing. */
- void onClosingFinished();
+ /** Called when a launch animation was cancelled. */
+ void onLaunchAnimationCancelled(boolean isLaunchForActivity);
+
+ /** Called when a launch animation ends. */
+ void onLaunchAnimationEnd(boolean launchIsFullScreen);
/** Sets the listener for when the visibility of the shade changes. */
void setVisibilityListener(ShadeVisibilityListener listener);
diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeControllerImpl.java b/packages/SystemUI/src/com/android/systemui/shade/ShadeControllerImpl.java
index d00dab6..7942b58 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/ShadeControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeControllerImpl.java
@@ -17,6 +17,7 @@
package com.android.systemui.shade;
import android.content.ComponentCallbacks2;
+import android.os.Looper;
import android.util.Log;
import android.view.MotionEvent;
import android.view.ViewTreeObserver;
@@ -25,6 +26,7 @@
import com.android.systemui.assist.AssistManager;
import com.android.systemui.dagger.SysUISingleton;
+import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.NotificationPresenter;
@@ -32,12 +34,14 @@
import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
+import com.android.systemui.statusbar.policy.DeviceProvisionedController;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.window.StatusBarWindowController;
import dagger.Lazy;
import java.util.ArrayList;
+import java.util.concurrent.Executor;
import javax.inject.Inject;
@@ -51,11 +55,13 @@
private final int mDisplayId;
private final CommandQueue mCommandQueue;
+ private final Executor mMainExecutor;
private final KeyguardStateController mKeyguardStateController;
private final NotificationShadeWindowController mNotificationShadeWindowController;
private final StatusBarStateController mStatusBarStateController;
private final StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
private final StatusBarWindowController mStatusBarWindowController;
+ private final DeviceProvisionedController mDeviceProvisionedController;
private final Lazy<AssistManager> mAssistManagerLazy;
private final Lazy<NotificationGutsManager> mGutsManager;
@@ -72,18 +78,22 @@
@Inject
public ShadeControllerImpl(
CommandQueue commandQueue,
+ @Main Executor mainExecutor,
KeyguardStateController keyguardStateController,
StatusBarStateController statusBarStateController,
StatusBarKeyguardViewManager statusBarKeyguardViewManager,
StatusBarWindowController statusBarWindowController,
+ DeviceProvisionedController deviceProvisionedController,
NotificationShadeWindowController notificationShadeWindowController,
WindowManager windowManager,
Lazy<AssistManager> assistManagerLazy,
Lazy<NotificationGutsManager> gutsManager
) {
mCommandQueue = commandQueue;
+ mMainExecutor = mainExecutor;
mStatusBarStateController = statusBarStateController;
mStatusBarWindowController = statusBarWindowController;
+ mDeviceProvisionedController = deviceProvisionedController;
mGutsManager = gutsManager;
mNotificationShadeWindowController = notificationShadeWindowController;
mStatusBarKeyguardViewManager = statusBarKeyguardViewManager;
@@ -107,21 +117,21 @@
@Override
public void animateCollapseShade(int flags) {
- animateCollapsePanels(flags, false, false, 1.0f);
+ animateCollapseShade(flags, false, false, 1.0f);
}
@Override
public void animateCollapseShadeForced() {
- animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE, true, false, 1.0f);
+ animateCollapseShade(CommandQueue.FLAG_EXCLUDE_NONE, true, false, 1.0f);
}
@Override
- public void animateCollapseShadeDelayed() {
- animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL, true, true, 1.0f);
+ public void animateCollapseShadeForcedDelayed() {
+ animateCollapseShade(CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL, true, true, 1.0f);
}
@Override
- public void animateCollapsePanels(int flags, boolean force, boolean delayed,
+ public void animateCollapseShade(int flags, boolean force, boolean delayed,
float speedUpFactor) {
if (!force && mStatusBarStateController.getState() != StatusBarState.SHADE) {
runPostCollapseRunnables();
@@ -143,6 +153,25 @@
}
@Override
+ public void animateExpandShade() {
+ if (!mCommandQueue.panelsEnabled()) {
+ return;
+ }
+ mNotificationPanelViewController.expandToNotifications();
+ }
+
+ @Override
+ public void animateExpandQs() {
+ if (!mCommandQueue.panelsEnabled()) {
+ return;
+ }
+ // Settings are not available in setup
+ if (!mDeviceProvisionedController.isCurrentUserSetup()) return;
+
+ mNotificationPanelViewController.expandToQs();
+ }
+
+ @Override
public boolean closeShadeIfOpen() {
if (!mNotificationPanelViewController.isFullyCollapsed()) {
mCommandQueue.animateCollapsePanels(
@@ -167,6 +196,20 @@
public boolean isExpandingOrCollapsing() {
return mNotificationPanelViewController.isExpandingOrCollapsing();
}
+ @Override
+ public void postAnimateCollapseShade() {
+ mMainExecutor.execute(this::animateCollapseShade);
+ }
+
+ @Override
+ public void postAnimateForceCollapseShade() {
+ mMainExecutor.execute(this::animateCollapseShadeForced);
+ }
+
+ @Override
+ public void postAnimateExpandQs() {
+ mMainExecutor.execute(this::animateExpandQs);
+ }
@Override
public void postOnShadeExpanded(Runnable executable) {
@@ -202,7 +245,7 @@
public boolean collapseShade() {
if (!mNotificationPanelViewController.isFullyCollapsed()) {
// close the shade if it was open
- animateCollapseShadeDelayed();
+ animateCollapseShadeForcedDelayed();
notifyVisibilityChanged(false);
return true;
@@ -227,6 +270,15 @@
}
@Override
+ public void collapseOnMainThread() {
+ if (Looper.getMainLooper().isCurrentThread()) {
+ collapseShade();
+ } else {
+ mMainExecutor.execute(this::collapseShade);
+ }
+ }
+
+ @Override
public void onStatusBarTouch(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_UP) {
if (mExpandedVisible) {
@@ -235,8 +287,7 @@
}
}
- @Override
- public void onClosingFinished() {
+ private void onClosingFinished() {
runPostCollapseRunnables();
if (!mPresenter.isPresenterFullyCollapsed()) {
// if we set it not to be focusable when collapsing, we have to undo it when we aborted
@@ -246,6 +297,27 @@
}
@Override
+ public void onLaunchAnimationCancelled(boolean isLaunchForActivity) {
+ if (mPresenter.isPresenterFullyCollapsed()
+ && !mPresenter.isCollapsing()
+ && isLaunchForActivity) {
+ onClosingFinished();
+ } else {
+ collapseShade(true /* animate */);
+ }
+ }
+
+ @Override
+ public void onLaunchAnimationEnd(boolean launchIsFullScreen) {
+ if (!mPresenter.isCollapsing()) {
+ onClosingFinished();
+ }
+ if (launchIsFullScreen) {
+ instantCollapseShade();
+ }
+ }
+
+ @Override
public void instantCollapseShade() {
mNotificationPanelViewController.instantCollapse();
runPostCollapseRunnables();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowDragController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowDragController.java
index 7a2bee9..b950187 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowDragController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowDragController.java
@@ -148,7 +148,7 @@
private void dismissShade() {
// Speed up dismissing the shade since the drag needs to be handled by
// the shell layer underneath
- mShadeController.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE, true /* force */,
+ mShadeController.animateCollapseShade(CommandQueue.FLAG_EXCLUDE_NONE, true /* force */,
false /* delayed */, 1.1f /* speedUpFactor */);
}
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 5ad5d84..217d32c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterImpl.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterImpl.kt
@@ -389,6 +389,35 @@
}
/**
+ * Whether we should animate an activity launch.
+ *
+ * Note: This method must be called *before* dismissing the keyguard.
+ */
+ private fun shouldAnimateLaunch(
+ isActivityIntent: Boolean,
+ showOverLockscreen: Boolean,
+ ): Boolean {
+ // TODO(b/184121838): Support launch animations when occluded.
+ if (keyguardStateController.isOccluded) {
+ return false
+ }
+
+ // Always animate if we are not showing the keyguard or if we animate over the lockscreen
+ // (without unlocking it).
+ if (showOverLockscreen || !keyguardStateController.isShowing) {
+ return true
+ }
+
+ // We don't animate non-activity launches as they can break the animation.
+ // TODO(b/184121838): Support non activity launches on the lockscreen.
+ return isActivityIntent
+ }
+
+ override fun shouldAnimateLaunch(isActivityIntent: Boolean): Boolean {
+ return shouldAnimateLaunch(isActivityIntent, false)
+ }
+
+ /**
* Encapsulates the activity logic for activity starter.
*
* Logic is duplicated in {@link CentralSurfacesImpl}
@@ -419,7 +448,7 @@
val animate =
animationController != null &&
!willLaunchResolverActivity &&
- centralSurfaces?.shouldAnimateLaunch(true /* isActivityIntent */) == true
+ shouldAnimateLaunch(isActivityIntent = true)
val animController =
wrapAnimationController(
animationController = animationController,
@@ -538,7 +567,7 @@
val animate =
!willLaunchResolverActivity &&
animationController != null &&
- centralSurfaces?.shouldAnimateLaunch(intent.isActivity) == true
+ shouldAnimateLaunch(intent.isActivity)
// If we animate, don't collapse the shade and defer the keyguard dismiss (in case we
// run the animation on the keyguard). The animation will take care of (instantly)
@@ -595,7 +624,7 @@
Log.w(TAG, "Sending intent failed: $e")
if (!collapse) {
// executeRunnableDismissingKeyguard did not collapse for us already.
- centralSurfaces?.collapsePanelOnMainThread()
+ shadeControllerLazy.get().collapseOnMainThread()
}
// TODO: Dismiss Keyguard.
}
@@ -637,7 +666,7 @@
val animate =
animationController != null &&
- centralSurfaces?.shouldAnimateLaunch(
+ shouldAnimateLaunch(
/* isActivityIntent= */ true,
showOverLockscreenWhenLocked
) == true
@@ -804,7 +833,7 @@
shadeControllerLazy.get().isExpandedVisible &&
!statusBarKeyguardViewManagerLazy.get().isBouncerShowing
) {
- shadeControllerLazy.get().animateCollapseShadeDelayed()
+ shadeControllerLazy.get().animateCollapseShadeForcedDelayed()
} else {
// Do it after DismissAction has been processed to conserve the
// needed ordering.
@@ -867,7 +896,8 @@
if (dismissShade) {
return StatusBarLaunchAnimatorController(
animationController,
- it,
+ it.shadeViewController,
+ 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 8bd9158..0929a4c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java
@@ -185,14 +185,6 @@
return contextForUser.getPackageManager();
}
- void animateExpandNotificationsPanel();
-
- void animateExpandSettingsPanel(@Nullable String subpanel);
-
- void collapsePanelOnMainThread();
-
- void togglePanel();
-
void start();
boolean updateIsKeyguard();
@@ -228,25 +220,10 @@
boolean isOccluded();
- //TODO: These can / should probably be moved to NotificationPresenter or ShadeController
- void onLaunchAnimationCancelled(boolean isLaunchForActivity);
-
- void onLaunchAnimationEnd(boolean launchIsFullScreen);
-
- boolean shouldAnimateLaunch(boolean isActivityIntent, boolean showOverLockscreen);
-
- boolean shouldAnimateLaunch(boolean isActivityIntent);
-
boolean isDeviceInVrMode();
NotificationPresenter getPresenter();
- void postAnimateCollapsePanels();
-
- void postAnimateForceCollapsePanels();
-
- void postAnimateOpenPanels();
-
boolean isPanelExpanded();
/**
@@ -264,8 +241,6 @@
*/
default void onStatusBarTrackpadEvent(MotionEvent event) {}
- void animateCollapseQuickSettings();
-
/** */
boolean getCommandQueuePanelsEnabled();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java
index 0ccc819..337acb6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java
@@ -208,7 +208,7 @@
@Override
public void animateCollapsePanels(int flags, boolean force) {
- mShadeController.animateCollapsePanels(flags, force, false /* delayed */,
+ mShadeController.animateCollapseShade(flags, force, false /* delayed */,
1.0f /* speedUpFactor */);
}
@@ -218,11 +218,7 @@
Log.d(CentralSurfaces.TAG,
"animateExpand: mExpandedVisible=" + mShadeController.isExpandedVisible());
}
- if (!mCommandQueue.panelsEnabled()) {
- return;
- }
-
- mShadeViewController.expandToNotifications();
+ mShadeController.animateExpandShade();
}
@Override
@@ -231,14 +227,7 @@
Log.d(CentralSurfaces.TAG,
"animateExpand: mExpandedVisible=" + mShadeController.isExpandedVisible());
}
- if (!mCommandQueue.panelsEnabled()) {
- return;
- }
-
- // Settings are not available in setup
- if (!mDeviceProvisionedController.isCurrentUserSetup()) return;
-
- mShadeViewController.expandToQs();
+ mShadeController.animateExpandQs();
}
@Override
@@ -559,7 +548,7 @@
if (mCentralSurfaces.isPanelExpanded()) {
mShadeController.animateCollapseShade();
} else {
- animateExpandNotificationsPanel();
+ mShadeController.animateExpandShade();
}
}
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 45b65bd..ddafa49 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
@@ -69,7 +69,6 @@
import android.os.Binder;
import android.os.Bundle;
import android.os.Handler;
-import android.os.Looper;
import android.os.PowerManager;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -411,24 +410,6 @@
return mQSPanelController;
}
- /** */
- @Override
- public void animateExpandNotificationsPanel() {
- mCommandQueueCallbacks.animateExpandNotificationsPanel();
- }
-
- /** */
- @Override
- public void animateExpandSettingsPanel(@Nullable String subpanel) {
- mCommandQueueCallbacks.animateExpandSettingsPanel(subpanel);
- }
-
- /** */
- @Override
- public void togglePanel() {
- mCommandQueueCallbacks.togglePanel();
- }
-
/**
* The {@link StatusBarState} of the status bar.
*/
@@ -1822,58 +1803,6 @@
return mKeyguardStateController.isOccluded();
}
- /** A launch animation was cancelled. */
- //TODO: These can / should probably be moved to NotificationPresenter or ShadeController
- @Override
- public void onLaunchAnimationCancelled(boolean isLaunchForActivity) {
- if (mPresenter.isPresenterFullyCollapsed() && !mPresenter.isCollapsing()
- && isLaunchForActivity) {
- mShadeController.onClosingFinished();
- } else {
- mShadeController.collapseShade(true /* animate */);
- }
- }
-
- /** A launch animation ended. */
- @Override
- public void onLaunchAnimationEnd(boolean launchIsFullScreen) {
- if (!mPresenter.isCollapsing()) {
- mShadeController.onClosingFinished();
- }
- if (launchIsFullScreen) {
- mShadeController.instantCollapseShade();
- }
- }
-
- /**
- * Whether we should animate an activity launch.
- *
- * Note: This method must be called *before* dismissing the keyguard.
- */
- @Override
- public boolean shouldAnimateLaunch(boolean isActivityIntent, boolean showOverLockscreen) {
- // TODO(b/184121838): Support launch animations when occluded.
- if (isOccluded()) {
- return false;
- }
-
- // Always animate if we are not showing the keyguard or if we animate over the lockscreen
- // (without unlocking it).
- if (showOverLockscreen || !mKeyguardStateController.isShowing()) {
- return true;
- }
-
- // We don't animate non-activity launches as they can break the animation.
- // TODO(b/184121838): Support non activity launches on the lockscreen.
- return isActivityIntent;
- }
-
- /** Whether we should animate an activity launch. */
- @Override
- public boolean shouldAnimateLaunch(boolean isActivityIntent) {
- return shouldAnimateLaunch(isActivityIntent, false /* showOverLockscreen */);
- }
-
@Override
public boolean isDeviceInVrMode() {
return mPresenter.isDeviceInVrMode();
@@ -1930,21 +1859,6 @@
}
@Override
- public void postAnimateCollapsePanels() {
- mMainExecutor.execute(mShadeController::animateCollapseShade);
- }
-
- @Override
- public void postAnimateForceCollapsePanels() {
- mMainExecutor.execute(mShadeController::animateCollapseShadeForced);
- }
-
- @Override
- public void postAnimateOpenPanels() {
- mMessageRouter.sendMessage(MSG_OPEN_SETTINGS_PANEL);
- }
-
- @Override
public boolean isPanelExpanded() {
return mPanelExpanded;
}
@@ -1970,14 +1884,6 @@
mCentralSurfacesComponent.getNotificationPanelViewController().handleExternalTouch(event);
}
- @Override
- public void animateCollapseQuickSettings() {
- if (mState == StatusBarState.SHADE) {
- mShadeSurface.collapse(
- true, false /* delayed */, 1.0f /* speedUpFactor */);
- }
- }
-
private void onExpandedInvisible() {
setInteracting(StatusBarManager.WINDOW_STATUS_BAR, false);
if (!mNotificationActivityStarter.isCollapsingToShowActivityOverLockscreen()) {
@@ -2957,19 +2863,6 @@
}
/**
- * Collapse the panel directly if we are on the main thread, post the collapsing on the main
- * thread if we are not.
- */
- @Override
- public void collapsePanelOnMainThread() {
- if (Looper.getMainLooper().isCurrentThread()) {
- mShadeController.collapseShade();
- } else {
- mContext.getMainExecutor().execute(mShadeController::collapseShade);
- }
- }
-
- /**
* Updates the light reveal effect to reflect the reason we're waking or sleeping (for example,
* from the power button).
* @param wakingUp Whether we're updating because we're waking up (true) or going to sleep
@@ -3768,8 +3661,9 @@
if (userSetup != mUserSetup) {
mUserSetup = userSetup;
- if (!mUserSetup) {
- animateCollapseQuickSettings();
+ if (!mUserSetup && mState == StatusBarState.SHADE) {
+ mShadeSurface.collapse(true /* animate */, false /* delayed */,
+ 1.0f /* speedUpFactor */);
}
updateQsExpansionEnabled();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarLaunchAnimatorController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarLaunchAnimatorController.kt
index 00ac3f4..b67ec58 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarLaunchAnimatorController.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarLaunchAnimatorController.kt
@@ -3,6 +3,8 @@
import android.view.View
import com.android.systemui.animation.ActivityLaunchAnimator
import com.android.systemui.animation.LaunchAnimator
+import com.android.systemui.shade.ShadeController
+import com.android.systemui.shade.ShadeViewController
import com.android.systemui.statusbar.NotificationShadeWindowController
/**
@@ -11,7 +13,8 @@
*/
class StatusBarLaunchAnimatorController(
private val delegate: ActivityLaunchAnimator.Controller,
- private val centralSurfaces: CentralSurfaces,
+ private val shadeViewController: ShadeViewController,
+ private val shadeController: ShadeController,
private val notificationShadeWindowController: NotificationShadeWindowController,
private val isLaunchForActivity: Boolean = true
) : ActivityLaunchAnimator.Controller by delegate {
@@ -23,25 +26,25 @@
override fun onIntentStarted(willAnimate: Boolean) {
delegate.onIntentStarted(willAnimate)
if (willAnimate) {
- centralSurfaces.shadeViewController.setIsLaunchAnimationRunning(true)
+ shadeViewController.setIsLaunchAnimationRunning(true)
} else {
- centralSurfaces.collapsePanelOnMainThread()
+ shadeController.collapseOnMainThread()
}
}
override fun onLaunchAnimationStart(isExpandingFullyAbove: Boolean) {
delegate.onLaunchAnimationStart(isExpandingFullyAbove)
- centralSurfaces.shadeViewController.setIsLaunchAnimationRunning(true)
+ shadeViewController.setIsLaunchAnimationRunning(true)
if (!isExpandingFullyAbove) {
- centralSurfaces.shadeViewController.collapseWithDuration(
+ shadeViewController.collapseWithDuration(
ActivityLaunchAnimator.TIMINGS.totalDuration.toInt())
}
}
override fun onLaunchAnimationEnd(isExpandingFullyAbove: Boolean) {
delegate.onLaunchAnimationEnd(isExpandingFullyAbove)
- centralSurfaces.shadeViewController.setIsLaunchAnimationRunning(false)
- centralSurfaces.onLaunchAnimationEnd(isExpandingFullyAbove)
+ shadeViewController.setIsLaunchAnimationRunning(false)
+ shadeController.onLaunchAnimationEnd(isExpandingFullyAbove)
}
override fun onLaunchAnimationProgress(
@@ -50,12 +53,12 @@
linearProgress: Float
) {
delegate.onLaunchAnimationProgress(state, progress, linearProgress)
- centralSurfaces.shadeViewController.applyLaunchAnimationProgress(linearProgress)
+ shadeViewController.applyLaunchAnimationProgress(linearProgress)
}
override fun onLaunchAnimationCancelled(newKeyguardOccludedState: Boolean?) {
delegate.onLaunchAnimationCancelled()
- centralSurfaces.shadeViewController.setIsLaunchAnimationRunning(false)
- centralSurfaces.onLaunchAnimationCancelled(isLaunchForActivity)
+ shadeViewController.setIsLaunchAnimationRunning(false)
+ shadeController.onLaunchAnimationCancelled(isLaunchForActivity)
}
}
\ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
index 28ec1ac..f79a081 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
@@ -122,7 +122,7 @@
private final CentralSurfaces mCentralSurfaces;
private final NotificationPresenter mPresenter;
- private final ShadeViewController mNotificationPanel;
+ private final ShadeViewController mShadeViewController;
private final NotificationShadeWindowController mNotificationShadeWindowController;
private final ActivityLaunchAnimator mActivityLaunchAnimator;
private final NotificationLaunchAnimatorControllerProvider mNotificationAnimationProvider;
@@ -158,7 +158,7 @@
OnUserInteractionCallback onUserInteractionCallback,
CentralSurfaces centralSurfaces,
NotificationPresenter presenter,
- ShadeViewController panel,
+ ShadeViewController shadeViewController,
NotificationShadeWindowController notificationShadeWindowController,
ActivityLaunchAnimator activityLaunchAnimator,
NotificationLaunchAnimatorControllerProvider notificationAnimationProvider,
@@ -193,7 +193,7 @@
// TODO: use KeyguardStateController#isOccluded to remove this dependency
mCentralSurfaces = centralSurfaces;
mPresenter = presenter;
- mNotificationPanel = panel;
+ mShadeViewController = shadeViewController;
mActivityLaunchAnimator = activityLaunchAnimator;
mNotificationAnimationProvider = notificationAnimationProvider;
mUserTracker = userTracker;
@@ -237,7 +237,7 @@
&& mActivityIntentHelper.wouldPendingLaunchResolverActivity(intent,
mLockscreenUserManager.getCurrentUserId());
final boolean animate = !willLaunchResolverActivity
- && mCentralSurfaces.shouldAnimateLaunch(isActivityIntent);
+ && mActivityStarter.shouldAnimateLaunch(isActivityIntent);
boolean showOverLockscreen = mKeyguardStateController.isShowing() && intent != null
&& mActivityIntentHelper.wouldPendingShowOverLockscreen(intent,
mLockscreenUserManager.getCurrentUserId());
@@ -288,7 +288,7 @@
}
// Always defer the keyguard dismiss when animating.
- return animate || !mNotificationPanel.isFullyCollapsed();
+ return animate || !mShadeViewController.isFullyCollapsed();
}
private void handleNotificationClickAfterPanelCollapsed(
@@ -323,7 +323,7 @@
removeHunAfterClick(row);
// Show work challenge, do not run PendingIntent and
// remove notification
- collapseOnMainThread();
+ mShadeController.collapseOnMainThread();
return;
}
}
@@ -440,7 +440,8 @@
ActivityLaunchAnimator.Controller animationController =
new StatusBarLaunchAnimatorController(
mNotificationAnimationProvider.getAnimatorController(row, null),
- mCentralSurfaces,
+ mShadeViewController,
+ mShadeController,
mNotificationShadeWindowController,
isActivityIntent);
mActivityLaunchAnimator.startPendingIntentWithAnimation(
@@ -472,7 +473,7 @@
@Override
public void startNotificationGutsIntent(final Intent intent, final int appUid,
ExpandableNotificationRow row) {
- boolean animate = mCentralSurfaces.shouldAnimateLaunch(true /* isActivityIntent */);
+ boolean animate = mActivityStarter.shouldAnimateLaunch(true /* isActivityIntent */);
ActivityStarter.OnDismissAction onDismissAction = new ActivityStarter.OnDismissAction() {
@Override
public boolean onDismiss() {
@@ -480,7 +481,8 @@
ActivityLaunchAnimator.Controller animationController =
new StatusBarLaunchAnimatorController(
mNotificationAnimationProvider.getAnimatorController(row),
- mCentralSurfaces,
+ mShadeViewController,
+ mShadeController,
mNotificationShadeWindowController,
true /* isActivityIntent */);
@@ -507,7 +509,7 @@
@Override
public void startHistoryIntent(View view, boolean showHistory) {
- boolean animate = mCentralSurfaces.shouldAnimateLaunch(true /* isActivityIntent */);
+ boolean animate = mActivityStarter.shouldAnimateLaunch(true /* isActivityIntent */);
ActivityStarter.OnDismissAction onDismissAction = new ActivityStarter.OnDismissAction() {
@Override
public boolean onDismiss() {
@@ -529,7 +531,8 @@
viewController == null ? null
: new StatusBarLaunchAnimatorController(
viewController,
- mCentralSurfaces,
+ mShadeViewController,
+ mShadeController,
mNotificationShadeWindowController,
true /* isActivityIntent */);
@@ -630,11 +633,4 @@
return true;
}
- private void collapseOnMainThread() {
- if (Looper.getMainLooper().isCurrentThread()) {
- mShadeController.collapseShade();
- } else {
- mMainThreadHandler.post(mShadeController::collapseShade);
- }
- }
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/globalactions/GlobalActionsDialogLiteTest.java b/packages/SystemUI/tests/src/com/android/systemui/globalactions/GlobalActionsDialogLiteTest.java
index c9ee1e8..6aa5a00 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/globalactions/GlobalActionsDialogLiteTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/globalactions/GlobalActionsDialogLiteTest.java
@@ -67,6 +67,7 @@
import com.android.systemui.plugins.GlobalActions;
import com.android.systemui.settings.UserContextProvider;
import com.android.systemui.settings.UserTracker;
+import com.android.systemui.shade.ShadeController;
import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.VibratorHelper;
import com.android.systemui.statusbar.phone.CentralSurfaces;
@@ -128,6 +129,7 @@
@Mock private UserContextProvider mUserContextProvider;
@Mock private VibratorHelper mVibratorHelper;
@Mock private CentralSurfaces mCentralSurfaces;
+ @Mock private ShadeController mShadeController;
@Mock private KeyguardUpdateMonitor mKeyguardUpdateMonitor;
@Mock private DialogLaunchAnimator mDialogLaunchAnimator;
@Mock private OnBackInvokedDispatcher mOnBackInvokedDispatcher;
@@ -177,6 +179,7 @@
mHandler,
mPackageManager,
Optional.of(mCentralSurfaces),
+ mShadeController,
mKeyguardUpdateMonitor,
mDialogLaunchAnimator);
mGlobalActionsDialogLite.setZeroDialogPressDelayForTesting();
@@ -317,7 +320,7 @@
MotionEvent end = MotionEvent.obtain(0, 0, MotionEvent.ACTION_DOWN, 0, 500, 0);
gestureListener.onFling(start, end, 0, 1000);
verifyLogPosted(GlobalActionsDialogLite.GlobalActionsEvent.GA_CLOSE_TAP_OUTSIDE);
- verify(mCentralSurfaces).animateExpandSettingsPanel(null);
+ verify(mShadeController).animateExpandQs();
}
@Test
@@ -341,7 +344,7 @@
MotionEvent end = MotionEvent.obtain(0, 0, MotionEvent.ACTION_DOWN, 0, 500, 0);
gestureListener.onFling(start, end, 0, 1000);
verifyLogPosted(GlobalActionsDialogLite.GlobalActionsEvent.GA_CLOSE_TAP_OUTSIDE);
- verify(mCentralSurfaces).animateExpandNotificationsPanel();
+ verify(mShadeController).animateExpandShade();
}
@Test
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/QSTileHostTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/QSTileHostTest.java
index 810ab34..d98bcee 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/QSTileHostTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/QSTileHostTest.java
@@ -67,8 +67,8 @@
import com.android.systemui.qs.tileimpl.QSTileImpl;
import com.android.systemui.settings.UserFileManager;
import com.android.systemui.settings.UserTracker;
+import com.android.systemui.shade.ShadeController;
import com.android.systemui.statusbar.phone.AutoTileManager;
-import com.android.systemui.statusbar.phone.CentralSurfaces;
import com.android.systemui.tuner.TunerService;
import com.android.systemui.util.FakeSharedPreferences;
import com.android.systemui.util.concurrency.FakeExecutor;
@@ -86,7 +86,6 @@
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.List;
-import java.util.Optional;
import java.util.concurrent.Executor;
import javax.inject.Provider;
@@ -110,7 +109,7 @@
@Mock
private Provider<AutoTileManager> mAutoTiles;
@Mock
- private CentralSurfaces mCentralSurfaces;
+ private ShadeController mShadeController;
@Mock
private QSLogger mQSLogger;
@Mock
@@ -161,7 +160,7 @@
mSecureSettings = new FakeSettings();
saveSetting("");
mQSTileHost = new TestQSTileHost(mContext, mDefaultFactory, mMainExecutor,
- mPluginManager, mTunerService, mAutoTiles, mCentralSurfaces,
+ mPluginManager, mTunerService, mAutoTiles, mShadeController,
mQSLogger, mUserTracker, mSecureSettings, mCustomTileStatePersister,
mTileLifecycleManagerFactory, mUserFileManager, mFeatureFlags);
@@ -682,13 +681,13 @@
QSFactory defaultFactory, Executor mainExecutor,
PluginManager pluginManager, TunerService tunerService,
Provider<AutoTileManager> autoTiles,
- CentralSurfaces centralSurfaces, QSLogger qsLogger,
+ ShadeController shadeController, QSLogger qsLogger,
UserTracker userTracker, SecureSettings secureSettings,
CustomTileStatePersister customTileStatePersister,
TileLifecycleManager.Factory tileLifecycleManagerFactory,
UserFileManager userFileManager, FeatureFlags featureFlags) {
super(context, defaultFactory, mainExecutor, pluginManager,
- tunerService, autoTiles, Optional.of(centralSurfaces), qsLogger,
+ tunerService, autoTiles, shadeController, qsLogger,
userTracker, secureSettings, customTileStatePersister,
tileLifecycleManagerFactory, userFileManager, featureFlags);
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/pipeline/domain/interactor/PanelInteractorImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/qs/pipeline/domain/interactor/PanelInteractorImplTest.kt
index 45783ab..6556cfd 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/pipeline/domain/interactor/PanelInteractorImplTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/pipeline/domain/interactor/PanelInteractorImplTest.kt
@@ -18,8 +18,7 @@
import android.testing.AndroidTestingRunner
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
-import com.android.systemui.statusbar.phone.CentralSurfaces
-import java.util.Optional
+import com.android.systemui.shade.ShadeController
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
@@ -31,7 +30,7 @@
@SmallTest
class PanelInteractorImplTest : SysuiTestCase() {
- @Mock private lateinit var centralSurfaces: CentralSurfaces
+ @Mock private lateinit var shadeController: ShadeController
@Before
fun setup() {
@@ -40,37 +39,28 @@
@Test
fun openPanels_callsCentralSurfaces() {
- val underTest = PanelInteractorImpl(Optional.of(centralSurfaces))
+ val underTest = PanelInteractorImpl(shadeController)
underTest.openPanels()
- verify(centralSurfaces).postAnimateOpenPanels()
+ verify(shadeController).postAnimateExpandQs()
}
@Test
fun collapsePanels_callsCentralSurfaces() {
- val underTest = PanelInteractorImpl(Optional.of(centralSurfaces))
+ val underTest = PanelInteractorImpl(shadeController)
underTest.collapsePanels()
- verify(centralSurfaces).postAnimateCollapsePanels()
+ verify(shadeController).postAnimateCollapseShade()
}
@Test
fun forceCollapsePanels_callsCentralSurfaces() {
- val underTest = PanelInteractorImpl(Optional.of(centralSurfaces))
+ val underTest = PanelInteractorImpl(shadeController)
underTest.forceCollapsePanels()
- verify(centralSurfaces).postAnimateForceCollapsePanels()
- }
-
- @Test
- fun whenOptionalEmpty_doesnThrow() {
- val underTest = PanelInteractorImpl(Optional.empty())
-
- underTest.openPanels()
- underTest.collapsePanels()
- underTest.forceCollapsePanels()
+ verify(shadeController).postAnimateForceCollapseShade()
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/ShadeControllerImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/ShadeControllerImplTest.kt
new file mode 100644
index 0000000..ef66756
--- /dev/null
+++ b/packages/SystemUI/tests/src/com/android/systemui/shade/ShadeControllerImplTest.kt
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.shade
+
+import android.testing.AndroidTestingRunner
+import android.view.Display
+import android.view.WindowManager
+import androidx.test.filters.SmallTest
+import com.android.systemui.SysuiTestCase
+import com.android.systemui.assist.AssistManager
+import com.android.systemui.plugins.statusbar.StatusBarStateController
+import com.android.systemui.statusbar.CommandQueue
+import com.android.systemui.statusbar.NotificationShadeWindowController
+import com.android.systemui.statusbar.notification.row.NotificationGutsManager
+import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager
+import com.android.systemui.statusbar.policy.DeviceProvisionedController
+import com.android.systemui.statusbar.policy.KeyguardStateController
+import com.android.systemui.statusbar.window.StatusBarWindowController
+import com.android.systemui.util.concurrency.FakeExecutor
+import com.android.systemui.util.mockito.whenever
+import com.android.systemui.util.time.FakeSystemClock
+import dagger.Lazy
+import org.junit.Before
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.mockito.ArgumentMatchers
+import org.mockito.Mock
+import org.mockito.Mockito.never
+import org.mockito.Mockito.verify
+import org.mockito.MockitoAnnotations
+
+@RunWith(AndroidTestingRunner::class)
+@SmallTest
+class ShadeControllerImplTest : SysuiTestCase() {
+ @Mock private lateinit var commandQueue: CommandQueue
+ @Mock private lateinit var keyguardStateController: KeyguardStateController
+ @Mock private lateinit var statusBarStateController: StatusBarStateController
+ @Mock private lateinit var statusBarKeyguardViewManager: StatusBarKeyguardViewManager
+ @Mock private lateinit var statusBarWindowController: StatusBarWindowController
+ @Mock private lateinit var deviceProvisionedController: DeviceProvisionedController
+ @Mock private lateinit var notificationShadeWindowController: NotificationShadeWindowController
+ @Mock private lateinit var windowManager: WindowManager
+ @Mock private lateinit var assistManager: AssistManager
+ @Mock private lateinit var gutsManager: NotificationGutsManager
+ @Mock private lateinit var notificationPanelViewController: NotificationPanelViewController
+ @Mock private lateinit var display: Display
+
+ private lateinit var shadeController: ShadeControllerImpl
+
+ @Before
+ fun setUp() {
+ MockitoAnnotations.initMocks(this)
+ whenever(windowManager.defaultDisplay).thenReturn(display)
+ whenever(deviceProvisionedController.isCurrentUserSetup).thenReturn(true)
+ shadeController =
+ ShadeControllerImpl(
+ commandQueue,
+ FakeExecutor(FakeSystemClock()),
+ keyguardStateController,
+ statusBarStateController,
+ statusBarKeyguardViewManager,
+ statusBarWindowController,
+ deviceProvisionedController,
+ notificationShadeWindowController,
+ windowManager,
+ Lazy { assistManager },
+ Lazy { gutsManager },
+ )
+ shadeController.setNotificationPanelViewController(notificationPanelViewController)
+ }
+
+ @Test
+ fun testDisableNotificationShade() {
+ whenever(commandQueue.panelsEnabled()).thenReturn(false)
+
+ // Trying to open it does nothing.
+ shadeController.animateExpandShade()
+ verify(notificationPanelViewController, never()).expandToNotifications()
+ shadeController.animateExpandQs()
+ verify(notificationPanelViewController, never()).expand(ArgumentMatchers.anyBoolean())
+ }
+
+ @Test
+ fun testEnableNotificationShade() {
+ whenever(commandQueue.panelsEnabled()).thenReturn(true)
+
+ // Can now be opened.
+ shadeController.animateExpandShade()
+ verify(notificationPanelViewController).expandToNotifications()
+ shadeController.animateExpandQs()
+ verify(notificationPanelViewController).expandToQs()
+ }
+}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowDragControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowDragControllerTest.java
index 915924f1..bdc8135 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowDragControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowDragControllerTest.java
@@ -108,7 +108,7 @@
mRow.doDragCallback(0, 0);
verify(controller).startDragAndDrop(mRow);
- verify(mShadeController).animateCollapsePanels(eq(0), eq(true),
+ verify(mShadeController).animateCollapseShade(eq(0), eq(true),
eq(false), anyFloat());
verify(mNotificationPanelLogger, times(1)).logNotificationDrag(any());
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java
index 3870d99..cb71fb8 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java
@@ -18,7 +18,6 @@
import static android.view.Display.DEFAULT_DISPLAY;
-import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
@@ -153,12 +152,6 @@
verify(mCentralSurfaces).updateQsExpansionEnabled();
verify(mShadeController).animateCollapseShade();
-
- // Trying to open it does nothing.
- mSbcqCallbacks.animateExpandNotificationsPanel();
- verify(mShadeViewController, never()).expandToNotifications();
- mSbcqCallbacks.animateExpandSettingsPanel(null);
- verify(mShadeViewController, never()).expand(anyBoolean());
}
@Test
@@ -171,12 +164,6 @@
StatusBarManager.DISABLE2_NONE, false);
verify(mCentralSurfaces).updateQsExpansionEnabled();
verify(mShadeController, never()).animateCollapseShade();
-
- // Can now be opened.
- mSbcqCallbacks.animateExpandNotificationsPanel();
- verify(mShadeViewController).expandToNotifications();
- mSbcqCallbacks.animateExpandSettingsPanel(null);
- verify(mShadeViewController).expandToQs();
}
@Test
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java
index 4ed113f..4fb5b07 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java
@@ -431,10 +431,12 @@
mShadeController = spy(new ShadeControllerImpl(
mCommandQueue,
+ mMainExecutor,
mKeyguardStateController,
mStatusBarStateController,
mStatusBarKeyguardViewManager,
mStatusBarWindowController,
+ mDeviceProvisionedController,
mNotificationShadeWindowController,
mContext.getSystemService(WindowManager.class),
() -> mAssistManager,