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

Commit b82bcd4e authored by Julia Reynolds's avatar Julia Reynolds Committed by Android (Google) Code Review
Browse files

Merge "Allow apps to minimize/block* pre-O apps that use FGSes" into udc-dev

parents 8fd7f194 2f637041
Loading
Loading
Loading
Loading
+9 −14
Original line number Diff line number Diff line
@@ -6625,10 +6625,6 @@ public class NotificationManagerService extends SystemService {
                            || r.getImportance() == IMPORTANCE_NONE)) {
                // Increase the importance of foreground service notifications unless the user had
                // an opinion otherwise (and the channel hasn't yet shown a fg service).
                if (TextUtils.isEmpty(channelId)
                        || NotificationChannel.DEFAULT_CHANNEL_ID.equals(channelId)) {
                    r.setSystemImportance(IMPORTANCE_LOW);
                } else {
                channel.setImportance(IMPORTANCE_LOW);
                r.setSystemImportance(IMPORTANCE_LOW);
                if (!fgServiceShown) {
@@ -6638,7 +6634,6 @@ public class NotificationManagerService extends SystemService {
                mPreferencesHelper.updateNotificationChannel(
                        pkg, notificationUid, channel, false);
                r.updateNotificationChannel(channel);
                }
            } else if (!fgServiceShown && !TextUtils.isEmpty(channelId)
                    && !NotificationChannel.DEFAULT_CHANNEL_ID.equals(channelId)) {
                channel.setFgServiceShown(true);
+5 −5
Original line number Diff line number Diff line
@@ -4734,7 +4734,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
    }

    @Test
    public void testBumpFGImportance_noChannelChangePreOApp() throws Exception {
    public void testBumpFGImportance_channelChangePreOApp() throws Exception {
        String preOPkg = PKG_N_MR1;
        final ApplicationInfo legacy = new ApplicationInfo();
        legacy.targetSdkVersion = Build.VERSION_CODES.N_MR1;
@@ -4752,7 +4752,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
                .setPriority(Notification.PRIORITY_MIN);

        StatusBarNotification sbn = new StatusBarNotification(preOPkg, preOPkg, 9,
                "testBumpFGImportance_noChannelChangePreOApp",
                "testBumpFGImportance_channelChangePreOApp",
                Binder.getCallingUid(), 0, nb.build(),
                UserHandle.getUserHandleForUid(Binder.getCallingUid()), null, 0);

@@ -4772,11 +4772,11 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
                .setPriority(Notification.PRIORITY_MIN);

        sbn = new StatusBarNotification(preOPkg, preOPkg, 9,
                "testBumpFGImportance_noChannelChangePreOApp", Binder.getCallingUid(),
                "testBumpFGImportance_channelChangePreOApp", Binder.getCallingUid(),
                0, nb.build(), UserHandle.getUserHandleForUid(Binder.getCallingUid()), null, 0);

        mBinderService.enqueueNotificationWithTag(preOPkg, preOPkg,
                "testBumpFGImportance_noChannelChangePreOApp",
                "testBumpFGImportance_channelChangePreOApp",
                sbn.getId(), sbn.getNotification(), sbn.getUserId());
        waitForIdle();
        assertEquals(IMPORTANCE_LOW,
@@ -4784,7 +4784,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {

        NotificationChannel defaultChannel = mBinderService.getNotificationChannel(
                preOPkg, mContext.getUserId(), preOPkg, NotificationChannel.DEFAULT_CHANNEL_ID);
        assertEquals(IMPORTANCE_UNSPECIFIED, defaultChannel.getImportance());
        assertEquals(IMPORTANCE_LOW, defaultChannel.getImportance());
    }

    @Test