Messaging: Explicitly specify Locale where needed
Change-Id: I636e9cceed0e73bcf957ebbda5e239982e681fd7
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
* Copyright (C) 2024 The LineageOS Project
|
||||
* Copyright (C) 2024-2025 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -170,9 +170,9 @@ public class Dates {
|
||||
final String format24, final String format12) {
|
||||
SimpleDateFormat formatter;
|
||||
if ((flags & FORCE_24_HOUR) == FORCE_24_HOUR) {
|
||||
formatter = new SimpleDateFormat(format24);
|
||||
formatter = new SimpleDateFormat(format24, Locale.getDefault());
|
||||
} else {
|
||||
formatter = new SimpleDateFormat(format12);
|
||||
formatter = new SimpleDateFormat(format12, Locale.getDefault());
|
||||
}
|
||||
return formatter.format(new Date(time));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
* Copyright (C) 2024 The LineageOS Project
|
||||
* Copyright (C) 2024-2025 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,6 +23,7 @@ import android.text.format.Formatter;
|
||||
import com.google.common.base.Stopwatch;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
@@ -51,7 +52,8 @@ public class GifTranscoder {
|
||||
final float compression = (inputSize > 0) ? ((float) outputSize / inputSize) : 0;
|
||||
|
||||
if (success) {
|
||||
LogUtil.i(TAG, String.format("Resized GIF (%s) in %d ms, %s => %s (%.0f%%)",
|
||||
LogUtil.i(TAG, String.format(Locale.getDefault(),
|
||||
"Resized GIF (%s) in %d ms, %s => %s (%.0f%%)",
|
||||
LogUtil.sanitizePII(filePath),
|
||||
elapsedMs,
|
||||
Formatter.formatShortFileSize(context, inputSize),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
* Copyright (C) 2024 The LineageOS Project
|
||||
* Copyright (C) 2024-2025 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -54,6 +54,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
|
||||
public class ImageUtils {
|
||||
private static final String TAG = LogUtil.BUGLE_TAG;
|
||||
@@ -603,7 +604,7 @@ public class ImageUtils {
|
||||
sampleSize = sampleSize * 2;
|
||||
// Note that recodeImage may try using mSampleSize * 2. Hence we use the factor of 4
|
||||
if (sampleSize >= (Integer.MAX_VALUE / 4)) {
|
||||
LogUtil.w(LogUtil.BUGLE_IMAGE_TAG, String.format(
|
||||
LogUtil.w(LogUtil.BUGLE_IMAGE_TAG, String.format(Locale.getDefault(),
|
||||
"Cannot resize image: widthLimit=%d heightLimit=%d byteLimit=%d " +
|
||||
"imageWidth=%d imageHeight=%d", mWidthLimit, mHeightLimit, mByteLimit,
|
||||
mWidth, mHeight));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
* Copyright (C) 2024 The LineageOS Project
|
||||
* Copyright (C) 2024-2025 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,6 +19,8 @@ package com.android.messaging.util;
|
||||
|
||||
import android.os.SystemClock;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* A utility timer that logs the execution time of operations
|
||||
*/
|
||||
@@ -58,7 +60,8 @@ public class LoggingTimer {
|
||||
public void stopAndLog() {
|
||||
final long elapsedMs = SystemClock.elapsedRealtime() - mStartMillis;
|
||||
|
||||
final String logMessage = String.format("Used %dms for %s", elapsedMs, mName);
|
||||
final String logMessage = String.format(Locale.getDefault(), "Used %dms for %s",
|
||||
elapsedMs, mName);
|
||||
|
||||
if (mWarnLimitMillis != NO_WARN_LIMIT && elapsedMs > mWarnLimitMillis) {
|
||||
LogUtil.w(mTag, logMessage);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
* Copyright (C) 2024 The LineageOS Project
|
||||
* Copyright (C) 2024-2025 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -628,12 +628,13 @@ public class PhoneUtils {
|
||||
if (mccmnc == null || mccmnc.length != 2) {
|
||||
return "000000";
|
||||
}
|
||||
return String.format("%03d%03d", mccmnc[0], mccmnc[1]);
|
||||
return String.format(Locale.getDefault(), "%03d%03d", mccmnc[0], mccmnc[1]);
|
||||
}
|
||||
|
||||
public static String canonicalizeMccMnc(final String mcc, final String mnc) {
|
||||
try {
|
||||
return String.format("%03d%03d", Integer.parseInt(mcc), Integer.parseInt(mnc));
|
||||
return String.format(Locale.getDefault(), "%03d%03d", Integer.parseInt(mcc),
|
||||
Integer.parseInt(mnc));
|
||||
} catch (final NumberFormatException e) {
|
||||
// Return invalid as is
|
||||
LogUtil.w(TAG, "canonicalizeMccMnc: invalid mccmnc:" + mcc + " ," + mnc);
|
||||
|
||||
Reference in New Issue
Block a user