wv_factory_extraction_tool: extract provision 4.0 csr
Bug: 231677822 Test: adb shell wv_factory_extraction_tool csr Change-Id: I9f21514b027261f1d69c24a4d2f54051ccaac9a5
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
// Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary
|
||||
// source code may only be used and distributed under the Widevine License
|
||||
// Agreement.
|
||||
|
||||
#include <android-base/properties.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include "log.h"
|
||||
#include "properties.h"
|
||||
|
||||
namespace {
|
||||
|
||||
bool GetAndroidProperty(const char* key, std::string* value) {
|
||||
if (!key) {
|
||||
LOGW("GetAndroidProperty: Invalid property key parameter");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!value) {
|
||||
LOGW("GetAndroidProperty: Invalid property value parameter");
|
||||
return false;
|
||||
}
|
||||
|
||||
*value = android::base::GetProperty(key, "");
|
||||
|
||||
return value->size() > 0;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace wvcdm {
|
||||
|
||||
bool Properties::GetCompanyName(std::string* company_name) {
|
||||
if (!company_name) {
|
||||
LOGW("Properties::GetCompanyName: Invalid parameter");
|
||||
return false;
|
||||
}
|
||||
return GetAndroidProperty("ro.product.manufacturer", company_name);
|
||||
}
|
||||
|
||||
bool Properties::GetModelName(std::string* model_name) {
|
||||
if (!model_name) {
|
||||
LOGW("Properties::GetModelName: Invalid parameter");
|
||||
return false;
|
||||
}
|
||||
return GetAndroidProperty("ro.product.model", model_name);
|
||||
}
|
||||
|
||||
bool Properties::GetArchitectureName(std::string* arch_name) {
|
||||
if (!arch_name) {
|
||||
LOGW("Properties::GetArchitectureName: Invalid parameter");
|
||||
return false;
|
||||
}
|
||||
return GetAndroidProperty("ro.product.cpu.abi", arch_name);
|
||||
}
|
||||
|
||||
bool Properties::GetDeviceName(std::string* device_name) {
|
||||
if (!device_name) {
|
||||
LOGW("Properties::GetDeviceName: Invalid parameter");
|
||||
return false;
|
||||
}
|
||||
return GetAndroidProperty("ro.product.device", device_name);
|
||||
}
|
||||
|
||||
bool Properties::GetProductName(std::string* product_name) {
|
||||
if (!product_name) {
|
||||
LOGW("Properties::GetProductName: Invalid parameter");
|
||||
return false;
|
||||
}
|
||||
return GetAndroidProperty("ro.product.name", product_name);
|
||||
}
|
||||
|
||||
bool Properties::GetBuildInfo(std::string* build_info) {
|
||||
if (!build_info) {
|
||||
LOGW("Properties::GetBuildInfo: Invalid parameter");
|
||||
return false;
|
||||
}
|
||||
return GetAndroidProperty("ro.build.fingerprint", build_info);
|
||||
}
|
||||
|
||||
bool Properties::GetOEMCryptoPath(std::string* library_name) {
|
||||
if (!library_name) {
|
||||
LOGW("Properties::GetOEMCryptoPath: Invalid parameter");
|
||||
return false;
|
||||
}
|
||||
*library_name = "liboemcrypto.so";
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace wvcdm
|
||||
Reference in New Issue
Block a user