Add OS Version to Properties

(This is a merge of http://go/wvgerrit/11613 from the Widevine CDM
repo.)

Adds a property for the OS version, implements it on Android, and
adds it to the license request property bag so that Netflix may
use it to discern the supported capabilities of the CDM.

Bug: 18230738
Change-Id: If5174a108093855314f3e0102b83691e20bb247b
This commit is contained in:
John "Juce" Bruce
2014-11-07 11:47:51 -08:00
parent 960718a673
commit 31f87bc19e
3 changed files with 15 additions and 0 deletions

View File

@@ -48,6 +48,7 @@ class Properties {
static bool GetDeviceName(std::string* device_name);
static bool GetProductName(std::string* product_name);
static bool GetBuildInfo(std::string* build_info);
static bool GetOsVersion(std::string* os_version);
static bool GetDeviceFilesBasePath(CdmSecurityLevel security_level,
std::string* base_path);
static bool GetFactoryKeyboxPath(std::string* keybox);

View File

@@ -25,6 +25,7 @@ std::string kDeviceNameKey = "device_name";
std::string kProductNameKey = "product_name";
std::string kBuildInfoKey = "build_info";
std::string kDeviceIdKey = "device_id";
std::string kOsVersion = "os_version";
const unsigned char kServiceCertificateCAPublicKey[] = {
0x30, 0x82, 0x01, 0x8a, 0x02, 0x82, 0x01, 0x81,
0x00, 0xb4, 0xfe, 0x39, 0xc3, 0x65, 0x90, 0x03,
@@ -281,6 +282,11 @@ bool CdmLicense::PrepareKeyRequest(const InitializationData& init_data,
client_info->set_name(kDeviceIdKey);
client_info->set_value(value);
}
if (Properties::GetOSVersion(&value)) {
client_info = client_id->add_client_info();
client_info->set_name(kOsVersionKey);
client_info->set_value(value);
}
ClientIdentification_ClientCapabilities* client_capabilities =
client_id->mutable_client_capabilities();

View File

@@ -87,6 +87,14 @@ bool Properties::GetBuildInfo(std::string* build_info) {
return GetAndroidProperty("ro.build.fingerprint", build_info);
}
bool Properties::GetOsVersion(std::string* os_version) {
if (!os_version) {
LOGW("Properties::GetOsVersion: Invalid parameter");
return false;
}
return GetAndroidProperty("ro.build.version.release", os_version);
}
bool Properties::GetDeviceFilesBasePath(CdmSecurityLevel security_level,
std::string* base_path) {
if (!base_path) {