Enable identifying profiling builds on proxy registration (#47967)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47967

(Android only) Updates `jsinspector-modern` to enable identifying profiling builds (experimental) when registering the debug target with the Inspector Proxy.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D66501768

fbshipit-source-id: bbe2b9a2c7c014c952ef5ee49284a161dbeefb09
This commit is contained in:
Alex Hunt
2024-11-27 11:42:31 -08:00
committed by Facebook GitHub Bot
parent b9762d568a
commit b95631ed7f
5 changed files with 16 additions and 2 deletions
@@ -2219,6 +2219,7 @@ public abstract interface class com/facebook/react/devsupport/HMRClient : com/fa
public final class com/facebook/react/devsupport/InspectorFlags {
public static final field INSTANCE Lcom/facebook/react/devsupport/InspectorFlags;
public static final fun getFuseboxEnabled ()Z
public static final fun getIsProfilingBuild ()Z
}
public class com/facebook/react/devsupport/InspectorPackagerConnection : com/facebook/react/devsupport/IInspectorPackagerConnection {
@@ -325,11 +325,12 @@ public class DevServerHelper {
private String getInspectorDeviceUrl() {
return String.format(
Locale.US,
"http://%s/inspector/device?name=%s&app=%s&device=%s",
"http://%s/inspector/device?name=%s&app=%s&device=%s&profiling=%b",
mPackagerConnectionSettings.getDebugServerHost(),
Uri.encode(AndroidInfoHelpers.getFriendlyDeviceName()),
Uri.encode(mPackageName),
Uri.encode(getInspectorDeviceId()));
Uri.encode(getInspectorDeviceId()),
InspectorFlags.getIsProfilingBuild());
}
public void downloadBundleFromURL(
@@ -17,4 +17,6 @@ public object InspectorFlags {
}
@DoNotStrip @JvmStatic public external fun getFuseboxEnabled(): Boolean
@DoNotStrip @JvmStatic public external fun getIsProfilingBuild(): Boolean
}
@@ -16,10 +16,19 @@ bool JInspectorFlags::getFuseboxEnabled(jni::alias_ref<jclass> /*unused*/) {
return inspectorFlags.getFuseboxEnabled();
}
bool JInspectorFlags::getIsProfilingBuild(jni::alias_ref<jclass> /*unused*/) {
auto& inspectorFlags = InspectorFlags::getInstance();
return inspectorFlags.getIsProfilingBuild();
}
void JInspectorFlags::registerNatives() {
javaClassLocal()->registerNatives({
makeNativeMethod("getFuseboxEnabled", JInspectorFlags::getFuseboxEnabled),
});
javaClassLocal()->registerNatives({
makeNativeMethod(
"getIsProfilingBuild", JInspectorFlags::getIsProfilingBuild),
});
}
} // namespace facebook::react::jsinspector_modern
@@ -20,6 +20,7 @@ class JInspectorFlags : public jni::JavaClass<JInspectorFlags> {
"Lcom/facebook/react/devsupport/InspectorFlags;";
static bool getFuseboxEnabled(jni::alias_ref<jclass>);
static bool getIsProfilingBuild(jni::alias_ref<jclass>);
static void registerNatives();