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

Commit 05b19d6d authored by Riley Jones's avatar Riley Jones
Browse files

Refactoring AccessibilityManagerService Read & Restore

Implemented parameterized readA11yShortcutTarget and restoreA11yShortcutTarget functions

Test: atest com.android.server.accessibility
Flag: EXEMPT internal refactoring
Bug: 330775538
Change-Id: Ib96aadcfe80b93d5d801126bb9c01f7c251d2404
parent fe04c2b4
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -180,6 +180,26 @@ public final class ShortcutUtils {
        }
    }

    /**
     * Converts {@link Settings.Secure} key to {@link UserShortcutType}.
     *
     * @param key The shortcut key.
     * @return Mapping type in Settings.
     */
    public static int convertToType(String key) {
        return switch (key) {
            case Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS -> UserShortcutType.SOFTWARE;
            case Settings.Secure.ACCESSIBILITY_QS_TARGETS -> UserShortcutType.QUICK_SETTINGS;
            case Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE -> UserShortcutType.HARDWARE;
            case Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED ->
                    UserShortcutType.TRIPLETAP;
            case Settings.Secure.ACCESSIBILITY_MAGNIFICATION_TWO_FINGER_TRIPLE_TAP_ENABLED ->
                    UserShortcutType.TWOFINGER_DOUBLETAP;
            default -> throw new IllegalArgumentException(
                    "Unsupported user shortcut key: " + key);
        };
    }

    /**
     * Updates an accessibility state if the accessibility service is a Always-On a11y service,
     * a.k.a. AccessibilityServices that has FLAG_REQUEST_ACCESSIBILITY_BUTTON
+106 −167

File changed.

Preview size limit exceeded, changes collapsed.

+37 −13

File changed.

Preview size limit exceeded, changes collapsed.

+7 −6

File changed.

Preview size limit exceeded, changes collapsed.

+4 −3

File changed.

Preview size limit exceeded, changes collapsed.