Handle unlimited usage table capacity.
[ Merge of http://go/wvgerrit/102945 ] The OEMCrypto method for usage table capacity can return zero to indicate that the usage table size is not explicitly limited. The CDM must handle this case with regard to the CDM's usage table management and information querying. The usage table initialization tests are extended to include cases where the table does not have a defined limit. AddEntry() was missing call to update the usage table header after creating a new usage entry. This call is now included and required additional changes to the usage table unit tests. Bug: 160560364 Test: Android unit tests Change-Id: Ica5d181092d2938d24deba5005a211ca883cb0f0
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
@@ -696,6 +697,12 @@ CdmResponseType CdmEngine::QueryStatus(SecurityLevel security_level,
|
||||
LOGW("GetMaxUsageTableEntries failed");
|
||||
return UNKNOWN_ERROR;
|
||||
}
|
||||
if (max_number_of_usage_entries == 0) {
|
||||
// Zero indicates that the table is dynamically allocated and does
|
||||
// not have a defined limit. Setting to max value of int32_t to
|
||||
// be able to fit into a Java int.
|
||||
max_number_of_usage_entries = std::numeric_limits<int32_t>::max();
|
||||
}
|
||||
*query_response = std::to_string(max_number_of_usage_entries);
|
||||
return NO_ERROR;
|
||||
} else if (query_token == QUERY_KEY_OEMCRYPTO_API_MINOR_VERSION) {
|
||||
|
||||
Reference in New Issue
Block a user