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

Commit cc797d59 authored by Phil Weaver's avatar Phil Weaver
Browse files

Double-check a11y node sealing during refresh

I believe this line can detect when a node is
recycled during a refresh. This change is much
more targeted than preventing all interactions
with recycled nodes.

Bug: 37858096
Test: A11y CTS and unit tests
Change-Id: I07dd6c2eccd2ba26347f42d4ecd2cefb684e2c8e
parent cf190ce1
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -870,6 +870,11 @@ public class AccessibilityNodeInfo implements Parcelable {
        if (refreshedInfo == null) {
            return false;
        }
        // Hard-to-reproduce bugs seem to be due to some tools recycling a node on another
        // thread. If that happens, the init will re-seal the node, which then is in a bad state
        // when it is obtained. Enforce sealing again before we init to fail when a node has been
        // recycled during a refresh to catch such errors earlier.
        enforceSealed();
        init(refreshedInfo);
        refreshedInfo.recycle();
        return true;