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

Commit b3b36ba1 authored by Craig Mautner's avatar Craig Mautner
Browse files

Resize all changed windows and fix moveTaskToStack

- Add all changing windows to mResizingWindows when an ActivityStack
is resized.

- Stop calling TaskStack.setBounds if the bounds haven't changed.

- Make moving a task from one stack to another work properly.

- Eliminate unused methods and redundant variables in WindowState and
WindowStateAnimator.

Change-Id: I3a950c777bcc50cdeced150d44423d4d0b38af4a
parent f7bfefb5
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -6336,7 +6336,6 @@ public final class ActivityManagerService extends ActivityManagerNative
                    new RuntimeException("here").fillInStackTrace());
        }
        synchronized (this) {
            mWindowManager.moveTaskToStack(taskId, stackId, toTop);
            mStackSupervisor.moveTaskToStack(taskId, stackId, toTop);
        }
    }
+1 −6
Original line number Diff line number Diff line
@@ -3416,12 +3416,7 @@ final class ActivityStack {
        return new ArrayList<TaskRecord>(mTaskHistory);
    }

    void moveTask(int taskId, boolean toTop) {
        final TaskRecord task = mStackSupervisor.anyTaskForIdLocked(taskId);
        if (task == null) {
            return;
        }
        task.stack.mTaskHistory.remove(task);
    void addTask(final TaskRecord task, final boolean toTop) {
        task.stack = this;
        if (toTop) {
            mTaskHistory.add(task);
+16 −1
Original line number Diff line number Diff line
@@ -314,7 +314,12 @@ public class ActivityStackSupervisor {
    }

    void removeTask(TaskRecord task) {
        mWindowManager.removeTask(task.taskId);
        final ActivityStack stack = task.stack;
        final ActivityRecord r = stack.mResumedActivity;
        if (r != null && r.task == task) {
            stack.mResumedActivity = null;
        }
        if (stack.removeTask(task) && !stack.isHomeStack()) {
            if (DEBUG_STACK) Slog.i(TAG, "removeTask: removing stack " + stack);
            mStacks.remove(stack);
@@ -1893,12 +1898,22 @@ public class ActivityStackSupervisor {
    }

    void moveTaskToStack(int taskId, int stackId, boolean toTop) {
        final TaskRecord task = anyTaskForIdLocked(taskId);
        if (task == null) {
            return;
        }
        final ActivityStack stack = getStack(stackId);
        if (stack == null) {
            Slog.w(TAG, "moveTaskToStack: no stack for id=" + stackId);
            return;
        }
        stack.moveTask(taskId, toTop);
        removeTask(task);
        stack.addTask(task, toTop);
        if (toTop) {
            moveHomeStack(stack.isHomeStack());
            setFocusedStack(task.getTopActivity());
        }
        mWindowManager.addTask(taskId, stackId, toTop);
        resumeTopActivitiesLocked();
    }

+4 −2
Original line number Diff line number Diff line
@@ -309,10 +309,12 @@ class DisplayContent {
     * Propagate the new bounds to all child stack boxes, applying weights as we move down.
     * @param contentRect The bounds to apply at the top level.
     */
    void setStackBoxSize(Rect contentRect) {
    boolean setStackBoxSize(Rect contentRect) {
        boolean change = false;
        for (int stackBoxNdx = mStackBoxes.size() - 1; stackBoxNdx >= 0; --stackBoxNdx) {
            mStackBoxes.get(stackBoxNdx).setStackBoxSizes(contentRect);
            change |= mStackBoxes.get(stackBoxNdx).setStackBoxSizes(contentRect);
        }
        return change;
    }

    Rect getStackBounds(int stackId) {
+4 −2
Original line number Diff line number Diff line
@@ -274,8 +274,10 @@ public class StackBox {
        boolean change;
        if (mStack != null) {
            change = !mBounds.equals(bounds);
            if (change) {
                mBounds.set(bounds);
                mStack.setBounds(bounds);
            }
        } else {
            mTmpRect.set(bounds);
            if (mVertical) {
Loading