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

Commit 3797fd2b authored by Julia Reynolds's avatar Julia Reynolds Committed by android-build-merger
Browse files

Merge "Reduce unnecessary NotificationListener binder transaction." am: d3ec7950

am: c3918379

Change-Id: I3270a2dcc3a41a46c74bfbb4e636da1264b6c5cd
parents b43f746c c3918379
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -1274,17 +1274,16 @@ public class NotificationManagerService extends SystemService {
                    uidList = new int[] {intent.getIntExtra(Intent.EXTRA_UID, -1)};
                }
                if (pkgList != null && (pkgList.length > 0)) {
                    for (String pkgName : pkgList) {
                    if (cancelNotifications) {
                        for (String pkgName : pkgList) {
                            cancelAllNotificationsInt(MY_UID, MY_PID, pkgName, null, 0, 0,
                                    !queryRestart, changeUserId, reason, null);
                        }
                    } else if (hideNotifications) {
                        hideNotificationsForPackages(pkgList);
                    } else if (unhideNotifications) {
                        unhideNotificationsForPackages(pkgList);
                    }

                    }
                }

                mHandler.scheduleOnPackageChanged(removingPackage, changeUserId, pkgList, uidList);
+6 −2
Original line number Diff line number Diff line
@@ -3601,7 +3601,9 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
        mService.simulatePackageDistractionBroadcast(
                PackageManager.RESTRICTION_HIDE_NOTIFICATIONS, new String[] {"a", "b"});
        ArgumentCaptor<List<NotificationRecord>> captorHide = ArgumentCaptor.forClass(List.class);
        verify(mListeners, times(2)).notifyHiddenLocked(captorHide.capture());

        // should be called only once.
        verify(mListeners, times(1)).notifyHiddenLocked(captorHide.capture());
        assertEquals(2, captorHide.getValue().size());
        assertEquals("a", captorHide.getValue().get(0).sbn.getPackageName());
        assertEquals("b", captorHide.getValue().get(1).sbn.getPackageName());
@@ -3610,7 +3612,9 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
        mService.simulatePackageDistractionBroadcast(
                PackageManager.RESTRICTION_HIDE_FROM_SUGGESTIONS, new String[] {"a", "b"});
        ArgumentCaptor<List<NotificationRecord>> captorUnhide = ArgumentCaptor.forClass(List.class);
        verify(mListeners, times(2)).notifyUnhiddenLocked(captorUnhide.capture());

        // should be called only once.
        verify(mListeners, times(1)).notifyUnhiddenLocked(captorUnhide.capture());
        assertEquals(2, captorUnhide.getValue().size());
        assertEquals("a", captorUnhide.getValue().get(0).sbn.getPackageName());
        assertEquals("b", captorUnhide.getValue().get(1).sbn.getPackageName());