Update CTS test for Android Security b/274759612
Bug: 274759612
Bug: 276748757
Test: Ran the new testcase on android-12.0.0_r28 with/without patch
Change-Id: I6321f475d8d99234a3dca400cea496ed484a679d
diff --git a/hostsidetests/securitybulletin/test-apps/CVE-2023-21129/src/android/security/cts/CVE_2023_21129/DeviceTest.java b/hostsidetests/securitybulletin/test-apps/CVE-2023-21129/src/android/security/cts/CVE_2023_21129/DeviceTest.java
index 070a1d9..d9dc035 100644
--- a/hostsidetests/securitybulletin/test-apps/CVE-2023-21129/src/android/security/cts/CVE_2023_21129/DeviceTest.java
+++ b/hostsidetests/securitybulletin/test-apps/CVE-2023-21129/src/android/security/cts/CVE_2023_21129/DeviceTest.java
@@ -16,6 +16,8 @@
package android.security.cts.CVE_2023_21129;
+import static android.app.NotificationManager.BUBBLE_PREFERENCE_ALL;
+
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
import static org.junit.Assert.assertFalse;
@@ -30,6 +32,9 @@
import androidx.test.runner.AndroidJUnit4;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
@@ -75,7 +80,7 @@
// Check if bubble notifications are enabled or disabled on the device
assumeTrue(
context.getString(R.string.bubbleNotificDisabled),
- notificationManager.areBubblesAllowed());
+ notificationManager.getBubblePreference() == BUBBLE_PREFERENCE_ALL);
// Launching BubbleActivity
Intent intent = new Intent(context, BubbleActivity.class);
diff --git a/hostsidetests/securitybulletin/test-apps/CVE-2023-21129/src/android/security/cts/CVE_2023_21129/PocService.java b/hostsidetests/securitybulletin/test-apps/CVE-2023-21129/src/android/security/cts/CVE_2023_21129/PocService.java
index 9fdacad..1406e83 100644
--- a/hostsidetests/securitybulletin/test-apps/CVE-2023-21129/src/android/security/cts/CVE_2023_21129/PocService.java
+++ b/hostsidetests/securitybulletin/test-apps/CVE-2023-21129/src/android/security/cts/CVE_2023_21129/PocService.java
@@ -46,8 +46,16 @@
PendingIntent.getActivity(
this,
mResources.getInteger(R.integer.requestCode),
+ new Intent(this, BubbleActivity.class),
+ PendingIntent.FLAG_MUTABLE /* flags */);
+
+ // Create a pending intent for fullscreen intent
+ PendingIntent pendingIntent =
+ PendingIntent.getActivity(
+ this,
+ mResources.getInteger(R.integer.requestCode),
new Intent(this, PocActivity.class),
- 0 /* flags */);
+ PendingIntent.FLAG_IMMUTABLE /* flags */);
// Create icon
Icon icon = createNotificationIcon();
@@ -102,7 +110,7 @@
.setSmallIcon(icon)
.setShortcutId(shortcutId)
.setBubbleMetadata(bubbleData)
- .setFullScreenIntent(bubbleIntent, true /* high priority */)
+ .setFullScreenIntent(pendingIntent, true /* high priority */)
.setStyle(messagingStyle);
notificationManager.notify(