Skip to content

Commit 6518649

Browse files
authored
Merge pull request #4299 from owncloud/technical/upgrade_min_sdk_to_android_7
[TECHNICAL] Upgrade min SDK to Android 7.0 (v24)
2 parents e93e845 + fd8767b commit 6518649

11 files changed

Lines changed: 82 additions & 286 deletions

File tree

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Table of Contents
22

3+
* [Changelog for unreleased](#changelog-for-owncloud-android-client-unreleased-unreleased)
34
* [Changelog for 4.2.0](#changelog-for-owncloud-android-client-420-2024-02-12)
45
* [Changelog for 4.1.1](#changelog-for-owncloud-android-client-411-2023-10-18)
56
* [Changelog for 4.1.0](#changelog-for-owncloud-android-client-410-2023-08-23)
@@ -18,6 +19,36 @@
1819
* [Changelog for 2.18.1](#changelog-for-owncloud-android-client-2181-2021-07-20)
1920
* [Changelog for 2.18.0](#changelog-for-owncloud-android-client-2180-2021-05-24)
2021
* [Changelog for 2.17 versions and below](#changelog-for-217-versions-and-below)
22+
# Changelog for ownCloud Android Client [unreleased] (UNRELEASED)
23+
24+
The following sections list the changes in ownCloud Android Client unreleased relevant to
25+
ownCloud admins and users.
26+
27+
[unreleased]: https://github.com/owncloud/android/compare/v4.2.0...master
28+
29+
## Summary
30+
31+
* Change - Upgrade minimum SDK version to Android 7.0 (v24): [#4230](https://github.com/owncloud/android/issues/4230)
32+
* Enhancement - Unit tests for repository classes - Part 1: [#4232](https://github.com/owncloud/android/issues/4232)
33+
34+
## Details
35+
36+
* Change - Upgrade minimum SDK version to Android 7.0 (v24): [#4230](https://github.com/owncloud/android/issues/4230)
37+
38+
The minimum Android version will be Android 7.0 Nougat (API 24). The application
39+
will no longer support previous versions.
40+
41+
https://github.com/owncloud/android/issues/4230
42+
https://github.com/owncloud/android/pull/4299
43+
44+
* Enhancement - Unit tests for repository classes - Part 1: [#4232](https://github.com/owncloud/android/issues/4232)
45+
46+
Unit tests for OCAppRegistryRepository, OCAuthenticationRepository and
47+
OCCapabilityRepository classes have been completed.
48+
49+
https://github.com/owncloud/android/issues/4232
50+
https://github.com/owncloud/android/pull/4281
51+
2152
# Changelog for ownCloud Android Client [4.2.0] (2024-02-12)
2253

2354
The following sections list the changes in ownCloud Android Client 4.2.0 relevant to

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ buildscript {
22
ext {
33
// SDK
44
sdkCompileVersion = 33
5-
sdkMinVersion = 23
5+
sdkMinVersion = 24
66
sdkTargetVersion = 33
77
}
88

changelog/unreleased/4299

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Change: Upgrade minimum SDK version to Android 7.0 (v24)
2+
3+
The minimum Android version will be Android 7.0 Nougat (API 24). The application will no longer support previous versions.
4+
5+
https://github.com/owncloud/android/issues/4230
6+
https://github.com/owncloud/android/pull/4299

owncloudApp/src/main/java/com/owncloud/android/extensions/ActivityExt.kt

Lines changed: 23 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,17 @@ package com.owncloud.android.extensions
2222
import android.app.Activity
2323
import android.app.AlertDialog
2424
import android.content.ActivityNotFoundException
25-
import android.content.ContentResolver
2625
import android.content.Context
2726
import android.content.Intent
2827
import android.content.Intent.FLAG_ACTIVITY_NO_HISTORY
2928
import android.content.pm.PackageManager
3029
import android.content.pm.ResolveInfo
3130
import android.net.Uri
32-
import android.os.Build
3331
import android.view.inputmethod.InputMethodManager
3432
import android.webkit.MimeTypeMap
3533
import android.widget.Toast
3634
import androidx.appcompat.app.AppCompatActivity
3735
import androidx.core.content.FileProvider
38-
import androidx.fragment.app.DialogFragment
3936
import androidx.fragment.app.FragmentActivity
4037
import androidx.lifecycle.Lifecycle
4138
import androidx.lifecycle.lifecycleScope
@@ -44,7 +41,6 @@ import com.google.android.material.snackbar.Snackbar
4441
import com.owncloud.android.R
4542
import com.owncloud.android.data.providers.implementation.OCSharedPreferencesProvider
4643
import com.owncloud.android.domain.files.model.OCFile
47-
import com.owncloud.android.lib.common.network.WebdavUtils
4844
import com.owncloud.android.presentation.common.ShareSheetHelper
4945
import com.owncloud.android.presentation.security.LockEnforcedType
5046
import com.owncloud.android.presentation.security.LockEnforcedType.Companion.parseFromInteger
@@ -60,7 +56,6 @@ import com.owncloud.android.presentation.settings.privacypolicy.PrivacyPolicyAct
6056
import com.owncloud.android.presentation.settings.security.SettingsSecurityFragment.Companion.EXTRAS_LOCK_ENFORCED
6157
import com.owncloud.android.providers.MdmProvider
6258
import com.owncloud.android.ui.activity.FileDisplayActivity.Companion.ALL_FILES_SAF_REGEX
63-
import com.owncloud.android.ui.dialog.ShareLinkToDialog
6459
import com.owncloud.android.utils.CONFIGURATION_DEVICE_PROTECTION
6560
import com.owncloud.android.utils.MimetypeIconUtil
6661
import com.owncloud.android.utils.UriUtilsKt.getExposedFileUriForOCFile
@@ -197,22 +192,15 @@ private fun getExposedFileUri(context: Context, localPath: String): Uri? {
197192
return null
198193
}
199194

200-
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
201-
// TODO - use FileProvider with any Android version, with deeper testing -> 2.2.0
202-
exposedFileUri = Uri.parse(
203-
ContentResolver.SCHEME_FILE + "://" + WebdavUtils.encodePath(localPath)
195+
// Use the FileProvider to get a content URI
196+
try {
197+
exposedFileUri = FileProvider.getUriForFile(
198+
context,
199+
context.getString(R.string.file_provider_authority),
200+
File(localPath)
204201
)
205-
} else {
206-
// Use the FileProvider to get a content URI
207-
try {
208-
exposedFileUri = FileProvider.getUriForFile(
209-
context,
210-
context.getString(R.string.file_provider_authority),
211-
File(localPath)
212-
)
213-
} catch (e: IllegalArgumentException) {
214-
Timber.e(e, "File can't be exported")
215-
}
202+
} catch (e: IllegalArgumentException) {
203+
Timber.e(e, "File can't be exported")
216204
}
217205

218206
return exposedFileUri
@@ -248,19 +236,13 @@ fun Activity.openFileWithIntent(intentForSavedMimeType: Intent, intentForGuessed
248236
fun AppCompatActivity.sendFile(file: File?) {
249237
if (file != null) {
250238
val sendIntent: Intent = makeIntent(file, this)
251-
252-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
253-
val shareSheetIntent = ShareSheetHelper().getShareSheetIntent(
254-
intent = sendIntent,
255-
context = this,
256-
title = R.string.activity_chooser_send_file_title,
257-
packagesToExclude = arrayOf()
258-
)
259-
this.startActivity(shareSheetIntent)
260-
} else {
261-
val chooserDialog: DialogFragment = ShareLinkToDialog.newInstance(sendIntent, arrayOf())
262-
chooserDialog.show(this.supportFragmentManager, "CHOOSER_DIALOG")
263-
}
239+
val shareSheetIntent = ShareSheetHelper().getShareSheetIntent(
240+
intent = sendIntent,
241+
context = this,
242+
title = R.string.activity_chooser_send_file_title,
243+
packagesToExclude = arrayOf()
244+
)
245+
this.startActivity(shareSheetIntent)
264246
} else {
265247
Timber.e("Trying to send a NULL file")
266248
}
@@ -309,6 +291,7 @@ fun Activity.checkPasscodeEnforced(securityEnforced: SecurityEnforced) {
309291
showSelectSecurityDialog(passcodeConfigured, patternConfigured, securityEnforced)
310292
}
311293
}
294+
312295
LockEnforcedType.EITHER_ENFORCED -> {
313296
showSelectSecurityDialog(passcodeConfigured, patternConfigured, securityEnforced)
314297
}
@@ -413,18 +396,13 @@ fun FragmentActivity.sendDownloadedFilesByShareSheet(ocFiles: List<OCFile>) {
413396
}
414397

415398
val packagesToExclude = arrayOf<String>(this@sendDownloadedFilesByShareSheet.packageName)
416-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
417-
val shareSheetIntent = ShareSheetHelper().getShareSheetIntent(
418-
sendIntent,
419-
this@sendDownloadedFilesByShareSheet,
420-
R.string.activity_chooser_send_file_title,
421-
packagesToExclude
422-
)
423-
startActivity(shareSheetIntent)
424-
} else {
425-
val chooserDialog: DialogFragment = ShareLinkToDialog.newInstance(sendIntent, packagesToExclude)
426-
chooserDialog.show(supportFragmentManager, FRAGMENT_TAG_CHOOSER_DIALOG)
427-
}
399+
val shareSheetIntent = ShareSheetHelper().getShareSheetIntent(
400+
sendIntent,
401+
this@sendDownloadedFilesByShareSheet,
402+
R.string.activity_chooser_send_file_title,
403+
packagesToExclude
404+
)
405+
startActivity(shareSheetIntent)
428406
}
429407

430408
fun Activity.openOCFile(ocFile: OCFile) {

owncloudApp/src/main/java/com/owncloud/android/presentation/common/ShareSheetHelper.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,11 @@ import android.content.Context
2424
import android.content.Intent
2525
import android.content.pm.PackageManager
2626
import android.content.pm.ResolveInfo
27-
import android.os.Build
2827
import android.os.Parcelable
29-
import androidx.annotation.RequiresApi
3028
import androidx.annotation.StringRes
3129

3230
class ShareSheetHelper {
3331

34-
@RequiresApi(Build.VERSION_CODES.N)
3532
fun getShareSheetIntent(
3633
intent: Intent,
3734
context: Context,

owncloudApp/src/main/java/com/owncloud/android/presentation/documentsprovider/cursors/FileCursor.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
package com.owncloud.android.presentation.documentsprovider.cursors
2525

2626
import android.database.MatrixCursor
27-
import android.os.Build
2827
import android.os.Bundle
2928
import android.provider.DocumentsContract
3029
import android.provider.DocumentsContract.Document
@@ -48,18 +47,15 @@ class FileCursor(projection: Array<String>?) : MatrixCursor(projection ?: DEFAUL
4847

4948
flags = flags or Document.FLAG_SUPPORTS_DELETE
5049
flags = flags or Document.FLAG_SUPPORTS_RENAME
50+
flags = flags or Document.FLAG_SUPPORTS_COPY
51+
flags = flags or Document.FLAG_SUPPORTS_MOVE
5152

5253
if (mimeType != Document.MIME_TYPE_DIR) { // If it is a file
5354
flags = flags or Document.FLAG_SUPPORTS_WRITE
5455
} else if (file.hasAddFilePermission && file.hasAddSubdirectoriesPermission) { // If it is a folder with writing permissions
5556
flags = flags or Document.FLAG_DIR_SUPPORTS_CREATE
5657
}
5758

58-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
59-
flags = flags or Document.FLAG_SUPPORTS_COPY
60-
flags = flags or Document.FLAG_SUPPORTS_MOVE
61-
}
62-
6359
newRow()
6460
.add(Document.COLUMN_DOCUMENT_ID, file.id.toString())
6561
.add(Document.COLUMN_DISPLAY_NAME, file.fileName)

0 commit comments

Comments
 (0)