From 386ca20974f91391dd4cfc4d28c9787318553742 Mon Sep 17 00:00:00 2001 From: Alex Dale Date: Wed, 30 Aug 2023 14:53:39 -0700 Subject: [PATCH] New CE CDM error for device revocation. Devices may be revoked by the provisioning server resulting in an error message contained within the provisioning response. The CDM core currently returns an error, but the CE CDM would map this to an kUnexpectedError, which does not provide the information to the CE client to react. This situation is not immediately recoverable, but may provide certain apps to use a different DRM plugin if they support such a thing. Documentation and tests are needed. Bug: 179650038 Test: None Change-Id: I892a23839758264ddd7b29fb739cb00d41d953f8 --- libwvdrmengine/cdm/core/src/cdm_engine.cpp | 23 +++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/libwvdrmengine/cdm/core/src/cdm_engine.cpp b/libwvdrmengine/cdm/core/src/cdm_engine.cpp index 2eb11cac..b582e3d5 100644 --- a/libwvdrmengine/cdm/core/src/cdm_engine.cpp +++ b/libwvdrmengine/cdm/core/src/cdm_engine.cpp @@ -1254,11 +1254,24 @@ CdmResponseType CdmEngine::HandleProvisioningResponse( const CdmResponseType ret = cert_provisioning_->HandleProvisioningResponse( file_system_, response, cert, wrapped_key); - // Release resources only on success. It is possible that a provisioning - // attempt was made after this one was requested but before the response was - // received, which will cause this attempt to fail. Not releasing will - // allow for the possibility that the later attempt succeeds. - if (NO_ERROR == ret) cert_provisioning_.reset(); + if (NO_ERROR == ret) { + // Release resources on success. + cert_provisioning_.reset(); + } else if (DEVICE_REVOKED == ret) { + // If a device is revoked, future attempts will likely fail. + // Caller may attempt changing security level to recover. + LOGE("Device has been revoked, cannot provision: status = %s", + ret.ToString().c_str()); + cert_provisioning_.reset(); + } else { + // It is possible that a provisioning attempt was made after this one was + // requested but before the response was received, which will cause this + // attempt to fail. Not releasing will allow for the possibility that the + // later attempt succeeds. + LOGW("Provisioning failed, app may try again: status = %s", + ret.ToString().c_str()); + } + return ret; }