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

Commit 18dcc695 authored by Rhed Jao's avatar Rhed Jao Committed by Android (Google) Code Review
Browse files

Merge "Fix a11y shortcut failed to be disabled by the warning dialog."

parents be69a3b6 f3fbcf5d
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -371,7 +371,9 @@ public class AccessibilityShortcutController {
        // targets during boot. Needs to read settings directly here.
        String shortcutTargets = Settings.Secure.getStringForUser(mContext.getContentResolver(),
                Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE, mUserId);
        if (TextUtils.isEmpty(shortcutTargets)) {
        // A11y warning dialog updates settings to empty string, when user disables a11y shortcut.
        // Only fallback to default a11y service, when setting is never updated.
        if (shortcutTargets == null) {
            shortcutTargets = mContext.getString(R.string.config_defaultAccessibilityService);
        }
        return !TextUtils.isEmpty(shortcutTargets);
+5 −4
Original line number Diff line number Diff line
@@ -1884,11 +1884,12 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
    }

    private boolean readAccessibilityShortcutKeySettingLocked(AccessibilityUserState userState) {
        final String settingValue = Settings.Secure.getStringForUser(mContext.getContentResolver(),
                Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE, userState.mUserId);
        final Set<String> targetsFromSetting = new ArraySet<>();
        readColonDelimitedSettingToSet(Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE,
                userState.mUserId, targetsFromSetting, str -> str);
        if (targetsFromSetting.isEmpty()) {
            // Fall back to device's default a11y service.
        readColonDelimitedStringToSet(settingValue, targetsFromSetting, false, str -> str);
        // Fall back to device's default a11y service, only when setting is never updated.
        if (settingValue == null) {
            final String defaultService = mContext.getString(
                    R.string.config_defaultAccessibilityService);
            if (!TextUtils.isEmpty(defaultService)) {