Resolve feedback from API review: MediaDrm

bug:123939401
test:media playback test
Change-Id: I8166535fe537a633a0ddac917217a5ac627f4ca8
This commit is contained in:
Jeff Tinker
2019-02-26 18:11:37 -08:00
parent 5ca35d19a4
commit f11261ba88
3 changed files with 9 additions and 0 deletions

View File

@@ -24942,6 +24942,7 @@ package android.media {
ctor public MediaDrm.SessionException(int, @Nullable String);
method public int getErrorCode();
field public static final int ERROR_RESOURCE_CONTENTION = 1; // 0x1
field public static final int ERROR_UNKNOWN = 0; // 0x0
}
public class MediaDrmException extends java.lang.Exception {

View File

@@ -303,6 +303,11 @@ public final class MediaDrm implements AutoCloseable {
mErrorCode = errorCode;
}
/**
* The SessionException has an unknown error code.
*/
public static final int ERROR_UNKNOWN = 0;
/**
* This indicates that apps using MediaDrm sessions are
* temporarily exceeding the capacity of available crypto

View File

@@ -149,6 +149,7 @@ struct SessionExceptionFields {
};
struct SessionExceptionErrorCodes {
jint kErrorUnknown;
jint kResourceContention;
} gSessionExceptionErrorCodes;
@@ -888,6 +889,8 @@ static void android_media_MediaDrm_native_init(JNIEnv *env) {
gFields.sessionException.classId = static_cast<jclass>(env->NewGlobalRef(clazz));
GET_FIELD_ID(gFields.sessionException.errorCode, clazz, "mErrorCode", "I");
GET_STATIC_FIELD_ID(field, clazz, "ERROR_UNKNOWN", "I");
gSessionExceptionErrorCodes.kErrorUnknown = env->GetStaticIntField(clazz, field);
GET_STATIC_FIELD_ID(field, clazz, "ERROR_RESOURCE_CONTENTION", "I");
gSessionExceptionErrorCodes.kResourceContention = env->GetStaticIntField(clazz, field);
}