Loading packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java +3 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.dagger; import android.app.INotificationManager; import android.content.Context; import android.service.dreams.IDreamManager; import androidx.annotation.Nullable; Loading Loading @@ -213,6 +214,7 @@ public abstract class SystemUIModule { ShadeController shadeController, @Nullable IStatusBarService statusBarService, INotificationManager notificationManager, IDreamManager dreamManager, NotificationVisibilityProvider visibilityProvider, NotificationInterruptStateProvider interruptionStateProvider, ZenModeController zenModeController, Loading @@ -230,6 +232,7 @@ public abstract class SystemUIModule { shadeController, statusBarService, notificationManager, dreamManager, visibilityProvider, interruptionStateProvider, zenModeController, Loading packages/SystemUI/src/com/android/systemui/wmshell/BubblesManager.java +16 −1 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.os.UserHandle; import android.provider.Settings; import android.service.dreams.IDreamManager; import android.service.notification.NotificationListenerService.RankingMap; import android.service.notification.ZenModeConfig; import android.util.Log; Loading Loading @@ -101,6 +102,7 @@ public class BubblesManager implements Dumpable { private final ShadeController mShadeController; private final IStatusBarService mBarService; private final INotificationManager mNotificationManager; private final IDreamManager mDreamManager; private final NotificationVisibilityProvider mVisibilityProvider; private final NotificationInterruptStateProvider mNotificationInterruptStateProvider; private final NotificationLockscreenUserManager mNotifUserManager; Loading @@ -126,6 +128,7 @@ public class BubblesManager implements Dumpable { ShadeController shadeController, @Nullable IStatusBarService statusBarService, INotificationManager notificationManager, IDreamManager dreamManager, NotificationVisibilityProvider visibilityProvider, NotificationInterruptStateProvider interruptionStateProvider, ZenModeController zenModeController, Loading @@ -144,6 +147,7 @@ public class BubblesManager implements Dumpable { shadeController, statusBarService, notificationManager, dreamManager, visibilityProvider, interruptionStateProvider, zenModeController, Loading @@ -167,6 +171,7 @@ public class BubblesManager implements Dumpable { ShadeController shadeController, @Nullable IStatusBarService statusBarService, INotificationManager notificationManager, IDreamManager dreamManager, NotificationVisibilityProvider visibilityProvider, NotificationInterruptStateProvider interruptionStateProvider, ZenModeController zenModeController, Loading @@ -182,6 +187,7 @@ public class BubblesManager implements Dumpable { mNotificationShadeWindowController = notificationShadeWindowController; mShadeController = shadeController; mNotificationManager = notificationManager; mDreamManager = dreamManager; mVisibilityProvider = visibilityProvider; mNotificationInterruptStateProvider = interruptionStateProvider; mNotifUserManager = notifUserManager; Loading @@ -203,7 +209,7 @@ public class BubblesManager implements Dumpable { @Override public void onKeyguardShowingChanged() { boolean isUnlockedShade = !keyguardStateController.isShowing() && !keyguardStateController.isOccluded(); && !isDreamingOrInPreview(); bubbles.onStatusBarStateChanged(isUnlockedShade); } }); Loading Loading @@ -397,6 +403,15 @@ public class BubblesManager implements Dumpable { mBubbles.setSysuiProxy(mSysuiProxy); } private boolean isDreamingOrInPreview() { try { return mDreamManager.isDreamingOrInPreview(); } catch (RemoteException e) { Log.e(TAG, "Failed to query dream manager.", e); return false; } } private void setupNotifPipeline() { mNotifPipeline.addCollectionListener(new NotifCollectionListener() { @Override Loading packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java +26 −1 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ import android.graphics.drawable.Icon; import android.hardware.display.AmbientDisplayConfiguration; import android.os.Handler; import android.os.PowerManager; import android.os.RemoteException; import android.os.UserHandle; import android.os.UserManager; import android.service.dreams.IDreamManager; Loading Loading @@ -204,6 +205,8 @@ public class BubblesTest extends SysuiTestCase { private ArgumentCaptor<IntentFilter> mFilterArgumentCaptor; @Captor private ArgumentCaptor<BroadcastReceiver> mBroadcastReceiverArgumentCaptor; @Captor private ArgumentCaptor<KeyguardStateController.Callback> mKeyguardStateControllerCallbackCaptor; private BubblesManager mBubblesManager; private TestableBubbleController mBubbleController; Loading Loading @@ -240,6 +243,8 @@ public class BubblesTest extends SysuiTestCase { @Mock private IStatusBarService mStatusBarService; @Mock private IDreamManager mIDreamManager; @Mock private NotificationVisibilityProvider mVisibilityProvider; @Mock private LauncherApps mLauncherApps; Loading Loading @@ -371,10 +376,11 @@ public class BubblesTest extends SysuiTestCase { mContext, mBubbleController.asBubbles(), mNotificationShadeWindowController, mock(KeyguardStateController.class), mKeyguardStateController, mShadeController, mStatusBarService, mock(INotificationManager.class), mIDreamManager, mVisibilityProvider, interruptionStateProvider, mZenModeController, Loading @@ -391,6 +397,25 @@ public class BubblesTest extends SysuiTestCase { verify(mNotifPipeline, atLeastOnce()) .addCollectionListener(mNotifListenerCaptor.capture()); mEntryListener = mNotifListenerCaptor.getValue(); // Get a reference to KeyguardStateController.Callback verify(mKeyguardStateController, atLeastOnce()) .addCallback(mKeyguardStateControllerCallbackCaptor.capture()); } @Test public void dreamingHidesBubbles() throws RemoteException { mBubbleController.updateBubble(mBubbleEntry); assertTrue(mBubbleController.hasBubbles()); assertThat(mBubbleController.getStackView().getVisibility()).isEqualTo(View.VISIBLE); when(mIDreamManager.isDreamingOrInPreview()).thenReturn(true); // dreaming is happening when(mKeyguardStateController.isShowing()).thenReturn(false); // device is unlocked KeyguardStateController.Callback callback = mKeyguardStateControllerCallbackCaptor.getValue(); callback.onKeyguardShowingChanged(); assertThat(mBubbleController.getStackView().getVisibility()).isEqualTo(View.INVISIBLE); } @Test Loading Loading
packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java +3 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.dagger; import android.app.INotificationManager; import android.content.Context; import android.service.dreams.IDreamManager; import androidx.annotation.Nullable; Loading Loading @@ -213,6 +214,7 @@ public abstract class SystemUIModule { ShadeController shadeController, @Nullable IStatusBarService statusBarService, INotificationManager notificationManager, IDreamManager dreamManager, NotificationVisibilityProvider visibilityProvider, NotificationInterruptStateProvider interruptionStateProvider, ZenModeController zenModeController, Loading @@ -230,6 +232,7 @@ public abstract class SystemUIModule { shadeController, statusBarService, notificationManager, dreamManager, visibilityProvider, interruptionStateProvider, zenModeController, Loading
packages/SystemUI/src/com/android/systemui/wmshell/BubblesManager.java +16 −1 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.os.UserHandle; import android.provider.Settings; import android.service.dreams.IDreamManager; import android.service.notification.NotificationListenerService.RankingMap; import android.service.notification.ZenModeConfig; import android.util.Log; Loading Loading @@ -101,6 +102,7 @@ public class BubblesManager implements Dumpable { private final ShadeController mShadeController; private final IStatusBarService mBarService; private final INotificationManager mNotificationManager; private final IDreamManager mDreamManager; private final NotificationVisibilityProvider mVisibilityProvider; private final NotificationInterruptStateProvider mNotificationInterruptStateProvider; private final NotificationLockscreenUserManager mNotifUserManager; Loading @@ -126,6 +128,7 @@ public class BubblesManager implements Dumpable { ShadeController shadeController, @Nullable IStatusBarService statusBarService, INotificationManager notificationManager, IDreamManager dreamManager, NotificationVisibilityProvider visibilityProvider, NotificationInterruptStateProvider interruptionStateProvider, ZenModeController zenModeController, Loading @@ -144,6 +147,7 @@ public class BubblesManager implements Dumpable { shadeController, statusBarService, notificationManager, dreamManager, visibilityProvider, interruptionStateProvider, zenModeController, Loading @@ -167,6 +171,7 @@ public class BubblesManager implements Dumpable { ShadeController shadeController, @Nullable IStatusBarService statusBarService, INotificationManager notificationManager, IDreamManager dreamManager, NotificationVisibilityProvider visibilityProvider, NotificationInterruptStateProvider interruptionStateProvider, ZenModeController zenModeController, Loading @@ -182,6 +187,7 @@ public class BubblesManager implements Dumpable { mNotificationShadeWindowController = notificationShadeWindowController; mShadeController = shadeController; mNotificationManager = notificationManager; mDreamManager = dreamManager; mVisibilityProvider = visibilityProvider; mNotificationInterruptStateProvider = interruptionStateProvider; mNotifUserManager = notifUserManager; Loading @@ -203,7 +209,7 @@ public class BubblesManager implements Dumpable { @Override public void onKeyguardShowingChanged() { boolean isUnlockedShade = !keyguardStateController.isShowing() && !keyguardStateController.isOccluded(); && !isDreamingOrInPreview(); bubbles.onStatusBarStateChanged(isUnlockedShade); } }); Loading Loading @@ -397,6 +403,15 @@ public class BubblesManager implements Dumpable { mBubbles.setSysuiProxy(mSysuiProxy); } private boolean isDreamingOrInPreview() { try { return mDreamManager.isDreamingOrInPreview(); } catch (RemoteException e) { Log.e(TAG, "Failed to query dream manager.", e); return false; } } private void setupNotifPipeline() { mNotifPipeline.addCollectionListener(new NotifCollectionListener() { @Override Loading
packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java +26 −1 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ import android.graphics.drawable.Icon; import android.hardware.display.AmbientDisplayConfiguration; import android.os.Handler; import android.os.PowerManager; import android.os.RemoteException; import android.os.UserHandle; import android.os.UserManager; import android.service.dreams.IDreamManager; Loading Loading @@ -204,6 +205,8 @@ public class BubblesTest extends SysuiTestCase { private ArgumentCaptor<IntentFilter> mFilterArgumentCaptor; @Captor private ArgumentCaptor<BroadcastReceiver> mBroadcastReceiverArgumentCaptor; @Captor private ArgumentCaptor<KeyguardStateController.Callback> mKeyguardStateControllerCallbackCaptor; private BubblesManager mBubblesManager; private TestableBubbleController mBubbleController; Loading Loading @@ -240,6 +243,8 @@ public class BubblesTest extends SysuiTestCase { @Mock private IStatusBarService mStatusBarService; @Mock private IDreamManager mIDreamManager; @Mock private NotificationVisibilityProvider mVisibilityProvider; @Mock private LauncherApps mLauncherApps; Loading Loading @@ -371,10 +376,11 @@ public class BubblesTest extends SysuiTestCase { mContext, mBubbleController.asBubbles(), mNotificationShadeWindowController, mock(KeyguardStateController.class), mKeyguardStateController, mShadeController, mStatusBarService, mock(INotificationManager.class), mIDreamManager, mVisibilityProvider, interruptionStateProvider, mZenModeController, Loading @@ -391,6 +397,25 @@ public class BubblesTest extends SysuiTestCase { verify(mNotifPipeline, atLeastOnce()) .addCollectionListener(mNotifListenerCaptor.capture()); mEntryListener = mNotifListenerCaptor.getValue(); // Get a reference to KeyguardStateController.Callback verify(mKeyguardStateController, atLeastOnce()) .addCallback(mKeyguardStateControllerCallbackCaptor.capture()); } @Test public void dreamingHidesBubbles() throws RemoteException { mBubbleController.updateBubble(mBubbleEntry); assertTrue(mBubbleController.hasBubbles()); assertThat(mBubbleController.getStackView().getVisibility()).isEqualTo(View.VISIBLE); when(mIDreamManager.isDreamingOrInPreview()).thenReturn(true); // dreaming is happening when(mKeyguardStateController.isShowing()).thenReturn(false); // device is unlocked KeyguardStateController.Callback callback = mKeyguardStateControllerCallbackCaptor.getValue(); callback.onKeyguardShowingChanged(); assertThat(mBubbleController.getStackView().getVisibility()).isEqualTo(View.INVISIBLE); } @Test Loading