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

Commit b1fa965b authored by Gaurav Gupta's avatar Gaurav Gupta
Browse files

Fix an edge case with notification clearing AppOp tests where the

notification freshness value overflows and goes negative

Bug: 289080543
Test: Ran tests locally, they are now passing
Change-Id: Ib82fe15b465dabcc4f338d8879b19a8f7d93a80c
parent be1761a0
Loading
Loading
Loading
Loading
+16 −15
Original line number Diff line number Diff line
@@ -303,7 +303,6 @@ import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestRule;
@@ -14061,7 +14060,6 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
    }
    @Test
    @Ignore("b/316989461")
    public void cancelNotificationsFromListener_rapidClear_oldNew_cancelOne()
            throws RemoteException {
        mSetFlagsRule.enableFlags(android.view.contentprotection.flags.Flags
@@ -14073,7 +14071,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
        mService.addNotification(nr1);
        // Create old notification.
        final NotificationRecord nr2 = generateNotificationRecord(mTestNotificationChannel, 0);
        final NotificationRecord nr2 = generateNotificationRecord(mTestNotificationChannel,
                System.currentTimeMillis() - 60000);
        mService.addNotification(nr2);
        // Cancel specific notifications via listener.
@@ -14091,16 +14090,17 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
    }
    @Test
    @Ignore("b/316989461")
    public void cancelNotificationsFromListener_rapidClear_old_cancelOne() throws RemoteException {
        mSetFlagsRule.enableFlags(android.view.contentprotection.flags.Flags
                .FLAG_RAPID_CLEAR_NOTIFICATIONS_BY_LISTENER_APP_OP_ENABLED);
        // Create old notifications.
        final NotificationRecord nr1 = generateNotificationRecord(mTestNotificationChannel, 0);
        final NotificationRecord nr1 = generateNotificationRecord(mTestNotificationChannel,
                System.currentTimeMillis() - 60000);
        mService.addNotification(nr1);
        final NotificationRecord nr2 = generateNotificationRecord(mTestNotificationChannel, 0);
        final NotificationRecord nr2 = generateNotificationRecord(mTestNotificationChannel,
                System.currentTimeMillis() - 60000);
        mService.addNotification(nr2);
        // Cancel specific notifications via listener.
@@ -14119,7 +14119,6 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
    }
    @Test
    @Ignore("b/316989461")
    public void cancelNotificationsFromListener_rapidClear_oldNew_cancelOne_flagDisabled()
            throws RemoteException {
        mSetFlagsRule.disableFlags(android.view.contentprotection.flags.Flags
@@ -14131,7 +14130,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
        mService.addNotification(nr1);
        // Create old notification.
        final NotificationRecord nr2 = generateNotificationRecord(mTestNotificationChannel, 0);
        final NotificationRecord nr2 = generateNotificationRecord(mTestNotificationChannel,
                System.currentTimeMillis() - 60000);
        mService.addNotification(nr2);
        // Cancel specific notifications via listener.
@@ -14150,7 +14150,6 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
    }
    @Test
    @Ignore("b/316989461")
    public void cancelNotificationsFromListener_rapidClear_oldNew_cancelAll()
            throws RemoteException {
        mSetFlagsRule.enableFlags(android.view.contentprotection.flags.Flags
@@ -14162,7 +14161,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
        mService.addNotification(nr1);
        // Create old notification.
        final NotificationRecord nr2 = generateNotificationRecord(mTestNotificationChannel, 0);
        final NotificationRecord nr2 = generateNotificationRecord(mTestNotificationChannel,
                System.currentTimeMillis() - 60000);
        mService.addNotification(nr2);
        // Cancel all notifications via listener.
@@ -14179,16 +14179,17 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
    }
    @Test
    @Ignore("b/316989461")
    public void cancelNotificationsFromListener_rapidClear_old_cancelAll() throws RemoteException {
        mSetFlagsRule.enableFlags(android.view.contentprotection.flags.Flags
                .FLAG_RAPID_CLEAR_NOTIFICATIONS_BY_LISTENER_APP_OP_ENABLED);
        // Create old notifications.
        final NotificationRecord nr1 = generateNotificationRecord(mTestNotificationChannel, 0);
        final NotificationRecord nr1 = generateNotificationRecord(mTestNotificationChannel,
                System.currentTimeMillis() - 60000);
        mService.addNotification(nr1);
        final NotificationRecord nr2 = generateNotificationRecord(mTestNotificationChannel, 0);
        final NotificationRecord nr2 = generateNotificationRecord(mTestNotificationChannel,
                System.currentTimeMillis() - 60000);
        mService.addNotification(nr2);
        // Cancel all notifications via listener.
@@ -14206,7 +14207,6 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
    }
    @Test
    @Ignore("b/316989461")
    public void cancelNotificationsFromListener_rapidClear_oldNew_cancelAll_flagDisabled()
            throws RemoteException {
        mSetFlagsRule.disableFlags(android.view.contentprotection.flags.Flags
@@ -14218,7 +14218,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
        mService.addNotification(nr1);
        // Create old notification.
        final NotificationRecord nr2 = generateNotificationRecord(mTestNotificationChannel, 0);
        final NotificationRecord nr2 = generateNotificationRecord(mTestNotificationChannel,
                System.currentTimeMillis() - 60000);
        mService.addNotification(nr2);
        // Cancel all notifications via listener.