Implement MediaDrm offline license support in Widevine hidl service.

Merged from http://go/wvgerrit/69723.

The new APIs are getOfflineLicenseIds, getOfflineLicenseState and
removeOfflineLicense. These methods are currently stubbed out in
Widevine hidl service. This CL completes the implementation.

Test: unit tests - libwvdrmdrmplugin_hidl_test

Test: GTS
  --test com.google.android.media.gts.MediaDrmTest#testWidevineApi29

bug: 117570686
Change-Id: I96ffb75f453e36e931effefd3664b5faa8d69d30
This commit is contained in:
Edwin Wong
2019-01-21 17:07:43 -08:00
parent 19c4996b3c
commit 54104c7a22
12 changed files with 462 additions and 30 deletions

View File

@@ -212,6 +212,17 @@ class CdmEngine {
CdmSecurityLevel security_level,
const std::string& key_set_id);
// Get offline license status: active, release or unknown
virtual CdmResponseType GetOfflineLicenseState(
const std::string& key_set_id,
CdmSecurityLevel security_level,
CdmOfflineLicenseState* license_state);
// Remove offline license with the given key_set_id
virtual CdmResponseType RemoveOfflineLicense(
const std::string& key_set_id,
CdmSecurityLevel security_level);
// Usage related methods for streaming licenses
// Retrieve a random usage info from the list of all usage infos for this app
// id.

View File

@@ -194,7 +194,7 @@ class CdmSession {
const std::string& signature);
virtual CdmResponseType SetDecryptHash(uint32_t frame_number,
const std::string& hash);
const std::string& hash);
virtual CdmResponseType GetDecryptHashError(std::string* hash_error_string);

View File

@@ -91,6 +91,7 @@ class DeviceFiles {
const CdmUsageEntry& usage_entry,
uint32_t usage_entry_number,
ResponseType* result);
virtual bool RetrieveLicense(
const std::string& key_set_id, LicenseState* state,
CdmInitData* pssh_data, CdmKeyMessage* key_request,

View File

@@ -40,6 +40,12 @@ enum CdmKeyRequestType {
kKeyRequestTypeRelease,
};
enum CdmOfflineLicenseState {
kLicenseStateActive,
kLicenseStateReleasing,
kLicenseStateUnknown,
};
enum CdmResponseType {
NO_ERROR = 0,
UNKNOWN_ERROR = 1,
@@ -355,6 +361,11 @@ enum CdmResponseType {
INVALID_LICENSE_TYPE_2 = 310,
SIGNATURE_NOT_FOUND_2 = 311,
SESSION_KEYS_NOT_FOUND_2 = 312,
GET_OFFLINE_LICENSE_STATE_ERROR_1 = 313,
GET_OFFLINE_LICENSE_STATE_ERROR_2 = 314,
REMOVE_OFFLINE_LICENSE_ERROR_1 = 315,
REMOVE_OFFLINE_LICENSE_ERROR_2 = 316,
SESSION_NOT_FOUND_21 = 317,
// Don't forget to add new values to ../test/test_printers.cpp.
};