OSDN Git Service

Don't recycle replaced nodes in a11y cache
authorPhil Weaver <pweaver@google.com>
Wed, 11 Oct 2017 19:53:54 +0000 (12:53 -0700)
committerPhil Weaver <pweaver@google.com>
Wed, 11 Oct 2017 22:51:33 +0000 (15:51 -0700)
commit9704426d14a69b1ffda278b9b5f65f7f41136347
tree483a5bec0cafc491df5ea6d317987b2aa8ef77ba
parent85e7dbc93ee35d134a75a352093baf29127715ea
Don't recycle replaced nodes in a11y cache

This is a patch for another bug. When the cache refreshes
nodes, it marks the transaction to bypass the cache. We
still, however, replace the cached node. If we recycle
the node as well, we end up refreshing it after it's been
recycled and end up with a sealed node in the cache. That
node can then be obtained and then throw an exception when
a setter is called. These exceptions are almost impossible
to debug.

I'm going to leave the bug open to roll this CL back and
fix the cache's behavior, but this fix seems safer this
late.

Bug: 35626351
Test: Ran a11y CTS and unit tests. Verified on instrumented
master build that the error indeed goes away. Removing one
line from unit tests that requires recycling.

Change-Id: Icc9a43ee49cf7c6bfa996839b35954faaf31621c
core/java/android/view/accessibility/AccessibilityCache.java
services/tests/servicestests/src/com/android/server/accessibility/AccessibilityCacheTest.java