Cache whether accessibility is enabled to avoid repeated remote calls

AccessibilityUtils#isAccessibilityEnabled() is called quite frequently.
Under some conditions, this method makes a remote call to get the list
of all enabled accessibility services, which can be slow. Help reduce
jank by caching whether accessibility is enabled in a static variable
the first time #isAccessibiltyEnabled is called.

This variable is reset when any activity is resumed since the user can
change accessibility settings while not in the application.
ChromeActivity also resets the value when accessibility state changes.

BUG=906303

Change-Id: Ie26d8295b183dc7fa8ac61115c75c31f7d524acf
Reviewed-on: https://chromium-review.googlesource.com/c/1461326
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Commit-Queue: Theresa <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#631499}
2 files changed