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

Commit 208ff92d authored by Wale Ogunwale's avatar Wale Ogunwale Committed by Android (Google) Code Review
Browse files

Merge "Fixed issue with not been able to dock task from recents after reboot"

parents 6038349b 6c5eb1c6
Loading
Loading
Loading
Loading
+20 −5
Original line number Diff line number Diff line
@@ -4183,14 +4183,16 @@ public final class ActivityManagerService extends ActivityManagerNative
                        "startActivityFromRecentsInner: Task " + taskId + " not found.");
            }
            if (launchStackId != INVALID_STACK_ID && task.stack.mStackId != launchStackId) {
            if (launchStackId != INVALID_STACK_ID) {
                if (launchStackId == DOCKED_STACK_ID && bOptions != null) {
                    ActivityOptions activityOptions = new ActivityOptions(bOptions);
                    mWindowManager.setDockedStackCreateMode(activityOptions.getDockCreateMode());
                }
                if (task.stack.mStackId != launchStackId) {
                    mStackSupervisor.moveTaskToStackLocked(
                            taskId, launchStackId, ON_TOP, FORCE_FOCUS, "startActivityFromRecents");
                }
            }
            if (task.getRootActivity() != null) {
                moveTaskToFrontLocked(task.taskId, 0, bOptions);
@@ -8690,12 +8692,25 @@ public final class ActivityManagerService extends ActivityManagerNative
        Rect rect = new Rect();
        try {
            synchronized (this) {
                TaskRecord task = mStackSupervisor.anyTaskForIdLocked(taskId);
                final TaskRecord task = mStackSupervisor.anyTaskForIdLocked(
                        taskId, !RESTORE_FROM_RECENTS, INVALID_STACK_ID);
                if (task == null) {
                    Slog.w(TAG, "getTaskBounds: taskId=" + taskId + " not found");
                    return rect;
                }
                if (task.stack != null) {
                    // Return the bounds from window manager since it will be adjusted for various
                    // things like the presense of a docked stack for tasks that aren't resizeable.
                    mWindowManager.getTaskBounds(task.taskId, rect);
                } else {
                    // Task isn't in window manager yet since it isn't associated with a stack.
                    // Return the persist value from activity manager
                    if (task.mBounds != null) {
                        rect.set(task.mBounds);
                    } else if (task.mLastNonFullscreenBounds != null) {
                        rect.set(task.mLastNonFullscreenBounds);
                    }
                }
            }
        } finally {
            Binder.restoreCallingIdentity(ident);
+5 −4
Original line number Diff line number Diff line
@@ -3272,7 +3272,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
            task.stack.removeTask(task, "restoreRecentTaskLocked", MOVING);
        }

        ActivityStack stack =
        final ActivityStack stack =
                getStack(stackId, CREATE_IF_NEEDED, !ON_TOP);

        if (stack == null) {
@@ -3339,15 +3339,16 @@ public final class ActivityStackSupervisor implements DisplayListener {
            Slog.w(TAG, "moveTaskToStack: no task for id=" + taskId);
            return;
        }
        if (StackId.preserveWindowOnTaskMove(stackId)) {

        final ActivityRecord topActivity = task.getTopActivity();
        if (StackId.preserveWindowOnTaskMove(stackId) && topActivity != null) {
            // We are about to relaunch the activity because its configuration changed due to
            // being maximized, i.e. size change. The activity will first remove the old window
            // and then add a new one. This call will tell window manager about this, so it can
            // preserve the old window until the new one is drawn. This prevents having a gap
            // between the removal and addition, in which no window is visible. We also want the
            // entrance of the new window to be properly animated.
            ActivityRecord r = task.getTopActivity();
            mWindowManager.setReplacingWindow(r.appToken, true /* animate */);
            mWindowManager.setReplacingWindow(topActivity.appToken, true /* animate */);
        }
        final ActivityStack stack =
                moveTaskToStackUncheckedLocked(task, stackId, toTop, forceFocus,
+3 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.server.am;
import static android.app.ActivityManager.StackId.FREEFORM_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.StackId.FULLSCREEN_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.StackId.HOME_STACK_ID;
import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
import static android.content.Intent.FLAG_ACTIVITY_NEW_DOCUMENT;
import static android.content.Intent.FLAG_ACTIVITY_RETAIN_IN_RECENTS;
import static android.content.pm.ActivityInfo.LOCK_TASK_LAUNCH_MODE_ALWAYS;
@@ -1366,6 +1367,8 @@ final class TaskRecord {
            sb.append(stringName);
            sb.append(" U=");
            sb.append(userId);
            sb.append(" StackId=");
            sb.append(stack != null ? stack.mStackId : INVALID_STACK_ID);
            sb.append(" sz=");
            sb.append(mActivities.size());
            sb.append('}');