From 6272ba2dfeb6145f5e2e4dfc2f596b25abb45c5b Mon Sep 17 00:00:00 2001 From: Alex Dale Date: Wed, 18 Sep 2019 17:23:19 -0700 Subject: [PATCH] Fixed RemoveAllUsageInfo returned error code. [ Merge of http://go/wvgerrit/86444 ] When the CDM engine attemped to remove all usage information across both L1 and L3, a failure in L1 was being ignored if L3 removal succeeded. For this fix, L1 failure codes are prioritized over L3 failure codes (should both L1 and L3 fail). Bug: 141272019 Test: Linux unit test and Android unit tests Change-Id: I2df6d47a2a57c373c6c76903ab33ebbf649005b3 --- libwvdrmengine/cdm/core/src/cdm_engine.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/libwvdrmengine/cdm/core/src/cdm_engine.cpp b/libwvdrmengine/cdm/core/src/cdm_engine.cpp index 717c8c12..3e060cf0 100644 --- a/libwvdrmengine/cdm/core/src/cdm_engine.cpp +++ b/libwvdrmengine/cdm/core/src/cdm_engine.cpp @@ -1432,11 +1432,15 @@ CdmResponseType CdmEngine::RemoveAllUsageInfo( CdmResponseType CdmEngine::RemoveAllUsageInfo(const std::string& app_id) { LOGI("Removing all usage info: app_id = %s", app_id.c_str()); - CdmResponseType status_l1, status_l3; - status_l1 = status_l3 = NO_ERROR; - status_l1 = RemoveAllUsageInfo(app_id, kSecurityLevelL1); - status_l3 = RemoveAllUsageInfo(app_id, kSecurityLevelL3); - return (status_l3 == NO_ERROR) ? status_l3 : status_l1; + const CdmResponseType status_l1 = + RemoveAllUsageInfo(app_id, kSecurityLevelL1); + const CdmResponseType status_l3 = + RemoveAllUsageInfo(app_id, kSecurityLevelL3); + // Prioritizing L1 status. + if (status_l1 != NO_ERROR) { + return status_l1; + } + return status_l3; } CdmResponseType CdmEngine::RemoveUsageInfo(