commit | 4a764c690353ea136c82f1a696a70bf38d1ef5fe | [log] [tgz] |
---|---|---|
author | Brinko Kobrin <[email protected]> | Tue Jun 28 14:25:32 2022 -0700 |
committer | Brinko Kobrin <[email protected]> | Tue Jun 28 14:25:32 2022 -0700 |
tree | a45055ed05cb902525fd50aa9885df750dd7ce19 | |
parent | 4984ca290585696617c1b4c443f73d9539b30e0a [diff] |
Commit message: Updates for Accessibility Test Framework v4.0.0: - New check in AccessibilityCheckPreset.LATEST for issues related to font scaling issues - New check in AccessibilityCheckPreset.PRERELEASE for unexposed text - Improved heuristic text contrast checking using text character locations - Removed obsolete *ViewCheck classes - Updated dependency versions
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()); }