From 603d2b2299dc844e575cd0c6290802a758702291 Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Thu, 12 Oct 2023 17:57:46 +0100 Subject: [PATCH] Revert "[LOCAL] For targeting SDK 34 - Added RECEIVER_EXPORTED/RECEIVER_NOT_EXPORTED flag support in DevSupportManagerBase" This reverts commit ffbec5b73fde3f6af92726f8fa209e4cddba317d. --- .../devsupport/DevSupportManagerBase.java | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.java index 8fece5579f943c..0141e70c3eb69b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.java @@ -20,7 +20,6 @@ import android.graphics.Color; import android.graphics.Typeface; import android.hardware.SensorManager; -import android.os.Build; import android.util.Pair; import android.view.Gravity; import android.view.View; @@ -1099,7 +1098,7 @@ private void reload() { if (!mIsReceiverRegistered) { IntentFilter filter = new IntentFilter(); filter.addAction(getReloadAppAction(mApplicationContext)); - compatRegisterReceiver(mApplicationContext, mReloadAppBroadcastReceiver, filter, true); + mApplicationContext.registerReceiver(mReloadAppBroadcastReceiver, filter); mIsReceiverRegistered = true; } @@ -1215,21 +1214,4 @@ public void setPackagerLocationCustomizer( return mSurfaceDelegateFactory.createSurfaceDelegate(moduleName); } - - /** - * Starting with Android 14, apps and services that target Android 14 and use context-registered - * receivers are required to specify a flag to indicate whether or not the receiver should be - * exported to all other apps on the device: either RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED - * - *

https://developer.android.com/about/versions/14/behavior-changes-14#runtime-receivers-exported - */ - private void compatRegisterReceiver( - Context context, BroadcastReceiver receiver, IntentFilter filter, boolean exported) { - if (Build.VERSION.SDK_INT >= 34 && context.getApplicationInfo().targetSdkVersion >= 34) { - context.registerReceiver( - receiver, filter, exported ? Context.RECEIVER_EXPORTED : Context.RECEIVER_NOT_EXPORTED); - } else { - context.registerReceiver(receiver, filter); - } - } }