From 21d7a7c66fcf495d7fa0e441f7211c00d81ab379 Mon Sep 17 00:00:00 2001 From: TranceLove Date: Mon, 19 Feb 2024 12:51:14 +0800 Subject: [PATCH 1/3] Switch to network-security-config instead of just opt-in for cleartext HTTP traffic everywhere Fixes #4084 (although may conflict with #376) --- app/src/main/AndroidManifest.xml | 2 +- app/src/main/res/xml/network_security_config.xml | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 app/src/main/res/xml/network_security_config.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 1db42ba617..4735783704 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -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"> + + + 127.0.0.1 + + From 4f396022a567f3f2c89db9c58116ffb3056b1a75 Mon Sep 17 00:00:00 2001 From: TranceLove Date: Mon, 19 Feb 2024 12:54:14 +0800 Subject: [PATCH 2/3] Explicitly disable inclusion of dependency info in built APK/bundles Fixes #4084 --- app/build.gradle | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/build.gradle b/app/build.gradle index 0f54e63352..7463d00bfc 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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' } From e7eb3d87cb04624a6799f048d4e5b410c4177d27 Mon Sep 17 00:00:00 2001 From: Raymond Lai Date: Tue, 20 Feb 2024 00:11:53 +0800 Subject: [PATCH 3/3] Fix UiPrefsFragmentTest failure by removing redundant languages at preference At ContextLocaleExt.kt, remove conflicting locales API 24 or above --- .../java/com/amaze/filemanager/utils/ContextLocaleExt.kt | 8 ++++++++ .../fragments/preferencefragments/UiPrefsFragmentTest.kt | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/amaze/filemanager/utils/ContextLocaleExt.kt b/app/src/main/java/com/amaze/filemanager/utils/ContextLocaleExt.kt index 5ef6bdf387..e674f6ed43 100644 --- a/app/src/main/java/com/amaze/filemanager/utils/ContextLocaleExt.kt +++ b/app/src/main/java/com/amaze/filemanager/utils/ContextLocaleExt.kt @@ -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 @@ -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(",")) } diff --git a/app/src/test/java/com/amaze/filemanager/ui/fragments/preferencefragments/UiPrefsFragmentTest.kt b/app/src/test/java/com/amaze/filemanager/ui/fragments/preferencefragments/UiPrefsFragmentTest.kt index d974fb57fa..d4c6a42981 100644 --- a/app/src/test/java/com/amaze/filemanager/ui/fragments/preferencefragments/UiPrefsFragmentTest.kt +++ b/app/src/test/java/com/amaze/filemanager/ui/fragments/preferencefragments/UiPrefsFragmentTest.kt @@ -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,