Skip to content

Commit 5293733

Browse files
sbuggayfacebook-github-bot
authored andcommitted
Remove legacy perf overlay from DevMenu (facebook#53328)
Summary: Pull Request resolved: facebook#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
1 parent 6a0b9d1 commit 5293733

1 file changed

Lines changed: 21 additions & 18 deletions

File tree

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.kt

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -450,26 +450,29 @@ public abstract class DevSupportManagerBase(
450450
}
451451
}
452452

453-
val fpsDebugLabel =
454-
if (devSettings.isFpsDebugEnabled)
455-
applicationContext.getString(R.string.catalyst_perf_monitor_stop)
456-
else applicationContext.getString(R.string.catalyst_perf_monitor)
457-
options[fpsDebugLabel] = DevOptionHandler {
458-
if (!devSettings.isFpsDebugEnabled) {
459-
// Request overlay permission if needed when "Show Perf Monitor" option is selected
460-
val context: Context? = reactInstanceDevHelper.currentActivity
461-
if (context == null) {
462-
FLog.e(ReactConstants.TAG, "Unable to get reference to react activity")
463-
} else {
464-
requestPermission(context)
453+
// Do not show legacy performance overlay if V2 is enabled
454+
if (!ReactNativeFeatureFlags.perfMonitorV2Enabled()) {
455+
val fpsDebugLabel =
456+
if (devSettings.isFpsDebugEnabled)
457+
applicationContext.getString(R.string.catalyst_perf_monitor_stop)
458+
else applicationContext.getString(R.string.catalyst_perf_monitor)
459+
options[fpsDebugLabel] = DevOptionHandler {
460+
if (!devSettings.isFpsDebugEnabled) {
461+
// Request overlay permission if needed when "Show Perf Monitor" option is selected
462+
val context: Context? = reactInstanceDevHelper.currentActivity
463+
if (context == null) {
464+
FLog.e(ReactConstants.TAG, "Unable to get reference to react activity")
465+
} else {
466+
requestPermission(context)
467+
}
465468
}
469+
devSettings.isFpsDebugEnabled = !devSettings.isFpsDebugEnabled
470+
}
471+
options[applicationContext.getString(R.string.catalyst_settings)] = DevOptionHandler {
472+
val intent = Intent(applicationContext, DevSettingsActivity::class.java)
473+
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
474+
applicationContext.startActivity(intent)
466475
}
467-
devSettings.isFpsDebugEnabled = !devSettings.isFpsDebugEnabled
468-
}
469-
options[applicationContext.getString(R.string.catalyst_settings)] = DevOptionHandler {
470-
val intent = Intent(applicationContext, DevSettingsActivity::class.java)
471-
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
472-
applicationContext.startActivity(intent)
473476
}
474477

475478
if (customDevOptions.isNotEmpty()) {

0 commit comments

Comments
 (0)