MediaDrm jni: get exception logs only if necessary

Bug: 162255728
Test: MediaDrmTest#testGetLogMessages
Change-Id: I39c203ff33dcc109120e9bbc1e089e6c8b7c90b3
This commit is contained in:
Robert Shih
2021-02-20 00:08:16 -08:00
parent 666c5015a9
commit 13eb27bb51

View File

@@ -424,7 +424,7 @@ static bool isSessionException(status_t err) {
static bool throwExceptionAsNecessary(
JNIEnv *env, const sp<IDrm> &drm, status_t err, const char *msg = NULL) {
std::string msgStr;
if (drm != NULL) {
if (drm != NULL && err != OK) {
msgStr = DrmUtils::GetExceptionMessage(err, msg, drm);
msg = msgStr.c_str();
}