diff options
| author | Anton Hansson <hansson@google.com> | 2019-03-29 15:50:09 +0000 |
|---|---|---|
| committer | Anton Hansson <hansson@google.com> | 2019-03-29 15:50:09 +0000 |
| commit | a6101e8b2d013e822600e4e29c7483db6778fff2 (patch) | |
| tree | 516e83bd7b70566517d00dc795120e1bb160bf9e /core/java | |
| parent | ee10d8bc36dbff7a10200ca047c416539eead994 (diff) | |
Make data warning notification use IEC units
This makes the number presented to the user consistent between
Settings and the notification. Previously the notification used
SI units while Settings used IEC units.
I haven't tested the TYPE_LIMIT_SNOOZED notification as I'm not
sure how to trigger it (though I don't see any reason why it
wouldn't get the same treatment).
Bug: 91635986
Test: manually:
1) set a limit for 10 MB
2) use >10 MB of data
3) verify notification and Settings agree on data use
Change-Id: I31f157332ac273ae260651eb426ab97258180176
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/text/format/Formatter.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/core/java/android/text/format/Formatter.java b/core/java/android/text/format/Formatter.java index 077d12de4d59..d7baa1086b2f 100644 --- a/core/java/android/text/format/Formatter.java +++ b/core/java/android/text/format/Formatter.java @@ -92,10 +92,15 @@ public final class Formatter { * @return formatted string with the number */ public static String formatFileSize(@Nullable Context context, long sizeBytes) { + return formatFileSize(context, sizeBytes, FLAG_SI_UNITS); + } + + /** @hide */ + public static String formatFileSize(@Nullable Context context, long sizeBytes, int flags) { if (context == null) { return ""; } - final BytesResult res = formatBytes(context.getResources(), sizeBytes, FLAG_SI_UNITS); + final BytesResult res = formatBytes(context.getResources(), sizeBytes, flags); return bidiWrap(context, context.getString(com.android.internal.R.string.fileSizeSuffix, res.value, res.units)); } |
