summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Hiroki Sato <hirokisato@google.com> 2024-02-01 15:22:00 +0900
committer Hiroki Sato <hirokisato@google.com> 2024-02-02 19:52:31 +0900
commitcfe9107604db01cbd8602da114cbeb3ed6487a74 (patch)
tree9a9062a11f064e24a14609600863b33202f1325a
parent984306a8e6d0cd8faafffe57dca58552f9cdcd29 (diff)
Updates event source to important parent only when events are merged
This is a partial revert of CL [1]. CL [1] changed two things: - Makes sure that event source is an important node when sending a SUBTREE_CHANGED events. This event type is always sent to services, This ensures that accessibility services can recognize event sources. - Adds SUBTREE_CHANGED type to the event change types when events from multiple nodes are merged into one. The primary motivation of [1] was to make sure AccessibilityCache is correctly invalidated, and this is accomplished only by the second change. Further, although the first change aims to provide more correct behavior, it resulted in a regression of some performance metrics. Thus, this CL reverts the first part of change. [1] Ic71f22ed6f6f54f49810dc83dc85dcd492dfc104 Bug: 322652084 Bug: 277305460 Test: ABTD to check the preformance regression. Test: CtsAccessibilityTestCases CtsAccessibilityServiceTestCases Change-Id: I1d9d4f6b2e4a1f34a97a3cc562f1a9c12ef67aaf
-rw-r--r--core/java/android/view/ViewRootImpl.java12
1 files changed, 3 insertions, 9 deletions
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index c18aeee52460..2daaa5dcd49c 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -11522,15 +11522,6 @@ public final class ViewRootImpl implements ViewParent,
event.setContentChangeTypes(mChangeTypes);
if (mAction.isPresent()) event.setAction(mAction.getAsInt());
if (AccessibilityEvent.DEBUG_ORIGIN) event.originStackTrace = mOrigin;
-
- if (fixMergedContentChangeEvent()) {
- if ((mChangeTypes & AccessibilityEvent.CONTENT_CHANGE_TYPE_SUBTREE) != 0) {
- final View importantParent = source.getSelfOrParentImportantForA11y();
- if (importantParent != null) {
- source = importantParent;
- }
- }
- }
source.sendAccessibilityEventUnchecked(event);
} else {
mLastEventTimeMillis = 0;
@@ -11567,6 +11558,9 @@ public final class ViewRootImpl implements ViewParent,
if (mSource != null) {
if (fixMergedContentChangeEvent()) {
View newSource = getCommonPredecessor(mSource, source);
+ if (newSource != null) {
+ newSource = newSource.getSelfOrParentImportantForA11y();
+ }
if (newSource == null) {
// If there is no common predecessor, then mSource points to
// a removed view, hence in this case always prefer the source.