From f55cffb820ad6fd88a9c05d81c56f0f3f335e187 Mon Sep 17 00:00:00 2001 From: Abhijit Nukalapati Date: Fri, 17 Sep 2021 15:49:32 -0700 Subject: [PATCH] update bug report notification title Since the existing notification style sets maxLines to 2, the title was being truncated and the percentage was thus not visible to the user. As recommended by UX, we are updating the string so that it is no longer truncated and the percentage text is visible. Screenshots: Before - https://screenshot.googleplex.com/9U6RKuMcnECQ3pV After - https://screenshot.googleplex.com/8U9NCJHhR5qkRCD BUG: 198747050 Change-Id: I2b94cc65e2b9c3af860dd35532e1060814f6a68e (cherry picked from commit 262e835016e340e5fd7b5eb00b7ac6579ca127ae) --- packages/Shell/res/values-watch/strings.xml | 20 +++++++++++++++++++ .../shell/BugreportProgressService.java | 10 ++++++---- 2 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 packages/Shell/res/values-watch/strings.xml diff --git a/packages/Shell/res/values-watch/strings.xml b/packages/Shell/res/values-watch/strings.xml new file mode 100644 index 000000000000..5f7bfcb25d85 --- /dev/null +++ b/packages/Shell/res/values-watch/strings.xml @@ -0,0 +1,20 @@ + + + + + Bug report #%1$d is %2$s complete + diff --git a/packages/Shell/src/com/android/shell/BugreportProgressService.java b/packages/Shell/src/com/android/shell/BugreportProgressService.java index 8c7011253c8a..1f4ea95085b5 100644 --- a/packages/Shell/src/com/android/shell/BugreportProgressService.java +++ b/packages/Shell/src/com/android/shell/BugreportProgressService.java @@ -721,14 +721,16 @@ public class BugreportProgressService extends Service { nf.setMaximumFractionDigits(2); final String percentageText = nf.format((double) info.progress.intValue() / 100); - String title = mContext.getString(R.string.bugreport_in_progress_title, info.id); - - // TODO: Remove this workaround when notification progress is implemented on Wear. + final String title; if (mIsWatch) { + // TODO: Remove this workaround when notification progress is implemented on Wear. nf.setMinimumFractionDigits(0); nf.setMaximumFractionDigits(0); final String watchPercentageText = nf.format((double) info.progress.intValue() / 100); - title = title + "\n" + watchPercentageText; + title = mContext.getString( + R.string.bugreport_in_progress_title, info.id, watchPercentageText); + } else { + title = mContext.getString(R.string.bugreport_in_progress_title, info.id); } final String name =