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

Commit d6fd0497 authored by Meng Wang's avatar Meng Wang Committed by android-build-merger
Browse files

Merge "Do no use hidden API TextUtils.isPrintableAsciiOnly"

am: 22f086f6

Change-Id: Id2a3c9bc99f4b91b5e9636b103bfd3852d3415a2
parents 8c679a76 22f086f6
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -326,7 +326,7 @@ public class RuimRecords extends IccRecords {
                    // SPN is checked to have characters in printable ASCII
                    // range. If not, they are decoded with
                    // ENCODING_GSM_7BIT_ALPHABET scheme.
                    if (TextUtils.isPrintableAsciiOnly(spn)) {
                    if (isPrintableAsciiOnly(spn)) {
                        setServiceProviderName(spn);
                    } else {
                        if (DBG) log("Some corruption in SPN decoding = " + spn);
@@ -351,6 +351,22 @@ public class RuimRecords extends IccRecords {
        }
    }

    private static boolean isPrintableAsciiOnly(final CharSequence str) {
        final int len = str.length();
        for (int i = 0; i < len; i++) {
            if (!isPrintableAscii(str.charAt(i))) {
                return false;
            }
        }
        return true;
    }

    private static boolean isPrintableAscii(final char c) {
        final int asciiFirst = 0x20;
        final int asciiLast = 0x7E;  // included
        return (asciiFirst <= c && c <= asciiLast) || c == '\r' || c == '\n';
    }

    private class EfCsimMdnLoaded implements IccRecordLoaded {
        @Override
        public String getEfName() {