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

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

Merge "Add the default a11y service to the target shortcut service when turns...

Merge "Add the default a11y service to the target shortcut service when turns on the default shortcut." into main
parents c7da918b 3b926f13
Loading
Loading
Loading
Loading
+27 −4
Original line number Diff line number Diff line
@@ -128,7 +128,7 @@ public class AccessibilityShortcutController {
            DialogStatus.SHOWN,
    })
    /** Denotes the user shortcut type. */
    private @interface DialogStatus {
    @interface DialogStatus {
        int NOT_SHOWN = 0;
        int SHOWN  = 1;
    }
@@ -338,7 +338,30 @@ public class AccessibilityShortcutController {
                .setTitle(getShortcutWarningTitle(targets))
                .setMessage(getShortcutWarningMessage(targets))
                .setCancelable(false)
                .setNegativeButton(R.string.accessibility_shortcut_on, null)
                .setNegativeButton(R.string.accessibility_shortcut_on,
                        (DialogInterface d, int which) -> {
                            String targetServices = Settings.Secure.getStringForUser(
                                    mContext.getContentResolver(),
                                    Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE, userId);
                            String defaultService = mContext.getString(
                                    R.string.config_defaultAccessibilityService);
                            // If the targetServices is null, means the user enables a
                            // shortcut for the default service by triggering the volume keys
                            // shortcut in the SUW instead of intentionally configuring the
                            // shortcut on UI.
                            if (targetServices == null && !TextUtils.isEmpty(defaultService)) {
                                // The defaultService in the string resource could be a shorten
                                // form like com.google.android.marvin.talkback/.TalkBackService.
                                // Converts it to the componentName for consistency before saving
                                // to the Settings.
                                final ComponentName configDefaultService =
                                        ComponentName.unflattenFromString(defaultService);
                                Settings.Secure.putStringForUser(mContext.getContentResolver(),
                                        Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE,
                                        configDefaultService.flattenToString(),
                                        userId);
                            }
                        })
                .setPositiveButton(R.string.accessibility_shortcut_off,
                        (DialogInterface d, int which) -> {
                            Settings.Secure.putStringForUser(mContext.getContentResolver(),
+138 −57

File changed.

Preview size limit exceeded, changes collapsed.