Skip to content

Commit 0b6da5a

Browse files
committed
Prevent file provider name collision (for debug builds)
1 parent d24e147 commit 0b6da5a

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

app/build.gradle

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,22 @@ def getCmdOutput = { cmd ->
1313
def getGitHash = { -> return getCmdOutput(["git", "rev-parse", "--short", "HEAD"]) }
1414
def getGitBranch = { -> return getCmdOutput(["git", "rev-parse", "--abbrev-ref", "HEAD"]) }
1515

16-
def fileProviderAuthority = "com.beemdevelopment.aegis.fileprovider"
16+
def packageName = "com.beemdevelopment.aegis"
17+
def fileProviderAuthority = "${packageName}.fileprovider"
18+
def fileProviderAuthorityDebug = "${packageName}.debug.fileprovider"
1719

1820
android {
1921
compileSdkVersion 30
2022

2123
defaultConfig {
22-
applicationId "com.beemdevelopment.aegis"
24+
applicationId "${packageName}"
2325
minSdkVersion 21
2426
targetSdkVersion 30
2527
versionCode 41
2628
versionName "1.4-beta1"
2729
multiDexEnabled true
2830
buildConfigField "String", "GIT_HASH", "\"${getGitHash()}\""
2931
buildConfigField "String", "GIT_BRANCH", "\"${getGitBranch()}\""
30-
buildConfigField("String", "FILE_PROVIDER_AUTHORITY", "\"${fileProviderAuthority}\"")
31-
manifestPlaceholders = [fileProviderAuthority: "${fileProviderAuthority}"]
3232

3333
testInstrumentationRunner "com.beemdevelopment.aegis.AegisTestRunner"
3434
testInstrumentationRunnerArguments clearPackageData: 'true'
@@ -55,7 +55,12 @@ android {
5555
buildTypes {
5656
debug {
5757
applicationIdSuffix ".debug"
58-
manifestPlaceholders = [title: "AegisDev", iconName: "ic_launcher_debug"]
58+
manifestPlaceholders = [
59+
title: "AegisDev",
60+
iconName: "ic_launcher_debug",
61+
fileProviderAuthority: "${fileProviderAuthorityDebug}"
62+
]
63+
buildConfigField("String", "FILE_PROVIDER_AUTHORITY", "\"${fileProviderAuthorityDebug}\"")
5964
resValue "bool", "pref_secure_screen_default", "false"
6065
postprocessing {
6166
removeUnusedCode true
@@ -66,7 +71,12 @@ android {
6671
}
6772
}
6873
release {
69-
manifestPlaceholders = [title: "Aegis", iconName: "ic_launcher"]
74+
manifestPlaceholders = [
75+
title: "Aegis",
76+
iconName: "ic_launcher",
77+
fileProviderAuthority: "${fileProviderAuthority}"
78+
]
79+
buildConfigField("String", "FILE_PROVIDER_AUTHORITY", "\"${fileProviderAuthority}\"")
7080
resValue "bool", "pref_secure_screen_default", "true"
7181
postprocessing {
7282
removeUnusedCode true

0 commit comments

Comments
 (0)