diff --git a/core/java/android/widget/PopupWindow.java b/core/java/android/widget/PopupWindow.java
index 8464c6e47d474..f6653fbfc08cc 100644
--- a/core/java/android/widget/PopupWindow.java
+++ b/core/java/android/widget/PopupWindow.java
@@ -208,6 +208,9 @@ public class PopupWindow {
private int mGravity = Gravity.NO_GRAVITY;
+ // Title provided to accessibility services
+ private CharSequence mAccessibilityTitle;
+
private static final int[] ABOVE_ANCHOR_STATE_SET = new int[] {
com.android.internal.R.attr.state_above_anchor
};
@@ -1131,6 +1134,31 @@ public class PopupWindow {
return mIsShowing;
}
+ /**
+ * Set the title for this window to be reported to accessibility services. If no title is set,
+ * a generic default will be reported.
+ *
+ * @param accessibilityTitle The new title, or {@code null} to specify that the default should
+ * be used.
+ * @hide
+ */
+ public void setAccessibilityTitle(@Nullable CharSequence accessibilityTitle) {
+ mAccessibilityTitle = accessibilityTitle;
+ }
+
+ /**
+ * Get the title for this window to be reported to accessibility services.
+ *
+ * @return The current title.
+ * @hide
+ */
+ public @NonNull CharSequence getAccessibilityTitle() {
+ if (mAccessibilityTitle == null) {
+ mAccessibilityTitle = mContext.getString(R.string.popup_window_default_title);
+ }
+ return mAccessibilityTitle;
+ }
+
/** @hide */
protected final void setShowing(boolean isShowing) {
mIsShowing = isShowing;
@@ -1496,6 +1524,7 @@ public class PopupWindow {
// Used for debugging.
p.setTitle("PopupWindow:" + Integer.toHexString(hashCode()));
+ p.accessibilityTitle = getAccessibilityTitle();
return p;
}
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 97b6940a1d391..f48e037c8e475 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -4706,4 +4706,7 @@
SIM not provisioned
SIM not allowed
Phone not allowed
+
+
+ Popup Window
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 023b032390189..7cee6d698c813 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -3049,4 +3049,5 @@
+