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

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

Merge "taskReturnToType be gone!"

parents 40e1dd67 66e16856
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -69,12 +69,11 @@ message TaskRecordProto {
  optional string real_activity = 6;
  optional string orig_activity = 7;
  optional int32 activity_type = 8;
  optional int32 return_to_type = 9;
  optional int32 resize_mode = 10;
  optional bool fullscreen = 11;
  optional .android.graphics.RectProto bounds = 12;
  optional int32 min_width = 13;
  optional int32 min_height = 14;
  optional int32 resize_mode = 9;
  optional bool fullscreen = 10;
  optional .android.graphics.RectProto bounds = 11;
  optional int32 min_width = 12;
  optional int32 min_height = 13;
}

message ActivityRecordProto {
+2 −6
Original line number Diff line number Diff line
@@ -8083,7 +8083,7 @@ public class ActivityManagerService extends IActivityManager.Stub
                    // Adjust the source bounds by the insets for the transition down
                    final Rect sourceBounds = new Rect(r.pictureInPictureArgs.getSourceRectHint());
                    mStackSupervisor.moveActivityToPinnedStackLocked(r, sourceBounds, aspectRatio,
                            true /* moveHomeStackToFront */, "enterPictureInPictureMode");
                            "enterPictureInPictureMode");
                    final PinnedActivityStack stack = r.getStack();
                    stack.setPictureInPictureAspectRatio(aspectRatio);
                    stack.setPictureInPictureActions(actions);
@@ -10231,11 +10231,7 @@ public class ActivityManagerService extends IActivityManager.Stub
                Slog.e(TAG, "moveTaskToFront: Attempt to violate Lock Task Mode");
                return;
            }
            final ActivityRecord prev = mStackSupervisor.topRunningActivityLocked();
            if (prev != null) {
                task.setTaskToReturnTo(prev);
            }
            mStackSupervisor.findTaskToMoveToFrontLocked(task, flags, options, "moveTaskToFront",
            mStackSupervisor.findTaskToMoveToFront(task, flags, options, "moveTaskToFront",
                    false /* forceNonResizable */);
            final ActivityRecord topActivity = task.getTopActivity();
+1 −0
Original line number Diff line number Diff line
@@ -277,6 +277,7 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo
    ActivityState state;    // current state we are in
    Bundle  icicle;         // last saved activity state
    PersistableBundle persistentState; // last persistently saved activity state
    // TODO: See if this is still needed.
    boolean frontOfTask;    // is this the root activity of its task?
    boolean launchFailed;   // set if a launched failed, to abort on 2nd try
    boolean haveState;      // have we gotten the last activity state?
+79 −265

File changed.

Preview size limit exceeded, changes collapsed.

+22 −35
Original line number Diff line number Diff line
@@ -681,10 +681,6 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
            return false;
        }

        if (prev != null) {
            prev.getTask().setTaskToReturnTo(ACTIVITY_TYPE_STANDARD);
        }

        mHomeStack.moveHomeStackTaskToTop();
        ActivityRecord r = getHomeActivity();
        final String myReason = reason + " resumeHomeStackTask";
@@ -2093,23 +2089,28 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
        }
    }

    void findTaskToMoveToFrontLocked(TaskRecord task, int flags, ActivityOptions options,
    void findTaskToMoveToFront(TaskRecord task, int flags, ActivityOptions options,
            String reason, boolean forceNonResizeable) {
        if ((flags & ActivityManager.MOVE_TASK_NO_USER_ACTION) == 0) {
            mUserLeaving = true;
        }
        if ((flags & ActivityManager.MOVE_TASK_WITH_HOME) != 0) {
            // Caller wants the home activity moved with it.  To accomplish this,
            // we'll just indicate that this task returns to the home task.
            task.setTaskToReturnTo(ACTIVITY_TYPE_HOME);
        }
        final ActivityStack currentStack = task.getStack();
        if (currentStack == null) {
            Slog.e(TAG, "findTaskToMoveToFrontLocked: can't move task="
            Slog.e(TAG, "findTaskToMoveToFront: can't move task="
                    + task + " to front. Stack is null");
            return;
        }

        if ((flags & ActivityManager.MOVE_TASK_NO_USER_ACTION) == 0) {
            mUserLeaving = true;
        }

        final ActivityRecord prev = topRunningActivityLocked();

        if ((flags & ActivityManager.MOVE_TASK_WITH_HOME) != 0
                || (prev != null && prev.isActivityTypeRecents())) {
            // Caller wants the home activity moved with it or the previous task is recents in which
            // case we always return home from the task we are moving to the front.
            moveHomeStackToFront("findTaskToMoveToFront");
        }

        if (task.isResizeable() && canUseActivityOptionsLaunchBounds(options)) {
            final Rect bounds = TaskRecord.validateBounds(options.getLaunchBounds());
            task.updateOverrideConfiguration(bounds);
@@ -2118,7 +2119,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D

            if (stack != currentStack) {
                task.reparent(stack, ON_TOP, REPARENT_KEEP_STACK_AT_FRONT, !ANIMATE, DEFER_RESUME,
                        "findTaskToMoveToFrontLocked");
                        "findTaskToMoveToFront");
                stack = currentStack;
                // moveTaskToStackUncheckedLocked() should already placed the task on top,
                // still need moveTaskToFrontLocked() below for any transition settings.
@@ -2554,13 +2555,6 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
                        final int returnToType =
                                toDisplay.getTopVisibleStackActivityType(WINDOWING_MODE_PINNED);
                        final boolean isTopTask = i == (size - 1);
                        if (inPinnedWindowingMode) {
                            // Update the return-to to reflect where the pinned stack task was
                            // moved from so that we retain the stack that was previously
                            // visible if the pinned stack is recreated.
                            // See moveActivityToPinnedStackLocked().
                            task.setTaskToReturnTo(returnToType);
                        }
                        // Defer resume until all the tasks have been moved to the fullscreen stack
                        task.reparent(toStack, ON_TOP, REPARENT_MOVE_STACK_TO_FRONT,
                                isTopTask /* animate */, DEFER_RESUME,
@@ -3033,12 +3027,12 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
        }

        moveActivityToPinnedStackLocked(r, null /* sourceBounds */, 0f /* aspectRatio */,
                true /* moveHomeStackToFront */, "moveTopActivityToPinnedStack");
                "moveTopActivityToPinnedStack");
        return true;
    }

    void moveActivityToPinnedStackLocked(ActivityRecord r, Rect sourceHintBounds, float aspectRatio,
            boolean moveHomeStackToFront, String reason) {
            String reason) {

        mWindowManager.deferSurfaceLayout();

@@ -3064,17 +3058,6 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
                    true /* allowResizeInDockedMode */, !DEFER_RESUME);

            if (task.mActivities.size() == 1) {
                // There is only one activity in the task. So, we can just move the task over to
                // the stack without re-parenting the activity in a different task.  We don't
                // move the home stack forward if we are currently entering picture-in-picture
                // while pausing because that changes the focused stack and may prevent the new
                // starting activity from resuming.
                if (moveHomeStackToFront && task.returnsToHomeTask()
                        && (r.state == RESUMED || !r.supportsEnterPipOnTaskSwitch)) {
                    // Move the home stack forward if the task we just moved to the pinned stack
                    // was launched from home so home should be visible behind it.
                    moveHomeStackToFront(reason);
                }
                // Defer resume until below, and do not schedule PiP changes until we animate below
                task.reparent(stack, ON_TOP, REPARENT_MOVE_STACK_TO_FRONT, !ANIMATE, DEFER_RESUME,
                        false /* schedulePictureInPictureModeChange */, reason);
@@ -4516,6 +4499,10 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
                        "startActivityFromRecents: Task " + taskId + " not found.");
            }

            // We always want to return to the home activity instead of the recents activity from
            // whatever is started from the recents activity, so move the home stack forward.
            moveHomeStackToFront("startActivityFromRecents");

            // If the user must confirm credentials (e.g. when first launching a work app and the
            // Work Challenge is present) let startActivityInPackage handle the intercepting.
            if (!mService.mUserController.shouldConfirmCredentials(task.userId)
Loading