summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/com/android/internal/app/AccessibilityButtonChooserActivity.java27
-rw-r--r--core/res/res/layout/accessibility_button_chooser.xml1
-rw-r--r--core/res/res/values/strings.xml12
-rw-r--r--core/res/res/values/symbols.xml7
4 files changed, 44 insertions, 3 deletions
diff --git a/core/java/com/android/internal/app/AccessibilityButtonChooserActivity.java b/core/java/com/android/internal/app/AccessibilityButtonChooserActivity.java
index b9ed96395130..7af45fc53ddf 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<AccessibilityButtonTarget> 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 480defbd5935..383780a3ccde 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 5b917cc4fdf1..d46b3760f51e 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -4495,10 +4495,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>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 4af05f699073..89cfa11a7737 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -3286,9 +3286,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 -->