RUMM-3356 fix jankstats#1512
Conversation
719411f to
627b446
Compare
627b446 to
492cbe8
Compare
Codecov Report
@@ Coverage Diff @@
## develop #1512 +/- ##
===========================================
- Coverage 82.00% 81.96% -0.04%
===========================================
Files 363 364 +1
Lines 12981 13018 +37
Branches 2162 2168 +6
===========================================
+ Hits 10645 10670 +25
- Misses 1679 1685 +6
- Partials 657 663 +6
|
0xnm
left a comment
There was a problem hiding this comment.
nice work, thanks for the help! I added few comments/suggestions.
| } | ||
|
|
||
| @Test | ||
| fun `𝕄 foNothing 𝕎 onActivityStopped() {}`() { |
There was a problem hiding this comment.
| fun `𝕄 foNothing 𝕎 onActivityStopped() {}`() { | |
| fun `𝕄 do nothing 𝕎 onActivityStopped() {}`() { |
| - "kotlin.collections.List.toSet()" | ||
| - "kotlin.collections.List.withIndex()" | ||
| - "kotlin.collections.Map.containsKey(kotlin.String)" | ||
| - "kotlin.collections.MutableMap.containsKey(android.view.Window)" |
There was a problem hiding this comment.
probably should be placed below, around line 673.
| InternalLogger.Target.MAINTAINER, | ||
| "Disabling jankStats for window $window" | ||
| ) | ||
| activeWindowsListener[window]?.isTrackingEnabled = false |
There was a problem hiding this comment.
I'm wondering if we should use WeakHashMap for activeActivities and activeWindowsListener, in case if the window was temporary and will be destroyed once a particular activity is destroyed.
I can see that PolicyManager.makeNewWindow can be called from different places, Dialog constructor included. So if there is a dialog shown and then destroyed, we will be keeping Window instance in the memory forever, preventing it from be GCed.
What does this PR do?
This PR aims at solving some issues found when using the JankStats tool to track Mobile Vitals
onActivityStarted(): before that the window is not fully created and the JankStats creation would often failonActivityStopped()to prevent keeping a listener on a Window not being used anymore.Additional Notes
Review checklist (to be filled by reviewers)