summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Calvin Pan <calvinpan@google.com> 2022-01-17 12:03:28 +0800
committer Calvin Pan <calvinpan@google.com> 2022-01-26 11:55:10 +0800
commit4ffb7e888439cf1d6fd6be4d3b06104c83a1f0d7 (patch)
tree776eeaaf6f91e64f0a13989a3740e47b81b697a7
parentbf4e15d0176c5e0d24ddcb84d839b7056faf6d16 (diff)
Clean <plurals> in BugreportProgressService
Bug: 199230228 Test: make Change-Id: I888c65c8819eb5443178ddfc2097d3519b89cefb
-rw-r--r--core/res/res/values/strings.xml9
-rw-r--r--core/res/res/values/symbols.xml2
-rw-r--r--packages/Shell/src/com/android/shell/BugreportProgressService.java12
3 files changed, 15 insertions, 8 deletions
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 5242b955917b..3fc0d95ded38 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -689,10 +689,11 @@
your device is unresponsive or too slow, or when you need all report sections.
Does not allow you to enter more details or take additional screenshots.</string>
<!-- Toast message informing user in how many seconds a bugreport screenshot will be taken -->
- <plurals name="bugreport_countdown">
- <item quantity="one">Taking screenshot for bug report in <xliff:g id="number">%d</xliff:g> second.</item>
- <item quantity="other">Taking screenshot for bug report in <xliff:g id="number">%d</xliff:g> seconds.</item>
- </plurals>
+ <string name="bugreport_countdown">{count, plural,
+ =1 {Taking screenshot for bug report in # second.}
+ other {Taking screenshot for bug report in # seconds.}
+ }
+ </string>
<!-- Format for build summary info [CHAR LIMIT=NONE] -->
<string name="bugreport_status" translatable="false">%s (%s)</string>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 76e0994d7b18..6fca95926323 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -1260,9 +1260,9 @@
<java-symbol type="string" name="conference_call" />
<java-symbol type="string" name="tooltip_popup_title" />
- <java-symbol type="plurals" name="bugreport_countdown" />
<java-symbol type="plurals" name="last_num_days" />
<java-symbol type="plurals" name="restr_pin_countdown" />
+ <java-symbol type="string" name="bugreport_countdown" />
<java-symbol type="string" name="file_count" />
<java-symbol type="string" name="matches_found" />
<java-symbol type="plurals" name="pinpuk_attempts" />
diff --git a/packages/Shell/src/com/android/shell/BugreportProgressService.java b/packages/Shell/src/com/android/shell/BugreportProgressService.java
index c5a01a1c2b93..0b8bd9784b7d 100644
--- a/packages/Shell/src/com/android/shell/BugreportProgressService.java
+++ b/packages/Shell/src/com/android/shell/BugreportProgressService.java
@@ -72,6 +72,7 @@ import android.text.format.DateUtils;
import android.util.Log;
import android.util.Pair;
import android.util.Patterns;
+import android.util.PluralsMessageFormatter;
import android.util.SparseArray;
import android.view.ContextThemeWrapper;
import android.view.IWindowManager;
@@ -111,7 +112,9 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Enumeration;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
@@ -943,9 +946,12 @@ public class BugreportProgressService extends Service {
}
setTakingScreenshot(true);
collapseNotificationBar();
- final String msg = mContext.getResources()
- .getQuantityString(com.android.internal.R.plurals.bugreport_countdown,
- mScreenshotDelaySec, mScreenshotDelaySec);
+ Map<String, Object> arguments = new HashMap<>();
+ arguments.put("count", mScreenshotDelaySec);
+ final String msg = PluralsMessageFormatter.format(
+ mContext.getResources(),
+ arguments,
+ com.android.internal.R.string.bugreport_countdown);
Log.i(TAG, msg);
// Show a toast just once, otherwise it might be captured in the screenshot.
Toast.makeText(mContext, msg, Toast.LENGTH_SHORT).show();