Fix CTS test failure
skip checking telephony protected broadcast when there is no Telephony
Package
Bug: 31039972
Change-Id: I396806152b020ce5e0a4c61fd2cded9c4c249f71
diff --git a/tests/tests/security/src/android/security/cts/STKFrameworkTest.java b/tests/tests/security/src/android/security/cts/STKFrameworkTest.java
index 1fae3c8..a30387f 100644
--- a/tests/tests/security/src/android/security/cts/STKFrameworkTest.java
+++ b/tests/tests/security/src/android/security/cts/STKFrameworkTest.java
@@ -17,12 +17,17 @@
import android.content.ComponentName;
import android.content.Intent;
+import android.content.pm.PackageManager;
import android.test.AndroidTestCase;
public class STKFrameworkTest extends AndroidTestCase {
+ private boolean mHasTelephony;
+
@Override
protected void setUp() throws Exception {
super.setUp();
+ mHasTelephony = getContext().getPackageManager().hasSystemFeature(
+ PackageManager.FEATURE_TELEPHONY);
}
@Override
@@ -35,6 +40,10 @@
* zero-permission malicious application
*/
public void testInterceptedSIMCommandsToTelephony() {
+ if (!mHasTelephony) {
+ return;
+ }
+
Intent intent = new Intent();
intent.setAction("android.intent.action.stk.command");
intent.putExtra("STK CMD", "test");