MediaDrm API update
Clarify offline usage of sessions and keys and implement implement CryptoSession to support additional crypto use cases. Change-Id: I3788e7b187cd20c4224bf07f3fc6bef48ee38bd6
This commit is contained in:
@@ -48,18 +48,18 @@ status_t WVDrmPlugin::closeSession(const Vector<uint8_t>& sessionId) {
|
||||
}
|
||||
}
|
||||
|
||||
status_t WVDrmPlugin::getLicenseRequest(
|
||||
status_t WVDrmPlugin::getKeyRequest(
|
||||
const Vector<uint8_t>& sessionId,
|
||||
const Vector<uint8_t>& initData,
|
||||
const String8& mimeType,
|
||||
LicenseType licenseType,
|
||||
KeyType keyType,
|
||||
const KeyedVector<String8, String8>& optionalParameters,
|
||||
Vector<uint8_t>& request,
|
||||
String8& defaultUrl) {
|
||||
CdmLicenseType cdmLicenseType;
|
||||
if (licenseType == kLicenseType_Offline) {
|
||||
if (keyType == kKeyType_Offline) {
|
||||
cdmLicenseType = kLicenseTypeOffline;
|
||||
} else if (licenseType == kLicenseType_Streaming) {
|
||||
} else if (keyType == kKeyType_Streaming) {
|
||||
cdmLicenseType = kLicenseTypeStreaming;
|
||||
} else {
|
||||
return BAD_TYPE;
|
||||
@@ -100,9 +100,11 @@ status_t WVDrmPlugin::getLicenseRequest(
|
||||
return android::OK;
|
||||
}
|
||||
|
||||
status_t WVDrmPlugin::provideLicenseResponse(
|
||||
status_t WVDrmPlugin::provideKeyResponse(
|
||||
const Vector<uint8_t>& sessionId,
|
||||
const Vector<uint8_t>& response) {
|
||||
const Vector<uint8_t>& response,
|
||||
Vector<uint8_t>& keySetId) {
|
||||
// TODO: return keySetId for persisted offline content
|
||||
CdmSessionId cdmSessionId(sessionId.begin(), sessionId.end());
|
||||
CdmKeyResponse cdmResponse(response.begin(), response.end());
|
||||
|
||||
@@ -115,19 +117,18 @@ status_t WVDrmPlugin::provideLicenseResponse(
|
||||
}
|
||||
}
|
||||
|
||||
status_t WVDrmPlugin::removeLicense(const Vector<uint8_t>& sessionId) {
|
||||
CdmSessionId cdmSessionId(sessionId.begin(), sessionId.end());
|
||||
|
||||
CdmResponseType res = mCDM->CancelKeyRequest(cdmSessionId);
|
||||
|
||||
if (res == wvcdm::NO_ERROR) {
|
||||
return android::OK;
|
||||
} else {
|
||||
return android::UNKNOWN_ERROR;
|
||||
}
|
||||
status_t WVDrmPlugin::removeKeys(const Vector<uint8_t>& keySetId) {
|
||||
// TODO: remove persisted offline keys associated with keySetId
|
||||
return android::UNKNOWN_ERROR;
|
||||
}
|
||||
|
||||
status_t WVDrmPlugin::queryLicenseStatus(
|
||||
status_t WVDrmPlugin::restoreKeys(const Vector<uint8_t>& sessionId,
|
||||
const Vector<uint8_t>& keySetId) {
|
||||
// TODO: restore persisted offline keys associated with keySetId
|
||||
return android::UNKNOWN_ERROR;
|
||||
}
|
||||
|
||||
status_t WVDrmPlugin::queryKeyStatus(
|
||||
const Vector<uint8_t>& sessionId,
|
||||
KeyedVector<String8, String8>& infoMap) const {
|
||||
CdmSessionId cdmSessionId(sessionId.begin(), sessionId.end());
|
||||
@@ -179,7 +180,8 @@ status_t WVDrmPlugin::getProvisionRequest(Vector<uint8_t>& request,
|
||||
}
|
||||
|
||||
status_t WVDrmPlugin::provideProvisionResponse(
|
||||
const Vector<uint8_t>& response) {
|
||||
const Vector<uint8_t>& response) {
|
||||
|
||||
CdmProvisioningResponse cdmResponse(response.begin(), response.end());
|
||||
|
||||
CdmResponseType res = mCDM->HandleProvisioningResponse(cdmResponse);
|
||||
@@ -252,6 +254,54 @@ status_t WVDrmPlugin::setPropertyByteArray(const String8& name,
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
status_t WVDrmPlugin::setCipherAlgorithm(Vector<uint8_t> const &sessionId,
|
||||
String8 const &algorithm) {
|
||||
// TODO: Implement this function once the OEMCrypto API supports it
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
status_t WVDrmPlugin::setMacAlgorithm(Vector<uint8_t> const &sessionId,
|
||||
String8 const &algorithm) {
|
||||
// TODO: Implement this function once the OEMCrypto API supports it
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
status_t WVDrmPlugin::encrypt(Vector<uint8_t> const &sessionId,
|
||||
Vector<uint8_t> const &keyId,
|
||||
Vector<uint8_t> const &input,
|
||||
Vector<uint8_t> const &iv,
|
||||
Vector<uint8_t> &output) {
|
||||
// TODO: Implement this function once the OEMCrypto API supports it
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
status_t WVDrmPlugin::decrypt(Vector<uint8_t> const &sessionId,
|
||||
Vector<uint8_t> const &keyId,
|
||||
Vector<uint8_t> const &input,
|
||||
Vector<uint8_t> const &iv,
|
||||
Vector<uint8_t> &output) {
|
||||
// TODO: Implement this function once the OEMCrypto API supports it
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
status_t WVDrmPlugin::sign(Vector<uint8_t> const &sessionId,
|
||||
Vector<uint8_t> const &keyId,
|
||||
Vector<uint8_t> const &message,
|
||||
Vector<uint8_t> &signature) {
|
||||
// TODO: Implement this function once the OEMCrypto API supports it
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
status_t WVDrmPlugin::verify(Vector<uint8_t> const &sessionId,
|
||||
Vector<uint8_t> const &keyId,
|
||||
Vector<uint8_t> const &message,
|
||||
Vector<uint8_t> const &signature,
|
||||
bool &match) {
|
||||
// TODO: Implement this function once the OEMCrypto API supports it
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
|
||||
// TODO: Hook up to event listener methods on CDM once Android API for
|
||||
// eventing is finalized.
|
||||
} // namespace wvdrm
|
||||
|
||||
Reference in New Issue
Block a user