Move shade code out of CentralSurfaces
Bug: 249277686 Test: manual Test: run an fix affected tests Change-Id: I5cbe29f521852a3671b7df794375d4b097323ba9
This commit is contained in:
@@ -485,13 +485,11 @@ public class SystemActions implements CoreStartable {
|
||||
}
|
||||
|
||||
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() {
|
||||
|
||||
@@ -125,6 +125,7 @@ import com.android.systemui.plugins.GlobalActions.GlobalActionsManager;
|
||||
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 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
|
||||
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 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
|
||||
@Main Handler handler,
|
||||
PackageManager packageManager,
|
||||
Optional<CentralSurfaces> centralSurfacesOptional,
|
||||
ShadeController shadeController,
|
||||
KeyguardUpdateMonitor keyguardUpdateMonitor,
|
||||
DialogLaunchAnimator dialogLaunchAnimator) {
|
||||
mContext = context;
|
||||
@@ -392,6 +395,7 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
|
||||
mMainHandler = handler;
|
||||
mSmallestScreenWidthDp = resources.getConfiguration().smallestScreenWidthDp;
|
||||
mCentralSurfacesOptional = centralSurfacesOptional;
|
||||
mShadeController = shadeController;
|
||||
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
|
||||
mDialogLaunchAnimator = dialogLaunchAnimator;
|
||||
|
||||
@@ -700,7 +704,9 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
|
||||
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 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
|
||||
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 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
|
||||
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 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
|
||||
mKeyguardShowing = keyguardShowing;
|
||||
mUiEventLogger = uiEventLogger;
|
||||
mCentralSurfacesOptional = centralSurfacesOptional;
|
||||
mShadeController = shadeController;
|
||||
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
|
||||
mLockPatternUtils = lockPatternUtils;
|
||||
mGestureDetector = new GestureDetector(mContext, mGestureListener);
|
||||
@@ -2342,12 +2351,10 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -52,8 +52,8 @@ import com.android.systemui.qs.pipeline.data.repository.CustomTileAddedRepositor
|
||||
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.Collection;
|
||||
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 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, P
|
||||
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 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, P
|
||||
PluginManager pluginManager,
|
||||
TunerService tunerService,
|
||||
Provider<AutoTileManager> autoTiles,
|
||||
Optional<CentralSurfaces> centralSurfacesOptional,
|
||||
ShadeController shadeController,
|
||||
QSLogger qsLogger,
|
||||
UserTracker userTracker,
|
||||
SecureSettings secureSettings,
|
||||
@@ -148,7 +147,7 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, P
|
||||
mUserFileManager = userFileManager;
|
||||
mFeatureFlags = featureFlags;
|
||||
|
||||
mCentralSurfacesOptional = centralSurfacesOptional;
|
||||
mShadeController = shadeController;
|
||||
|
||||
mQsFactories.add(defaultFactory);
|
||||
pluginManager.addPluginListener(this, QSFactory.class, true);
|
||||
@@ -209,17 +208,17 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, P
|
||||
|
||||
@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
|
||||
|
||||
@@ -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 @@ interface PanelInteractor {
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -360,7 +360,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
|
||||
@Override
|
||||
public void toggleNotificationPanel() {
|
||||
verifyCallerAndClearCallingIdentityPostMain("toggleNotificationPanel", () ->
|
||||
mCentralSurfacesOptionalLazy.get().ifPresent(CentralSurfaces::togglePanel));
|
||||
mCommandQueue.togglePanel());
|
||||
}
|
||||
|
||||
private boolean verifyCaller(String reason) {
|
||||
|
||||
@@ -38,23 +38,38 @@ public interface ShadeController {
|
||||
/** 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.
|
||||
|
||||
@@ -34,6 +34,7 @@ import com.android.systemui.statusbar.NotificationShadeWindowController;
|
||||
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;
|
||||
|
||||
@@ -60,6 +61,7 @@ public final class ShadeControllerImpl implements ShadeController {
|
||||
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;
|
||||
@@ -81,6 +83,7 @@ public final class ShadeControllerImpl implements ShadeController {
|
||||
StatusBarStateController statusBarStateController,
|
||||
StatusBarKeyguardViewManager statusBarKeyguardViewManager,
|
||||
StatusBarWindowController statusBarWindowController,
|
||||
DeviceProvisionedController deviceProvisionedController,
|
||||
NotificationShadeWindowController notificationShadeWindowController,
|
||||
WindowManager windowManager,
|
||||
Lazy<AssistManager> assistManagerLazy,
|
||||
@@ -90,6 +93,7 @@ public final class ShadeControllerImpl implements ShadeController {
|
||||
mMainExecutor = mainExecutor;
|
||||
mStatusBarStateController = statusBarStateController;
|
||||
mStatusBarWindowController = statusBarWindowController;
|
||||
mDeviceProvisionedController = deviceProvisionedController;
|
||||
mGutsManager = gutsManager;
|
||||
mNotificationShadeWindowController = notificationShadeWindowController;
|
||||
mStatusBarKeyguardViewManager = statusBarKeyguardViewManager;
|
||||
@@ -113,21 +117,21 @@ public final class ShadeControllerImpl implements ShadeController {
|
||||
|
||||
@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();
|
||||
@@ -148,6 +152,25 @@ public final class ShadeControllerImpl implements ShadeController {
|
||||
}
|
||||
}
|
||||
|
||||
@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()) {
|
||||
@@ -173,6 +196,20 @@ public final class ShadeControllerImpl implements ShadeController {
|
||||
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) {
|
||||
@@ -208,7 +245,7 @@ public final class ShadeControllerImpl implements ShadeController {
|
||||
public boolean collapseShade() {
|
||||
if (!mNotificationPanelViewController.isFullyCollapsed()) {
|
||||
// close the shade if it was open
|
||||
animateCollapseShadeDelayed();
|
||||
animateCollapseShadeForcedDelayed();
|
||||
notifyVisibilityChanged(false);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -148,7 +148,7 @@ public class ExpandableNotificationRowDragController {
|
||||
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 */);
|
||||
}
|
||||
|
||||
|
||||
@@ -833,7 +833,7 @@ constructor(
|
||||
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.
|
||||
|
||||
@@ -187,12 +187,6 @@ public interface CentralSurfaces extends Dumpable, LifecycleOwner {
|
||||
return contextForUser.getPackageManager();
|
||||
}
|
||||
|
||||
void animateExpandNotificationsPanel();
|
||||
|
||||
void animateExpandSettingsPanel(@Nullable String subpanel);
|
||||
|
||||
void togglePanel();
|
||||
|
||||
void start();
|
||||
|
||||
boolean updateIsKeyguard();
|
||||
@@ -232,12 +226,6 @@ public interface CentralSurfaces extends Dumpable, LifecycleOwner {
|
||||
|
||||
NotificationPresenter getPresenter();
|
||||
|
||||
void postAnimateCollapsePanels();
|
||||
|
||||
void postAnimateForceCollapsePanels();
|
||||
|
||||
void postAnimateOpenPanels();
|
||||
|
||||
boolean isPanelExpanded();
|
||||
|
||||
/**
|
||||
@@ -255,8 +243,6 @@ public interface CentralSurfaces extends Dumpable, LifecycleOwner {
|
||||
*/
|
||||
default void onStatusBarTrackpadEvent(MotionEvent event) {}
|
||||
|
||||
void animateCollapseQuickSettings();
|
||||
|
||||
/** */
|
||||
boolean getCommandQueuePanelsEnabled();
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callba
|
||||
|
||||
@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 @@ public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callba
|
||||
Log.d(CentralSurfaces.TAG,
|
||||
"animateExpand: mExpandedVisible=" + mShadeController.isExpandedVisible());
|
||||
}
|
||||
if (!mCommandQueue.panelsEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mShadeViewController.expandToNotifications();
|
||||
mShadeController.animateExpandShade();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -231,14 +227,7 @@ public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callba
|
||||
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 @@ public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callba
|
||||
if (mCentralSurfaces.isPanelExpanded()) {
|
||||
mShadeController.animateCollapseShade();
|
||||
} else {
|
||||
animateExpandNotificationsPanel();
|
||||
mShadeController.animateExpandShade();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -411,24 +411,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
|
||||
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.
|
||||
*/
|
||||
@@ -1877,21 +1859,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
|
||||
}
|
||||
}
|
||||
|
||||
@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;
|
||||
@@ -1918,14 +1885,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
|
||||
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()) {
|
||||
@@ -3714,8 +3673,9 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
|
||||
|
||||
if (userSetup != mUserSetup) {
|
||||
mUserSetup = userSetup;
|
||||
if (!mUserSetup) {
|
||||
animateCollapseQuickSettings();
|
||||
if (!mUserSetup && mState == StatusBarState.SHADE) {
|
||||
mShadeSurface.collapse(true /* animate */, false /* delayed */,
|
||||
1.0f /* speedUpFactor */);
|
||||
}
|
||||
updateQsExpansionEnabled();
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ import com.android.systemui.colorextraction.SysuiColorExtractor;
|
||||
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 @@ public class GlobalActionsDialogLiteTest extends SysuiTestCase {
|
||||
@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 @@ public class GlobalActionsDialogLiteTest extends SysuiTestCase {
|
||||
mHandler,
|
||||
mPackageManager,
|
||||
Optional.of(mCentralSurfaces),
|
||||
mShadeController,
|
||||
mKeyguardUpdateMonitor,
|
||||
mDialogLaunchAnimator);
|
||||
mGlobalActionsDialogLite.setZeroDialogPressDelayForTesting();
|
||||
@@ -317,7 +320,7 @@ public class GlobalActionsDialogLiteTest extends SysuiTestCase {
|
||||
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 @@ public class GlobalActionsDialogLiteTest extends SysuiTestCase {
|
||||
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
|
||||
|
||||
@@ -67,8 +67,8 @@ import com.android.systemui.qs.logging.QSLogger;
|
||||
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 org.mockito.stubbing.Answer;
|
||||
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 @@ public class QSTileHostTest extends SysuiTestCase {
|
||||
@Mock
|
||||
private Provider<AutoTileManager> mAutoTiles;
|
||||
@Mock
|
||||
private CentralSurfaces mCentralSurfaces;
|
||||
private ShadeController mShadeController;
|
||||
@Mock
|
||||
private QSLogger mQSLogger;
|
||||
@Mock
|
||||
@@ -161,7 +160,7 @@ public class QSTileHostTest extends SysuiTestCase {
|
||||
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 @@ public class QSTileHostTest extends SysuiTestCase {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -18,8 +18,7 @@ package com.android.systemui.qs.pipeline.domain.interactor
|
||||
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 @@ import org.mockito.MockitoAnnotations
|
||||
@SmallTest
|
||||
class PanelInteractorImplTest : SysuiTestCase() {
|
||||
|
||||
@Mock private lateinit var centralSurfaces: CentralSurfaces
|
||||
@Mock private lateinit var shadeController: ShadeController
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
@@ -40,37 +39,28 @@ class PanelInteractorImplTest : SysuiTestCase() {
|
||||
|
||||
@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()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
@@ -108,7 +108,7 @@ public class ExpandableNotificationRowDragControllerTest extends SysuiTestCase {
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.android.systemui.statusbar.phone;
|
||||
|
||||
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 @@ public class CentralSurfacesCommandQueueCallbacksTest extends SysuiTestCase {
|
||||
|
||||
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 @@ public class CentralSurfacesCommandQueueCallbacksTest extends SysuiTestCase {
|
||||
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
|
||||
|
||||
@@ -436,6 +436,7 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
|
||||
mStatusBarStateController,
|
||||
mStatusBarKeyguardViewManager,
|
||||
mStatusBarWindowController,
|
||||
mDeviceProvisionedController,
|
||||
mNotificationShadeWindowController,
|
||||
mContext.getSystemService(WindowManager.class),
|
||||
() -> mAssistManager,
|
||||
|
||||
Reference in New Issue
Block a user