Merge "Add pkg target to snoozing alarm" into qt-dev am: 8e75c0526a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13676688 Change-Id: I284e21b4bd4fefb1f152e29de57b80aadfc46b1f
This commit is contained in:
@@ -36,6 +36,7 @@ import android.util.Slog;
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.logging.MetricsLogger;
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.server.pm.PackageManagerService;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
@@ -333,6 +334,7 @@ public class SnoozeHelper {
|
||||
return PendingIntent.getBroadcast(mContext,
|
||||
REQUEST_CODE_REPOST,
|
||||
new Intent(REPOST_ACTION)
|
||||
.setPackage(PackageManagerService.PLATFORM_PACKAGE_NAME)
|
||||
.setData(new Uri.Builder().scheme(REPOST_SCHEME).appendPath(key).build())
|
||||
.addFlags(Intent.FLAG_RECEIVER_FOREGROUND)
|
||||
.putExtra(EXTRA_KEY, key)
|
||||
|
||||
@@ -41,6 +41,7 @@ import android.util.IntArray;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
import com.android.server.UiServiceTestCase;
|
||||
import com.android.server.pm.PackageManagerService;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -81,6 +82,17 @@ 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(PackageManagerService.PLATFORM_PACKAGE_NAME,
|
||||
captor.getValue().getIntent().getPackage());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSnooze() throws Exception {
|
||||
NotificationRecord r = getNotificationRecord("pkg", 1, "one", UserHandle.SYSTEM);
|
||||
|
||||
Reference in New Issue
Block a user