blob: 4a579181b2270117ae6560fd74a36c947e685537 [file] [log] [blame]
Tianjie Xu1b661142017-09-28 14:03:42 -07001//
2// Copyright (C) 2017 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17#include "update_engine/metrics_reporter_android.h"
18
19#ifndef _UE_SIDELOAD
20#include <metricslogger/metrics_logger.h>
21#endif // _UE_SIDELOAD
22
23namespace chromeos_update_engine {
24
25namespace metrics {
26
27#ifndef _UE_SIDELOAD
28const char kMetricsUpdateEngineErrorCode[] = "ota_update_engine_error_code";
29#endif
30} // namespace metrics
31
32void MetricsReporterAndroid::ReportUpdateAttemptMetrics(
33 SystemState* /* system_state */,
34 int /* attempt_number */,
35 PayloadType /* payload_type */,
36 base::TimeDelta /* duration */,
37 base::TimeDelta /* duration_uptime */,
38 int64_t /* payload_size */,
Tianjie Xu1b661142017-09-28 14:03:42 -070039 metrics::AttemptResult /* attempt_result */,
Tianjie Xu1f93d092017-10-09 12:13:29 -070040 ErrorCode error_code) {
Tianjie Xu1b661142017-09-28 14:03:42 -070041// No need to log histogram under sideload mode.
42#ifndef _UE_SIDELOAD
43 android::metricslogger::LogHistogram(metrics::kMetricsUpdateEngineErrorCode,
44 static_cast<int>(error_code));
45#endif
46}
47
48}; // namespace chromeos_update_engine