Allow Secure Stops to be queried and deleted by application ID
This CL changes the WVDrmPlugin so that an application can segregate its secure stops from those of other applications by setting an application ID. This CL is a merge of the following Widevine CLs: https://widevine-internal-review.googlesource.com/#/c/11565/ Add getSecureStop by ssid https://widevine-internal-review.googlesource.com/#/c/11572 Add getSecureStop by SSID and releaseAllSecureStops by app id. https://widevine-internal-review.googlesource.com/#/c/11564/ Store Usage Info by App Id (device_file stubs) https://widevine-internal-review.googlesource.com/#/c/11563/ Add application id to StoreUsageInfo. https://widevine-internal-review.googlesource.com/#/c/11561/ Added Application ID to PropertySet for secure stop. bug: 18053197 bug: 18076411 Change-Id: I5444baf67ba1b960dee2dc958bced8de82ab70a3
This commit is contained in:
@@ -23,7 +23,6 @@ namespace {
|
||||
static const char* const kResetSecurityLevel = "";
|
||||
static const char* const kEnable = "enable";
|
||||
static const char* const kDisable = "disable";
|
||||
|
||||
static const std::string kPsshTag = "pssh";
|
||||
}
|
||||
|
||||
@@ -394,9 +393,30 @@ status_t WVDrmPlugin::unprovisionDevice() {
|
||||
}
|
||||
}
|
||||
|
||||
status_t WVDrmPlugin::getSecureStop(const Vector<uint8_t>& ssid,
|
||||
Vector<uint8_t>& secureStop) {
|
||||
CdmUsageInfo cdmUsageInfo;
|
||||
CdmSecureStopId cdmSsid(ssid.begin(), ssid.end());
|
||||
CdmResponseType res = mCDM->GetUsageInfo(
|
||||
mPropertySet.app_id(), cdmSsid, &cdmUsageInfo);
|
||||
if (isCdmResponseTypeSuccess(res)) {
|
||||
secureStop.clear();
|
||||
for (CdmUsageInfo::const_iterator iter = cdmUsageInfo.begin();
|
||||
iter != cdmUsageInfo.end();
|
||||
++iter) {
|
||||
const string& cdmStop = *iter;
|
||||
|
||||
secureStop.appendArray(reinterpret_cast<const uint8_t*>(cdmStop.data()),
|
||||
cdmStop.size());
|
||||
}
|
||||
}
|
||||
return mapCdmResponseType(res);
|
||||
}
|
||||
|
||||
status_t WVDrmPlugin::getSecureStops(List<Vector<uint8_t> >& secureStops) {
|
||||
CdmUsageInfo cdmUsageInfo;
|
||||
CdmResponseType res = mCDM->GetUsageInfo(&cdmUsageInfo);
|
||||
CdmResponseType res =
|
||||
mCDM->GetUsageInfo(mPropertySet.app_id(), &cdmUsageInfo);
|
||||
if (isCdmResponseTypeSuccess(res)) {
|
||||
secureStops.clear();
|
||||
for (CdmUsageInfo::const_iterator iter = cdmUsageInfo.begin();
|
||||
@@ -414,6 +434,11 @@ status_t WVDrmPlugin::getSecureStops(List<Vector<uint8_t> >& secureStops) {
|
||||
return mapCdmResponseType(res);
|
||||
}
|
||||
|
||||
status_t WVDrmPlugin::releaseAllSecureStops() {
|
||||
CdmResponseType res = mCDM->ReleaseAllUsageInfo(mPropertySet.app_id());
|
||||
return mapCdmResponseType(res);
|
||||
}
|
||||
|
||||
status_t WVDrmPlugin::releaseSecureStops(const Vector<uint8_t>& ssRelease) {
|
||||
CdmUsageInfoReleaseMessage cdmMessage(ssRelease.begin(), ssRelease.end());
|
||||
CdmResponseType res = mCDM->ReleaseUsageInfo(cdmMessage);
|
||||
@@ -628,6 +653,18 @@ status_t WVDrmPlugin::setPropertyString(const String8& name,
|
||||
ALOGE("App tried to change key sharing while sessions are open.");
|
||||
return kErrorSessionIsOpen;
|
||||
}
|
||||
} else if (name == "appId") {
|
||||
size_t sessionCount = 0;
|
||||
{
|
||||
Mutex::Autolock lock(mCryptoSessionsMutex);
|
||||
sessionCount = mCryptoSessions.size();
|
||||
}
|
||||
if (sessionCount == 0) {
|
||||
mPropertySet.set_app_id(value.string());
|
||||
} else {
|
||||
ALOGE("App tried to set the application id while sessions are opened.");
|
||||
return kErrorSessionIsOpen;
|
||||
}
|
||||
} else {
|
||||
ALOGE("App set unknown string property %s", name.string());
|
||||
return android::ERROR_DRM_CANNOT_HANDLE;
|
||||
|
||||
Reference in New Issue
Block a user