Merge "Improve how we manage the previous app." into ics-mr1
This commit is contained in:
committed by
Android (Google) Code Review
commit
55e81bd0f2
@ -414,7 +414,12 @@ public final class ActivityManagerService extends ActivityManagerNative
|
|||||||
* is in a different process from the one they are currently in.
|
* is in a different process from the one they are currently in.
|
||||||
*/
|
*/
|
||||||
ProcessRecord mPreviousProcess;
|
ProcessRecord mPreviousProcess;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The time at which the previous process was last visible.
|
||||||
|
*/
|
||||||
|
long mPreviousProcessVisibleTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Packages that the user has asked to have run in screen size
|
* Packages that the user has asked to have run in screen size
|
||||||
* compatibility mode instead of filling the screen.
|
* compatibility mode instead of filling the screen.
|
||||||
@ -8361,6 +8366,12 @@ public final class ActivityManagerService extends ActivityManagerNative
|
|||||||
pw.println();
|
pw.println();
|
||||||
pw.println(" mHomeProcess: " + mHomeProcess);
|
pw.println(" mHomeProcess: " + mHomeProcess);
|
||||||
pw.println(" mPreviousProcess: " + mPreviousProcess);
|
pw.println(" mPreviousProcess: " + mPreviousProcess);
|
||||||
|
if (dumpAll) {
|
||||||
|
StringBuilder sb = new StringBuilder(128);
|
||||||
|
sb.append(" mPreviousProcessVisibleTime: ");
|
||||||
|
TimeUtils.formatDuration(mPreviousProcessVisibleTime, sb);
|
||||||
|
pw.println(sb);
|
||||||
|
}
|
||||||
if (mHeavyWeightProcess != null) {
|
if (mHeavyWeightProcess != null) {
|
||||||
pw.println(" mHeavyWeightProcess: " + mHeavyWeightProcess);
|
pw.println(" mHeavyWeightProcess: " + mHeavyWeightProcess);
|
||||||
}
|
}
|
||||||
|
@ -80,6 +80,7 @@ final class ActivityRecord {
|
|||||||
ThumbnailHolder thumbHolder; // where our thumbnails should go.
|
ThumbnailHolder thumbHolder; // where our thumbnails should go.
|
||||||
long launchTime; // when we starting launching this activity
|
long launchTime; // when we starting launching this activity
|
||||||
long startTime; // last time this activity was started
|
long startTime; // last time this activity was started
|
||||||
|
long lastVisibleTime; // last time this activity became visible
|
||||||
long cpuTimeAtResume; // the cpu time of host process at the time of resuming activity
|
long cpuTimeAtResume; // the cpu time of host process at the time of resuming activity
|
||||||
Configuration configuration; // configuration activity was last running in
|
Configuration configuration; // configuration activity was last running in
|
||||||
CompatibilityInfo compat;// last used compatibility mode
|
CompatibilityInfo compat;// last used compatibility mode
|
||||||
@ -188,6 +189,10 @@ final class ActivityRecord {
|
|||||||
TimeUtils.formatDuration(launchTime, pw); pw.print(" startTime=");
|
TimeUtils.formatDuration(launchTime, pw); pw.print(" startTime=");
|
||||||
TimeUtils.formatDuration(startTime, pw); pw.println("");
|
TimeUtils.formatDuration(startTime, pw); pw.println("");
|
||||||
}
|
}
|
||||||
|
if (lastVisibleTime != 0) {
|
||||||
|
pw.print(prefix); pw.print("lastVisibleTime=");
|
||||||
|
TimeUtils.formatDuration(lastVisibleTime, pw); pw.println("");
|
||||||
|
}
|
||||||
if (waitingVisible || nowVisible) {
|
if (waitingVisible || nowVisible) {
|
||||||
pw.print(prefix); pw.print("waitingVisible="); pw.print(waitingVisible);
|
pw.print(prefix); pw.print("waitingVisible="); pw.print(waitingVisible);
|
||||||
pw.print(" nowVisible="); pw.println(nowVisible);
|
pw.print(" nowVisible="); pw.println(nowVisible);
|
||||||
@ -632,6 +637,7 @@ final class ActivityRecord {
|
|||||||
ActivityManagerService.TAG, "windowsVisible(): " + this);
|
ActivityManagerService.TAG, "windowsVisible(): " + this);
|
||||||
if (!nowVisible) {
|
if (!nowVisible) {
|
||||||
nowVisible = true;
|
nowVisible = true;
|
||||||
|
lastVisibleTime = SystemClock.uptimeMillis();
|
||||||
if (!idle) {
|
if (!idle) {
|
||||||
// Instead of doing the full stop routine here, let's just
|
// Instead of doing the full stop routine here, let's just
|
||||||
// hide any activities we now can, and let them stop when
|
// hide any activities we now can, and let them stop when
|
||||||
|
@ -949,6 +949,22 @@ final class ActivityStack {
|
|||||||
if (r.configDestroy) {
|
if (r.configDestroy) {
|
||||||
destroyActivityLocked(r, true, false, "stop-config");
|
destroyActivityLocked(r, true, false, "stop-config");
|
||||||
resumeTopActivityLocked(null);
|
resumeTopActivityLocked(null);
|
||||||
|
} else {
|
||||||
|
// Now that this process has stopped, we may want to consider
|
||||||
|
// it to be the previous app to try to keep around in case
|
||||||
|
// the user wants to return to it.
|
||||||
|
ProcessRecord fgApp = null;
|
||||||
|
if (mResumedActivity != null) {
|
||||||
|
fgApp = mResumedActivity.app;
|
||||||
|
} else if (mPausingActivity != null) {
|
||||||
|
fgApp = mPausingActivity.app;
|
||||||
|
}
|
||||||
|
if (r.app != null && fgApp != null && r.app != fgApp
|
||||||
|
&& r.lastVisibleTime > mService.mPreviousProcessVisibleTime
|
||||||
|
&& r.app != mService.mHomeProcess) {
|
||||||
|
mService.mPreviousProcess = r.app;
|
||||||
|
mService.mPreviousProcessVisibleTime = r.lastVisibleTime;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1363,14 +1379,6 @@ final class ActivityStack {
|
|||||||
+ ", nowVisible=" + next.nowVisible);
|
+ ", nowVisible=" + next.nowVisible);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!prev.finishing && prev.app != null && prev.app != next.app
|
|
||||||
&& prev.app != mService.mHomeProcess) {
|
|
||||||
// We are switching to a new activity that is in a different
|
|
||||||
// process than the previous one. Note the previous process,
|
|
||||||
// so we can try to keep it around.
|
|
||||||
mService.mPreviousProcess = prev.app;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Launching this app's activity, make sure the app is no longer
|
// Launching this app's activity, make sure the app is no longer
|
||||||
|
Reference in New Issue
Block a user