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

Commit 6e015391 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fixes minimized state to match task and stack bounds for cts test"

parents bd7ae7df aa2b620c
Loading
Loading
Loading
Loading
+7 −3
Original line number Original line Diff line number Diff line
@@ -22,6 +22,7 @@ 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.HOME_STACK_ID;
import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
import static android.app.ActivityManager.StackId.PINNED_STACK_ID;
import static android.app.ActivityManager.StackId.PINNED_STACK_ID;
import static android.app.ActivityManager.StackId.RECENTS_STACK_ID;
import static android.provider.Settings.Global.DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT;
import static android.provider.Settings.Global.DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT;


import android.annotation.NonNull;
import android.annotation.NonNull;
@@ -1057,15 +1058,18 @@ public class SystemServicesProxy {
    }
    }


    /**
    /**
     * Returns the window rect for the RecentsActivity, based on the dimensions of the home stack.
     * Returns the window rect for the RecentsActivity, based on the dimensions of the recents stack
     */
     */
    public Rect getWindowRect() {
    public Rect getWindowRect() {
        Rect windowRect = new Rect();
        Rect windowRect = new Rect();
        if (mIam == null) return windowRect;
        if (mIam == null) return windowRect;


        try {
        try {
            // Use the home stack bounds
            // Use the recents stack bounds, fallback to fullscreen stack if it is null
            ActivityManager.StackInfo stackInfo = mIam.getStackInfo(HOME_STACK_ID);
            ActivityManager.StackInfo stackInfo = mIam.getStackInfo(RECENTS_STACK_ID);
            if (stackInfo == null) {
                stackInfo = mIam.getStackInfo(FULLSCREEN_WORKSPACE_STACK_ID);
            }
            if (stackInfo != null) {
            if (stackInfo != null) {
                windowRect.set(stackInfo.bounds);
                windowRect.set(stackInfo.bounds);
            }
            }
+7 −4
Original line number Original line Diff line number Diff line
@@ -746,15 +746,18 @@ public class DividerView extends FrameLayout implements OnTouchListener,
            if (mStableInsets.isEmpty()) {
            if (mStableInsets.isEmpty()) {
                SystemServicesProxy.getInstance(mContext).getStableInsets(mStableInsets);
                SystemServicesProxy.getInstance(mContext).getStableInsets(mStableInsets);
            }
            }
            mMinimizedSnapAlgorithm = null;
            mDockedStackMinimized = minimized;
            initializeSnapAlgorithm();
            if (!mIsInMinimizeInteraction && minimized) {
            if (!mIsInMinimizeInteraction && minimized) {
                mIsInMinimizeInteraction = true;
                mIsInMinimizeInteraction = true;
                mDividerPositionBeforeMinimized = DockedDividerUtils.calculateMiddlePosition(
                mDividerPositionBeforeMinimized = DockedDividerUtils.calculateMiddlePosition(
                        isHorizontalDivision(), mStableInsets, mDisplayWidth, mDisplayHeight,
                        isHorizontalDivision(), mStableInsets, mDisplayWidth, mDisplayHeight,
                        mDividerSize);
                        mDividerSize);

                int position = mMinimizedSnapAlgorithm.getMiddleTarget().position;
                resizeStack(position, position, mMinimizedSnapAlgorithm.getMiddleTarget());
            }
            }
            mMinimizedSnapAlgorithm = null;
            mDockedStackMinimized = minimized;
            initializeSnapAlgorithm();
        }
        }
    }
    }


@@ -1140,7 +1143,7 @@ public class DividerView extends FrameLayout implements OnTouchListener,
                        && dockSideBottomRight(mDockSide))) {
                        && dockSideBottomRight(mDockSide))) {
            return StackId.DOCKED_STACK_ID;
            return StackId.DOCKED_STACK_ID;
        } else {
        } else {
            return StackId.HOME_STACK_ID;
            return StackId.RECENTS_STACK_ID;
        }
        }
    }
    }


+3 −6
Original line number Original line Diff line number Diff line
@@ -19901,14 +19901,11 @@ public class ActivityManagerService extends IActivityManager.Stub
    /** Helper method that requests bounds from WM and applies them to stack. */
    /** Helper method that requests bounds from WM and applies them to stack. */
    private void resizeStackWithBoundsFromWindowManager(int stackId, boolean deferResume) {
    private void resizeStackWithBoundsFromWindowManager(int stackId, boolean deferResume) {
        final Rect newStackBounds = new Rect();
        final Rect newStackBounds = new Rect();
        final Rect newTempTaskBounds = new Rect();
        mStackSupervisor.getStack(stackId).getBoundsForNewConfiguration(newStackBounds);
        mStackSupervisor.getStack(stackId).getBoundsForNewConfiguration(newStackBounds,
                newTempTaskBounds);
        mStackSupervisor.resizeStackLocked(
        mStackSupervisor.resizeStackLocked(
                stackId, !newStackBounds.isEmpty() ? newStackBounds : null /* bounds */,
                stackId, !newStackBounds.isEmpty() ? newStackBounds : null /* bounds */,
                !newTempTaskBounds.isEmpty() ? newTempTaskBounds : null /* tempTaskBounds */,
                null /* tempTaskBounds */, null /* tempTaskInsetBounds */,
                null /* tempTaskInsetBounds */, false /* preserveWindows */,
                false /* preserveWindows */, false /* allowResizeInDockedMode */, deferResume);
                false /* allowResizeInDockedMode */, deferResume);
    }
    }
    /**
    /**
+10 −6
Original line number Original line Diff line number Diff line
@@ -120,6 +120,7 @@ import com.android.server.am.ActivityManagerService.ItemMatcher;
import com.android.server.am.ActivityStackSupervisor.ActivityContainer;
import com.android.server.am.ActivityStackSupervisor.ActivityContainer;
import com.android.server.wm.StackWindowController;
import com.android.server.wm.StackWindowController;
import com.android.server.wm.StackWindowListener;
import com.android.server.wm.StackWindowListener;
import com.android.server.wm.TaskStack;
import com.android.server.wm.WindowManagerService;
import com.android.server.wm.WindowManagerService;


import java.io.FileDescriptor;
import java.io.FileDescriptor;
@@ -544,10 +545,13 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
        mActivityContainer.mActivityDisplay.mDisplay.getSize(out);
        mActivityContainer.mActivityDisplay.mDisplay.getSize(out);
    }
    }


    void getStackDockedModeBounds(Rect outBounds, Rect outTempBounds, Rect outTempInsetBounds,
    /**
            boolean ignoreVisibility) {
     * @see ActivityStack.getStackDockedModeBounds(Rect, Rect, Rect, boolean)
        mWindowContainerController.getStackDockedModeBounds(outBounds, outTempBounds,
     */
                outTempInsetBounds, ignoreVisibility);
    void getStackDockedModeBounds(Rect currentTempTaskBounds, Rect outStackBounds,
            Rect outTempTaskBounds, boolean ignoreVisibility) {
        mWindowContainerController.getStackDockedModeBounds(currentTempTaskBounds,
                outStackBounds, outTempTaskBounds, ignoreVisibility);
    }
    }


    void prepareFreezingTaskBounds() {
    void prepareFreezingTaskBounds() {
@@ -562,8 +566,8 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
        outBounds.setEmpty();
        outBounds.setEmpty();
    }
    }


    void getBoundsForNewConfiguration(Rect outBounds, Rect outTempBounds) {
    void getBoundsForNewConfiguration(Rect outBounds) {
        mWindowContainerController.getBoundsForNewConfiguration(outBounds, outTempBounds);
        mWindowContainerController.getBoundsForNewConfiguration(outBounds);
    }
    }


    void positionChildWindowContainerAtTop(TaskRecord child) {
    void positionChildWindowContainerAtTop(TaskRecord child) {
+9 −9
Original line number Original line Diff line number Diff line
@@ -2403,19 +2403,19 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
                // static stacks need to be adjusted so they don't overlap with the docked stack.
                // static stacks need to be adjusted so they don't overlap with the docked stack.
                // We get the bounds to use from window manager which has been adjusted for any
                // We get the bounds to use from window manager which has been adjusted for any
                // screen controls and is also the same for all stacks.
                // screen controls and is also the same for all stacks.
                final Rect tempOtherTaskRect = new Rect();
                final Rect otherTaskRect = new Rect();
                final Rect tempOtherTaskInsetRect = new Rect();
                for (int i = FIRST_STATIC_STACK_ID; i <= LAST_STATIC_STACK_ID; i++) {
                for (int i = FIRST_STATIC_STACK_ID; i <= LAST_STATIC_STACK_ID; i++) {
                    final ActivityStack current = getStack(i);
                    final ActivityStack current = getStack(i);
                    if (current != null && StackId.isResizeableByDockedStack(i)) {
                    if (current != null && StackId.isResizeableByDockedStack(i)) {
                        current.getStackDockedModeBounds(tempRect, tempOtherTaskRect,
                        current.getStackDockedModeBounds(
                                tempOtherTaskInsetRect, true /* ignoreVisibility */);
                                tempOtherTaskBounds /* currentTempTaskBounds */,
                                tempRect /* outStackBounds */,
                                otherTaskRect /* outTempTaskBounds */, true /* ignoreVisibility */);

                        resizeStackLocked(i, tempRect,
                        resizeStackLocked(i, tempRect,
                                !tempOtherTaskRect.isEmpty() ? tempOtherTaskRect :
                                !otherTaskRect.isEmpty() ? otherTaskRect : tempOtherTaskBounds,
                                        tempOtherTaskBounds,
                                tempOtherTaskInsetBounds, preserveWindows,
                                !tempOtherTaskInsetRect.isEmpty() ? tempOtherTaskInsetRect :
                                true /* allowResizeInDockedMode */, deferResume);
                                        tempOtherTaskInsetBounds,
                                preserveWindows, true /* allowResizeInDockedMode */, deferResume);
                    }
                    }
                }
                }
            }
            }
Loading