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

Commit 53f5867f authored by Robert Shih's avatar Robert Shih Committed by Automerger Merge Worker
Browse files

Merge "MediaDrm: error detail apis" am: 854155d3 am: cdba3c36

parents 912ecdc4 cdba3c36
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -21304,7 +21304,7 @@ package android.media {
    field public static final int ERROR_RECLAIMED = 1101; // 0x44d
  }
  public static final class MediaCodec.CryptoException extends java.lang.RuntimeException {
  public static final class MediaCodec.CryptoException extends java.lang.RuntimeException implements android.media.MediaDrmThrowable {
    ctor public MediaCodec.CryptoException(int, @Nullable String);
    method public int getErrorCode();
    field @Deprecated public static final int ERROR_FRAME_TOO_LARGE = 8; // 0x8
@@ -21804,7 +21804,7 @@ package android.media {
    method public void setMediaDrmSession(@NonNull byte[]) throws android.media.MediaCryptoException;
  }
  public final class MediaCryptoException extends java.lang.Exception {
  public final class MediaCryptoException extends java.lang.Exception implements android.media.MediaDrmThrowable {
    ctor public MediaCryptoException(@Nullable String);
  }
@@ -22027,7 +22027,7 @@ package android.media {
    method public long getTimestampMillis();
  }
  public static final class MediaDrm.MediaDrmStateException extends java.lang.IllegalStateException {
  public static final class MediaDrm.MediaDrmStateException extends java.lang.IllegalStateException implements android.media.MediaDrmThrowable {
    method @NonNull public String getDiagnosticInfo();
    method public int getErrorCode();
    method public boolean isTransient();
@@ -22100,7 +22100,7 @@ package android.media {
  @Deprecated @IntDef({android.media.MediaDrm.SECURITY_LEVEL_UNKNOWN, android.media.MediaDrm.SECURITY_LEVEL_SW_SECURE_CRYPTO, android.media.MediaDrm.SECURITY_LEVEL_SW_SECURE_DECODE, android.media.MediaDrm.SECURITY_LEVEL_HW_SECURE_CRYPTO, android.media.MediaDrm.SECURITY_LEVEL_HW_SECURE_DECODE, android.media.MediaDrm.SECURITY_LEVEL_HW_SECURE_ALL}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface MediaDrm.SecurityLevel {
  }
  public static final class MediaDrm.SessionException extends java.lang.RuntimeException {
  public static final class MediaDrm.SessionException extends java.lang.RuntimeException implements android.media.MediaDrmThrowable {
    ctor public MediaDrm.SessionException(int, @Nullable String);
    method @Deprecated public int getErrorCode();
    method public boolean isTransient();
@@ -22108,14 +22108,20 @@ package android.media {
    field @Deprecated public static final int ERROR_UNKNOWN = 0; // 0x0
  }
  public class MediaDrmException extends java.lang.Exception {
  public class MediaDrmException extends java.lang.Exception implements android.media.MediaDrmThrowable {
    ctor public MediaDrmException(String);
  }
  public class MediaDrmResetException extends java.lang.IllegalStateException {
  public class MediaDrmResetException extends java.lang.IllegalStateException implements android.media.MediaDrmThrowable {
    ctor public MediaDrmResetException(String);
  }
  public interface MediaDrmThrowable {
    method public default int getErrorContext();
    method public default int getOemError();
    method public default int getVendorError();
  }
  public final class MediaExtractor {
    ctor public MediaExtractor();
    method public boolean advance();
+7 −0
Original line number Diff line number Diff line
@@ -24,4 +24,11 @@ public final class DeniedByServerException extends MediaDrmException {
    public DeniedByServerException(String detailMessage) {
        super(detailMessage);
    }

    /**
     * @hide
     */
    public DeniedByServerException(String message, int vendorError, int oemError, int context) {
        super(message, vendorError, oemError, context);
    }
}
+30 −3
Original line number Diff line number Diff line
@@ -2472,10 +2472,22 @@ final public class MediaCodec {
    /**
     * Thrown when a crypto error occurs while queueing a secure input buffer.
     */
    public final static class CryptoException extends RuntimeException {
    public final static class CryptoException extends RuntimeException
            implements MediaDrmThrowable {
        public CryptoException(int errorCode, @Nullable String detailMessage) {
            super(detailMessage);
            this(detailMessage, errorCode, 0, 0, 0);
        }

        /**
         * @hide
         */
        public CryptoException(String message, int errorCode, int vendorError, int oemError,
                int errorContext) {
            super(message);
            mErrorCode = errorCode;
            mVendorError = vendorError;
            mOemError = oemError;
            mErrorContext = errorContext;
        }

        /**
@@ -2594,7 +2606,22 @@ final public class MediaCodec {
            return mErrorCode;
        }

        private int mErrorCode;
        @Override
        public int getVendorError() {
            return mVendorError;
        }

        @Override
        public int getOemError() {
            return mOemError;
        }

        @Override
        public int getErrorContext() {
            return mErrorContext;
        }

        private final int mErrorCode, mVendorError, mOemError, mErrorContext;
    }

    /**
+29 −2
Original line number Diff line number Diff line
@@ -22,8 +22,35 @@ import android.annotation.Nullable;
 * Exception thrown if MediaCrypto object could not be instantiated or
 * if unable to perform an operation on the MediaCrypto object.
 */
public final class MediaCryptoException extends Exception {
public final class MediaCryptoException extends Exception implements MediaDrmThrowable {
    public MediaCryptoException(@Nullable String detailMessage) {
        super(detailMessage);
        this(detailMessage, 0, 0, 0);
    }

    /**
     * @hide
     */
    public MediaCryptoException(String message, int vendorError, int oemError, int errorContext) {
        super(message);
        mVendorError = vendorError;
        mOemError = oemError;
        mErrorContext = errorContext;
    }

    @Override
    public int getVendorError() {
        return mVendorError;
    }

    @Override
    public int getOemError() {
        return mOemError;
    }

    @Override
    public int getErrorContext() {
        return mErrorContext;
    }

    private final int mVendorError, mOemError, mErrorContext;
}
+59 −5
Original line number Diff line number Diff line
@@ -664,16 +664,28 @@ public final class MediaDrm implements AutoCloseable {
     * strategy and details about each possible return value from {@link
     * MediaDrmStateException#getErrorCode()}.
     */
    public static final class MediaDrmStateException extends java.lang.IllegalStateException {
        private final int mErrorCode;
    public static final class MediaDrmStateException extends java.lang.IllegalStateException
            implements MediaDrmThrowable {
        private final int mErrorCode, mVendorError, mOemError, mErrorContext;
        private final String mDiagnosticInfo;

        /**
         * @hide
         */
        public MediaDrmStateException(int errorCode, @Nullable String detailMessage) {
            this(detailMessage, errorCode, 0, 0, 0);
        }

        /**
         * @hide
         */
        public MediaDrmStateException(String detailMessage, int errorCode,
                int vendorError, int oemError, int errorContext) {
            super(detailMessage);
            mErrorCode = errorCode;
            mVendorError = vendorError;
            mOemError = oemError;
            mErrorContext = errorContext;

            // TODO get this from DRM session
            final String sign = errorCode < 0 ? "neg_" : "";
@@ -696,6 +708,21 @@ public final class MediaDrm implements AutoCloseable {
            return mErrorCode;
        }

        @Override
        public int getVendorError() {
            return mVendorError;
        }

        @Override
        public int getOemError() {
            return mOemError;
        }

        @Override
        public int getErrorContext() {
            return mErrorContext;
        }

        /**
         * Returns true if the {@link MediaDrmStateException} is a transient
         * issue, perhaps due to resource constraints, and that the operation
@@ -727,10 +754,22 @@ public final class MediaDrm implements AutoCloseable {
     * {@link #isTransient()} to determine whether the app should retry the
     * failing operation.
     */
    public static final class SessionException extends RuntimeException {
    public static final class SessionException extends RuntimeException
            implements MediaDrmThrowable {
        public SessionException(int errorCode, @Nullable String detailMessage) {
            this(detailMessage, errorCode, 0, 0, 0);
        }

        /**
         * @hide
         */
        public SessionException(String detailMessage, int errorCode, int vendorError, int oemError,
                int errorContext) {
            super(detailMessage);
            mErrorCode = errorCode;
            mVendorError = vendorError;
            mOemError = oemError;
            mErrorContext = errorContext;
        }

        /**
@@ -769,6 +808,21 @@ public final class MediaDrm implements AutoCloseable {
            return mErrorCode;
        }

        @Override
        public int getVendorError() {
            return mVendorError;
        }

        @Override
        public int getOemError() {
            return mOemError;
        }

        @Override
        public int getErrorContext() {
            return mErrorContext;
        }

        /**
         * Returns true if the {@link SessionException} is a transient
         * issue, perhaps due to resource constraints, and that the operation
@@ -779,7 +833,7 @@ public final class MediaDrm implements AutoCloseable {
            return mErrorCode == ERROR_RESOURCE_CONTENTION;
        }

        private final int mErrorCode;
        private final int mErrorCode, mVendorError, mOemError, mErrorContext;
    }

    /**
Loading