Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 147eccd7 authored by Jack Yu's avatar Jack Yu
Browse files

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: Icd58ecef7a761f8c6bd0f44ce201d571373dbd22
parent a2ab0269
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -86,6 +86,7 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
@@ -610,10 +611,10 @@ public class CarrierPrivilegesTracker extends Handler {
        List<Signature> signatures = UiccAccessRule.getSignatures(pkg);
        for (Signature signature : signatures) {
            byte[] sha1 = UiccAccessRule.getCertHash(signature, SHA_1);
            certs.add(IccUtils.bytesToHexString(sha1).toUpperCase());
            certs.add(IccUtils.bytesToHexString(sha1).toUpperCase(Locale.ROOT));

            byte[] sha256 = UiccAccessRule.getCertHash(signature, SHA_256);
            certs.add(IccUtils.bytesToHexString(sha256).toUpperCase());
            certs.add(IccUtils.bytesToHexString(sha256).toUpperCase(Locale.ROOT));
        }

        mInstalledPackageCerts.put(pkg.packageName, certs);
+3 −1
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;

/**
 * CarrierResolver identifies the subscription carrier and returns a canonical carrier Id
@@ -751,7 +752,8 @@ public class CarrierResolver extends Handler {
        // Ideally we should do full string match. However due to SIM manufacture issues
        // gid from some SIM might has garbage tail.
        private boolean gidMatch(String gidFromSim, String gid) {
            return (gidFromSim != null) && gidFromSim.toLowerCase().startsWith(gid.toLowerCase());
            return (gidFromSim != null) && gidFromSim.toLowerCase(Locale.ROOT)
                    .startsWith(gid.toLowerCase(Locale.ROOT));
        }

        private boolean carrierPrivilegeRulesMatch(List<String> certsFromSubscription,
+2 −1
Original line number Diff line number Diff line
@@ -130,6 +130,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.function.Consumer;
import java.util.regex.Matcher;
@@ -4570,7 +4571,7 @@ public class GsmCdmaPhone extends Phone {
        if (subInfo == null || TextUtils.isEmpty(subInfo.getCountryIso())) {
            return null;
        }
        return subInfo.getCountryIso().toUpperCase();
        return subInfo.getCountryIso().toUpperCase(Locale.ROOT);
    }

    public void notifyEcbmTimerReset(Boolean flag) {
+5 −1
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import com.android.internal.telephony.uicc.UiccProfile;
import com.android.telephony.Rlog;

import java.util.List;
import java.util.Locale;
import java.util.concurrent.atomic.AtomicBoolean;

/**
@@ -337,7 +338,10 @@ public class IccPhoneBookInterfaceManager {
        }

        efid = updateEfForIccType(efid);
        if (DBG) logd("getAdnRecordsInEF: efid=0x" + Integer.toHexString(efid).toUpperCase());
        if (DBG) {
            logd("getAdnRecordsInEF: efid=0x" + Integer.toHexString(efid)
                    .toUpperCase(Locale.ROOT));
        }

        checkThread();
        Request loadRequest = new Request();
+2 −1
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import com.android.internal.telephony.uicc.IccConstants;
import com.android.telephony.Rlog;

import java.util.List;
import java.util.Locale;

/**
 * {@hide}
@@ -424,7 +425,7 @@ public class IccProvider extends ContentProvider {

    private MatrixCursor loadFromEf(int efType, int subId) {
        if (DBG) log("loadFromEf: efType=0x" +
                Integer.toHexString(efType).toUpperCase() + ", subscription=" + subId);
                Integer.toHexString(efType).toUpperCase(Locale.ROOT) + ", subscription=" + subId);

        List<AdnRecord> adnRecords = null;
        try {
Loading