Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3822896e authored by Svetoslav's avatar Svetoslav
Browse files

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
parent 8c47e856
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -36,6 +36,8 @@ package android {
    field public static final java.lang.String CALL_PHONE = "android.permission.CALL_PHONE";
    field public static final java.lang.String CALL_PRIVILEGED = "android.permission.CALL_PRIVILEGED";
    field public static final java.lang.String CAMERA = "android.permission.CAMERA";
    field public static final java.lang.String CAN_REQUEST_ENHANCED_WEB_ACCESSIBILITY = "android.permission.CAN_REQUEST_ENHANCED_WEB_ACCESSIBILITY";
    field public static final java.lang.String CAN_REQUEST_TOUCH_EXPLORATION_MODE = "android.permission.CAN_REQUEST_TOUCH_EXPLORATION_MODE";
    field public static final java.lang.String CHANGE_COMPONENT_ENABLED_STATE = "android.permission.CHANGE_COMPONENT_ENABLED_STATE";
    field public static final java.lang.String CHANGE_CONFIGURATION = "android.permission.CHANGE_CONFIGURATION";
    field public static final java.lang.String CHANGE_NETWORK_STATE = "android.permission.CHANGE_NETWORK_STATE";
@@ -141,6 +143,7 @@ package android {
  public static final class Manifest.permission_group {
    ctor public Manifest.permission_group();
    field public static final java.lang.String ACCESSIBILITY_FEATURES = "android.permission-group.ACCESSIBILITY_FEATURES";
    field public static final java.lang.String ACCOUNTS = "android.permission-group.ACCOUNTS";
    field public static final java.lang.String AFFECTS_BATTERY = "android.permission-group.AFFECTS_BATTERY";
    field public static final java.lang.String APP_INFO = "android.permission-group.APP_INFO";
@@ -2104,7 +2107,8 @@ package android.accessibilityservice {
    field public static final int FEEDBACK_SPOKEN = 1; // 0x1
    field public static final int FEEDBACK_VISUAL = 8; // 0x8
    field public static final int FLAG_INCLUDE_NOT_IMPORTANT_VIEWS = 2; // 0x2
    field public static final int FLAG_REPORT_VIEW_IDS = 8; // 0x8
    field public static final int FLAG_REPORT_VIEW_IDS = 16; // 0x10
    field public static final int FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY = 8; // 0x8
    field public static final int FLAG_REQUEST_TOUCH_EXPLORATION_MODE = 4; // 0x4
    field public int eventTypes;
    field public int feedbackType;
+13 −1
Original line number Diff line number Diff line
@@ -152,6 +152,18 @@ 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.
@@ -159,7 +171,7 @@ public class AccessibilityServiceInfo implements Parcelable {
     * 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.
+1 −0
Original line number Diff line number Diff line
@@ -3351,6 +3351,7 @@ public final class Settings {
         *
         * @hide
         */
        @Deprecated
        public static final String TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES =
            "touch_exploration_granted_accessibility_services";

+26 −1
Original line number Diff line number Diff line
@@ -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 -->
    <!-- ======================================= -->
+1.19 KiB
Loading image diff...
Loading