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

Commit 362b4796 authored by Julia Reynolds's avatar Julia Reynolds Committed by Automerger Merge Worker
Browse files

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

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14329274

Change-Id: I58c6785f54e910e7b43e853420d52cc2164f0f04
parents 35a8a6b8 3dfc4cd4
Loading
Loading
Loading
Loading
+15 −12
Original line number Diff line number Diff line
@@ -3025,6 +3025,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())
@@ -3034,9 +3035,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);