Replace OS Version with Widevine Version

(This is a merge of http://go/wvgerrit/13813)

Removes the OS Version property which was only ever implemented on
Android to appease Netflix and never actually used by them. Adds,
instead, a Widevine library version property. Also adds
implementations of this function for both Android and CE Devices.

For Android, the version number is starting at 3.0.0-android, to
reflect that this is the third major revision of the Widevine CDM in
Android.

For CE Devices, the version number is not changing from its current
value (2.2.0) but is gaining a "-ce" on the end in order to
differentiate it from the Android version number.

Bug: 18376638
Change-Id: Ifb3fa0d62631b45d9e91a6a53bcab3be38763d3a
This commit is contained in:
John "Juce" Bruce
2015-04-09 18:53:49 -07:00
parent 3ff106f86a
commit b0b11bc534
4 changed files with 28 additions and 8 deletions

View File

@@ -49,7 +49,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 GetWVCdmVersion(std::string* version);
static bool GetDeviceFilesBasePath(CdmSecurityLevel security_level,
std::string* base_path);
static bool GetFactoryKeyboxPath(std::string* keybox);

View File

@@ -25,7 +25,7 @@ std::string kDeviceNameKey = "device_name";
std::string kProductNameKey = "product_name";
std::string kBuildInfoKey = "build_info";
std::string kDeviceIdKey = "device_id";
std::string kOsVersionKey = "os_version";
std::string kWVCdmVersionKey = "widevine_cdm_version";
const unsigned char kServiceCertificateCAPublicKey[] = {
0x30, 0x82, 0x01, 0x8a, 0x02, 0x82, 0x01, 0x81, 0x00, 0xb4, 0xfe, 0x39,
0xc3, 0x65, 0x90, 0x03, 0xdb, 0x3c, 0x11, 0x97, 0x09, 0xe8, 0x68, 0xcd,
@@ -261,9 +261,9 @@ bool CdmLicense::PrepareKeyRequest(const InitializationData& init_data,
client_info->set_name(kDeviceIdKey);
client_info->set_value(value);
}
if (Properties::GetOsVersion(&value)) {
if (Properties::GetWVCdmVersion(&value)) {
client_info = client_id->add_client_info();
client_info->set_name(kOsVersionKey);
client_info->set_name(kWVCdmVersionKey);
client_info->set_value(value);
}

View File

@@ -18,6 +18,8 @@ const char kL2Dir[] = "/L2/";
const char kL3Dir[] = "/L3/";
const char kFactoryKeyboxPath[] = "/factory/wv.keys";
const char kWVCdmVersion[] = "v3.0.0-android";
bool GetAndroidProperty(const char* key, std::string* value) {
char val[PROPERTY_VALUE_MAX];
if (!key) {
@@ -88,12 +90,13 @@ 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");
bool Properties::GetWVCdmVersion(std::string* version) {
if (!version) {
LOGW("Properties::GetWVCdmVersion: Invalid parameter");
return false;
}
return GetAndroidProperty("ro.build.version.release", os_version);
*version = kWVCdmVersion;
return true;
}
bool Properties::GetDeviceFilesBasePath(CdmSecurityLevel security_level,

View File

@@ -4,6 +4,7 @@
#include <getopt.h>
#include <sstream>
#include <cutils/properties.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
@@ -1908,6 +1909,22 @@ INSTANTIATE_TEST_CASE_P(Cdm, WvCdmDecryptionTest,
&switch_key_encrypted_sub_samples[0],
&partial_encrypted_sub_samples[0]));
TEST(VersionNumberTest, VersionNumberChangeCanary) {
char release_number[PROPERTY_VALUE_MAX];
ASSERT_GT(property_get("ro.build.version.release", release_number, "Unknown"),
0);
EXPECT_STREQ("MNC", release_number) <<
"The Android version number has changed. You need to update this test "
"and also possibly update the Widevine version number in "
"properties_android.cpp.";
std::string widevine_version;
ASSERT_TRUE(Properties::GetWVCdmVersion(&widevine_version));
EXPECT_EQ("v3.0.0-android", widevine_version) <<
"The Widevine CDM version number has changed. Did you forget to update "
"this test after changing it?";
}
} // namespace wvcdm
void show_menu(char* prog_name) {