am 7089b88d: am fa993b2b: am a3ae129f: Merge "metricsd: Update weave command APIs"

* commit '7089b88d86303f31bf687a5c0e01f604794bb48e':
  metricsd: Update weave command APIs
This commit is contained in:
Alex Vakulenko 2015-10-10 05:47:39 +00:00 committed by Android Git Automerger
commit c1d467c17a
1 changed files with 8 additions and 6 deletions

View File

@ -326,7 +326,7 @@ void MetricsDaemon::OnShutdown(int* return_code) {
}
void MetricsDaemon::OnWeaveCommand(CommandProxy* command) {
if (command->category() != "metrics" || command->status() != "queued") {
if (command->state() != "queued") {
return;
}
@ -342,24 +342,26 @@ void MetricsDaemon::OnEnableMetrics(CommandProxy* command) {
if (base::WriteFile(metrics_directory_.Append(metrics::kConsentFileName),
"", 0) != 0) {
PLOG(ERROR) << "Could not create the consent file.";
command->Abort(nullptr);
command->Abort("metrics_error", "Could not create the consent file",
nullptr);
return;
}
NotifyStateChanged();
command->Done(nullptr);
command->Complete({}, nullptr);
}
void MetricsDaemon::OnDisableMetrics(CommandProxy* command) {
if (!base::DeleteFile(metrics_directory_.Append(metrics::kConsentFileName),
false)) {
PLOG(ERROR) << "Cound not delete the consent file.";
command->Abort(nullptr);
PLOG(ERROR) << "Could not delete the consent file.";
command->Abort("metrics_error", "Could not delete the consent file",
nullptr);
return;
}
NotifyStateChanged();
command->Done(nullptr);
command->Complete({}, nullptr);
}
void MetricsDaemon::NotifyStateChanged() {