Loading core/java/android/text/format/Formatter.java +6 −1 Original line number Diff line number Diff line Loading @@ -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)); } Loading services/core/java/com/android/server/net/NetworkPolicyManagerService.java +2 −2 Original line number Diff line number Diff line Loading @@ -1335,7 +1335,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { case TYPE_WARNING: { title = res.getText(R.string.data_usage_warning_title); body = res.getString(R.string.data_usage_warning_body, Formatter.formatFileSize(mContext, totalBytes)); Formatter.formatFileSize(mContext, totalBytes, Formatter.FLAG_IEC_UNITS)); builder.setSmallIcon(R.drawable.stat_notify_error); Loading Loading @@ -1383,7 +1383,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { } final long overBytes = totalBytes - policy.limitBytes; body = res.getString(R.string.data_usage_limit_snoozed_body, Formatter.formatFileSize(mContext, overBytes)); Formatter.formatFileSize(mContext, overBytes, Formatter.FLAG_IEC_UNITS)); builder.setOngoing(true); builder.setSmallIcon(R.drawable.stat_notify_error); Loading Loading
core/java/android/text/format/Formatter.java +6 −1 Original line number Diff line number Diff line Loading @@ -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)); } Loading
services/core/java/com/android/server/net/NetworkPolicyManagerService.java +2 −2 Original line number Diff line number Diff line Loading @@ -1335,7 +1335,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { case TYPE_WARNING: { title = res.getText(R.string.data_usage_warning_title); body = res.getString(R.string.data_usage_warning_body, Formatter.formatFileSize(mContext, totalBytes)); Formatter.formatFileSize(mContext, totalBytes, Formatter.FLAG_IEC_UNITS)); builder.setSmallIcon(R.drawable.stat_notify_error); Loading Loading @@ -1383,7 +1383,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { } final long overBytes = totalBytes - policy.limitBytes; body = res.getString(R.string.data_usage_limit_snoozed_body, Formatter.formatFileSize(mContext, overBytes)); Formatter.formatFileSize(mContext, overBytes, Formatter.FLAG_IEC_UNITS)); builder.setOngoing(true); builder.setSmallIcon(R.drawable.stat_notify_error); Loading