summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Sally <sallyyuen@google.com> 2024-02-13 22:02:41 +0000
committer Sally <sallyyuen@google.com> 2024-02-13 22:02:41 +0000
commit3134865b4d36d5ca93cffa3167faaf39abb9b0bc (patch)
tree488e37ba5082d9d37ef65b5f9e68252b8df77dcd
parent976207c49e9573d03badfe0057862fd2dcb051e6 (diff)
Only request a layout for non-empty accessibility focus rects
The original fix here: ag/22622669 is aggressive for when to perform layouts and will request a layout when the rect is empty, but the actual new traversal logic only applies when the rect is non-empty. Narrowing so we don't request for empty rects will eliminate unneccessary layouts and fix a serious a11y bug of a drop down preference spinner closing itself immediately when opened. This is because the pop-up appearing caused the focus to disappear, causing the focus rect to be empty and triggering global layout change that the spinner responds with by closing itself. For more details, please see the analysis at b/320398253. Test: manual Bug: 320398253 Change-Id: I845da4d5ff1a9271e885448b8d6b9cb537f0c33c
-rw-r--r--core/java/android/view/ViewRootImpl.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 7bc832ef9e3f..8bb7beaa4dbb 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -5143,7 +5143,10 @@ public final class ViewRootImpl implements ViewParent,
// Force recalculation of transparent regions
if (accessibilityFocusDirty) {
- requestLayout();
+ final Rect bounds = mAttachInfo.mTmpInvalRect;
+ if (getAccessibilityFocusedRect(bounds)) {
+ requestLayout();
+ }
}
mAttachInfo.mDrawingTime =