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

Commit 318397b0 authored by jorgegil@google.com's avatar jorgegil@google.com
Browse files

Rename autoEnterAllowed to autoEnterEnabled

Bug: 167621602
Test: atest PinnedStackTests#testAutoPipAllowedBypassesExplicitEnterPip

Change-Id: I6e92c138c49b55f8641950bc9c45dd4631d62ee8
parent 9db72481
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -6188,7 +6188,7 @@ package android.app {
    method public android.app.PictureInPictureParams build();
    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 setAutoEnterAllowed(boolean);
    method @NonNull public android.app.PictureInPictureParams.Builder setAutoEnterEnabled(boolean);
    method public android.app.PictureInPictureParams.Builder setSourceRectHint(android.graphics.Rect);
  }
+18 −18
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ public final class PictureInPictureParams implements Parcelable {
        @Nullable
        private Rect mSourceRectHint;

        private boolean mAutoEnterAllowed;
        private boolean mAutoEnterEnabled;

        /**
         * Sets the aspect ratio.  This aspect ratio is defined as the desired width / height, and
@@ -106,21 +106,21 @@ public final class PictureInPictureParams implements Parcelable {
        }

        /**
         * Sets whether the system is allowed to automatically put the activity in
         * picture-in-picture mode without needing/waiting for the activity to call
         * Sets whether the system will automatically put the activity in picture-in-picture mode
         * without needing/waiting for the activity to call
         * {@link Activity#enterPictureInPictureMode(PictureInPictureParams)}.
         *
         * If true, {@link Activity#onPictureInPictureRequested()} will never be called.
         *
         * This property is false by default.
         * @param autoEnterAllowed {@code true} if the system is allowed to automatically put the
         *                                  activity in picture-in-picture mode.
         * @param autoEnterEnabled {@code true} if the system will automatically put the activity
         *                                     in picture-in-picture mode.
         *
         * @return this builder instance.
         */
        @NonNull
        public Builder setAutoEnterAllowed(boolean autoEnterAllowed) {
            mAutoEnterAllowed = autoEnterAllowed;
        public Builder setAutoEnterEnabled(boolean autoEnterEnabled) {
            mAutoEnterEnabled = autoEnterEnabled;
            return this;
        }

@@ -133,7 +133,7 @@ public final class PictureInPictureParams implements Parcelable {
         */
        public PictureInPictureParams build() {
            PictureInPictureParams params = new PictureInPictureParams(mAspectRatio, mUserActions,
                    mSourceRectHint, mAutoEnterAllowed);
                    mSourceRectHint, mAutoEnterEnabled);
            return params;
        }
    }
@@ -161,7 +161,7 @@ public final class PictureInPictureParams implements Parcelable {
    /**
     * Whether the system is allowed to automatically put the activity in picture-in-picture mode.
     */
    private boolean mAutoEnterAllowed;
    private boolean mAutoEnterEnabled;

    /** {@hide} */
    PictureInPictureParams() {
@@ -180,17 +180,17 @@ public final class PictureInPictureParams implements Parcelable {
            mSourceRectHint = Rect.CREATOR.createFromParcel(in);
        }
        if (in.readInt() != 0) {
            mAutoEnterAllowed = in.readBoolean();
            mAutoEnterEnabled = in.readBoolean();
        }
    }

    /** {@hide} */
    PictureInPictureParams(Rational aspectRatio, List<RemoteAction> actions,
            Rect sourceRectHint, boolean autoEnterAllowed) {
            Rect sourceRectHint, boolean autoEnterEnabled) {
        mAspectRatio = aspectRatio;
        mUserActions = actions;
        mSourceRectHint = sourceRectHint;
        mAutoEnterAllowed = autoEnterAllowed;
        mAutoEnterEnabled = autoEnterEnabled;
    }

    /**
@@ -207,7 +207,7 @@ public final class PictureInPictureParams implements Parcelable {
        if (otherArgs.hasSourceBoundsHint()) {
            mSourceRectHint = new Rect(otherArgs.getSourceRectHint());
        }
        mAutoEnterAllowed = otherArgs.mAutoEnterAllowed;
        mAutoEnterEnabled = otherArgs.mAutoEnterEnabled;
    }

    /**
@@ -280,11 +280,11 @@ public final class PictureInPictureParams implements Parcelable {
    }

    /**
     * @return whether auto pip allowed.
     * @return whether auto pip is enabled.
     * @hide
     */
    public boolean isAutoEnterAllowed() {
        return mAutoEnterAllowed;
    public boolean isAutoEnterEnabled() {
        return mAutoEnterEnabled;
    }

    /**
@@ -293,7 +293,7 @@ public final class PictureInPictureParams implements Parcelable {
     */
    public boolean empty() {
        return !hasSourceBoundsHint() && !hasSetActions() && !hasSetAspectRatio()
                && !mAutoEnterAllowed;
                && !mAutoEnterEnabled;
    }

    @Override
@@ -323,7 +323,7 @@ public final class PictureInPictureParams implements Parcelable {
            out.writeInt(0);
        }
        out.writeInt(1);
        out.writeBoolean(mAutoEnterAllowed);
        out.writeBoolean(mAutoEnterEnabled);
    }

    public static final @android.annotation.NonNull Creator<PictureInPictureParams> CREATOR =
+1 −1
Original line number Diff line number Diff line
@@ -316,7 +316,7 @@ message ActivityRecordProto {
    optional bool front_of_task = 28;
    optional int32 proc_id = 29;
    optional bool translucent = 30;
    optional bool pip_auto_enter_allowed = 31;
    optional bool pip_auto_enter_enabled = 31;
}

/* represents WindowToken */
+1 −1
Original line number Diff line number Diff line
@@ -6188,7 +6188,7 @@ package android.app {
    method public android.app.PictureInPictureParams build();
    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 setAutoEnterAllowed(boolean);
    method @NonNull public android.app.PictureInPictureParams.Builder setAutoEnterEnabled(boolean);
    method public android.app.PictureInPictureParams.Builder setSourceRectHint(android.graphics.Rect);
  }
+3 −3
Original line number Diff line number Diff line
@@ -129,7 +129,7 @@ import static com.android.server.wm.ActivityRecordProto.LAST_SURFACE_SHOWING;
import static com.android.server.wm.ActivityRecordProto.NAME;
import static com.android.server.wm.ActivityRecordProto.NUM_DRAWN_WINDOWS;
import static com.android.server.wm.ActivityRecordProto.NUM_INTERESTING_WINDOWS;
import static com.android.server.wm.ActivityRecordProto.PIP_AUTO_ENTER_ALLOWED;
import static com.android.server.wm.ActivityRecordProto.PIP_AUTO_ENTER_ENABLED;
import static com.android.server.wm.ActivityRecordProto.PROC_ID;
import static com.android.server.wm.ActivityRecordProto.REPORTED_DRAWN;
import static com.android.server.wm.ActivityRecordProto.REPORTED_VISIBLE;
@@ -4750,7 +4750,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            // returns. Just need to confirm this reasoning makes sense.
            final boolean deferHidingClient = canEnterPictureInPicture
                    && !isState(STARTED, STOPPING, STOPPED, PAUSED);
            if (deferHidingClient && pictureInPictureArgs.isAutoEnterAllowed()) {
            if (deferHidingClient && pictureInPictureArgs.isAutoEnterEnabled()) {
                // Go ahead and just put the activity in pip if it supports auto-pip.
                mAtmService.enterPictureInPictureMode(this, pictureInPictureArgs);
                return;
@@ -7705,7 +7705,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        if (hasProcess()) {
            proto.write(PROC_ID, app.getPid());
        }
        proto.write(PIP_AUTO_ENTER_ALLOWED, pictureInPictureArgs.isAutoEnterAllowed());
        proto.write(PIP_AUTO_ENTER_ENABLED, pictureInPictureArgs.isAutoEnterEnabled());
    }

    @Override
Loading