Merge "MediaCodec/Drm: move from getErrorCode to getDiagnosticInfo" into lmp-dev

This commit is contained in:
Lajos Molnar
2014-09-10 02:38:49 +00:00
committed by Android (Google) Code Review
3 changed files with 39 additions and 2 deletions

View File

@@ -14664,7 +14664,7 @@ package android.media {
}
public static final class MediaCodec.CodecException extends java.lang.IllegalStateException {
method public int getErrorCode();
method public java.lang.String getDiagnosticInfo();
method public boolean isRecoverable();
method public boolean isTransient();
}
@@ -15002,7 +15002,7 @@ package android.media {
public static final class MediaDrm.MediaDrmStateException extends java.lang.IllegalStateException {
ctor public MediaDrm.MediaDrmStateException(int, java.lang.String);
method public int getErrorCode();
method public java.lang.String getDiagnosticInfo();
}
public static abstract interface MediaDrm.OnEventListener {

View File

@@ -672,6 +672,11 @@ final public class MediaCodec {
super(detailMessage);
mErrorCode = errorCode;
mActionCode = actionCode;
// TODO get this from codec
final String sign = errorCode < 0 ? "neg_" : "";
mDiagnosticInfo =
"android.media.MediaCodec.error_" + sign + Math.abs(errorCode);
}
/**
@@ -696,15 +701,28 @@ final public class MediaCodec {
* Retrieve the error code associated with a CodecException.
* This is opaque diagnostic information and may depend on
* hardware or API level.
*
* @hide
*/
public int getErrorCode() {
return mErrorCode;
}
/**
* Retrieve a human readable diagnostic information string
* associated with the exception. DO NOT SHOW THIS TO END-USERS!
* This string will not be localized or generally comprehensible
* to end-users.
*/
public String getDiagnosticInfo() {
return mDiagnosticInfo;
}
/* Must be in sync with android_media_MediaCodec.cpp */
private final static int ACTION_TRANSIENT = 1;
private final static int ACTION_RECOVERABLE = 2;
private final String mDiagnosticInfo;
private final int mErrorCode;
private final int mActionCode;
}

View File

@@ -188,18 +188,37 @@ public final class MediaDrm {
*/
public static final class MediaDrmStateException extends java.lang.IllegalStateException {
private final int mErrorCode;
private final String mDiagnosticInfo;
public MediaDrmStateException(int errorCode, String detailMessage) {
super(detailMessage);
mErrorCode = errorCode;
// TODO get this from DRM session
final String sign = errorCode < 0 ? "neg_" : "";
mDiagnosticInfo =
"android.media.MediaDrm.error_" + sign + Math.abs(errorCode);
}
/**
* Retrieve the associated error code
*
* @hide
*/
public int getErrorCode() {
return mErrorCode;
}
/**
* Retrieve a human readable diagnostic information string
* associated with the exception. DO NOT SHOW THIS TO END-USERS!
* This string will not be localized or generally comprehensible
* to end-users.
*/
public String getDiagnosticInfo() {
return mDiagnosticInfo;
}
}
/**