Stabilize resource IDs

This commit is contained in:
topjohnwu 2019-10-15 04:37:12 -04:00
parent 1b3a009da7
commit 34ff764515
4 changed files with 42 additions and 9 deletions

5
.gitignore vendored
View File

@ -2,8 +2,9 @@ out
*.zip
*.jks
*.apk
config.prop
update.sh
/config.prop
/update.sh
/stub-ids.txt
# Built binaries
native/out

View File

@ -8,4 +8,16 @@
<string name="magiskhide" translatable="false">Magisk Hide</string>
<string name="empty" translatable="false"/>
<!-- Preserve 10 string slots for stub -->
<string name="preserve_0" translatable="false"/>
<string name="preserve_1" translatable="false"/>
<string name="preserve_2" translatable="false"/>
<string name="preserve_3" translatable="false"/>
<string name="preserve_4" translatable="false"/>
<string name="preserve_5" translatable="false"/>
<string name="preserve_6" translatable="false"/>
<string name="preserve_7" translatable="false"/>
<string name="preserve_8" translatable="false"/>
<string name="preserve_9" translatable="false"/>
</resources>

View File

@ -85,13 +85,13 @@ subprojects {
}
aaptOptions {
// Preserve stub resource IDs
File publicTxt = rootProject.file('stub-public.txt')
if (publicTxt.exists()) {
additionalParameters "--stable-ids", "${publicTxt.absolutePath}"
} else if (module.name == 'stub') {
additionalParameters "--emit-ids", "${publicTxt.absolutePath}"
}
// Handle resource IDs
File resIds = rootProject.file('stable-ids.txt')
File stubIds = rootProject.file('stub-ids.txt')
if (module.name == 'app' && resIds.exists())
additionalParameters "--stable-ids", "${resIds.absolutePath}"
else if (module.name == 'stub')
additionalParameters "--emit-ids", "${stubIds.absolutePath}"
}
}
}

20
stable-ids.txt Normal file
View File

@ -0,0 +1,20 @@
com.topjohnwu.magisk:color/ic_launcher_background = 0x7f010000
com.topjohnwu.magisk:drawable/ic_launcher = 0x7f020000
com.topjohnwu.magisk:drawable/ic_logo = 0x7f020001
com.topjohnwu.magisk:drawable/ic_magisk = 0x7f020002
com.topjohnwu.magisk:drawable/ic_splash_activity = 0x7f020003
com.topjohnwu.magisk:style/SplashTheme = 0x7f040000
com.topjohnwu.magisk:style/SplashThemeBase = 0x7f040001
com.topjohnwu.magisk:style/SplashThemeBase.V19 = 0x7f040002
com.topjohnwu.magisk:xml/file_paths = 0x7f050000
com.topjohnwu.magisk:string/preserve_0 = 0x7f030000
com.topjohnwu.magisk:string/preserve_1 = 0x7f030001
com.topjohnwu.magisk:string/preserve_2 = 0x7f030002
com.topjohnwu.magisk:string/preserve_3 = 0x7f030003
com.topjohnwu.magisk:string/preserve_4 = 0x7f030004
com.topjohnwu.magisk:string/preserve_5 = 0x7f030005
com.topjohnwu.magisk:string/preserve_6 = 0x7f030006
com.topjohnwu.magisk:string/preserve_7 = 0x7f030007
com.topjohnwu.magisk:string/preserve_8 = 0x7f030008
com.topjohnwu.magisk:string/preserve_9 = 0x7f030009