blob: ebfad0dc91b5b10fcf178924b774bed09f9c9330 [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 */,
39 int64_t /* payload_bytes_downloaded */,
40 int64_t /* payload_download_speed_bps */,
41 DownloadSource /* download_source */,
42 metrics::AttemptResult /* attempt_result */,
43 ErrorCode error_code,
44 metrics::DownloadErrorCode /* payload_download_error_code */,
45 metrics::ConnectionType /* connection_type */) {
46// No need to log histogram under sideload mode.
47#ifndef _UE_SIDELOAD
48 android::metricslogger::LogHistogram(metrics::kMetricsUpdateEngineErrorCode,
49 static_cast<int>(error_code));
50#endif
51}
52
53}; // namespace chromeos_update_engine