diff options
author | Jeff Tinker <jtinker@google.com> | 2015-07-01 17:35:18 -0700 |
---|---|---|
committer | Jeff Tinker <jtinker@google.com> | 2015-07-06 14:35:29 -0700 |
commit | 96a2a957e42e04be817b60bb27199f3846f00fc9 (patch) | |
tree | 0f235e5ff14010fe4fb2c7d2e47b665f3c543de5 /media | |
parent | a6fb1e70ffa4faeba725b06610f4daa1ee60ead8 (diff) | |
download | frameworks_base-96a2a957e42e04be817b60bb27199f3846f00fc9.zip frameworks_base-96a2a957e42e04be817b60bb27199f3846f00fc9.tar.gz frameworks_base-96a2a957e42e04be817b60bb27199f3846f00fc9.tar.bz2 |
Report specific exception type on decrypt with invalid session
bug: 22235465
Change-Id: Ic1e1a86529d4f2246b9768799aacde5cd1070d04
Diffstat (limited to 'media')
-rw-r--r-- | media/java/android/media/MediaCodec.java | 9 | ||||
-rw-r--r-- | media/jni/android_media_MediaCodec.cpp | 9 |
2 files changed, 18 insertions, 0 deletions
diff --git a/media/java/android/media/MediaCodec.java b/media/java/android/media/MediaCodec.java index a79dd04..5f60891 100644 --- a/media/java/android/media/MediaCodec.java +++ b/media/java/android/media/MediaCodec.java @@ -2029,12 +2029,21 @@ final public class MediaCodec { */ public static final int ERROR_INSUFFICIENT_OUTPUT_PROTECTION = 4; + /** + * This indicates that decryption was attempted on a session that is + * not opened, which could be due to a failure to open the session, + * closing the session prematurely, or the session being reclaimed + * by the resource manager. + */ + public static final int ERROR_SESSION_NOT_OPENED = 5; + /** @hide */ @IntDef({ ERROR_NO_KEY, ERROR_KEY_EXPIRED, ERROR_RESOURCE_BUSY, ERROR_INSUFFICIENT_OUTPUT_PROTECTION, + ERROR_SESSION_NOT_OPENED, }) @Retention(RetentionPolicy.SOURCE) public @interface CryptoErrorCode {} diff --git a/media/jni/android_media_MediaCodec.cpp b/media/jni/android_media_MediaCodec.cpp index ce7f7e5..218a117 100644 --- a/media/jni/android_media_MediaCodec.cpp +++ b/media/jni/android_media_MediaCodec.cpp @@ -64,6 +64,7 @@ static struct CryptoErrorCodes { jint cryptoErrorKeyExpired; jint cryptoErrorResourceBusy; jint cryptoErrorInsufficientOutputProtection; + jint cryptoErrorSessionNotOpened; } gCryptoErrorCodes; static struct CodecActionCodes { @@ -843,6 +844,9 @@ static void throwCryptoException(JNIEnv *env, status_t err, const char *msg) { case ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION: err = gCryptoErrorCodes.cryptoErrorInsufficientOutputProtection; break; + case ERROR_DRM_SESSION_NOT_OPENED: + err = gCryptoErrorCodes.cryptoErrorSessionNotOpened; + break; default: /* Other negative DRM error codes go out as is. */ break; } @@ -1689,6 +1693,11 @@ static void android_media_MediaCodec_native_init(JNIEnv *env) { gCryptoErrorCodes.cryptoErrorInsufficientOutputProtection = env->GetStaticIntField(clazz.get(), field); + field = env->GetStaticFieldID(clazz.get(), "ERROR_SESSION_NOT_OPENED", "I"); + CHECK(field != NULL); + gCryptoErrorCodes.cryptoErrorSessionNotOpened = + 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"); |