Merge "Support key without default value for carrier config subset retrieval APIs" am: f303bd31e9
Original change: https://android-review.googlesource.com/c/platform/packages/services/Telephony/+/2479118
Change-Id: I0f3218a407dde7a2dc7d1ebcc33054d7beda1d14
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/src/com/android/phone/CarrierConfigLoader.java b/src/com/android/phone/CarrierConfigLoader.java
index 8409ff8..051d676 100644
--- a/src/com/android/phone/CarrierConfigLoader.java
+++ b/src/com/android/phone/CarrierConfigLoader.java
@@ -1362,17 +1362,18 @@
}
for (String key : keys) {
Objects.requireNonNull(key, "Config key must be non-null");
- // TODO(b/261776046): validate provided key which may has no default value.
- // For now, return empty bundle if any required key is not supported
- if (!allConfigs.containsKey(key)) {
- return new PersistableBundle();
- }
}
PersistableBundle configSubset = new PersistableBundle(
keys.length + CONFIG_SUBSET_METADATA_KEYS.length);
for (String carrierConfigKey : keys) {
Object value = allConfigs.get(carrierConfigKey);
+ if (value == null) {
+ // Filter out keys without values.
+ // In history, many AOSP or OEMs/carriers private configs didn't provide default
+ // values. We have to continue supporting them for now. See b/261776046 for details.
+ continue;
+ }
// Config value itself could be PersistableBundle which requires different API to put
if (value instanceof PersistableBundle) {
configSubset.putPersistableBundle(carrierConfigKey, (PersistableBundle) value);