Merge "fix "am start -W" hang on activity start" into nyc-dev
This commit is contained in:
@@ -1123,6 +1123,13 @@ final class ActivityRecord {
|
|||||||
|
|
||||||
public void reportFullyDrawnLocked() {
|
public void reportFullyDrawnLocked() {
|
||||||
final long curTime = SystemClock.uptimeMillis();
|
final long curTime = SystemClock.uptimeMillis();
|
||||||
|
// Normally launch time counts from the point when the activity is resumed, to when the
|
||||||
|
// first window is drawn. However the activity could become visible before it is resumed,
|
||||||
|
// due to some other activity in the same task being launched. In this case we still need
|
||||||
|
// to report launch time to unblock ActivityStarter.startActivityMayWait().
|
||||||
|
if (displayStartTime == 0 && task != null && task.isLaunching) {
|
||||||
|
displayStartTime = curTime;
|
||||||
|
}
|
||||||
if (displayStartTime != 0) {
|
if (displayStartTime != 0) {
|
||||||
reportLaunchTimeLocked(curTime);
|
reportLaunchTimeLocked(curTime);
|
||||||
}
|
}
|
||||||
@@ -1188,13 +1195,22 @@ final class ActivityRecord {
|
|||||||
//service.mUsageStatsService.noteLaunchTime(realActivity, (int)totalTime);
|
//service.mUsageStatsService.noteLaunchTime(realActivity, (int)totalTime);
|
||||||
}
|
}
|
||||||
displayStartTime = 0;
|
displayStartTime = 0;
|
||||||
|
task.isLaunching = false;
|
||||||
stack.mLaunchStartTime = 0;
|
stack.mLaunchStartTime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void windowsDrawnLocked() {
|
void windowsDrawnLocked() {
|
||||||
mStackSupervisor.mActivityMetricsLogger.notifyWindowsDrawn();
|
mStackSupervisor.mActivityMetricsLogger.notifyWindowsDrawn();
|
||||||
|
final long curTime = SystemClock.uptimeMillis();
|
||||||
|
// Normally launch time counts from the point when the activity is resumed, to when the
|
||||||
|
// first window is drawn. However the activity could become visible before it is resumed,
|
||||||
|
// due to some other activity in the same task being launched. In this case we still need
|
||||||
|
// to report launch time to unblock ActivityStarter.startActivityMayWait().
|
||||||
|
if (displayStartTime == 0 && task != null && task.isLaunching) {
|
||||||
|
displayStartTime = curTime;
|
||||||
|
}
|
||||||
if (displayStartTime != 0) {
|
if (displayStartTime != 0) {
|
||||||
reportLaunchTimeLocked(SystemClock.uptimeMillis());
|
reportLaunchTimeLocked(curTime);
|
||||||
}
|
}
|
||||||
mStackSupervisor.sendWaitingVisibleReportLocked(this);
|
mStackSupervisor.sendWaitingVisibleReportLocked(this);
|
||||||
startTime = 0;
|
startTime = 0;
|
||||||
|
|||||||
@@ -912,6 +912,9 @@ final class ActivityStack {
|
|||||||
void setLaunchTime(ActivityRecord r) {
|
void setLaunchTime(ActivityRecord r) {
|
||||||
if (r.displayStartTime == 0) {
|
if (r.displayStartTime == 0) {
|
||||||
r.fullyDrawnStartTime = r.displayStartTime = SystemClock.uptimeMillis();
|
r.fullyDrawnStartTime = r.displayStartTime = SystemClock.uptimeMillis();
|
||||||
|
if (r.task != null) {
|
||||||
|
r.task.isLaunching = true;
|
||||||
|
}
|
||||||
if (mLaunchStartTime == 0) {
|
if (mLaunchStartTime == 0) {
|
||||||
startLaunchTraces(r.packageName);
|
startLaunchTraces(r.packageName);
|
||||||
mLaunchStartTime = mFullyDrawnStartTime = r.displayStartTime;
|
mLaunchStartTime = mFullyDrawnStartTime = r.displayStartTime;
|
||||||
@@ -926,6 +929,9 @@ final class ActivityStack {
|
|||||||
// Make sure that there is no activity waiting for this to launch.
|
// Make sure that there is no activity waiting for this to launch.
|
||||||
if (mStackSupervisor.mWaitingActivityLaunched.isEmpty()) {
|
if (mStackSupervisor.mWaitingActivityLaunched.isEmpty()) {
|
||||||
r.displayStartTime = r.fullyDrawnStartTime = 0;
|
r.displayStartTime = r.fullyDrawnStartTime = 0;
|
||||||
|
if (r.task != null) {
|
||||||
|
r.task.isLaunching = false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
mStackSupervisor.removeTimeoutsForActivityLocked(r);
|
mStackSupervisor.removeTimeoutsForActivityLocked(r);
|
||||||
mStackSupervisor.scheduleIdleTimeoutLocked(r);
|
mStackSupervisor.scheduleIdleTimeoutLocked(r);
|
||||||
|
|||||||
@@ -151,6 +151,7 @@ final class TaskRecord {
|
|||||||
long lastActiveTime; // Last time this task was active, including sleep.
|
long lastActiveTime; // Last time this task was active, including sleep.
|
||||||
boolean inRecents; // Actually in the recents list?
|
boolean inRecents; // Actually in the recents list?
|
||||||
boolean isAvailable; // Is the activity available to be launched?
|
boolean isAvailable; // Is the activity available to be launched?
|
||||||
|
boolean isLaunching; // Is an activity in this task launching?
|
||||||
boolean rootWasReset; // True if the intent at the root of the task had
|
boolean rootWasReset; // True if the intent at the root of the task had
|
||||||
// the FLAG_ACTIVITY_RESET_TASK_IF_NEEDED flag.
|
// the FLAG_ACTIVITY_RESET_TASK_IF_NEEDED flag.
|
||||||
boolean autoRemoveRecents; // If true, we should automatically remove the task from
|
boolean autoRemoveRecents; // If true, we should automatically remove the task from
|
||||||
|
|||||||
Reference in New Issue
Block a user