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

Commit 06868c37 authored by Winson's avatar Winson
Browse files

Changing initial PIP bounds specifications.

- Change from a absolute bounds to a size, gravity and inset to
  allow easier tweaking of initial pinned stack bounds.

Test: android.server.cts.ActivityManagerPinnedStackTests
Test: #testPinnedStackDefaultBounds
Test: #testPinnedStackMovementBounds

Change-Id: I82a102bbd2d83259c6c84915071d1a16728e3aa7
parent e60cb323
Loading
Loading
Loading
Loading
+42 −0
Original line number Diff line number Diff line
@@ -2931,6 +2931,20 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
            reply.writeNoException();
            return true;
        }
        case GET_DEFAULT_PICTURE_IN_PICTURE_BOUNDS_TRANSACTION: {
            data.enforceInterface(IActivityManager.descriptor);
            Rect r = getDefaultPictureInPictureBounds();
            reply.writeNoException();
            r.writeToParcel(reply, 0);
            return true;
        }
        case GET_PICTURE_IN_PICTURE_MOVEMENT_BOUNDS_TRANSACTION: {
            data.enforceInterface(IActivityManager.descriptor);
            Rect r = getPictureInPictureMovementBounds();
            reply.writeNoException();
            r.writeToParcel(reply, 0);
            return true;
        }
        case SET_VR_MODE_TRANSACTION: {
            data.enforceInterface(IActivityManager.descriptor);
            final IBinder token = data.readStrongBinder();
@@ -6988,6 +7002,34 @@ class ActivityManagerProxy implements IActivityManager
        reply.recycle();
    }

    @Override
    public Rect getDefaultPictureInPictureBounds() throws RemoteException
    {
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
        mRemote.transact(GET_DEFAULT_PICTURE_IN_PICTURE_BOUNDS_TRANSACTION, data, reply, 0);
        reply.readException();
        Rect rect = Rect.CREATOR.createFromParcel(reply);
        data.recycle();
        reply.recycle();
        return rect;
    }

    @Override
    public Rect getPictureInPictureMovementBounds() throws RemoteException
    {
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
        mRemote.transact(GET_PICTURE_IN_PICTURE_MOVEMENT_BOUNDS_TRANSACTION, data, reply, 0);
        reply.readException();
        Rect rect = Rect.CREATOR.createFromParcel(reply);
        data.recycle();
        reply.recycle();
        return rect;
    }

    @Override
    public boolean isAppForeground(int uid) throws RemoteException {
        Parcel data = Parcel.obtain();
+12 −0
Original line number Diff line number Diff line
@@ -647,6 +647,16 @@ public interface IActivityManager extends IInterface {

    public void enterPictureInPictureMode(IBinder token) throws RemoteException;

    /**
     * @return the default bounds of the PIP on the default display.
     */
    public Rect getDefaultPictureInPictureBounds() throws RemoteException;

    /**
     * @return the movement bounds of the PIP on the default display.
     */
    public Rect getPictureInPictureMovementBounds() throws RemoteException;

    public int setVrMode(IBinder token, boolean enabled, ComponentName packageName)
            throws RemoteException;

@@ -1091,4 +1101,6 @@ public interface IActivityManager extends IInterface {

    // Start of O transactions
    int REQUEST_ACTIVITY_RELAUNCH = IBinder.FIRST_CALL_TRANSACTION+400;
    int GET_DEFAULT_PICTURE_IN_PICTURE_BOUNDS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 401;
    int GET_PICTURE_IN_PICTURE_MOVEMENT_BOUNDS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 402;
}
+3 −2
Original line number Diff line number Diff line
@@ -21,7 +21,8 @@
     for TV products.  Do not translate. -->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">

    <!-- Default bounds [left top right bottom] on screen for picture-in-picture windows. -->
    <string translatable="false" name="config_defaultPictureInPictureBounds">"112 54 592 324"</string>
    <!-- The default gravity for the picture-in-picture window.
         Currently, this maps to Gravity.TOP | Gravity.LEFT -->
    <integer name="config_defaultPictureInPictureGravity">0x33</integer>

</resources>
+11 −2
Original line number Diff line number Diff line
@@ -24,6 +24,15 @@
    <!-- Flags enabling default window features. See Window.java -->
    <bool name="config_defaultWindowFeatureOptionsPanel">false</bool>

    <!-- Default bounds [left top right bottom] on screen for picture-in-picture windows. -->
    <string translatable="false" name="config_defaultPictureInPictureBounds">"1328 54 1808 324"</string>
    <!-- Max default size [WIDTHxHEIGHT] on screen for picture-in-picture windows to fit inside.
         These values are in DPs and will be converted to pixel sizes internally. -->
    <string translatable="false" name="config_defaultPictureInPictureSize">240x135</string>

    <!-- Default insets [LEFT/RIGHTxTOP/BOTTOM] from the screen edge for picture-in-picture windows.
         These values are in DPs and will be converted to pixel sizes internally. -->
    <string translatable="false" name="config_defaultPictureInPictureScreenEdgeInsets">56x27</string>

    <!-- The default gravity for the picture-in-picture window.
         Currently, this maps to Gravity.TOP | Gravity.RIGHT -->
    <integer name="config_defaultPictureInPictureGravity">0x35</integer>
</resources>
+11 −2
Original line number Diff line number Diff line
@@ -2482,8 +2482,17 @@
         -->
    <integer name="config_navBarOpacityMode">0</integer>

    <!-- Default bounds [left top right bottom] on screen for picture-in-picture windows. -->
    <string translatable="false" name="config_defaultPictureInPictureBounds">"0 0 100 100"</string>
    <!-- Default insets [LEFT/RIGHTxTOP/BOTTOM] from the screen edge for picture-in-picture windows.
         These values are in DPs and will be converted to pixel sizes internally. -->
    <string translatable="false" name="config_defaultPictureInPictureScreenEdgeInsets">10x10</string>

    <!-- Max default size [WIDTHxHEIGHT] on screen for picture-in-picture windows to fit inside.
         These values are in DPs and will be converted to pixel sizes internally. -->
    <string translatable="false" name="config_defaultPictureInPictureSize">216x135</string>

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

    <!-- Controls the snap mode for the docked stack divider
             0 - 3 snap targets: left/top has 16:9 ratio, 1:1, and right/bottom has 16:9 ratio
Loading