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

Commit f90ab868 authored by PETER LIANG's avatar PETER LIANG Committed by Automerger Merge Worker
Browse files

Merge changes from topic "a11y_floating_menu_migration_tooltip" into sc-dev am: 74a43585

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13990513

Change-Id: I5d688ef85c073567950abb0b4f552157750d1836
parents d13a047f 74a43585
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -9920,6 +9920,18 @@ public final class Settings {
        public static final String ACCESSIBILITY_FLOATING_MENU_OPACITY =
                "accessibility_floating_menu_opacity";
        /**
         * Prompts the user to the Accessibility button is replaced with the floating menu.
         * <ul>
         *    <li> 0 = disabled </li>
         *    <li> 1 = enabled </li>
         * </ul>
         *
         * @hide
         */
        public static final String ACCESSIBILITY_FLOATING_MENU_MIGRATION_TOOLTIP_PROMPT =
                "accessibility_floating_menu_migration_tooltip_prompt";
        /**
         * Whether the Adaptive connectivity option is enabled.
         *
+5 −0
Original line number Diff line number Diff line
@@ -86,6 +86,11 @@ public class AccessibilityShortcutController {
    public static final ComponentName REDUCE_BRIGHT_COLORS_COMPONENT_NAME =
            new ComponentName("com.android.server.accessibility", "ReduceBrightColors");

    // The component name for the sub setting of Accessibility button in Accessibility settings
    public static final ComponentName ACCESSIBILITY_BUTTON_COMPONENT_NAME =
            new ComponentName("com.android.server.accessibility", "AccessibilityButton");


    private static final AudioAttributes VIBRATION_ATTRIBUTES = new AudioAttributes.Builder()
            .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
            .setUsage(AudioAttributes.USAGE_ASSISTANCE_ACCESSIBILITY)
+21 −4
Original line number Diff line number Diff line
@@ -4944,6 +4944,15 @@ public class SettingsProvider extends ContentProvider {
                                    String.valueOf(defAccessibilityButtonMode), /* tag= */
                                    null, /* makeDefault= */ true,
                                    SettingsState.SYSTEM_PACKAGE_NAME);

                            if (hasValueInA11yButtonTargets(secureSettings)) {
                                secureSettings.insertSettingLocked(
                                        Secure.ACCESSIBILITY_FLOATING_MENU_MIGRATION_TOOLTIP_PROMPT,
                                        /* enabled */ "1",
                                        /* tag= */ null,
                                        /* makeDefault= */ false,
                                        SettingsState.SYSTEM_PACKAGE_NAME);
                            }
                        }
                    }

@@ -5170,13 +5179,21 @@ public class SettingsProvider extends ContentProvider {
        }

        private boolean isAccessibilityButtonInNavigationBarOn(SettingsState secureSettings) {
            final boolean hasValueInA11yBtnTargets = !TextUtils.isEmpty(
                    secureSettings.getSettingLocked(
                            Secure.ACCESSIBILITY_BUTTON_TARGETS).getValue());
            return hasValueInA11yButtonTargets(secureSettings) && !isGestureNavigateEnabled();
        }

        private boolean isGestureNavigateEnabled() {
            final int navigationMode = getContext().getResources().getInteger(
                    com.android.internal.R.integer.config_navBarInteractionMode);
            return navigationMode == NAV_BAR_MODE_GESTURAL;
        }

        private boolean hasValueInA11yButtonTargets(SettingsState secureSettings) {
            final Setting a11yButtonTargetsSettings =
                    secureSettings.getSettingLocked(Secure.ACCESSIBILITY_BUTTON_TARGETS);

            return hasValueInA11yBtnTargets && (navigationMode != NAV_BAR_MODE_GESTURAL);
            return !a11yButtonTargetsSettings.isNull()
                    && !TextUtils.isEmpty(a11yButtonTargetsSettings.getValue());
        }
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -752,6 +752,7 @@ public class SettingsBackupTest {
                 Settings.Secure.SUPPRESS_DOZE,
                 Settings.Secure.REDUCE_BRIGHT_COLORS_ACTIVATED,
                 Settings.Secure.ACCESSIBILITY_SHOW_WINDOW_MAGNIFICATION_PROMPT,
                 Settings.Secure.ACCESSIBILITY_FLOATING_MENU_MIGRATION_TOOLTIP_PROMPT,
                 Settings.Secure.UI_TRANSLATION_ENABLED);

    @Test
+23 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (C) 2021 The Android Open Source Project

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->

<shape xmlns:android="http://schemas.android.com/apk/res/android"
       xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
       android:shape="rectangle">
    <solid android:color="?androidprv:attr/colorAccentPrimary" />
    <corners android:radius="@dimen/accessibility_floating_tooltip_text_corner_radius" />
</shape>
Loading