Skip to content

Commit

Permalink
Create a Debug manifest inside React Native Android
Browse files Browse the repository at this point in the history
Summary:
While working on debugging tools, I noticed that we ask in every template app to
- Add a "com.facebook.react.devsupport.DevSettingsActivity" activity
- Add the <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

This is error prone and can be cleanup as we now distribute React Native that is variant aware (debug/release).
So I'm creating a manifest inside `src/debug` that contains those directive so we don't need to ask users
to add them (I'm removing them from the template).

Changelog:
[Internal] [Changed] - Create a Debug manifest inside React Native Android

Reviewed By: cipolleschi

Differential Revision: D46556884

fbshipit-source-id: 0867968935a3ae1a7e0810091a03c3a0f1715e65
  • Loading branch information
cortinico authored and facebook-github-bot committed Jun 8, 2023
1 parent 3221f37 commit e4f963a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
15 changes: 15 additions & 0 deletions packages/react-native/ReactAndroid/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<!--
This manifest file is used only by Gradle to configure debug-only capabilities
for React Native Apps.
-->
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

<application>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity"
android:exported="false" />
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@
* instance manager recreates it (through {@link #onNewReactContextCreated). Also, instance manager
* is responsible for enabling/disabling dev support in case when app is backgrounded or when all
* the views has been detached from the instance (through {@link #setDevSupportEnabled} method).
*
* IMPORTANT: In order for developer support to work correctly it is required that the
* manifest of your application contain the following entries:
* {@code <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false"/>}
* {@code <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>}
*/
public final class BridgeDevSupportManager extends DevSupportManagerBase {
private boolean mIsSamplingProfilerEnabled = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

<application
android:usesCleartextTraffic="true"
tools:targetApi="28"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false" />
</application>
tools:ignore="GoogleAppIndexingWarning"/>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
<data android:scheme="rntester" android:host="example" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false"/>
<provider
android:name="com.facebook.react.modules.blob.BlobProvider"
android:authorities="@string/blob_provider_authority"
Expand Down

0 comments on commit e4f963a

Please sign in to comment.