Repository: datadog/dd-sdk-android
Issue: Performance Timing will be reported with wrong view scope

**Describe what happened**

In following scenario, I expected to get the performance timing only for the screen home and item. But the SDK reported the timing with not only screens but also `ApplicationLaunch`

Setup:
Create a sample app that has 2 screens called home and item.
Add a performance timing to measure Compose rendering performance.
Add some network calls in `Application::onCreate()`.

Scenario:
1. Open the app
   - a timing for home screen will be reported 
3. Navigate to item screen
   - a timing for item screen and ApplicationLaunch will be reported <- !?

**Steps to reproduce the issue:**

Clone this PR and run the sample Kotlin app.
https://github.com/ken-kentan/dd-sdk-android/pull/1

**Describe what you expected:**

Performance Timing won't be sent with ApplicationLaunch scope.

**Additional context**
 - Android OS version: Any
 - Device Model: Any
 - Datadog SDK version: develop
 - Versions of any other relevant dependencies (OkHttp, …): OkHttp
 - Proguard configuration: Any
 - Gradle Plugins: Any


Changed files:
dd-sdk-android/src/main/kotlin/com/datadog/android/rum/internal/domain/scope/RumViewScope.kt
dd-sdk-android/src/test/kotlin/com/datadog/android/rum/internal/domain/scope/RumViewScopeTest.kt
dd-sdk-android/src/main/kotlin/com/datadog/android/rum/internal/domain/scope/RumViewManagerScope.kt

diff --git a/dd-sdk-android/src/main/kotlin/com/datadog/android/rum/internal/domain/scope/RumViewManagerScope.kt b/dd-sdk-android/src/main/kotlin/com/datadog/android/rum/internal/domain/scope/RumViewManagerScope.kt
index 8c7ac5546..c2e275788 100644
--- a/dd-sdk-android/src/main/kotlin/com/datadog/android/rum/internal/domain/scope/RumViewManagerScope.kt
+++ b/dd-sdk-android/src/main/kotlin/com/datadog/android/rum/internal/domain/scope/RumViewManagerScope.kt
@@ -85,7 +85,7 @@ internal class RumViewManagerScope(
 
     // region Internal
 
-    fun isViewManagerComplete(): Boolean {
+    private fun isViewManagerComplete(): Boolean {
         return stopped && childrenScopes.isEmpty()
     }
 
diff --git a/dd-sdk-android/src/main/kotlin/com/datadog/android/rum/internal/domain/scope/RumViewScope.kt b/dd-sdk-android/src/main/kotlin/com/datadog/android/rum/internal/domain/scope/RumViewScope.kt
index 5bb1578ab..7eb44113a 100644
--- a/dd-sdk-android/src/main/kotlin/com/datadog/android/rum/internal/domain/scope/RumViewScope.kt
+++ b/dd-sdk-android/src/main/kotlin/com/datadog/android/rum/internal/domain/scope/RumViewScope.kt
@@ -106,7 +106,7 @@ internal open class RumViewScope(
     private var version: Long = 1
     private var loadingTime: Long? = null
     private var loadingType: ViewEvent.LoadingType? = null
-    private val customTimings: MutableMap<String, Long> = mutableMapOf()
+    internal val customTimings: MutableMap<String, Long> = mutableMapOf()
     internal val featureFlags: MutableMap<String, Any?> = mutableMapOf()
 
     internal var stopped: Boolean = false
@@ -467,6 +467,8 @@ internal open class RumViewScope(
         event: RumRawEvent.AddCustomTiming,
         writer: DataWriter<Any>
     ) {
+        if (stopped) return
+
         customTimings[event.name] = max(event.eventTime.nanoTime - startedNanos, 1L)
         sendViewUpdate(event, writer)
     }
@@ -988,6 +990,8 @@ internal open class RumViewScope(
         event: RumRawEvent.AddFeatureFlagEvaluation,
         writer: DataWriter<Any>
     ) {
+        if (stopped) return
+
         featureFlags[event.name] = event.value
         sendViewUpdate(event, writer)
         sendViewChanged()
diff --git a/dd-sdk-android/src/test/kotlin/com/datadog/android/rum/internal/domain/scope/RumViewScopeTest.kt b/dd-sdk-android/src/test/kotlin/com/datadog/android/rum/internal/domain/scope/RumViewScopeTest.kt
index a99a3886c..643f8c74b 100644
--- a/dd-sdk-android/src/test/kotlin/com/datadog/android/rum/internal/domain/scope/RumViewScopeTest.kt
+++ b/dd-sdk-android/src/test/kotlin/com/datadog/android/rum/internal/domain/scope/RumViewScopeTest.kt
@@ -5563,6 +5563,25 @@ internal class RumViewScopeTest {
         verifyNoMoreInteractions(mockWriter)
     }
 
+    @Test
+    fun `𝕄 not add custom timing 𝕎 handleEvent(AddCustomTiming) on stopped view`(
+        forge: Forge
+    ) {
+        // Given
+        testedScope.stopped = true
+        val fakeTimingKey = forge.anAlphabeticalString()
+
+        // When
+        testedScope.handleEvent(
+            RumRawEvent.AddCustomTiming(fakeTimingKey),
+            mockWriter
+        )
+
+        // Then
+        assertThat(testedScope.customTimings).isEmpty()
+        verifyNoInteractions(mockWriter)
+    }
+
     // endregion
 
     // region Vitals
@@ -6904,6 +6923,28 @@ internal class RumViewScopeTest {
         }
     }
 
+    @Test
+    fun `M not add feature flag W handleEvent(AddFeatureFlagEvaluation) on stopped view`(
+        @StringForgery flagName: String,
+        @StringForgery flagValue: String
+    ) {
+        // GIVEN
+        testedScope.stopped = true
+
+        // WHEN
+        testedScope.handleEvent(
+            RumRawEvent.AddFeatureFlagEvaluation(
+                name = flagName,
+                value = flagValue
+            ),
+            mockWriter
+        )
+
+        // THEN
+        assertThat(testedScope.featureFlags).isEmpty()
+        verifyNoInteractions(mockWriter)
+    }
+
     @Test
     fun `M modify flag W handleEvent(AddFeatureFlagEvaluation) on active view { existing feature flag }`(
         @StringForgery flagName: String,