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

Commit 7befb7de authored by Svetoslav Ganov's avatar Svetoslav Ganov
Browse files

Global gesture to toggle Accessibility system-wide.

1. This change adds a global gesture for enabling accessibility.
   To enable this gesture the user has to allow it from the
   accessibility settings or use the setup wizard to enable
   accessibility. When the global gesture is enabled the user
   can long press on power to bring the global actions dialog
   and then hold with two fingers for a few seconds to enable
   accessibility. The appropriate feedback is also provided.

2. The global gesture is writing directly into the settings for
   the current user if performed when the keyguard is not on. If
   the keygaurd is on and the current user has no accessibility
   enabled, the gesture will temporary enable accessibility
   for the current user, i.e. no settings are changed, to allow
   the blind user to log into his account. As soon as a user
   switch happens the new user settings are inherited. If no
   user change happens after temporary enabling accessibility
   the temporary changes will be undone when the keyguard goes
   away and the device will works as expected by the current user.

bug:6171929

3. The initialization code for the owner was not executed due
   to a redundant check, thus putting the accessibility layer in
   an inconsistent state which breaks pretty much everything.

bug:7240414

Change-Id: Ie7d7aba80f5867b7f88d5893b848b53fb02a7537
parent 5e9187a3
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -3300,7 +3300,7 @@ public final class Settings {
            "enabled_accessibility_services";

        /**
         * List of the accessibility services to which the user has graned
         * List of the accessibility services to which the user has granted
         * permission to put the device into touch exploration mode.
         *
         * @hide
@@ -3319,7 +3319,7 @@ public final class Settings {
         * <p>
         *   Note: The JavaScript based screen-reader is served by the
         *   Google infrastructure and enable users with disabilities to
         *   efficiantly navigate in and explore web content.
         *   efficiently navigate in and explore web content.
         * </p>
         * <p>
         *   This property represents a boolean value.
@@ -3331,7 +3331,7 @@ public final class Settings {

        /**
         * The URL for the injected JavaScript based screen-reader used
         * for providing accessiblity of content in WebView.
         * for providing accessibility of content in WebView.
         * <p>
         *   Note: The JavaScript based screen-reader is served by the
         *   Google infrastructure and enable users with disabilities to
@@ -4109,6 +4109,15 @@ public final class Settings {
         */
        public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/global");

        /**
         * Setting whether the global gesture for enabling accessibility is enabled.
         * If this gesture is enabled the user will be able to perfrom it to enable
         * the accessibility state without visiting the settings app.
         * @hide
         */
        public static final String ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED =
                "enable_accessibility_global_gesture_enabled";

        /**
         * Whether Airplane Mode is on.
         */
+4 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ package android.view.accessibility;
import android.accessibilityservice.AccessibilityServiceInfo;
import android.accessibilityservice.IAccessibilityServiceConnection;
import android.accessibilityservice.IAccessibilityServiceClient;
import android.content.ComponentName;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.accessibility.IAccessibilityInteractionConnection;
@@ -53,4 +54,7 @@ interface IAccessibilityManager {
        in AccessibilityServiceInfo info);

    void unregisterUiTestAutomationService(IAccessibilityServiceClient client);

    void temporaryEnableAccessibilityStateUntilKeyguardRemoved(in ComponentName service,
            boolean touchExplorationEnabled);
}
+6 −0
Original line number Diff line number Diff line
@@ -1578,6 +1578,12 @@
        android:description="@string/permdesc_retrieve_window_info"
        android:protectionLevel="signature" />

    <!-- @hide Allows an application to temporary enable accessibility on the device. -->
    <permission android:name="android.permission.TEMPORARY_ENABLE_ACCESSIBILITY"
        android:label="@string/permlab_temporary_enable_accessibility"
        android:description="@string/permdesc_temporary_enable_accessibility"
        android:protectionLevel="signature" />

    <!-- @hide Allows an application to magnify the content of a display. -->
    <permission android:name="android.permission.MAGNIFY_DISPLAY"
        android:label="@string/permlab_magnify_display"
+3 −0
Original line number Diff line number Diff line
@@ -285,4 +285,7 @@
    <!-- Space reserved at the bottom of secure views (pin/pattern/password/SIM pin/SIM puk) -->
    <dimen name="kg_secure_padding_height">46dp</dimen>

    <!-- Touch slop for the global toggle accessibility gesture -->
    <dimen name="accessibility_touch_slop">80dip</dimen>

</resources>
+16 −0
Original line number Diff line number Diff line
@@ -743,6 +743,13 @@
        the content of the active window. Malicious apps may retrieve
        the entire window content and examine all its text except passwords.</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_temporary_enable_accessibility">temporary enable 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_temporary_enable_accessibility">Allows an application to temporarily
         enable accessibility on the device. Malicious apps may enable accessibility without
         user consent.</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_retrieve_window_info">retrieve window info</string>
    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
@@ -3903,4 +3910,13 @@
    </string>


    <!-- Text spoken when the user is performing a gesture that will enable accessibility. [CHAR LIMIT=none] -->
    <string name="continue_to_enable_accessibility">Continue touching the screen to enable accessibility.</string>
    <!-- Text spoken when the user enabled accessibility. [CHAR LIMIT=none] -->
    <string name="accessibility_enabled">Accessibility enabled.</string>
    <!-- Text spoken when the user stops preforming a gesture that would enable accessibility. [CHAR LIMIT=none] -->
    <string name="enable_accessibility_canceled">Enable accessibility canceled.</string>
    <!-- Text spoken when the current user is switched if accessibility is enabled. [CHAR LIMIT=none] -->
    <string name="user_switched">Switched to user <xliff:g id="name" example="Bob">%1$s</xliff:g>.</string>

</resources>
Loading