summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/ShadeController.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java12
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java21
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java8
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java22
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java13
7 files changed, 55 insertions, 38 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
index a98f826c0284..d3a9c2c3c87d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
@@ -62,6 +62,7 @@ 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;
@@ -122,6 +123,7 @@ public class NotificationMediaManager implements Dumpable {
private final Context mContext;
private final MediaSessionManager mMediaSessionManager;
private final ArrayList<MediaListener> mMediaListeners;
+ private final Lazy<StatusBar> mStatusBarLazy;
private final MediaArtworkProcessor mMediaArtworkProcessor;
private final Set<AsyncTask<?, ?, ?>> mProcessArtworkTasks = new ArraySet<>();
@@ -182,6 +184,7 @@ public class NotificationMediaManager implements Dumpable {
public NotificationMediaManager(
Context context,
Lazy<ShadeController> shadeController,
+ Lazy<StatusBar> statusBarLazy,
Lazy<StatusBarWindowController> statusBarWindowController,
NotificationEntryManager notificationEntryManager,
MediaArtworkProcessor mediaArtworkProcessor,
@@ -195,6 +198,8 @@ public class NotificationMediaManager implements Dumpable {
// TODO: use MediaSessionManager.SessionListener to hook us up to future updates
// in session state
mShadeController = shadeController;
+ // TODO: use KeyguardStateController#isOccluded to remove this dependency
+ mStatusBarLazy = statusBarLazy;
mStatusBarWindowController = statusBarWindowController;
mEntryManager = notificationEntryManager;
notificationEntryManager.addNotificationEntryListener(new NotificationEntryListener() {
@@ -526,9 +531,8 @@ public class NotificationMediaManager implements Dumpable {
}
}
- ShadeController shadeController = mShadeController.get();
StatusBarWindowController windowController = mStatusBarWindowController.get();
- boolean hideBecauseOccluded = shadeController != null && shadeController.isOccluded();
+ boolean hideBecauseOccluded = mStatusBarLazy.get().isOccluded();
final boolean hasArtwork = artworkDrawable != null;
mColorExtractor.setHasMediaArtwork(hasMediaArtwork);
@@ -599,6 +603,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()
&& !ScrimState.AOD.getAnimateChange();
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 f359fe7cfec4..b31ce6afc281 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ShadeController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ShadeController.java
@@ -77,14 +77,6 @@ public interface ShadeController {
void goToKeyguard();
/**
- * When the keyguard is showing and covered by something (bouncer, keyguard activity, etc.) it
- * is occluded. This is controlled by {@link com.android.server.policy.PhoneWindowManager}
- *
- * @return whether the keyguard is currently occluded
- */
- boolean isOccluded();
-
- /**
* Notify the shade controller that the current user changed
*
* @param newUserId userId of the new user
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 d1da7f71731c..5c71a57cba77 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -1237,7 +1237,8 @@ public class StatusBar extends SystemUI implements DemoMode,
mPresenter = new StatusBarNotificationPresenter(mContext, mNotificationPanel,
mHeadsUpManager, mStatusBarWindow, mStackScroller, mDozeScrimController,
mScrimController, mActivityLaunchAnimator, mDynamicPrivacyController,
- mNotificationAlertingManager, rowBinder, mKeyguardStateController, mCommandQueue);
+ mNotificationAlertingManager, rowBinder, mKeyguardStateController,
+ this /* statusBar */, mCommandQueue);
mNotificationListController =
new NotificationListController(
@@ -1250,7 +1251,7 @@ public class StatusBar extends SystemUI implements DemoMode,
mNotificationActivityStarter =
mStatusBarNotificationActivityStarterBuilder
- .setShadeController(this)
+ .setStatusBar(this)
.setActivityLaunchAnimator(mActivityLaunchAnimator)
.setNotificationPresenter(mPresenter)
.build();
@@ -1758,7 +1759,12 @@ public class StatusBar extends SystemUI implements DemoMode,
return mAmbientIndicationContainer;
}
- @Override
+ /**
+ * When the keyguard is showing and covered by a "showWhenLocked" activity it
+ * is occluded. This is controlled by {@link com.android.server.policy.PhoneWindowManager}
+ *
+ * @return whether the keyguard is currently occluded
+ */
public boolean isOccluded() {
return mIsOccluded;
}
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 863874e788c6..e2832587e2ea 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
@@ -93,6 +93,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
private final NotificationRemoteInputManager mRemoteInputManager;
private final NotificationLockscreenUserManager mLockscreenUserManager;
private final ShadeController mShadeController;
+ private final StatusBar mStatusBar;
private final KeyguardStateController mKeyguardStateController;
private final ActivityStarter mActivityStarter;
private final NotificationEntryManager mEntryManager;
@@ -125,7 +126,8 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
IDreamManager dreamManager, NotificationRemoteInputManager remoteInputManager,
StatusBarRemoteInputCallback remoteInputCallback, NotificationGroupManager groupManager,
NotificationLockscreenUserManager lockscreenUserManager,
- ShadeController shadeController, KeyguardStateController keyguardStateController,
+ ShadeController shadeController, StatusBar statusBar,
+ KeyguardStateController keyguardStateController,
NotificationInterruptionStateProvider notificationInterruptionStateProvider,
MetricsLogger metricsLogger, LockPatternUtils lockPatternUtils,
Handler mainThreadHandler, Handler backgroundHandler,
@@ -142,6 +144,8 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
mRemoteInputManager = remoteInputManager;
mLockscreenUserManager = lockscreenUserManager;
mShadeController = shadeController;
+ // TODO: use KeyguardStateController#isOccluded to remove this dependency
+ mStatusBar = statusBar;
mKeyguardStateController = keyguardStateController;
mActivityStarter = activityStarter;
mEntryManager = entryManager;
@@ -198,7 +202,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
final boolean afterKeyguardGone = isActivityIntent
&& mActivityIntentHelper.wouldLaunchResolverActivity(intent.getIntent(),
mLockscreenUserManager.getCurrentUserId());
- final boolean wasOccluded = mShadeController.isOccluded();
+ final boolean wasOccluded = mStatusBar.isOccluded();
boolean showOverLockscreen = mKeyguardStateController.isShowing() && intent != null
&& mActivityIntentHelper.wouldShowOverLockscreen(intent.getIntent(),
mLockscreenUserManager.getCurrentUserId());
@@ -253,7 +257,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
mShadeController.addPostCollapseAction(runnable);
mShadeController.collapsePanel(true /* animate */);
} else if (mKeyguardStateController.isShowing()
- && mShadeController.isOccluded()) {
+ && mStatusBar.isOccluded()) {
mShadeController.addAfterKeyguardGoneRunnable(runnable);
mShadeController.collapsePanel();
} else {
@@ -384,7 +388,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
.addNextIntentWithParentStack(intent)
.startActivities(getActivityOptions(
mActivityLaunchAnimator.getLaunchAnimation(
- row, mShadeController.isOccluded())),
+ row, mStatusBar.isOccluded())),
new UserHandle(UserHandle.getUserId(appUid)));
mActivityLaunchAnimator.setLaunchResult(launchResult, true /* isActivityIntent */);
if (shouldCollapse()) {
@@ -518,6 +522,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
private ShadeController mShadeController;
private NotificationPresenter mNotificationPresenter;
private ActivityLaunchAnimator mActivityLaunchAnimator;
+ private StatusBar mStatusBar;
@Inject
public Builder(Context context,
@@ -567,8 +572,11 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
mBubbleController = bubbleController;
mSuperStatusBarViewFactory = superStatusBarViewFactory;
}
- public Builder setShadeController(ShadeController shadeController) {
- mShadeController = shadeController;
+
+ /** Sets the status bar to use as {@link StatusBar} and {@link ShadeController}. */
+ public Builder setStatusBar(StatusBar statusBar) {
+ mStatusBar = statusBar;
+ mShadeController = statusBar;
return this;
}
@@ -600,6 +608,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
mGroupManager,
mLockscreenUserManager,
mShadeController,
+ mStatusBar,
mKeyguardStateController,
mNotificationInterruptionStateProvider,
mMetricsLogger,
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 30e26e57e435..6650cf6a5af6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java
@@ -113,6 +113,7 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
private final DozeScrimController mDozeScrimController;
private final ScrimController mScrimController;
private final Context mContext;
+ private final StatusBar mStatusBar;
private final CommandQueue mCommandQueue;
private final AccessibilityManager mAccessibilityManager;
@@ -140,12 +141,15 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
NotificationAlertingManager notificationAlertingManager,
NotificationRowBinderImpl notificationRowBinder,
KeyguardStateController keyguardStateController,
+ StatusBar statusBar,
CommandQueue commandQueue) {
mContext = context;
mKeyguardStateController = keyguardStateController;
mNotificationPanel = panel;
mHeadsUpManager = headsUp;
mDynamicPrivacyController = dynamicPrivacyController;
+ // TODO: use KeyguardStateController#isOccluded to remove this dependency
+ mStatusBar = statusBar;
mCommandQueue = commandQueue;
mAboveShelfObserver = new AboveShelfObserver(stackScroller);
mActivityLaunchAnimator = activityLaunchAnimator;
@@ -330,7 +334,7 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
}
public boolean canHeadsUp(NotificationEntry entry, StatusBarNotification sbn) {
- if (mShadeController.isOccluded()) {
+ if (mStatusBar.isOccluded()) {
boolean devicePublic = mLockscreenUserManager.
isLockscreenPublicMode(mLockscreenUserManager.getCurrentUserId());
boolean userPublic = devicePublic
@@ -356,7 +360,7 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
} else {
// we only allow head-up on the lockscreen if it doesn't have a fullscreen intent
return !mKeyguardStateController.isShowing()
- || mShadeController.isOccluded();
+ || mStatusBar.isOccluded();
}
}
return true;
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 6f5cfbecb5d0..77cdc025bbc9 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
@@ -102,7 +102,7 @@ public class StatusBarNotificationActivityStarterTest extends SysuiTestCase {
@Mock
private RemoteInputController mRemoteInputController;
@Mock
- private ShadeController mShadeController;
+ private StatusBar mStatusBar;
@Mock
private KeyguardStateController mKeyguardStateController;
@Mock
@@ -175,7 +175,7 @@ public class StatusBarNotificationActivityStarterTest extends SysuiTestCase {
mock(NotificationInterruptionStateProvider.class), mock(MetricsLogger.class),
mock(LockPatternUtils.class), mHandler, mHandler, mActivityIntentHelper,
mBubbleController, mSuperStatusBarViewFactory))
- .setShadeController(mShadeController)
+ .setStatusBar(mStatusBar)
.setNotificationPresenter(mock(NotificationPresenter.class))
.setActivityLaunchAnimator(mock(ActivityLaunchAnimator.class))
.build();
@@ -186,11 +186,11 @@ public class StatusBarNotificationActivityStarterTest extends SysuiTestCase {
// set up addAfterKeyguardGoneRunnable to synchronously invoke the Runnable arg
doAnswer(answerVoid(Runnable::run))
- .when(mShadeController).addAfterKeyguardGoneRunnable(any(Runnable.class));
+ .when(mStatusBar).addAfterKeyguardGoneRunnable(any(Runnable.class));
// set up addPostCollapseAction to synchronously invoke the Runnable arg
doAnswer(answerVoid(Runnable::run))
- .when(mShadeController).addPostCollapseAction(any(Runnable.class));
+ .when(mStatusBar).addPostCollapseAction(any(Runnable.class));
// set up Handler to synchronously invoke the Runnable arg
doAnswer(answerVoid(Runnable::run))
@@ -209,13 +209,13 @@ public class StatusBarNotificationActivityStarterTest extends SysuiTestCase {
sbn.getNotification().flags |= Notification.FLAG_AUTO_CANCEL;
when(mKeyguardStateController.isShowing()).thenReturn(true);
- when(mShadeController.isOccluded()).thenReturn(true);
+ when(mStatusBar.isOccluded()).thenReturn(true);
// When
mNotificationActivityStarter.onNotificationClicked(sbn, mNotificationRow);
// Then
- verify(mShadeController, atLeastOnce()).collapsePanel();
+ verify(mStatusBar, atLeastOnce()).collapsePanel();
verify(mContentIntent).sendAndReturnResult(
any(Context.class),
@@ -250,7 +250,7 @@ public class StatusBarNotificationActivityStarterTest extends SysuiTestCase {
verify(mBubbleController).expandStackAndSelectBubble(eq(sbn.getKey()));
// This is called regardless, and simply short circuits when there is nothing to do.
- verify(mShadeController, atLeastOnce()).collapsePanel();
+ verify(mStatusBar, atLeastOnce()).collapsePanel();
verify(mAssistManager).hideAssist();
@@ -272,7 +272,7 @@ public class StatusBarNotificationActivityStarterTest extends SysuiTestCase {
// Given
sbn.getNotification().contentIntent = null;
when(mKeyguardStateController.isShowing()).thenReturn(true);
- when(mShadeController.isOccluded()).thenReturn(true);
+ when(mStatusBar.isOccluded()).thenReturn(true);
// When
mNotificationActivityStarter.onNotificationClicked(sbn, mBubbleNotificationRow);
@@ -280,7 +280,7 @@ public class StatusBarNotificationActivityStarterTest extends SysuiTestCase {
// Then
verify(mBubbleController).expandStackAndSelectBubble(eq(sbn.getKey()));
- verify(mShadeController, atLeastOnce()).collapsePanel();
+ verify(mStatusBar, atLeastOnce()).collapsePanel();
verify(mAssistManager).hideAssist();
@@ -302,7 +302,7 @@ public class StatusBarNotificationActivityStarterTest extends SysuiTestCase {
// Given
sbn.getNotification().contentIntent = mContentIntent;
when(mKeyguardStateController.isShowing()).thenReturn(true);
- when(mShadeController.isOccluded()).thenReturn(true);
+ when(mStatusBar.isOccluded()).thenReturn(true);
// When
mNotificationActivityStarter.onNotificationClicked(sbn, mBubbleNotificationRow);
@@ -310,7 +310,7 @@ public class StatusBarNotificationActivityStarterTest extends SysuiTestCase {
// Then
verify(mBubbleController).expandStackAndSelectBubble(eq(sbn.getKey()));
- verify(mShadeController, atLeastOnce()).collapsePanel();
+ verify(mStatusBar, atLeastOnce()).collapsePanel();
verify(mAssistManager).hideAssist();
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 1c02b60902b8..14f5795c39f1 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
@@ -71,10 +71,11 @@ import java.util.ArrayList;
public class StatusBarNotificationPresenterTest extends SysuiTestCase {
- private StatusBarNotificationPresenter mStatusBar;
+ private StatusBarNotificationPresenter mStatusBarNotificationPresenter;
private CommandQueue mCommandQueue;
private FakeMetricsLogger mMetricsLogger;
private ShadeController mShadeController = mock(ShadeController.class);
+ private StatusBar mStatusBar = mock(StatusBar.class);
@Before
public void setup() {
@@ -105,14 +106,14 @@ public class StatusBarNotificationPresenterTest extends SysuiTestCase {
StatusBarWindowView statusBarWindowView = mock(StatusBarWindowView.class);
when(statusBarWindowView.getResources()).thenReturn(mContext.getResources());
- mStatusBar = new StatusBarNotificationPresenter(mContext,
+ mStatusBarNotificationPresenter = new StatusBarNotificationPresenter(mContext,
mock(NotificationPanelView.class), mock(HeadsUpManagerPhone.class),
statusBarWindowView, mock(NotificationListContainerViewGroup.class),
mock(DozeScrimController.class), mock(ScrimController.class),
mock(ActivityLaunchAnimator.class), mock(DynamicPrivacyController.class),
mock(NotificationAlertingManager.class),
mock(NotificationRowBinderImpl.class), mock(KeyguardStateController.class),
- mCommandQueue);
+ mStatusBar, mCommandQueue);
}
@Test
@@ -129,7 +130,7 @@ public class StatusBarNotificationPresenterTest extends SysuiTestCase {
TestableLooper.get(this).processAllMessages();
assertFalse("The panel shouldn't allow heads up while disabled",
- mStatusBar.canHeadsUp(entry, entry.getSbn()));
+ mStatusBarNotificationPresenter.canHeadsUp(entry, entry.getSbn()));
}
@Test
@@ -146,13 +147,13 @@ public class StatusBarNotificationPresenterTest extends SysuiTestCase {
TestableLooper.get(this).processAllMessages();
assertFalse("The panel shouldn't allow heads up while notitifcation shade disabled",
- mStatusBar.canHeadsUp(entry, entry.getSbn()));
+ mStatusBarNotificationPresenter.canHeadsUp(entry, entry.getSbn()));
}
@Test
public void onActivatedMetrics() {
ActivatableNotificationView view = mock(ActivatableNotificationView.class);
- mStatusBar.onActivated(view);
+ mStatusBarNotificationPresenter.onActivated(view);
MetricsAsserts.assertHasLog("missing lockscreen note tap log",
mMetricsLogger.getLogs(),