@RunWith(AndroidJUnit4.class)
public class IntentTest {
private static final String TAG = IntentTest.class.getSimpleName();
private static final File SIGNATURE_TEST_PACKGES =
new File("/data/local/tmp/signature-test-packages");
private static final String ANDROID_INTENT_PREFIX = "android.intent.action";
...
@Test
public void shouldNotFindUnexpectedIntents() throws Exception {
Set<String> platformIntents = lookupPlatformIntents();
platformIntents.addAll(intentWhitelist);
Set<String> allInvalidIntents = new HashSet<>();
Set<String> errors = new HashSet<>();
List<ApplicationInfo> packages =
mPackageManager.getInstalledApplications(PackageManager.GET_META_DATA);
for (ApplicationInfo appInfo : packages) {
if (!isSystemApp(appInfo) && !isUpdatedSystemApp(appInfo)) {
// Only examine system apps
continue;
}
Set<String> invalidIntents = new HashSet<>();
Set<String> activeIntents = lookupActiveIntents(appInfo.packageName);
for (String activeIntent : activeIntents) {
String intent = activeIntent.trim();
if (!platformIntents.contains(intent) &&
intent.startsWith(ANDROID_INTENT_PREFIX)) {
invalidIntents.add(activeIntent);
allInvalidIntents.add(activeIntent);
}
}
String error = String.format("Package: %s Invalid Intent: %s",
appInfo.packageName, invalidIntents);
if (!invalidIntents.isEmpty()) {
errors.add(error);
}
}
...
Note that it checks intent which starts with "android.intent.action".
So, if device with some launcher which wants to show badges (and so, has broadcast for action 'android.intent.action.BADGE_COUNT_UPDATE') it will definitely fail this CTS case.
There's the following test in CTS 8.x
http://androidxref.com/8.0.0_r4/xref/cts/tests/signature/src/android/signature/cts/IntentTest.java#107
Note that it checks intent which starts with "android.intent.action".
So, if device with some launcher which wants to show badges (and so, has broadcast for action 'android.intent.action.BADGE_COUNT_UPDATE') it will definitely fail this CTS case.