Delete secure stops by key set ID.

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

Similar to the issue with updating secure stops by PST (see
http://go/wvgerrit/165597), when deleting different secure stops with
the same PST results in unintended behavior.  This CL changes how the
CDM identifies which secure stop to delete from storaged based on the
key set ID rather than the PST.

Bug: 263316107
Test: device_files_unittest
Test: GTS MediaDrmParameterizedTests and MediaDrmStressTest
Change-Id: Ic3843a1435f252f052c7189423c211c28ed74eaa
This commit is contained in:
Alex Dale
2023-02-07 22:32:24 -08:00
parent 080bfc7414
commit 2c05c65138
6 changed files with 16 additions and 23 deletions

View File

@@ -1128,7 +1128,7 @@ bool DeviceFiles::GetProviderSessionToken(const std::string& app_id,
}
bool DeviceFiles::DeleteUsageInfo(const std::string& usage_info_file_name,
const std::string& provider_session_token) {
const CdmKeySetId& key_set_id) {
RETURN_FALSE_IF_UNINITIALIZED();
video_widevine_client::sdk::File file;
if (RetrieveHashedFile(usage_info_file_name, &file) != kNoError) {
@@ -1140,17 +1140,19 @@ bool DeviceFiles::DeleteUsageInfo(const std::string& usage_info_file_name,
int index = 0;
bool found = false;
for (; index < usage_info->sessions_size(); ++index) {
if (usage_info->sessions(index).token() == provider_session_token) {
const auto& session = usage_info->sessions(index);
if (session.key_set_id() == key_set_id) {
found = true;
break;
}
}
if (!found) {
LOGE("Unable to find provider session token: pst = %s",
wvutil::b2a_hex(provider_session_token).c_str());
LOGE("Unable to find usage info: key_set_id = %s", IdToString(key_set_id));
return false;
}
LOGD("Deleting usage info: key_set_id = %s, pst = %s", IdToString(key_set_id),
wvutil::b2a_hex(usage_info->sessions(index).token()).c_str());
google::protobuf::RepeatedPtrField<UsageInfo_ProviderSession>* sessions =
usage_info->mutable_sessions();