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

Commit dfab2353 authored by nharold's avatar nharold Committed by android-build-merger
Browse files

Merge "Trim Empty PLMNs from the list of parsed PLMNs" am: 5f84fc93 am: 654f7ec6

am: 7e8eb60c

Change-Id: I712b587892a5b7145cbe7d0423e9132e692abfd5
parents 03f0c3a8 7e8eb60c
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -2072,10 +2072,14 @@ public class SIMRecords extends IccRecords {
            return null;
        }
        int numPlmns = data.length / packedBcdPlmnLenBytes;
        String[] ret = new String[numPlmns];
        int numValidPlmns = 0;
        String[] parsed = new String[numPlmns];
        for (int i = 0; i < numPlmns; i++) {
            ret[i] = IccUtils.bcdPlmnToString(data, i * packedBcdPlmnLenBytes);
            parsed[numValidPlmns] = IccUtils.bcdPlmnToString(data, i * packedBcdPlmnLenBytes);
            // we count the valid (non empty) records and only increment if valid
            if (!TextUtils.isEmpty(parsed[numValidPlmns])) numValidPlmns++;
        }
        String[] ret = Arrays.copyOf(parsed, numValidPlmns);
        if (VDBG) logv(description + " PLMNs: " + Arrays.toString(ret));
        return ret;
    }