Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 41785f61 authored by Minche Li's avatar Minche Li Committed by Automerger Merge Worker
Browse files

Merge "Removes the a11y service from the cached service list when...

Merge "Removes the a11y service from the cached service list when onPackageRemoved" into rvc-dev am: 179321d5

Change-Id: Ibb043667177fb395badb9e6117e570f7ea146230
parents 48126a5a 179321d5
Loading
Loading
Loading
Loading
+15 −11
Original line number Diff line number Diff line
@@ -132,6 +132,7 @@ import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;

/**
 * This class is instantiated by the system as a system level service and can be
@@ -391,7 +392,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
                        return;
                    }
                    // We will update when the automation service dies.
                    AccessibilityUserState userState = getCurrentUserStateLocked();
                    final AccessibilityUserState userState = getCurrentUserStateLocked();
                    // We have to reload the installed services since some services may
                    // have different attributes, resolve info (does not support equals),
                    // etc. Remove them then to force reload.
@@ -440,15 +441,18 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
                    if (userId != mCurrentUserId) {
                        return;
                    }
                    AccessibilityUserState userState = getUserStateLocked(userId);
                    Iterator<ComponentName> it = userState.mEnabledServices.iterator();
                    final AccessibilityUserState userState = getUserStateLocked(userId);
                    final Predicate<ComponentName> filter =
                            component -> component != null && component.getPackageName().equals(
                                    packageName);
                    userState.mBindingServices.removeIf(filter);
                    userState.mCrashedServices.removeIf(filter);
                    final Iterator<ComponentName> it = userState.mEnabledServices.iterator();
                    while (it.hasNext()) {
                        ComponentName comp = it.next();
                        String compPkg = comp.getPackageName();
                        final ComponentName comp = it.next();
                        final String compPkg = comp.getPackageName();
                        if (compPkg.equals(packageName)) {
                            it.remove();
                            userState.getBindingServicesLocked().remove(comp);
                            userState.getCrashedServicesLocked().remove(comp);
                            // Update the enabled services setting.
                            persistComponentNamesToSettingLocked(
                                    Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES,
@@ -476,11 +480,11 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
                    if (userId != mCurrentUserId) {
                        return false;
                    }
                    AccessibilityUserState userState = getUserStateLocked(userId);
                    Iterator<ComponentName> it = userState.mEnabledServices.iterator();
                    final AccessibilityUserState userState = getUserStateLocked(userId);
                    final Iterator<ComponentName> it = userState.mEnabledServices.iterator();
                    while (it.hasNext()) {
                        ComponentName comp = it.next();
                        String compPkg = comp.getPackageName();
                        final ComponentName comp = it.next();
                        final String compPkg = comp.getPackageName();
                        for (String pkg : packages) {
                            if (compPkg.equals(pkg)) {
                                if (!doit) {