Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c4c19a23 authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android Git Automerger
Browse files

am 55e81bd0: Merge "Improve how we manage the previous app." into ics-mr1

* commit '55e81bd0':
  Improve how we manage the previous app.
parents 0c22fa74 55e81bd0
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -415,6 +415,11 @@ public final class ActivityManagerService extends ActivityManagerNative
     */
    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
     * compatibility mode instead of filling the screen.
@@ -8361,6 +8366,12 @@ public final class ActivityManagerService extends ActivityManagerNative
        pw.println();
        pw.println("  mHomeProcess: " + mHomeProcess);
        pw.println("  mPreviousProcess: " + mPreviousProcess);
        if (dumpAll) {
            StringBuilder sb = new StringBuilder(128);
            sb.append("  mPreviousProcessVisibleTime: ");
            TimeUtils.formatDuration(mPreviousProcessVisibleTime, sb);
            pw.println(sb);
        }
        if (mHeavyWeightProcess != null) {
            pw.println("  mHeavyWeightProcess: " + mHeavyWeightProcess);
        }
+6 −0
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ final class ActivityRecord {
    ThumbnailHolder thumbHolder; // where our thumbnails should go.
    long launchTime;        // when we starting launching this activity
    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
    Configuration configuration; // configuration activity was last running in
    CompatibilityInfo compat;// last used compatibility mode
@@ -188,6 +189,10 @@ final class ActivityRecord {
                    TimeUtils.formatDuration(launchTime, pw); pw.print(" startTime=");
                    TimeUtils.formatDuration(startTime, pw); pw.println("");
        }
        if (lastVisibleTime != 0) {
            pw.print(prefix); pw.print("lastVisibleTime=");
                    TimeUtils.formatDuration(lastVisibleTime, pw); pw.println("");
        }
        if (waitingVisible || nowVisible) {
            pw.print(prefix); pw.print("waitingVisible="); pw.print(waitingVisible);
                    pw.print(" nowVisible="); pw.println(nowVisible);
@@ -632,6 +637,7 @@ final class ActivityRecord {
                    ActivityManagerService.TAG, "windowsVisible(): " + this);
            if (!nowVisible) {
                nowVisible = true;
                lastVisibleTime = SystemClock.uptimeMillis();
                if (!idle) {
                    // Instead of doing the full stop routine here, let's just
                    // hide any activities we now can, and let them stop when
+16 −8
Original line number Diff line number Diff line
@@ -949,6 +949,22 @@ final class ActivityStack {
            if (r.configDestroy) {
                destroyActivityLocked(r, true, false, "stop-config");
                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);
                }
            }

            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