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

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

Merge "Notifs need small icons to be in the notif history" into sc-dev

parents a9f72d30 7ed5b586
Loading
Loading
Loading
Loading
+15 −12
Original line number Original line Diff line number Diff line
@@ -3023,6 +3023,7 @@ public class NotificationManagerService extends SystemService {
                    getRealUserId(r.getSbn().getUserId()));
                    getRealUserId(r.getSbn().getUserId()));
            Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "notifHistoryAddItem");
            Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "notifHistoryAddItem");
            try {
            try {
                if (r.getNotification().getSmallIcon() != null) {
                    mHistoryManager.addNotification(new HistoricalNotification.Builder()
                    mHistoryManager.addNotification(new HistoricalNotification.Builder()
                            .setPackage(r.getSbn().getPackageName())
                            .setPackage(r.getSbn().getPackageName())
                            .setUid(r.getSbn().getUid())
                            .setUid(r.getSbn().getUid())
@@ -3032,9 +3033,11 @@ public class NotificationManagerService extends SystemService {
                            .setPostedTimeMs(System.currentTimeMillis())
                            .setPostedTimeMs(System.currentTimeMillis())
                            .setTitle(getHistoryTitle(r.getNotification()))
                            .setTitle(getHistoryTitle(r.getNotification()))
                            .setText(getHistoryText(
                            .setText(getHistoryText(
                                r.getSbn().getPackageContext(getContext()), r.getNotification()))
                                    r.getSbn().getPackageContext(getContext()),
                                    r.getNotification()))
                            .setIcon(r.getNotification().getSmallIcon())
                            .setIcon(r.getNotification().getSmallIcon())
                            .build());
                            .build());
                }
            } finally {
            } finally {
                Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
                Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
            }
            }
+16 −0
Original line number Original line Diff line number Diff line
@@ -4729,6 +4729,22 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
        verify(mHistoryManager, times(1)).addNotification(any());
        verify(mHistoryManager, times(1)).addNotification(any());
    }
    }


    @Test
    public void testMaybeRecordInterruptionLocked_smallIconsRequiredForHistory()
            throws RemoteException {
        final NotificationRecord r = generateNotificationRecord(
                mTestNotificationChannel, 1, null, true);
        r.setInterruptive(true);
        r.getSbn().getNotification().setSmallIcon(null);
        mService.addNotification(r);

        mService.maybeRecordInterruptionLocked(r);

        verify(mAppUsageStats, times(1)).reportInterruptiveNotification(
                anyString(), anyString(), anyInt());
        verify(mHistoryManager, never()).addNotification(any());
    }

    @Test
    @Test
    public void testBubble() throws Exception {
    public void testBubble() throws Exception {
        mBinderService.setBubblesAllowed(PKG, mUid, BUBBLE_PREFERENCE_NONE);
        mBinderService.setBubblesAllowed(PKG, mUid, BUBBLE_PREFERENCE_NONE);