Merge "Rename Session2Command methods" into qt-dev

This commit is contained in:
Jin Seok Park
2019-04-16 06:47:18 +00:00
committed by Android (Google) Code Review
2 changed files with 19 additions and 19 deletions

View File

@@ -26158,8 +26158,8 @@ package android.media {
ctor public Session2Command(@NonNull String, @Nullable android.os.Bundle); ctor public Session2Command(@NonNull String, @Nullable android.os.Bundle);
method public int describeContents(); method public int describeContents();
method public int getCommandCode(); method public int getCommandCode();
method @Nullable public String getCustomCommand(); method @Nullable public String getCustomAction();
method @Nullable public android.os.Bundle getExtras(); method @Nullable public android.os.Bundle getCustomExtras();
method public void writeToParcel(@NonNull android.os.Parcel, int); method public void writeToParcel(@NonNull android.os.Parcel, int);
field public static final int COMMAND_CODE_CUSTOM = 0; // 0x0 field public static final int COMMAND_CODE_CUSTOM = 0; // 0x0
field @NonNull public static final android.os.Parcelable.Creator<android.media.Session2Command> CREATOR; field @NonNull public static final android.os.Parcelable.Creator<android.media.Session2Command> CREATOR;

View File

@@ -30,7 +30,7 @@ import java.util.Objects;
* <p> * <p>
* If {@link #getCommandCode()} isn't {@link #COMMAND_CODE_CUSTOM}), it's predefined command. * If {@link #getCommandCode()} isn't {@link #COMMAND_CODE_CUSTOM}), it's predefined command.
* If {@link #getCommandCode()} is {@link #COMMAND_CODE_CUSTOM}), it's custom command and * If {@link #getCommandCode()} is {@link #COMMAND_CODE_CUSTOM}), it's custom command and
* {@link #getCustomCommand()} shouldn't be {@code null}. * {@link #getCustomAction()} shouldn't be {@code null}.
* <p> * <p>
* Refer to the * Refer to the
* <a href="{@docRoot}reference/androidx/media2/SessionCommand2.html">AndroidX SessionCommand</a> * <a href="{@docRoot}reference/androidx/media2/SessionCommand2.html">AndroidX SessionCommand</a>
@@ -63,8 +63,8 @@ public final class Session2Command implements Parcelable {
private final int mCommandCode; private final int mCommandCode;
// Nonnull if it's custom command // Nonnull if it's custom command
private final String mCustomCommand; private final String mCustomAction;
private final Bundle mExtras; private final Bundle mCustomExtras;
/** /**
* Constructor for creating a command predefined in AndroidX media2. * Constructor for creating a command predefined in AndroidX media2.
@@ -76,8 +76,8 @@ public final class Session2Command implements Parcelable {
throw new IllegalArgumentException("commandCode shouldn't be COMMAND_CODE_CUSTOM"); throw new IllegalArgumentException("commandCode shouldn't be COMMAND_CODE_CUSTOM");
} }
mCommandCode = commandCode; mCommandCode = commandCode;
mCustomCommand = null; mCustomAction = null;
mExtras = null; mCustomExtras = null;
} }
/** /**
@@ -91,8 +91,8 @@ public final class Session2Command implements Parcelable {
throw new IllegalArgumentException("action shouldn't be null"); throw new IllegalArgumentException("action shouldn't be null");
} }
mCommandCode = COMMAND_CODE_CUSTOM; mCommandCode = COMMAND_CODE_CUSTOM;
mCustomCommand = action; mCustomAction = action;
mExtras = extras; mCustomExtras = extras;
} }
/** /**
@@ -101,8 +101,8 @@ public final class Session2Command implements Parcelable {
@SuppressWarnings("WeakerAccess") /* synthetic access */ @SuppressWarnings("WeakerAccess") /* synthetic access */
Session2Command(Parcel in) { Session2Command(Parcel in) {
mCommandCode = in.readInt(); mCommandCode = in.readInt();
mCustomCommand = in.readString(); mCustomAction = in.readString();
mExtras = in.readBundle(); mCustomExtras = in.readBundle();
} }
/** /**
@@ -118,8 +118,8 @@ public final class Session2Command implements Parcelable {
* This will return {@code null} for a predefined command. * This will return {@code null} for a predefined command.
*/ */
@Nullable @Nullable
public String getCustomCommand() { public String getCustomAction() {
return mCustomCommand; return mCustomAction;
} }
/** /**
@@ -127,8 +127,8 @@ public final class Session2Command implements Parcelable {
* This will return {@code null} for a predefined command. * This will return {@code null} for a predefined command.
*/ */
@Nullable @Nullable
public Bundle getExtras() { public Bundle getCustomExtras() {
return mExtras; return mCustomExtras;
} }
@Override @Override
@@ -142,8 +142,8 @@ public final class Session2Command implements Parcelable {
throw new IllegalArgumentException("parcel shouldn't be null"); throw new IllegalArgumentException("parcel shouldn't be null");
} }
dest.writeInt(mCommandCode); dest.writeInt(mCommandCode);
dest.writeString(mCustomCommand); dest.writeString(mCustomAction);
dest.writeBundle(mExtras); dest.writeBundle(mCustomExtras);
} }
@Override @Override
@@ -153,12 +153,12 @@ public final class Session2Command implements Parcelable {
} }
Session2Command other = (Session2Command) obj; Session2Command other = (Session2Command) obj;
return mCommandCode == other.mCommandCode return mCommandCode == other.mCommandCode
&& TextUtils.equals(mCustomCommand, other.mCustomCommand); && TextUtils.equals(mCustomAction, other.mCustomAction);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(mCustomCommand, mCommandCode); return Objects.hash(mCustomAction, mCommandCode);
} }
/** /**