From e1dd6a01deffa5c2088b7ab4e21691fbbfd3aee4 Mon Sep 17 00:00:00 2001 From: Jordan Liu <jminjie@google.com> Date: Mon, 11 Oct 2021 17:16:57 -0700 Subject: [PATCH] Do not strip trailing F's of test ICCID Some OEMs use test SIMs which have ICCID=FFFFFFF... In this case we don't strip trailing F's. Bug: 199254579 Test: manual Change-Id: I69b40fa75e59163e8c30be77cc38e908d6dd8cd4 --- .../java/com/android/internal/telephony/uicc/IccUtils.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/telephony/java/com/android/internal/telephony/uicc/IccUtils.java b/telephony/java/com/android/internal/telephony/uicc/IccUtils.java index ec1204042260..5b44dba49929 100644 --- a/telephony/java/com/android/internal/telephony/uicc/IccUtils.java +++ b/telephony/java/com/android/internal/telephony/uicc/IccUtils.java @@ -43,6 +43,10 @@ public class IccUtils { @VisibleForTesting static final int FPLMN_BYTE_SIZE = 3; + // ICCID used for tests by some OEMs + // TODO(b/159354974): Replace the constant here with UiccPortInfo.ICCID_REDACTED once ready + private static final String TEST_ICCID = "FFFFFFFFFFFFFFFFFFFF"; + // A table mapping from a number to a hex character for fast encoding hex strings. private static final char[] HEX_CHARS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' @@ -923,6 +927,9 @@ public class IccUtils { * Strip all the trailing 'F' characters of a string, e.g., an ICCID. */ public static String stripTrailingFs(String s) { + if (TEST_ICCID.equals(s)) { + return s; + } return s == null ? null : s.replaceAll("(?i)f*$", ""); } -- GitLab