Merge "Fix incorrect error returns from DRM plugin" into ics-mr0

This commit is contained in:
Jeffrey Tinker
2011-10-18 19:14:58 -07:00
committed by Android (Google) Code Review
8 changed files with 11 additions and 3 deletions

View File

@@ -63,7 +63,7 @@ class WVDRMPluginAPI {
virtual bool RemoveRights(std::string &path) = 0;
virtual bool RemoveAllRights() = 0;
virtual bool Prepare(char *data, int len) = 0;
virtual bool Operate(char *in, char *out, int len, char *iv) = 0;
virtual int Operate(char *in, char *out, int len, char *iv) = 0;
enum EventType {
EventType_AcquireDrmInfoFailed,

View File

@@ -854,10 +854,18 @@ status_t WVMDrmPlugin::onDecrypt(int uniqueId, DecryptHandle* decryptHandle, int
(*decBuffer)->length = encBuffer->length;
if (!mDrmPluginImpl->Operate(encBuffer->data, (*decBuffer)->data, encBuffer->length, iv)) {
int status;
status = mDrmPluginImpl->Operate(encBuffer->data, (*decBuffer)->data, encBuffer->length, iv);
if (status != WVDRMPluginAPI::RIGHTS_VALID) {
(*decBuffer)->length = 0;
usleep(1000000); // prevent spinning
return DRM_ERROR_LICENSE_EXPIRED;
if (status == WVDRMPluginAPI::RIGHTS_NOT_ACQUIRED) {
return DRM_ERROR_NO_LICENSE;
} else if (status == WVDRMPluginAPI::RIGHTS_EXPIRED) {
return DRM_ERROR_LICENSE_EXPIRED;
} else if (status == WVDRMPluginAPI::RIGHTS_INVALID) {
return DRM_ERROR_DECRYPT;
}
}
return DRM_NO_ERROR;