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

Commit 311fac7e authored by Svetoslav Ganov's avatar Svetoslav Ganov Committed by Android (Google) Code Review
Browse files

Merge "Disable accessibility if all accessibility serivces are disbaled."

parents 44445730 37fedf8b
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -697,6 +697,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
    private void manageServicesLocked() {
        populateEnabledServicesLocked(mEnabledServices);
        updateServicesStateLocked(mInstalledServices, mEnabledServices);
        disableAccessibilityIfNoEnabledServices(mEnabledServices);
    }

    /**
@@ -780,6 +781,19 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
        }
    }

    /**
     * Disables accessibility if there are no enabled accessibility services which
     * to consume the generated accessibility events.
     *
     * @param enabledServices The set of enabled services.
     */
    private void disableAccessibilityIfNoEnabledServices(Set<ComponentName> enabledServices) {
        if (enabledServices.isEmpty()) {
            Settings.Secure.putInt(mContext.getContentResolver(),
                    Settings.Secure.ACCESSIBILITY_ENABLED, 0);
        }
    }

    /**
     * Sends the state to the clients.
     */