Skip to content

Commit e82bb01

Browse files
Merge pull request #16065 from nextcloud/drop-not-supported-api-levels
drop not supported api levels
2 parents 1307cdb + 32545d4 commit e82bb01

File tree

15 files changed

+1675
-116
lines changed

15 files changed

+1675
-116
lines changed

.github/workflows/screenShotTest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
matrix:
2424
scheme: [ Light ]
2525
color: [ blue ]
26-
api-level: [ 27 ]
26+
api-level: [ 28 ]
2727
steps:
2828
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
2929

app/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ android {
9494

9595
defaultConfig {
9696
applicationId = "com.nextcloud.client"
97-
minSdk = 27
97+
minSdk = 28
9898
targetSdk = 36
9999
compileSdk = 36
100100

app/src/androidTest/assets/java.md

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,6 @@ Java:
22

33
```java
44
private String getAppProcessName() {
5-
String processName = "";
6-
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
7-
ActivityManager manager = (ActivityManager) this.getSystemService(Context.ACTIVITY_SERVICE);
8-
final int ownPid = android.os.Process.myPid();
9-
final List<ActivityManager.RunningAppProcessInfo> processes = manager.getRunningAppProcesses();
10-
if (processes != null) {
11-
for (ActivityManager.RunningAppProcessInfo info : processes) {
12-
if (info.pid == ownPid) {
13-
processName = info.processName;
14-
break;
15-
}
16-
}
17-
}
18-
} else {
19-
processName = Application.getProcessName();
20-
}
21-
return processName;
22-
}
5+
return Application.getProcessName();
6+
}
237
```
Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
* Nextcloud - Android Client
33
*
4+
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
45
* SPDX-FileCopyrightText: 2023 Álvaro Brey <[email protected]>
56
* SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH
67
* SPDX-FileCopyrightText: 2019 Tobias Kaminsky <[email protected]>
@@ -9,23 +10,12 @@
910
package com.nextcloud.client
1011

1112
import android.app.Application
12-
import android.app.Instrumentation
1313
import android.content.Context
14-
import android.os.Build
1514
import androidx.test.runner.AndroidJUnitRunner
16-
import com.github.tmurakami.dexopener.DexOpener
1715
import com.nextcloud.test.TestMainApp
1816

1917
class TestRunner : AndroidJUnitRunner() {
2018
@Throws(ClassNotFoundException::class, IllegalAccessException::class, InstantiationException::class)
21-
override fun newApplication(cl: ClassLoader, className: String, context: Context): Application {
22-
/*
23-
* Initialize DexOpener only on API below 28 to enable mocking of Kotlin classes.
24-
* On API 28+ the platform supports mocking natively.
25-
*/
26-
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
27-
DexOpener.install(this)
28-
}
29-
return Instrumentation.newApplication(TestMainApp::class.java, context)
30-
}
19+
override fun newApplication(cl: ClassLoader, className: String, context: Context): Application =
20+
newApplication(TestMainApp::class.java, context)
3121
}

app/src/androidTest/java/com/owncloud/android/datamodel/ContentResolverHelperIT.kt

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ package com.owncloud.android.datamodel
99

1010
import android.content.ContentResolver
1111
import android.net.Uri
12-
import android.os.Build
1312
import androidx.test.ext.junit.runners.AndroidJUnit4
14-
import androidx.test.filters.SdkSuppress
1513
import org.junit.Before
1614
import org.junit.Test
1715
import org.junit.runner.RunWith
@@ -60,20 +58,4 @@ class ContentResolverHelperIT {
6058
null
6159
)
6260
}
63-
64-
@Test
65-
@SdkSuppress(maxSdkVersion = Build.VERSION_CODES.N_MR1)
66-
fun contentResolver_onAndroidBelow26_usesOldAPI() {
67-
ContentResolverHelper
68-
.queryResolver(resolver, URI, PROJECTION, SELECTION, null, SORT_COLUMN, SORT_DIRECTION, LIMIT)
69-
70-
verify(resolver).query(
71-
eq(URI),
72-
eq(PROJECTION),
73-
eq(SELECTION),
74-
eq(null),
75-
eq("$SORT_COLUMN $SORT_DIRECTION LIMIT $LIMIT"),
76-
eq(null)
77-
)
78-
}
7961
}

app/src/main/java/com/nextcloud/client/jobs/clipboard/ClipboardClearWorker.kt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,7 @@ class ClipboardClearWorker(private val context: Context, params: WorkerParameter
3333
return Result.success()
3434
}
3535

36-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
37-
clipboardManager.clearPrimaryClip()
38-
} else {
39-
val newEmptyClip = ClipData.newPlainText("EmptyClipContent", "")
40-
clipboardManager.setPrimaryClip(newEmptyClip)
41-
}
36+
clipboardManager.clearPrimaryClip()
4237

4338
return Result.success()
4439
} catch (e: Exception) {

app/src/main/java/com/owncloud/android/MainApp.java

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
* Contains methods to build the "static" strings. These strings were before constants in different classes.
130130
*/
131131
public class MainApp extends Application implements HasAndroidInjector, NetworkChangeListener {
132-
public static final OwnCloudVersion OUTDATED_SERVER_VERSION = NextcloudVersion.nextcloud_29;
132+
public static final OwnCloudVersion OUTDATED_SERVER_VERSION = NextcloudVersion.nextcloud_30;
133133
public static final OwnCloudVersion MINIMUM_SUPPORTED_SERVER_VERSION = OwnCloudVersion.nextcloud_20;
134134

135135
private static final String TAG = MainApp.class.getSimpleName();
@@ -233,23 +233,7 @@ private void registerNetworkChangeReceiver() {
233233
}
234234

235235
private String getAppProcessName() {
236-
String processName = "";
237-
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
238-
ActivityManager manager = (ActivityManager) this.getSystemService(Context.ACTIVITY_SERVICE);
239-
final int ownPid = android.os.Process.myPid();
240-
final List<ActivityManager.RunningAppProcessInfo> processes = manager.getRunningAppProcesses();
241-
if (processes != null) {
242-
for (ActivityManager.RunningAppProcessInfo info : processes) {
243-
if (info.pid == ownPid) {
244-
processName = info.processName;
245-
break;
246-
}
247-
}
248-
}
249-
} else {
250-
processName = Application.getProcessName();
251-
}
252-
return processName;
236+
return Application.getProcessName();
253237
}
254238

255239
@Override

app/src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import android.content.BroadcastReceiver
1010
import android.content.Context
1111
import android.content.Intent
1212
import android.content.IntentFilter
13-
import android.os.Build
1413
import android.os.Bundle
1514
import android.view.MenuItem
1615
import android.view.View
@@ -129,10 +128,6 @@ class PreviewImageActivity :
129128
}
130129

131130
private fun applyDisplayCutOutTopPadding() {
132-
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
133-
return
134-
}
135-
136131
window.decorView.setOnApplyWindowInsetsListener { view, insets ->
137132
val displayCutout = insets.displayCutout
138133
if (displayCutout != null) {

app/src/test/java/com/nextcloud/client/device/TestPowerManagementService.kt

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,10 @@ class TestPowerManagementService {
111111
}
112112

113113
@Test
114-
fun `battery charging status on API 17+`() {
114+
fun `battery charging status`() {
115115
// GIVEN
116-
// device has API level 17+
117116
// battery status sticky intent is available
118-
whenever(deviceInfo.apiLevel).thenReturn(Build.VERSION_CODES.JELLY_BEAN_MR1)
117+
whenever(deviceInfo.apiLevel).thenReturn(Build.VERSION_CODES.P)
119118
val powerSources = setOf(
120119
BatteryManager.BATTERY_PLUGGED_AC,
121120
BatteryManager.BATTERY_PLUGGED_USB,
@@ -134,29 +133,6 @@ class TestPowerManagementService {
134133
}
135134
}
136135

137-
@Test
138-
fun `battery charging status on API 16`() {
139-
// GIVEN
140-
// device has API level 16
141-
// battery status sticky intent is available
142-
whenever(deviceInfo.apiLevel).thenReturn(Build.VERSION_CODES.JELLY_BEAN)
143-
val powerSources = setOf(
144-
BatteryManager.BATTERY_PLUGGED_AC,
145-
BatteryManager.BATTERY_PLUGGED_USB
146-
)
147-
148-
for (row in powerSources) {
149-
// WHEN
150-
// device is charging using AC or USB
151-
whenever(intent.getIntExtra(eq(BatteryManager.EXTRA_PLUGGED), any()))
152-
.thenReturn(row)
153-
154-
// THEN
155-
// charging flag is true
156-
assertTrue(powerManagementService.battery.isCharging)
157-
}
158-
}
159-
160136
@Test
161137
fun `battery status sticky intent is not available`() {
162138
// GIVEN

app/src/test/java/com/nextcloud/client/jobs/BackgroundJobFactoryTest.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,10 @@ class BackgroundJobFactoryTest {
144144
}
145145

146146
@Test
147-
fun content_observer_worker_is_created_on_api_level_24() {
147+
fun content_observer_worker_is_created() {
148148
// GIVEN
149-
// api level is > 24
150149
// content URI trigger is supported
151-
whenever(deviceInfo.apiLevel).thenReturn(Build.VERSION_CODES.N)
150+
whenever(deviceInfo.apiLevel).thenReturn(Build.VERSION_CODES.P)
152151

153152
// WHEN
154153
// factory is called to create content observer worker

0 commit comments

Comments
 (0)