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

Commit cacfaa21 authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Resize pinned stack with bounds in ActivityOptions.

If an activity is been launched into the pinned stack and
there is a bounds specified in the ActivityOptions, use it to
resize the pinned stack.

Bug: 26574470
Change-Id: I43c15069b8512ce54cfde6cc16f5caa2a70bd06a
parent b68d2d5b
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -600,6 +600,14 @@ public class ActivityManager {
        public static boolean allowTopTaskToReturnHome(int stackId) {
            return stackId != PINNED_STACK_ID;
        }

        /**
         * Returns true if the stack should be resized to match the bounds specified by
         * {@link ActivityOptions#setLaunchBounds} when launching an activity into the stack.
         */
        public static boolean resizeStackWithLaunchBounds(int stackId) {
            return stackId == PINNED_STACK_ID;
        }
    }

    /**
+11 −5
Original line number Diff line number Diff line
@@ -1689,6 +1689,11 @@ public final class ActivityStackSupervisor implements DisplayListener {
                    // moveTaskToStackUncheckedLocked() should already placed the task on top,
                    // still need moveTaskToFrontLocked() below for any transition settings.
                }
                if (StackId.resizeStackWithLaunchBounds(stackId)) {
                    resizeStackLocked(stackId, bounds,
                            null /* tempTaskBounds */, null /* tempTaskInsetBounds */,
                            !PRESERVE_WINDOWS, true /* allowResizeInDockedMode */);
                } else {
                    // WM resizeTask must be done after the task is moved to the correct stack,
                    // because Task's setBounds() also updates dim layer's bounds, but that has
                    // dependency on the stack.
@@ -1696,6 +1701,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
                            false /* relayout */, false /* forced */);
                }
            }
        }

        final ActivityRecord r = task.getTopActivity();
        task.stack.moveTaskToFrontLocked(task, false /* noAnimation */, options,
+14 −1
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ import static com.android.server.am.ActivityStack.ActivityState.RESUMED;
import static com.android.server.am.ActivityStackSupervisor.CREATE_IF_NEEDED;
import static com.android.server.am.ActivityStackSupervisor.FORCE_FOCUS;
import static com.android.server.am.ActivityStackSupervisor.ON_TOP;
import static com.android.server.am.ActivityStackSupervisor.PRESERVE_WINDOWS;
import static com.android.server.am.ActivityStackSupervisor.TAG_TASKS;
import static com.android.server.am.EventLogTags.AM_NEW_INTENT;

@@ -1426,8 +1427,15 @@ class ActivityStarter {
                    mVoiceSession, mVoiceInteractor, !mLaunchTaskBehind /* toTop */);
            mStartActivity.setTask(task, taskToAffiliate);
            if (mLaunchBounds != null) {
                final int stackId = mTargetStack.mStackId;
                if (StackId.resizeStackWithLaunchBounds(stackId)) {
                    mSupervisor.resizeStackLocked(stackId, mLaunchBounds,
                            null /* tempTaskBounds */, null /* tempTaskInsetBounds */,
                            !PRESERVE_WINDOWS, true /* allowResizeInDockedMode */);
                } else {
                    mStartActivity.task.updateOverrideConfiguration(mLaunchBounds);
                }
            }
            if (DEBUG_TASKS) Slog.v(TAG_TASKS,
                    "Starting new activity " +
                            mStartActivity + " in new task " + mStartActivity.task);
@@ -1509,6 +1517,11 @@ class ActivityStarter {
                mSupervisor.moveTaskToStackUncheckedLocked(
                        mInTask, stackId, ON_TOP, !FORCE_FOCUS, "inTaskToFront");
            }
            if (StackId.resizeStackWithLaunchBounds(stackId)) {
                mSupervisor.resizeStackLocked(stackId, mLaunchBounds,
                        null /* tempTaskBounds */, null /* tempTaskInsetBounds */,
                        !PRESERVE_WINDOWS, true /* allowResizeInDockedMode */);
            }
        }
        mTargetStack = mInTask.stack;
        mTargetStack.moveTaskToFrontLocked(