Allow Resetting Device to L1 from L3
This change allows the security level, after it is forced from L1 to L3, to be reset back to L1 using the string "L1" instead of only allowing the reset string. (the empty string) Merge of https://widevine-internal-review.googlesource.com/#/c/8928/ from the widevine cdm repo. Bug: 10651521 Change-Id: I39797bb0a51b82db3543aec800a08ad36e11d661
This commit is contained in:
committed by
John Bruce
parent
0a2c9889b0
commit
55e8f29b40
@@ -462,8 +462,26 @@ status_t WVDrmPlugin::setPropertyString(const String8& name,
|
||||
if (mCryptoSessions.size() == 0) {
|
||||
if (value == QUERY_VALUE_SECURITY_LEVEL_L3.c_str()) {
|
||||
mPropertySet.set_security_level(QUERY_VALUE_SECURITY_LEVEL_L3);
|
||||
} else if (value == QUERY_VALUE_SECURITY_LEVEL_L1.c_str()) {
|
||||
// We must be sure we CAN set the security level to L1.
|
||||
CdmQueryMap status;
|
||||
CdmResponseType res = mCDM->QueryStatus(&status);
|
||||
if (!isCdmResponseTypeSuccess(res)) {
|
||||
ALOGE("Error querying CDM status: %u", res);
|
||||
return mapCdmResponseType(res);
|
||||
} else if (!status.count(QUERY_KEY_SECURITY_LEVEL)) {
|
||||
ALOGE("CDM did not report a security level");
|
||||
return kErrorCDMGeneric;
|
||||
}
|
||||
|
||||
if (status[QUERY_KEY_SECURITY_LEVEL] != QUERY_VALUE_SECURITY_LEVEL_L1) {
|
||||
ALOGE("App requested L1 security on a non-L1 device.");
|
||||
return android::BAD_VALUE;
|
||||
} else {
|
||||
mPropertySet.set_security_level(kResetSecurityLevel);
|
||||
}
|
||||
} else if (value == kResetSecurityLevel) {
|
||||
mPropertySet.set_security_level("");
|
||||
mPropertySet.set_security_level(kResetSecurityLevel);
|
||||
} else {
|
||||
ALOGE("App requested invalid security level %s", value.string());
|
||||
return android::BAD_VALUE;
|
||||
|
||||
Reference in New Issue
Block a user