Loading core/api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -6639,6 +6639,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 setCloseAction(@Nullable android.app.RemoteAction); method @NonNull public android.app.PictureInPictureParams.Builder setExpandedAspectRatio(@Nullable android.util.Rational); 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 @@ -357,6 +357,7 @@ package android.app { public final class PictureInPictureParams implements android.os.Parcelable { method public java.util.List<android.app.RemoteAction> getActions(); method public float getAspectRatio(); method @Nullable public android.app.RemoteAction getCloseAction(); method public float getExpandedAspectRatio(); method public android.graphics.Rect getSourceRectHint(); method @Nullable public CharSequence getSubtitle(); Loading core/java/android/app/PictureInPictureParams.java +67 −9 Original line number Diff line number Diff line Loading @@ -50,6 +50,9 @@ public final class PictureInPictureParams implements Parcelable { @Nullable private List<RemoteAction> mUserActions; @Nullable private RemoteAction mCloseAction; @Nullable private Rect mSourceRectHint; Loading Loading @@ -113,6 +116,25 @@ public final class PictureInPictureParams implements Parcelable { return this; } /** * Sets a close action that should be invoked before the default close PiP action. The * custom action must close the activity quickly using {@link Activity#finish()}. * Otherwise, the system will forcibly close the PiP as if no custom close action was * provided. * * If the action matches one set via {@link PictureInPictureParams.Builder#setActions(List)} * it may be shown in place of that custom action in the menu. * * @param action to replace the system close action * @return this builder instance. * @see RemoteAction */ @NonNull public Builder setCloseAction(@Nullable RemoteAction action) { mCloseAction = action; return this; } /** * Sets the source bounds hint. These bounds are only used when an activity first enters * picture-in-picture, and describe the bounds in window coordinates of activity entering Loading Loading @@ -209,8 +231,8 @@ public final class PictureInPictureParams implements Parcelable { */ public PictureInPictureParams build() { PictureInPictureParams params = new PictureInPictureParams(mAspectRatio, mExpandedAspectRatio, mUserActions, mSourceRectHint, mAutoEnterEnabled, mSeamlessResizeEnabled, mTitle, mSubtitle); mExpandedAspectRatio, mUserActions, mCloseAction, mSourceRectHint, mAutoEnterEnabled, mSeamlessResizeEnabled, mTitle, mSubtitle); return params; } } Loading @@ -233,6 +255,12 @@ public final class PictureInPictureParams implements Parcelable { @Nullable private List<RemoteAction> mUserActions; /** * Action to replace the system close action. */ @Nullable private RemoteAction mCloseAction; /** * The source bounds hint used when entering picture-in-picture, relative to the window bounds. * We can use this internally for the transition into picture-in-picture to ensure that a Loading Loading @@ -278,6 +306,7 @@ public final class PictureInPictureParams implements Parcelable { mUserActions = new ArrayList<>(); in.readTypedList(mUserActions, RemoteAction.CREATOR); } mCloseAction = in.readTypedObject(RemoteAction.CREATOR); if (in.readInt() != 0) { mSourceRectHint = Rect.CREATOR.createFromParcel(in); } Loading @@ -297,11 +326,13 @@ public final class PictureInPictureParams implements Parcelable { /** {@hide} */ PictureInPictureParams(Rational aspectRatio, Rational expandedAspectRatio, List<RemoteAction> actions, Rect sourceRectHint, Boolean autoEnterEnabled, Boolean seamlessResizeEnabled, CharSequence title, CharSequence subtitle) { List<RemoteAction> actions, RemoteAction closeAction, Rect sourceRectHint, Boolean autoEnterEnabled, Boolean seamlessResizeEnabled, CharSequence title, CharSequence subtitle) { mAspectRatio = aspectRatio; mExpandedAspectRatio = expandedAspectRatio; mUserActions = actions; mCloseAction = closeAction; mSourceRectHint = sourceRectHint; mAutoEnterEnabled = autoEnterEnabled; mSeamlessResizeEnabled = seamlessResizeEnabled; Loading @@ -314,7 +345,7 @@ public final class PictureInPictureParams implements Parcelable { * @hide */ public PictureInPictureParams(PictureInPictureParams other) { this(other.mAspectRatio, other.mExpandedAspectRatio, other.mUserActions, this(other.mAspectRatio, other.mExpandedAspectRatio, other.mUserActions, other.mCloseAction, other.hasSourceBoundsHint() ? new Rect(other.getSourceRectHint()) : null, other.mAutoEnterEnabled, other.mSeamlessResizeEnabled, other.mTitle, other.mSubtitle); Loading @@ -335,6 +366,9 @@ public final class PictureInPictureParams implements Parcelable { if (otherArgs.hasSetActions()) { mUserActions = otherArgs.mUserActions; } if (otherArgs.hasSetCloseAction()) { mCloseAction = otherArgs.mCloseAction; } if (otherArgs.hasSourceBoundsHint()) { mSourceRectHint = new Rect(otherArgs.getSourceRectHint()); } Loading Loading @@ -414,8 +448,27 @@ public final class PictureInPictureParams implements Parcelable { return mUserActions != null; } /** * @return the close action. * @hide */ @TestApi @Nullable public RemoteAction getCloseAction() { return mCloseAction; } /** * @return whether the close action was set. * @hide */ public boolean hasSetCloseAction() { return mCloseAction != null; } /** * Truncates the set of actions to the given {@param size}. * * @hide */ public void truncateActions(int size) { Loading Loading @@ -499,8 +552,8 @@ public final class PictureInPictureParams implements Parcelable { * @hide */ public boolean empty() { return !hasSourceBoundsHint() && !hasSetActions() && !hasSetAspectRatio() && !hasSetExpandedAspectRatio() && mAutoEnterEnabled != null return !hasSourceBoundsHint() && !hasSetActions() && !hasSetCloseAction() && !hasSetAspectRatio() && !hasSetExpandedAspectRatio() && mAutoEnterEnabled != null && mSeamlessResizeEnabled != null && !hasSetTitle() && !hasSetSubtitle(); } Loading @@ -515,6 +568,7 @@ public final class PictureInPictureParams implements Parcelable { && Objects.equals(mAspectRatio, that.mAspectRatio) && Objects.equals(mExpandedAspectRatio, that.mExpandedAspectRatio) && Objects.equals(mUserActions, that.mUserActions) && Objects.equals(mCloseAction, that.mCloseAction) && Objects.equals(mSourceRectHint, that.mSourceRectHint) && Objects.equals(mTitle, that.mTitle) && Objects.equals(mSubtitle, that.mSubtitle); Loading @@ -522,8 +576,8 @@ public final class PictureInPictureParams implements Parcelable { @Override public int hashCode() { return Objects.hash(mAspectRatio, mExpandedAspectRatio, mUserActions, mSourceRectHint, mAutoEnterEnabled, mSeamlessResizeEnabled, mTitle, mSubtitle); return Objects.hash(mAspectRatio, mExpandedAspectRatio, mUserActions, mCloseAction, mSourceRectHint, mAutoEnterEnabled, mSeamlessResizeEnabled, mTitle, mSubtitle); } @Override Loading @@ -541,6 +595,9 @@ public final class PictureInPictureParams implements Parcelable { } else { out.writeInt(0); } out.writeTypedObject(mCloseAction, 0); if (mSourceRectHint != null) { out.writeInt(1); mSourceRectHint.writeToParcel(out, 0); Loading Loading @@ -597,6 +654,7 @@ public final class PictureInPictureParams implements Parcelable { + " expandedAspectRatio=" + mExpandedAspectRatio + " sourceRectHint=" + getSourceRectHint() + " hasSetActions=" + hasSetActions() + " hasSetCloseAction=" + hasSetCloseAction() + " isAutoPipEnabled=" + isAutoEnterEnabled() + " isSeamlessResizeEnabled=" + isSeamlessResizeEnabled() + " title=" + getTitle() Loading Loading
core/api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -6639,6 +6639,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 setCloseAction(@Nullable android.app.RemoteAction); method @NonNull public android.app.PictureInPictureParams.Builder setExpandedAspectRatio(@Nullable android.util.Rational); 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 @@ -357,6 +357,7 @@ package android.app { public final class PictureInPictureParams implements android.os.Parcelable { method public java.util.List<android.app.RemoteAction> getActions(); method public float getAspectRatio(); method @Nullable public android.app.RemoteAction getCloseAction(); method public float getExpandedAspectRatio(); method public android.graphics.Rect getSourceRectHint(); method @Nullable public CharSequence getSubtitle(); Loading
core/java/android/app/PictureInPictureParams.java +67 −9 Original line number Diff line number Diff line Loading @@ -50,6 +50,9 @@ public final class PictureInPictureParams implements Parcelable { @Nullable private List<RemoteAction> mUserActions; @Nullable private RemoteAction mCloseAction; @Nullable private Rect mSourceRectHint; Loading Loading @@ -113,6 +116,25 @@ public final class PictureInPictureParams implements Parcelable { return this; } /** * Sets a close action that should be invoked before the default close PiP action. The * custom action must close the activity quickly using {@link Activity#finish()}. * Otherwise, the system will forcibly close the PiP as if no custom close action was * provided. * * If the action matches one set via {@link PictureInPictureParams.Builder#setActions(List)} * it may be shown in place of that custom action in the menu. * * @param action to replace the system close action * @return this builder instance. * @see RemoteAction */ @NonNull public Builder setCloseAction(@Nullable RemoteAction action) { mCloseAction = action; return this; } /** * Sets the source bounds hint. These bounds are only used when an activity first enters * picture-in-picture, and describe the bounds in window coordinates of activity entering Loading Loading @@ -209,8 +231,8 @@ public final class PictureInPictureParams implements Parcelable { */ public PictureInPictureParams build() { PictureInPictureParams params = new PictureInPictureParams(mAspectRatio, mExpandedAspectRatio, mUserActions, mSourceRectHint, mAutoEnterEnabled, mSeamlessResizeEnabled, mTitle, mSubtitle); mExpandedAspectRatio, mUserActions, mCloseAction, mSourceRectHint, mAutoEnterEnabled, mSeamlessResizeEnabled, mTitle, mSubtitle); return params; } } Loading @@ -233,6 +255,12 @@ public final class PictureInPictureParams implements Parcelable { @Nullable private List<RemoteAction> mUserActions; /** * Action to replace the system close action. */ @Nullable private RemoteAction mCloseAction; /** * The source bounds hint used when entering picture-in-picture, relative to the window bounds. * We can use this internally for the transition into picture-in-picture to ensure that a Loading Loading @@ -278,6 +306,7 @@ public final class PictureInPictureParams implements Parcelable { mUserActions = new ArrayList<>(); in.readTypedList(mUserActions, RemoteAction.CREATOR); } mCloseAction = in.readTypedObject(RemoteAction.CREATOR); if (in.readInt() != 0) { mSourceRectHint = Rect.CREATOR.createFromParcel(in); } Loading @@ -297,11 +326,13 @@ public final class PictureInPictureParams implements Parcelable { /** {@hide} */ PictureInPictureParams(Rational aspectRatio, Rational expandedAspectRatio, List<RemoteAction> actions, Rect sourceRectHint, Boolean autoEnterEnabled, Boolean seamlessResizeEnabled, CharSequence title, CharSequence subtitle) { List<RemoteAction> actions, RemoteAction closeAction, Rect sourceRectHint, Boolean autoEnterEnabled, Boolean seamlessResizeEnabled, CharSequence title, CharSequence subtitle) { mAspectRatio = aspectRatio; mExpandedAspectRatio = expandedAspectRatio; mUserActions = actions; mCloseAction = closeAction; mSourceRectHint = sourceRectHint; mAutoEnterEnabled = autoEnterEnabled; mSeamlessResizeEnabled = seamlessResizeEnabled; Loading @@ -314,7 +345,7 @@ public final class PictureInPictureParams implements Parcelable { * @hide */ public PictureInPictureParams(PictureInPictureParams other) { this(other.mAspectRatio, other.mExpandedAspectRatio, other.mUserActions, this(other.mAspectRatio, other.mExpandedAspectRatio, other.mUserActions, other.mCloseAction, other.hasSourceBoundsHint() ? new Rect(other.getSourceRectHint()) : null, other.mAutoEnterEnabled, other.mSeamlessResizeEnabled, other.mTitle, other.mSubtitle); Loading @@ -335,6 +366,9 @@ public final class PictureInPictureParams implements Parcelable { if (otherArgs.hasSetActions()) { mUserActions = otherArgs.mUserActions; } if (otherArgs.hasSetCloseAction()) { mCloseAction = otherArgs.mCloseAction; } if (otherArgs.hasSourceBoundsHint()) { mSourceRectHint = new Rect(otherArgs.getSourceRectHint()); } Loading Loading @@ -414,8 +448,27 @@ public final class PictureInPictureParams implements Parcelable { return mUserActions != null; } /** * @return the close action. * @hide */ @TestApi @Nullable public RemoteAction getCloseAction() { return mCloseAction; } /** * @return whether the close action was set. * @hide */ public boolean hasSetCloseAction() { return mCloseAction != null; } /** * Truncates the set of actions to the given {@param size}. * * @hide */ public void truncateActions(int size) { Loading Loading @@ -499,8 +552,8 @@ public final class PictureInPictureParams implements Parcelable { * @hide */ public boolean empty() { return !hasSourceBoundsHint() && !hasSetActions() && !hasSetAspectRatio() && !hasSetExpandedAspectRatio() && mAutoEnterEnabled != null return !hasSourceBoundsHint() && !hasSetActions() && !hasSetCloseAction() && !hasSetAspectRatio() && !hasSetExpandedAspectRatio() && mAutoEnterEnabled != null && mSeamlessResizeEnabled != null && !hasSetTitle() && !hasSetSubtitle(); } Loading @@ -515,6 +568,7 @@ public final class PictureInPictureParams implements Parcelable { && Objects.equals(mAspectRatio, that.mAspectRatio) && Objects.equals(mExpandedAspectRatio, that.mExpandedAspectRatio) && Objects.equals(mUserActions, that.mUserActions) && Objects.equals(mCloseAction, that.mCloseAction) && Objects.equals(mSourceRectHint, that.mSourceRectHint) && Objects.equals(mTitle, that.mTitle) && Objects.equals(mSubtitle, that.mSubtitle); Loading @@ -522,8 +576,8 @@ public final class PictureInPictureParams implements Parcelable { @Override public int hashCode() { return Objects.hash(mAspectRatio, mExpandedAspectRatio, mUserActions, mSourceRectHint, mAutoEnterEnabled, mSeamlessResizeEnabled, mTitle, mSubtitle); return Objects.hash(mAspectRatio, mExpandedAspectRatio, mUserActions, mCloseAction, mSourceRectHint, mAutoEnterEnabled, mSeamlessResizeEnabled, mTitle, mSubtitle); } @Override Loading @@ -541,6 +595,9 @@ public final class PictureInPictureParams implements Parcelable { } else { out.writeInt(0); } out.writeTypedObject(mCloseAction, 0); if (mSourceRectHint != null) { out.writeInt(1); mSourceRectHint.writeToParcel(out, 0); Loading Loading @@ -597,6 +654,7 @@ public final class PictureInPictureParams implements Parcelable { + " expandedAspectRatio=" + mExpandedAspectRatio + " sourceRectHint=" + getSourceRectHint() + " hasSetActions=" + hasSetActions() + " hasSetCloseAction=" + hasSetCloseAction() + " isAutoPipEnabled=" + isAutoEnterEnabled() + " isSeamlessResizeEnabled=" + isSeamlessResizeEnabled() + " title=" + getTitle() Loading