MASTG-KNOW-0143: Accessibility Data Sensitivity
Android 14 (API level 34) introduced accessibility data sensitivity, which lets an app specify that a View only allows interactions from accessibility services that are declared as accessibility tools by setting the android:isAccessibilityTool attribute to true in its service configuration. Accessibility services that aren't declared as accessibility tools can't read the content of these views or perform accessibility actions on them, while accessibility tools, such as screen readers, keep full access. On Android 16 (API level 36) and higher, the protection also blocks simulated touch gestures that these services inject with AccessibilityService.dispatchGesture (see the Android guidance on tapjacking).
Accessibility Tool Declaration
Google Play restricts this declaration to apps whose primary purpose is to support people with disabilities, such as screen readers, switch-based input tools, and voice-based input tools. Apps that use accessibility services for other purposes, such as password managers, automation tools, launchers, or antivirus apps, don't qualify. Google Play rejects apps that declare android:isAccessibilityTool without meeting these criteria, and Google Play Protect blocks such apps on user devices. See the Google Play policy on the use of the AccessibilityService API and the Android Developers Blog post "Enhancing Android security: Stop malware from snooping on your app data" for more details.
Apps can configure accessibility data sensitivity for each view in the following ways:
- In layout files within the
res/layoutdirectory, using theandroid:accessibilityDataSensitiveXML attribute. - Programmatically, by calling
setAccessibilityDataSensitiveon a view with one of the following values:View.ACCESSIBILITY_DATA_SENSITIVE_AUTO(default): the system determines the value automatically (see "Automatic Behavior" below).View.ACCESSIBILITY_DATA_SENSITIVE_YES: the view only allows interactions from accessibility tools.View.ACCESSIBILITY_DATA_SENSITIVE_NO: the view allows interactions from all accessibility services.
- In Jetpack Compose, by setting the
isSensitiveDatasemantics property totruewith thesemanticsmodifier.
The isAccessibilityDataSensitive method returns the effective state of a view, taking the automatic behavior into account.
Automatic Behavior¶
When a view uses ACCESSIBILITY_DATA_SENSITIVE_AUTO, the system restricts interactions to accessibility tools if any of the following conditions is met:
- Any parent of the view returns
truefromisAccessibilityDataSensitive. - The view has
View.setFilterTouchesWhenObscuredset totrue, either with theandroid:filterTouchesWhenObscuredXML attribute or by callingView.setFilterTouchesWhenObscured(true)(see Overlay Attacks).
Advanced Protection on Android 17¶
On Android 17, enabling Advanced Protection restricts access to the AccessibilityService API to verified apps categorized as accessibility tools. While Advanced Protection is enabled, other accessibility services are restricted for all apps, independently of whether individual views are marked as accessibility data sensitive. Accessibility data sensitivity remains the mechanism that apps control for devices that don't use Advanced Protection.