Add notification count to content description for badged apps

Bug: 70389249
Change-Id: If7f43941d501ba807adbb33d489da3944c012e94
diff --git a/res/values/strings.xml b/res/values/strings.xml
index ee09946..2318e9e 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -132,6 +132,11 @@
     <!-- Accessibility -->
     <!-- The format string for when an app is temporarily disabled. -->
     <string name="disabled_app_label">Disabled <xliff:g id="app_name" example="Messenger">%1$s</xliff:g></string>
+    <!-- The format string for when an app has a notification dot (meaning it has associated notifications). -->
+    <plurals name="badged_app_label">
+        <item quantity="one"><xliff:g id="app_name" example="Messenger">%1$s</xliff:g>, has <xliff:g id="notification_count" example="1">%2$d</xliff:g> notification</item>
+        <item quantity="other"><xliff:g id="app_name" example="Messenger">%1$s</xliff:g>, has <xliff:g id="notification_count" example="3">%2$d</xliff:g> notifications</item>
+    </plurals>
     <skip />
 
     <!-- The format string for default page scroll text [CHAR_LIMIT=none] -->
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index 46d7227..dbdb2dc 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -560,6 +560,15 @@
                     invalidate();
                 }
             }
+            if (itemInfo.contentDescription != null) {
+                if (hasBadge()) {
+                    int count = mBadgeInfo.getNotificationCount();
+                    setContentDescription(getContext().getResources().getQuantityString(
+                            R.plurals.badged_app_label, count, itemInfo.contentDescription, count));
+                } else {
+                    setContentDescription(itemInfo.contentDescription);
+                }
+            }
         }
     }