Adds a VersionInfo message to SignedMessage

[ Merge from http://go/wvgerrit/72724 ]

This adds a message that contains SDK and service version information
useful for debugging problems that occur because of different services.

BUG: 80536436

Test: Unit tests and manual GPlay testing.
Change-Id: I095f893b907ea7c2cd149155fb2cd4c7181e7bb2
This commit is contained in:
Adam Stone
2019-02-14 17:10:19 -08:00
parent 741645a4be
commit c891824a7a
10 changed files with 56 additions and 1 deletions

View File

@@ -17,6 +17,7 @@
namespace video_widevine {
class SignedMessage;
class LicenseRequest;
class VersionInfo;
} // namespace video_widevine
namespace wvcdm {
@@ -29,6 +30,7 @@ class CryptoKey;
using ::google::protobuf::RepeatedPtrField;
using video_widevine::License_KeyContainer;
using video_widevine::VersionInfo;
using video_widevine::WidevinePsshData_EntitledKey;
class CdmLicense {
@@ -75,6 +77,10 @@ class CdmLicense {
virtual bool is_offline() { return is_offline_; }
virtual const VersionInfo& GetServiceVersion() {
return latest_service_version_;
}
static bool ExtractProviderSessionToken(
const CdmKeyResponse& license_response,
std::string* provider_session_token);
@@ -152,6 +158,9 @@ class CdmLicense {
RepeatedPtrField<License_KeyContainer> entitlement_keys_;
std::string provider_client_token_;
// This is the latest version info extracted from the SignedMessage in
// HandleKeyResponse
VersionInfo latest_service_version_;
#if defined(UNIT_TEST)
friend class CdmLicenseTestPeer;

View File

@@ -515,6 +515,11 @@ CdmResponseType CdmSession::AddKeyInternal(const CdmKeyResponse& key_response) {
}
sts = license_parser_->HandleKeyResponse(key_response);
// Update the license sdk and service versions.
const VersionInfo& version_info = license_parser_->GetServiceVersion();
metrics_->license_sdk_version_.Record(version_info.license_sdk_version());
metrics_->license_sdk_version_.Record(version_info.license_service_version());
// Update or delete entry if usage table header+entries are supported
if (usage_support_type_ == kUsageEntrySupport &&
!provider_session_token.empty() && usage_table_header_ != NULL) {

View File

@@ -514,6 +514,9 @@ CdmResponseType CdmLicense::HandleKeyResponse(
LOGE("CdmLicense::HandleKeyResponse: not initialized");
return LICENSE_PARSER_NOT_INITIALIZED_2;
}
// Clear the latest service version when we receive a new response.
latest_service_version_.Clear();
if (license_response.empty()) {
LOGE("CdmLicense::HandleKeyResponse: empty license response");
return EMPTY_LICENSE_RESPONSE_1;
@@ -527,6 +530,8 @@ CdmResponseType CdmLicense::HandleKeyResponse(
return INVALID_LICENSE_RESPONSE;
}
latest_service_version_ = signed_response.service_version_info();
if (use_privacy_mode_ && Properties::allow_service_certificate_requests() &&
signed_response.type() == SignedMessage::SERVICE_CERTIFICATE) {
std::string signed_certificate;

View File

@@ -390,6 +390,13 @@ message RemoteAttestation {
optional bytes signature = 3;
}
message VersionInfo {
// License SDK version reported by the Widevine License SDK.
optional string license_sdk_version = 1;
// Version of the service hosting the license SDK.
optional string license_service_version = 2;
}
message SignedMessage {
enum MessageType {
LICENSE_REQUEST = 1;
@@ -412,6 +419,9 @@ message SignedMessage {
optional RemoteAttestation remote_attestation = 5;
repeated MetricData metric_data = 6;
// Version information from the SDK and license service. This information is
// provided in the license response.
optional VersionInfo service_version_info = 7;
}
message GroupKeys {
enum GroupLicenseVersion {