AccessibilityManagerService not registered for removed packages.
The pakcage monitor in the AccessibilityManagerService was not watching for packages that are removed. This is needes since 1) we need to remove the package from the enabled accessibility serivces and clean up after the removed serivice; 2) we need to disable accessibility if the last access serivices went away. Change-Id: I06d33b411ce60703e5a2843107323ffc87046c16
This commit is contained in:
@ -189,6 +189,22 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPackageRemoved(String packageName, int uid) {
|
||||
synchronized (mLock) {
|
||||
Iterator<ComponentName> it = mEnabledServices.iterator();
|
||||
while (it.hasNext()) {
|
||||
ComponentName comp = it.next();
|
||||
String compPkg = comp.getPackageName();
|
||||
if (compPkg.equals(packageName)) {
|
||||
it.remove();
|
||||
updateEnabledAccessibilitySerivcesSettingLocked(mEnabledServices);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onHandleForceStop(Intent intent, String[] packages,
|
||||
int uid, boolean doit) {
|
||||
@ -209,18 +225,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
}
|
||||
}
|
||||
if (changed) {
|
||||
it = mEnabledServices.iterator();
|
||||
StringBuilder str = new StringBuilder();
|
||||
while (it.hasNext()) {
|
||||
if (str.length() > 0) {
|
||||
str.append(':');
|
||||
}
|
||||
str.append(it.next().flattenToShortString());
|
||||
}
|
||||
Settings.Secure.putString(mContext.getContentResolver(),
|
||||
Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES,
|
||||
str.toString());
|
||||
manageServicesLocked();
|
||||
updateEnabledAccessibilitySerivcesSettingLocked(mEnabledServices);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -252,6 +257,21 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
||||
|
||||
super.onReceive(context, intent);
|
||||
}
|
||||
|
||||
private void updateEnabledAccessibilitySerivcesSettingLocked(
|
||||
Set<ComponentName> enabledServices) {
|
||||
Iterator<ComponentName> it = enabledServices.iterator();
|
||||
StringBuilder str = new StringBuilder();
|
||||
while (it.hasNext()) {
|
||||
if (str.length() > 0) {
|
||||
str.append(':');
|
||||
}
|
||||
str.append(it.next().flattenToShortString());
|
||||
}
|
||||
Settings.Secure.putString(mContext.getContentResolver(),
|
||||
Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES,
|
||||
str.toString());
|
||||
}
|
||||
};
|
||||
|
||||
// package changes
|
||||
|
Reference in New Issue
Block a user