Removes posting to a handler for onWindowInfosChanged.
This handler post was originally added to fix an ANR in b/221497060 but
that underlying lock issue has since been resolved in b/222421815.
Now, this handler post can cause OOM in extreme cases when hundreds of
messages are posted before being handled.
It should be safe to remove given that the locking issue is resolved.
Bug: 333834990
Test: Drag app from taskbar to split screen, observe no ANR
Change-Id: I5e391bb375105f369586374e38a8980a12b449b8
diff --git a/services/accessibility/accessibility.aconfig b/services/accessibility/accessibility.aconfig
index 8ab2e0f..a7fdd77 100644
--- a/services/accessibility/accessibility.aconfig
+++ b/services/accessibility/accessibility.aconfig
@@ -122,6 +122,16 @@
}
flag {
+ name: "remove_on_window_infos_changed_handler"
+ namespace: "accessibility"
+ description: "Updates onWindowInfosChanged() to run without posting to a handler."
+ bug: "333834990"
+ metadata {
+ purpose: PURPOSE_BUGFIX
+ }
+}
+
+flag {
name: "reset_hover_event_timer_on_action_up"
namespace: "accessibility"
description: "Reset the timer for sending hover events on receiving ACTION_UP to guarantee the correct amount of time is available between taps."
diff --git a/services/core/java/com/android/server/wm/AccessibilityWindowsPopulator.java b/services/core/java/com/android/server/wm/AccessibilityWindowsPopulator.java
index f6afc52..3393d3e 100644
--- a/services/core/java/com/android/server/wm/AccessibilityWindowsPopulator.java
+++ b/services/core/java/com/android/server/wm/AccessibilityWindowsPopulator.java
@@ -150,7 +150,11 @@
@Override
public void onWindowInfosChanged(InputWindowHandle[] windowHandles,
DisplayInfo[] displayInfos) {
- mHandler.post(() -> onWindowInfosChangedInternal(windowHandles, displayInfos));
+ if (com.android.server.accessibility.Flags.removeOnWindowInfosChangedHandler()) {
+ onWindowInfosChangedInternal(windowHandles, displayInfos);
+ } else {
+ mHandler.post(() -> onWindowInfosChangedInternal(windowHandles, displayInfos));
+ }
}
private void onWindowInfosChangedInternal(InputWindowHandle[] windowHandles,