Gestures don't work when turning on Explore by Touch pragmatically.
1. There was a misspelled duplicate member in the accessibility service
class which was causing inconsistent behavior because one field was
updated and another checked.
2. When the set of services that can put the device in explore by touch
mode changes we were disconnecting and reconnecting all services
and this is not correct. Now only the state of explore by touch is
updated appropriately.
bug:6798860
Change-Id: Ib3c119cef8e71c3458d56e4ce6fbde2c2f750dcd
diff --git a/services/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/java/com/android/server/accessibility/AccessibilityManagerService.java
index e42ec84..5650da8 100644
--- a/services/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -358,8 +358,7 @@
// We will update when the automation service dies.
if (mUiAutomationService == null) {
populateTouchExplorationGrantedAccessibilityServicesLocked();
- unbindAllServicesLocked();
- manageServicesLocked();
+ handleTouchExplorationGrantedAccessibilityServicesChangedLocked();
}
}
}
@@ -624,7 +623,7 @@
// enabled accessibility services.
for (int i = mServices.size() - 1; i >= 0; i--) {
Service service = mServices.get(i);
- if (service.mReqeustTouchExplorationMode && service.mIsDefault == isDefault) {
+ if (service.mRequestTouchExplorationMode && service.mIsDefault == isDefault) {
service.notifyGesture(gestureId);
return true;
}
@@ -1000,6 +999,22 @@
Settings.Secure.TOUCH_EXPLORATION_ENABLED, 0) == 1;
}
+ private void handleTouchExplorationGrantedAccessibilityServicesChangedLocked() {
+ final int serviceCount = mServices.size();
+ for (int i = 0; i < serviceCount; i++) {
+ Service service = mServices.get(i);
+ if (service.mRequestTouchExplorationMode
+ && mTouchExplorationGrantedServices.contains(service.mComponentName)) {
+ tryEnableTouchExplorationLocked(service);
+ return;
+ }
+ }
+ if (mIsTouchExplorationEnabled) {
+ mMainHandler.obtainMessage(MSG_TOGGLE_TOUCH_EXPLORATION, 0,
+ 0).sendToTarget();
+ }
+ }
+
private void tryEnableTouchExplorationLocked(final Service service) {
if (!mIsTouchExplorationEnabled && service.mRequestTouchExplorationMode) {
final boolean canToggleTouchExploration = mTouchExplorationGrantedServices.contains(
@@ -1163,8 +1178,6 @@
boolean mCanRetrieveScreenContent;
- boolean mReqeustTouchExplorationMode;
-
boolean mIsAutomation;
final Rect mTempBounds = new Rect();
@@ -1204,7 +1217,7 @@
mIsAutomation = isAutomation;
if (!isAutomation) {
mCanRetrieveScreenContent = accessibilityServiceInfo.getCanRetrieveWindowContent();
- mReqeustTouchExplorationMode =
+ mRequestTouchExplorationMode =
(accessibilityServiceInfo.flags
& AccessibilityServiceInfo.FLAG_REQUEST_TOUCH_EXPLORATION_MODE) != 0;
mIntent = new Intent().setComponent(mComponentName);