Pass CdmIdentifier to UsageInfo Methods
The methods on WvContentDecryptionModule related to UsageInfo (Secure Stops) do not work if kDefaultCdmIdentifier has not been provisioned. This can occur if an app provisions and uses an origin without any app on that device ever provisioning the default origin. More concerningly, this will happen 100% of the time on SPOID-using devices, as there is no way to provision the default identifier on these devices. The fix is to pass the current identifier to these methods so that they do not have to use kDefaultCdmIdentifier. Test: build_and_run_all_unit_tests.sh Test: WV GTS Tests Bug: 62431478 Change-Id: I92a8b4acb69c964abe8129bccf2ff48a66c4a9e0
This commit is contained in:
@@ -164,17 +164,20 @@ class MockCDM : public WvContentDecryptionModule {
|
||||
MOCK_METHOD2(Unprovision, CdmResponseType(CdmSecurityLevel,
|
||||
const CdmIdentifier&));
|
||||
|
||||
MOCK_METHOD2(GetUsageInfo, CdmResponseType(const std::string&,
|
||||
CdmUsageInfo*));
|
||||
|
||||
MOCK_METHOD3(GetUsageInfo, CdmResponseType(const std::string&,
|
||||
const CdmSecureStopId&,
|
||||
const CdmIdentifier&,
|
||||
CdmUsageInfo*));
|
||||
|
||||
MOCK_METHOD1(ReleaseAllUsageInfo, CdmResponseType(const std::string&));
|
||||
MOCK_METHOD4(GetUsageInfo, CdmResponseType(const std::string&,
|
||||
const CdmSecureStopId&,
|
||||
const CdmIdentifier&,
|
||||
CdmUsageInfo*));
|
||||
|
||||
MOCK_METHOD1(ReleaseUsageInfo,
|
||||
CdmResponseType(const CdmUsageInfoReleaseMessage&));
|
||||
MOCK_METHOD2(ReleaseAllUsageInfo, CdmResponseType(const std::string&,
|
||||
const CdmIdentifier&));
|
||||
|
||||
MOCK_METHOD2(ReleaseUsageInfo,
|
||||
CdmResponseType(const CdmUsageInfoReleaseMessage&, const CdmIdentifier&));
|
||||
|
||||
MOCK_METHOD1(IsValidServiceCertificate, bool(const std::string&));
|
||||
};
|
||||
@@ -946,8 +949,8 @@ TEST_F(WVDrmPluginTest, GetsSecureStops) {
|
||||
}
|
||||
|
||||
const char* app_id = "my_app_id";
|
||||
EXPECT_CALL(*cdm, GetUsageInfo(StrEq(app_id), _))
|
||||
.WillOnce(DoAll(SetArgPointee<1>(cdmStops),
|
||||
EXPECT_CALL(*cdm, GetUsageInfo(StrEq(app_id), _, _))
|
||||
.WillOnce(DoAll(SetArgPointee<2>(cdmStops),
|
||||
testing::Return(wvcdm::NO_ERROR)));
|
||||
|
||||
std::list<std::vector<uint8_t> > stops;
|
||||
@@ -987,7 +990,7 @@ TEST_F(WVDrmPluginTest, ReleasesAllSecureStops) {
|
||||
StrictMock<MockCrypto> crypto;
|
||||
std::string appPackageName;
|
||||
|
||||
EXPECT_CALL(*cdm, ReleaseAllUsageInfo(StrEq("")))
|
||||
EXPECT_CALL(*cdm, ReleaseAllUsageInfo(StrEq(""), _))
|
||||
.Times(1);
|
||||
|
||||
WVDrmPlugin plugin(cdm.get(), appPackageName, &crypto, false);
|
||||
@@ -1015,7 +1018,8 @@ TEST_F(WVDrmPluginTest, ReleasesSecureStop) {
|
||||
message.assign(messageRaw, messageRaw + kMessageSize);
|
||||
|
||||
EXPECT_CALL(*cdm, ReleaseUsageInfo(ElementsAreArray(messageRaw,
|
||||
kMessageSize)))
|
||||
kMessageSize),
|
||||
_))
|
||||
.Times(1);
|
||||
|
||||
WVDrmPlugin plugin(cdm.get(), appPackageName, &crypto, false);
|
||||
|
||||
@@ -82,17 +82,20 @@ class MockCDM : public WvContentDecryptionModule {
|
||||
MOCK_METHOD2(Unprovision, CdmResponseType(CdmSecurityLevel,
|
||||
const CdmIdentifier&));
|
||||
|
||||
MOCK_METHOD2(GetUsageInfo, CdmResponseType(const std::string&,
|
||||
CdmUsageInfo*));
|
||||
|
||||
MOCK_METHOD3(GetUsageInfo, CdmResponseType(const std::string&,
|
||||
const CdmSecureStopId&,
|
||||
const CdmIdentifier&,
|
||||
CdmUsageInfo*));
|
||||
|
||||
MOCK_METHOD1(ReleaseAllUsageInfo, CdmResponseType(const std::string&));
|
||||
MOCK_METHOD4(GetUsageInfo, CdmResponseType(const std::string&,
|
||||
const CdmSecureStopId&,
|
||||
const CdmIdentifier&,
|
||||
CdmUsageInfo*));
|
||||
|
||||
MOCK_METHOD1(ReleaseUsageInfo,
|
||||
CdmResponseType(const CdmUsageInfoReleaseMessage&));
|
||||
MOCK_METHOD2(ReleaseAllUsageInfo, CdmResponseType(const std::string&,
|
||||
const CdmIdentifier&));
|
||||
|
||||
MOCK_METHOD2(ReleaseUsageInfo,
|
||||
CdmResponseType(const CdmUsageInfoReleaseMessage&, const CdmIdentifier&));
|
||||
|
||||
MOCK_METHOD1(IsValidServiceCertificate, bool(const std::string&));
|
||||
};
|
||||
@@ -755,8 +758,8 @@ TEST_F(WVDrmPluginTest, GetsSecureStops) {
|
||||
cdmStops.push_back(string(stopsRaw[i], stopsRaw[i] + kStopSize));
|
||||
}
|
||||
|
||||
EXPECT_CALL(*cdm, GetUsageInfo(StrEq(app_id), _))
|
||||
.WillOnce(DoAll(SetArgPointee<1>(cdmStops),
|
||||
EXPECT_CALL(*cdm, GetUsageInfo(StrEq(app_id), _, _))
|
||||
.WillOnce(DoAll(SetArgPointee<2>(cdmStops),
|
||||
Return(wvcdm::NO_ERROR)));
|
||||
|
||||
List<Vector<uint8_t> > stops;
|
||||
@@ -786,7 +789,7 @@ TEST_F(WVDrmPluginTest, ReleasesAllSecureStops) {
|
||||
status_t res = plugin.setPropertyString(String8("appId"), String8(""));
|
||||
ASSERT_EQ(OK, res);
|
||||
|
||||
EXPECT_CALL(*cdm, ReleaseAllUsageInfo(StrEq("")))
|
||||
EXPECT_CALL(*cdm, ReleaseAllUsageInfo(StrEq(""), _))
|
||||
.Times(1);
|
||||
|
||||
res = plugin.releaseAllSecureStops();
|
||||
@@ -808,7 +811,8 @@ TEST_F(WVDrmPluginTest, ReleasesSecureStops) {
|
||||
message.appendArray(messageRaw, kMessageSize);
|
||||
|
||||
EXPECT_CALL(*cdm, ReleaseUsageInfo(ElementsAreArray(messageRaw,
|
||||
kMessageSize)))
|
||||
kMessageSize),
|
||||
_))
|
||||
.Times(1);
|
||||
|
||||
status_t res = plugin.releaseSecureStops(message);
|
||||
|
||||
Reference in New Issue
Block a user