Skip to content

Commit c83a700

Browse files
committed
Merge branch 'release/4.0' into ondemand-comment-artifact
2 parents 1793cad + 60507e0 commit c83a700

File tree

137 files changed

+2660
-2487
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+2660
-2487
lines changed

.github/workflows/android-build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- uses: actions/checkout@v4
19-
- name: Set up JDK 11
19+
- name: Set up JDK 17
2020
uses: actions/setup-java@v4
2121
with:
2222
distribution: "temurin"
23-
java-version: 11
23+
java-version: 17
2424
- name: Check formatting using spotless
2525
uses: gradle/actions/setup-gradle@v3
2626
with:
@@ -31,11 +31,11 @@ jobs:
3131
runs-on: ubuntu-latest
3232
steps:
3333
- uses: actions/checkout@v4
34-
- name: Set up JDK 11
34+
- name: Set up JDK 17
3535
uses: actions/setup-java@v4
3636
with:
3737
distribution: "temurin"
38-
java-version: 11
38+
java-version: 17
3939
- name: Build with Gradle
4040
uses: gradle/actions/setup-gradle@v3
4141
with:

.github/workflows/android-debug-artifact-ondemand.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ jobs:
3535
token: ${{ secrets.GITHUB_TOKEN }}
3636
repository: ${{fromJson(steps.request.outputs.data).head.repo.full_name}}
3737
ref: ${{fromJson(steps.request.outputs.data).head.ref}}
38-
- name: Set up JDK 11
38+
- name: Set up JDK 17
3939
uses: actions/setup-java@v4
4040
with:
4141
distribution: "temurin"
42-
java-version: 11
42+
java-version: 17
4343
- name: Build with Gradle
4444
uses: gradle/actions/setup-gradle@v3
4545
with:

.github/workflows/android-debug-artifact-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v4
12-
- name: Set up JDK 11
12+
- name: Set up JDK 17
1313
uses: actions/setup-java@v4
1414
with:
1515
distribution: "temurin"
16-
java-version: 11
16+
java-version: 17
1717
- name: Build with Gradle
1818
uses: gradle/actions/setup-gradle@v3
1919
with:

.github/workflows/android-feature.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- uses: actions/checkout@v4
20-
- name: Set up JDK 11
20+
- name: Set up JDK 17
2121
uses: actions/setup-java@v4
2222
with:
2323
distribution: "temurin"
24-
java-version: 11
24+
java-version: 17
2525
- name: Check formatting using spotless
2626
uses: gradle/actions/setup-gradle@v3
2727
with:
@@ -32,11 +32,11 @@ jobs:
3232
runs-on: ubuntu-latest
3333
steps:
3434
- uses: actions/checkout@v4
35-
- name: Set up JDK 11
35+
- name: Set up JDK 17
3636
uses: actions/setup-java@v4
3737
with:
3838
distribution: "temurin"
39-
java-version: 11
39+
java-version: 17
4040
- name: Build with Gradle
4141
uses: gradle/actions/setup-gradle@v3
4242
with:

.github/workflows/android-main.yml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- uses: actions/checkout@v4
20-
- name: Set up JDK 11
20+
- name: Set up JDK 17
2121
uses: actions/setup-java@v4
2222
with:
2323
distribution: "temurin"
24-
java-version: 11
24+
java-version: 17
2525
- name: Check formatting using spotless
2626
uses: gradle/actions/setup-gradle@v3
2727
with:
@@ -34,11 +34,11 @@ jobs:
3434
- uses: actions/checkout@v4
3535
with:
3636
fetch-depth: 0
37-
- name: Set up JDK 11
37+
- name: Set up JDK 17
3838
uses: actions/setup-java@v4
3939
with:
4040
distribution: "temurin"
41-
java-version: 11
41+
java-version: 17
4242
- name: Build with Gradle
4343
uses: gradle/actions/setup-gradle@v3
4444
with:
@@ -63,18 +63,24 @@ jobs:
6363

6464
test_emulator:
6565
timeout-minutes: 30 # Emulator can get stuck
66-
runs-on: macos-latest
66+
runs-on: ubuntu-latest
6767
strategy:
6868
fail-fast: true
6969
matrix:
70-
api-level: [ 16, 19, 28 ]
70+
api-level: [ 21, 28 ]
7171
steps:
7272
- name: checkout
7373
uses: actions/checkout@v4
74-
- name: Java 15
74+
- name: Java 17
7575
uses: actions/setup-java@v4
7676
with:
77-
java-version: 15
77+
distribution: "temurin"
78+
java-version: 17
79+
- name: Enable KVM
80+
run: |
81+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
82+
sudo udevadm control --reload-rules
83+
sudo udevadm trigger --name-match=kvm
7884
- name: Gradle cache
7985
uses: gradle/actions/setup-gradle@v3
8086
- name: AVD cache
@@ -95,7 +101,7 @@ jobs:
95101
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
96102
disable-animations: false
97103
sdcard-path-or-size: 100M
98-
arch: x86
104+
arch: x86_64
99105
ram-size: 2048M
100106
channel: canary
101107
script: echo "Generated AVD snapshot for caching."
@@ -108,10 +114,11 @@ jobs:
108114
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
109115
disable-animations: true
110116
sdcard-path-or-size: 100M
111-
arch: x86
117+
arch: x86_64
112118
ram-size: 2048M
113119
channel: canary
114120
script: |
115121
adb logcat -c
116122
adb logcat *:E &
117123
./gradlew :app:connectedCheck
124+

app/build.gradle

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
22
apply plugin: 'kotlin-android'
33
apply plugin: 'kotlin-kapt'
44
apply plugin: 'kotlin-parcelize'
5-
apply plugin: 'com.hiya.jacoco-android'
5+
apply plugin: "com.mxalbert.gradle.jacoco-android"
66
apply plugin: "com.starter.easylauncher"
77
apply plugin: 'com.google.devtools.ksp'
88

@@ -11,11 +11,10 @@ android {
1111
compileSdk libs.versions.compileSdk.get().toInteger()
1212
packagingOptions {
1313
resources {
14-
excludes += ['proguard-project.txt', 'project.properties', 'META-INF/LICENSE.txt', 'META-INF/LICENSE', 'META-INF/NOTICE.txt', 'META-INF/NOTICE', 'META-INF/DEPENDENCIES.txt', 'META-INF/DEPENDENCIES']
14+
excludes += ['proguard-project.txt', 'project.properties', 'META-INF/LICENSE.txt', 'META-INF/LICENSE', 'META-INF/NOTICE.txt', 'META-INF/NOTICE', 'META-INF/DEPENDENCIES.txt', 'META-INF/DEPENDENCIES', 'META-INF/versions/9/OSGI-INF/MANIFEST.MF']
1515
}
1616
}
1717

18-
1918
defaultConfig {
2019
applicationId "com.amaze.filemanager"
2120
minSdkVersion libs.versions.minSdk.get().toInteger()
@@ -95,12 +94,12 @@ android {
9594
}
9695

9796
compileOptions {
98-
sourceCompatibility JavaVersion.VERSION_11
99-
targetCompatibility JavaVersion.VERSION_11
97+
sourceCompatibility JavaVersion.VERSION_17
98+
targetCompatibility JavaVersion.VERSION_17
10099
}
101100

102101
kotlinOptions {
103-
jvmTarget = '11'
102+
jvmTarget = '17'
104103
}
105104

106105
testOptions {
@@ -263,7 +262,7 @@ dependencies {
263262
}
264263

265264
kotlin {
266-
jvmToolchain(11)
265+
jvmToolchain(17)
267266
}
268267

269268
configurations.configureEach {
@@ -292,6 +291,8 @@ tasks.register('supportOldLangCodes')
292291
include('strings.xml')
293292
}
294293
supportOldLangCodes.dependsOn copyTask
294+
rootProject.tasks.named('spotlessJava').configure { dependsOn copyTask }
295+
rootProject.tasks.named('spotlessKotlin').configure { dependsOn copyTask }
295296
}
296297

297298
project.afterEvaluate {
@@ -305,14 +306,6 @@ jacoco {
305306
toolVersion = libs.versions.jacoco.get()
306307
}
307308

308-
tasks.withType(JacocoReport).configureEach {
309-
reports {
310-
csv.required.set(false)
311-
html.required.set(true)
312-
xml.required.set(true)
313-
}
314-
}
315-
316309
tasks.withType(Test).configureEach {
317310
jacoco.includeNoLocationClasses = true
318311
jacoco.excludes = ['jdk.internal.*']
@@ -342,5 +335,8 @@ if (propFile.canRead()) {
342335
android.buildTypes.release.signingConfig = null
343336
}
344337
repositories {
338+
google()
345339
mavenCentral()
340+
maven { url "https://jitpack.io" }
341+
maven { url "https://jcenter.bintray.com" }
346342
}

app/proguard.cfg

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,13 @@
9898
-keep class org.bouncycastle.jcajce.spec.* {*;}
9999
-keep class org.bouncycastle.jce.** {*;}
100100

101+
-dontwarn org.bouncycastle.jsse.**
102+
-dontwarn org.bouncycastle.asn1.ASN1ApplicationSpecific
103+
-dontwarn org.bouncycastle.asn1.DERApplicationSpecific
104+
-dontwarn org.conscrypt.**
105+
-dontwarn org.openjsse.**
106+
-dontwarn sun.security.x509.X509Key
107+
101108
-dontwarn javax.naming.**
102109

103110
#From here sshj. We are not using GSSAPI to connect to SSH

app/src/androidTest/java/com/amaze/filemanager/ui/activities/TextEditorActivityEspressoTest.java

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import java.util.concurrent.CountDownLatch;
2727

2828
import org.junit.Before;
29-
import org.junit.Rule;
3029
import org.junit.Test;
3130
import org.junit.runner.RunWith;
3231

@@ -36,22 +35,18 @@
3635
import android.content.Intent;
3736
import android.net.Uri;
3837

38+
import androidx.test.core.app.ActivityScenario;
3939
import androidx.test.ext.junit.runners.AndroidJUnit4;
4040
import androidx.test.filters.SmallTest;
4141
import androidx.test.filters.Suppress;
4242
import androidx.test.platform.app.InstrumentationRegistry;
43-
import androidx.test.rule.ActivityTestRule;
4443

4544
@SmallTest
4645
@RunWith(AndroidJUnit4.class)
4746
@Suppress
4847
// Have to rewrite to cope with Android 11 storage access model
4948
public class TextEditorActivityEspressoTest {
5049

51-
@Rule
52-
public ActivityTestRule<TextEditorActivity> activityRule =
53-
new ActivityTestRule<>(TextEditorActivity.class, true, false);
54-
5550
private Context context;
5651

5752
private Uri uri;
@@ -65,22 +60,29 @@ public void setUp() {
6560
}
6661

6762
@Test
68-
public void testOpenFile() throws Exception {
63+
public void testOpenFile() {
6964
Intent intent =
7065
new Intent(context, TextEditorActivity.class)
7166
.setAction(Intent.ACTION_VIEW)
7267
.addCategory(Intent.CATEGORY_DEFAULT)
7368
.setType("text/plain")
7469
.setData(uri);
75-
activityRule.launchActivity(intent);
76-
CountDownLatch waiter = new CountDownLatch(1);
77-
while ("".equals(activityRule.getActivity().mainTextView.getText().toString())) {
78-
waiter.await();
70+
try (ActivityScenario<TextEditorActivity> scenario = ActivityScenario.launch(intent)) {
71+
scenario.onActivity(
72+
activity -> {
73+
CountDownLatch waiter = new CountDownLatch(1);
74+
try {
75+
while ("".equals(activity.mainTextView.getText().toString())) {
76+
waiter.await();
77+
}
78+
} catch (InterruptedException ignored) {
79+
}
80+
waiter.countDown();
81+
assertNotEquals("", activity.mainTextView.getText().toString());
82+
assertNotEquals("foobar", activity.mainTextView.getText().toString());
83+
// Add extra time for you to see the Activity did load, and text is actually there
84+
// Thread.sleep(1000);
85+
});
7986
}
80-
waiter.countDown();
81-
assertNotEquals("", activityRule.getActivity().mainTextView.getText());
82-
assertNotEquals("foobar", activityRule.getActivity().mainTextView.getText());
83-
// Add extra time for you to see the Activity did load, and text is actually there
84-
// Thread.sleep(1000);
8587
}
8688
}

app/src/androidTest/java/com/amaze/filemanager/ui/fragments/BackupPrefsFragmentTest.kt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,16 @@ import androidx.test.espresso.action.ViewActions
3434
import androidx.test.espresso.matcher.ViewMatchers.withId
3535
import androidx.test.espresso.matcher.ViewMatchers.withText
3636
import androidx.test.ext.junit.runners.AndroidJUnit4
37+
import androidx.test.rule.GrantPermissionRule
3738
import com.amaze.filemanager.R
3839
import com.amaze.filemanager.ui.activities.PreferencesActivity
3940
import com.amaze.filemanager.ui.fragments.preferencefragments.BackupPrefsFragment
4041
import com.google.gson.GsonBuilder
4142
import com.google.gson.reflect.TypeToken
4243
import org.junit.Assert
44+
import org.junit.Assert.assertEquals
45+
import org.junit.Assert.assertTrue
46+
import org.junit.Rule
4347
import org.junit.Test
4448
import org.junit.runner.RunWith
4549
import java.io.File
@@ -49,6 +53,12 @@ class BackupPrefsFragmentTest {
4953
var storagePath = "/storage/emulated/0"
5054
var fileName = "amaze_backup.json"
5155

56+
@Rule
57+
@JvmField
58+
val storagePermissionRule: GrantPermissionRule =
59+
GrantPermissionRule
60+
.grant(android.Manifest.permission.WRITE_EXTERNAL_STORAGE)
61+
5262
/** Test exporting */
5363
@Test
5464
fun testExport() {
@@ -146,7 +156,7 @@ class BackupPrefsFragmentTest {
146156
mapValue = (mapValue as Double).toInt() // since Gson parses Integer as Double
147157
}
148158

149-
Assert.assertEquals(value, mapValue)
159+
assertEquals("Difference found at key $key", value, mapValue)
150160
}
151161
}
152162
}
@@ -209,7 +219,7 @@ class BackupPrefsFragmentTest {
209219
val preferenceMap: Map<String?, *> = preferences.all
210220

211221
for ((key, value) in preferenceMap) {
212-
Assert.assertTrue(checkPrefEqual(preferences, importMap, key, value))
222+
assertTrue("checkPrefEqual($key) failed", checkPrefEqual(preferences, importMap, key, value))
213223
}
214224
}
215225
}

0 commit comments

Comments
 (0)