Squashed merge 3 CLs.

1. "Change CdmResponseType from enum into a struct"
Merged from http://go/wvgerrit/163199
Bug: 253271674

2. "Log request information when server returns 401"
Bug: 260760387
Bug: 186031735
Merged from http://go/wvgerrit/162798

3. "Specify server version on the command line"
Bug: 251599048
Merged from http://go/wvgerrit/158897

Test: build android.hardware.drm-service.widevine
Test: Netflix and Play Movies & TV
Test: build_and_run_all_unit_tests.sh

Bug: 253271674
Change-Id: I70c950acce070609ee0343920ec68e66b058bc23
This commit is contained in:
Robert Shih
2022-11-16 10:02:18 -08:00
committed by Edwin Wong
parent ac9641ae13
commit 096b0eda5a
46 changed files with 1726 additions and 1443 deletions

View File

@@ -96,7 +96,7 @@ SharedBufferBase::~SharedBufferBase() {
CdmResponseType res = mCDM->QuerySessionStatus(mSessionId, &status);
if (!::wvdrm::isCdmResponseTypeSuccess(res)) {
ALOGE("Error querying CDM status: %u", res);
ALOGE("Error querying CDM status: %d", static_cast<int>(res));
*_aidl_return = false;
return ::ndk::ScopedAStatus::ok();
}
@@ -305,8 +305,8 @@ Status WVCryptoPlugin::attemptDecrypt(const CdmDecryptionParametersV16& params,
return Status::OK;
} else {
ALOGE("Decrypt error in session %s during a sample %s protected data: %d",
mSessionId.c_str(), hasProtectedData ? "with" : "without", res);
switch (res) {
mSessionId.c_str(), hasProtectedData ? "with" : "without", static_cast<int>(res));
switch (res.Enum()) {
case wvcdm::INSUFFICIENT_CRYPTO_RESOURCES:
errorDetailMsg->assign(
"Error decrypting data: insufficient crypto resources");

View File

@@ -106,7 +106,7 @@ public:
fclose(fp);
// Set default CdmResponseType value for gMock
DefaultValue<CdmResponseType>::Set(wvcdm::NO_ERROR);
DefaultValue<CdmResponseType>::Set(CdmResponseType(wvcdm::NO_ERROR));
heapBases.clear();
mCdm = new NiceMock<MockCDM>();
@@ -156,7 +156,7 @@ public:
uint8_t *base = static_cast<uint8_t *>(
mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0));
EXPECT_NE(MAP_FAILED, base);
auto p = reinterpret_cast<uint32_t*>(base);
auto p = reinterpret_cast<uint32_t *>(base);
for (size_t i = 0; i < size / sizeof(uint32_t); i++) {
p[i] = rand();
}
@@ -175,10 +175,10 @@ TEST_F(WVCryptoPluginTest, CorrectlyReportsSecureBuffers) {
// Specify the expected calls to QuerySessionStatus
EXPECT_CALL(*mCdm, QuerySessionStatus(_, _))
.WillOnce(
DoAll(SetArgPointee<1>(l1Map), testing::Return(wvcdm::NO_ERROR)))
.WillOnce(
DoAll(SetArgPointee<1>(l3Map), testing::Return(wvcdm::NO_ERROR)));
.WillOnce(DoAll(SetArgPointee<1>(l1Map),
testing::Return(CdmResponseType(wvcdm::NO_ERROR))))
.WillOnce(DoAll(SetArgPointee<1>(l3Map),
testing::Return(CdmResponseType(wvcdm::NO_ERROR))));
bool isSecure = false;
auto ret = mPlugin->requiresSecureDecoderComponent("video/mp4", &isSecure);