Only set hasFragileUserData for signed builds

We do not want to allow saving of user data on unsigned builds as they don't have a stable signature and will not properly handle reinstallation. This can lead to a situation where the user has to resort to complex techniques to completely uninstall the package such as ADB or calling into PM directly.
This commit is contained in:
PixelyIon 2022-06-17 12:26:18 +05:30
parent 3139889a09
commit d913f29662
No known key found for this signature in database
GPG Key ID: 11BC6C3201BC2C05
2 changed files with 10 additions and 3 deletions

View File

@ -16,6 +16,8 @@ idea.module {
android { android {
namespace 'emu.skyline' namespace 'emu.skyline'
var isBuildSigned = (System.getenv("CI") == "true") && (System.getenv("IS_SKYLINE_SIGNED") == "true")
compileSdkVersion 31 compileSdkVersion 31
buildToolsVersion '33.0.0' buildToolsVersion '33.0.0'
defaultConfig { defaultConfig {
@ -30,6 +32,11 @@ android {
ndk { ndk {
abiFilters "arm64-v8a" abiFilters "arm64-v8a"
} }
if (isBuildSigned)
manifestPlaceholders = [shouldSaveUserData: "true"]
else
manifestPlaceholders = [shouldSaveUserData: "false"]
} }
/* JVM Bytecode Options */ /* JVM Bytecode Options */
@ -63,14 +70,14 @@ android {
minifyEnabled true minifyEnabled true
shrinkResources true shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig = (System.getenv("CI") == "true") && (System.getenv("IS_SKYLINE_SIGNED") == "true") ? signingConfigs.ci : signingConfigs.debug signingConfig = isBuildSigned ? signingConfigs.ci : signingConfigs.debug
} }
debug { debug {
debuggable true debuggable true
minifyEnabled false minifyEnabled false
shrinkResources false shrinkResources false
signingConfig = (System.getenv("CI") == "true") && (System.getenv("IS_SKYLINE_SIGNED") == "true") ? signingConfigs.ci : signingConfigs.debug signingConfig = isBuildSigned ? signingConfigs.ci : signingConfigs.debug
} }
} }

View File

@ -16,7 +16,7 @@
android:allowBackup="true" android:allowBackup="true"
android:extractNativeLibs="true" android:extractNativeLibs="true"
android:fullBackupContent="@xml/backup_descriptor" android:fullBackupContent="@xml/backup_descriptor"
android:hasFragileUserData="true" android:hasFragileUserData="${shouldSaveUserData}"
android:icon="@drawable/logo_skyline" android:icon="@drawable/logo_skyline"
android:isGame="true" android:isGame="true"
android:label="@string/app_name" android:label="@string/app_name"