commit | 00e9b0633708112a5fd745b1020e82fe57fb25aa | [log] [tgz] |
---|---|---|
author | Sadaf Ebrahimi <sadafebrahimi@google.com> | Thu Jan 16 22:02:22 2025 +0000 |
committer | Sadaf Ebrahimi <sadafebrahimi@google.com> | Thu Jan 16 22:02:23 2025 +0000 |
tree | 2c166a0466e764abd5321b2229d407306b023382 | |
parent | 8f3789514e7854704ed2de7ec9915173c377babb [diff] | |
parent | c65cab02b2a845c29c3da100d6adefd345a144e3 [diff] |
Upgrade accessibility-test-framework to c65cab02b2a845c29c3da100d6adefd345a144e3 This project was upgraded with external_updater. Usage: tools/external_updater/updater.sh update external/accessibility-test-framework For more info, check https://cs.android.com/android/platform/superproject/main/+/main:tools/external_updater/README.md Test: TreeHugger Change-Id: I5ed8e16596a57a210a690b1fb48ec5ff62aa8344
To help people with disabilities access Android apps, developers of those apps need to consider how their apps will be presented to accessibility services. Some good practices can be checked by automated tools, such as if a View has a contentDescription. Other rules require human judgment, such as whether or not a contentDescription makes sense to all users.
For more information about Mobile Accessibility, see http://www.w3.org/WAI/mobile/.
This library collects various accessibility-related checks on View objects as well as AccessibilityNodeInfo objects (which the Android framework derives from Views and sends to AccessibilityServices).
The supplied gradle wrapper and build.gradle file can be used to build the Accessibility Test Framework or import the project into Android Studio.
$ ./gradlew build
Given a view, the following code runs all accessibility checks on all views in the hierarchy rooted at that view and throws an exception if any errors are found:
ImmutableSet<AccessibilityHierarchyCheck> checks = AccessibilityCheckPreset.getAccessibilityHierarchyChecksForPreset( AccessibilityCheckPreset.LATEST); AccessibilityHierarchyAndroid hierarchy = AccessibilityHierarchyAndroid.newBuilder(view).build(); List<AccessibilityHierarchyCheckResult> results = new ArrayList<>(); for (AccessibilityHierarchyCheck check : checks) { results.addAll(check.runCheckOnHierarchy(hierarchy)); } List<AccessibilityHierarchyCheckResult> errors = AccessibilityCheckResultUtils.getResultsForType( results, AccessibilityCheckResultType.ERROR); if (!errors.isEmpty()) { throw new RuntimeException(errors.get(0).getMessage().toString()); }