Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
.github/workflows/ | H | 25-Apr-2025 | - | 24 | 19 | |
gradle/wrapper/ | H | 25-Apr-2025 | - | 6 | 5 | |
src/main/ | H | 25-Apr-2025 | - | 38,824 | 22,609 | |
.gitignore | H A D | 25-Apr-2025 | 845 | 68 | 51 | |
Android.bp | H A D | 25-Apr-2025 | 760 | 27 | 26 | |
LICENSE | H A D | 25-Apr-2025 | 11.1 KiB | 202 | 169 | |
METADATA | H A D | 25-Apr-2025 | 557 | 17 | 15 | |
MODULE_LICENSE_APACHE2 | HD | 25-Apr-2025 | 0 | |||
OWNERS | H A D | 25-Apr-2025 | 51 | 2 | 1 | |
README.md | H A D | 25-Apr-2025 | 1.7 KiB | 47 | 37 | |
build.gradle | H A D | 25-Apr-2025 | 4.3 KiB | 139 | 126 | |
gradle.properties | H A D | 25-Apr-2025 | 25 | 2 | 1 | |
gradlew | H A D | 25-Apr-2025 | 5.6 KiB | 186 | 125 | |
gradlew.bat | H A D | 25-Apr-2025 | 2.6 KiB | 90 | 68 |
README.md
1# Accessibility Test Framework for Android 2 3To help people with disabilities access Android apps, developers of those apps 4need to consider how their apps will be presented to accessibility services. 5Some good practices can be checked by automated tools, such as if a View has a 6contentDescription. Other rules require human judgment, such as whether or not a 7contentDescription makes sense to all users. 8 9For more information about Mobile Accessibility, see 10http://www.w3.org/WAI/mobile/. 11 12This library collects various accessibility-related checks on View objects as 13well as AccessibilityNodeInfo objects (which the Android framework derives from 14Views and sends to AccessibilityServices). 15 16## Building the Library 17 18The supplied gradle wrapper and build.gradle file can be used to build the 19Accessibility Test Framework or import the project into Android Studio. 20 21```shell 22$ ./gradlew build 23``` 24 25## Sample Usage 26 27Given a view, the following code runs all accessibility checks on all views in 28the hierarchy rooted at that view and throws an exception if any errors are 29found: 30 31```java 32ImmutableSet<AccessibilityHierarchyCheck> checks = 33 AccessibilityCheckPreset.getAccessibilityHierarchyChecksForPreset( 34 AccessibilityCheckPreset.LATEST); 35AccessibilityHierarchyAndroid hierarchy = AccessibilityHierarchyAndroid.newBuilder(view).build(); 36List<AccessibilityHierarchyCheckResult> results = new ArrayList<>(); 37for (AccessibilityHierarchyCheck check : checks) { 38 results.addAll(check.runCheckOnHierarchy(hierarchy)); 39} 40List<AccessibilityHierarchyCheckResult> errors = 41 AccessibilityCheckResultUtils.getResultsForType( 42 results, AccessibilityCheckResultType.ERROR); 43if (!errors.isEmpty()) { 44 throw new RuntimeException(errors.get(0).getMessage().toString()); 45} 46``` 47