diff options
Diffstat (limited to 'tests/tests/appenumeration/src/android/appenumeration/cts/AppEnumerationTests.java')
-rw-r--r-- | tests/tests/appenumeration/src/android/appenumeration/cts/AppEnumerationTests.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/tests/appenumeration/src/android/appenumeration/cts/AppEnumerationTests.java b/tests/tests/appenumeration/src/android/appenumeration/cts/AppEnumerationTests.java index 4a26aaf82f9..123808e80cf 100644 --- a/tests/tests/appenumeration/src/android/appenumeration/cts/AppEnumerationTests.java +++ b/tests/tests/appenumeration/src/android/appenumeration/cts/AppEnumerationTests.java @@ -20,6 +20,7 @@ import static android.Manifest.permission.SET_PREFERRED_APPLICATIONS; import static android.appenumeration.cts.Constants.ACTION_AWAIT_LAUNCHER_APPS_CALLBACK; import static android.appenumeration.cts.Constants.ACTION_BIND_SERVICE; import static android.appenumeration.cts.Constants.ACTION_CHECK_SIGNATURES; +import static android.appenumeration.cts.Constants.ACTION_GET_INSTALLED_ACCESSIBILITYSERVICES_PACKAGES; import static android.appenumeration.cts.Constants.ACTION_GET_INSTALLED_APPWIDGET_PROVIDERS; import static android.appenumeration.cts.Constants.ACTION_GET_INSTALLED_PACKAGES; import static android.appenumeration.cts.Constants.ACTION_GET_NAMES_FOR_UIDS; @@ -649,6 +650,21 @@ public class AppEnumerationTests { assertVisible(QUERIES_WILDCARD_SHARE, TARGET_SHARE); } + @Test + public void queriesNothing_cannotSeeA11yService() throws Exception { + if (!sGlobalFeatureEnabled) return; + final String[] result = getInstalledAccessibilityServices(QUERIES_NOTHING); + assertThat(result, not(hasItemInArray(TARGET_FILTERS))); + } + + @Test + public void queriesNothingHasPermission_canSeeA11yService() throws Exception { + if (!sGlobalFeatureEnabled) return; + final String[] result = getInstalledAccessibilityServices(QUERIES_NOTHING_PERM); + assertThat(QUERIES_NOTHING_PERM + " should be able to see " + TARGET_FILTERS, + result, hasItemInArray(TARGET_FILTERS)); + } + private void assertVisible(String sourcePackageName, String targetPackageName) throws Exception { if (!sGlobalFeatureEnabled) return; @@ -1183,6 +1199,13 @@ public class AppEnumerationTests { } } + private String[] getInstalledAccessibilityServices (String sourcePackageName) + throws Exception { + final Bundle response = sendCommandBlocking(sourcePackageName, null /*targetPackageName*/, + null /*queryIntent*/, ACTION_GET_INSTALLED_ACCESSIBILITYSERVICES_PACKAGES); + return response.getStringArray(Intent.EXTRA_RETURN_RESULT); + } + private PackageInfo getPackageInfo(String sourcePackageName, String targetPackageName) throws Exception { Bundle response = sendCommandBlocking(sourcePackageName, targetPackageName, |