Ran clang-format on android/cdm/ files.

[ Merge of http://go/wvgerrit/87123 ]

Certain android files have yet to be formated since we introduced
clang-formatting.

Test: built for android
Bug: 134365840
Change-Id: Ia316b039e7469f7cf803464ee95a919fe7966450
This commit is contained in:
Alex Dale
2019-10-02 11:55:27 -07:00
parent 78e84dcd3b
commit bdcb79a442
13 changed files with 1023 additions and 1081 deletions

View File

@@ -8,59 +8,40 @@
namespace wvcdm {
AmiAdapter::AmiAdapter() :
analytics_item_("widevine") {
AmiAdapter::AmiAdapter() : analytics_item_("widevine") {
analytics_item_.generateSessionID();
}
AmiAdapter::AmiAdapter(int64_t parent) :
analytics_item_("widevine") {
AmiAdapter::AmiAdapter(int64_t parent) : analytics_item_("widevine") {
analytics_item_.generateSessionID();
analytics_item_.setInt64("/drm/widevine/parent/external", parent);
}
AmiAdapter::~AmiAdapter() {
analytics_item_.selfrecord();
}
AmiAdapter::~AmiAdapter() { analytics_item_.selfrecord(); }
void AmiAdapter::UpdateString(const std::string& metric_id,
const std::string& value) {
analytics_item_.setCString(metric_id.c_str(), value.c_str());
LOGV(
"AmiAdapter (%lld) %s : %s",
analytics_item_.getSessionID(),
metric_id.c_str(),
value.c_str());
LOGV("AmiAdapter (%lld) %s : %s", analytics_item_.getSessionID(),
metric_id.c_str(), value.c_str());
}
void AmiAdapter::UpdateInt32(const std::string& metric_id,
int32_t value) {
void AmiAdapter::UpdateInt32(const std::string& metric_id, int32_t value) {
analytics_item_.setInt32(metric_id.c_str(), value);
LOGV(
"AmiAdapter (%lld) %s : %ld",
analytics_item_.getSessionID(),
metric_id.c_str(),
value);
LOGV("AmiAdapter (%lld) %s : %ld", analytics_item_.getSessionID(),
metric_id.c_str(), value);
}
void AmiAdapter::UpdateInt64(const std::string& metric_id,
int64_t value) {
void AmiAdapter::UpdateInt64(const std::string& metric_id, int64_t value) {
analytics_item_.setInt64(metric_id.c_str(), value);
LOGV(
"AmiAdapter (%lld) %s : %lld",
analytics_item_.getSessionID(),
metric_id.c_str(),
value);
LOGV("AmiAdapter (%lld) %s : %lld", analytics_item_.getSessionID(),
metric_id.c_str(), value);
}
void AmiAdapter::UpdateDouble(const std::string& metric_id,
double value) {
void AmiAdapter::UpdateDouble(const std::string& metric_id, double value) {
analytics_item_.setDouble(metric_id.c_str(), value);
LOGV(
"AmiAdapter (%lld) %s : %f",
analytics_item_.getSessionID(),
metric_id.c_str(),
value);
LOGV("AmiAdapter (%lld) %s : %f", analytics_item_.getSessionID(),
metric_id.c_str(), value);
}
} // namespace wvcdm

View File

@@ -121,9 +121,15 @@ bool Properties::GetDeviceFilesBasePath(CdmSecurityLevel security_level,
std::stringstream ss;
ss << kBasePathPrefix << getuid();
switch (security_level) {
case kSecurityLevelL1: ss << kL1Dir; break;
case kSecurityLevelL2: ss << kL2Dir; break;
case kSecurityLevelL3: ss << kL3Dir; break;
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);
@@ -163,12 +169,8 @@ bool Properties::GetSandboxId(std::string* /* sandbox_id */) {
return false;
}
bool Properties::AlwaysUseKeySetIds() {
return false;
}
bool Properties::AlwaysUseKeySetIds() { return false; }
bool Properties::UseProviderIdInProvisioningRequest() {
return false;
}
bool Properties::UseProviderIdInProvisioningRequest() { return false; }
} // namespace wvcdm

View File

@@ -20,21 +20,21 @@ class Timer::Impl : virtual public android::RefBase {
class ImplThread : public android::Thread {
public:
ImplThread() : Thread(false), handler_(nullptr), period_ns_(0) {}
virtual ~ImplThread() {};
virtual ~ImplThread() {}
bool Start(TimerHandler *handler, uint32_t time_in_secs) {
bool Start(TimerHandler* handler, uint32_t time_in_secs) {
handler_ = handler;
period_ns_ = time_in_secs * 1000000000ll;
return run("wvcdm::Timer::Impl") == android::NO_ERROR;
}
void Stop() {
{
android::Mutex::Autolock autoLock(lock_);
stop_condition_.signal();
}
requestExitAndWait();
}
void Stop() {
{
android::Mutex::Autolock autoLock(lock_);
stop_condition_.signal();
}
requestExitAndWait();
}
private:
virtual bool threadLoop() {
@@ -44,7 +44,7 @@ class Timer::Impl : virtual public android::RefBase {
return true;
}
TimerHandler *handler_;
TimerHandler* handler_;
uint64_t period_ns_;
android::Mutex lock_;
android::Condition stop_condition_;
@@ -56,9 +56,9 @@ class Timer::Impl : virtual public android::RefBase {
public:
Impl() {}
virtual ~Impl() {};
virtual ~Impl(){};
bool Start(TimerHandler *handler, uint32_t time_in_secs) {
bool Start(TimerHandler* handler, uint32_t time_in_secs) {
impl_thread_ = new ImplThread();
return impl_thread_->Start(handler, time_in_secs);
}
@@ -75,27 +75,20 @@ class Timer::Impl : virtual public android::RefBase {
CORE_DISALLOW_COPY_AND_ASSIGN(Impl);
};
Timer::Timer() : impl_(new Timer::Impl()) {
}
Timer::Timer() : impl_(new Timer::Impl()) {}
Timer::~Timer() {
if (IsRunning())
Stop();
if (IsRunning()) Stop();
}
bool Timer::Start(TimerHandler *handler, uint32_t time_in_secs) {
if (!handler || time_in_secs == 0)
return false;
bool Timer::Start(TimerHandler* handler, uint32_t time_in_secs) {
if (!handler || time_in_secs == 0) return false;
return impl_->Start(handler, time_in_secs);
}
void Timer::Stop() {
impl_->Stop();
}
void Timer::Stop() { impl_->Stop(); }
bool Timer::IsRunning() {
return impl_->IsRunning();
}
bool Timer::IsRunning() { return impl_->IsRunning(); }
} // namespace wvcdm
} // namespace wvcdm

View File

@@ -106,16 +106,14 @@ CdmResponseType WvContentDecryptionModule::GenerateKeyRequest(
}
const SecurityLevel requested_security_level =
property_set &&
property_set->security_level().compare(
wvcdm::QUERY_VALUE_SECURITY_LEVEL_L3) == 0
property_set && property_set->security_level().compare(
wvcdm::QUERY_VALUE_SECURITY_LEVEL_L3) == 0
? wvcdm::kLevel3
: wvcdm::kLevelDefault;
std::string oec_version;
sts = cdm_engine->QueryStatus(requested_security_level,
QUERY_KEY_OEMCRYPTO_API_VERSION,
&oec_version);
QUERY_KEY_OEMCRYPTO_API_VERSION, &oec_version);
if (sts != NO_ERROR) {
return sts;
}
@@ -258,8 +256,7 @@ CdmResponseType WvContentDecryptionModule::RemoveAllUsageInfo(
}
CdmResponseType WvContentDecryptionModule::RemoveUsageInfo(
const std::string& app_id,
const CdmIdentifier& identifier,
const std::string& app_id, const CdmIdentifier& identifier,
const CdmSecureStopId& secure_stop_id) {
CdmEngine* cdm_engine = EnsureCdmForIdentifier(identifier);
return cdm_engine->RemoveUsageInfo(app_id, secure_stop_id);
@@ -273,12 +270,12 @@ CdmResponseType WvContentDecryptionModule::ReleaseUsageInfo(
}
CdmResponseType WvContentDecryptionModule::GetSecureStopIds(
const std::string& app_id,
const CdmIdentifier& identifier,
const std::string& app_id, const CdmIdentifier& identifier,
std::vector<CdmSecureStopId>* ssids) {
if (ssids == nullptr) {
LOGE("WvContentDecryptionModule::GetSecureStopIds: ssid destination not "
"provided");
LOGE(
"WvContentDecryptionModule::GetSecureStopIds: "
"ssid destination not provided");
return PARAMETER_NULL;
}
@@ -337,7 +334,6 @@ bool WvContentDecryptionModule::IsValidServiceCertificate(
return cert.has_certificate();
}
CdmResponseType WvContentDecryptionModule::GetMetrics(
const CdmIdentifier& identifier, drm_metrics::WvCdmMetrics* metrics) {
if (!metrics) {
@@ -350,8 +346,8 @@ CdmResponseType WvContentDecryptionModule::GetMetrics(
// TODO(blueeyes): Add a better error.
return UNKNOWN_ERROR;
}
return it->second.cdm_engine->GetMetricsSnapshot(metrics) ?
NO_ERROR : UNKNOWN_ERROR;
return it->second.cdm_engine->GetMetricsSnapshot(metrics) ? NO_ERROR
: UNKNOWN_ERROR;
}
WvContentDecryptionModule::CdmInfo::CdmInfo()
@@ -453,13 +449,13 @@ CdmResponseType WvContentDecryptionModule::SetDecryptHash(
}
CdmResponseType WvContentDecryptionModule::GetDecryptHashError(
const CdmSessionId& session_id,
std::string* hash_error_string) {
const CdmSessionId& session_id, std::string* hash_error_string) {
CdmEngine* cdm_engine = GetCdmForSessionId(session_id);
if (!cdm_engine) {
LOGE("WVContentDecryptionModule::GetDecryptHashError: Unable to find "
"CdmEngine");
LOGE(
"WVContentDecryptionModule::GetDecryptHashError: "
"Unable to find CdmEngine");
return SESSION_NOT_FOUND_20;
}
return cdm_engine->GetDecryptHashError(session_id, hash_error_string);
@@ -491,31 +487,25 @@ uint32_t WvContentDecryptionModule::GenerateSessionSharingId() {
}
CdmResponseType WvContentDecryptionModule::ListStoredLicenses(
CdmSecurityLevel security_level,
const CdmIdentifier& identifier,
CdmSecurityLevel security_level, const CdmIdentifier& identifier,
std::vector<CdmKeySetId>* key_set_ids) {
CdmEngine* cdm_engine = EnsureCdmForIdentifier(identifier);
return cdm_engine->ListStoredLicenses(
security_level, key_set_ids);
return cdm_engine->ListStoredLicenses(security_level, key_set_ids);
}
CdmResponseType WvContentDecryptionModule::GetOfflineLicenseState(
const CdmKeySetId& key_set_id,
CdmSecurityLevel security_level,
const CdmIdentifier& identifier,
CdmOfflineLicenseState* license_state) {
const CdmKeySetId& key_set_id, CdmSecurityLevel security_level,
const CdmIdentifier& identifier, CdmOfflineLicenseState* license_state) {
CdmEngine* cdm_engine = EnsureCdmForIdentifier(identifier);
return cdm_engine->GetOfflineLicenseState(
key_set_id, security_level, license_state);
return cdm_engine->GetOfflineLicenseState(key_set_id, security_level,
license_state);
}
CdmResponseType WvContentDecryptionModule::RemoveOfflineLicense(
const CdmKeySetId& key_set_id,
CdmSecurityLevel security_level,
const CdmKeySetId& key_set_id, CdmSecurityLevel security_level,
const CdmIdentifier& identifier) {
CdmEngine* cdm_engine = EnsureCdmForIdentifier(identifier);
return cdm_engine->RemoveOfflineLicense(
key_set_id, security_level);
return cdm_engine->RemoveOfflineLicense(key_set_id, security_level);
}
} // namespace wvcdm