Replace toStatus indirection.

CdmResponseType are mapped to android::status_t, then map to hidl
android::hardware::drm::V1_0::Status. This CL removes the indirection
by mapping cdm errors to hidl Status.

Test: Play Movies (pin and streaming)
Test: Netflix (download and streaming)
Test: libwvdrmmediacrypto_hidl_test and libwvdrmdrmplugin_hidl_test
Test: GtsMediaTestCases module
Test: Vts - VtsHalDrmV1_0Target

bug: 34682447
Change-Id: I0b04f47871f5e4898e7297831d5fceab52e0f7f9
This commit is contained in:
Edwin Wong
2017-05-18 09:01:42 -07:00
parent 496b184ddd
commit 485f11483c
12 changed files with 491 additions and 271 deletions

View File

@@ -60,8 +60,7 @@ LOCAL_HEADER_LIBRARIES := \
LOCAL_STATIC_LIBRARIES := \
libcdm_protos \
libcrypto \
libwidevinehidl_utils \
libcrypto
LOCAL_SHARED_LIBRARIES := \
android.hardware.drm@1.0 \

View File

@@ -68,7 +68,7 @@ struct WVCryptoPlugin : public ICryptoPlugin {
sp<wvcdm::WvContentDecryptionModule> const mCDM;
android::status_t attemptDecrypt(
Status attemptDecrypt(
const wvcdm::CdmDecryptionParameters& params,
bool haveEncryptedSubsamples, std::string* errorDetailMsg);
static wvcdm::CdmResponseType countEncryptedBlocksInPatternedRange(

View File

@@ -30,12 +30,9 @@ namespace V1_0 {
namespace widevine {
using ::android::hardware::drm::V1_0::BufferType;
using ::android::hardware::drm::V1_0::widevine::toStatus;
using ::android::hardware::drm::V1_0::widevine::toVector;
using ::android::hardware::Void;
using android::status_t;
using wvcdm::CdmDecryptionParameters;
using wvcdm::CdmQueryMap;
using wvcdm::CdmResponseType;
@@ -258,10 +255,10 @@ Return<void> WVCryptoPlugin::decrypt(
params.decrypt_buffer_offset = bufferOffset;
params.subsample_flags = clearFlags;
status_t res = attemptDecrypt(params, haveEncryptedSubsamples,
Status res = attemptDecrypt(params, haveEncryptedSubsamples,
&errorDetailMsg);
if (res != android::OK) {
_hidl_cb(toStatus(res), 0, errorDetailMsg.c_str());
if (res != Status::OK) {
_hidl_cb(res, 0, errorDetailMsg.c_str());
return Void();
}
bufferOffset += subSample.numBytesOfClearData;
@@ -277,10 +274,10 @@ Return<void> WVCryptoPlugin::decrypt(
params.decrypt_buffer_offset = bufferOffset;
params.subsample_flags = encryptedFlags;
status_t res = attemptDecrypt(params, haveEncryptedSubsamples,
Status res = attemptDecrypt(params, haveEncryptedSubsamples,
&errorDetailMsg);
if (res != android::OK) {
_hidl_cb(toStatus(res), 0, errorDetailMsg.c_str());
if (res != Status::OK) {
_hidl_cb(res, 0, errorDetailMsg.c_str());
return Void();
}
@@ -331,14 +328,14 @@ Return<void> WVCryptoPlugin::decrypt(
return Void();
}
status_t WVCryptoPlugin::attemptDecrypt(const CdmDecryptionParameters& params,
Status WVCryptoPlugin::attemptDecrypt(const CdmDecryptionParameters& params,
bool haveEncryptedSubsamples,
std::string* errorDetailMsg) {
CdmResponseType res = mCDM->Decrypt(mSessionId, haveEncryptedSubsamples,
params);
if (isCdmResponseTypeSuccess(res)) {
return android::OK;
return Status::OK;
} else {
ALOGE("Decrypt error result in session %s during %s block: %d",
mSessionId.c_str(),
@@ -381,7 +378,7 @@ status_t WVCryptoPlugin::attemptDecrypt(const CdmDecryptionParameters& params,
return mapCdmResponseType(res);
} else {
// Swallow the specifics of other errors to obscure decrypt internals.
return kErrorCDMGeneric;
return Status::ERROR_DRM_UNKNOWN;
}
}
}

View File

@@ -86,10 +86,6 @@ LOCAL_STATIC_LIBRARIES := \
libwvlevel3 \
libwvdrmcryptoplugin_hidl \
# When the GNU linker sees a library, it discards all symbols that it doesn't
# need. libwidevinehidl_utils must come after libwvdrmcryptoplugin.
LOCAL_STATIC_LIBRARIES += libwidevinehidl_utils
LOCAL_SHARED_LIBRARIES := \
android.hardware.drm@1.0 \
android.hidl.memory@1.0 \