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

Commit 2e78e35f authored by Ibrahim Yilmaz's avatar Ibrahim Yilmaz
Browse files

Ensure promoted value NOT depend on default value

canBePromoted default value is true. This CL ensures that tested promoted value does NOT depend on the default value.

Bug: 367705002
Flag: android.app.ui_rich_ongoing
Test: Presubmit
Change-Id: I824bd437d3a3be5e1d441eaab62f8ca77d155a96
parent ab4eafb6
Loading
Loading
Loading
Loading
+34 −3
Original line number Diff line number Diff line
@@ -17641,8 +17641,19 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
    }
    @Test
    @EnableFlags(android.app.Flags.FLAG_API_RICH_ONGOING)
    public void testSetCanBePromoted_granted() throws Exception {
    @EnableFlags({android.app.Flags.FLAG_API_RICH_ONGOING})
    public void testSetCanBePromoted_granted_noui() throws Exception {
        testSetCanBePromoted_granted();
    }
    @Test
    @EnableFlags({android.app.Flags.FLAG_API_RICH_ONGOING,
            android.app.Flags.FLAG_UI_RICH_ONGOING })
    public void testSetCanBePromoted_granted_ui() throws Exception {
        testSetCanBePromoted_granted();
    }
    private void testSetCanBePromoted_granted() throws Exception {
        // qualifying posted notification
        Notification n = new Notification.Builder(mContext, mTestNotificationChannel.getId())
                .setSmallIcon(android.R.drawable.sym_def_app_icon)
@@ -17697,6 +17708,11 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
        mService.addNotification(r);
        mService.addEnqueuedNotification(r1);
        // GIVEN - make sure the promoted value does not depend on the default value.
        mBinderService.setCanBePromoted(mPkg, mUid, false, true);
        waitForIdle();
        clearInvocations(mListeners);
        mBinderService.setCanBePromoted(mPkg, mUid, true, true);
        waitForIdle();
@@ -17719,7 +17735,18 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
    @Test
    @EnableFlags(android.app.Flags.FLAG_API_RICH_ONGOING)
    public void testSetCanBePromoted_granted_onlyNotifiesOnce() throws Exception {
    public void testSetCanBePromoted_granted_onlyNotifiesOnce_noui() throws Exception {
        testSetCanBePromoted_granted_onlyNotifiesOnce();
    }
    @Test
    @EnableFlags({android.app.Flags.FLAG_API_RICH_ONGOING,
            android.app.Flags.FLAG_UI_RICH_ONGOING})
    public void testSetCanBePromoted_granted_onlyNotifiesOnce_ui() throws Exception {
        testSetCanBePromoted_granted_onlyNotifiesOnce();
    }
    private void testSetCanBePromoted_granted_onlyNotifiesOnce() throws Exception {
        // qualifying posted notification
        Notification n = new Notification.Builder(mContext, mTestNotificationChannel.getId())
                .setSmallIcon(android.R.drawable.sym_def_app_icon)
@@ -17735,6 +17762,10 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
        NotificationRecord r = new NotificationRecord(mContext, sbn, mTestNotificationChannel);
        mService.addNotification(r);
        // GIVEN - make sure the promoted value does not depend on the default value.
        mBinderService.setCanBePromoted(mPkg, mUid, false, true);
        waitForIdle();
        clearInvocations(mListeners);
        mBinderService.setCanBePromoted(mPkg, mUid, true, true);
        waitForIdle();