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

Commit 712d5fd7 authored by Kevin Yao's avatar Kevin Yao Committed by android-build-merger
Browse files

Merge "User education support on disambiguation dialog" into qt-dev am: 327751f1

am: ece8f00c

Change-Id: I99e41bc1cdd3a25e4884ba7ed7e77ab6bd7cf14e
parents 5c2b8d2f ece8f00c
Loading
Loading
Loading
Loading
+26 −1
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@
 */
package com.android.internal.app;

import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;

import android.accessibilityservice.AccessibilityServiceInfo;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -64,8 +66,21 @@ public class AccessibilityButtonChooserActivity extends Activity {

        String component = Settings.Secure.getString(getContentResolver(),
                Settings.Secure.ACCESSIBILITY_BUTTON_TARGET_COMPONENT);

        if (isGestureNavigateEnabled()) {
            TextView promptPrologue = findViewById(R.id.accessibility_button_prompt_prologue);
            promptPrologue.setText(isTouchExploreOn()
                    ? R.string.accessibility_gesture_3finger_prompt_text
                    : R.string.accessibility_gesture_prompt_text);
        }

        if (TextUtils.isEmpty(component)) {
            TextView prompt = findViewById(R.id.accessibility_button_prompt);
            if (isGestureNavigateEnabled()) {
                prompt.setText(isTouchExploreOn()
                        ? R.string.accessibility_gesture_3finger_instructional_text
                        : R.string.accessibility_gesture_instructional_text);
            }
            prompt.setVisibility(View.VISIBLE);
        }

@@ -91,6 +106,16 @@ public class AccessibilityButtonChooserActivity extends Activity {
        });
    }

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

    private boolean isTouchExploreOn() {
        return ((AccessibilityManager) getSystemService(Context.ACCESSIBILITY_SERVICE))
                .isTouchExplorationEnabled();
    }

    private static List<AccessibilityButtonTarget> getServiceAccessibilityButtonTargets(
            @NonNull Context context) {
        AccessibilityManager ams = (AccessibilityManager) context.getSystemService(
+1 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:minHeight="56dp"
            android:id="@+id/accessibility_button_prompt_prologue"
            android:textAppearance="?attr/textAppearanceMedium"
            android:text="@string/accessibility_button_prompt_text"
            android:gravity="start|center_vertical"
+10 −2
Original line number Diff line number Diff line
@@ -4498,10 +4498,18 @@
        <xliff:g id="service_name" example="TalkBack">%1$s</xliff:g></string>

    <!-- Text appearing in a prompt at the top of UI allowing the user to select a target service or feature to be assigned to the Accessibility button in the navigation bar. -->
    <string name="accessibility_button_prompt_text">Choose a feature to use when you tap the Accessibility button:</string>
    <string name="accessibility_button_prompt_text">Choose a service to use when you tap the accessibility button:</string>
    <!-- Text appearing in a prompt at the top of UI allowing the user to select a target service or feature to be assigned to the Accessibility button when gesture navigation is enabled [CHAR LIMIT=none] -->
    <string name="accessibility_gesture_prompt_text">Choose a service to use with the accessibility gesture (swipe up from the bottom of the screen with two fingers):</string>
    <!-- Text appearing in a prompt at the top of UI allowing the user to select a target service or feature to be assigned to the Accessibility button when gesture navigation and TalkBack is enabled [CHAR LIMIT=none] -->
    <string name="accessibility_gesture_3finger_prompt_text">Choose a service to use with the accessibility gesture (swipe up from the bottom of the screen with three fingers):</string>

    <!-- Text describing how to display UI allowing a user to select a target service or feature to be assigned to the Accessibility button in the navigation bar. -->
    <string name="accessibility_button_instructional_text">To change features, touch &amp; hold the Accessibility button.</string>
    <string name="accessibility_button_instructional_text">To switch between services, touch &amp; hold the accessibility button.</string>
    <!-- Text describing how to display UI allowing a user to select a target service or feature to be assigned to the Accessibility button when gesture navigation is enabled. [CHAR LIMIT=none] -->
    <string name="accessibility_gesture_instructional_text">To switch between services, swipe up with two fingers and hold.</string>
    <!-- Text describing how to display UI allowing a user to select a target service or feature to be assigned to the Accessibility button when gesture navigation and TalkBack is enabled. [CHAR LIMIT=none] -->
    <string name="accessibility_gesture_3finger_instructional_text">To switch between services, swipe up with three fingers and hold.</string>

    <!-- Text used to describe system navigation features, shown within a UI allowing a user to assign system magnification features to the Accessibility button in the navigation bar. -->
    <string name="accessibility_magnification_chooser_text">Magnification</string>
+7 −0
Original line number Diff line number Diff line
@@ -3282,9 +3282,16 @@
  <java-symbol type="layout" name="accessibility_button_chooser_item" />
  <java-symbol type="id" name="accessibility_button_chooser_grid" />
  <java-symbol type="id" name="accessibility_button_prompt" />
  <java-symbol type="id" name="accessibility_button_prompt_prologue" />
  <java-symbol type="id" name="accessibility_button_target_icon" />
  <java-symbol type="id" name="accessibility_button_target_label" />
  <java-symbol type="string" name="accessibility_magnification_chooser_text" />

  <java-symbol type="string" name="accessibility_gesture_prompt_text" />
  <java-symbol type="string" name="accessibility_gesture_3finger_prompt_text" />
  <java-symbol type="string" name="accessibility_gesture_instructional_text" />
  <java-symbol type="string" name="accessibility_gesture_3finger_instructional_text" />

  <java-symbol type="drawable" name="ic_accessibility_magnification" />

  <!-- com.android.internal.widget.RecyclerView -->