Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f404193c authored by Evan Rosky's avatar Evan Rosky
Browse files

Reduce Accessibility animation-wait timeout

Logic on the client-side often uses a similar mechanism
(waiting for no-changes) to detect idle-ness. The most widely
used (esp. in tests) is UiAutomator which happens to share
the same 500ms timeout. This means there is a race between
the timers+binder where, accessibility will have up-to-date
information, but not send it because it is still getting
updates from surfaceflinger. To prevent data from getting
too stale, lower the timeout here so that the client can
receive the latest window information before timing-out and
using stale information to perform other operations

Bug: 258073789
Test: atest NexusLauncherTests:AddConfigWidgetTest#testWidgetConfig
Change-Id: I7c32acbc36810d74fe1baff538e26f0899a730aa
parent c2d3644f
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -56,8 +56,11 @@ public final class AccessibilityWindowsPopulator extends WindowInfosListener {
    private static final int SURFACE_FLINGER_CALLBACK_WINDOWS_STABLE_TIMES_MS = 35;
    private static final int SURFACE_FLINGER_CALLBACK_WINDOWS_STABLE_TIMES_MS = 35;
    // To avoid the surface flinger callbacks always comes within in 2 frames, then no windows
    // To avoid the surface flinger callbacks always comes within in 2 frames, then no windows
    // are reported to the A11y framework, and the animation duration time is 500ms, so setting
    // are reported to the A11y framework, and the animation duration time is 500ms, so setting
    // this value as the max timeout value to force computing changed windows.
    // this value as the max timeout value to force computing changed windows. However, since
    private static final int WINDOWS_CHANGED_NOTIFICATION_MAX_DURATION_TIMES_MS = 500;
    // UiAutomator waits 500ms to determine that things are idle. Since we aren't actually idle,
    // we need to reduce the timeout here a little so that we can deliver an updated state before
    // UiAutomator reports idle based-on stale information.
    private static final int WINDOWS_CHANGED_NOTIFICATION_MAX_DURATION_TIMES_MS = 450;


    private static final float[] sTempFloats = new float[9];
    private static final float[] sTempFloats = new float[9];