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

Commit 7ed5b586 authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Notifs need small icons to be in the notif history

Because they need them to appear in the shade

Test: atest
Fixes: 186290531
Change-Id: I95892ce746fce3f3f40e4982d206784b95b0357d
parent 0e78c72a
Loading
Loading
Loading
Loading
+15 −12
Original line number Diff line number Diff line
@@ -3022,6 +3022,7 @@ public class NotificationManagerService extends SystemService {
                    getRealUserId(r.getSbn().getUserId()));
            Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "notifHistoryAddItem");
            try {
                if (r.getNotification().getSmallIcon() != null) {
                    mHistoryManager.addNotification(new HistoricalNotification.Builder()
                            .setPackage(r.getSbn().getPackageName())
                            .setUid(r.getSbn().getUid())
@@ -3031,9 +3032,11 @@ public class NotificationManagerService extends SystemService {
                            .setPostedTimeMs(System.currentTimeMillis())
                            .setTitle(getHistoryTitle(r.getNotification()))
                            .setText(getHistoryText(
                                r.getSbn().getPackageContext(getContext()), r.getNotification()))
                                    r.getSbn().getPackageContext(getContext()),
                                    r.getNotification()))
                            .setIcon(r.getNotification().getSmallIcon())
                            .build());
                }
            } finally {
                Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
            }
+16 −0
Original line number Diff line number Diff line
@@ -4729,6 +4729,22 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
        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
    public void testBubble() throws Exception {
        mBinderService.setBubblesAllowed(PKG, mUid, BUBBLE_PREFERENCE_NONE);