Remove last transition info after it is logged

Otherwise if the activity calls Activity#reportFullyDrawn every
time after it is created, the metrics will be reported again
with unexpected values if it is relaunched, e.g. rotation change.

Bug: 123355661
Test: No "Fully drawn" log by activity relaunched
Change-Id: I16bd816c8f0af8c28c2b2ac38994d9daa9c0ba96
This commit is contained in:
Riddle Hsu
2021-02-05 18:35:42 +08:00
parent 5f6672f171
commit a957038f99

View File

@@ -978,6 +978,7 @@ class ActivityMetricsLogger {
final TransitionInfoSnapshot infoSnapshot =
new TransitionInfoSnapshot(info, r, (int) startupTimeMs);
BackgroundThread.getHandler().post(() -> logAppFullyDrawn(infoSnapshot));
mLastTransitionInfo.remove(r);
if (!info.isInterestingToLoggerAndObserver()) {
return infoSnapshot;