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

Commit 3d82ed6b authored by Filip Gruszczynski's avatar Filip Gruszczynski
Browse files

Fix activity not launching from recents after it was dismissed.

When activity was launched from recents and started at the same time, we
would first try resuming activities and then focus on the started
activity. That is wrong odering, as the previously focused activity will
be resumed (in this case recents). We need to first focus on the start
activity and then request resuming.

The CL also flag protects some logging that is being very frequently
printed from activity manager.

Bug: 25823213
Change-Id: I5311fb2bf316ce3d298b30fa90fb257978bacdca
parent d7963806
Loading
Loading
Loading
Loading
+24 −22
Original line number Diff line number Diff line
@@ -3484,6 +3484,7 @@ public final class ActivityManagerService extends ActivityManagerNative
                Watchdog.getInstance().processStarted(app.processName, startResult.pid);
            }
            if (DEBUG_PROCESSES) {
                checkTime(startTime, "startProcess: building log message");
                StringBuilder buf = mStringBuilder;
                buf.setLength(0);
@@ -3505,6 +3506,7 @@ public final class ActivityManagerService extends ActivityManagerNative
                    buf.append(hostingNameStr);
                }
                Slog.i(TAG, buf.toString());
            }
            app.setPid(startResult.pid);
            app.usingWrapper = startResult.usingWrapper;
            app.removed = false;
@@ -19748,7 +19750,7 @@ public final class ActivityManagerService extends ActivityManagerNative
                        } else {
                            numEmpty++;
                            if (numEmpty > emptyProcessLimit) {
                                app.kill("empty #" + numEmpty, true);
                                app.kill("empty #" + numEmpty, DEBUG_PROCESSES);
                            }
                        }
                        break;
+4 −9
Original line number Diff line number Diff line
@@ -74,6 +74,7 @@ import android.os.Trace;
import android.os.UserHandle;
import android.service.voice.IVoiceInteractionSession;
import android.util.EventLog;
import android.util.Log;
import android.util.Slog;
import android.view.Display;

@@ -733,7 +734,7 @@ final class ActivityStack {
                "Launch completed; removing icicle of " + r.icicle);
    }

    private void addRecentActivityLocked(ActivityRecord r) {
    void addRecentActivityLocked(ActivityRecord r) {
        if (r != null) {
            mRecentTasks.addLocked(r.task);
            r.task.touchActiveTime();
@@ -2312,8 +2313,8 @@ final class ActivityStack {
        updateTaskMovement(task, true);
    }

    final void startActivityLocked(ActivityRecord r, boolean newTask,
            boolean doResume, boolean keepCurTransition, ActivityOptions options) {
    final void startActivityLocked(ActivityRecord r, boolean newTask, boolean keepCurTransition,
            ActivityOptions options) {
        TaskRecord rTask = r.task;
        final int taskId = rTask.taskId;
        // mLaunchTaskBehind tasks get placed at the back of the task stack.
@@ -2459,12 +2460,6 @@ final class ActivityStack {
        if (VALIDATE_TOKENS) {
            validateAppTokensLocked();
        }

        if (doResume) {
            mStackSupervisor.resumeTopActivitiesLocked(this, r, options);
        } else {
            addRecentActivityLocked(r);
        }
    }

    final void validateAppTokensLocked() {
+8 −3
Original line number Diff line number Diff line
@@ -2628,10 +2628,15 @@ public final class ActivityStackSupervisor implements DisplayListener {
        }
        ActivityStack.logStartActivity(EventLogTags.AM_CREATE_ACTIVITY, r, r.task);
        targetStack.mLastPausedActivity = null;
        targetStack.startActivityLocked(r, newTask, doResume, keepCurTransition, options);
        if (!launchTaskBehind && doResume) {
        targetStack.startActivityLocked(r, newTask, keepCurTransition, options);
        if (doResume) {
            if (!launchTaskBehind) {
                mService.setFocusedActivityLocked(r, "startedActivity");
            }
            resumeTopActivitiesLocked(targetStack, r, options);
        } else {
            targetStack.addRecentActivityLocked(r);
        }
        updateUserStackLocked(r.userId, targetStack);

        if (!r.task.mResizeable && isStackDockedInEffect(targetStack.mStackId)) {