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

Commit dd17afa1 authored by Chloris Kuo's avatar Chloris Kuo Committed by Android (Google) Code Review
Browse files

Merge "Apply adjustment to all enqueued notification records with matched key"

parents a38a7a16 f2b2daaa
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -4861,7 +4861,6 @@ public class NotificationManagerService extends SystemService {
                            // calculate the final importance here
                            // calculate the final importance here
                            r.calculateImportance();
                            r.calculateImportance();
                            foundEnqueued = true;
                            foundEnqueued = true;
                            break;
                        }
                        }
                    }
                    }
                    if (!foundEnqueued) {
                    if (!foundEnqueued) {
+21 −1
Original line number Original line Diff line number Diff line
@@ -178,7 +178,6 @@ import com.android.server.wm.WindowManagerInternal;


import org.junit.After;
import org.junit.After;
import org.junit.Before;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.ArgumentCaptor;
@@ -3773,6 +3772,27 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
        assertEquals(USER_SENTIMENT_NEGATIVE, r.getUserSentiment());
        assertEquals(USER_SENTIMENT_NEGATIVE, r.getUserSentiment());
    }
    }


    @Test
    public void testEnqueuedAdjustmentAppliesAdjustments_MultiNotifications() throws Exception {
        final NotificationRecord r1 = generateNotificationRecord(mTestNotificationChannel);
        final NotificationRecord r2 = generateNotificationRecord(mTestNotificationChannel);
        mService.addEnqueuedNotification(r1);
        mService.addEnqueuedNotification(r2);
        when(mAssistants.isSameUser(eq(null), anyInt())).thenReturn(true);

        Bundle signals = new Bundle();
        signals.putInt(Adjustment.KEY_IMPORTANCE,
                IMPORTANCE_HIGH);
        Adjustment adjustment = new Adjustment(
                r1.getSbn().getPackageName(), r1.getKey(), signals,
                "", r1.getUser().getIdentifier());

        mBinderService.applyEnqueuedAdjustmentFromAssistant(null, adjustment);

        assertEquals(IMPORTANCE_HIGH, r1.getImportance());
        assertEquals(IMPORTANCE_HIGH, r2.getImportance());
    }

    @Test
    @Test
    public void testRestore() throws Exception {
    public void testRestore() throws Exception {
        int systemChecks = mService.countSystemChecks;
        int systemChecks = mService.countSystemChecks;