summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/view/AccessibilityInteractionController.java42
-rw-r--r--core/java/android/view/ViewRootImpl.java9
-rw-r--r--core/java/android/view/accessibility/IAccessibilityInteractionConnection.aidl2
-rw-r--r--core/res/res/values/ids.xml3
-rw-r--r--core/res/res/values/symbols.xml1
-rw-r--r--packages/SystemUI/src/com/android/systemui/pip/phone/PipAccessibilityInteractionConnection.java5
-rw-r--r--services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java16
7 files changed, 55 insertions, 23 deletions
diff --git a/core/java/android/view/AccessibilityInteractionController.java b/core/java/android/view/AccessibilityInteractionController.java
index 0051d01eec13..bbd44c8b85af 100644
--- a/core/java/android/view/AccessibilityInteractionController.java
+++ b/core/java/android/view/AccessibilityInteractionController.java
@@ -682,14 +682,6 @@ public final class AccessibilityInteractionController {
// Handle this hidden action separately
succeeded = handleClickableSpanActionUiThread(
target, virtualDescendantId, arguments);
- } else if (action == R.id.accessibilityActionOutsideTouch) {
- // trigger ACTION_OUTSIDE to notify windows
- final long now = SystemClock.uptimeMillis();
- MotionEvent event = MotionEvent.obtain(now, now, MotionEvent.ACTION_OUTSIDE,
- 0, 0, 0);
- event.setSource(InputDevice.SOURCE_TOUCHSCREEN);
- mViewRootImpl.dispatchInputEvent(event);
- succeeded = true;
} else {
AccessibilityNodeProvider provider = target.getAccessibilityNodeProvider();
if (provider != null) {
@@ -756,6 +748,33 @@ public final class AccessibilityInteractionController {
}
}
+ /**
+ * Notify outside touch event to the target window.
+ */
+ public void notifyOutsideTouchClientThread() {
+ final Message message = mHandler.obtainMessage();
+ message.what = PrivateHandler.MSG_NOTIFY_OUTSIDE_TOUCH;
+
+ // Don't care about pid and tid because there's no interrogating client for this message.
+ scheduleMessage(message, 0, 0, CONSIDER_REQUEST_PREPARERS);
+ }
+
+ private void notifyOutsideTouchUiThread() {
+ if (mViewRootImpl.mView == null || mViewRootImpl.mAttachInfo == null
+ || mViewRootImpl.mStopped || mViewRootImpl.mPausedForTransition) {
+ return;
+ }
+ final View root = mViewRootImpl.mView;
+ if (root != null && isShown(root)) {
+ // trigger ACTION_OUTSIDE to notify windows
+ final long now = SystemClock.uptimeMillis();
+ final MotionEvent event = MotionEvent.obtain(now, now, MotionEvent.ACTION_OUTSIDE,
+ 0, 0, 0);
+ event.setSource(InputDevice.SOURCE_TOUCHSCREEN);
+ mViewRootImpl.dispatchInputEvent(event);
+ }
+ }
+
private View findViewByAccessibilityId(int accessibilityId) {
if (accessibilityId == AccessibilityNodeInfo.ROOT_ITEM_ID) {
return mViewRootImpl.mView;
@@ -1328,6 +1347,8 @@ public final class AccessibilityInteractionController {
private static final int FIRST_NO_ACCESSIBILITY_CALLBACK_MSG = 100;
private static final int MSG_CLEAR_ACCESSIBILITY_FOCUS =
FIRST_NO_ACCESSIBILITY_CALLBACK_MSG + 1;
+ private static final int MSG_NOTIFY_OUTSIDE_TOUCH =
+ FIRST_NO_ACCESSIBILITY_CALLBACK_MSG + 2;
public PrivateHandler(Looper looper) {
super(looper);
@@ -1357,6 +1378,8 @@ public final class AccessibilityInteractionController {
return "MSG_APP_PREPARATION_TIMEOUT";
case MSG_CLEAR_ACCESSIBILITY_FOCUS:
return "MSG_CLEAR_ACCESSIBILITY_FOCUS";
+ case MSG_NOTIFY_OUTSIDE_TOUCH:
+ return "MSG_NOTIFY_OUTSIDE_TOUCH";
default:
throw new IllegalArgumentException("Unknown message type: " + type);
}
@@ -1396,6 +1419,9 @@ public final class AccessibilityInteractionController {
case MSG_CLEAR_ACCESSIBILITY_FOCUS: {
clearAccessibilityFocusUiThread();
} break;
+ case MSG_NOTIFY_OUTSIDE_TOUCH: {
+ notifyOutsideTouchUiThread();
+ } break;
default:
throw new IllegalArgumentException("Unknown message type: " + type);
}
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 7ad118e760d8..e71c7edc0a53 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -8819,6 +8819,15 @@ public final class ViewRootImpl implements ViewParent,
.clearAccessibilityFocusClientThread();
}
}
+
+ @Override
+ public void notifyOutsideTouch() {
+ ViewRootImpl viewRootImpl = mViewRootImpl.get();
+ if (viewRootImpl != null && viewRootImpl.mView != null) {
+ viewRootImpl.getAccessibilityInteractionController()
+ .notifyOutsideTouchClientThread();
+ }
+ }
}
private class SendWindowContentChangedAccessibilityEvent implements Runnable {
diff --git a/core/java/android/view/accessibility/IAccessibilityInteractionConnection.aidl b/core/java/android/view/accessibility/IAccessibilityInteractionConnection.aidl
index 947ff056627e..deb0d2a3fd3d 100644
--- a/core/java/android/view/accessibility/IAccessibilityInteractionConnection.aidl
+++ b/core/java/android/view/accessibility/IAccessibilityInteractionConnection.aidl
@@ -57,4 +57,6 @@ oneway interface IAccessibilityInteractionConnection {
int interrogatingPid, long interrogatingTid);
void clearAccessibilityFocus();
+
+ void notifyOutsideTouch();
}
diff --git a/core/res/res/values/ids.xml b/core/res/res/values/ids.xml
index ce7995a93f7f..2b0c86b49577 100644
--- a/core/res/res/values/ids.xml
+++ b/core/res/res/values/ids.xml
@@ -185,9 +185,6 @@
<!-- Accessibility action identifier for {@link android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction#ACTION_HIDE_TOOLTIP}. -->
<item type="id" name="accessibilityActionHideTooltip" />
- <!-- Accessibility action to notify a window there is an outside touch. -->
- <item type="id" name="accessibilityActionOutsideTouch" />
-
<!-- A tag used to save the view added to a transition overlay -->
<item type="id" name="transition_overlay_view_tag" />
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index bebba5435c40..470c9ed472dc 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -245,7 +245,6 @@
<java-symbol type="id" name="selection_end_handle" />
<java-symbol type="id" name="insertion_handle" />
<java-symbol type="id" name="accessibilityActionClickOnClickableSpan" />
- <java-symbol type="id" name="accessibilityActionOutsideTouch" />
<java-symbol type="id" name="camera" />
<java-symbol type="id" name="mic" />
<java-symbol type="id" name="overlay" />
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipAccessibilityInteractionConnection.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipAccessibilityInteractionConnection.java
index 60dceef23f7c..84f7e89d9f2f 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipAccessibilityInteractionConnection.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipAccessibilityInteractionConnection.java
@@ -170,6 +170,11 @@ public class PipAccessibilityInteractionConnection
// We should not be here.
}
+ @Override
+ public void notifyOutsideTouch() {
+ // Do nothing.
+ }
+
public static AccessibilityNodeInfo obtainRootAccessibilityNodeInfo() {
AccessibilityNodeInfo info = AccessibilityNodeInfo.obtain();
info.setSourceNodeId(AccessibilityNodeInfo.ROOT_NODE_ID,
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
index 334262fa3570..05b937a34626 100644
--- a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -2722,9 +2722,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
return -1;
}
- private void notifyOutsideTouchIfNeeded(int targetWindowId, int action, Bundle arguments,
- int interactionId, IAccessibilityInteractionConnectionCallback callback, int fetchFlags,
- int interrogatingPid, long interrogatingTid) {
+ private void notifyOutsideTouchIfNeeded(int targetWindowId, int action) {
if (action != ACTION_CLICK && action != ACTION_LONG_CLICK) {
return;
}
@@ -2741,13 +2739,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
final RemoteAccessibilityConnection connection = connectionList.get(i);
if (connection != null) {
try {
- connection.mConnection.performAccessibilityAction(
- AccessibilityNodeInfo.ROOT_ITEM_ID,
- R.id.accessibilityActionOutsideTouch, arguments, interactionId,
- callback, fetchFlags, interrogatingPid, interrogatingTid);
+ connection.getRemote().notifyOutsideTouch();
} catch (RemoteException re) {
if (DEBUG) {
- Slog.e(LOG_TAG, "Error calling performAccessibilityAction: " + re);
+ Slog.e(LOG_TAG, "Error calling notifyOutsideTouch()");
}
}
}
@@ -2833,8 +2828,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
mPowerManager.userActivity(SystemClock.uptimeMillis(),
PowerManager.USER_ACTIVITY_EVENT_ACCESSIBILITY, 0);
- notifyOutsideTouchIfNeeded(resolvedWindowId, action, arguments, interactionId, callback,
- fetchFlags, interrogatingPid, interrogatingTid);
+ notifyOutsideTouchIfNeeded(resolvedWindowId, action);
if (activityToken != null) {
LocalServices.getService(ActivityTaskManagerInternal.class)
.setFocusedActivity(activityToken);
@@ -3790,7 +3784,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
private List<Integer> getWatchOutsideTouchWindowIdLocked(int targetWindowId) {
final WindowInfo targetWindow = mWindowInfoById.get(targetWindowId);
- if (targetWindow != null && mWindowInfoById != null && mHasWatchOutsideTouchWindow) {
+ if (targetWindow != null && mHasWatchOutsideTouchWindow) {
final List<Integer> outsideWindowsId = new ArrayList<>();
for (int i = 0; i < mWindowInfoById.size(); i++) {
WindowInfo window = mWindowInfoById.valueAt(i);