• Home
Name Date Size #Lines LOC

..--

.github/workflows/06-Sep-2024-2419

gradle/wrapper/06-Sep-2024-65

src/main/06-Sep-2024-38,82422,609

.gitignoreD06-Sep-2024845 6851

Android.bpD06-Sep-2024791 2928

LICENSED06-Sep-202411.1 KiB202169

METADATAD06-Sep-2024557 1715

MODULE_LICENSE_APACHE2D06-Sep-20240

OWNERSD06-Sep-202451 21

README.mdD06-Sep-20241.7 KiB4737

build.gradleD06-Sep-20244.3 KiB139126

gradle.propertiesD06-Sep-202425 21

gradlewD06-Sep-20245.6 KiB186125

gradlew.batD06-Sep-20242.6 KiB9068

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