diff options
author | Svetoslav <svetoslavganov@google.com> | 2013-01-29 01:04:35 -0800 |
---|---|---|
committer | Svetoslav <svetoslavganov@google.com> | 2013-01-29 13:56:22 -0800 |
commit | 3822896e226567c6cd3ef84518d318abd33a7624 (patch) | |
tree | 6e755134d69f6b6ecac12d0ee949124e42ed43a3 /core | |
parent | 8c47e856b067057b5fcbb6eccfc79d1da4cff8f1 (diff) | |
download | frameworks_base-3822896e226567c6cd3ef84518d318abd33a7624.zip frameworks_base-3822896e226567c6cd3ef84518d318abd33a7624.tar.gz frameworks_base-3822896e226567c6cd3ef84518d318abd33a7624.tar.bz2 |
Remove "enhance web scripts" from settings and make it requested by plug-ins.
Currently we have an "enhance web accessibility" setting that has to be
enabled to make sure web content is accessible. We added the setting to
get user consent because we are injecting JavaScript-based screen-reader
pulled from the Google infrastructure. However, many users do not know
that and (as expected) do not read the user documentation, resulting in
critique for lacking accessibility support in WebViews with JavaScript
enabled (Browser, Gmail, etc).
To smoothen the user experience now "enhance web accessibility" is a
feature an accessibility plug-in can request, similarly to explore by
touch. Now a user does not need to know that she has to explicitly
enable the setting and web accessibility will work out-of-the-box.
Before we were showing a dialog when a plug-in tries to put the device
in a touch exploration mode. However, now that we have one more feature
a plug-in can request, showing two dialogs (assume a plug-in wants both
features) will mean that a user should potentially deal with three
dialogs, one for enabling the service, and one for each feature. We
could merge the dialogs but still the user has to poke two dialogs.
It seems that the permission mechanism is a perfect fit for getting
user permission for an app to do something, in this case to enable
an accessibility feature. We need a separate permission for explore
by touch and enhance web accessibility since the former changes the
interaction model and the latter injects JavaScript in web pages. It
is critical to get user consent for the script injection part so we
need a well-documented permission rather a vague umbrella permission
for poking accessibility features. To allow better grouping of the
accessibility permissions this patch adds a permission group as well.
bug:8089372
Change-Id: Ic125514c34f191aea0416a469e4b3481ab3200b9
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/accessibilityservice/AccessibilityServiceInfo.java | 14 | ||||
-rw-r--r-- | core/java/android/provider/Settings.java | 1 | ||||
-rw-r--r-- | core/res/AndroidManifest.xml | 27 | ||||
-rwxr-xr-x | core/res/res/drawable-hdpi/perm_group_accessibility_features.png | bin | 0 -> 1223 bytes | |||
-rwxr-xr-x | core/res/res/drawable-mdpi/perm_group_accessibility_features.png | bin | 0 -> 845 bytes | |||
-rw-r--r-- | core/res/res/drawable-xhdpi/perm_group_accessibility_features.png | bin | 0 -> 1631 bytes | |||
-rw-r--r-- | core/res/res/values/attrs.xml | 2 | ||||
-rw-r--r-- | core/res/res/values/strings.xml | 38 |
8 files changed, 61 insertions, 21 deletions
diff --git a/core/java/android/accessibilityservice/AccessibilityServiceInfo.java b/core/java/android/accessibilityservice/AccessibilityServiceInfo.java index 2006bc7..2dc0501 100644 --- a/core/java/android/accessibilityservice/AccessibilityServiceInfo.java +++ b/core/java/android/accessibilityservice/AccessibilityServiceInfo.java @@ -153,13 +153,25 @@ public class AccessibilityServiceInfo implements Parcelable { public static final int FLAG_REQUEST_TOUCH_EXPLORATION_MODE= 0x0000004; /** + * This flag requests from the system to enable web accessibility enhancing + * extensions. Such extensions aim to provide improved accessibility support + * for content presented in a {@link android.webkit.WebView}. An example of such + * an extension is injecting JavaScript from Google. The system will enable + * enhanced web accessibility if there is at least one accessibility service + * that has this flag set. Hence, clearing this flag does not guarantee that the + * device will not have enhanced web accessibility enabled since there may be + * another enabled service that requested it. + */ + public static final int FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY = 0x00000008; + + /** * This flag requests that the {@link AccessibilityNodeInfo}s obtained * by an {@link AccessibilityService} contain the id of the source view. * The source view id will be a fully qualified resource name of the * form "package:id/name", for example "foo.bar:id/my_list", and it is * useful for UI test automation. This flag is not set by default. */ - public static final int FLAG_REPORT_VIEW_IDS = 0x00000008; + public static final int FLAG_REPORT_VIEW_IDS = 0x00000010; /** * The event types an {@link AccessibilityService} is interested in. diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 3d850cf..be21fb4 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -3351,6 +3351,7 @@ public final class Settings { * * @hide */ + @Deprecated public static final String TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES = "touch_exploration_granted_accessibility_services"; diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index aafc4bf..7a51c0c 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -532,6 +532,31 @@ android:label="@string/permlab_addVoicemail" android:description="@string/permdesc_addVoicemail" /> + <!-- =============================================== --> + <!-- Permissions for enabling accessibility features --> + <!-- =============================================== --> + + <!-- Used for permissions that allow requesting certain accessibility features. --> + <permission-group android:name="android.permission-group.ACCESSIBILITY_FEATURES" + android:label="@string/permgrouplab_accessibilityFeatures" + android:icon="@drawable/perm_group_accessibility_features" + android:description="@string/permgroupdesc_accessibilityFeatures" + android:priority="380" /> + + <!-- Allows an accessibility service to request touch exploration mode. --> + <permission android:name="android.permission.CAN_REQUEST_TOUCH_EXPLORATION_MODE" + android:permissionGroup="android.permission-group.ACCESSIBILITY_FEATURES" + android:label="@string/permlab_canRequestTouchExplorationMode" + android:description="@string/permdesc_canRequestTouchExplorationMode" + android:protectionLevel="dangerous" /> + + <!-- Allows an accessibility service to request enhanced web accessibility. --> + <permission android:name="android.permission.CAN_REQUEST_ENHANCED_WEB_ACCESSIBILITY" + android:permissionGroup="android.permission-group.ACCESSIBILITY_FEATURES" + android:label="@string/permlab_canRequestEnahncedWebAccessibility" + android:description="@string/permdesc_canRequestEnahncedWebAccessibility" + android:protectionLevel="dangerous" /> + <!-- ======================================= --> <!-- Permissions for accessing location info --> <!-- ======================================= --> @@ -1724,7 +1749,7 @@ android:description="@string/permdesc_bindInputMethod" android:protectionLevel="signature" /> - <!-- Must be required by an {@link android.accessibilityservice.AccessibilityService}, + <!-- Must be required by an {@link android.accessibilityservice.AccessibilityService}, to ensure that only the system can bind to it. --> <permission android:name="android.permission.BIND_ACCESSIBILITY_SERVICE" android:label="@string/permlab_bindAccessibilityService" diff --git a/core/res/res/drawable-hdpi/perm_group_accessibility_features.png b/core/res/res/drawable-hdpi/perm_group_accessibility_features.png Binary files differnew file mode 100755 index 0000000..849c19c --- /dev/null +++ b/core/res/res/drawable-hdpi/perm_group_accessibility_features.png diff --git a/core/res/res/drawable-mdpi/perm_group_accessibility_features.png b/core/res/res/drawable-mdpi/perm_group_accessibility_features.png Binary files differnew file mode 100755 index 0000000..ba86d3d --- /dev/null +++ b/core/res/res/drawable-mdpi/perm_group_accessibility_features.png diff --git a/core/res/res/drawable-xhdpi/perm_group_accessibility_features.png b/core/res/res/drawable-xhdpi/perm_group_accessibility_features.png Binary files differnew file mode 100644 index 0000000..2fec7a3 --- /dev/null +++ b/core/res/res/drawable-xhdpi/perm_group_accessibility_features.png diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index dc921e6..ab2bd3a 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -2510,6 +2510,8 @@ <flag name="flagIncludeNotImportantViews" value="0x00000002" /> <!-- Has flag {@link android.accessibilityservice.AccessibilityServiceInfo#FLAG_REQUEST_TOUCH_EXPLORATION_MODE} --> <flag name="flagRequestTouchExplorationMode" value="0x00000004" /> + <!-- Has flag {@link android.accessibilityservice.AccessibilityServiceInfo#FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY} --> + <flag name="flagRequestEnhancedWebAccessibility" value="0x00000008" /> </attr> <!-- Component name of an activity that allows the user to modify the settings for this service. This setting cannot be changed at runtime. --> diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 7f0fc0b..8f8f32d 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -535,6 +535,11 @@ <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. --> <string name="permgroupdesc_storage" product="default">Access the SD card.</string> + <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permgrouplab_accessibilityFeatures">Accessibility features</string> + <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permgroupdesc_accessibilityFeatures">Features that assistive technology can request.</string> + <!-- Permissions --> <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> @@ -935,6 +940,20 @@ interface of an accessibility service. Should never be needed for normal apps.</string> <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permlab_canRequestTouchExplorationMode">request explore by touch</string> + <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permdesc_canRequestTouchExplorationMode">Allows the hoder to request an + interaction mode in which touched items are spoken aloud and the UI can be explored + via gestures.</string> + + <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permlab_canRequestEnahncedWebAccessibility">request enhanced web accessibility</string> + <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permdesc_canRequestEnahncedWebAccessibility">Allows the hoder to request + enabling of web accessibility enhancements. For example, installing scripts from + Google to make app content more accessible.</string> + + <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permlab_bindTextService">bind to a text service</string> <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permdesc_bindTextService">Allows the holder to bind to the top-level @@ -2695,25 +2714,6 @@ <!-- SearchView accessibility description for voice button [CHAR LIMIT=NONE] --> <string name="searchview_description_voice">Voice search</string> - <!-- Title for a warning message about the interaction model changes after allowing an accessibility - service to put the device into explore by touch mode, displayed as a dialog message when - the user selects to enables the service. (default). [CHAR LIMIT=45] --> - <string name="enable_explore_by_touch_warning_title">Enable Explore by Touch?</string> - <!-- Summary for a warning message about the interaction model changes after allowing an accessibility - service to put the device into explore by touch mode, displayed as a dialog message when - the user selects to enables the service. (tablet). [CHAR LIMIT=NONE] --> - <string name="enable_explore_by_touch_warning_message" product="tablet"> - <xliff:g id="accessibility_service_name">%1$s</xliff:g> wants to enable Explore by Touch. - When Explore by Touch is turned on, you can hear or see descriptions of what\'s under - your finger or perform gestures to interact with the tablet.</string> - <!-- Summary for a warning message about the interaction model changes after allowing an accessibility - service to put the device into explore by touch mode, displayed as a dialog message when - the user selects to enables the service. (default). [CHAR LIMIT=NONE] --> - <string name="enable_explore_by_touch_warning_message" product="default"> - <xliff:g id="accessibility_service_name">%1$s</xliff:g> wants to enable Explore by Touch. - When Explore by Touch is turned on, you can hear or see descriptions of what\'s under - your finger or perform gestures to interact with the phone.</string> - <!-- String used to display the date. This is the string to say something happened 1 month ago. --> <string name="oneMonthDurationPast">1 month ago</string> <!-- String used to display the date. This is the string to say something happened more than 1 month ago. --> |