diff options
author | 2021-03-03 21:37:49 +0000 | |
---|---|---|
committer | 2021-03-03 21:37:49 +0000 | |
commit | b5b5aa24ac457709844370f85d6ceaa7f8d3d2cc (patch) | |
tree | f60bdebb61d1e3c5a15f896b37aa93fc7791004d | |
parent | 1ef54a4a3648587e81de35c7f0703b536e23055c (diff) | |
parent | 84995d5dc41e2b2f635287e8711427a4bd945dde (diff) |
Merge "Fix broken broadcast options key in test" into sc-dev
-rw-r--r-- | services/tests/mockingservicestests/src/com/android/server/alarm/AlarmManagerServiceTest.java | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/services/tests/mockingservicestests/src/com/android/server/alarm/AlarmManagerServiceTest.java b/services/tests/mockingservicestests/src/com/android/server/alarm/AlarmManagerServiceTest.java index 91098813380e..51c9b0ddb0d6 100644 --- a/services/tests/mockingservicestests/src/com/android/server/alarm/AlarmManagerServiceTest.java +++ b/services/tests/mockingservicestests/src/com/android/server/alarm/AlarmManagerServiceTest.java @@ -85,6 +85,7 @@ import android.app.ActivityManager; import android.app.ActivityManagerInternal; import android.app.AlarmManager; import android.app.AppOpsManager; +import android.app.BroadcastOptions; import android.app.IActivityManager; import android.app.IAlarmCompleteListener; import android.app.IAlarmListener; @@ -1649,8 +1650,8 @@ public class AlarmManagerServiceTest { eq(FLAG_ALLOW_WHILE_IDLE_COMPAT | FLAG_STANDALONE), isNull(), isNull(), eq(Process.myUid()), eq(TEST_CALLING_PACKAGE), bundleCaptor.capture()); - final Bundle idleOptions = bundleCaptor.getValue(); - final int type = idleOptions.getInt("android:broadcast.temporaryAppWhitelistType"); + final BroadcastOptions idleOptions = new BroadcastOptions(bundleCaptor.getValue()); + final int type = idleOptions.getTemporaryAppAllowlistType(); assertEquals(TEMPORARY_ALLOWLIST_TYPE_FOREGROUND_SERVICE_ALLOWED, type); } @@ -1669,8 +1670,8 @@ public class AlarmManagerServiceTest { eq(alarmPi), isNull(), isNull(), eq(FLAG_ALLOW_WHILE_IDLE_COMPAT), isNull(), isNull(), eq(Process.myUid()), eq(TEST_CALLING_PACKAGE), bundleCaptor.capture()); - final Bundle idleOptions = bundleCaptor.getValue(); - final int type = idleOptions.getInt("android:broadcast.temporaryAppWhitelistType"); + final BroadcastOptions idleOptions = new BroadcastOptions(bundleCaptor.getValue()); + final int type = idleOptions.getTemporaryAppAllowlistType(); assertEquals(TEMPORARY_ALLOWLIST_TYPE_FOREGROUND_SERVICE_ALLOWED, type); } @@ -1716,8 +1717,8 @@ public class AlarmManagerServiceTest { isNull(), eq(alarmClock), eq(Process.myUid()), eq(TEST_CALLING_PACKAGE), bundleCaptor.capture()); - final Bundle idleOptions = bundleCaptor.getValue(); - final int type = idleOptions.getInt("android:broadcast.temporaryAppWhitelistType"); + final BroadcastOptions idleOptions = new BroadcastOptions(bundleCaptor.getValue()); + final int type = idleOptions.getTemporaryAppAllowlistType(); assertEquals(TEMPORARY_ALLOWLIST_TYPE_FOREGROUND_SERVICE_ALLOWED, type); } @@ -1742,8 +1743,8 @@ public class AlarmManagerServiceTest { eq(FLAG_ALLOW_WHILE_IDLE | FLAG_STANDALONE), isNull(), isNull(), eq(Process.myUid()), eq(TEST_CALLING_PACKAGE), bundleCaptor.capture()); - final Bundle idleOptions = bundleCaptor.getValue(); - final int type = idleOptions.getInt("android:broadcast.temporaryAppWhitelistType"); + final BroadcastOptions idleOptions = new BroadcastOptions(bundleCaptor.getValue()); + final int type = idleOptions.getTemporaryAppAllowlistType(); assertEquals(TEMPORARY_ALLOWLIST_TYPE_FOREGROUND_SERVICE_ALLOWED, type); } @@ -1772,8 +1773,8 @@ public class AlarmManagerServiceTest { eq(FLAG_ALLOW_WHILE_IDLE_COMPAT | FLAG_STANDALONE), isNull(), isNull(), eq(Process.myUid()), eq(TEST_CALLING_PACKAGE), bundleCaptor.capture()); - final Bundle idleOptions = bundleCaptor.getValue(); - final int type = idleOptions.getInt("android:broadcast.temporaryAppWhitelistType"); + final BroadcastOptions idleOptions = new BroadcastOptions(bundleCaptor.getValue()); + final int type = idleOptions.getTemporaryAppAllowlistType(); assertEquals(TEMPORARY_ALLOWLIST_TYPE_FOREGROUND_SERVICE_ALLOWED, type); } @@ -1797,8 +1798,8 @@ public class AlarmManagerServiceTest { eq(alarmPi), isNull(), isNull(), eq(FLAG_ALLOW_WHILE_IDLE_COMPAT), isNull(), isNull(), eq(Process.myUid()), eq(TEST_CALLING_PACKAGE), bundleCaptor.capture()); - final Bundle idleOptions = bundleCaptor.getValue(); - final int type = idleOptions.getInt("android:broadcast.temporaryAppWhitelistType"); + final BroadcastOptions idleOptions = new BroadcastOptions(bundleCaptor.getValue()); + final int type = idleOptions.getTemporaryAppAllowlistType(); assertEquals(TEMPORARY_ALLOWLIST_TYPE_FOREGROUND_SERVICE_ALLOWED, type); } @@ -1822,8 +1823,8 @@ public class AlarmManagerServiceTest { eq(alarmPi), isNull(), isNull(), eq(FLAG_ALLOW_WHILE_IDLE_COMPAT), isNull(), isNull(), eq(Process.myUid()), eq(TEST_CALLING_PACKAGE), bundleCaptor.capture()); - final Bundle idleOptions = bundleCaptor.getValue(); - final int type = idleOptions.getInt("android:broadcast.temporaryAppWhitelistType"); + final BroadcastOptions idleOptions = new BroadcastOptions(bundleCaptor.getValue()); + final int type = idleOptions.getTemporaryAppAllowlistType(); assertEquals(TEMPORARY_ALLOWLIST_TYPE_FOREGROUND_SERVICE_NOT_ALLOWED, type); } |