summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Kevin Jeon <kevinjeon@google.com> 2023-09-28 17:35:56 -0400
committer Kevin Jeon <kevinjeon@google.com> 2023-09-28 18:16:56 -0400
commite84af98835bf99fce80ef7572f8c5841e449aa73 (patch)
treecc2b4fd447657121fdee3eb24ee6693f22d82882
parent4d91e437b0674047de0ad0ef1eb0dd6634177c29 (diff)
Fix incorrect number formatting in dumpsys meminfo
This change updates the printRow() helper method that ActivityThread.dumpMemInfo() references to include Locale.US, so that numbers will be formatted correctly. This change also replaces an incorrect %s with %d in the format string used for three-column rows. Test: Change the system locale to a different language (Arabic) and verify that dumpsys meminfo produces correctly-formatted values. Bug: 301934161 Change-Id: If814796a1cf0302a54a02fa23e82d21a3213ea10
-rw-r--r--core/java/android/app/ActivityThread.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 183783bdf309..9a90df93b2cd 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -263,6 +263,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.TimeZone;
@@ -3033,7 +3034,7 @@ public final class ActivityThread extends ClientTransactionHandler
"%13s %8s %8s %8s %8s %8s %8s %8s %8s";
private static final String ONE_COUNT_COLUMN = "%21s %8d";
private static final String TWO_COUNT_COLUMNS = "%21s %8d %21s %8d";
- private static final String THREE_COUNT_COLUMNS = "%21s %8d %21s %8s %21s %8d";
+ private static final String THREE_COUNT_COLUMNS = "%21s %8d %21s %8d %21s %8d";
private static final String TWO_COUNT_COLUMN_HEADER = "%21s %8s %21s %8s";
private static final String ONE_ALT_COUNT_COLUMN = "%21s %8s %21s %8d";
@@ -3041,7 +3042,7 @@ public final class ActivityThread extends ClientTransactionHandler
private static final int ACTIVITY_THREAD_CHECKIN_VERSION = 4;
static void printRow(PrintWriter pw, String format, Object...objs) {
- pw.println(String.format(format, objs));
+ pw.println(String.format(Locale.US, format, objs));
}
@NeverCompile