Reformat wv core/src files
[ Merge of http://go/wvgerrit/80484 ] Clang-format has been run on files in core/src. clang-format has been turned off for some blocks but otherwise no other changes have been made. Bug: 134365840 Test: WV unit/integration tests Change-Id: I6e509f25136f84d37de3d920084302f0f2c23dc4
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "device_files.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "file_store.h"
|
||||
@@ -31,20 +32,20 @@ using video_widevine_client::sdk::UsageTableInfo;
|
||||
using video_widevine_client::sdk::UsageTableInfo_UsageEntryInfo;
|
||||
using video_widevine_client::sdk::
|
||||
UsageTableInfo_UsageEntryInfo_UsageEntryStorage_LICENSE;
|
||||
using video_widevine_client::sdk::
|
||||
UsageTableInfo_UsageEntryInfo_UsageEntryStorage_USAGE_INFO;
|
||||
using video_widevine_client::sdk::
|
||||
UsageTableInfo_UsageEntryInfo_UsageEntryStorage_UNKNOWN;
|
||||
using video_widevine_client::sdk::
|
||||
UsageTableInfo_UsageEntryInfo_UsageEntryStorage_USAGE_INFO;
|
||||
|
||||
using video_widevine::SignedDrmDeviceCertificate;
|
||||
using video_widevine::DrmDeviceCertificate;
|
||||
using video_widevine::SignedDrmDeviceCertificate;
|
||||
|
||||
#define RETURN_FALSE_IF_NULL(PARAM) \
|
||||
if (PARAM == nullptr) { \
|
||||
LOGE("|PARAM| not provided"); \
|
||||
*result = kParameterNull; \
|
||||
return false; \
|
||||
}
|
||||
if (PARAM == nullptr) { \
|
||||
LOGE("|PARAM| not provided"); \
|
||||
*result = kParameterNull; \
|
||||
return false; \
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -107,8 +108,8 @@ bool DeviceFiles::StoreCertificate(const std::string& certificate,
|
||||
std::string serialized_file;
|
||||
file.SerializeToString(&serialized_file);
|
||||
|
||||
return
|
||||
StoreFileWithHash(GetCertificateFileName(), serialized_file) == kNoError;
|
||||
return StoreFileWithHash(GetCertificateFileName(), serialized_file) ==
|
||||
kNoError;
|
||||
}
|
||||
|
||||
bool DeviceFiles::RetrieveCertificate(std::string* certificate,
|
||||
@@ -161,8 +162,9 @@ bool DeviceFiles::ExtractDeviceInfo(const std::string& device_certificate,
|
||||
SignedDrmDeviceCertificate signed_drm_device_certificate;
|
||||
if (!signed_drm_device_certificate.ParseFromString(device_certificate) ||
|
||||
!signed_drm_device_certificate.has_drm_certificate()) {
|
||||
LOGE("DeviceFiles::ExtractDeviceInfo: fails parsing signed drm device "
|
||||
"certificate.");
|
||||
LOGE(
|
||||
"DeviceFiles::ExtractDeviceInfo: fails parsing signed drm device "
|
||||
"certificate.");
|
||||
return false;
|
||||
}
|
||||
DrmDeviceCertificate drm_device_certificate;
|
||||
@@ -170,8 +172,9 @@ bool DeviceFiles::ExtractDeviceInfo(const std::string& device_certificate,
|
||||
signed_drm_device_certificate.drm_certificate()) ||
|
||||
(drm_device_certificate.type() !=
|
||||
video_widevine::DrmDeviceCertificate::DRM_USER_DEVICE)) {
|
||||
LOGE("DeviceFiles::ExtractDeviceInfo: fails parsing drm device "
|
||||
"certificate message.");
|
||||
LOGE(
|
||||
"DeviceFiles::ExtractDeviceInfo: fails parsing drm device "
|
||||
"certificate message.");
|
||||
return false;
|
||||
}
|
||||
if (serial_number != NULL) {
|
||||
@@ -209,10 +212,8 @@ bool DeviceFiles::StoreLicense(
|
||||
const CdmKeyResponse& license_renewal,
|
||||
const std::string& release_server_url, int64_t playback_start_time,
|
||||
int64_t last_playback_time, int64_t grace_period_end_time,
|
||||
const CdmAppParameterMap& app_parameters,
|
||||
const CdmUsageEntry& usage_entry,
|
||||
const uint32_t usage_entry_number,
|
||||
ResponseType* result) {
|
||||
const CdmAppParameterMap& app_parameters, const CdmUsageEntry& usage_entry,
|
||||
const uint32_t usage_entry_number, ResponseType* result) {
|
||||
if (result == nullptr) {
|
||||
LOGE("DeviceFiles::StoreLicense: |result| not provided");
|
||||
return false;
|
||||
@@ -492,8 +493,7 @@ bool DeviceFiles::StoreUsageInfo(const std::string& provider_session_token,
|
||||
}
|
||||
|
||||
bool DeviceFiles::ListUsageIds(
|
||||
const std::string& app_id,
|
||||
std::vector<std::string>* ksids,
|
||||
const std::string& app_id, std::vector<std::string>* ksids,
|
||||
std::vector<std::string>* provider_session_tokens) {
|
||||
if (!initialized_) {
|
||||
LOGW("DeviceFiles::ListUsageIds: not initialized");
|
||||
@@ -718,12 +718,9 @@ bool DeviceFiles::RetrieveUsageInfo(const std::string& usage_info_file_name,
|
||||
}
|
||||
|
||||
bool DeviceFiles::RetrieveUsageInfoByKeySetId(
|
||||
const std::string& usage_info_file_name,
|
||||
const std::string& key_set_id,
|
||||
std::string* provider_session_token,
|
||||
CdmKeyMessage* license_request,
|
||||
CdmKeyResponse* license_response,
|
||||
std::string* usage_entry,
|
||||
const std::string& usage_info_file_name, const std::string& key_set_id,
|
||||
std::string* provider_session_token, CdmKeyMessage* license_request,
|
||||
CdmKeyResponse* license_response, std::string* usage_entry,
|
||||
uint32_t* usage_entry_number) {
|
||||
if (!initialized_) {
|
||||
LOGW("DeviceFiles::RetrieveUsageInfoByKeySetId: not initialized");
|
||||
@@ -798,7 +795,6 @@ bool DeviceFiles::UpdateUsageInfo(const std::string& usage_info_file_name,
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (RetrieveHashedFile(usage_info_file_name, &file) != kNoError) {
|
||||
LOGW("DeviceFiles::UpdateUsageInfo: Unable to retrieve file");
|
||||
return false;
|
||||
@@ -818,8 +814,8 @@ bool DeviceFiles::UpdateUsageInfo(const std::string& usage_info_file_name,
|
||||
|
||||
std::string serialized_file;
|
||||
file.SerializeToString(&serialized_file);
|
||||
return
|
||||
StoreFileWithHash(usage_info_file_name, serialized_file) == kNoError;
|
||||
return StoreFileWithHash(usage_info_file_name, serialized_file) ==
|
||||
kNoError;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -860,7 +856,7 @@ bool DeviceFiles::RetrieveUsageInfo(const std::string& usage_info_file_name,
|
||||
(*usage_data)[i].key_set_id = file.usage_info().sessions(i).key_set_id();
|
||||
(*usage_data)[i].usage_entry = file.usage_info().sessions(i).usage_entry();
|
||||
(*usage_data)[i].usage_entry_number =
|
||||
file.usage_info().sessions(i).usage_entry_number();
|
||||
file.usage_info().sessions(i).usage_entry_number();
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -928,8 +924,7 @@ bool DeviceFiles::ListUsageInfoFiles(
|
||||
std::string* name = &filenames[i];
|
||||
std::size_t pos_prefix = name->find(kUsageInfoFileNamePrefix);
|
||||
std::size_t pos_suffix = name->find(kUsageInfoFileNameExt);
|
||||
if (pos_prefix == std::string::npos ||
|
||||
pos_suffix == std::string::npos) {
|
||||
if (pos_prefix == std::string::npos || pos_suffix == std::string::npos) {
|
||||
// Skip this file - extension does not match
|
||||
continue;
|
||||
}
|
||||
@@ -1080,8 +1075,8 @@ bool DeviceFiles::StoreUsageTableInfo(
|
||||
std::string serialized_file;
|
||||
file.SerializeToString(&serialized_file);
|
||||
|
||||
return
|
||||
StoreFileWithHash(GetUsageTableFileName(), serialized_file) == kNoError;
|
||||
return StoreFileWithHash(GetUsageTableFileName(), serialized_file) ==
|
||||
kNoError;
|
||||
}
|
||||
|
||||
bool DeviceFiles::RetrieveUsageTableInfo(
|
||||
@@ -1160,8 +1155,7 @@ bool DeviceFiles::DeleteUsageTableInfo() {
|
||||
}
|
||||
|
||||
DeviceFiles::ResponseType DeviceFiles::StoreFileWithHash(
|
||||
const std::string& name,
|
||||
const std::string& serialized_file) {
|
||||
const std::string& name, const std::string& serialized_file) {
|
||||
std::string hash = Sha256Hash(serialized_file);
|
||||
|
||||
// Fill in hashed file data
|
||||
@@ -1176,8 +1170,7 @@ DeviceFiles::ResponseType DeviceFiles::StoreFileWithHash(
|
||||
}
|
||||
|
||||
DeviceFiles::ResponseType DeviceFiles::StoreFileRaw(
|
||||
const std::string& name,
|
||||
const std::string& serialized_file) {
|
||||
const std::string& name, const std::string& serialized_file) {
|
||||
std::string path;
|
||||
if (!Properties::GetDeviceFilesBasePath(security_level_, &path)) {
|
||||
LOGW("DeviceFiles::StoreFileRaw: Unable to get base path");
|
||||
@@ -1335,9 +1328,7 @@ std::string DeviceFiles::GetCertificateFileName() {
|
||||
return kCertificateFileName;
|
||||
}
|
||||
|
||||
std::string DeviceFiles::GetUsageTableFileName() {
|
||||
return kUsageTableFileName;
|
||||
}
|
||||
std::string DeviceFiles::GetUsageTableFileName() { return kUsageTableFileName; }
|
||||
|
||||
std::string DeviceFiles::GetHlsAttributesFileNameExtension() {
|
||||
return kHlsAttributesFileNameExt;
|
||||
|
||||
Reference in New Issue
Block a user