Loading src/java/com/android/internal/telephony/CarrierResolver.java +20 −2 Original line number Diff line number Diff line Loading @@ -1023,6 +1023,20 @@ public class CarrierResolver extends Handler { */ public static int getCarrierIdFromIdentifier(@NonNull Context context, @NonNull CarrierIdentifier carrierIdentifier) { return getCarrierIdFromIdentifier(context, carrierIdentifier, false); } /** * a util function to convert carrierIdentifier to the best matching carrier id. * * @param useParentCid {@code true} to indicate that the parent carrier ID is required to be * returned if it has valid value. * * @return the best matching carrier id. */ public static int getCarrierIdFromIdentifier(@NonNull Context context, @NonNull CarrierIdentifier carrierIdentifier, boolean useParentCid) { final String mccmnc = carrierIdentifier.getMcc() + carrierIdentifier.getMnc(); final String gid1 = carrierIdentifier.getGid1(); final String gid2 = carrierIdentifier.getGid2(); Loading Loading @@ -1051,9 +1065,13 @@ public class CarrierResolver extends Handler { rule.match(targetRule); if (rule.mScore > maxScore) { maxScore = rule.mScore; if (useParentCid && rule.mParentCid != TelephonyManager.UNKNOWN_CARRIER_ID) { carrierId = rule.mParentCid; } else { carrierId = rule.mCid; } } } return carrierId; } Loading Loading
src/java/com/android/internal/telephony/CarrierResolver.java +20 −2 Original line number Diff line number Diff line Loading @@ -1023,6 +1023,20 @@ public class CarrierResolver extends Handler { */ public static int getCarrierIdFromIdentifier(@NonNull Context context, @NonNull CarrierIdentifier carrierIdentifier) { return getCarrierIdFromIdentifier(context, carrierIdentifier, false); } /** * a util function to convert carrierIdentifier to the best matching carrier id. * * @param useParentCid {@code true} to indicate that the parent carrier ID is required to be * returned if it has valid value. * * @return the best matching carrier id. */ public static int getCarrierIdFromIdentifier(@NonNull Context context, @NonNull CarrierIdentifier carrierIdentifier, boolean useParentCid) { final String mccmnc = carrierIdentifier.getMcc() + carrierIdentifier.getMnc(); final String gid1 = carrierIdentifier.getGid1(); final String gid2 = carrierIdentifier.getGid2(); Loading Loading @@ -1051,9 +1065,13 @@ public class CarrierResolver extends Handler { rule.match(targetRule); if (rule.mScore > maxScore) { maxScore = rule.mScore; if (useParentCid && rule.mParentCid != TelephonyManager.UNKNOWN_CARRIER_ID) { carrierId = rule.mParentCid; } else { carrierId = rule.mCid; } } } return carrierId; } Loading