From 34ff76451501e87cb6927c23fa277009ccc56236 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Tue, 15 Oct 2019 04:37:12 -0400 Subject: [PATCH] Stabilize resource IDs --- .gitignore | 5 +++-- app/src/main/res/values/resources.xml | 12 ++++++++++++ build.gradle | 14 +++++++------- stable-ids.txt | 20 ++++++++++++++++++++ 4 files changed, 42 insertions(+), 9 deletions(-) create mode 100644 stable-ids.txt diff --git a/.gitignore b/.gitignore index 47cd35844..9630aa645 100644 --- a/.gitignore +++ b/.gitignore @@ -2,8 +2,9 @@ out *.zip *.jks *.apk -config.prop -update.sh +/config.prop +/update.sh +/stub-ids.txt # Built binaries native/out diff --git a/app/src/main/res/values/resources.xml b/app/src/main/res/values/resources.xml index 9c785befd..77f7d8ccc 100644 --- a/app/src/main/res/values/resources.xml +++ b/app/src/main/res/values/resources.xml @@ -8,4 +8,16 @@ Magisk Hide + + + + + + + + + + + + diff --git a/build.gradle b/build.gradle index 52c34561a..6731fa8f2 100644 --- a/build.gradle +++ b/build.gradle @@ -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}" } } } diff --git a/stable-ids.txt b/stable-ids.txt new file mode 100644 index 000000000..763209e25 --- /dev/null +++ b/stable-ids.txt @@ -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