[RESTRICT AUTOMERGE] Add BubbleMetadata detection to block FSI
Bug: 274759612 Test: atest NotificationInterruptStateProviderImplTest Change-Id: I40e1aa6377b8a60d91cb2f4189df1e9a4a4578a2
This commit is contained in:
@@ -18,6 +18,7 @@ package com.android.systemui.statusbar.notification.interruption;
|
|||||||
|
|
||||||
import static com.android.systemui.statusbar.StatusBarState.SHADE;
|
import static com.android.systemui.statusbar.StatusBarState.SHADE;
|
||||||
|
|
||||||
|
import android.app.Notification;
|
||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.database.ContentObserver;
|
import android.database.ContentObserver;
|
||||||
@@ -209,6 +210,20 @@ public class NotificationInterruptStateProviderImpl implements NotificationInter
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the notification has suppressive BubbleMetadata, block FSI and warn.
|
||||||
|
Notification.BubbleMetadata bubbleMetadata = sbn.getNotification().getBubbleMetadata();
|
||||||
|
if (bubbleMetadata != null && bubbleMetadata.isNotificationSuppressed()) {
|
||||||
|
// b/274759612: Detect and report an event when a notification has both an FSI and a
|
||||||
|
// suppressive BubbleMetadata, and now correctly block the FSI from firing.
|
||||||
|
final int uid = entry.getSbn().getUid();
|
||||||
|
android.util.EventLog.writeEvent(0x534e4554, "274759612", uid, "bubbleMetadata");
|
||||||
|
if (DEBUG) {
|
||||||
|
Log.w(TAG, "No FullScreenIntent: WARNING: BubbleMetadata may prevent HUN: "
|
||||||
|
+ entry.getKey());
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// If the screen is off, then launch the FullScreenIntent
|
// If the screen is off, then launch the FullScreenIntent
|
||||||
if (!mPowerManager.isInteractive()) {
|
if (!mPowerManager.isInteractive()) {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
|
|||||||
@@ -435,9 +435,27 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase {
|
|||||||
.isFalse();
|
.isFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testShouldNotFullScreen_isSuppressedByBubbleMetadata() throws RemoteException {
|
||||||
|
NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false);
|
||||||
|
Notification.BubbleMetadata bubbleMetadata = new Notification.BubbleMetadata.Builder("foo")
|
||||||
|
.setSuppressNotification(true).build();
|
||||||
|
entry.getSbn().getNotification().setBubbleMetadata(bubbleMetadata);
|
||||||
|
when(mPowerManager.isInteractive()).thenReturn(false);
|
||||||
|
when(mDreamManager.isDreaming()).thenReturn(true);
|
||||||
|
when(mStatusBarStateController.getState()).thenReturn(KEYGUARD);
|
||||||
|
|
||||||
|
assertThat(mNotifInterruptionStateProvider.shouldLaunchFullScreenIntentWhenAdded(entry))
|
||||||
|
.isFalse();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testShouldFullScreen_notInteractive() throws RemoteException {
|
public void testShouldFullScreen_notInteractive() throws RemoteException {
|
||||||
NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false);
|
NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false);
|
||||||
|
Notification.BubbleMetadata bubbleMetadata = new Notification.BubbleMetadata.Builder("foo")
|
||||||
|
.setSuppressNotification(false).build();
|
||||||
|
entry.getSbn().getNotification().setBubbleMetadata(bubbleMetadata);
|
||||||
when(mPowerManager.isInteractive()).thenReturn(false);
|
when(mPowerManager.isInteractive()).thenReturn(false);
|
||||||
when(mDreamManager.isDreaming()).thenReturn(false);
|
when(mDreamManager.isDreaming()).thenReturn(false);
|
||||||
when(mStatusBarStateController.getState()).thenReturn(SHADE);
|
when(mStatusBarStateController.getState()).thenReturn(SHADE);
|
||||||
|
|||||||
Reference in New Issue
Block a user