Merge "Populate WaitResult with AML data for hot launches"
This commit is contained in:
committed by
Android (Google) Code Review
commit
39a3c60407
@@ -823,7 +823,14 @@ class ActivityMetricsLogger {
|
||||
return StatsLog.APP_START_OCCURRED__TYPE__HOT;
|
||||
}
|
||||
return StatsLog.APP_START_OCCURRED__TYPE__UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
/** @return the last known window drawn delay of the given windowing mode. */
|
||||
int getLastDrawnDelayMs(@WindowingMode int windowingMode) {
|
||||
final WindowingModeTransitionInfo info = mLastWindowingModeTransitionInfo.get(
|
||||
windowingMode);
|
||||
return info != null ? info.windowsDrawnDelayMs : INVALID_DELAY;
|
||||
}
|
||||
|
||||
WindowingModeTransitionInfoSnapshot logAppTransitionReportedDrawn(ActivityRecord r,
|
||||
boolean restoredFromBundle) {
|
||||
|
||||
@@ -5086,7 +5086,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
final @LaunchState int launchState = info != null ? info.getLaunchState() : -1;
|
||||
mStackSupervisor.reportActivityLaunchedLocked(false /* timeout */, this,
|
||||
windowsDrawnDelayMs, launchState);
|
||||
mStackSupervisor.stopWaitingForActivityVisible(this);
|
||||
mStackSupervisor.stopWaitingForActivityVisible(this, windowsDrawnDelayMs);
|
||||
finishLaunchTickingLocked();
|
||||
if (task != null) {
|
||||
task.hasBeenVisible = true;
|
||||
|
||||
@@ -562,8 +562,8 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
|
||||
return candidateTaskId;
|
||||
}
|
||||
|
||||
void waitActivityVisible(ComponentName name, WaitResult result, long startTimeMs) {
|
||||
final WaitInfo waitInfo = new WaitInfo(name, result, startTimeMs);
|
||||
void waitActivityVisible(ComponentName name, WaitResult result) {
|
||||
final WaitInfo waitInfo = new WaitInfo(name, result);
|
||||
mWaitingForActivityVisible.add(waitInfo);
|
||||
}
|
||||
|
||||
@@ -573,10 +573,15 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
|
||||
// down to the max limit while they are still waiting to finish.
|
||||
mFinishingActivities.remove(r);
|
||||
|
||||
stopWaitingForActivityVisible(r);
|
||||
stopWaitingForActivityVisible(r, WaitResult.INVALID_DELAY);
|
||||
}
|
||||
|
||||
void stopWaitingForActivityVisible(ActivityRecord r) {
|
||||
stopWaitingForActivityVisible(r,
|
||||
getActivityMetricsLogger().getLastDrawnDelayMs(r.getWindowingMode()));
|
||||
}
|
||||
|
||||
void stopWaitingForActivityVisible(ActivityRecord r, long totalTime) {
|
||||
boolean changed = false;
|
||||
for (int i = mWaitingForActivityVisible.size() - 1; i >= 0; --i) {
|
||||
final WaitInfo w = mWaitingForActivityVisible.get(i);
|
||||
@@ -585,7 +590,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
|
||||
changed = true;
|
||||
result.timeout = false;
|
||||
result.who = w.getComponent();
|
||||
result.totalTime = SystemClock.uptimeMillis() - w.getStartTime();
|
||||
result.totalTime = totalTime;
|
||||
mWaitingForActivityVisible.remove(w);
|
||||
}
|
||||
}
|
||||
@@ -2824,13 +2829,10 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
|
||||
static class WaitInfo {
|
||||
private final ComponentName mTargetComponent;
|
||||
private final WaitResult mResult;
|
||||
/** Time stamp when we started to wait for {@link WaitResult}. */
|
||||
private final long mStartTimeMs;
|
||||
|
||||
WaitInfo(ComponentName targetComponent, WaitResult result, long startTimeMs) {
|
||||
WaitInfo(ComponentName targetComponent, WaitResult result) {
|
||||
this.mTargetComponent = targetComponent;
|
||||
this.mResult = result;
|
||||
this.mStartTimeMs = startTimeMs;
|
||||
}
|
||||
|
||||
public boolean matches(ComponentName targetComponent) {
|
||||
@@ -2841,10 +2843,6 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
|
||||
return mResult;
|
||||
}
|
||||
|
||||
public long getStartTime() {
|
||||
return mStartTimeMs;
|
||||
}
|
||||
|
||||
public ComponentName getComponent() {
|
||||
return mTargetComponent;
|
||||
}
|
||||
|
||||
@@ -107,7 +107,6 @@ import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.os.Process;
|
||||
import android.os.RemoteException;
|
||||
import android.os.SystemClock;
|
||||
import android.os.Trace;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
@@ -764,9 +763,7 @@ class ActivityStarter {
|
||||
mRequest.waitResult.who = r.mActivityComponent;
|
||||
mRequest.waitResult.totalTime = 0;
|
||||
} else {
|
||||
final long startTimeMs = SystemClock.uptimeMillis();
|
||||
mSupervisor.waitActivityVisible(r.mActivityComponent, mRequest.waitResult,
|
||||
startTimeMs);
|
||||
mSupervisor.waitActivityVisible(r.mActivityComponent, mRequest.waitResult);
|
||||
// Note: the timeout variable is not currently not ever set.
|
||||
do {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user