Loading services/core/java/com/android/server/am/ActivityRecord.java +1 −17 Original line number Diff line number Diff line Loading @@ -1157,13 +1157,6 @@ final class ActivityRecord { public void reportFullyDrawnLocked() { 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) { reportLaunchTimeLocked(curTime); } Loading Loading @@ -1229,22 +1222,13 @@ final class ActivityRecord { //service.mUsageStatsService.noteLaunchTime(realActivity, (int)totalTime); } displayStartTime = 0; task.isLaunching = false; stack.mLaunchStartTime = 0; } void windowsDrawnLocked() { 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) { reportLaunchTimeLocked(curTime); reportLaunchTimeLocked(SystemClock.uptimeMillis()); } mStackSupervisor.sendWaitingVisibleReportLocked(this); startTime = 0; Loading services/core/java/com/android/server/am/ActivityStack.java +1 −6 Original line number Diff line number Diff line Loading @@ -933,9 +933,6 @@ final class ActivityStack { void setLaunchTime(ActivityRecord r) { if (r.displayStartTime == 0) { r.fullyDrawnStartTime = r.displayStartTime = SystemClock.uptimeMillis(); if (r.task != null) { r.task.isLaunching = true; } if (mLaunchStartTime == 0) { startLaunchTraces(r.packageName); mLaunchStartTime = mFullyDrawnStartTime = r.displayStartTime; Loading @@ -950,9 +947,6 @@ final class ActivityStack { // Make sure that there is no activity waiting for this to launch. if (mStackSupervisor.mWaitingActivityLaunched.isEmpty()) { r.displayStartTime = r.fullyDrawnStartTime = 0; if (r.task != null) { r.task.isLaunching = false; } } else { mStackSupervisor.removeTimeoutsForActivityLocked(r); mStackSupervisor.scheduleIdleTimeoutLocked(r); Loading Loading @@ -1407,6 +1401,7 @@ final class ActivityStack { if (next.nowVisible) { // We won't get a call to reportActivityVisibleLocked() so dismiss lockscreen now. mStackSupervisor.reportActivityVisibleLocked(next); mStackSupervisor.notifyActivityDrawnForKeyguard(); } Loading services/core/java/com/android/server/am/ActivityStackSupervisor.java +20 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,7 @@ import static android.app.ActivityManager.LOCK_TASK_MODE_NONE; import static android.app.ActivityManager.LOCK_TASK_MODE_PINNED; import static android.app.ActivityManager.RESIZE_MODE_FORCED; import static android.app.ActivityManager.RESIZE_MODE_SYSTEM; import static android.app.ActivityManager.START_TASK_TO_FRONT; import static android.app.ActivityManager.StackId.DOCKED_STACK_ID; import static android.app.ActivityManager.StackId.FIRST_DYNAMIC_STACK_ID; import static android.app.ActivityManager.StackId.FIRST_STATIC_STACK_ID; Loading Loading @@ -1002,6 +1003,24 @@ public final class ActivityStackSupervisor implements DisplayListener { } } void reportTaskToFrontNoLaunch(ActivityRecord r) { boolean changed = false; for (int i = mWaitingActivityLaunched.size() - 1; i >= 0; i--) { WaitResult w = mWaitingActivityLaunched.remove(i); if (w.who == null) { changed = true; // Set result to START_TASK_TO_FRONT so that startActivityMayWait() knows that // the starting activity ends up moving another activity to front, and it should // wait for this new activity to become visible instead. // Do not modify other fields. w.result = START_TASK_TO_FRONT; } } if (changed) { mService.notifyAll(); } } void reportActivityLaunchedLocked(boolean timeout, ActivityRecord r, long thisTime, long totalTime) { boolean changed = false; Loading @@ -1015,6 +1034,7 @@ public final class ActivityStackSupervisor implements DisplayListener { } w.thisTime = thisTime; w.totalTime = totalTime; // Do not modify w.result. } } if (changed) { Loading services/core/java/com/android/server/am/ActivityStarter.java +14 −2 Original line number Diff line number Diff line Loading @@ -553,6 +553,13 @@ class ActivityStarter { return; } // We're waiting for an activity launch to finish, but that activity simply // brought another activity to front. Let startActivityMayWait() know about // this, so it waits for the new activity to become visible instead. if (result == START_TASK_TO_FRONT && !mSupervisor.mWaitingActivityLaunched.isEmpty()) { mSupervisor.reportTaskToFrontNoLaunch(mStartActivity); } int startedActivityStackId = INVALID_STACK_ID; if (r.task != null && r.task.stack != null) { startedActivityStackId = r.task.stack.mStackId; Loading Loading @@ -840,8 +847,13 @@ class ActivityStarter { mService.wait(); } catch (InterruptedException e) { } } while (!outResult.timeout && outResult.who == null); } else if (res == START_TASK_TO_FRONT) { } while (outResult.result != START_TASK_TO_FRONT && !outResult.timeout && outResult.who == null); if (outResult.result == START_TASK_TO_FRONT) { res = START_TASK_TO_FRONT; } } if (res == START_TASK_TO_FRONT) { ActivityRecord r = stack.topRunningActivityLocked(); if (r.nowVisible && r.state == RESUMED) { outResult.timeout = false; Loading services/core/java/com/android/server/am/TaskRecord.java +0 −1 Original line number Diff line number Diff line Loading @@ -154,7 +154,6 @@ final class TaskRecord { long lastActiveTime; // Last time this task was active, including sleep. boolean inRecents; // Actually in the recents list? 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 // the FLAG_ACTIVITY_RESET_TASK_IF_NEEDED flag. boolean autoRemoveRecents; // If true, we should automatically remove the task from Loading Loading
services/core/java/com/android/server/am/ActivityRecord.java +1 −17 Original line number Diff line number Diff line Loading @@ -1157,13 +1157,6 @@ final class ActivityRecord { public void reportFullyDrawnLocked() { 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) { reportLaunchTimeLocked(curTime); } Loading Loading @@ -1229,22 +1222,13 @@ final class ActivityRecord { //service.mUsageStatsService.noteLaunchTime(realActivity, (int)totalTime); } displayStartTime = 0; task.isLaunching = false; stack.mLaunchStartTime = 0; } void windowsDrawnLocked() { 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) { reportLaunchTimeLocked(curTime); reportLaunchTimeLocked(SystemClock.uptimeMillis()); } mStackSupervisor.sendWaitingVisibleReportLocked(this); startTime = 0; Loading
services/core/java/com/android/server/am/ActivityStack.java +1 −6 Original line number Diff line number Diff line Loading @@ -933,9 +933,6 @@ final class ActivityStack { void setLaunchTime(ActivityRecord r) { if (r.displayStartTime == 0) { r.fullyDrawnStartTime = r.displayStartTime = SystemClock.uptimeMillis(); if (r.task != null) { r.task.isLaunching = true; } if (mLaunchStartTime == 0) { startLaunchTraces(r.packageName); mLaunchStartTime = mFullyDrawnStartTime = r.displayStartTime; Loading @@ -950,9 +947,6 @@ final class ActivityStack { // Make sure that there is no activity waiting for this to launch. if (mStackSupervisor.mWaitingActivityLaunched.isEmpty()) { r.displayStartTime = r.fullyDrawnStartTime = 0; if (r.task != null) { r.task.isLaunching = false; } } else { mStackSupervisor.removeTimeoutsForActivityLocked(r); mStackSupervisor.scheduleIdleTimeoutLocked(r); Loading Loading @@ -1407,6 +1401,7 @@ final class ActivityStack { if (next.nowVisible) { // We won't get a call to reportActivityVisibleLocked() so dismiss lockscreen now. mStackSupervisor.reportActivityVisibleLocked(next); mStackSupervisor.notifyActivityDrawnForKeyguard(); } Loading
services/core/java/com/android/server/am/ActivityStackSupervisor.java +20 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,7 @@ import static android.app.ActivityManager.LOCK_TASK_MODE_NONE; import static android.app.ActivityManager.LOCK_TASK_MODE_PINNED; import static android.app.ActivityManager.RESIZE_MODE_FORCED; import static android.app.ActivityManager.RESIZE_MODE_SYSTEM; import static android.app.ActivityManager.START_TASK_TO_FRONT; import static android.app.ActivityManager.StackId.DOCKED_STACK_ID; import static android.app.ActivityManager.StackId.FIRST_DYNAMIC_STACK_ID; import static android.app.ActivityManager.StackId.FIRST_STATIC_STACK_ID; Loading Loading @@ -1002,6 +1003,24 @@ public final class ActivityStackSupervisor implements DisplayListener { } } void reportTaskToFrontNoLaunch(ActivityRecord r) { boolean changed = false; for (int i = mWaitingActivityLaunched.size() - 1; i >= 0; i--) { WaitResult w = mWaitingActivityLaunched.remove(i); if (w.who == null) { changed = true; // Set result to START_TASK_TO_FRONT so that startActivityMayWait() knows that // the starting activity ends up moving another activity to front, and it should // wait for this new activity to become visible instead. // Do not modify other fields. w.result = START_TASK_TO_FRONT; } } if (changed) { mService.notifyAll(); } } void reportActivityLaunchedLocked(boolean timeout, ActivityRecord r, long thisTime, long totalTime) { boolean changed = false; Loading @@ -1015,6 +1034,7 @@ public final class ActivityStackSupervisor implements DisplayListener { } w.thisTime = thisTime; w.totalTime = totalTime; // Do not modify w.result. } } if (changed) { Loading
services/core/java/com/android/server/am/ActivityStarter.java +14 −2 Original line number Diff line number Diff line Loading @@ -553,6 +553,13 @@ class ActivityStarter { return; } // We're waiting for an activity launch to finish, but that activity simply // brought another activity to front. Let startActivityMayWait() know about // this, so it waits for the new activity to become visible instead. if (result == START_TASK_TO_FRONT && !mSupervisor.mWaitingActivityLaunched.isEmpty()) { mSupervisor.reportTaskToFrontNoLaunch(mStartActivity); } int startedActivityStackId = INVALID_STACK_ID; if (r.task != null && r.task.stack != null) { startedActivityStackId = r.task.stack.mStackId; Loading Loading @@ -840,8 +847,13 @@ class ActivityStarter { mService.wait(); } catch (InterruptedException e) { } } while (!outResult.timeout && outResult.who == null); } else if (res == START_TASK_TO_FRONT) { } while (outResult.result != START_TASK_TO_FRONT && !outResult.timeout && outResult.who == null); if (outResult.result == START_TASK_TO_FRONT) { res = START_TASK_TO_FRONT; } } if (res == START_TASK_TO_FRONT) { ActivityRecord r = stack.topRunningActivityLocked(); if (r.nowVisible && r.state == RESUMED) { outResult.timeout = false; Loading
services/core/java/com/android/server/am/TaskRecord.java +0 −1 Original line number Diff line number Diff line Loading @@ -154,7 +154,6 @@ final class TaskRecord { long lastActiveTime; // Last time this task was active, including sleep. boolean inRecents; // Actually in the recents list? 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 // the FLAG_ACTIVITY_RESET_TASK_IF_NEEDED flag. boolean autoRemoveRecents; // If true, we should automatically remove the task from Loading