Merge "Fix bubbles hiding when unlocked with showOnLockscreen Activity" into tm-qpr-dev

This commit is contained in:
Mady Mellor
2022-08-22 23:33:33 +00:00
committed by Android (Google) Code Review
3 changed files with 45 additions and 2 deletions

View File

@@ -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;
@@ -213,6 +214,7 @@ public abstract class SystemUIModule {
ShadeController shadeController,
@Nullable IStatusBarService statusBarService,
INotificationManager notificationManager,
IDreamManager dreamManager,
NotificationVisibilityProvider visibilityProvider,
NotificationInterruptStateProvider interruptionStateProvider,
ZenModeController zenModeController,
@@ -230,6 +232,7 @@ public abstract class SystemUIModule {
shadeController,
statusBarService,
notificationManager,
dreamManager,
visibilityProvider,
interruptionStateProvider,
zenModeController,

View File

@@ -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;
@@ -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;
@@ -126,6 +128,7 @@ public class BubblesManager implements Dumpable {
ShadeController shadeController,
@Nullable IStatusBarService statusBarService,
INotificationManager notificationManager,
IDreamManager dreamManager,
NotificationVisibilityProvider visibilityProvider,
NotificationInterruptStateProvider interruptionStateProvider,
ZenModeController zenModeController,
@@ -144,6 +147,7 @@ public class BubblesManager implements Dumpable {
shadeController,
statusBarService,
notificationManager,
dreamManager,
visibilityProvider,
interruptionStateProvider,
zenModeController,
@@ -167,6 +171,7 @@ public class BubblesManager implements Dumpable {
ShadeController shadeController,
@Nullable IStatusBarService statusBarService,
INotificationManager notificationManager,
IDreamManager dreamManager,
NotificationVisibilityProvider visibilityProvider,
NotificationInterruptStateProvider interruptionStateProvider,
ZenModeController zenModeController,
@@ -182,6 +187,7 @@ public class BubblesManager implements Dumpable {
mNotificationShadeWindowController = notificationShadeWindowController;
mShadeController = shadeController;
mNotificationManager = notificationManager;
mDreamManager = dreamManager;
mVisibilityProvider = visibilityProvider;
mNotificationInterruptStateProvider = interruptionStateProvider;
mNotifUserManager = notifUserManager;
@@ -203,7 +209,7 @@ public class BubblesManager implements Dumpable {
@Override
public void onKeyguardShowingChanged() {
boolean isUnlockedShade = !keyguardStateController.isShowing()
&& !keyguardStateController.isOccluded();
&& !isDreamingOrInPreview();
bubbles.onStatusBarStateChanged(isUnlockedShade);
}
});
@@ -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

View File

@@ -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;
@@ -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;
@@ -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;
@@ -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,
@@ -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