xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/PerftestDevSupportManager.java (#45684)

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

Changelog: [Internal]

Differential Revision: D60233489

fbshipit-source-id: 00f0ab65824415242925a5a8e85793487dc251e0
This commit is contained in:
Andrew Datsenko
2024-07-29 06:34:25 -07:00
committed by Facebook GitHub Bot
parent c6f89c300d
commit 7c1740a44c
2 changed files with 38 additions and 50 deletions
@@ -1,50 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.devsupport;
import android.content.Context;
import com.facebook.infer.annotation.Nullsafe;
import com.facebook.react.modules.debug.interfaces.DeveloperSettings;
/**
* Interface for accessing and interacting with development features related to performance testing.
* Communication is enabled via the Inspector, but everything else is disabled.
*/
@Nullsafe(Nullsafe.Mode.LOCAL)
public final class PerftestDevSupportManager extends ReleaseDevSupportManager {
private final DevServerHelper mDevServerHelper;
private final DeveloperSettings mDevSettings;
public PerftestDevSupportManager(Context applicationContext) {
mDevSettings =
new DevInternalSettings(
applicationContext,
new DevInternalSettings.Listener() {
@Override
public void onInternalSettingsChanged() {}
});
mDevServerHelper =
new DevServerHelper(
mDevSettings, applicationContext, mDevSettings.getPackagerConnectionSettings());
}
@Override
public DeveloperSettings getDevSettings() {
return mDevSettings;
}
@Override
public void startInspector() {
mDevServerHelper.openInspectorConnection();
}
@Override
public void stopInspector() {
mDevServerHelper.closeInspectorConnection();
}
}
@@ -0,0 +1,38 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.devsupport
import android.content.Context
import com.facebook.react.modules.debug.interfaces.DeveloperSettings
/**
* Interface for accessing and interacting with development features related to performance testing.
* Communication is enabled via the Inspector, but everything else is disabled.
*/
public class PerftestDevSupportManager(
applicationContext: Context,
) : ReleaseDevSupportManager() {
override public val devSettings: DeveloperSettings =
DevInternalSettings(
applicationContext,
object : DevInternalSettings.Listener {
override fun onInternalSettingsChanged() = Unit
})
private val devServerHelper: DevServerHelper =
DevServerHelper(devSettings, applicationContext, devSettings.packagerConnectionSettings)
override fun startInspector() {
devServerHelper.openInspectorConnection()
}
override fun stopInspector() {
devServerHelper.closeInspectorConnection()
}
}