Skip to content

Commit 7befb7d

Browse files
committed
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
1 parent 5e9187a commit 7befb7d

File tree

10 files changed

+621
-23
lines changed

10 files changed

+621
-23
lines changed

core/java/android/provider/Settings.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3300,7 +3300,7 @@ public static final String getBluetoothInputDevicePriorityKey(String address) {
33003300
"enabled_accessibility_services";
33013301

33023302
/**
3303-
* List of the accessibility services to which the user has graned
3303+
* List of the accessibility services to which the user has granted
33043304
* permission to put the device into touch exploration mode.
33053305
*
33063306
* @hide
@@ -3319,7 +3319,7 @@ public static final String getBluetoothInputDevicePriorityKey(String address) {
33193319
* <p>
33203320
* Note: The JavaScript based screen-reader is served by the
33213321
* Google infrastructure and enable users with disabilities to
3322-
* efficiantly navigate in and explore web content.
3322+
* efficiently navigate in and explore web content.
33233323
* </p>
33243324
* <p>
33253325
* This property represents a boolean value.
@@ -3331,7 +3331,7 @@ public static final String getBluetoothInputDevicePriorityKey(String address) {
33313331

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

4112+
/**
4113+
* Setting whether the global gesture for enabling accessibility is enabled.
4114+
* If this gesture is enabled the user will be able to perfrom it to enable
4115+
* the accessibility state without visiting the settings app.
4116+
* @hide
4117+
*/
4118+
public static final String ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED =
4119+
"enable_accessibility_global_gesture_enabled";
4120+
41124121
/**
41134122
* Whether Airplane Mode is on.
41144123
*/

core/java/android/view/accessibility/IAccessibilityManager.aidl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ package android.view.accessibility;
2020
import android.accessibilityservice.AccessibilityServiceInfo;
2121
import android.accessibilityservice.IAccessibilityServiceConnection;
2222
import android.accessibilityservice.IAccessibilityServiceClient;
23+
import android.content.ComponentName;
2324
import android.view.accessibility.AccessibilityEvent;
2425
import android.view.accessibility.AccessibilityNodeInfo;
2526
import android.view.accessibility.IAccessibilityInteractionConnection;
@@ -53,4 +54,7 @@ interface IAccessibilityManager {
5354
in AccessibilityServiceInfo info);
5455

5556
void unregisterUiTestAutomationService(IAccessibilityServiceClient client);
57+
58+
void temporaryEnableAccessibilityStateUntilKeyguardRemoved(in ComponentName service,
59+
boolean touchExplorationEnabled);
5660
}

core/res/AndroidManifest.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,6 +1578,12 @@
15781578
android:description="@string/permdesc_retrieve_window_info"
15791579
android:protectionLevel="signature" />
15801580

1581+
<!-- @hide Allows an application to temporary enable accessibility on the device. -->
1582+
<permission android:name="android.permission.TEMPORARY_ENABLE_ACCESSIBILITY"
1583+
android:label="@string/permlab_temporary_enable_accessibility"
1584+
android:description="@string/permdesc_temporary_enable_accessibility"
1585+
android:protectionLevel="signature" />
1586+
15811587
<!-- @hide Allows an application to magnify the content of a display. -->
15821588
<permission android:name="android.permission.MAGNIFY_DISPLAY"
15831589
android:label="@string/permlab_magnify_display"

core/res/res/values/dimens.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,4 +285,7 @@
285285
<!-- Space reserved at the bottom of secure views (pin/pattern/password/SIM pin/SIM puk) -->
286286
<dimen name="kg_secure_padding_height">46dp</dimen>
287287

288+
<!-- Touch slop for the global toggle accessibility gesture -->
289+
<dimen name="accessibility_touch_slop">80dip</dimen>
290+
288291
</resources>

core/res/res/values/strings.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,13 @@
743743
the content of the active window. Malicious apps may retrieve
744744
the entire window content and examine all its text except passwords.</string>
745745

746+
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
747+
<string name="permlab_temporary_enable_accessibility">temporary enable accessibility</string>
748+
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
749+
<string name="permdesc_temporary_enable_accessibility">Allows an application to temporarily
750+
enable accessibility on the device. Malicious apps may enable accessibility without
751+
user consent.</string>
752+
746753
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
747754
<string name="permlab_retrieve_window_info">retrieve window info</string>
748755
<!-- 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 @@
39033910
</string>
39043911

39053912

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

core/res/res/values/symbols.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@
290290

291291
<java-symbol type="color" name="tab_indicator_text_v4" />
292292

293+
<java-symbol type="dimen" name="accessibility_touch_slop" />
293294
<java-symbol type="dimen" name="config_prefDialogWidth" />
294295
<java-symbol type="dimen" name="config_viewConfigurationTouchSlop" />
295296
<java-symbol type="dimen" name="default_app_widget_padding_bottom" />
@@ -357,6 +358,7 @@
357358
<java-symbol type="string" name="abbrev_month_day_year" />
358359
<java-symbol type="string" name="abbrev_month_year" />
359360
<java-symbol type="string" name="accept" />
361+
<java-symbol type="string" name="accessibility_enabled" />
360362
<java-symbol type="string" name="activity_chooser_view_see_all" />
361363
<java-symbol type="string" name="activitychooserview_choose_application" />
362364
<java-symbol type="string" name="alternate_eri_file" />
@@ -437,6 +439,7 @@
437439
<java-symbol type="string" name="contentServiceSync" />
438440
<java-symbol type="string" name="contentServiceSyncNotificationTitle" />
439441
<java-symbol type="string" name="contentServiceTooManyDeletesNotificationDesc" />
442+
<java-symbol type="string" name="continue_to_enable_accessibility" />
440443
<java-symbol type="string" name="date1_date2" />
441444
<java-symbol type="string" name="date1_time1_date2_time2" />
442445
<java-symbol type="string" name="date_and_time" />
@@ -470,6 +473,7 @@
470473
<java-symbol type="string" name="emailTypeWork" />
471474
<java-symbol type="string" name="emergency_call_dialog_number_for_display" />
472475
<java-symbol type="string" name="emergency_calls_only" />
476+
<java-symbol type="string" name="enable_accessibility_canceled" />
473477
<java-symbol type="string" name="eventTypeAnniversary" />
474478
<java-symbol type="string" name="eventTypeBirthday" />
475479
<java-symbol type="string" name="eventTypeCustom" />
@@ -778,6 +782,7 @@
778782
<java-symbol type="string" name="twelve_hour_time_format" />
779783
<java-symbol type="string" name="twenty_four_hour_time_format" />
780784
<java-symbol type="string" name="upload_file" />
785+
<java-symbol type="string" name="user_switched" />
781786
<java-symbol type="string" name="volume_alarm" />
782787
<java-symbol type="string" name="volume_icon_description_bluetooth" />
783788
<java-symbol type="string" name="volume_icon_description_incall" />

0 commit comments

Comments
 (0)