Updating content description for the shortcuts menu and announcing
it when the container is opened
Bug: 30587453
Change-Id: I6f2d3ba05593f3e2a1a8f05c66a0f80e76932c38
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 2bc0cae..d11d5a5 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -254,4 +254,7 @@
<!-- Accessibility action to show quick actions menu for an icon. [CHAR_LIMIT=30] -->
<string name="action_deep_shortcut">Shortcuts</string>
+ <!-- Accessibility description for the shortcuts menu shown for an app. -->
+ <string name="shortcuts_menu_description"><xliff:g id="number_of_shortcuts" example="3">%1$d</xliff:g> shortcuts for <xliff:g id="app_name" example="Messenger">%2$s</xliff:g></string>
+
</resources>
diff --git a/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java b/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java
index 53a28de..3d1bee5 100644
--- a/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java
+++ b/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java
@@ -40,6 +40,7 @@
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
+import android.view.accessibility.AccessibilityEvent;
import android.view.animation.DecelerateInterpolator;
import android.widget.LinearLayout;
@@ -147,6 +148,8 @@
shortcut.getBubbleText().setAccessibilityDelegate(mAccessibilityDelegate);
addView(shortcut);
}
+ setContentDescription(getContext().getString(R.string.shortcuts_menu_description,
+ numShortcuts, originalIcon.getContentDescription().toString()));
measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
orientAboutIcon(originalIcon);
@@ -276,6 +279,8 @@
@Override
public void onAnimationEnd(Animator animation) {
mOpenCloseAnimator = null;
+
+ sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
}
});