Fixed potential string conversion issues
Replaced all toLowerCase() with toLowerCase(Locale.ROOT).
Replaced all toUpperCase() with toUpperCase(Locale.ROOT).
Fix: 250048156
Test: atest FrameworksTelephonyTests + Basic testing
Change-Id: I1dbfed792475377cd07bcf2b8265f2ae3a1117fc
diff --git a/src/com/android/phone/CallForwardEditPreference.java b/src/com/android/phone/CallForwardEditPreference.java
index 2cbb7c5..96915d4 100644
--- a/src/com/android/phone/CallForwardEditPreference.java
+++ b/src/com/android/phone/CallForwardEditPreference.java
@@ -28,6 +28,7 @@
import com.android.internal.telephony.Phone;
import java.util.HashMap;
+import java.util.Locale;
public class CallForwardEditPreference extends EditPhoneNumberPreference {
private static final String LOG_TAG = "CallForwardEditPreference";
@@ -287,7 +288,7 @@
if (telephonyManager == null) {
return "";
}
- return telephonyManager.getNetworkCountryIso().toUpperCase();
+ return telephonyManager.getNetworkCountryIso().toUpperCase(Locale.ROOT);
}
// Message protocol:
diff --git a/src/com/android/phone/TelephonyShellCommand.java b/src/com/android/phone/TelephonyShellCommand.java
index 11e5b69..463cdb1 100644
--- a/src/com/android/phone/TelephonyShellCommand.java
+++ b/src/com/android/phone/TelephonyShellCommand.java
@@ -1178,7 +1178,7 @@
return 0;
}
- boolean isEnabled = "true".equals(arg.toLowerCase());
+ boolean isEnabled = "true".equals(arg.toLowerCase(Locale.ROOT));
try {
mInterface.setDeviceToDeviceForceEnabled(isEnabled);
} catch (RemoteException e) {
diff --git a/src/com/android/phone/callcomposer/DigestAuthUtils.java b/src/com/android/phone/callcomposer/DigestAuthUtils.java
index 2f081f7..770aadf 100644
--- a/src/com/android/phone/callcomposer/DigestAuthUtils.java
+++ b/src/com/android/phone/callcomposer/DigestAuthUtils.java
@@ -30,6 +30,7 @@
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.text.ParseException;
+import java.util.Locale;
public class DigestAuthUtils {
private static final String TAG = DigestAuthUtils.class.getSimpleName();
@@ -54,12 +55,12 @@
public static String generateAuthorizationHeader(WWWAuthenticate parsedHeader,
GbaCredentials credentials, String method, String uri) {
if (!TextUtils.isEmpty(parsedHeader.getAlgorithm())
- && !MD5_ALGORITHM.equals(parsedHeader.getAlgorithm().toLowerCase())) {
+ && !MD5_ALGORITHM.equals(parsedHeader.getAlgorithm().toLowerCase(Locale.ROOT))) {
Log.e(TAG, "This client only supports MD5 auth");
return "";
}
if (!TextUtils.isEmpty(parsedHeader.getQop())
- && !AUTH_QOP.equals(parsedHeader.getQop().toLowerCase())) {
+ && !AUTH_QOP.equals(parsedHeader.getQop().toLowerCase(Locale.ROOT))) {
Log.e(TAG, "This client only supports the auth qop");
return "";
}
@@ -137,7 +138,7 @@
}
private static String base16(byte[] input) {
- return BaseEncoding.base16().encode(input).toLowerCase();
+ return BaseEncoding.base16().encode(input).toLowerCase(Locale.ROOT);
}
private static MessageDigest getMd5Digest() {