From 5f7f4cb35d3e7bf3ae222e4c46fd0c61749ed9ca Mon Sep 17 00:00:00 2001 From: Schneider Victor-tulias Date: Thu, 28 Jan 2021 13:51:23 -0800 Subject: [PATCH] State download information in content description whether or not there was an update. Talkback wasn't announcing the incremental download/install progress if the progress wasn't updated. Updated BubbleTextView to update the content description with the incremental download/install info if the progress bar should be shown. Fixes: 149444435 Test: manual Change-Id: I3efe6e31cec389da4119a2179a341aedd074a0b7 --- res/values/strings.xml | 2 ++ src/com/android/launcher3/BubbleTextView.java | 26 ++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 3425f919c5..447c9ac568 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -232,6 +232,8 @@ The app for this icon isn\'t installed. You can remove it, or search for the app and install it manually. + + %1$s installing, %2$s complete %1$s downloading, %2$s complete diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java index 575d6cd8e6..ecda501f1f 100644 --- a/src/com/android/launcher3/BubbleTextView.java +++ b/src/com/android/launcher3/BubbleTextView.java @@ -289,6 +289,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, setTag(info); applyLoadingState(promiseStateChanged); applyDotState(info, false /* animate */); + setDownloadStateContentDescription(info, info.getProgressLevel()); } public void applyFromApplicationInfo(AppInfo info) { @@ -304,6 +305,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, applyProgressLevel(); } applyDotState(info, false /* animate */); + setDownloadStateContentDescription(info, info.getProgressLevel()); } /** @@ -316,6 +318,8 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, // Verify high res immediately verifyHighRes(); + + setDownloadStateContentDescription(info, info.getProgressLevel()); } /** @@ -635,9 +639,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, setContentDescription(info.contentDescription != null ? info.contentDescription : ""); } else if (progressLevel > 0) { - setContentDescription(getContext() - .getString(R.string.app_downloading_title, info.title, - NumberFormat.getPercentInstance().format(progressLevel * 0.01))); + setDownloadStateContentDescription(info, progressLevel); } else { setContentDescription(getContext() .getString(R.string.app_waiting_download_title, info.title)); @@ -713,6 +715,24 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, } } + private void setDownloadStateContentDescription(ItemInfoWithIcon info, int progressLevel) { + if ((info.runtimeStatusFlags & ItemInfoWithIcon.FLAG_SHOW_DOWNLOAD_PROGRESS_MASK) + != 0) { + String percentageString = NumberFormat.getPercentInstance() + .format(progressLevel * 0.01); + if ((info.runtimeStatusFlags & ItemInfoWithIcon.FLAG_INSTALL_SESSION_ACTIVE) != 0) { + setContentDescription(getContext() + .getString( + R.string.app_installing_title, info.title, percentageString)); + } else if ((info.runtimeStatusFlags + & ItemInfoWithIcon.FLAG_INCREMENTAL_DOWNLOAD_ACTIVE) != 0) { + setContentDescription(getContext() + .getString( + R.string.app_downloading_title, info.title, percentageString)); + } + } + } + /** * Sets the icon for this view based on the layout direction. */