From 31f87bc19e81333e72d391f7bfd0f6e8632c6562 Mon Sep 17 00:00:00 2001 From: "John \"Juce\" Bruce" Date: Fri, 7 Nov 2014 11:47:51 -0800 Subject: [PATCH] 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 --- libwvdrmengine/cdm/core/include/properties.h | 1 + libwvdrmengine/cdm/core/src/license.cpp | 6 ++++++ libwvdrmengine/cdm/src/properties_android.cpp | 8 ++++++++ 3 files changed, 15 insertions(+) diff --git a/libwvdrmengine/cdm/core/include/properties.h b/libwvdrmengine/cdm/core/include/properties.h index a34dcde2..6fe200ea 100644 --- a/libwvdrmengine/cdm/core/include/properties.h +++ b/libwvdrmengine/cdm/core/include/properties.h @@ -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); diff --git a/libwvdrmengine/cdm/core/src/license.cpp b/libwvdrmengine/cdm/core/src/license.cpp index 3cab9e94..ad1da091 100644 --- a/libwvdrmengine/cdm/core/src/license.cpp +++ b/libwvdrmengine/cdm/core/src/license.cpp @@ -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(); diff --git a/libwvdrmengine/cdm/src/properties_android.cpp b/libwvdrmengine/cdm/src/properties_android.cpp index e8d2c10a..323f8e44 100644 --- a/libwvdrmengine/cdm/src/properties_android.cpp +++ b/libwvdrmengine/cdm/src/properties_android.cpp @@ -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) {