Merge "Do not abort launch logger by invisible drawn activity" into rvc-qpr-dev am: c469f76079

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13352090

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I4811c3567ea556d02559987de62f1733f665ef24
This commit is contained in:
TreeHugger Robot
2021-01-29 20:44:01 +00:00
committed by Automerger Merge Worker
2 changed files with 18 additions and 2 deletions

View File

@@ -264,7 +264,7 @@ class ActivityMetricsLogger {
return; return;
} }
mLastLaunchedActivity = r; mLastLaunchedActivity = r;
if (!r.noDisplay) { if (!r.noDisplay && !r.mDrawn) {
if (DEBUG_METRICS) Slog.i(TAG, "Add pending draw " + r); if (DEBUG_METRICS) Slog.i(TAG, "Add pending draw " + r);
mPendingDrawActivities.add(r); mPendingDrawActivities.add(r);
} }
@@ -546,7 +546,7 @@ class ActivityMetricsLogger {
+ " processSwitch=" + processSwitch + " info=" + info); + " processSwitch=" + processSwitch + " info=" + info);
} }
if (launchedActivity.mDrawn) { if (launchedActivity.mDrawn && launchedActivity.isVisible()) {
// Launched activity is already visible. We cannot measure windows drawn delay. // Launched activity is already visible. We cannot measure windows drawn delay.
abort(info, "launched activity already visible"); abort(info, "launched activity already visible");
return; return;

View File

@@ -311,6 +311,22 @@ public class ActivityMetricsLaunchObserverTests extends ActivityTestsBase {
verifyNoMoreInteractions(mLaunchObserver); verifyNoMoreInteractions(mLaunchObserver);
} }
@Test
public void testActivityDrawnBeforeTransition() {
mTopActivity.setVisible(false);
notifyActivityLaunching(mTopActivity.intent);
// Assume the activity is launched the second time consecutively. The drawn event is from
// the first time (omitted in test) launch that is earlier than transition.
mTopActivity.mDrawn = true;
notifyWindowsDrawn(mTopActivity);
notifyActivityLaunched(START_SUCCESS, mTopActivity);
// If the launching activity was drawn when starting transition, the launch event should
// be reported successfully.
notifyTransitionStarting(mTopActivity);
verifyOnActivityLaunchFinished(mTopActivity);
}
@Test @Test
public void testActivityRecordProtoIsNotTooBig() { public void testActivityRecordProtoIsNotTooBig() {
// The ActivityRecordProto must not be too big, otherwise converting it at runtime // The ActivityRecordProto must not be too big, otherwise converting it at runtime