Add Property to Access System ID
Adds a new property to the CDM's QueryStatus called QUERY_KEY_SYSTEM_ID that contains the System ID. (as read from OEMCrypto_GetKeyData) Adds a new property to the DrmPlugin (cleverly named "systemId") that allows the app to query for this. Also adds unit tests. Also changes the Device ID getter in crypto_engine.cpp to return a failure instead of an empty ID. Bug: 8621632 Merge of https://widevine-internal-review.googlesource.com/#/c/5010/ from widevine cdm repository to android repository. Change-Id: I8f309af18487c499e8ce25e829059e45623ea4dc
This commit is contained in:
@@ -422,48 +422,57 @@ TEST_F(WVDrmPluginTest, ReturnsExpectedPropertyValues) {
|
||||
l3Map[QUERY_KEY_SECURITY_LEVEL] = QUERY_VALUE_SECURITY_LEVEL_L3;
|
||||
|
||||
static const string uniqueId = "The Universe";
|
||||
CdmQueryMap idMap;
|
||||
idMap[QUERY_KEY_DEVICE_ID] = uniqueId;
|
||||
CdmQueryMap deviceIDMap;
|
||||
deviceIDMap[QUERY_KEY_DEVICE_ID] = uniqueId;
|
||||
|
||||
static const string systemId = "42";
|
||||
CdmQueryMap systemIDMap;
|
||||
systemIDMap[QUERY_KEY_SYSTEM_ID] = systemId;
|
||||
|
||||
EXPECT_CALL(cdm, QueryStatus(_))
|
||||
.WillOnce(DoAll(SetArgPointee<0>(l1Map),
|
||||
Return(wvcdm::NO_ERROR)))
|
||||
.WillOnce(DoAll(SetArgPointee<0>(l3Map),
|
||||
Return(wvcdm::NO_ERROR)))
|
||||
.WillOnce(DoAll(SetArgPointee<0>(idMap),
|
||||
.WillOnce(DoAll(SetArgPointee<0>(deviceIDMap),
|
||||
Return(wvcdm::NO_ERROR)))
|
||||
.WillOnce(DoAll(SetArgPointee<0>(systemIDMap),
|
||||
Return(wvcdm::NO_ERROR)));
|
||||
|
||||
String8 stringResult;
|
||||
Vector<uint8_t> vectorResult;
|
||||
|
||||
status_t res = plugin.getPropertyString(String8("vendor"), stringResult);
|
||||
ASSERT_EQ(OK, res);
|
||||
EXPECT_EQ(String8("Google"), stringResult);
|
||||
EXPECT_STREQ("Google", stringResult.string());
|
||||
|
||||
res = plugin.getPropertyString(String8("version"), stringResult);
|
||||
ASSERT_EQ(OK, res);
|
||||
EXPECT_EQ(String8("1.0"), stringResult);
|
||||
EXPECT_STREQ("1.0", stringResult.string());
|
||||
|
||||
res = plugin.getPropertyString(String8("description"), stringResult);
|
||||
ASSERT_EQ(OK, res);
|
||||
EXPECT_EQ(String8("Widevine CDM"), stringResult);
|
||||
EXPECT_STREQ("Widevine CDM", stringResult.string());
|
||||
|
||||
res = plugin.getPropertyString(String8("algorithms"), stringResult);
|
||||
ASSERT_EQ(OK, res);
|
||||
EXPECT_EQ(String8("AES/CBC/NoPadding,HmacSHA256"), stringResult);
|
||||
EXPECT_STREQ("AES/CBC/NoPadding,HmacSHA256", stringResult.string());
|
||||
|
||||
res = plugin.getPropertyString(String8("securityLevel"), stringResult);
|
||||
ASSERT_EQ(OK, res);
|
||||
EXPECT_EQ(String8("L1"), stringResult);
|
||||
EXPECT_STREQ(QUERY_VALUE_SECURITY_LEVEL_L1.c_str(), stringResult.string());
|
||||
|
||||
res = plugin.getPropertyString(String8("securityLevel"), stringResult);
|
||||
ASSERT_EQ(OK, res);
|
||||
EXPECT_EQ(String8("L3"), stringResult);
|
||||
|
||||
Vector<uint8_t> vectorResult;
|
||||
EXPECT_STREQ(QUERY_VALUE_SECURITY_LEVEL_L3.c_str(), stringResult.string());
|
||||
|
||||
res = plugin.getPropertyByteArray(String8("deviceUniqueId"), vectorResult);
|
||||
ASSERT_EQ(OK, res);
|
||||
EXPECT_THAT(vectorResult, ElementsAreArray(uniqueId.data(), uniqueId.size()));
|
||||
|
||||
res = plugin.getPropertyString(String8("systemId"), stringResult);
|
||||
ASSERT_EQ(OK, res);
|
||||
EXPECT_STREQ(systemId.c_str(), stringResult.string());
|
||||
}
|
||||
|
||||
TEST_F(WVDrmPluginTest, DoesNotGetUnknownProperties) {
|
||||
|
||||
Reference in New Issue
Block a user