From b832812767a06ec6ec232291e6d14c8c2f14118c Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sun, 27 Aug 2023 22:14:43 +0200 Subject: [PATCH] fix: do not flag resource table as sparse when main package is not loaded --- .../app/revanced/patcher/data/ResourceContext.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/kotlin/app/revanced/patcher/data/ResourceContext.kt b/src/main/kotlin/app/revanced/patcher/data/ResourceContext.kt index 8bfcb12..f6eb877 100644 --- a/src/main/kotlin/app/revanced/patcher/data/ResourceContext.kt +++ b/src/main/kotlin/app/revanced/patcher/data/ResourceContext.kt @@ -83,6 +83,16 @@ class ResourceContext internal constructor( versionInfo.let { metadata.packageVersion = it.versionName ?: it.versionCode } + + /* + The ResTable if flagged as sparse if the main package is not loaded, which is the case here, + because ResourcesDecoder.decodeResources loads the main package + and not XmlPullStreamDecoder.decodeManifest. + See ARSCDecoder.readTableType for more info. + + Set this to false again to prevent the ResTable from being flagged as sparse falsely. + */ + metadata.apkInfo.sparseResources = false } } }