Loading src/java/com/android/internal/telephony/dataconnection/ApnSettingUtils.java +0 −72 Original line number Diff line number Diff line Loading @@ -21,10 +21,8 @@ import android.os.PersistableBundle; import android.telephony.Annotation.ApnType; import android.telephony.CarrierConfigManager; import android.telephony.data.ApnSetting; import android.util.Log; import com.android.internal.telephony.Phone; import com.android.internal.telephony.uicc.IccRecords; import com.android.telephony.Rlog; import java.util.Arrays; Loading @@ -39,76 +37,6 @@ public class ApnSettingUtils { private static final boolean DBG = false; private static boolean iccidMatches(String mvnoData, String iccId) { String[] mvnoIccidList = mvnoData.split(","); for (String mvnoIccid : mvnoIccidList) { if (iccId.startsWith(mvnoIccid)) { Log.d(LOG_TAG, "mvno icc id match found"); return true; } } return false; } private static boolean imsiMatches(String imsiDB, String imsiSIM) { // Note: imsiDB value has digit number or 'x' character for seperating USIM information // for MVNO operator. And then digit number is matched at same order and 'x' character // could replace by any digit number. // ex) if imsiDB inserted '310260x10xxxxxx' for GG Operator, // that means first 6 digits, 8th and 9th digit // should be set in USIM for GG Operator. int len = imsiDB.length(); if (len <= 0) return false; if (len > imsiSIM.length()) return false; for (int idx = 0; idx < len; idx++) { char c = imsiDB.charAt(idx); if ((c == 'x') || (c == 'X') || (c == imsiSIM.charAt(idx))) { continue; } else { return false; } } return true; } /** * Check if MVNO type and data match IccRecords. * * @param r the IccRecords * @param mvnoType the MVNO type * @param mvnoMatchData the MVNO match data * @return {@code true} if MVNO type and data match IccRecords, {@code false} otherwise. */ public static boolean mvnoMatches(IccRecords r, int mvnoType, String mvnoMatchData) { if (mvnoType == ApnSetting.MVNO_TYPE_SPN) { String spn = r.getServiceProviderNameWithBrandOverride(); if ((spn != null) && spn.equalsIgnoreCase(mvnoMatchData)) { return true; } } else if (mvnoType == ApnSetting.MVNO_TYPE_IMSI) { String imsiSIM = r.getIMSI(); if ((imsiSIM != null) && imsiMatches(mvnoMatchData, imsiSIM)) { return true; } } else if (mvnoType == ApnSetting.MVNO_TYPE_GID) { String gid1 = r.getGid1(); int mvno_match_data_length = mvnoMatchData.length(); if ((gid1 != null) && (gid1.length() >= mvno_match_data_length) && gid1.substring(0, mvno_match_data_length).equalsIgnoreCase(mvnoMatchData)) { return true; } } else if (mvnoType == ApnSetting.MVNO_TYPE_ICCID) { String iccId = r.getIccId(); if ((iccId != null) && iccidMatches(mvnoMatchData, iccId)) { return true; } } return false; } /** * Check if this APN type is metered. * Loading src/java/com/android/internal/telephony/uicc/UiccController.java +77 −0 Original line number Diff line number Diff line Loading @@ -42,8 +42,10 @@ import android.telephony.TelephonyManager; import android.telephony.UiccCardInfo; import android.telephony.UiccPortInfo; import android.telephony.UiccSlotMapping; import android.telephony.data.ApnSetting; import android.text.TextUtils; import android.util.LocalLog; import android.util.Log; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.telephony.CommandException; Loading Loading @@ -1325,6 +1327,81 @@ public class UiccController extends Handler { return false; } private static boolean iccidMatches(String mvnoData, String iccId) { String[] mvnoIccidList = mvnoData.split(","); for (String mvnoIccid : mvnoIccidList) { if (iccId.startsWith(mvnoIccid)) { Log.d(LOG_TAG, "mvno icc id match found"); return true; } } return false; } private static boolean imsiMatches(String imsiDB, String imsiSIM) { // Note: imsiDB value has digit number or 'x' character for separating USIM information // for MVNO operator. And then digit number is matched at same order and 'x' character // could replace by any digit number. // ex) if imsiDB inserted '310260x10xxxxxx' for GG Operator, // that means first 6 digits, 8th and 9th digit // should be set in USIM for GG Operator. int len = imsiDB.length(); if (len <= 0) return false; if (len > imsiSIM.length()) return false; for (int idx = 0; idx < len; idx++) { char c = imsiDB.charAt(idx); if ((c == 'x') || (c == 'X') || (c == imsiSIM.charAt(idx))) { continue; } else { return false; } } return true; } /** * Check if MVNO type and data match IccRecords. * * @param slotIndex SIM slot index. * @param mvnoType the MVNO type * @param mvnoMatchData the MVNO match data * @return {@code true} if MVNO type and data match IccRecords, {@code false} otherwise. */ public boolean mvnoMatches(int slotIndex, int mvnoType, String mvnoMatchData) { IccRecords iccRecords = getIccRecords(slotIndex, UiccController.APP_FAM_3GPP); if (iccRecords == null) { Log.d(LOG_TAG, "isMvnoMatched# IccRecords is null"); return false; } if (mvnoType == ApnSetting.MVNO_TYPE_SPN) { String spn = iccRecords.getServiceProviderNameWithBrandOverride(); if ((spn != null) && spn.equalsIgnoreCase(mvnoMatchData)) { return true; } } else if (mvnoType == ApnSetting.MVNO_TYPE_IMSI) { String imsiSIM = iccRecords.getIMSI(); if ((imsiSIM != null) && imsiMatches(mvnoMatchData, imsiSIM)) { return true; } } else if (mvnoType == ApnSetting.MVNO_TYPE_GID) { String gid1 = iccRecords.getGid1(); int mvno_match_data_length = mvnoMatchData.length(); if ((gid1 != null) && (gid1.length() >= mvno_match_data_length) && gid1.substring(0, mvno_match_data_length).equalsIgnoreCase(mvnoMatchData)) { return true; } } else if (mvnoType == ApnSetting.MVNO_TYPE_ICCID) { String iccId = iccRecords.getIccId(); if ((iccId != null) && iccidMatches(mvnoMatchData, iccId)) { return true; } } return false; } @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) private void log(String string) { Rlog.d(LOG_TAG, string); Loading Loading
src/java/com/android/internal/telephony/dataconnection/ApnSettingUtils.java +0 −72 Original line number Diff line number Diff line Loading @@ -21,10 +21,8 @@ import android.os.PersistableBundle; import android.telephony.Annotation.ApnType; import android.telephony.CarrierConfigManager; import android.telephony.data.ApnSetting; import android.util.Log; import com.android.internal.telephony.Phone; import com.android.internal.telephony.uicc.IccRecords; import com.android.telephony.Rlog; import java.util.Arrays; Loading @@ -39,76 +37,6 @@ public class ApnSettingUtils { private static final boolean DBG = false; private static boolean iccidMatches(String mvnoData, String iccId) { String[] mvnoIccidList = mvnoData.split(","); for (String mvnoIccid : mvnoIccidList) { if (iccId.startsWith(mvnoIccid)) { Log.d(LOG_TAG, "mvno icc id match found"); return true; } } return false; } private static boolean imsiMatches(String imsiDB, String imsiSIM) { // Note: imsiDB value has digit number or 'x' character for seperating USIM information // for MVNO operator. And then digit number is matched at same order and 'x' character // could replace by any digit number. // ex) if imsiDB inserted '310260x10xxxxxx' for GG Operator, // that means first 6 digits, 8th and 9th digit // should be set in USIM for GG Operator. int len = imsiDB.length(); if (len <= 0) return false; if (len > imsiSIM.length()) return false; for (int idx = 0; idx < len; idx++) { char c = imsiDB.charAt(idx); if ((c == 'x') || (c == 'X') || (c == imsiSIM.charAt(idx))) { continue; } else { return false; } } return true; } /** * Check if MVNO type and data match IccRecords. * * @param r the IccRecords * @param mvnoType the MVNO type * @param mvnoMatchData the MVNO match data * @return {@code true} if MVNO type and data match IccRecords, {@code false} otherwise. */ public static boolean mvnoMatches(IccRecords r, int mvnoType, String mvnoMatchData) { if (mvnoType == ApnSetting.MVNO_TYPE_SPN) { String spn = r.getServiceProviderNameWithBrandOverride(); if ((spn != null) && spn.equalsIgnoreCase(mvnoMatchData)) { return true; } } else if (mvnoType == ApnSetting.MVNO_TYPE_IMSI) { String imsiSIM = r.getIMSI(); if ((imsiSIM != null) && imsiMatches(mvnoMatchData, imsiSIM)) { return true; } } else if (mvnoType == ApnSetting.MVNO_TYPE_GID) { String gid1 = r.getGid1(); int mvno_match_data_length = mvnoMatchData.length(); if ((gid1 != null) && (gid1.length() >= mvno_match_data_length) && gid1.substring(0, mvno_match_data_length).equalsIgnoreCase(mvnoMatchData)) { return true; } } else if (mvnoType == ApnSetting.MVNO_TYPE_ICCID) { String iccId = r.getIccId(); if ((iccId != null) && iccidMatches(mvnoMatchData, iccId)) { return true; } } return false; } /** * Check if this APN type is metered. * Loading
src/java/com/android/internal/telephony/uicc/UiccController.java +77 −0 Original line number Diff line number Diff line Loading @@ -42,8 +42,10 @@ import android.telephony.TelephonyManager; import android.telephony.UiccCardInfo; import android.telephony.UiccPortInfo; import android.telephony.UiccSlotMapping; import android.telephony.data.ApnSetting; import android.text.TextUtils; import android.util.LocalLog; import android.util.Log; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.telephony.CommandException; Loading Loading @@ -1325,6 +1327,81 @@ public class UiccController extends Handler { return false; } private static boolean iccidMatches(String mvnoData, String iccId) { String[] mvnoIccidList = mvnoData.split(","); for (String mvnoIccid : mvnoIccidList) { if (iccId.startsWith(mvnoIccid)) { Log.d(LOG_TAG, "mvno icc id match found"); return true; } } return false; } private static boolean imsiMatches(String imsiDB, String imsiSIM) { // Note: imsiDB value has digit number or 'x' character for separating USIM information // for MVNO operator. And then digit number is matched at same order and 'x' character // could replace by any digit number. // ex) if imsiDB inserted '310260x10xxxxxx' for GG Operator, // that means first 6 digits, 8th and 9th digit // should be set in USIM for GG Operator. int len = imsiDB.length(); if (len <= 0) return false; if (len > imsiSIM.length()) return false; for (int idx = 0; idx < len; idx++) { char c = imsiDB.charAt(idx); if ((c == 'x') || (c == 'X') || (c == imsiSIM.charAt(idx))) { continue; } else { return false; } } return true; } /** * Check if MVNO type and data match IccRecords. * * @param slotIndex SIM slot index. * @param mvnoType the MVNO type * @param mvnoMatchData the MVNO match data * @return {@code true} if MVNO type and data match IccRecords, {@code false} otherwise. */ public boolean mvnoMatches(int slotIndex, int mvnoType, String mvnoMatchData) { IccRecords iccRecords = getIccRecords(slotIndex, UiccController.APP_FAM_3GPP); if (iccRecords == null) { Log.d(LOG_TAG, "isMvnoMatched# IccRecords is null"); return false; } if (mvnoType == ApnSetting.MVNO_TYPE_SPN) { String spn = iccRecords.getServiceProviderNameWithBrandOverride(); if ((spn != null) && spn.equalsIgnoreCase(mvnoMatchData)) { return true; } } else if (mvnoType == ApnSetting.MVNO_TYPE_IMSI) { String imsiSIM = iccRecords.getIMSI(); if ((imsiSIM != null) && imsiMatches(mvnoMatchData, imsiSIM)) { return true; } } else if (mvnoType == ApnSetting.MVNO_TYPE_GID) { String gid1 = iccRecords.getGid1(); int mvno_match_data_length = mvnoMatchData.length(); if ((gid1 != null) && (gid1.length() >= mvno_match_data_length) && gid1.substring(0, mvno_match_data_length).equalsIgnoreCase(mvnoMatchData)) { return true; } } else if (mvnoType == ApnSetting.MVNO_TYPE_ICCID) { String iccId = iccRecords.getIccId(); if ((iccId != null) && iccidMatches(mvnoMatchData, iccId)) { return true; } } return false; } @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) private void log(String string) { Rlog.d(LOG_TAG, string); Loading