diff options
23 files changed, 95 insertions, 140 deletions
diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/statusbar/StatusBarStateController.java b/packages/SystemUI/plugin/src/com/android/systemui/plugins/statusbar/StatusBarStateController.java index b21a9f7c4d05..6c4cbdf27fa5 100644 --- a/packages/SystemUI/plugin/src/com/android/systemui/plugins/statusbar/StatusBarStateController.java +++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/statusbar/StatusBarStateController.java @@ -34,7 +34,8 @@ public interface StatusBarStateController { int getState(); /** - * Is device dozing + * Is device dozing. Dozing is when the screen is in AOD or asleep given that + * {@link com.android.systemui.doze.DozeService} is configured. */ boolean isDozing(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java index d3a9c2c3c87d..246b0f0e19ff 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java @@ -61,7 +61,6 @@ import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.statusbar.phone.LockscreenWallpaper; import com.android.systemui.statusbar.phone.ScrimController; import com.android.systemui.statusbar.phone.ScrimState; -import com.android.systemui.statusbar.phone.ShadeController; import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.phone.StatusBarWindowController; import com.android.systemui.statusbar.policy.KeyguardStateController; @@ -105,9 +104,6 @@ public class NotificationMediaManager implements Dumpable { private final NotificationEntryManager mEntryManager; - // Late binding, also @Nullable due to being in com.android.systemui.statusbar.phone package - @Nullable - private Lazy<ShadeController> mShadeController; @Nullable private Lazy<StatusBarWindowController> mStatusBarWindowController; @@ -183,7 +179,6 @@ public class NotificationMediaManager implements Dumpable { @Inject public NotificationMediaManager( Context context, - Lazy<ShadeController> shadeController, Lazy<StatusBar> statusBarLazy, Lazy<StatusBarWindowController> statusBarWindowController, NotificationEntryManager notificationEntryManager, @@ -193,11 +188,10 @@ public class NotificationMediaManager implements Dumpable { mMediaArtworkProcessor = mediaArtworkProcessor; mKeyguardBypassController = keyguardBypassController; mMediaListeners = new ArrayList<>(); - mMediaSessionManager - = (MediaSessionManager) mContext.getSystemService(Context.MEDIA_SESSION_SERVICE); // TODO: use MediaSessionManager.SessionListener to hook us up to future updates // in session state - mShadeController = shadeController; + mMediaSessionManager = (MediaSessionManager) mContext.getSystemService( + Context.MEDIA_SESSION_SERVICE); // TODO: use KeyguardStateController#isOccluded to remove this dependency mStatusBarLazy = statusBarLazy; mStatusBarWindowController = statusBarWindowController; @@ -603,9 +597,7 @@ public class NotificationMediaManager implements Dumpable { if (DEBUG_MEDIA) { Log.v(TAG, "DEBUG_MEDIA: Fading out album artwork"); } - ShadeController shadeController = mShadeController.get(); - boolean cannotAnimateDoze = shadeController != null - && shadeController.isDozing() + boolean cannotAnimateDoze = mStatusBarStateController.isDozing() && !ScrimState.AOD.getAnimateChange(); boolean needsBypassFading = mKeyguardStateController.isBypassFadingAnimation(); if (((mBiometricUnlockController != null && mBiometricUnlockController.getMode() diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java index c556bc0b39d1..f6f3ac1b5aaf 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java @@ -58,7 +58,7 @@ import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.collection.NotificationEntry.EditedSuggestionInfo; import com.android.systemui.statusbar.notification.logging.NotificationLogger; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; -import com.android.systemui.statusbar.phone.ShadeController; +import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.policy.RemoteInputUriController; import com.android.systemui.statusbar.policy.RemoteInputView; @@ -116,7 +116,7 @@ public class NotificationRemoteInputManager implements Dumpable { private final NotificationEntryManager mEntryManager; private final Handler mMainHandler; - private final Lazy<ShadeController> mShadeController; + private final Lazy<StatusBar> mStatusBarLazy; protected final Context mContext; private final UserManager mUserManager; @@ -136,7 +136,7 @@ public class NotificationRemoteInputManager implements Dumpable { @Override public boolean onClickHandler( View view, PendingIntent pendingIntent, RemoteViews.RemoteResponse response) { - mShadeController.get().wakeUpIfDozing(SystemClock.uptimeMillis(), view, + mStatusBarLazy.get().wakeUpIfDozing(SystemClock.uptimeMillis(), view, "NOTIFICATION_CLICK"); if (handleRemoteInput(view, pendingIntent)) { @@ -261,7 +261,7 @@ public class NotificationRemoteInputManager implements Dumpable { NotificationLockscreenUserManager lockscreenUserManager, SmartReplyController smartReplyController, NotificationEntryManager notificationEntryManager, - Lazy<ShadeController> shadeController, + Lazy<StatusBar> statusBarLazy, StatusBarStateController statusBarStateController, @MainHandler Handler mainHandler, RemoteInputUriController remoteInputUriController) { @@ -269,7 +269,7 @@ public class NotificationRemoteInputManager implements Dumpable { mLockscreenUserManager = lockscreenUserManager; mSmartReplyController = smartReplyController; mEntryManager = notificationEntryManager; - mShadeController = shadeController; + mStatusBarLazy = statusBarLazy; mMainHandler = mainHandler; mBarService = IStatusBarService.Stub.asInterface( ServiceManager.getService(Context.STATUS_BAR_SERVICE)); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/PulseExpansionHandler.kt b/packages/SystemUI/src/com/android/systemui/statusbar/PulseExpansionHandler.kt index e516af590e34..88f148b00cdc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/PulseExpansionHandler.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/PulseExpansionHandler.kt @@ -211,7 +211,7 @@ constructor( setUserLocked(mStartingChild!!, false) mStartingChild = null } - if (shadeController.isDozing) { + if (statusBarStateController.isDozing) { isWakingToShadeLocked = true wakeUpCoordinator.willWakeUp = true mPowerManager!!.wakeUp(SystemClock.uptimeMillis(), WAKE_REASON_GESTURE, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationAlertingManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationAlertingManager.java index 65f3fa94374b..31b7cb0fb5a0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationAlertingManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationAlertingManager.java @@ -24,18 +24,16 @@ import android.service.notification.StatusBarNotification; import android.util.Log; import com.android.internal.statusbar.NotificationVisibility; +import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.NotificationListener; import com.android.systemui.statusbar.NotificationRemoteInputManager; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.NotificationContentInflater.InflationFlag; -import com.android.systemui.statusbar.phone.ShadeController; import com.android.systemui.statusbar.policy.HeadsUpManager; import javax.inject.Inject; import javax.inject.Singleton; -import dagger.Lazy; - /** Handles heads-up and pulsing behavior driven by notification changes. */ @Singleton public class NotificationAlertingManager { @@ -44,7 +42,7 @@ public class NotificationAlertingManager { private final NotificationRemoteInputManager mRemoteInputManager; private final VisualStabilityManager mVisualStabilityManager; - private final Lazy<ShadeController> mShadeController; + private final StatusBarStateController mStatusBarStateController; private final NotificationInterruptionStateProvider mNotificationInterruptionStateProvider; private final NotificationListener mNotificationListener; @@ -55,12 +53,12 @@ public class NotificationAlertingManager { NotificationEntryManager notificationEntryManager, NotificationRemoteInputManager remoteInputManager, VisualStabilityManager visualStabilityManager, - Lazy<ShadeController> shadeController, + StatusBarStateController statusBarStateController, NotificationInterruptionStateProvider notificationInterruptionStateProvider, NotificationListener notificationListener) { mRemoteInputManager = remoteInputManager; mVisualStabilityManager = visualStabilityManager; - mShadeController = shadeController; + mStatusBarStateController = statusBarStateController; mNotificationInterruptionStateProvider = notificationInterruptionStateProvider; mNotificationListener = notificationListener; @@ -102,7 +100,7 @@ public class NotificationAlertingManager { // If it does and we no longer need to heads up, we should free the view. if (mNotificationInterruptionStateProvider.shouldHeadsUp(entry)) { mHeadsUpManager.showNotification(entry); - if (!mShadeController.get().isDozing()) { + if (!mStatusBarStateController.isDozing()) { // Mark as seen immediately setNotificationShown(entry.getSbn()); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationClicker.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationClicker.java index b5c664116944..8ecf2b8421f0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationClicker.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationClicker.java @@ -24,7 +24,7 @@ import android.view.View; import com.android.systemui.DejankUtils; import com.android.systemui.bubbles.BubbleController; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; -import com.android.systemui.statusbar.phone.ShadeController; +import com.android.systemui.statusbar.phone.StatusBar; /** * Click handler for generic clicks on notifications. Clicks on specific areas (expansion caret, @@ -33,14 +33,14 @@ import com.android.systemui.statusbar.phone.ShadeController; public final class NotificationClicker implements View.OnClickListener { private static final String TAG = "NotificationClicker"; - private final ShadeController mShadeController; + private final StatusBar mStatusBar; private final BubbleController mBubbleController; private final NotificationActivityStarter mNotificationActivityStarter; - public NotificationClicker(ShadeController shadeController, + public NotificationClicker(StatusBar statusBar, BubbleController bubbleController, NotificationActivityStarter notificationActivityStarter) { - mShadeController = shadeController; + mStatusBar = statusBar; mBubbleController = bubbleController; mNotificationActivityStarter = notificationActivityStarter; } @@ -52,7 +52,7 @@ public final class NotificationClicker implements View.OnClickListener { return; } - mShadeController.wakeUpIfDozing(SystemClock.uptimeMillis(), v, "NOTIFICATION_CLICK"); + mStatusBar.wakeUpIfDozing(SystemClock.uptimeMillis(), v, "NOTIFICATION_CLICK"); final ExpandableNotificationRow row = (ExpandableNotificationRow) v; final StatusBarNotification sbn = row.getEntry().getSbn(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationFilter.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationFilter.java index b61c1ef50cae..6c61923332ea 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationFilter.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationFilter.java @@ -27,6 +27,7 @@ import android.service.notification.StatusBarNotification; import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.Dependency; import com.android.systemui.ForegroundServiceController; +import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.NotificationLockscreenUserManager; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.phone.NotificationGroupManager; @@ -45,6 +46,7 @@ public class NotificationFilter { private final NotificationGroupManager mGroupManager = Dependency.get( NotificationGroupManager.class); + private final StatusBarStateController mStatusBarStateController; private NotificationEntryManager.KeyguardEnvironment mEnvironment; private ShadeController mShadeController; @@ -52,7 +54,9 @@ public class NotificationFilter { private NotificationLockscreenUserManager mUserManager; @Inject - public NotificationFilter() {} + public NotificationFilter(StatusBarStateController statusBarStateController) { + mStatusBarStateController = statusBarStateController; + } private NotificationEntryManager.KeyguardEnvironment getEnvironment() { if (mEnvironment == null) { @@ -104,11 +108,11 @@ public class NotificationFilter { return true; } - if (getShadeController().isDozing() && entry.shouldSuppressAmbient()) { + if (mStatusBarStateController.isDozing() && entry.shouldSuppressAmbient()) { return true; } - if (!getShadeController().isDozing() && entry.shouldSuppressNotificationList()) { + if (!mStatusBarStateController.isDozing() && entry.shouldSuppressNotificationList()) { return true; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index 35407c6df690..ed2fb0fdcb1a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -2989,7 +2989,7 @@ public class NotificationPanelView extends PanelView implements return true; case StatusBarState.SHADE_LOCKED: if (!mQsExpanded) { - mShadeController.goToKeyguard(); + mStatusBarStateController.setState(StatusBarState.KEYGUARD); } return true; case StatusBarState.SHADE: diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ShadeController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ShadeController.java index b31ce6afc281..deea3f17aad0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ShadeController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ShadeController.java @@ -14,11 +14,9 @@ package com.android.systemui.statusbar.phone; -import android.annotation.NonNull; import android.view.View; import com.android.systemui.statusbar.StatusBarState; -import com.android.systemui.statusbar.notification.row.ActivatableNotificationView; /** * {@link ShadeController} is an abstraction of the work that used to be hard-coded in @@ -30,14 +28,6 @@ import com.android.systemui.statusbar.notification.row.ActivatableNotificationVi public interface ShadeController { /** - * Shows the keyguard bouncer - the password challenge on the lock screen - * - * @param scrimmed true when the bouncer should show scrimmed, false when the user will be - * dragging it and translation should be deferred {@see KeyguardBouncer#show(boolean, boolean)} - */ - void showBouncer(boolean scrimmed); - - /** * Make our window larger and the panel expanded */ void instantExpandNotificationsPanel(); @@ -71,12 +61,6 @@ public interface ShadeController { void addPostCollapseAction(Runnable action); /** - * Ask shade controller to set the state to {@link StatusBarState#KEYGUARD}, but only from - * {@link StatusBarState#SHADE_LOCKED} - */ - void goToKeyguard(); - - /** * Notify the shade controller that the current user changed * * @param newUserId userId of the new user @@ -84,22 +68,6 @@ public interface ShadeController { void setLockscreenUser(int newUserId); /** - * Dozing is when the screen is in AOD or asleep - * - * @return true if we are dozing - */ - boolean isDozing(); - - /** - * Ask the display to wake up if currently dozing, else do nothing - * - * @param time when to wake up - * @param view the view requesting the wakeup - * @param why the reason for the wake up - */ - void wakeUpIfDozing(long time, View view, @NonNull String why); - - /** * If secure with redaction: Show bouncer, go to unlocked shade. * * <p>If secure without redaction or no security: Go to {@link StatusBarState#SHADE_LOCKED}.</p> @@ -109,11 +77,6 @@ public interface ShadeController { void goToLockedShade(View startingChild); /** - * Adds a {@param runnable} to be executed after Keyguard is gone. - */ - void addAfterKeyguardGoneRunnable(Runnable runnable); - - /** * Close the shade if it was open * * @return true if the shade was open, else false @@ -127,16 +90,4 @@ public interface ShadeController { * @param animate */ void collapsePanel(boolean animate); - - /** - * Callback to tell the shade controller that an activity launch animation was canceled - */ - void onLaunchAnimationCancelled(); - - /** - * Callback to notify the shade controller that a {@link ActivatableNotificationView} has become - * inactive - */ - void onActivationReset(); - } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index 5575d10c7fe1..709143d7275a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -1239,6 +1239,7 @@ public class StatusBar extends SystemUI implements DemoMode, mHeadsUpManager, mStatusBarWindow, mStackScroller, mDozeScrimController, mScrimController, mActivityLaunchAnimator, mDynamicPrivacyController, mNotificationAlertingManager, rowBinder, mKeyguardStateController, + mKeyguardIndicationController, this /* statusBar */, mCommandQueue); mNotificationListController = @@ -1282,17 +1283,13 @@ public class StatusBar extends SystemUI implements DemoMode, mCommandQueue.disable(mDisplayId, state1, state2, false /* animate */); } - @Override - public void addAfterKeyguardGoneRunnable(Runnable runnable) { - mStatusBarKeyguardViewManager.addAfterKeyguardGoneRunnable(runnable); - } - - @Override - public boolean isDozing() { - return mDozing; - } - - @Override + /** + * Ask the display to wake up if currently dozing, else do nothing + * + * @param time when to wake up + * @param where the view requesting the wakeup + * @param why the reason for the wake up + */ public void wakeUpIfDozing(long time, View where, String why) { if (mDozing) { mPowerManager.wakeUp( @@ -1708,7 +1705,7 @@ public class StatusBar extends SystemUI implements DemoMode, @Override public void onHeadsUpStateChanged(NotificationEntry entry, boolean isHeadsUp) { mEntryManager.updateNotifications("onHeadsUpStateChanged"); - if (isDozing() && isHeadsUp) { + if (mStatusBarStateController.isDozing() && isHeadsUp) { entry.setPulseSuppressed(false); mDozeServiceHost.fireNotificationPulse(entry); if (mDozeServiceHost.isPulsing()) { @@ -3453,16 +3450,11 @@ public class StatusBar extends SystemUI implements DemoMode, private void showBouncerIfKeyguard() { if ((mState == StatusBarState.KEYGUARD || mState == StatusBarState.SHADE_LOCKED) && !mKeyguardViewMediator.isHiding()) { - showBouncer(true /* scrimmed */); + mStatusBarKeyguardViewManager.showBouncer(true /* scrimmed */); } } @Override - public void showBouncer(boolean scrimmed) { - mStatusBarKeyguardViewManager.showBouncer(scrimmed); - } - - @Override public void instantExpandNotificationsPanel() { // Make our window larger and the panel expanded. makeExpandedVisible(true); @@ -3583,10 +3575,6 @@ public class StatusBar extends SystemUI implements DemoMode, mStatusBarKeyguardViewManager.isOccluded()); } - public void onActivationReset() { - mKeyguardIndicationController.hideTransientIndication(); - } - public void onTrackingStarted() { runPostCollapseRunnables(); } @@ -3628,7 +3616,7 @@ public class StatusBar extends SystemUI implements DemoMode, public void onTrackingStopped(boolean expand) { if (mState == StatusBarState.KEYGUARD || mState == StatusBarState.SHADE_LOCKED) { if (!expand && !mKeyguardStateController.canDismissLockScreen()) { - showBouncer(false /* scrimmed */); + mStatusBarKeyguardViewManager.showBouncer(false /* scrimmed */); } } } @@ -3688,15 +3676,6 @@ public class StatusBar extends SystemUI implements DemoMode, } /** - * Goes back to the keyguard after hanging around in {@link StatusBarState#SHADE_LOCKED}. - */ - public void goToKeyguard() { - if (mState == StatusBarState.SHADE_LOCKED) { - mStatusBarStateController.setState(StatusBarState.KEYGUARD); - } - } - - /** * Propagation of the bouncer state, indicating that it's fully visible. */ public void setBouncerShowing(boolean bouncerShowing) { @@ -4019,7 +3998,8 @@ public class StatusBar extends SystemUI implements DemoMode, } public boolean shouldIgnoreTouch() { - return isDozing() && mDozeServiceHost.getIgnoreTouchWhilePulsing(); + return mStatusBarStateController.isDozing() + && mDozeServiceHost.getIgnoreTouchWhilePulsing(); } // Begin Extra BaseStatusBar methods. diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java index 31d03621d23b..dac4e585c1ac 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -365,6 +365,12 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb cancelPendingWakeupAction(); } + /** + * Shows the keyguard bouncer - the password challenge on the lock screen + * + * @param scrimmed true when the bouncer should show scrimmed, false when the user will be + * dragging it and translation should be deferred {@see KeyguardBouncer#show(boolean, boolean)} + */ public void showBouncer(boolean scrimmed) { if (mShowing && !mBouncer.isShowing()) { mBouncer.show(false /* resetSecuritySelection */, scrimmed); 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 e2832587e2ea..1988b42be14f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java @@ -105,6 +105,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit private final NotificationPresenter mPresenter; private final LockPatternUtils mLockPatternUtils; private final HeadsUpManagerPhone mHeadsUpManager; + private final StatusBarKeyguardViewManager mStatusBarKeyguardViewManager; private final KeyguardManager mKeyguardManager; private final ActivityLaunchAnimator mActivityLaunchAnimator; private final IStatusBarService mBarService; @@ -122,7 +123,9 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit NotificationPresenter presenter, NotificationEntryManager entryManager, HeadsUpManagerPhone headsUpManager, ActivityStarter activityStarter, ActivityLaunchAnimator activityLaunchAnimator, IStatusBarService statusBarService, - StatusBarStateController statusBarStateController, KeyguardManager keyguardManager, + StatusBarStateController statusBarStateController, + StatusBarKeyguardViewManager statusBarKeyguardViewManager, + KeyguardManager keyguardManager, IDreamManager dreamManager, NotificationRemoteInputManager remoteInputManager, StatusBarRemoteInputCallback remoteInputCallback, NotificationGroupManager groupManager, NotificationLockscreenUserManager lockscreenUserManager, @@ -139,6 +142,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit mActivityLaunchAnimator = activityLaunchAnimator; mBarService = statusBarService; mCommandQueue = commandQueue; + mStatusBarKeyguardViewManager = statusBarKeyguardViewManager; mKeyguardManager = keyguardManager; mDreamManager = dreamManager; mRemoteInputManager = remoteInputManager; @@ -258,7 +262,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit mShadeController.collapsePanel(true /* animate */); } else if (mKeyguardStateController.isShowing() && mStatusBar.isOccluded()) { - mShadeController.addAfterKeyguardGoneRunnable(runnable); + mStatusBarKeyguardViewManager.addAfterKeyguardGoneRunnable(runnable); mShadeController.collapsePanel(); } else { mBackgroundHandler.postAtFrontOfQueue(runnable); @@ -504,6 +508,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit private final ActivityStarter mActivityStarter; private final IStatusBarService mStatusBarService; private final StatusBarStateController mStatusBarStateController; + private final StatusBarKeyguardViewManager mStatusBarKeyguardViewManager; private final KeyguardManager mKeyguardManager; private final IDreamManager mDreamManager; private final NotificationRemoteInputManager mRemoteInputManager; @@ -533,6 +538,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit ActivityStarter activityStarter, IStatusBarService statusBarService, StatusBarStateController statusBarStateController, + StatusBarKeyguardViewManager statusBarKeyguardViewManager, KeyguardManager keyguardManager, IDreamManager dreamManager, NotificationRemoteInputManager remoteInputManager, @@ -556,6 +562,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit mActivityStarter = activityStarter; mStatusBarService = statusBarService; mStatusBarStateController = statusBarStateController; + mStatusBarKeyguardViewManager = statusBarKeyguardViewManager; mKeyguardManager = keyguardManager; mDreamManager = dreamManager; mRemoteInputManager = remoteInputManager; @@ -601,6 +608,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit mActivityLaunchAnimator, mStatusBarService, mStatusBarStateController, + mStatusBarKeyguardViewManager, mKeyguardManager, mDreamManager, mRemoteInputManager, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java index 6650cf6a5af6..2649166bfcbf 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java @@ -49,6 +49,7 @@ import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.ActivityStarter.OnDismissAction; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.CommandQueue; +import com.android.systemui.statusbar.KeyguardIndicationController; import com.android.systemui.statusbar.NotificationLockscreenUserManager; import com.android.systemui.statusbar.NotificationMediaManager; import com.android.systemui.statusbar.NotificationPresenter; @@ -113,6 +114,7 @@ public class StatusBarNotificationPresenter implements NotificationPresenter, private final DozeScrimController mDozeScrimController; private final ScrimController mScrimController; private final Context mContext; + private final KeyguardIndicationController mKeyguardIndicationController; private final StatusBar mStatusBar; private final CommandQueue mCommandQueue; @@ -141,6 +143,7 @@ public class StatusBarNotificationPresenter implements NotificationPresenter, NotificationAlertingManager notificationAlertingManager, NotificationRowBinderImpl notificationRowBinder, KeyguardStateController keyguardStateController, + KeyguardIndicationController keyguardIndicationController, StatusBar statusBar, CommandQueue commandQueue) { mContext = context; @@ -148,6 +151,7 @@ public class StatusBarNotificationPresenter implements NotificationPresenter, mNotificationPanel = panel; mHeadsUpManager = headsUp; mDynamicPrivacyController = dynamicPrivacyController; + mKeyguardIndicationController = keyguardIndicationController; // TODO: use KeyguardStateController#isOccluded to remove this dependency mStatusBar = statusBar; mCommandQueue = commandQueue; @@ -323,7 +327,7 @@ public class StatusBarNotificationPresenter implements NotificationPresenter, mCommandQueue.animateCollapsePanels(); } else if (mStatusBarStateController.getState() == StatusBarState.SHADE_LOCKED && !isCollapsing()) { - mShadeController.goToKeyguard(); + mStatusBarStateController.setState(StatusBarState.KEYGUARD); } } } @@ -420,7 +424,7 @@ public class StatusBarNotificationPresenter implements NotificationPresenter, public void onActivationReset(ActivatableNotificationView view) { if (view == mNotificationPanel.getActivatedChild()) { mNotificationPanel.setActivatedChild(null); - mShadeController.onActivationReset(); + mKeyguardIndicationController.hideTransientIndication(); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallback.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallback.java index 3e6ba4dacb71..2012b5703504 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallback.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallback.java @@ -64,6 +64,7 @@ public class StatusBarRemoteInputCallback implements Callback, Callbacks, private final ActivityStarter mActivityStarter; private final Lazy<ShadeController> mShadeControllerLazy; private final Context mContext; + private final StatusBarKeyguardViewManager mStatusBarKeyguardViewManager; private final ActivityIntentHelper mActivityIntentHelper; private final NotificationGroupManager mGroupManager; private View mPendingWorkRemoteInputView; @@ -81,9 +82,11 @@ public class StatusBarRemoteInputCallback implements Callback, Callbacks, NotificationLockscreenUserManager notificationLockscreenUserManager, KeyguardStateController keyguardStateController, StatusBarStateController statusBarStateController, + StatusBarKeyguardViewManager statusBarKeyguardViewManager, ActivityStarter activityStarter, Lazy<ShadeController> shadeControllerLazy, CommandQueue commandQueue) { mContext = context; + mStatusBarKeyguardViewManager = statusBarKeyguardViewManager; mContext.registerReceiverAsUser(mChallengeReceiver, UserHandle.ALL, new IntentFilter(ACTION_DEVICE_LOCKED_CHANGED), null, null); mLockscreenUserManager = notificationLockscreenUserManager; @@ -118,7 +121,7 @@ public class StatusBarRemoteInputCallback implements Callback, Callbacks, if (!row.isPinned()) { mStatusBarStateController.setLeaveOpenOnKeyguardHide(true); } - mShadeControllerLazy.get().showBouncer(true /* scrimmed */); + mStatusBarKeyguardViewManager.showBouncer(true /* scrimmed */); mPendingRemoteInputView = clicked; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowViewController.java index 3935df02fd91..f8929e01adb8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowViewController.java @@ -263,7 +263,7 @@ public class StatusBarWindowViewController { if (isDown) { mStackScrollLayout.closeControlsIfOutsideTouch(ev); } - if (mService.isDozing()) { + if (mStatusBarStateController.isDozing()) { mService.mDozeScrimController.extendPulse(); } // In case we start outside of the view bounds (below the status bar), we need to @@ -284,7 +284,8 @@ public class StatusBarWindowViewController { @Override public boolean shouldInterceptTouchEvent(MotionEvent ev) { - if (mService.isDozing() && !mService.isPulsing() && !mDockManager.isDocked()) { + if (mStatusBarStateController.isDozing() && !mService.isPulsing() + && !mDockManager.isDocked()) { // Capture all touch events in always-on. return true; } @@ -292,7 +293,7 @@ public class StatusBarWindowViewController { if (notificationPanelView.isFullyExpanded() && mDragDownHelper.isDragDownEnabled() && !mService.isBouncerShowing() - && !mService.isDozing()) { + && !mStatusBarStateController.isDozing()) { intercept = mDragDownHelper.onInterceptTouchEvent(ev); } @@ -312,7 +313,7 @@ public class StatusBarWindowViewController { @Override public boolean handleTouchEvent(MotionEvent ev) { boolean handled = false; - if (mService.isDozing()) { + if (mStatusBarStateController.isDozing()) { handled = !mService.isPulsing(); } if ((mDragDownHelper.isDragDownEnabled() && !handled) @@ -358,7 +359,7 @@ public class StatusBarWindowViewController { break; case KeyEvent.KEYCODE_VOLUME_DOWN: case KeyEvent.KEYCODE_VOLUME_UP: - if (mService.isDozing()) { + if (mStatusBarStateController.isDozing()) { MediaSessionLegacyHelper.getHelper(mView.getContext()) .sendVolumeKeyEvent( event, AudioManager.USE_DEFAULT_STREAM_TYPE, true); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java index a754a00df940..8aac1891a5e4 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java @@ -30,7 +30,7 @@ import com.android.systemui.statusbar.NotificationRemoteInputManager.SmartReplyH import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; -import com.android.systemui.statusbar.phone.ShadeController; +import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.policy.RemoteInputUriController; import com.google.android.collect.Sets; @@ -76,7 +76,7 @@ public class NotificationRemoteInputManagerTest extends SysuiTestCase { mRemoteInputManager = new TestableNotificationRemoteInputManager(mContext, mLockscreenUserManager, mSmartReplyController, mEntryManager, - () -> mock(ShadeController.class), + () -> mock(StatusBar.class), mStateController, Handler.createAsync(Looper.myLooper()), mRemoteInputUriController); @@ -212,12 +212,12 @@ public class NotificationRemoteInputManagerTest extends SysuiTestCase { NotificationLockscreenUserManager lockscreenUserManager, SmartReplyController smartReplyController, NotificationEntryManager notificationEntryManager, - Lazy<ShadeController> shadeController, + Lazy<StatusBar> statusBarLazy, StatusBarStateController statusBarStateController, Handler mainHandler, RemoteInputUriController remoteInputUriController) { super(context, lockscreenUserManager, smartReplyController, notificationEntryManager, - shadeController, statusBarStateController, mainHandler, + statusBarLazy, statusBarStateController, mainHandler, remoteInputUriController); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/SmartReplyControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/SmartReplyControllerTest.java index 95ce53c58e95..3f624128ac2c 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/SmartReplyControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/SmartReplyControllerTest.java @@ -41,7 +41,7 @@ import com.android.systemui.SysuiTestCase; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.collection.NotificationEntry; -import com.android.systemui.statusbar.phone.ShadeController; +import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.policy.RemoteInputUriController; import org.junit.Before; @@ -88,7 +88,7 @@ public class SmartReplyControllerTest extends SysuiTestCase { mRemoteInputManager = new NotificationRemoteInputManager(mContext, mock(NotificationLockscreenUserManager.class), mSmartReplyController, - mNotificationEntryManager, () -> mock(ShadeController.class), + mNotificationEntryManager, () -> mock(StatusBar.class), mStatusBarStateController, Handler.createAsync(Looper.myLooper()), mRemoteInputUriController); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationFilterTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationFilterTest.java index 68730d12dee3..7fabb0fee8e2 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationFilterTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationFilterTest.java @@ -100,7 +100,7 @@ public class NotificationFilterTest extends SysuiTestCase { when(mEnvironment.isDeviceProvisioned()).thenReturn(true); when(mEnvironment.isNotificationForCurrentProfiles(any())).thenReturn(true); mRow = new NotificationTestHelper(getContext(), mDependency).createRow(); - mNotificationFilter = new NotificationFilter(); + mNotificationFilter = new NotificationFilter(mock(StatusBarStateController.class)); } @Test diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java index 61e5058b1a20..b27e84a37e3f 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java @@ -126,7 +126,7 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { @Test public void showBouncer_onlyWhenShowing() { mStatusBarKeyguardViewManager.hide(0 /* startTime */, 0 /* fadeoutDuration */); - mStatusBar.showBouncer(true /* scrimmed */); + mStatusBarKeyguardViewManager.showBouncer(true /* scrimmed */); verify(mBouncer, never()).show(anyBoolean(), anyBoolean()); verify(mBouncer, never()).show(anyBoolean()); } @@ -135,7 +135,7 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { public void showBouncer_notWhenBouncerAlreadyShowing() { mStatusBarKeyguardViewManager.hide(0 /* startTime */, 0 /* fadeoutDuration */); when(mBouncer.isSecure()).thenReturn(true); - mStatusBar.showBouncer(true /* scrimmed */); + mStatusBarKeyguardViewManager.showBouncer(true /* scrimmed */); verify(mBouncer, never()).show(anyBoolean(), anyBoolean()); verify(mBouncer, never()).show(anyBoolean()); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java index 77cdc025bbc9..d7c00cf3038d 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java @@ -98,6 +98,8 @@ public class StatusBarNotificationActivityStarterTest extends SysuiTestCase { @Mock private StatusBarStateController mStatusBarStateController; @Mock + private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager; + @Mock private NotificationRemoteInputManager mRemoteInputManager; @Mock private RemoteInputController mRemoteInputController; @@ -167,7 +169,8 @@ public class StatusBarNotificationActivityStarterTest extends SysuiTestCase { getContext(), mock(CommandQueue.class), () -> mAssistManager, mEntryManager, mock(HeadsUpManagerPhone.class), mActivityStarter, mStatusBarService, - mock(StatusBarStateController.class), mock(KeyguardManager.class), + mock(StatusBarStateController.class), mStatusBarKeyguardViewManager, + mock(KeyguardManager.class), mock(IDreamManager.class), mRemoteInputManager, mock(StatusBarRemoteInputCallback.class), mock(NotificationGroupManager.class), mock(NotificationLockscreenUserManager.class), @@ -186,7 +189,8 @@ public class StatusBarNotificationActivityStarterTest extends SysuiTestCase { // set up addAfterKeyguardGoneRunnable to synchronously invoke the Runnable arg doAnswer(answerVoid(Runnable::run)) - .when(mStatusBar).addAfterKeyguardGoneRunnable(any(Runnable.class)); + .when(mStatusBarKeyguardViewManager) + .addAfterKeyguardGoneRunnable(any(Runnable.class)); // set up addPostCollapseAction to synchronously invoke the Runnable arg doAnswer(answerVoid(Runnable::run)) diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java index 14f5795c39f1..fb6e1684c376 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java @@ -39,6 +39,7 @@ import com.android.systemui.InitController; import com.android.systemui.SysuiTestCase; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.CommandQueue; +import com.android.systemui.statusbar.KeyguardIndicationController; import com.android.systemui.statusbar.NotificationEntryBuilder; import com.android.systemui.statusbar.NotificationLockscreenUserManager; import com.android.systemui.statusbar.NotificationMediaManager; @@ -113,6 +114,7 @@ public class StatusBarNotificationPresenterTest extends SysuiTestCase { mock(ActivityLaunchAnimator.class), mock(DynamicPrivacyController.class), mock(NotificationAlertingManager.class), mock(NotificationRowBinderImpl.class), mock(KeyguardStateController.class), + mock(KeyguardIndicationController.class), mStatusBar, mCommandQueue); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallbackTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallbackTest.java index 9d76b425725f..6dfd0828de9a 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallbackTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallbackTest.java @@ -54,6 +54,7 @@ public class StatusBarRemoteInputCallbackTest extends SysuiTestCase { @Mock private NotificationLockscreenUserManager mNotificationLockscreenUserManager; @Mock private KeyguardStateController mKeyguardStateController; @Mock private SysuiStatusBarStateController mStatusBarStateController; + @Mock private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager; @Mock private ActivityStarter mActivityStarter; private int mCurrentUserId = 0; @@ -71,8 +72,8 @@ public class StatusBarRemoteInputCallbackTest extends SysuiTestCase { mRemoteInputCallback = spy(new StatusBarRemoteInputCallback(mContext, mock(NotificationGroupManager.class), mNotificationLockscreenUserManager, - mKeyguardStateController, mStatusBarStateController, mActivityStarter, - () -> mShadeController, new CommandQueue(mContext))); + mKeyguardStateController, mStatusBarStateController, mStatusBarKeyguardViewManager, + mActivityStarter, () -> mShadeController, new CommandQueue(mContext))); mRemoteInputCallback.mChallengeReceiver = mRemoteInputCallback.new ChallengeReceiver(); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarWindowViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarWindowViewTest.java index 529333effa2c..00ea18749de3 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarWindowViewTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarWindowViewTest.java @@ -80,7 +80,7 @@ public class StatusBarWindowViewTest extends SysuiTestCase { MockitoAnnotations.initMocks(this); mView = new StatusBarWindowView(getContext(), null); - when(mStatusBar.isDozing()).thenReturn(false); + when(mStatusBarStateController.isDozing()).thenReturn(false); mDependency.injectTestDependency(ShadeController.class, mShadeController); when(mDockManager.isDocked()).thenReturn(false); |