From 8e533b52333ea11e32b476785b8bd80a19e7de49 Mon Sep 17 00:00:00 2001 From: Mikhail Suendukov Date: Wed, 11 Oct 2023 19:12:46 +0200 Subject: [PATCH] add flag FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT for PendingIntent and use RECEIVER_EXPORTED --- .../distribute/install/session/InstallStatusReceiver.java | 3 +++ .../distribute/install/session/SessionReleaseInstaller.java | 2 +- versions.gradle | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/sdk/appcenter-distribute/src/main/java/com/microsoft/appcenter/distribute/install/session/InstallStatusReceiver.java b/sdk/appcenter-distribute/src/main/java/com/microsoft/appcenter/distribute/install/session/InstallStatusReceiver.java index a91aad3ab..2a007b71c 100644 --- a/sdk/appcenter-distribute/src/main/java/com/microsoft/appcenter/distribute/install/session/InstallStatusReceiver.java +++ b/sdk/appcenter-distribute/src/main/java/com/microsoft/appcenter/distribute/install/session/InstallStatusReceiver.java @@ -49,6 +49,9 @@ static IntentSender getInstallStatusIntentSender(Context context, int requestCod int broadcastFlags = 0; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { broadcastFlags = PendingIntent.FLAG_MUTABLE; + if (Build.VERSION.SDK_INT >= 34) { + broadcastFlags |= PendingIntent.FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT; + } } PendingIntent pendingIntent = PendingIntent.getBroadcast( context, diff --git a/sdk/appcenter-distribute/src/main/java/com/microsoft/appcenter/distribute/install/session/SessionReleaseInstaller.java b/sdk/appcenter-distribute/src/main/java/com/microsoft/appcenter/distribute/install/session/SessionReleaseInstaller.java index f590564b5..1e40d2b4d 100644 --- a/sdk/appcenter-distribute/src/main/java/com/microsoft/appcenter/distribute/install/session/SessionReleaseInstaller.java +++ b/sdk/appcenter-distribute/src/main/java/com/microsoft/appcenter/distribute/install/session/SessionReleaseInstaller.java @@ -235,7 +235,7 @@ private synchronized void registerListeners() { AppCenterLog.debug(LOG_TAG, "Register receiver for installing a new release."); mInstallStatusReceiver = new InstallStatusReceiver(this); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { - mContext.registerReceiver(mInstallStatusReceiver, InstallStatusReceiver.getInstallerReceiverFilter(), Context.RECEIVER_NOT_EXPORTED); + mContext.registerReceiver(mInstallStatusReceiver, InstallStatusReceiver.getInstallerReceiverFilter(), Context.RECEIVER_EXPORTED); } else { mContext.registerReceiver(mInstallStatusReceiver, InstallStatusReceiver.getInstallerReceiverFilter()); } diff --git a/versions.gradle b/versions.gradle index 781c0a9be..1d23cdf61 100644 --- a/versions.gradle +++ b/versions.gradle @@ -9,7 +9,7 @@ ext { versionCode = 72 versionName = '5.0.3' minSdkVersion = 21 - compileSdkVersion = 33 + compileSdkVersion = 34 targetSdkVersion = 34 annotationVersion = '1.2.0' } \ No newline at end of file