mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Re-add Start/Stop Sampling profiler in Dev Menu for Android
Reviewed By: yinghuitan Differential Revision: D16069122 fbshipit-source-id: 179ba7ec709731f4b861dc4367df357e93e025f2
This commit is contained in:
committed by
Facebook Github Bot
parent
e8c5495961
commit
8e3ccaadf2
@@ -36,6 +36,7 @@ public class DevInternalSettings
|
||||
private static final String PREFS_INSPECTOR_DEBUG_KEY = "inspector_debug";
|
||||
private static final String PREFS_HOT_MODULE_REPLACEMENT_KEY = "hot_module_replacement";
|
||||
private static final String PREFS_REMOTE_JS_DEBUG_KEY = "remote_js_debug";
|
||||
private static final String PREFS_SAMPLING_PROFILER_ENABLED = "sampling_profiler_enabled";
|
||||
|
||||
private final SharedPreferences mPreferences;
|
||||
private final Listener mListener;
|
||||
|
||||
@@ -95,6 +95,9 @@ public class DevSupportManagerImpl
|
||||
private static final int JSEXCEPTION_ERROR_COOKIE = -1;
|
||||
private static final String JS_BUNDLE_FILE_NAME = "ReactNativeDevBundle.js";
|
||||
private static final String RELOAD_APP_ACTION_SUFFIX = ".RELOAD_APP_ACTION";
|
||||
private static final String ENABLE_SAMPLING_PROFILER = ".ENABLE_SAMPLING_PROFILER";
|
||||
private static final String DISABLE_SAMPLING_PROFILER = ".DISABLE_SAMPLING_PROFILER";
|
||||
private boolean mIsSamplingProfilerEnabled = false;
|
||||
|
||||
private enum ErrorType {
|
||||
JS,
|
||||
@@ -543,6 +546,24 @@ public class DevSupportManagerImpl
|
||||
}
|
||||
}
|
||||
});
|
||||
options.put(
|
||||
mIsSamplingProfilerEnabled
|
||||
? mApplicationContext.getString(R.string.catalyst_sample_profiler_disable)
|
||||
: mApplicationContext.getString(R.string.catalyst_sample_profiler_enable),
|
||||
new DevOptionHandler() {
|
||||
@Override
|
||||
public void onOptionSelected() {
|
||||
Intent intent =
|
||||
new Intent(
|
||||
mApplicationContext.getPackageName()
|
||||
+ (mIsSamplingProfilerEnabled
|
||||
? DISABLE_SAMPLING_PROFILER
|
||||
: ENABLE_SAMPLING_PROFILER));
|
||||
mApplicationContext.sendBroadcast(intent);
|
||||
mIsSamplingProfilerEnabled = !mIsSamplingProfilerEnabled;
|
||||
}
|
||||
});
|
||||
|
||||
options.put(
|
||||
mDevSettings.isFpsDebugEnabled()
|
||||
? mApplicationContext.getString(R.string.catalyst_perf_monitor_stop)
|
||||
|
||||
Reference in New Issue
Block a user