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

Commit f3fbcf5d authored by Rhed Jao's avatar Rhed Jao
Browse files

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

Bug: 147330765
Test: atest AccessibilityShortcutControllerTest
Change-Id: I0eed04c7892a22be3721ca08562fb9121a257847
parent 805b26ac
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
@@ -1883,11 +1883,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)) {