From 68beb2701a8b535714bf54c0db082abcebc3b89a Mon Sep 17 00:00:00 2001 From: Andy Garron Date: Sat, 4 Nov 2023 06:59:59 -0700 Subject: [PATCH] [Android] use explicit not-exported flag for AudioBecomingNoisyReceiver (#3327) * using explicit not-exported flag for AudioBecomingNoisyReceiver * androidx.core:core version 1.9.0, androix.activity:activity version 1.6.0 --------- Co-authored-by: Andy G --- android/build.gradle | 9 ++++----- .../brentvatne/receiver/AudioBecomingNoisyReceiver.java | 3 ++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index f159fa64..40c7f487 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -152,11 +152,10 @@ dependencies { exclude group: 'com.android.support' } - // All support libs must use the same version - implementation "androidx.annotation:annotation:1.1.0" - implementation "androidx.core:core:1.1.0" - implementation "androidx.media:media:1.1.0" - implementation "androidx.activity:activity:1.4.0" + implementation "androidx.annotation:annotation:1.7.0" + implementation "androidx.core:core:1.9.0" + implementation "androidx.media:media:1.6.0" + implementation "androidx.activity:activity:1.6.0" implementation('com.google.android.exoplayer:extension-okhttp:2.18.1') { exclude group: 'com.squareup.okhttp3', module: 'okhttp' diff --git a/android/src/main/java/com/brentvatne/receiver/AudioBecomingNoisyReceiver.java b/android/src/main/java/com/brentvatne/receiver/AudioBecomingNoisyReceiver.java index 82f8e28c..3a114920 100644 --- a/android/src/main/java/com/brentvatne/receiver/AudioBecomingNoisyReceiver.java +++ b/android/src/main/java/com/brentvatne/receiver/AudioBecomingNoisyReceiver.java @@ -2,6 +2,7 @@ package com.brentvatne.receiver; import android.content.BroadcastReceiver; import android.content.Context; +import androidx.core.content.ContextCompat; import android.content.Intent; import android.content.IntentFilter; import android.media.AudioManager; @@ -25,7 +26,7 @@ public class AudioBecomingNoisyReceiver extends BroadcastReceiver { public void setListener(BecomingNoisyListener listener) { this.listener = listener; IntentFilter intentFilter = new IntentFilter(AudioManager.ACTION_AUDIO_BECOMING_NOISY); - context.registerReceiver(this, intentFilter); + ContextCompat.registerReceiver(context, this, intentFilter, ContextCompat.RECEIVER_NOT_EXPORTED); } public void removeListener() {