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

Commit 958d17bb authored by Chun-Ku Lin's avatar Chun-Ku Lin Committed by Android (Google) Code Review
Browse files

Merge "Reflect QS shortcut changes in a11y pages." into main

parents 59007733 deba8599
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -175,6 +175,9 @@ public class AccessibilitySettings extends DashboardFragment implements
        // Observe changes from accessibility selection menu
        shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS);
        shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE);
        if (android.view.accessibility.Flags.a11yQsShortcut()) {
            shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_QS_TARGETS);
        }
        shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_STICKY_KEYS);
        shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_SLOW_KEYS);
        shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_BOUNCE_KEYS);
+3 −0
Original line number Diff line number Diff line
@@ -125,6 +125,9 @@ public abstract class AccessibilityShortcutPreferenceFragment extends Restricted
        final List<String> shortcutFeatureKeys = new ArrayList<>();
        shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS);
        shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE);
        if (android.view.accessibility.Flags.a11yQsShortcut()) {
            shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_QS_TARGETS);
        }
        mSettingsContentObserver = new AccessibilitySettingsContentObserver(new Handler());
        mSettingsContentObserver.registerKeysToObserverCallback(shortcutFeatureKeys, key -> {
            updateShortcutPreferenceData();
+3 −0
Original line number Diff line number Diff line
@@ -74,6 +74,9 @@ public class ColorAndMotionFragment extends DashboardFragment {
        mShortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED);
        mShortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE);
        mShortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS);
        if (android.view.accessibility.Flags.a11yQsShortcut()) {
            mShortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_QS_TARGETS);
        }
        if (Flags.forceInvertColor()) {
            mShortcutFeatureKeys.add(ToggleForceInvertPreferenceController.SETTINGS_KEY);
        }
+3 −0
Original line number Diff line number Diff line
@@ -179,6 +179,9 @@ public abstract class ToggleFeaturePreferenceFragment extends DashboardFragment
        final List<String> shortcutFeatureKeys = new ArrayList<>();
        shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS);
        shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE);
        if (android.view.accessibility.Flags.a11yQsShortcut()) {
            shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_QS_TARGETS);
        }
        return shortcutFeatureKeys;
    }

+15 −0
Original line number Diff line number Diff line
@@ -50,6 +50,8 @@ public class OneHandedSettingsUtils {
            Settings.Secure.getUriFor(Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS);
    static final Uri HARDWARE_SHORTCUT_ENABLED_URI =
            Settings.Secure.getUriFor(Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE);
    static final Uri QS_SHORTCUT_ENABLED_URI =
            Settings.Secure.getUriFor(Settings.Secure.ACCESSIBILITY_QS_TARGETS);

    public enum OneHandedTimeout {
        NEVER(0), SHORT(4), MEDIUM(8), LONG(12);
@@ -254,6 +256,16 @@ public class OneHandedSettingsUtils {
        if (!TextUtils.isEmpty(targetsHW) && targetsHW.contains(ONE_HANDED_MODE_TARGET_NAME)) {
            return true;
        }

        if (android.view.accessibility.Flags.a11yQsShortcut()) {
            // Checks QS_SHORTCUT_KEY
            final String targetsQs = Settings.Secure.getStringForUser(context.getContentResolver(),
                    Settings.Secure.ACCESSIBILITY_QS_TARGETS, sCurrentUserId);
            if (!TextUtils.isEmpty(targetsQs) && targetsQs.contains(ONE_HANDED_MODE_TARGET_NAME)) {
                return true;
            }
        }

        return false;
    }

@@ -301,6 +313,9 @@ public class OneHandedSettingsUtils {
            resolver.registerContentObserver(SHOW_NOTIFICATION_ENABLED_URI, true, this);
            resolver.registerContentObserver(SOFTWARE_SHORTCUT_ENABLED_URI, true, this);
            resolver.registerContentObserver(HARDWARE_SHORTCUT_ENABLED_URI, true, this);
            if (android.view.accessibility.Flags.a11yQsShortcut()) {
                resolver.registerContentObserver(QS_SHORTCUT_ENABLED_URI, true, this);
            }
        }

        @Override
Loading