Merge "Add pkg target to snoozing alarm" into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
691b6ca55b
@@ -309,6 +309,7 @@ public class SnoozeHelper {
|
|||||||
return PendingIntent.getBroadcast(mContext,
|
return PendingIntent.getBroadcast(mContext,
|
||||||
REQUEST_CODE_REPOST,
|
REQUEST_CODE_REPOST,
|
||||||
new Intent(REPOST_ACTION)
|
new Intent(REPOST_ACTION)
|
||||||
|
.setPackage("android")
|
||||||
.setData(new Uri.Builder().scheme(REPOST_SCHEME).appendPath(key).build())
|
.setData(new Uri.Builder().scheme(REPOST_SCHEME).appendPath(key).build())
|
||||||
.addFlags(Intent.FLAG_RECEIVER_FOREGROUND)
|
.addFlags(Intent.FLAG_RECEIVER_FOREGROUND)
|
||||||
.putExtra(EXTRA_KEY, key)
|
.putExtra(EXTRA_KEY, key)
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ import static org.mockito.Mockito.verify;
|
|||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import com.android.server.UiServiceTestCase;
|
import com.android.server.UiServiceTestCase;
|
||||||
|
import com.android.server.pm.PackageManagerService;
|
||||||
|
|
||||||
|
|
||||||
@SmallTest
|
@SmallTest
|
||||||
@@ -80,6 +81,16 @@ public class SnoozeHelperTest extends UiServiceTestCase {
|
|||||||
UserHandle.USER_SYSTEM, r.sbn.getPackageName(), r.getKey()));
|
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
|
@Test
|
||||||
public void testSnooze() throws Exception {
|
public void testSnooze() throws Exception {
|
||||||
NotificationRecord r = getNotificationRecord("pkg", 1, "one", UserHandle.SYSTEM);
|
NotificationRecord r = getNotificationRecord("pkg", 1, "one", UserHandle.SYSTEM);
|
||||||
|
|||||||
Reference in New Issue
Block a user