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

Commit 50becbcd authored by Jin Seok Park's avatar Jin Seok Park
Browse files

Move Session2Command result codes into Result class

Bug: 128459284
Test: update-api
Change-Id: I01167fb81724432462f78233d45abc9c3a8e641f
parent 2b11e525
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -26383,15 +26383,15 @@ package android.media {
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field public static final int COMMAND_CODE_CUSTOM = 0; // 0x0
    field @NonNull public static final android.os.Parcelable.Creator<android.media.Session2Command> CREATOR;
    field public static final int RESULT_ERROR_UNKNOWN_ERROR = -1; // 0xffffffff
    field public static final int RESULT_INFO_SKIPPED = 1; // 0x1
    field public static final int RESULT_SUCCESS = 0; // 0x0
  }
  public static final class Session2Command.Result {
    ctor public Session2Command.Result(int, @Nullable android.os.Bundle);
    method public int getResultCode();
    method @Nullable public android.os.Bundle getResultData();
    field public static final int RESULT_ERROR_UNKNOWN_ERROR = -1; // 0xffffffff
    field public static final int RESULT_INFO_SKIPPED = 1; // 0x1
    field public static final int RESULT_SUCCESS = 0; // 0x0
  }
  public final class Session2CommandGroup implements android.os.Parcelable {
+3 −3
Original line number Diff line number Diff line
@@ -22,8 +22,8 @@ import static android.media.MediaConstants.KEY_PID;
import static android.media.MediaConstants.KEY_PLAYBACK_ACTIVE;
import static android.media.MediaConstants.KEY_SESSION2LINK;
import static android.media.MediaConstants.KEY_TOKEN_EXTRAS;
import static android.media.Session2Command.RESULT_ERROR_UNKNOWN_ERROR;
import static android.media.Session2Command.RESULT_INFO_SKIPPED;
import static android.media.Session2Command.Result.RESULT_ERROR_UNKNOWN_ERROR;
import static android.media.Session2Command.Result.RESULT_INFO_SKIPPED;
import static android.media.Session2Token.TYPE_SESSION;

import android.annotation.NonNull;
@@ -329,7 +329,7 @@ public class MediaController2 implements AutoCloseable {
                    MediaController2.this, command, args);
            if (resultReceiver != null) {
                if (result == null) {
                    resultReceiver.send(Session2Command.RESULT_INFO_SKIPPED, null);
                    resultReceiver.send(RESULT_INFO_SKIPPED, null);
                } else {
                    resultReceiver.send(result.getResultCode(), result.getResultData());
                }
+3 −3
Original line number Diff line number Diff line
@@ -22,8 +22,8 @@ import static android.media.MediaConstants.KEY_PID;
import static android.media.MediaConstants.KEY_PLAYBACK_ACTIVE;
import static android.media.MediaConstants.KEY_SESSION2LINK;
import static android.media.MediaConstants.KEY_TOKEN_EXTRAS;
import static android.media.Session2Command.RESULT_ERROR_UNKNOWN_ERROR;
import static android.media.Session2Command.RESULT_INFO_SKIPPED;
import static android.media.Session2Command.Result.RESULT_ERROR_UNKNOWN_ERROR;
import static android.media.Session2Command.Result.RESULT_INFO_SKIPPED;
import static android.media.Session2Token.TYPE_SESSION;

import android.annotation.NonNull;
@@ -415,7 +415,7 @@ public class MediaSession2 implements AutoCloseable {
                    MediaSession2.this, controllerInfo, command, args);
            if (resultReceiver != null) {
                if (result == null) {
                    resultReceiver.send(Session2Command.RESULT_INFO_SKIPPED, null);
                    resultReceiver.send(RESULT_INFO_SKIPPED, null);
                } else {
                    resultReceiver.send(result.getResultCode(), result.getResultData());
                }
+16 −16
Original line number Diff line number Diff line
@@ -48,22 +48,6 @@ public final class Session2Command implements Parcelable {
     */
    public static final int COMMAND_CODE_CUSTOM = 0;

    /**
     * Result code representing that the command is skipped or canceled. For an example, a seek
     * command can be skipped if it is followed by another seek command.
     */
    public static final int RESULT_INFO_SKIPPED = 1;

    /**
     * Result code representing that the command is successfully completed.
     */
    public static final int RESULT_SUCCESS = 0;

    /**
     * Result code represents that call is ended with an unknown error.
     */
    public static final int RESULT_ERROR_UNKNOWN_ERROR = -1;

    public static final @android.annotation.NonNull Parcelable.Creator<Session2Command> CREATOR =
            new Parcelable.Creator<Session2Command>() {
                @Override
@@ -184,6 +168,22 @@ public final class Session2Command implements Parcelable {
        private final int mResultCode;
        private final Bundle mResultData;

        /**
         * Result code representing that the command is skipped or canceled. For an example, a seek
         * command can be skipped if it is followed by another seek command.
         */
        public static final int RESULT_INFO_SKIPPED = 1;

        /**
         * Result code representing that the command is successfully completed.
         */
        public static final int RESULT_SUCCESS = 0;

        /**
         * Result code represents that call is ended with an unknown error.
         */
        public static final int RESULT_ERROR_UNKNOWN_ERROR = -1;

        /**
         * Constructor of {@link Result}.
         *