diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/perf/ProfilerStopDialogFragment.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/perf/ProfilerStopDialogFragment.kt index f08b1a6552e2..351860f4422a 100644 --- a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/perf/ProfilerStopDialogFragment.kt +++ b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/perf/ProfilerStopDialogFragment.kt @@ -56,9 +56,8 @@ class ProfilerStopDialogFragment : DialogFragment() { } } - override fun dismiss() { + private fun setProfilerState() { profilerViewModel.setProfilerState(requireContext().components.core.engine.profiler!!.isProfilerActive()) - super.dismiss() } @Composable @@ -111,7 +110,14 @@ class ProfilerStopDialogFragment : DialogFragment() { ) { TextButton( onClick = { - requireContext().components.core.engine.profiler?.stopProfiler({}, {}) + requireContext().components.core.engine.profiler?.stopProfiler( + onSuccess = { + setProfilerState() + }, + onError = { + setProfilerState() + }, + ) dismiss() }, ) { @@ -162,6 +168,7 @@ class ProfilerStopDialogFragment : DialogFragment() { resources.getString(message) + extra, Toast.LENGTH_LONG, ).show() + setProfilerState() dismiss() }