From b163bd6490c9da685e5e306f51247e0766bbec5b Mon Sep 17 00:00:00 2001 From: Nikita Ogorodnikov Date: Tue, 3 Oct 2023 17:49:48 +0200 Subject: [PATCH] Update AGP to 8.1.1 --- .../android/core/internal/receiver/ThreadSafeReceiver.kt | 9 ++++++++- detekt_custom.yml | 1 + gradle/libs.versions.toml | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dd-sdk-android-core/src/main/kotlin/com/datadog/android/core/internal/receiver/ThreadSafeReceiver.kt b/dd-sdk-android-core/src/main/kotlin/com/datadog/android/core/internal/receiver/ThreadSafeReceiver.kt index a26dd30a2e..c054b0309d 100644 --- a/dd-sdk-android-core/src/main/kotlin/com/datadog/android/core/internal/receiver/ThreadSafeReceiver.kt +++ b/dd-sdk-android-core/src/main/kotlin/com/datadog/android/core/internal/receiver/ThreadSafeReceiver.kt @@ -6,21 +6,28 @@ package com.datadog.android.core.internal.receiver +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 java.util.concurrent.atomic.AtomicBoolean internal abstract class ThreadSafeReceiver : BroadcastReceiver() { val isRegistered = AtomicBoolean(false) + @SuppressLint("UnspecifiedRegisterReceiverFlag") fun registerReceiver( context: Context, filter: IntentFilter ): Intent? { - val intent = context.registerReceiver(this, filter) + val intent = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + context.registerReceiver(this, filter, Context.RECEIVER_NOT_EXPORTED) + } else { + context.registerReceiver(this, filter) + } isRegistered.set(true) return intent } diff --git a/detekt_custom.yml b/detekt_custom.yml index f59b2b5933..ec99d84d0f 100644 --- a/detekt_custom.yml +++ b/detekt_custom.yml @@ -286,6 +286,7 @@ datadog: - "android.content.Context.getSystemService(kotlin.String)" - "android.content.Context.registerComponentCallbacks(android.content.ComponentCallbacks)" - "android.content.Context.registerReceiver(android.content.BroadcastReceiver?, android.content.IntentFilter)" + - "android.content.Context.registerReceiver(android.content.BroadcastReceiver?, android.content.IntentFilter, kotlin.Int)" - "android.content.Context.unregisterReceiver(android.content.BroadcastReceiver)" - "android.content.Intent.getBooleanExtra(kotlin.String, kotlin.Boolean)" - "android.content.Intent.getIntExtra(kotlin.String, kotlin.Int)" diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 26de3eaae6..a13c353b46 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -7,7 +7,7 @@ okHttp = "4.11.0" kronosNTP = "0.0.1-alpha11" # Android -androidToolsPlugin = "8.0.2" +androidToolsPlugin = "8.1.1" androidXAnnotations = "1.1.0" androidXAppCompat = "1.3.0" androidXCore = "1.3.1"