Suppress error for removing lingering offline licenses.

[ Merge of http://go/wvgerrit/97963 ]

There are situations where an offline license file will remain on the
system after it's usage entry has been deleted.  This would result in
its key set ID being reported as present by the CDM, but any
operations acting upon it will result in an error.

The app should be able to remove the license without error, so long
as the license file exists and no other OEMCrypto operations fail.

This change introduces a new error code LICENSE_USAGE_ENTRY_MISSING,
which indicates that a license's usage entry cannot be found.

A new integration test checks that the CDM can handle the calls to
removeOfflineLicense().

Bug: 137034719
Test: Android unit and integration tests
Change-Id: Ibdbe963b7f7e3ac97b446300d8e3896cdee7abc5
This commit is contained in:
Alex Dale
2020-04-13 14:27:20 -07:00
parent e27bc4ba6a
commit 2a16d70a06
9 changed files with 160 additions and 7 deletions

View File

@@ -233,6 +233,12 @@ class CdmSession {
virtual CdmResponseType AddKeyInternal(const CdmKeyResponse& key_response);
void UpdateRequestLatencyTiming(CdmResponseType sts);
// Checks that the usage entry in the usage table header matches the
// information of the currently loaded license for this session.
// Returns false if there is any unexpected mismatch of information,
// true otherwise.
bool VerifyOfflineUsageEntry();
// These setters are for testing only. Takes ownership of the pointers.
void set_license_parser(CdmLicense* license_parser);
void set_crypto_session(CryptoSession* crypto_session);

View File

@@ -411,6 +411,7 @@ enum CdmResponseType {
LOAD_USAGE_ENTRY_INVALID_SESSION = 357,
MOVE_USAGE_ENTRY_DESTINATION_IN_USE = 358,
SHRINK_USAGE_TABLE_HEADER_ENTRY_IN_USE = 359,
LICENSE_USAGE_ENTRY_MISSING = 360,
// Don't forget to add new values to
// * core/test/test_printers.cpp.
// * android/include/mapErrors-inl.h