summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorchen xu <fionaxu@google.com>2018-11-21 15:37:14 -0800
committerchen xu <fionaxu@google.com>2018-11-26 18:00:25 -0800
commit73e6d208b0a3b85dc349719fb9a761d5fc9d4f04 (patch)
treee0143eda5c1de9735e5aca27ef23f9bf9647e3af /src
parent047bb81b5712bc63d478409ba52b50af54ee3794 (diff)
downloadandroid_packages_apps_CarrierConfig-73e6d208b0a3b85dc349719fb9a761d5fc9d4f04.tar.gz
android_packages_apps_CarrierConfig-73e6d208b0a3b85dc349719fb9a761d5fc9d4f04.tar.bz2
android_packages_apps_CarrierConfig-73e6d208b0a3b85dc349719fb9a761d5fc9d4f04.zip
carrierconfig data migrate to carrier id
1. migrate 490 mccmnc.xml to carrier id. 2. remove the duplicated configurations between a single carrier to a single carrier config file. 3. data migration takes care of mccmnc fallback. 4. TODO 92 mccmnc.xml didn't find match yet Bug: 110559381 Test: telephony unit test Change-Id: Ic98a0b04b6aeade2d218a2c97813b9616f224829 Merged-in: Ic98a0b04b6aeade2d218a2c97813b9616f224829
Diffstat (limited to 'src')
-rw-r--r--src/com/android/carrierconfig/DefaultCarrierConfigService.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/com/android/carrierconfig/DefaultCarrierConfigService.java b/src/com/android/carrierconfig/DefaultCarrierConfigService.java
index 48bc8c1..d69722e 100644
--- a/src/com/android/carrierconfig/DefaultCarrierConfigService.java
+++ b/src/com/android/carrierconfig/DefaultCarrierConfigService.java
@@ -31,6 +31,10 @@ public class DefaultCarrierConfigService extends CarrierService {
private static final String SPN_EMPTY_MATCH = "null";
+ private static final String CARRIER_ID_PREFIX = "carrier_config_carrierid_";
+
+ private static final String MCCMNC_PREFIX = "carrier_config_mccmnc_";
+
private static final String TAG = "DefaultCarrierConfigService";
private XmlPullParserFactory mFactory;
@@ -45,7 +49,7 @@ public class DefaultCarrierConfigService extends CarrierService {
*
* This returns a carrier config bundle appropriate for the given carrier by reading data from
* files in our assets folder. First we look for file named after
- * carrier_config_<carrierid>_<carriername>.xml if carrier id is not
+ * carrier_config_carrierid_<carrierid>_<carriername>.xml if carrier id is not
* {@link TelephonyManager#UNKNOWN_CARRIER_ID}. Note <carriername> is to improve the
* readability which should not be used to search asset files. If there is no configuration,
* then we look for a file named after the MCC+MNC of {@code id} as a fallback. Last, we read
@@ -80,14 +84,14 @@ public class DefaultCarrierConfigService extends CarrierService {
int mccmncCarrierId = TelephonyManager.from(getApplicationContext())
.getCarrierIdFromMccMnc(id.getMcc() + id.getMnc());
for (String file : getApplicationContext().getAssets().list("")) {
- if (file.startsWith("carrier_config_" + id.getPreciseCarrierId() + "_")) {
+ if (file.startsWith(CARRIER_ID_PREFIX + id.getPreciseCarrierId() + "_")) {
parser.setInput(getApplicationContext().getAssets().open(file), "utf-8");
configByPreciseCarrierId = readConfigFromXml(parser, null);
break;
- } else if (file.startsWith("carrier_config_" + id.getCarrierId() + "_")) {
+ } else if (file.startsWith(CARRIER_ID_PREFIX + id.getCarrierId() + "_")) {
parser.setInput(getApplicationContext().getAssets().open(file), "utf-8");
configByCarrierId = readConfigFromXml(parser, null);
- } else if (file.startsWith("carrier_config_" + mccmncCarrierId + "_")) {
+ } else if (file.startsWith(CARRIER_ID_PREFIX + mccmncCarrierId + "_")) {
parser.setInput(getApplicationContext().getAssets().open(file), "utf-8");
configByMccMncFallBackCarrierId = readConfigFromXml(parser, null);
}
@@ -105,7 +109,7 @@ public class DefaultCarrierConfigService extends CarrierService {
if (config.isEmpty()) {
// fallback to use mccmnc.xml when there is no carrier id named configuration found.
parser.setInput(getApplicationContext().getAssets().open(
- "carrier_config_" + id.getMcc() + id.getMnc() + ".xml"), "utf-8");
+ MCCMNC_PREFIX + id.getMcc() + id.getMnc() + ".xml"), "utf-8");
config = readConfigFromXml(parser, id);
}