diff --git a/OpenKeychain/build.gradle b/OpenKeychain/build.gradle index 634ac801e..433f770a3 100644 --- a/OpenKeychain/build.gradle +++ b/OpenKeychain/build.gradle @@ -7,13 +7,13 @@ plugins { dependencies { // from local Android SDK implementation 'androidx.legacy:legacy-support-v4:1.0.0' - implementation 'androidx.appcompat:appcompat:1.5.1' - implementation 'androidx.recyclerview:recyclerview:1.2.1' + implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'androidx.recyclerview:recyclerview:1.3.2' implementation 'androidx.cardview:cardview:1.0.0' - implementation 'androidx.annotation:annotation:1.5.0' + implementation 'androidx.annotation:annotation:1.7.1' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - implementation 'androidx.sqlite:sqlite-framework:2.2.0' - implementation 'com.google.android.material:material:1.6.1' + implementation 'androidx.sqlite:sqlite-framework:2.4.0' + implementation 'com.google.android.material:material:1.11.0' // JCenter etc. implementation 'com.journeyapps:zxing-android-embedded:3.4.0' @@ -61,7 +61,7 @@ dependencies { implementation project(':extern:bouncycastle:pg') // implementation project(':openkeychain:extern:bouncycastle:prov') - implementation 'androidx.work:work-runtime:2.7.1' + implementation 'androidx.work:work-runtime:2.9.0' // Unit tests in the local JVM with Robolectric // https://developer.android.com/training/testing/unit-testing/local-unit-tests.html @@ -76,8 +76,8 @@ dependencies { implementation 'com.jakewharton.timber:timber:4.7.1' implementation 'org.glassfish:javax.annotation:10.0-b28' - api "com.google.auto.value:auto-value-annotations:1.6.5" - annotationProcessor "com.google.auto.value:auto-value:1.6.2" + api 'com.google.auto.value:auto-value-annotations:1.10.4' + annotationProcessor 'com.google.auto.value:auto-value:1.6.2' implementation 'com.ryanharter.auto.value:auto-value-parcel-adapter:0.2.6' annotationProcessor "com.ryanharter.auto.value:auto-value-parcel:0.2.6" @@ -94,7 +94,7 @@ android { defaultConfig { minSdkVersion 15 - targetSdkVersion 31 + targetSdkVersion 34 versionCode 58902 // inconsistent at the moment - set to 59000 for 5.9.0! versionName "5.8.2" applicationId "org.sufficientlysecure.keychain" diff --git a/OpenKeychain/src/main/AndroidManifest.xml b/OpenKeychain/src/main/AndroidManifest.xml index 3819a2a3c..23a425784 100644 --- a/OpenKeychain/src/main/AndroidManifest.xml +++ b/OpenKeychain/src/main/AndroidManifest.xml @@ -55,13 +55,14 @@ - - - - + + + + + + + @@ -71,6 +72,7 @@ + @@ -986,6 +991,7 @@ android:enabled="true" android:exported="true" android:process=":remote_api_2" + android:foregroundServiceType="specialUse" tools:ignore="ExportedService"> @@ -999,6 +1005,7 @@ android:enabled="true" android:exported="true" android:process=":remote_ssh_api" + android:foregroundServiceType="specialUse" tools:ignore="ExportedService"> diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/network/orbot/OrbotHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/network/orbot/OrbotHelper.java index 78bafe195..0d1e46e30 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/network/orbot/OrbotHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/network/orbot/OrbotHelper.java @@ -58,6 +58,8 @@ import android.content.IntentFilter; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.net.Uri; +import android.os.Build.VERSION; +import android.os.Build.VERSION_CODES; import android.os.Handler; import android.os.Message; import android.os.Messenger; @@ -451,7 +453,11 @@ public class OrbotHelper { intent.getStringExtra(EXTRA_STATUS)); } }; - context.registerReceiver(receiver, new IntentFilter(OrbotHelper.ACTION_STATUS)); + if (VERSION.SDK_INT >= VERSION_CODES.TIRAMISU) { + context.registerReceiver(receiver, new IntentFilter(OrbotHelper.ACTION_STATUS), Context.RECEIVER_EXPORTED); + } else { + context.registerReceiver(receiver, new IntentFilter(OrbotHelper.ACTION_STATUS)); + } requestStartTor(context); } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/UsbConnectionDispatcher.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/UsbConnectionDispatcher.java index 17b1ea1cb..b8ef3bf4c 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/UsbConnectionDispatcher.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/UsbConnectionDispatcher.java @@ -24,6 +24,8 @@ import android.content.Intent; import android.content.IntentFilter; import android.hardware.usb.UsbDevice; import android.hardware.usb.UsbManager; +import android.os.Build.VERSION; +import android.os.Build.VERSION_CODES; import org.sufficientlysecure.keychain.BuildConfig; import org.sufficientlysecure.keychain.Constants; @@ -71,7 +73,11 @@ public class UsbConnectionDispatcher { final IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(ACTION_USB_PERMISSION); - context.registerReceiver(usbBroadcastReceiver, intentFilter); + if (VERSION.SDK_INT >= VERSION_CODES.TIRAMISU) { + context.registerReceiver(usbBroadcastReceiver, intentFilter, Context.RECEIVER_EXPORTED); + } else { + context.registerReceiver(usbBroadcastReceiver, intentFilter); + } } public void onStop() { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/PassphraseCacheService.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/PassphraseCacheService.java index c6e81c121..dd8dec507 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/PassphraseCacheService.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/PassphraseCacheService.java @@ -29,6 +29,8 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Binder; +import android.os.Build.VERSION; +import android.os.Build.VERSION_CODES; import android.os.Bundle; import android.os.Handler; import android.os.HandlerThread; @@ -36,11 +38,11 @@ import android.os.IBinder; import android.os.Message; import android.os.Messenger; import android.os.RemoteException; + +import androidx.collection.LongSparseArray; import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationCompat.Builder; import androidx.core.app.NotificationCompat.InboxStyle; -import androidx.collection.LongSparseArray; - import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Constants.NotificationIds; import org.sufficientlysecure.keychain.NotificationChannelManager; @@ -318,7 +320,11 @@ public class PassphraseCacheService extends Service { IntentFilter filter = new IntentFilter(); filter.addAction(BROADCAST_ACTION_PASSPHRASE_CACHE_SERVICE); filter.addAction(Intent.ACTION_SCREEN_OFF); - registerReceiver(mIntentReceiver, filter); + if (VERSION.SDK_INT >= VERSION_CODES.TIRAMISU) { + registerReceiver(mIntentReceiver, filter, RECEIVER_EXPORTED); + } else { + registerReceiver(mIntentReceiver, filter); + } } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/PermissionsUtil.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/PermissionsUtil.java index c002d004f..ebc088809 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/PermissionsUtil.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/PermissionsUtil.java @@ -18,6 +18,7 @@ package org.sufficientlysecure.keychain.ui.util; import android.Manifest; +import android.Manifest.permission; import android.annotation.SuppressLint; import android.app.Activity; import android.content.ContentResolver; @@ -25,8 +26,12 @@ import android.content.Context; import android.content.pm.PackageManager; import android.net.Uri; import android.os.Build; + +import androidx.annotation.RequiresApi; import androidx.fragment.app.Fragment; import androidx.core.content.ContextCompat; + +import android.os.Build.VERSION_CODES; import android.widget.Toast; import org.sufficientlysecure.keychain.R; @@ -34,6 +39,13 @@ import org.sufficientlysecure.keychain.R; public class PermissionsUtil { private static final int PERMISSION_READ_EXTERNAL_STORAGE = 1; + public static final String[] READ_PERMISSIONS = { permission.READ_EXTERNAL_STORAGE }; + @RequiresApi(api = VERSION_CODES.TIRAMISU) + public static final String[] READ_PERMISSIONS_TIRAMISU = { + permission.READ_MEDIA_IMAGES, + permission.READ_MEDIA_AUDIO, + permission.READ_MEDIA_VIDEO + }; /** * Request READ_EXTERNAL_STORAGE permission on Android >= 6.0 to read content from "file" Uris. @@ -47,8 +59,7 @@ public class PermissionsUtil { public static boolean checkAndRequestReadPermission(Activity activity, Uri uri) { boolean result = checkReadPermission(activity, uri); if (!result) { - activity.requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, - PERMISSION_READ_EXTERNAL_STORAGE); + activity.requestPermissions(getReadPermissions(), PERMISSION_READ_EXTERNAL_STORAGE); } return result; } @@ -56,12 +67,19 @@ public class PermissionsUtil { public static boolean checkAndRequestReadPermission(Fragment fragment, Uri uri) { boolean result = checkReadPermission(fragment.getContext(), uri); if (!result) { - fragment.requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, - PERMISSION_READ_EXTERNAL_STORAGE); + fragment.requestPermissions(getReadPermissions(), PERMISSION_READ_EXTERNAL_STORAGE); } return result; } + private static String[] getReadPermissions() { + if (Build.VERSION.SDK_INT >= VERSION_CODES.TIRAMISU) { + return READ_PERMISSIONS_TIRAMISU; + } else { + return READ_PERMISSIONS; + } + } + public static boolean checkReadPermission(Context context, Uri uri) { if (!ContentResolver.SCHEME_FILE.equals(uri.getScheme())) { return true; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java index d81a56e26..89e18cc1c 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java @@ -350,11 +350,6 @@ public class Preferences { return mSharedPreferences.getBoolean(Pref.SYNC_KEYSERVER, true); } - public UUID getKeyserverSyncWorkUuid() { - String uuidString = mSharedPreferences.getString(Pref.SYNC_WORK_UUID, null); - return uuidString != null ? UUID.fromString(uuidString) : null; - } - public void setKeyserverSyncScheduled(UUID uuid) { String value = uuid != null ? uuid.toString() : null; mSharedPreferences.edit().putString(Pref.SYNC_WORK_UUID, value).apply(); diff --git a/build.gradle b/build.gradle index b7a8d4c7a..0bc2fbd73 100644 --- a/build.gradle +++ b/build.gradle @@ -29,5 +29,5 @@ allprojects { // SDK Version and Build Tools used by all subprojects // See http://tools.android.com/tech-docs/new-build-system/tips#TOC-Controlling-Android-properties-of-all-your-modules-from-the-main-project. ext { - compileSdkVersion = 33 + compileSdkVersion = 34 } diff --git a/extern/MaterialChipsInput/build.gradle b/extern/MaterialChipsInput/build.gradle index 249bce14b..657357337 100644 --- a/extern/MaterialChipsInput/build.gradle +++ b/extern/MaterialChipsInput/build.gradle @@ -1,7 +1,7 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 28 + compileSdkVersion rootProject.ext.compileSdkVersion defaultConfig { minSdkVersion 15 @@ -21,10 +21,10 @@ android { } dependencies { - implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'androidx.appcompat:appcompat:1.6.1' // recycler - implementation 'androidx.recyclerview:recyclerview:1.1.0' + implementation 'androidx.recyclerview:recyclerview:1.3.2' implementation 'com.beloo.widget:ChipsLayoutManager:0.3.7@aar' }