Loading core/api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -6216,6 +6216,7 @@ package android.app { method public android.app.PictureInPictureParams.Builder setActions(java.util.List<android.app.RemoteAction>); method public android.app.PictureInPictureParams.Builder setAspectRatio(android.util.Rational); method @NonNull public android.app.PictureInPictureParams.Builder setAutoEnterEnabled(boolean); method @NonNull public android.app.PictureInPictureParams.Builder setSeamlessResizeEnabled(boolean); method public android.app.PictureInPictureParams.Builder setSourceRectHint(android.graphics.Rect); } core/api/test-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -283,6 +283,7 @@ package android.app { method public java.util.List<android.app.RemoteAction> getActions(); method public float getAspectRatio(); method public android.graphics.Rect getSourceRectHint(); method public boolean isSeamlessResizeEnabled(); } public class StatusBarManager { Loading core/java/android/app/PictureInPictureParams.java +71 −13 Original line number Diff line number Diff line Loading @@ -48,7 +48,9 @@ public final class PictureInPictureParams implements Parcelable { @Nullable private Rect mSourceRectHint; private boolean mAutoEnterEnabled; private Boolean mAutoEnterEnabled; private Boolean mSeamlessResizeEnabled; /** * Sets the aspect ratio. This aspect ratio is defined as the desired width / height, and Loading Loading @@ -113,7 +115,7 @@ public final class PictureInPictureParams implements Parcelable { * * If true, {@link Activity#onPictureInPictureRequested()} will never be called. * * This property is false by default. * This property is {@code false} by default. * @param autoEnterEnabled {@code true} if the system will automatically put the activity * in picture-in-picture mode. * Loading @@ -125,6 +127,23 @@ public final class PictureInPictureParams implements Parcelable { return this; } /** * Sets whether the system can seamlessly resize the window while the activity is in * picture-in-picture mode. This should normally be the case for video content and * when it's set to {@code false}, system will perform transitions to overcome the * artifacts due to resize. * * This property is {@code true} by default for backwards compatibility. * @param seamlessResizeEnabled {@code true} if the system can seamlessly resize the window * while activity is in picture-in-picture mode. * @return this builder instance. */ @NonNull public Builder setSeamlessResizeEnabled(boolean seamlessResizeEnabled) { mSeamlessResizeEnabled = seamlessResizeEnabled; return this; } /** * @return an immutable {@link PictureInPictureParams} to be used when entering or updating * the activity in picture-in-picture. Loading @@ -134,7 +153,7 @@ public final class PictureInPictureParams implements Parcelable { */ public PictureInPictureParams build() { PictureInPictureParams params = new PictureInPictureParams(mAspectRatio, mUserActions, mSourceRectHint, mAutoEnterEnabled); mSourceRectHint, mAutoEnterEnabled, mSeamlessResizeEnabled); return params; } } Loading @@ -161,8 +180,16 @@ public final class PictureInPictureParams implements Parcelable { /** * Whether the system is allowed to automatically put the activity in picture-in-picture mode. * {@link #isAutoEnterEnabled()} defaults to {@code false} if this is not set. */ private Boolean mAutoEnterEnabled; /** * Whether system can seamlessly resize the window when activity is in picture-in-picture mode. * {@link #isSeamlessResizeEnabled()} defaults to {@code true} if this is not set for * backwards compatibility. */ private boolean mAutoEnterEnabled; private Boolean mSeamlessResizeEnabled; /** {@hide} */ PictureInPictureParams() { Loading @@ -183,15 +210,19 @@ public final class PictureInPictureParams implements Parcelable { if (in.readInt() != 0) { mAutoEnterEnabled = in.readBoolean(); } if (in.readInt() != 0) { mSeamlessResizeEnabled = in.readBoolean(); } } /** {@hide} */ PictureInPictureParams(Rational aspectRatio, List<RemoteAction> actions, Rect sourceRectHint, boolean autoEnterEnabled) { Rect sourceRectHint, Boolean autoEnterEnabled, Boolean seamlessResizeEnabled) { mAspectRatio = aspectRatio; mUserActions = actions; mSourceRectHint = sourceRectHint; mAutoEnterEnabled = autoEnterEnabled; mSeamlessResizeEnabled = seamlessResizeEnabled; } /** Loading @@ -201,7 +232,7 @@ public final class PictureInPictureParams implements Parcelable { public PictureInPictureParams(PictureInPictureParams other) { this(other.mAspectRatio, other.mUserActions, other.hasSourceBoundsHint() ? new Rect(other.getSourceRectHint()) : null, other.mAutoEnterEnabled); other.mAutoEnterEnabled, other.mSeamlessResizeEnabled); } /** Loading @@ -218,8 +249,13 @@ public final class PictureInPictureParams implements Parcelable { if (otherArgs.hasSourceBoundsHint()) { mSourceRectHint = new Rect(otherArgs.getSourceRectHint()); } if (otherArgs.mAutoEnterEnabled != null) { mAutoEnterEnabled = otherArgs.mAutoEnterEnabled; } if (otherArgs.mSeamlessResizeEnabled != null) { mSeamlessResizeEnabled = otherArgs.mSeamlessResizeEnabled; } } /** * @return the aspect ratio. If none is set, return 0. Loading Loading @@ -295,7 +331,16 @@ public final class PictureInPictureParams implements Parcelable { * @hide */ public boolean isAutoEnterEnabled() { return mAutoEnterEnabled; return mAutoEnterEnabled == null ? false : mAutoEnterEnabled; } /** * @return whether seamless resize is enabled. * @hide */ @TestApi public boolean isSeamlessResizeEnabled() { return mSeamlessResizeEnabled == null ? true : mSeamlessResizeEnabled; } /** Loading @@ -304,7 +349,7 @@ public final class PictureInPictureParams implements Parcelable { */ public boolean empty() { return !hasSourceBoundsHint() && !hasSetActions() && !hasSetAspectRatio() && !mAutoEnterEnabled; && mAutoEnterEnabled != null && mSeamlessResizeEnabled != null; } @Override Loading @@ -312,7 +357,8 @@ public final class PictureInPictureParams implements Parcelable { if (this == o) return true; if (!(o instanceof PictureInPictureParams)) return false; PictureInPictureParams that = (PictureInPictureParams) o; return mAutoEnterEnabled == that.mAutoEnterEnabled return Objects.equals(mAutoEnterEnabled, that.mAutoEnterEnabled) && Objects.equals(mSeamlessResizeEnabled, that.mSeamlessResizeEnabled) && Objects.equals(mAspectRatio, that.mAspectRatio) && Objects.equals(mUserActions, that.mUserActions) && Objects.equals(mSourceRectHint, that.mSourceRectHint); Loading @@ -320,7 +366,8 @@ public final class PictureInPictureParams implements Parcelable { @Override public int hashCode() { return Objects.hash(mAspectRatio, mUserActions, mSourceRectHint, mAutoEnterEnabled); return Objects.hash(mAspectRatio, mUserActions, mSourceRectHint, mAutoEnterEnabled, mSeamlessResizeEnabled); } @Override Loading Loading @@ -349,8 +396,18 @@ public final class PictureInPictureParams implements Parcelable { } else { out.writeInt(0); } if (mAutoEnterEnabled != null) { out.writeInt(1); out.writeBoolean(mAutoEnterEnabled); } else { out.writeInt(0); } if (mSeamlessResizeEnabled != null) { out.writeInt(1); out.writeBoolean(mSeamlessResizeEnabled); } else { out.writeInt(0); } } @Override Loading @@ -360,6 +417,7 @@ public final class PictureInPictureParams implements Parcelable { + " sourceRectHint=" + getSourceRectHint() + " hasSetActions=" + hasSetActions() + " isAutoPipEnabled=" + isAutoEnterEnabled() + " isSeamlessResizeEnabled=" + isSeamlessResizeEnabled() + ")"; } Loading Loading
core/api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -6216,6 +6216,7 @@ package android.app { method public android.app.PictureInPictureParams.Builder setActions(java.util.List<android.app.RemoteAction>); method public android.app.PictureInPictureParams.Builder setAspectRatio(android.util.Rational); method @NonNull public android.app.PictureInPictureParams.Builder setAutoEnterEnabled(boolean); method @NonNull public android.app.PictureInPictureParams.Builder setSeamlessResizeEnabled(boolean); method public android.app.PictureInPictureParams.Builder setSourceRectHint(android.graphics.Rect); }
core/api/test-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -283,6 +283,7 @@ package android.app { method public java.util.List<android.app.RemoteAction> getActions(); method public float getAspectRatio(); method public android.graphics.Rect getSourceRectHint(); method public boolean isSeamlessResizeEnabled(); } public class StatusBarManager { Loading
core/java/android/app/PictureInPictureParams.java +71 −13 Original line number Diff line number Diff line Loading @@ -48,7 +48,9 @@ public final class PictureInPictureParams implements Parcelable { @Nullable private Rect mSourceRectHint; private boolean mAutoEnterEnabled; private Boolean mAutoEnterEnabled; private Boolean mSeamlessResizeEnabled; /** * Sets the aspect ratio. This aspect ratio is defined as the desired width / height, and Loading Loading @@ -113,7 +115,7 @@ public final class PictureInPictureParams implements Parcelable { * * If true, {@link Activity#onPictureInPictureRequested()} will never be called. * * This property is false by default. * This property is {@code false} by default. * @param autoEnterEnabled {@code true} if the system will automatically put the activity * in picture-in-picture mode. * Loading @@ -125,6 +127,23 @@ public final class PictureInPictureParams implements Parcelable { return this; } /** * Sets whether the system can seamlessly resize the window while the activity is in * picture-in-picture mode. This should normally be the case for video content and * when it's set to {@code false}, system will perform transitions to overcome the * artifacts due to resize. * * This property is {@code true} by default for backwards compatibility. * @param seamlessResizeEnabled {@code true} if the system can seamlessly resize the window * while activity is in picture-in-picture mode. * @return this builder instance. */ @NonNull public Builder setSeamlessResizeEnabled(boolean seamlessResizeEnabled) { mSeamlessResizeEnabled = seamlessResizeEnabled; return this; } /** * @return an immutable {@link PictureInPictureParams} to be used when entering or updating * the activity in picture-in-picture. Loading @@ -134,7 +153,7 @@ public final class PictureInPictureParams implements Parcelable { */ public PictureInPictureParams build() { PictureInPictureParams params = new PictureInPictureParams(mAspectRatio, mUserActions, mSourceRectHint, mAutoEnterEnabled); mSourceRectHint, mAutoEnterEnabled, mSeamlessResizeEnabled); return params; } } Loading @@ -161,8 +180,16 @@ public final class PictureInPictureParams implements Parcelable { /** * Whether the system is allowed to automatically put the activity in picture-in-picture mode. * {@link #isAutoEnterEnabled()} defaults to {@code false} if this is not set. */ private Boolean mAutoEnterEnabled; /** * Whether system can seamlessly resize the window when activity is in picture-in-picture mode. * {@link #isSeamlessResizeEnabled()} defaults to {@code true} if this is not set for * backwards compatibility. */ private boolean mAutoEnterEnabled; private Boolean mSeamlessResizeEnabled; /** {@hide} */ PictureInPictureParams() { Loading @@ -183,15 +210,19 @@ public final class PictureInPictureParams implements Parcelable { if (in.readInt() != 0) { mAutoEnterEnabled = in.readBoolean(); } if (in.readInt() != 0) { mSeamlessResizeEnabled = in.readBoolean(); } } /** {@hide} */ PictureInPictureParams(Rational aspectRatio, List<RemoteAction> actions, Rect sourceRectHint, boolean autoEnterEnabled) { Rect sourceRectHint, Boolean autoEnterEnabled, Boolean seamlessResizeEnabled) { mAspectRatio = aspectRatio; mUserActions = actions; mSourceRectHint = sourceRectHint; mAutoEnterEnabled = autoEnterEnabled; mSeamlessResizeEnabled = seamlessResizeEnabled; } /** Loading @@ -201,7 +232,7 @@ public final class PictureInPictureParams implements Parcelable { public PictureInPictureParams(PictureInPictureParams other) { this(other.mAspectRatio, other.mUserActions, other.hasSourceBoundsHint() ? new Rect(other.getSourceRectHint()) : null, other.mAutoEnterEnabled); other.mAutoEnterEnabled, other.mSeamlessResizeEnabled); } /** Loading @@ -218,8 +249,13 @@ public final class PictureInPictureParams implements Parcelable { if (otherArgs.hasSourceBoundsHint()) { mSourceRectHint = new Rect(otherArgs.getSourceRectHint()); } if (otherArgs.mAutoEnterEnabled != null) { mAutoEnterEnabled = otherArgs.mAutoEnterEnabled; } if (otherArgs.mSeamlessResizeEnabled != null) { mSeamlessResizeEnabled = otherArgs.mSeamlessResizeEnabled; } } /** * @return the aspect ratio. If none is set, return 0. Loading Loading @@ -295,7 +331,16 @@ public final class PictureInPictureParams implements Parcelable { * @hide */ public boolean isAutoEnterEnabled() { return mAutoEnterEnabled; return mAutoEnterEnabled == null ? false : mAutoEnterEnabled; } /** * @return whether seamless resize is enabled. * @hide */ @TestApi public boolean isSeamlessResizeEnabled() { return mSeamlessResizeEnabled == null ? true : mSeamlessResizeEnabled; } /** Loading @@ -304,7 +349,7 @@ public final class PictureInPictureParams implements Parcelable { */ public boolean empty() { return !hasSourceBoundsHint() && !hasSetActions() && !hasSetAspectRatio() && !mAutoEnterEnabled; && mAutoEnterEnabled != null && mSeamlessResizeEnabled != null; } @Override Loading @@ -312,7 +357,8 @@ public final class PictureInPictureParams implements Parcelable { if (this == o) return true; if (!(o instanceof PictureInPictureParams)) return false; PictureInPictureParams that = (PictureInPictureParams) o; return mAutoEnterEnabled == that.mAutoEnterEnabled return Objects.equals(mAutoEnterEnabled, that.mAutoEnterEnabled) && Objects.equals(mSeamlessResizeEnabled, that.mSeamlessResizeEnabled) && Objects.equals(mAspectRatio, that.mAspectRatio) && Objects.equals(mUserActions, that.mUserActions) && Objects.equals(mSourceRectHint, that.mSourceRectHint); Loading @@ -320,7 +366,8 @@ public final class PictureInPictureParams implements Parcelable { @Override public int hashCode() { return Objects.hash(mAspectRatio, mUserActions, mSourceRectHint, mAutoEnterEnabled); return Objects.hash(mAspectRatio, mUserActions, mSourceRectHint, mAutoEnterEnabled, mSeamlessResizeEnabled); } @Override Loading Loading @@ -349,8 +396,18 @@ public final class PictureInPictureParams implements Parcelable { } else { out.writeInt(0); } if (mAutoEnterEnabled != null) { out.writeInt(1); out.writeBoolean(mAutoEnterEnabled); } else { out.writeInt(0); } if (mSeamlessResizeEnabled != null) { out.writeInt(1); out.writeBoolean(mSeamlessResizeEnabled); } else { out.writeInt(0); } } @Override Loading @@ -360,6 +417,7 @@ public final class PictureInPictureParams implements Parcelable { + " sourceRectHint=" + getSourceRectHint() + " hasSetActions=" + hasSetActions() + " isAutoPipEnabled=" + isAutoEnterEnabled() + " isSeamlessResizeEnabled=" + isSeamlessResizeEnabled() + ")"; } Loading