From 19c25a8106ac187df0e171be0c193b0e33c3a820 Mon Sep 17 00:00:00 2001 From: Arne Date: Mon, 22 May 2023 19:22:26 +0200 Subject: [PATCH] Support API 33 feature detection (Cheogram) --- build.gradle | 2 +- src/main/java/eu/siacs/conversations/entities/Contact.java | 6 ++++++ .../eu/siacs/conversations/persistance/FileBackend.java | 5 +++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 3fa05d0d4..d6225576d 100644 --- a/build.gradle +++ b/build.gradle @@ -125,7 +125,7 @@ def tags = grgit.tag.list().findAll { it.dateTime != null }.sort { it.dateTime } android { namespace 'eu.siacs.conversations' //noinspection GradleCompatible - compileSdkVersion 32 + compileSdkVersion 33 defaultConfig { minSdkVersion 21 diff --git a/src/main/java/eu/siacs/conversations/entities/Contact.java b/src/main/java/eu/siacs/conversations/entities/Contact.java index 40fe4af2a..22e0846ea 100644 --- a/src/main/java/eu/siacs/conversations/entities/Contact.java +++ b/src/main/java/eu/siacs/conversations/entities/Contact.java @@ -731,6 +731,12 @@ public class Contact implements ListItem, Blockable { // This Contact is a gateway to use for voice calls, register it with OS public void registerAsPhoneAccount(XmppConnectionService ctx) { if (Build.VERSION.SDK_INT < 23) return; + if (Build.VERSION.SDK_INT >= 33) { + if (!ctx.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELECOM)) return; + } else { + if (!ctx.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CONNECTION_SERVICE)) return; + } + if (!ctx.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CONNECTION_SERVICE)) return; TelecomManager telecomManager = ctx.getSystemService(TelecomManager.class); diff --git a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java index e5a20e38d..fc94db3ff 100644 --- a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java +++ b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java @@ -1980,6 +1980,11 @@ public class FileBackend { } catch (Exception e) { width = -1; } + try { + metadataRetriever.release(); + } catch (final IOException e) { + throw new NotAVideoFile(); + } metadataRetriever.release(); Log.d(Config.LOGTAG, "extracted video dims " + width + "x" + height); return rotated ? new Dimensions(width, height) : new Dimensions(height, width);