Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 29d4f59b authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Add bundle dismissal reason

Test: NotificationManagerServiceTest
Test: NotifCollectionTest
Test: view event log after swiping away a bundle
Flag: android.app.notification_classification_ui
Flag: android.service.notification.nm_classification_nls
Fixes: 416144530
Change-Id: Idc8e64f3b83febb70c4fc6c88252a31be1dd033a
parent 407e873e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -42461,6 +42461,7 @@ package android.service.notification {
    field public static final int REASON_APP_CANCEL = 8; // 0x8
    field public static final int REASON_APP_CANCEL_ALL = 9; // 0x9
    field public static final int REASON_ASSISTANT_CANCEL = 22; // 0x16
    field @FlaggedApi("android.service.notification.nm_classification_nls") public static final int REASON_BUNDLE_DISMISSED = 24; // 0x18
    field public static final int REASON_CANCEL = 2; // 0x2
    field public static final int REASON_CANCEL_ALL = 3; // 0x3
    field public static final int REASON_CHANNEL_BANNED = 17; // 0x11
+7 −0
Original line number Diff line number Diff line
@@ -283,6 +283,12 @@ public abstract class NotificationListenerService extends Service {
     * will be restored via NotificationListeners#notifyPostedLocked()
     */
    public static final int REASON_LOCKDOWN = 23;
    @FlaggedApi(Flags.FLAG_NM_CLASSIFICATION_NLS)
    /**
     * Notification was canceled because it was in a bundle
     * (e.g. @link android.app.NotificationChannel#PROMOTIONS_ID) that was dismissed.
     */
    public static final int REASON_BUNDLE_DISMISSED = 24;
    // If adding a new notification cancellation reason, you must also add handling for it in
    // NotificationCancelledEvent.fromCancelReason.

@@ -313,6 +319,7 @@ public abstract class NotificationListenerService extends Service {
            REASON_CLEAR_DATA,
            REASON_ASSISTANT_CANCEL,
            REASON_LOCKDOWN,
            REASON_BUNDLE_DISMISSED
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface NotificationCancelReason{};
+9 −0
Original line number Diff line number Diff line
@@ -89,8 +89,17 @@ flag {
  bug: "387528442"
}

# Start: API flags

flag {
  name: "nm_classification_nls"
  namespace: "systemui"
  description: "New api for notification_classification_ui"
  bug: "416144530"
  is_exported: true
}

# End: API flags

# Start: Flags that have been cleaned up in code but need to remain for CTS

+1 −1
Original line number Diff line number Diff line
@@ -92,7 +92,7 @@ interface IStatusBarService
            int uid, int initialPid, String message, int userId);
    void onClearAllNotifications(int userId);
    void onNotificationClear(String pkg, int userId, String key,
            int dismissalSurface, int dismissalSentiment, in NotificationVisibility nv);
            int dismissalSurface, int dismissalSentiment, in NotificationVisibility nv, boolean fromBundle);
    void onNotificationVisibilityChanged( in NotificationVisibility[] newlyVisibleKeys,
            in NotificationVisibility[] noLongerVisibleKeys);
    void onNotificationExpansionChanged(in String key, in boolean userAction, in boolean expanded, in int notificationLocation);
+7 −6
Original line number Diff line number Diff line
@@ -161,7 +161,7 @@ public class LaunchConversationActivityTest extends SysuiTestCase {
        mActivity.onCreate(new Bundle());

        verify(mIStatusBarService, never()).onNotificationClear(
                any(), anyInt(), any(), anyInt(), anyInt(), any());
                any(), anyInt(), any(), anyInt(), anyInt(), any(), anyBoolean());
    }

    @Test
@@ -172,7 +172,7 @@ public class LaunchConversationActivityTest extends SysuiTestCase {
        mActivity.onCreate(new Bundle());

        verify(mIStatusBarService, never()).onNotificationClear(
                any(), anyInt(), any(), anyInt(), anyInt(), any());
                any(), anyInt(), any(), anyInt(), anyInt(), any(), anyBoolean());
    }

    @Test
@@ -183,7 +183,7 @@ public class LaunchConversationActivityTest extends SysuiTestCase {
        mActivity.onCreate(new Bundle());

        verify(mIStatusBarService, never()).onNotificationClear(
                any(), anyInt(), any(), anyInt(), anyInt(), any());
                any(), anyInt(), any(), anyInt(), anyInt(), any(), anyBoolean());
    }

    @Test
@@ -201,7 +201,8 @@ public class LaunchConversationActivityTest extends SysuiTestCase {
        // Clear the notification for bubbles.
        FakeExecutor.exhaustExecutors(mBgExecutor);
        verify(mIStatusBarService, times(1)).onNotificationClear(any(),
                anyInt(), any(), anyInt(), anyInt(), mNotificationVisibilityCaptor.capture());
                anyInt(), any(), anyInt(), anyInt(), mNotificationVisibilityCaptor.capture(),
                anyBoolean());
        // Do not select the bubble.
        verify(mBubblesManager, never()).expandStackAndSelectBubble(any(Bubble.class));
        verify(mBubblesManager, never()).expandStackAndSelectBubble(any(NotificationEntry.class));
@@ -226,7 +227,7 @@ public class LaunchConversationActivityTest extends SysuiTestCase {
        verify(mCommandQueue).removeCallback(any());
        // Don't clear the notification for bubbles.
        verify(mIStatusBarService, never()).onNotificationClear(any(),
                anyInt(), any(), anyInt(), anyInt(), any());
                anyInt(), any(), anyInt(), anyInt(), any(), anyBoolean());
        // Select the bubble.
        verify(mBubblesManager, times(1)).getBubbleWithShortcutId(any());
        verify(mBubblesManager, times(1)).expandStackAndSelectBubble(eq(mNotifEntryCanBubble));
@@ -247,7 +248,7 @@ public class LaunchConversationActivityTest extends SysuiTestCase {
        verify(mCommandQueue).removeCallback(any());
        // Don't clear the notification for bubbles.
        verify(mIStatusBarService, never()).onNotificationClear(any(),
                anyInt(), any(), anyInt(), anyInt(), any());
                anyInt(), any(), anyInt(), anyInt(), any(), anyBoolean());
        // Do not select the bubble.
        verify(mBubblesManager, never()).expandStackAndSelectBubble(any(Bubble.class));
        verify(mBubblesManager, never()).expandStackAndSelectBubble(any(NotificationEntry.class));
Loading