Skip to content

RUMM-2903 handle device refresh rate with navigation strategy#1312

Merged
xgouchet merged 4 commits into
developfrom
xgouchet/RUMM-2903/high_framerate
Mar 6, 2023
Merged

RUMM-2903 handle device refresh rate with navigation strategy#1312
xgouchet merged 4 commits into
developfrom
xgouchet/RUMM-2903/high_framerate

Conversation

@xgouchet

@xgouchet xgouchet commented Mar 2, 2023

Copy link
Copy Markdown
Contributor

What does this PR do?

In order to get the device's refresh rate to scale down or up the detected app's refresh rate , we need to grab the activity from the navigation controller.

Motivation

Ensure that the refresh rate is properly reported in all use cases

@xgouchet
xgouchet requested a review from a team as a code owner March 2, 2023 17:40
return if (value == 0.0) 0.0 else 1.0 / value
}

val navControllerActivityField = NavController::class.java.declaredFields.firstOrNull {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did this get put at the bottom of the companion object instead of with the other vals?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly because I added it there, I could move it up but it doesn't really change anything IMO

)
hasConnectivityInfo(fakeDatadogContext.networkInfo)
hasServiceName(fakeDatadogContext.service)
hasVersion(fakeDatadogContext.version)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be checking all of these properties in this test?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, just to make sure that the event is complete as expected

@0xnm 0xnm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! I've added one comment in order to simplify debugging.

is Fragment -> key.activity
is android.app.Fragment -> key.activity
is NavigationViewTrackingStrategy.NavigationKey -> {
navControllerActivityField?.isAccessible = true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can add some log entry when navControllerActivityField is not found (because of the private API changes, for example)? this will simplify the debugging if things don't work.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes indeed, I'll add one

@xgouchet
xgouchet force-pushed the xgouchet/RUMM-2903/high_framerate branch from ad2b0b0 to 69444e6 Compare March 6, 2023 10:17
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

Merging #1312 (69444e6) into develop (16543f7) will decrease coverage by 0.09%.
The diff coverage is 68.18%.

@@             Coverage Diff             @@
##           develop    #1312      +/-   ##
===========================================
- Coverage    82.11%   82.02%   -0.09%     
===========================================
  Files          361      361              
  Lines        12832    12852      +20     
  Branches      2153     2157       +4     
===========================================
+ Hits         10536    10541       +5     
- Misses        1653     1659       +6     
- Partials       643      652       +9     
Impacted Files Coverage Δ
.../android/rum/internal/domain/scope/RumViewScope.kt 94.12% <56.25%> (-1.26%) ⬇️
...rnal/system/BroadcastReceiverSystemInfoProvider.kt 98.08% <100.00%> (+0.04%) ⬆️
...oid/rum/tracking/NavigationViewTrackingStrategy.kt 85.25% <100.00%> (+0.76%) ⬆️
.../datadog/android/sessionreplay/utils/ThemeUtils.kt 83.33% <0.00%> (-16.67%) ⬇️
...in/com/datadog/android/log/internal/LogsFeature.kt 84.62% <0.00%> (-4.62%) ⬇️
...droid/rum/tracking/FragmentViewTrackingStrategy.kt 75.00% <0.00%> (-3.85%) ⬇️
...rsistence/file/batch/PlainBatchFileReaderWriter.kt 81.54% <0.00%> (-1.54%) ⬇️
...id/rum/internal/ndk/DatadogNdkCrashEventHandler.kt 93.00% <0.00%> (-1.00%) ⬇️
.../android/rum/internal/monitor/DatadogRumMonitor.kt 90.81% <0.00%> (-0.54%) ⬇️
... and 4 more

@xgouchet
xgouchet merged commit e614b64 into develop Mar 6, 2023
@xgouchet
xgouchet deleted the xgouchet/RUMM-2903/high_framerate branch March 6, 2023 13:09
@xgouchet xgouchet added this to the 1.18.0 milestone Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants