Fix several bugs from cts test through aidl clearkey
* handle error code in DrmHalAidl and CryptoHalAidl
* clearkey aidl getKeyRequest defaultUrl
Test: atest CtsMediaDrmTestCases
Bug: 206804036
Change-Id: I038c6d92df8b222ab69aa48c4b994c8c9516c711
diff --git a/drm/libmediadrm/CryptoHalAidl.cpp b/drm/libmediadrm/CryptoHalAidl.cpp
index 03782ef..5989ca2 100644
--- a/drm/libmediadrm/CryptoHalAidl.cpp
+++ b/drm/libmediadrm/CryptoHalAidl.cpp
@@ -41,7 +41,7 @@
using ::aidl::android::hardware::common::Ashmem;
using ::android::sp;
-using ::android::DrmUtils::toStatusTAidl;
+using ::android::DrmUtils::statusAidlToStatusT;
using ::android::hardware::hidl_array;
using ::android::hardware::hidl_handle;
using ::android::hardware::hidl_memory;
@@ -281,7 +281,7 @@
}
auto err = mPlugin->setMediaDrmSession(toStdVec(sessionId));
- return err.isOk() ? toStatusTAidl(err.getServiceSpecificError()) : DEAD_OBJECT;
+ return statusAidlToStatusT(err);
}
ssize_t CryptoHalAidl::decrypt(const uint8_t keyId[16], const uint8_t iv[16],
@@ -350,13 +350,12 @@
std::vector<uint8_t> keyIdAidl(toStdVec(keyId, 16));
std::vector<uint8_t> ivAidl(toStdVec(iv, 16));
DecryptResult result;
- err = mPlugin->decrypt(secure, keyIdAidl, ivAidl, aMode, aPattern, stdSubSamples,
+ ::ndk::ScopedAStatus statusAidl = mPlugin->decrypt(secure,
+ keyIdAidl, ivAidl, aMode, aPattern, stdSubSamples,
hidlSharedBufferToAidlSharedBuffer(hSource), offset,
- hidlDestinationBufferToAidlDestinationBuffer(hDestination), &result)
- .isOk()
- ? OK
- : DEAD_OBJECT;
+ hidlDestinationBufferToAidlDestinationBuffer(hDestination), &result);
+ err = statusAidlToStatusT(statusAidl);
*errorDetailMsg = toString8(result.detailedError);
if (err != OK) {
ALOGE("Failed on decrypt, error message:%s, bytes written:%d", result.detailedError.c_str(),
@@ -416,6 +415,6 @@
Mutex::Autolock autoLock(mLock);
// Need to convert logmessage
- return DrmUtils::GetLogMessagesAidl<ICryptoPluginAidl>(mPlugin, logs);
+ return DrmUtils::GetLogMessagesAidl<ICryptoPluginAidl>(mPlugin, logs);
}
} // namespace android
\ No newline at end of file