diff --git a/core/java/com/android/internal/app/AccessibilityButtonChooserActivity.java b/core/java/com/android/internal/app/AccessibilityButtonChooserActivity.java index b9ed963951304..7af45fc53ddf9 100644 --- a/core/java/com/android/internal/app/AccessibilityButtonChooserActivity.java +++ b/core/java/com/android/internal/app/AccessibilityButtonChooserActivity.java @@ -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 getServiceAccessibilityButtonTargets( @NonNull Context context) { AccessibilityManager ams = (AccessibilityManager) context.getSystemService( @@ -177,4 +202,4 @@ public class AccessibilityButtonChooserActivity extends Activity { return mDrawable; } } -} \ No newline at end of file +} diff --git a/core/res/res/layout/accessibility_button_chooser.xml b/core/res/res/layout/accessibility_button_chooser.xml index 480defbd5935f..383780a3ccdec 100644 --- a/core/res/res/layout/accessibility_button_chooser.xml +++ b/core/res/res/layout/accessibility_button_chooser.xml @@ -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" diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 5b917cc4fdf17..d46b3760f51e0 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -4495,10 +4495,18 @@ %1$s - Choose a feature to use when you tap the Accessibility button: + Choose a service to use when you tap the accessibility button: + + Choose a service to use with the accessibility gesture (swipe up from the bottom of the screen with two fingers): + + Choose a service to use with the accessibility gesture (swipe up from the bottom of the screen with three fingers): - To change features, touch & hold the Accessibility button. + To switch between services, touch & hold the accessibility button. + + To switch between services, swipe up with two fingers and hold. + + To switch between services, swipe up with three fingers and hold. Magnification diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 4af05f6990736..89cfa11a7737a 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -3286,9 +3286,16 @@ + + + + + + +