diff --git a/app/build.gradle b/app/build.gradle
index ee223cd35..8bda1e02e 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -43,7 +43,7 @@ android {
defaultConfig {
minSdkVersion 24
- targetSdkVersion 33
+ targetSdkVersion 34
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
// mayor.minor.hotfix.increment (for increment: 01-50=Alpha / 51-89=RC / 90-99=stable)
diff --git a/app/lint.xml b/app/lint.xml
index c571055aa..d0d2d08f6 100644
--- a/app/lint.xml
+++ b/app/lint.xml
@@ -13,6 +13,12 @@
+
+
+
+
+
+
diff --git a/app/src/gplay/AndroidManifest.xml b/app/src/gplay/AndroidManifest.xml
index 7661d02bd..4032681e4 100644
--- a/app/src/gplay/AndroidManifest.xml
+++ b/app/src/gplay/AndroidManifest.xml
@@ -23,6 +23,8 @@
+
+
+ android:exported="false">
diff --git a/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt b/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt
index 2439940de..aebaabe24 100644
--- a/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt
+++ b/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt
@@ -113,6 +113,7 @@ import com.nextcloud.talk.utils.ApiUtils
import com.nextcloud.talk.utils.DisplayUtils
import com.nextcloud.talk.utils.NotificationUtils.cancelExistingNotificationsForRoom
import com.nextcloud.talk.utils.NotificationUtils.getCallRingtoneUri
+import com.nextcloud.talk.utils.ReceiverFlag
import com.nextcloud.talk.utils.VibrationUtils.vibrateShort
import com.nextcloud.talk.utils.animations.PulseAnimation
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_CALL_VOICE_ONLY
@@ -136,6 +137,7 @@ import com.nextcloud.talk.utils.database.user.CapabilitiesUtilNew.isCallRecordin
import com.nextcloud.talk.utils.database.user.CurrentUserProviderNew
import com.nextcloud.talk.utils.permissions.PlatformPermissionUtil
import com.nextcloud.talk.utils.power.PowerManagerUtils
+import com.nextcloud.talk.utils.registerPermissionHandlerBroadcastReceiver
import com.nextcloud.talk.utils.singletons.ApplicationWideCurrentRoomHolder
import com.nextcloud.talk.viewmodels.CallRecordingViewModel
import com.nextcloud.talk.viewmodels.CallRecordingViewModel.RecordingConfirmStopState
@@ -3015,11 +3017,12 @@ class CallActivity : CallBaseActivity() {
}
}
}
- registerReceiver(
+ registerPermissionHandlerBroadcastReceiver(
mReceiver,
IntentFilter(MICROPHONE_PIP_INTENT_NAME),
permissionUtil!!.privateBroadcastPermission,
- null
+ null,
+ ReceiverFlag.NotExported
)
updateUiForPipMode()
} else {
diff --git a/app/src/main/java/com/nextcloud/talk/utils/ContextExtensions.kt b/app/src/main/java/com/nextcloud/talk/utils/ContextExtensions.kt
new file mode 100644
index 000000000..ed85664f3
--- /dev/null
+++ b/app/src/main/java/com/nextcloud/talk/utils/ContextExtensions.kt
@@ -0,0 +1,54 @@
+/*
+ * Nextcloud Android client application
+ *
+ * @author Alper Ozturk
+ * Copyright (C) 2023 Alper Ozturk
+ * Copyright (C) 2023 Nextcloud GmbH
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package com.nextcloud.talk.utils
+
+import android.annotation.SuppressLint
+import android.content.BroadcastReceiver
+import android.content.Context
+import android.content.Intent
+import android.content.IntentFilter
+import android.os.Build
+import android.os.Handler
+
+@SuppressLint("UnspecifiedRegisterReceiverFlag")
+fun Context.registerBroadcastReceiver(receiver: BroadcastReceiver?, filter: IntentFilter, flag: ReceiverFlag): Intent? {
+ return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ registerReceiver(receiver, filter, flag.getId())
+ } else {
+ registerReceiver(receiver, filter)
+ }
+}
+
+@SuppressLint("UnspecifiedRegisterReceiverFlag")
+fun Context.registerPermissionHandlerBroadcastReceiver(
+ receiver: BroadcastReceiver?,
+ filter: IntentFilter,
+ broadcastPermission: String?,
+ scheduler: Handler?,
+ flag: ReceiverFlag
+): Intent? {
+ return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ registerReceiver(receiver, filter, broadcastPermission, scheduler, flag.getId())
+ } else {
+ registerReceiver(receiver, filter, broadcastPermission, scheduler)
+ }
+}
diff --git a/app/src/main/java/com/nextcloud/talk/utils/ReceiverFlag.kt b/app/src/main/java/com/nextcloud/talk/utils/ReceiverFlag.kt
new file mode 100644
index 000000000..8ceda84be
--- /dev/null
+++ b/app/src/main/java/com/nextcloud/talk/utils/ReceiverFlag.kt
@@ -0,0 +1,35 @@
+/*
+ * Nextcloud Android client application
+ *
+ * @author Alper Ozturk
+ * Copyright (C) 2023 Alper Ozturk
+ * Copyright (C) 2023 Nextcloud GmbH
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package com.nextcloud.talk.utils
+
+import android.content.Context
+import android.os.Build
+import androidx.annotation.RequiresApi
+
+enum class ReceiverFlag {
+ NotExported;
+
+ @RequiresApi(Build.VERSION_CODES.TIRAMISU)
+ fun getId(): Int {
+ return Context.RECEIVER_NOT_EXPORTED
+ }
+}
diff --git a/app/src/main/java/com/nextcloud/talk/webrtc/WebRtcAudioManager.java b/app/src/main/java/com/nextcloud/talk/webrtc/WebRtcAudioManager.java
index a3cf70773..1cd0c6bca 100644
--- a/app/src/main/java/com/nextcloud/talk/webrtc/WebRtcAudioManager.java
+++ b/app/src/main/java/com/nextcloud/talk/webrtc/WebRtcAudioManager.java
@@ -44,6 +44,8 @@ import android.media.AudioManager;
import android.util.Log;
import com.nextcloud.talk.events.ProximitySensorEvent;
+import com.nextcloud.talk.utils.ContextExtensionsKt;
+import com.nextcloud.talk.utils.ReceiverFlag;
import com.nextcloud.talk.utils.power.PowerManagerUtils;
import org.greenrobot.eventbus.EventBus;
@@ -55,7 +57,7 @@ import java.util.Set;
public class WebRtcAudioManager {
private static final String TAG = WebRtcAudioManager.class.getSimpleName();
- private final Context magicContext;
+ private final Context context;
private final WebRtcBluetoothManager bluetoothManager;
private final boolean useProximitySensor;
private final AudioManager audioManager;
@@ -81,7 +83,7 @@ public class WebRtcAudioManager {
private WebRtcAudioManager(Context context, boolean useProximitySensor) {
Log.d(TAG, "ctor");
ThreadUtils.checkIsOnMainThread();
- magicContext = context;
+ this.context = context;
audioManager = ((AudioManager) context.getSystemService(Context.AUDIO_SERVICE));
bluetoothManager = WebRtcBluetoothManager.create(context, this);
wiredHeadsetReceiver = new WiredHeadsetReceiver();
@@ -339,14 +341,14 @@ public class WebRtcAudioManager {
* Helper method for receiver registration.
*/
private void registerReceiver(BroadcastReceiver receiver, IntentFilter filter) {
- magicContext.registerReceiver(receiver, filter);
+ ContextExtensionsKt.registerBroadcastReceiver(context, receiver, filter, ReceiverFlag.NotExported);
}
/**
* Helper method for unregistration of an existing receiver.
*/
private void unregisterReceiver(BroadcastReceiver receiver) {
- magicContext.unregisterReceiver(receiver);
+ context.unregisterReceiver(receiver);
}
/**
@@ -375,7 +377,7 @@ public class WebRtcAudioManager {
* Gets the current earpiece state.
*/
private boolean hasEarpiece() {
- return magicContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY);
+ return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY);
}
/**
diff --git a/app/src/main/java/com/nextcloud/talk/webrtc/WebRtcBluetoothManager.java b/app/src/main/java/com/nextcloud/talk/webrtc/WebRtcBluetoothManager.java
index ba530f1c3..4f0ddd9bf 100644
--- a/app/src/main/java/com/nextcloud/talk/webrtc/WebRtcBluetoothManager.java
+++ b/app/src/main/java/com/nextcloud/talk/webrtc/WebRtcBluetoothManager.java
@@ -51,6 +51,9 @@ import android.os.Looper;
import android.os.Process;
import android.util.Log;
+import com.nextcloud.talk.utils.ContextExtensionsKt;
+import com.nextcloud.talk.utils.ReceiverFlag;
+
import org.webrtc.ThreadUtils;
import java.util.List;
@@ -300,7 +303,11 @@ public class WebRtcBluetoothManager {
}
protected void registerReceiver(BroadcastReceiver receiver, IntentFilter filter) {
- apprtcContext.registerReceiver(receiver, filter);
+ ContextExtensionsKt.registerBroadcastReceiver(
+ apprtcContext,
+ receiver,
+ filter,
+ ReceiverFlag.NotExported);
}
protected void unregisterReceiver(BroadcastReceiver receiver) {
diff --git a/scripts/analysis/lint-results.txt b/scripts/analysis/lint-results.txt
index 7cc7b2ee3..992f68d81 100644
--- a/scripts/analysis/lint-results.txt
+++ b/scripts/analysis/lint-results.txt
@@ -1,2 +1,2 @@
DO NOT TOUCH; GENERATED BY DRONE
- Lint Report: 8 errors and 83 warnings
+ Lint Report: 8 errors and 80 warnings