diff --git a/api/current.txt b/api/current.txt index 6fbd40bfe2306..f461b638e6d67 100644 --- a/api/current.txt +++ b/api/current.txt @@ -14665,6 +14665,7 @@ package android.media { public static final class MediaCodec.CryptoException extends java.lang.RuntimeException { ctor public MediaCodec.CryptoException(int, java.lang.String); method public int getErrorCode(); + field public static final int ERROR_INSUFFICIENT_OUTPUT_PROTECTION = 4; // 0x4 field public static final int ERROR_KEY_EXPIRED = 2; // 0x2 field public static final int ERROR_NO_KEY = 1; // 0x1 field public static final int ERROR_RESOURCE_BUSY = 3; // 0x3 diff --git a/media/java/android/media/MediaCodec.java b/media/java/android/media/MediaCodec.java index 032f07f116463..b3018da5d86b4 100644 --- a/media/java/android/media/MediaCodec.java +++ b/media/java/android/media/MediaCodec.java @@ -733,6 +733,13 @@ final public class MediaCodec { */ public static final int ERROR_RESOURCE_BUSY = 3; + /** + * This indicates that the output protection levels supported by the + * device are not sufficient to meet the requirements set by the + * content owner in the license policy. + */ + public static final int ERROR_INSUFFICIENT_OUTPUT_PROTECTION = 4; + /** * Retrieve the error code associated with a CryptoException */ diff --git a/media/jni/android_media_MediaCodec.cpp b/media/jni/android_media_MediaCodec.cpp index f1e1099332af8..1cf589d156709 100644 --- a/media/jni/android_media_MediaCodec.cpp +++ b/media/jni/android_media_MediaCodec.cpp @@ -62,6 +62,7 @@ static struct CryptoErrorCodes { jint cryptoErrorNoKey; jint cryptoErrorKeyExpired; jint cryptoErrorResourceBusy; + jint cryptoErrorInsufficientOutputProtection; } gCryptoErrorCodes; static struct CodecActionCodes { @@ -756,6 +757,9 @@ static void throwCryptoException(JNIEnv *env, status_t err, const char *msg) { case ERROR_DRM_RESOURCE_BUSY: err = gCryptoErrorCodes.cryptoErrorResourceBusy; break; + case ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION: + err = gCryptoErrorCodes.cryptoErrorInsufficientOutputProtection; + break; default: /* Other negative DRM error codes go out as is. */ break; } @@ -1434,6 +1438,11 @@ static void android_media_MediaCodec_native_init(JNIEnv *env) { gCryptoErrorCodes.cryptoErrorResourceBusy = env->GetStaticIntField(clazz.get(), field); + field = env->GetStaticFieldID(clazz.get(), "ERROR_INSUFFICIENT_OUTPUT_PROTECTION", "I"); + CHECK(field != NULL); + gCryptoErrorCodes.cryptoErrorInsufficientOutputProtection = + env->GetStaticIntField(clazz.get(), field); + clazz.reset(env->FindClass("android/media/MediaCodec$CodecException")); CHECK(clazz.get() != NULL); field = env->GetStaticFieldID(clazz.get(), "ACTION_TRANSIENT", "I");