From 7c1ce8bb6e37a63b84bf1cd736d929110663c791 Mon Sep 17 00:00:00 2001 From: Sunil Shivanand Date: Thu, 28 Apr 2016 16:25:42 +0200 Subject: [PATCH] Issue 1234 - Use literal value of versionName when used When reference string is used for versionName in AndroidManifest.xml, fetch the literal value of the referened string in the output apk. This patch doesnt modify the original apk. --- .../src/main/java/brut/androlib/ApkDecoder.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/ApkDecoder.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/ApkDecoder.java index a0719e2e..2aa8be2a 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/ApkDecoder.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/ApkDecoder.java @@ -22,10 +22,12 @@ import brut.androlib.err.UndefinedResObject; import brut.androlib.meta.MetaInfo; import brut.androlib.meta.PackageInfo; import brut.androlib.meta.UsesFramework; +import brut.androlib.meta.VersionInfo; import brut.androlib.res.AndrolibResources; import brut.androlib.res.data.ResPackage; import brut.androlib.res.data.ResTable; import brut.androlib.res.util.ExtFile; +import brut.androlib.res.xml.ResXmlPatcher; import brut.common.BrutException; import brut.directory.DirectoryException; import brut.util.OS; @@ -354,7 +356,12 @@ public class ApkDecoder { } private void putVersionInfo(MetaInfo meta) throws AndrolibException { - meta.versionInfo = getResTable().getVersionInfo(); + VersionInfo info = getResTable().getVersionInfo(); + String refValue = ResXmlPatcher.pullValueFromStrings(mOutDir, info.versionName); + if (refValue != null) { + info.versionName = refValue; + } + meta.versionInfo = info; } private void putUnknownInfo(MetaInfo meta) throws AndrolibException {