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

Commit b3415238 authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Add pkg target to snoozing alarm

Test: SnoozeHelperTest
Bug: 174493336
Change-Id: I6aaf80a11dcae2eca41d4647411126ed41587027
(cherry picked from commit 6b5813b1)
Merged-In: I6aaf80a11dcae2eca41d4647411126ed41587027
parent 663162c3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -309,6 +309,7 @@ public class SnoozeHelper {
        return PendingIntent.getBroadcast(mContext,
                REQUEST_CODE_REPOST,
                new Intent(REPOST_ACTION)
                        .setPackage("android")
                        .setData(new Uri.Builder().scheme(REPOST_SCHEME).appendPath(key).build())
                        .addFlags(Intent.FLAG_RECEIVER_FOREGROUND)
                        .putExtra(EXTRA_KEY, key)
+11 −0
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import com.android.server.UiServiceTestCase;
import com.android.server.pm.PackageManagerService;


@SmallTest
@@ -80,6 +81,16 @@ public class SnoozeHelperTest extends UiServiceTestCase {
                UserHandle.USER_SYSTEM, r.sbn.getPackageName(), r.getKey()));
    }

    @Test
    public void testSnoozeSentToAndroid() throws Exception {
        NotificationRecord r = getNotificationRecord("pkg", 1, "one", UserHandle.SYSTEM);
        mSnoozeHelper.snooze(r, 1000);
        ArgumentCaptor<PendingIntent> captor = ArgumentCaptor.forClass(PendingIntent.class);
        verify(mAm, times(1)).setExactAndAllowWhileIdle(
                anyInt(), anyLong(), captor.capture());
        assertEquals("android", captor.getValue().getIntent().getPackage());
    }

    @Test
    public void testSnooze() throws Exception {
        NotificationRecord r = getNotificationRecord("pkg", 1, "one", UserHandle.SYSTEM);