CTS test fix for Android Security b/154915372

Skip the test if we are unable to get a pendingintent from the wallpaper
service.

Bug: 154915372
Bug: 170661753
Test: Ran the new testcase on android-10.0.0_r38 with/without patch
Test: sts-tradefed run sts-engbuild-no-spl-lock -m CtsSecurityTestCases -t android.security.cts.CVE_2020_0294
Change-Id: Iecbd1773314e5c9f24af16db41ef0d515a764235
diff --git a/tests/tests/security/src/android/security/cts/CVE_2020_0294.java b/tests/tests/security/src/android/security/cts/CVE_2020_0294.java
index 7310606..0a533bb 100644
--- a/tests/tests/security/src/android/security/cts/CVE_2020_0294.java
+++ b/tests/tests/security/src/android/security/cts/CVE_2020_0294.java
@@ -24,17 +24,25 @@
 import android.content.Intent;
 import android.net.Uri;
 import android.platform.test.annotations.SecurityTest;
-import android.test.AndroidTestCase;
 
 import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.*;
+import static org.junit.Assume.*;
 
 @SecurityTest
-public class CVE_2020_0294 extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class CVE_2020_0294 {
     private static final String TAG = "CVE_2020_0294";
 
     /**
      * b/170661753
      */
+    @Test
     @SecurityTest(minPatchLevel = "2020-12")
     public void testPocCVE_2020_0294() throws Exception {
         Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
@@ -44,6 +52,7 @@
         ComponentName componentName =
                 ComponentName.unflattenFromString("com.android.systemui/.ImageWallpaper");
         PendingIntent pi = activityManager.getRunningServiceControlPanel(componentName);
+        assumeNotNull(pi);
 
         Intent spuriousIntent = new Intent();
         spuriousIntent.setPackage(targetContext.getPackageName());