diff options
2 files changed, 12 insertions, 18 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java index f841206c6dec..85e63e58bc7a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java @@ -94,9 +94,7 @@ import com.android.systemui.flags.RefactorFlag; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper; import com.android.systemui.res.R; -import com.android.systemui.shade.ShadeController; import com.android.systemui.shade.TouchLogger; -import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.EmptyShadeView; import com.android.systemui.statusbar.NotificationShelf; import com.android.systemui.statusbar.StatusBarState; @@ -145,8 +143,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable private static final String TAG = "StackScroller"; private static final boolean SPEW = Log.isLoggable(TAG, Log.VERBOSE); - // Delay in milli-seconds before shade closes for clear all. - private static final int DELAY_BEFORE_SHADE_CLOSE = 200; private boolean mShadeNeedsToClose = false; @VisibleForTesting @@ -481,7 +477,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable private final Rect mTmpRect = new Rect(); private ClearAllListener mClearAllListener; private ClearAllAnimationListener mClearAllAnimationListener; - private ShadeController mShadeController; + private Runnable mClearAllFinishedWhilePanelExpandedRunnable; private Consumer<Boolean> mOnStackYChanged; private Interpolator mHideXInterpolator = Interpolators.FAST_OUT_SLOW_IN; @@ -4315,21 +4311,12 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable if (mShadeNeedsToClose) { mShadeNeedsToClose = false; if (mIsExpanded) { - collapseShadeDelayed(); + mClearAllFinishedWhilePanelExpandedRunnable.run(); } } } } - private void collapseShadeDelayed() { - postDelayed( - () -> { - mShadeController.animateCollapseShade( - CommandQueue.FLAG_EXCLUDE_NONE); - }, - DELAY_BEFORE_SHADE_CLOSE /* delayMillis */); - } - private void clearHeadsUpDisappearRunning() { for (int i = 0; i < getChildCount(); i++) { View view = getChildAt(i); @@ -5680,8 +5667,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable mFooterClearAllListener = listener; } - void setShadeController(ShadeController shadeController) { - mShadeController = shadeController; + void setClearAllFinishedWhilePanelExpandedRunnable(Runnable runnable) { + mClearAllFinishedWhilePanelExpandedRunnable = runnable; } /** diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java index 9fe9eceff38d..d2fca8fca837 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java @@ -81,6 +81,7 @@ import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.power.domain.interactor.PowerInteractor; import com.android.systemui.shade.ShadeController; import com.android.systemui.shade.ShadeViewController; +import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.LockscreenShadeTransitionController; import com.android.systemui.statusbar.NotificationLockscreenUserManager; import com.android.systemui.statusbar.NotificationLockscreenUserManager.UserChangedListener; @@ -152,6 +153,8 @@ public class NotificationStackScrollLayoutController implements Dumpable { private static final String TAG = "StackScrollerController"; private static final boolean DEBUG = Compile.IS_DEBUG && Log.isLoggable(TAG, Log.DEBUG); private static final String HIGH_PRIORITY = "high_priority"; + /** Delay in milli-seconds before shade closes for clear all. */ + private static final int DELAY_BEFORE_SHADE_CLOSE = 200; private final boolean mAllowLongPress; private final NotificationGutsManager mNotificationGutsManager; @@ -770,7 +773,11 @@ public class NotificationStackScrollLayoutController implements Dumpable { mView.setIsRemoteInputActive(active); } }); - mView.setShadeController(mShadeController); + mView.setClearAllFinishedWhilePanelExpandedRunnable(()-> { + final Runnable doCollapseRunnable = () -> + mShadeController.animateCollapseShade(CommandQueue.FLAG_EXCLUDE_NONE); + mView.postDelayed(doCollapseRunnable, /* delayMillis = */ DELAY_BEFORE_SHADE_CLOSE); + }); mDumpManager.registerDumpable(mView); mKeyguardBypassController.registerOnBypassStateChangedListener( |