From 39c8277904c97b7de4fcd063ab2210e4226dd1d0 Mon Sep 17 00:00:00 2001 From: Julian Raufelder Date: Mon, 9 May 2022 15:31:03 +0200 Subject: [PATCH] Update target SDK to 31 (Android 12) --- buildsystem/dependencies.gradle | 4 +- presentation/src/main/AndroidManifest.xml | 56 +++++++++++++++---- .../service/AutoUploadNotification.kt | 4 +- .../service/OpenWritableFileNotification.kt | 3 +- .../service/UnlockedNotification.java | 7 +-- 5 files changed, 54 insertions(+), 20 deletions(-) diff --git a/buildsystem/dependencies.gradle b/buildsystem/dependencies.gradle index 7704025f..0faa846a 100644 --- a/buildsystem/dependencies.gradle +++ b/buildsystem/dependencies.gradle @@ -21,8 +21,8 @@ allprojects { ext { androidBuildToolsVersion = "30.0.3" androidMinSdkVersion = 26 - androidTargetSdkVersion = 30 - androidCompileSdkVersion = 30 + androidTargetSdkVersion = 31 + androidCompileSdkVersion = 31 // android and java libs androidVersion = '4.1.1.4' diff --git a/presentation/src/main/AndroidManifest.xml b/presentation/src/main/AndroidManifest.xml index 9c449d8b..359fb2ec 100644 --- a/presentation/src/main/AndroidManifest.xml +++ b/presentation/src/main/AndroidManifest.xml @@ -37,6 +37,7 @@ @@ -47,25 +48,31 @@ @@ -80,12 +87,14 @@ @@ -98,22 +107,40 @@ - - - - - - - - + + + + + + + + @@ -131,10 +158,12 @@ @@ -159,11 +188,15 @@ - + + + @@ -209,7 +243,9 @@ - + diff --git a/presentation/src/main/java/org/cryptomator/presentation/service/AutoUploadNotification.kt b/presentation/src/main/java/org/cryptomator/presentation/service/AutoUploadNotification.kt index d2f38f46..cfd8f00a 100644 --- a/presentation/src/main/java/org/cryptomator/presentation/service/AutoUploadNotification.kt +++ b/presentation/src/main/java/org/cryptomator/presentation/service/AutoUploadNotification.kt @@ -48,7 +48,7 @@ class AutoUploadNotification(private val context: Context, private val amountOfP private fun cancelNowAction(): NotificationCompat.Action { val intentAction = cancelAutoUploadIntent(context) - val cancelIntent = PendingIntent.getService(context, 0, intentAction, FLAG_CANCEL_CURRENT) + val cancelIntent = PendingIntent.getService(context, 0, intentAction, FLAG_CANCEL_CURRENT or PendingIntent.FLAG_IMMUTABLE) return NotificationCompat.Action.Builder( // R.drawable.ic_lock, // getString(R.string.notification_cancel_auto_upload), // @@ -60,7 +60,7 @@ class AutoUploadNotification(private val context: Context, private val amountOfP val startTheActivity = Intent(context, VaultListActivity::class.java) startTheActivity.action = ACTION_MAIN startTheActivity.flags = FLAG_ACTIVITY_CLEAR_TASK or FLAG_ACTIVITY_NEW_TASK - return PendingIntent.getActivity(context, 0, startTheActivity, FLAG_CANCEL_CURRENT) + return PendingIntent.getActivity(context, 0, startTheActivity, FLAG_CANCEL_CURRENT or PendingIntent.FLAG_IMMUTABLE) } fun update(progress: Int) { diff --git a/presentation/src/main/java/org/cryptomator/presentation/service/OpenWritableFileNotification.kt b/presentation/src/main/java/org/cryptomator/presentation/service/OpenWritableFileNotification.kt index 023945fa..f36d6098 100644 --- a/presentation/src/main/java/org/cryptomator/presentation/service/OpenWritableFileNotification.kt +++ b/presentation/src/main/java/org/cryptomator/presentation/service/OpenWritableFileNotification.kt @@ -4,7 +4,6 @@ import android.app.NotificationChannel import android.app.NotificationManager import android.app.NotificationManager.IMPORTANCE_LOW import android.app.PendingIntent -import android.app.PendingIntent.FLAG_CANCEL_CURRENT import android.content.Context import android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION import android.content.Intent.FLAG_GRANT_WRITE_URI_PERMISSION @@ -54,7 +53,7 @@ class OpenWritableFileNotification(private val context: Context, private val uri private fun cancelNowIntent(): PendingIntent { context.revokeUriPermission(uriToOpenendFile, FLAG_GRANT_WRITE_URI_PERMISSION or FLAG_GRANT_READ_URI_PERMISSION) val startTheActivity = vaultListIntent().withStopEditFileNotification(true).build(context as ContextHolder) - return PendingIntent.getActivity(context, 0, startTheActivity, FLAG_CANCEL_CURRENT) + return PendingIntent.getActivity(context, 0, startTheActivity, PendingIntent.FLAG_CANCEL_CURRENT or PendingIntent.FLAG_IMMUTABLE) } fun show() { diff --git a/presentation/src/main/java/org/cryptomator/presentation/service/UnlockedNotification.java b/presentation/src/main/java/org/cryptomator/presentation/service/UnlockedNotification.java index 52c53c92..1b90f1d1 100644 --- a/presentation/src/main/java/org/cryptomator/presentation/service/UnlockedNotification.java +++ b/presentation/src/main/java/org/cryptomator/presentation/service/UnlockedNotification.java @@ -16,7 +16,6 @@ import org.cryptomator.presentation.util.ResourceHelper; import timber.log.Timber; import static android.app.NotificationManager.IMPORTANCE_LOW; -import static android.app.PendingIntent.FLAG_CANCEL_CURRENT; import static android.content.Intent.ACTION_MAIN; import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK; import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; @@ -73,15 +72,15 @@ class UnlockedNotification { return PendingIntent.getService( // service.getApplicationContext(), // 0, // - CryptorsService.lockAllIntent(service.getApplicationContext()), // - FLAG_CANCEL_CURRENT); + CryptorsService.lockAllIntent(service.getApplicationContext()), + PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE); } private PendingIntent startTheActivity() { Intent startTheActivity = new Intent(service, VaultListActivity.class); startTheActivity.setAction(ACTION_MAIN); startTheActivity.setFlags(FLAG_ACTIVITY_CLEAR_TASK | FLAG_ACTIVITY_NEW_TASK); - return PendingIntent.getActivity(service, 0, startTheActivity, 0); + return PendingIntent.getActivity(service, 0, startTheActivity, PendingIntent.FLAG_IMMUTABLE); } public void setUnlockedCount(int unlocked) {