diff --git a/src/main/java/com/reandroid/apk/ApkModule.java b/src/main/java/com/reandroid/apk/ApkModule.java index 084c78d2d..e8511fc8b 100644 --- a/src/main/java/com/reandroid/apk/ApkModule.java +++ b/src/main/java/com/reandroid/apk/ApkModule.java @@ -1251,6 +1251,7 @@ private void mergeFusedModules(ApkModule module) { baseManifest.addFusedModuleNames(split); logMessage("Added as fused module <" + split + ">"); } + baseManifest.mergeApplicationElements(manifest); } private void validateMerge(ApkModule apkModule, boolean force) throws IOException{ if (!hasTableBlock()) { diff --git a/src/main/java/com/reandroid/arsc/chunk/xml/AndroidManifestBlock.java b/src/main/java/com/reandroid/arsc/chunk/xml/AndroidManifestBlock.java index 4aff0dd2f..9df3880d0 100644 --- a/src/main/java/com/reandroid/arsc/chunk/xml/AndroidManifestBlock.java +++ b/src/main/java/com/reandroid/arsc/chunk/xml/AndroidManifestBlock.java @@ -22,6 +22,7 @@ import com.reandroid.arsc.io.BlockReader; import com.reandroid.arsc.model.ResourceEntry; import com.reandroid.arsc.value.ValueType; +import com.reandroid.json.JSONObject; import com.reandroid.utils.ObjectsUtil; import com.reandroid.utils.StringsUtil; import com.reandroid.utils.collection.ArrayCollection; @@ -146,6 +147,31 @@ public String[] getFusedModuleNames() { } return null; } + public void mergeApplicationElements(AndroidManifestBlock other) { + if (other == null) { + return; + } + ResXmlElement otherApplication = other.getApplicationElement(); + if (otherApplication == null) { + return; + } + ResXmlElement thisApplication = getOrCreateApplicationElement(); + + Iterator elements = otherApplication.getElements(); + while (elements.hasNext()) { + ResXmlElement otherElement = elements.next(); + String tagName = otherElement.getName(); + if (TAG_meta_data.equals(tagName)) { + String nameValue = getAndroidNameValue(otherElement); + if (VALUE_com_android_dynamic_apk_fused_modules.equals(nameValue)) { + continue; + } + } + JSONObject json = otherElement.toJson(); + ResXmlElement newElement = thisApplication.newElement(); + newElement.fromJson(json); + } + } public void addFusedModuleNames(String ... names) { if (names == null || names.length == 0) { return;