Merge "Disable all A11yServices from an uninstalled package." into rvc-dev

This commit is contained in:
Daniel Norman
2022-10-17 19:44:35 +00:00
committed by Android (Google) Code Review

View File

@@ -456,25 +456,27 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
userState.mBindingServices.removeIf(filter); userState.mBindingServices.removeIf(filter);
userState.mCrashedServices.removeIf(filter); userState.mCrashedServices.removeIf(filter);
final Iterator<ComponentName> it = userState.mEnabledServices.iterator(); final Iterator<ComponentName> it = userState.mEnabledServices.iterator();
boolean anyServiceRemoved = false;
while (it.hasNext()) { while (it.hasNext()) {
final ComponentName comp = it.next(); final ComponentName comp = it.next();
final String compPkg = comp.getPackageName(); final String compPkg = comp.getPackageName();
if (compPkg.equals(packageName)) { if (compPkg.equals(packageName)) {
it.remove(); it.remove();
// Update the enabled services setting.
persistComponentNamesToSettingLocked(
Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES,
userState.mEnabledServices, userId);
// Update the touch exploration granted services setting.
userState.mTouchExplorationGrantedServices.remove(comp); userState.mTouchExplorationGrantedServices.remove(comp);
persistComponentNamesToSettingLocked( anyServiceRemoved = true;
Settings.Secure.
TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES,
userState.mTouchExplorationGrantedServices, userId);
onUserStateChangedLocked(userState);
return;
} }
} }
if (anyServiceRemoved) {
// Update the enabled services setting.
persistComponentNamesToSettingLocked(
Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES,
userState.mEnabledServices, userId);
// Update the touch exploration granted services setting.
persistComponentNamesToSettingLocked(
Settings.Secure.TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES,
userState.mTouchExplorationGrantedServices, userId);
onUserStateChangedLocked(userState);
}
} }
} }