MediaCryptoException: human readable error codes

Bug: 162255728
Change-Id: I912daa716a3018e787cccb7db9bf6fa293197c66
Test: build
This commit is contained in:
Robert Shih
2021-02-14 07:56:32 +00:00
parent 666c5015a9
commit 4b2c641d02

View File

@@ -202,10 +202,11 @@ static void android_media_MediaCrypto_native_setup(
uuid = NULL;
if (err != OK) {
jniThrowException(
std::string strerr(StrCryptoError(err));
jniThrowExceptionFmt(
env,
"android/media/MediaCryptoException",
"Failed to instantiate crypto object.");
"Failed to instantiate crypto object: %s", strerr.c_str());
return;
}
@@ -295,7 +296,8 @@ static void android_media_MediaCrypto_setMediaDrmSession(
} else if (err == NO_INIT) {
msg += ": crypto plugin not initialized";
} else {
msg.appendFormat(": general failure (%d)", err);
std::string strerr(StrCryptoError(err));
msg.appendFormat(": general failure (%s)", strerr.c_str());
}
jniThrowException(env, "android/media/MediaCryptoException", msg.string());
}