Fix a11y service targeting sdk version doesn't update

The accessibility service connection uses old service info
to create connection while the system is trying to rebind the
enabled services after packages finished updated. The root
cause is we always reloaded the installed service info after
the a11y services were rebound. To fix this issue, always
reloads the installed service info before rebinds the services.

Bug: 152817355
Test: All a11y related cts tests
Change-Id: Iab424940fc47b5a5f44096d67dc7bdfe2d43c5be
This commit is contained in:
Rhed Jao
2020-04-01 11:21:36 +08:00
parent 60e3892fec
commit f74e5ccbe5

View File

@@ -414,7 +414,12 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
&& component.getPackageName().equals(packageName))
|| userState.mCrashedServices.removeIf(component -> component != null
&& component.getPackageName().equals(packageName));
if (reboundAService) {
// Reloads the installed services info to make sure the rebound service could
// get a new one.
userState.mInstalledServices.clear();
final boolean configurationChanged =
readConfigurationForUserStateLocked(userState);
if (reboundAService || configurationChanged) {
onUserStateChangedLocked(userState);
}
migrateAccessibilityButtonSettingsIfNecessaryLocked(userState, packageName);