From 52937337c3eceeff78cf2e9833de98161f3bae4b Mon Sep 17 00:00:00 2001 From: Devan Buggay Date: Fri, 29 Aug 2025 03:14:56 -0700 Subject: [PATCH] Remove legacy perf overlay from DevMenu (#53328) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53328 Disables the legacy performance overlay toggle from the Android DevMenu to make way for V2. Changelog: [Internal] Reviewed By: cortinico Differential Revision: D79791703 fbshipit-source-id: c99ac95e2907ce978ef0c2711ad304c9a3f278ec --- .../react/devsupport/DevSupportManagerBase.kt | 39 ++++++++++--------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.kt index fe26f7601ce..9d455d26f9a 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.kt @@ -450,26 +450,29 @@ public abstract class DevSupportManagerBase( } } - val fpsDebugLabel = - if (devSettings.isFpsDebugEnabled) - applicationContext.getString(R.string.catalyst_perf_monitor_stop) - else applicationContext.getString(R.string.catalyst_perf_monitor) - options[fpsDebugLabel] = DevOptionHandler { - if (!devSettings.isFpsDebugEnabled) { - // Request overlay permission if needed when "Show Perf Monitor" option is selected - val context: Context? = reactInstanceDevHelper.currentActivity - if (context == null) { - FLog.e(ReactConstants.TAG, "Unable to get reference to react activity") - } else { - requestPermission(context) + // Do not show legacy performance overlay if V2 is enabled + if (!ReactNativeFeatureFlags.perfMonitorV2Enabled()) { + val fpsDebugLabel = + if (devSettings.isFpsDebugEnabled) + applicationContext.getString(R.string.catalyst_perf_monitor_stop) + else applicationContext.getString(R.string.catalyst_perf_monitor) + options[fpsDebugLabel] = DevOptionHandler { + if (!devSettings.isFpsDebugEnabled) { + // Request overlay permission if needed when "Show Perf Monitor" option is selected + val context: Context? = reactInstanceDevHelper.currentActivity + if (context == null) { + FLog.e(ReactConstants.TAG, "Unable to get reference to react activity") + } else { + requestPermission(context) + } } + devSettings.isFpsDebugEnabled = !devSettings.isFpsDebugEnabled + } + options[applicationContext.getString(R.string.catalyst_settings)] = DevOptionHandler { + val intent = Intent(applicationContext, DevSettingsActivity::class.java) + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + applicationContext.startActivity(intent) } - devSettings.isFpsDebugEnabled = !devSettings.isFpsDebugEnabled - } - options[applicationContext.getString(R.string.catalyst_settings)] = DevOptionHandler { - val intent = Intent(applicationContext, DevSettingsActivity::class.java) - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK) - applicationContext.startActivity(intent) } if (customDevOptions.isNotEmpty()) {