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

Commit 43513086 authored by Tracy Zhou's avatar Tracy Zhou
Browse files

Move default pip position to right above the shelf.

This change takes care of the flow from WindowManagerService to
PinnedStackController, all the way to PipTouchHandler. It also
introduces a WindowManager hook that allows Launcher to pass in
shelf visibility and height. A separate change is made to send
signals from Launcher to SysUI. (ag/3724896)

Bug: 73961893
Change-Id: I2ff54e78bc2dc35c806b902464048b051a4d6394
Test: atest CtsActivityManagerDeviceTestCases:ActivityManagerPinnedStackTests
parent 1b929db3
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -385,4 +385,10 @@ public abstract class ActivityManagerInternal {
     * Returns a list that contains the memory stats for currently running processes.
     */
    public abstract List<ProcessMemoryState> getMemoryStateForProcesses();

    /**
     * This enforces {@code func} can only be called if either the caller is Recents activity or
     * has {@code permission}.
     */
    public abstract void enforceCallerIsRecentsOrHasPermission(String permission, String func);
}
+10 −2
Original line number Diff line number Diff line
@@ -47,16 +47,24 @@ oneway interface IPinnedStackListener {
     * the WM has changed in the mean time but the client has not received onMovementBoundsChanged).
     */
    void onMovementBoundsChanged(in Rect insetBounds, in Rect normalBounds, in Rect animatingBounds,
            boolean fromImeAdjustement, int displayRotation);
            boolean fromImeAdjustment, boolean fromShelfAdjustment, int displayRotation);

    /**
     * Called when window manager decides to adjust the pinned stack bounds because of the IME, or
     * when the listener is first registered to allow the listener to synchronized its state with
     * the controller.  This call will always be followed by a onMovementBoundsChanged() call
     * with fromImeAdjustement set to true.
     * with fromImeAdjustement set to {@code true}.
     */
    void onImeVisibilityChanged(boolean imeVisible, int imeHeight);

    /**
     * Called when window manager decides to adjust the pinned stack bounds because of the shelf, or
     * when the listener is first registered to allow the listener to synchronized its state with
     * the controller.  This call will always be followed by a onMovementBoundsChanged() call
     * with fromShelfAdjustment set to {@code true}.
     */
    void onShelfVisibilityChanged(boolean shelfVisible, int shelfHeight);

    /**
     * Called when window manager decides to adjust the minimized state, or when the listener
     * is first registered to allow the listener to synchronized its state with the controller.
+8 −3
Original line number Diff line number Diff line
@@ -284,6 +284,11 @@ interface IWindowManager
     */
    oneway void setPipVisibility(boolean visible);

    /**
     * Called by System UI to notify of changes to the visibility and height of the shelf.
     */
    void setShelfHeight(boolean visible, int shelfHeight);

    /**
     * Called by System UI to enable or disable haptic feedback on the navigation bar buttons.
     */
+2 −2
Original line number Diff line number Diff line
@@ -325,14 +325,14 @@ public class PipSnapAlgorithm {
     * {@param stackBounds}.
     */
    public void getMovementBounds(Rect stackBounds, Rect insetBounds, Rect movementBoundsOut,
            int imeHeight) {
            int bottomOffset) {
        // Adjust the right/bottom to ensure the stack bounds never goes offscreen
        movementBoundsOut.set(insetBounds);
        movementBoundsOut.right = Math.max(insetBounds.left, insetBounds.right -
                stackBounds.width());
        movementBoundsOut.bottom = Math.max(insetBounds.top, insetBounds.bottom -
                stackBounds.height());
        movementBoundsOut.bottom -= imeHeight;
        movementBoundsOut.bottom -= bottomOffset;
    }

    /**
+2 −2
Original line number Diff line number Diff line
@@ -2956,8 +2956,8 @@
    <item name="config_pictureInPictureAspectRatioLimitForMinSize" format="float" type="dimen">1.777778</item>

    <!-- The default gravity for the picture-in-picture window.
         Currently, this maps to Gravity.TOP | Gravity.RIGHT -->
    <integer name="config_defaultPictureInPictureGravity">0x35</integer>
         Currently, this maps to Gravity.BOTTOM | Gravity.RIGHT -->
    <integer name="config_defaultPictureInPictureGravity">0x55</integer>

    <!-- The minimum aspect ratio (width/height) that is supported for picture-in-picture.  Any
         ratio smaller than this is considered too tall and thin to be usable. Currently, this
Loading