Merge identical key/val pairs in dynamic partition info

We might add new values to dynamic_partition_info.txt, so some kind of
generic fallback mechanism is needed. If keys are different, we need to
decided on a case-by-case basis which side takes precedence. For
example, Virtual AB requires vendor support, so vendor side takes
precedence. VABC on T+ devices are implemented entirely in system, so
system/framework side takes precedence.

Bug: 230876542
Test: th
Change-Id: I67747368547d3ef3e29ad64f8f818ef4c5896246
This commit is contained in:
Kelvin Zhang
2022-05-02 12:19:45 -07:00
parent 62bf0d5c88
commit 6a683ce02b

View File

@@ -1188,10 +1188,14 @@ def MergeDynamicPartitionInfoDicts(framework_dict, vendor_dict):
return " ".join(sorted(combined))
if (framework_dict.get("use_dynamic_partitions") !=
"true") or (vendor_dict.get("use_dynamic_partitions") != "true"):
"true") or (vendor_dict.get("use_dynamic_partitions") != "true"):
raise ValueError("Both dictionaries must have use_dynamic_partitions=true")
merged_dict = {"use_dynamic_partitions": "true"}
# For keys-value pairs that are the same, copy to merged dict
for key in vendor_dict.keys():
if key in framework_dict and framework_dict[key] == vendor_dict[key]:
merged_dict[key] = vendor_dict[key]
merged_dict["dynamic_partition_list"] = uniq_concat(
framework_dict.get("dynamic_partition_list", ""),