diff options
author | Meng Wang <mewan@google.com> | 2021-04-30 21:28:03 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-04-30 21:28:03 +0000 |
commit | a0e8441caa9c66ecbbede61803f7a1a2f10a4084 (patch) | |
tree | 3e2138982cecd7057a274f1b6ddaee6622ed7681 | |
parent | 4e23d746aa35fbd09937ca21c77e13a0e2b6a30a (diff) | |
parent | 50d35183ef3987bccd80375c37fd1fe8ef42a4ee (diff) | |
download | carrier_settings-a0e8441caa9c66ecbbede61803f7a1a2f10a4084.tar.gz |
Align the handling of no-mcc-mnc configs in vendor.xml with carrierconfig app am: 4fc47e4a1f am: 5dd439e18d am: 29bb818b42 am: 50d35183efandroid-mainline-12.0.0_r99android-mainline-12.0.0_r98android-mainline-12.0.0_r77android-mainline-12.0.0_r70android-mainline-12.0.0_r69android-mainline-12.0.0_r63android-mainline-12.0.0_r59android-mainline-12.0.0_r56android-mainline-12.0.0_r5android-mainline-12.0.0_r49android-mainline-12.0.0_r42android-mainline-12.0.0_r39android-mainline-12.0.0_r22android-mainline-12.0.0_r19android-mainline-12.0.0_r122android-mainline-12.0.0_r115android-mainline-12.0.0_r113android-mainline-12.0.0_r100aml_tz3_311312010android12-mainline-networkstack-releaseandroid12-mainline-art-release
Original change: https://android-review.googlesource.com/c/platform/tools/carrier_settings/+/1690689
Change-Id: Ic14f75a4bb93eae9c7f63d5d4f6d1fc64c1dd18e
-rw-r--r-- | java/CarrierConfigConverterV2.java | 33 |
1 files changed, 6 insertions, 27 deletions
diff --git a/java/CarrierConfigConverterV2.java b/java/CarrierConfigConverterV2.java index 58a3848..cca6462 100644 --- a/java/CarrierConfigConverterV2.java +++ b/java/CarrierConfigConverterV2.java @@ -102,10 +102,6 @@ public final class CarrierConfigConverterV2 { @Parameter(names = "--version", description = "The version number for all output textpb.") private long version = 1L; - // For configs in vendor.xml w/o mcc/mnc, they are the default config values for all carriers. - // In CarrierSettings, a special mcc/mnc "000000" is used to look up default config. - private static final String MCCMNC_FOR_DEFAULT_SETTINGS = "000000"; - // Resource file path to the AOSP carrier list file private static final String RESOURCE_CARRIER_LIST = "/assets/latest_carrier_id/carrier_list.textpb"; @@ -242,18 +238,11 @@ public final class CarrierConfigConverterV2 { // Then, try to parse CarrierId CarrierId.Builder id = parseCarrierId(element); // A valid mccmnc is 5- or 6-digit. But vendor.xml see special cases below: - // Case 1: a <carrier_config> element may have neither "mcc" nor "mnc". - // Such a tag provides a base config value for all carriers. CarrierSettings uses - // mcc/mnc 000/000 to identify that, and does the merge at run time instead of - // build time (which is now). - // Case 2: a <carrier_config> element may have just "mcc" and not "mnc" for + // <carrier_config> element may have just "mcc" and not "mnc" for // country-wise config. Such a element doesn't make a carrier; but still keep it so // can be used if a mccmnc appears in APNs later. - if (id.getMccMnc().isEmpty()) { - // special case 1 - carriers.add(id.setMccMnc(MCCMNC_FOR_DEFAULT_SETTINGS).build()); - } else if (id.getMccMnc().length() == 3) { - // special case 2 + if (id.getMccMnc().length() == 3) { + // special case carriers.add(id.build()); } else if (id.getMccMnc().length() == 5 || id.getMccMnc().length() == 6) { // Normal mcc+mnc @@ -554,7 +543,7 @@ public final class CarrierConfigConverterV2 { Document xmlDoc, CarrierIdentifier carrier) throws IOException { HashMap<String, CarrierConfig.Config> configMap = new HashMap<>(); for (Element element : getElementsByTagName(xmlDoc, TAG_CARRIER_CONFIG)) { - if (carrier != null && !checkFilters(false, element, carrier)) { + if (carrier != null && !checkFilters(element, carrier)) { continue; } configMap.putAll(parseCarrierConfigToMap(element)); @@ -572,7 +561,7 @@ public final class CarrierConfigConverterV2 { Document xmlDoc, CarrierIdentifier carrier) throws IOException { HashMap<String, CarrierConfig.Config> configMap = new HashMap<>(); for (Element element : getElementsByTagName(xmlDoc, TAG_CARRIER_CONFIG)) { - if (carrier != null && !checkFilters(true, element, carrier)) { + if (carrier != null && !checkFilters(element, carrier)) { continue; } configMap.putAll(parseCarrierConfigToMap(element)); @@ -695,17 +684,7 @@ public final class CarrierConfigConverterV2 { * * <p>Copied from AOSP DefaultCarrierConfigService. */ - private static boolean checkFilters(boolean isVendorXml, Element element, CarrierIdentifier id) { - // Special case: in vendor.xml, the <carrier_config> element w/o mcc/mnc provides a base config - // value for all carriers. CarrierSettings uses mcc/mnc 000/000 to identify that, and does the - // merge at run time instead of build time (which is now). - // Hence, such an element should only match 000/000. - if (isVendorXml - && !element.hasAttribute("mcc") - && !element.hasAttribute("mnc") - && !element.hasAttribute("cid")) { - return MCCMNC_FOR_DEFAULT_SETTINGS.equals(id.getMcc() + id.getMnc()); - } + private static boolean checkFilters(Element element, CarrierIdentifier id) { boolean result = true; NamedNodeMap attributes = element.getAttributes(); for (int i = 0; i < attributes.getLength(); i++) { |