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

Commit 8fac2df8 authored by Garfield Tan's avatar Garfield Tan Committed by Android (Google) Code Review
Browse files

Merge "Use equals() to check equality of PictureInPictureParams."

parents cd281370 c5bb4395
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.util.Rational;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * Represents a set of parameters used to initialize and update an Activity in picture-in-picture
@@ -193,6 +194,16 @@ public final class PictureInPictureParams implements Parcelable {
        mAutoEnterEnabled = autoEnterEnabled;
    }

    /**
     * Makes a copy from the other picture-in-picture args.
     * @hide
     */
    public PictureInPictureParams(PictureInPictureParams other) {
        this(other.mAspectRatio, other.mUserActions,
                other.hasSourceBoundsHint() ? new Rect(other.getSourceRectHint()) : null,
                other.mAutoEnterEnabled);
    }

    /**
     * Copies the set parameters from the other picture-in-picture args.
     * @hide
@@ -296,6 +307,22 @@ public final class PictureInPictureParams implements Parcelable {
                && !mAutoEnterEnabled;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof PictureInPictureParams)) return false;
        PictureInPictureParams that = (PictureInPictureParams) o;
        return mAutoEnterEnabled == that.mAutoEnterEnabled
                && Objects.equals(mAspectRatio, that.mAspectRatio)
                && Objects.equals(mUserActions, that.mUserActions)
                && Objects.equals(mSourceRectHint, that.mSourceRectHint);
    }

    @Override
    public int hashCode() {
        return Objects.hash(mAspectRatio, mUserActions, mSourceRectHint, mAutoEnterEnabled);
    }

    @Override
    public int describeContents() {
        return 0;
+20 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.os.Parcelable;
import android.text.TextUtils;

import java.io.PrintWriter;
import java.util.Objects;

/**
 * Represents a remote action that can be called from another process.  The action can have an
@@ -126,6 +127,25 @@ public final class RemoteAction implements Parcelable {
        return action;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof RemoteAction)) return false;
        RemoteAction that = (RemoteAction) o;
        return mEnabled == that.mEnabled
                && mShouldShowIcon == that.mShouldShowIcon
                && mIcon.equals(that.mIcon)
                && mTitle.equals(that.mTitle)
                && mContentDescription.equals(that.mContentDescription)
                && mActionIntent.equals(that.mActionIntent);
    }

    @Override
    public int hashCode() {
        return Objects.hash(mIcon, mTitle, mContentDescription, mActionIntent, mEnabled,
                mShouldShowIcon);
    }

    @Override
    public int describeContents() {
        return 0;
+1 −1
Original line number Diff line number Diff line
@@ -313,7 +313,7 @@ public class TaskInfo {
                && isResizeable == that.isResizeable
                && Objects.equals(positionInParent, that.positionInParent)
                && equalsLetterboxParams(that)
                && pictureInPictureParams == that.pictureInPictureParams
                && Objects.equals(pictureInPictureParams, that.pictureInPictureParams)
                && getWindowingMode() == that.getWindowingMode()
                && Objects.equals(taskDescription, that.taskDescription)
                && isFocused == that.isFocused
+1 −2
Original line number Diff line number Diff line
@@ -224,7 +224,6 @@ import com.android.server.uri.NeededUriGrants;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlSerializer;

import java.io.FileDescriptor;
import java.io.IOException;
@@ -4108,7 +4107,7 @@ class Task extends WindowContainer<WindowContainer> {
        if (top == null) return null;
        final ActivityRecord rootActivity = top.getRootActivity();
        return (rootActivity == null || rootActivity.pictureInPictureArgs.empty())
                ? null : rootActivity.pictureInPictureArgs;
                ? null : new PictureInPictureParams(rootActivity.pictureInPictureArgs);
    }

    void maybeUpdateLetterboxBounds(