Skip to content

Commit bdddd22

Browse files
fuzzybinary0xnm
andcommitted
Apply suggestions from code review
Co-authored-by: Nikita Ogorodnikov <[email protected]>
1 parent 231e760 commit bdddd22

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

features/dd-sdk-android-rum/src/main/kotlin/com/datadog/android/rum/internal/RumFeature.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ internal class RumFeature(
387387
*/
388388
internal fun enableJankStatsTracking(activity: Activity) {
389389
try {
390+
@Suppress("UnsafeThirdPartyFunctionCall")
390391
jankStatsActivityLifecycleListener?.onActivityStarted(activity)
391392
} catch (@Suppress("TooGenericExceptionCaught") e: Exception) {
392393
sdkCore.internalLogger.log(

features/dd-sdk-android-rum/src/main/kotlin/com/datadog/android/rum/internal/monitor/DatadogRumMonitor.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -646,13 +646,9 @@ internal class DatadogRumMonitor(
646646
}
647647

648648
override fun enableJankStatsTracking(activity: Activity) {
649-
val rumFeatureScope = sdkCore.getFeature(Feature.RUM_FEATURE_NAME)
649+
sdkCore.getFeature(Feature.RUM_FEATURE_NAME)
650650
?.unwrap<RumFeature>()
651-
if (rumFeatureScope == null) {
652-
return
653-
}
654-
655-
rumFeatureScope.enableJankStatsTracking(activity)
651+
?.enableJankStatsTracking(activity)
656652
}
657653

658654
// endregion

features/dd-sdk-android-rum/src/test/kotlin/com/datadog/android/rum/internal/RumFeatureTest.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -545,13 +545,14 @@ internal class RumFeatureTest {
545545
fakeConfiguration,
546546
lateCrashReporterFactory = { mockLateCrashReporter }
547547
)
548-
testedFeature.jankStatsActivityLifecycleListener = mock()
548+
val mockJankStatsActivityLifecycleListener = mock<JankStatsActivityLifecycleListener>()
549+
testedFeature.jankStatsActivityLifecycleListener = mockJankStatsActivityLifecycleListener
549550

550551
// When
551552
testedFeature.enableJankStatsTracking(activity)
552553

553554
// Then
554-
verify(testedFeature.jankStatsActivityLifecycleListener)!!.onActivityStarted(activity)
555+
verify(mockJankStatsActivityLifecycleListener).onActivityStarted(activity)
555556
}
556557

557558
@Test

features/dd-sdk-android-rum/src/test/kotlin/com/datadog/android/rum/internal/vitals/JankStatsActivityLifecycleListenerTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ internal class JankStatsActivityLifecycleListenerTest {
134134
testedJankListener.onActivityStarted(mockActivity)
135135

136136
// Then
137-
assertThat(testedJankListener.activeActivities[mockWindow]?.size).isEqualTo(1)
137+
assertThat(testedJankListener.activeActivities[mockWindow]).hasSize(1)
138138
}
139139

140140
@Test

0 commit comments

Comments
 (0)