Remove Stale Licenses on Reprovisioning

Merges change 267713c (Remove stale licenses on reprovisioning) from
the Widevine CDM repository.  This change removes licenses belonging
to the previous provisioning when provisioning changes.

Bug: 9761923
Change-Id: I473816dd11dd950f4fb009b5b004630bd2d2b579
This commit is contained in:
John "Juce" Bruce
2013-08-08 14:57:40 -07:00
parent ba66224ef4
commit 0fa3e16999
13 changed files with 250 additions and 104 deletions

View File

@@ -11,6 +11,12 @@
namespace {
const char kBasePathPrefix[] = "/data/mediadrm/IDM";
const char kL1Dir[] = "/L1";
const char kL2Dir[] = "/L2";
const char kL3Dir[] = "/L3";
const char kFactoryKeyboxPath[] = "/factory/wv.keys";
bool GetAndroidProperty(const char* key, std::string* value) {
char val[PROPERTY_VALUE_MAX];
if (!key) {
@@ -81,13 +87,24 @@ bool Properties::GetBuildInfo(std::string* build_info) {
return GetAndroidProperty("ro.build.fingerprint", build_info);
}
bool Properties::GetDeviceFilesBasePath(std::string* base_path) {
bool Properties::GetDeviceFilesBasePath(CdmSecurityLevel security_level,
std::string* base_path) {
if (!base_path) {
LOGW("Properties::GetDeviceFilesBasePath: Invalid parameter");
return false;
}
std::stringstream ss;
ss << "/data/mediadrm/IDM" << getuid() << "/";
ss << kBasePathPrefix << getuid();
switch (security_level) {
case kSecurityLevelL1: ss << kL1Dir; break;
case kSecurityLevelL2: ss << kL2Dir; break;
case kSecurityLevelL3: ss << kL3Dir; break;
default:
LOGW("Properties::GetDeviceFilesBasePath: Unknown security level: %d",
security_level);
return false;
}
*base_path = ss.str();
return true;
}
@@ -97,7 +114,7 @@ bool Properties::GetFactoryKeyboxPath(std::string* keybox) {
LOGW("Properties::GetFactoryKeyboxPath: Invalid parameter");
return false;
}
*keybox = "/factory/wv.keys";
*keybox = kFactoryKeyboxPath;
return true;
}