Skip to content

Commit

Permalink
Merge pull request #4085 from TeamAmaze/bugfix/4084
Browse files Browse the repository at this point in the history
Discard dependency info in apk and stricten cleartext traffic to local streamer only
  • Loading branch information
VishalNehra authored Mar 30, 2024
2 parents 7136ff3 + e7eb3d8 commit 604c680
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 2 deletions.
7 changes: 7 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ android {
}
}

dependenciesInfo {
// Disables dependency metadata when building APKs.
includeInApk = false
// Disables dependency metadata when building Android App Bundles.
includeInBundle = false
}

sourceSets {
test.java.srcDirs += '../testShared/src/test/java'
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
android:requestLegacyExternalStorage="true"
android:banner="@drawable/about_header"
android:localeConfig="@xml/locales_config"
android:usesCleartextTraffic="true">
android:networkSecurityConfig="@xml/network_security_config">

<activity
android:exported="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
package com.amaze.filemanager.utils

import android.content.Context
import android.os.Build
import android.os.Build.VERSION_CODES.N
import androidx.appcompat.app.AppCompatDelegate
import androidx.core.os.LocaleListCompat
import com.amaze.filemanager.R
Expand Down Expand Up @@ -50,6 +52,12 @@ fun Context.getLocaleListFromXml(): LocaleListCompat {
e.printStackTrace()
}

// Remove locale tags that would produce same locale on Android N or above
if (Build.VERSION.SDK_INT >= N) {
tagsList.remove("id")
tagsList.remove("he")
}

return LocaleListCompat.forLanguageTags(tagsList.joinToString(","))
}

Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/xml/network_security_config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="false">127.0.0.1</domain>
</domain-config>
</network-security-config>
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ import kotlin.random.Random
* Tests for [UiPrefsFragment].
*/
@Config(
sdk = [Build.VERSION_CODES.KITKAT, Build.VERSION_CODES.P, Build.VERSION_CODES.R],
sdk = [
Build.VERSION_CODES.KITKAT,
Build.VERSION_CODES.N,
Build.VERSION_CODES.P,
Build.VERSION_CODES.R
],
shadows = [
ShadowMultiDex::class,
ShadowStorageManager::class,
Expand Down

0 comments on commit 604c680

Please sign in to comment.