Tweak behavior of isAccessibilityDataPrivate() to reduce CPU usage.
Changes:
- Cache the value of isAccessibilityDataPrivate().
- Change callers to check if the a11y service isAccessibilityTool
first where possible, to prevent unnecessary calls to
isAccessibilityDataPrivate() for "happy use case" users (anyone
not using a non-a11y-tool).
Using simpleperf during UI benchmark test, % of CPU in frameworks.jar
from isAccessibilityDataPrivate():
- before: 71.6% ( :O )
- after: 0.25%
Bug: 242267091
Test: atest com.android.uibench.microbenchmark.UiBenchBrowseContentScrollNoBitmapUploadMicrobenchmark#testBrowseContentScrollNoBitmapUpload
Change-Id: Ie0c89c2fb893be1c7347a0acfb0ede0993034ee6
3 files changed