tag | 1bdfffe3731b68609435328dc63d329df80380c0 | |
---|---|---|
tagger | The Android Open Source Project <initial-contribution@android.com> | Fri Jan 31 14:57:22 2025 -0800 |
object | 9da753f892ebef1606bcd30e0686e0ae7ce6aaf7 |
aml_mpr_351311140 (12873146,com.google.android.go.mediaprovider,com.google.android.mediaprovider)
commit | 9da753f892ebef1606bcd30e0686e0ae7ce6aaf7 | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Sun Nov 17 22:34:05 2024 +0000 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Sun Nov 17 22:34:05 2024 +0000 |
tree | 1c88b39ad9b2862ae31b14cfb891714d99a31999 | |
parent | a78003332a3f0962f02b8240474fb4a3735a1609 [diff] | |
parent | c03f1116cade83854a1fc4ef18bbae8375da6cfc [diff] |
Snap for 12668534 from c03f1116cade83854a1fc4ef18bbae8375da6cfc to mainline-mediaprovider-release Change-Id: Ibe0d45f348824ef303d57800de8568bd57ae8b3a
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()); }