Tianjie Xu | 1b66114 | 2017-09-28 14:03:42 -0700 | [diff] [blame] | 1 | // |
| 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 | |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 17 | #ifndef UPDATE_ENGINE_AOSP_METRICS_REPORTER_ANDROID_H_ |
| 18 | #define UPDATE_ENGINE_AOSP_METRICS_REPORTER_ANDROID_H_ |
Tianjie Xu | 1b66114 | 2017-09-28 14:03:42 -0700 | [diff] [blame] | 19 | |
Marton Hunyady | a030268 | 2018-05-16 18:52:13 +0200 | [diff] [blame] | 20 | #include <string> |
| 21 | |
Tianjie Xu | 1b66114 | 2017-09-28 14:03:42 -0700 | [diff] [blame] | 22 | #include "update_engine/common/error_code.h" |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 23 | #include "update_engine/common/metrics_constants.h" |
| 24 | #include "update_engine/common/metrics_reporter_interface.h" |
Kelvin Zhang | 9a5e368 | 2021-03-29 12:58:48 -0400 | [diff] [blame] | 25 | #include "update_engine/payload_consumer/install_plan.h" |
Tianjie Xu | 1b66114 | 2017-09-28 14:03:42 -0700 | [diff] [blame] | 26 | |
| 27 | namespace chromeos_update_engine { |
| 28 | |
| 29 | class MetricsReporterAndroid : public MetricsReporterInterface { |
| 30 | public: |
Yifan Hong | c514f66 | 2021-02-04 11:18:43 -0800 | [diff] [blame] | 31 | explicit MetricsReporterAndroid( |
Kelvin Zhang | 9a5e368 | 2021-03-29 12:58:48 -0400 | [diff] [blame] | 32 | DynamicPartitionControlInterface* dynamic_partition_control, |
| 33 | const InstallPlan* install_plan) |
| 34 | : dynamic_partition_control_(dynamic_partition_control), |
| 35 | install_plan_(install_plan) {} |
Tianjie Xu | 1b66114 | 2017-09-28 14:03:42 -0700 | [diff] [blame] | 36 | |
| 37 | ~MetricsReporterAndroid() override = default; |
| 38 | |
Tianjie Xu | 1b66114 | 2017-09-28 14:03:42 -0700 | [diff] [blame] | 39 | void ReportRollbackMetrics(metrics::RollbackResult result) override {} |
| 40 | |
Marton Hunyady | a030268 | 2018-05-16 18:52:13 +0200 | [diff] [blame] | 41 | void ReportEnterpriseRollbackMetrics( |
| 42 | bool success, const std::string& rollback_version) override {} |
| 43 | |
Tianjie Xu | 1b66114 | 2017-09-28 14:03:42 -0700 | [diff] [blame] | 44 | void ReportDailyMetrics(base::TimeDelta os_age) override {} |
| 45 | |
| 46 | void ReportUpdateCheckMetrics( |
Tianjie Xu | 1b66114 | 2017-09-28 14:03:42 -0700 | [diff] [blame] | 47 | metrics::CheckResult result, |
| 48 | metrics::CheckReaction reaction, |
| 49 | metrics::DownloadErrorCode download_error_code) override {} |
| 50 | |
Amin Hassani | 538bd59 | 2020-11-04 20:46:08 -0800 | [diff] [blame] | 51 | void ReportUpdateAttemptMetrics(int attempt_number, |
Tianjie Xu | 1f93d09 | 2017-10-09 12:13:29 -0700 | [diff] [blame] | 52 | PayloadType payload_type, |
| 53 | base::TimeDelta duration, |
| 54 | base::TimeDelta duration_uptime, |
| 55 | int64_t payload_size, |
| 56 | metrics::AttemptResult attempt_result, |
| 57 | ErrorCode internal_error_code) override; |
| 58 | |
| 59 | void ReportUpdateAttemptDownloadMetrics( |
Tianjie Xu | 1b66114 | 2017-09-28 14:03:42 -0700 | [diff] [blame] | 60 | int64_t payload_bytes_downloaded, |
| 61 | int64_t payload_download_speed_bps, |
| 62 | DownloadSource download_source, |
Tianjie Xu | 1b66114 | 2017-09-28 14:03:42 -0700 | [diff] [blame] | 63 | metrics::DownloadErrorCode payload_download_error_code, |
Tianjie Xu | 82d9910 | 2017-11-02 22:26:19 -0700 | [diff] [blame] | 64 | metrics::ConnectionType connection_type) override; |
Tianjie Xu | 1b66114 | 2017-09-28 14:03:42 -0700 | [diff] [blame] | 65 | |
Tianjie Xu | 52c678c | 2017-10-18 15:52:27 -0700 | [diff] [blame] | 66 | void ReportAbnormallyTerminatedUpdateAttemptMetrics() override; |
Tianjie Xu | 1b66114 | 2017-09-28 14:03:42 -0700 | [diff] [blame] | 67 | |
| 68 | void ReportSuccessfulUpdateMetrics( |
| 69 | int attempt_count, |
| 70 | int updates_abandoned_count, |
| 71 | PayloadType payload_type, |
| 72 | int64_t payload_size, |
| 73 | int64_t num_bytes_downloaded[kNumDownloadSources], |
| 74 | int download_overhead_percentage, |
| 75 | base::TimeDelta total_duration, |
Sen Jiang | 8712e96 | 2018-05-08 12:12:28 -0700 | [diff] [blame] | 76 | base::TimeDelta total_duration_uptime, |
Tianjie Xu | 1b66114 | 2017-09-28 14:03:42 -0700 | [diff] [blame] | 77 | int reboot_count, |
Tianjie Xu | 52c678c | 2017-10-18 15:52:27 -0700 | [diff] [blame] | 78 | int url_switch_count) override; |
Tianjie Xu | 1b66114 | 2017-09-28 14:03:42 -0700 | [diff] [blame] | 79 | |
| 80 | void ReportCertificateCheckMetrics(ServerToCheck server_to_check, |
| 81 | CertificateCheckResult result) override {} |
| 82 | |
| 83 | void ReportFailedUpdateCount(int target_attempt) override {} |
| 84 | |
| 85 | void ReportTimeToReboot(int time_to_reboot_minutes) override {} |
| 86 | |
| 87 | void ReportInstallDateProvisioningSource(int source, int max) override {} |
| 88 | |
Amin Hassani | 80f4d4c | 2018-05-16 13:34:00 -0700 | [diff] [blame] | 89 | void ReportInternalErrorCode(ErrorCode error_code) override {} |
| 90 | |
Marton Hunyady | ffbfdfb | 2018-05-30 13:03:29 +0200 | [diff] [blame] | 91 | void ReportKeyVersionMetrics(int kernel_min_version, |
| 92 | int kernel_max_rollforward_version, |
| 93 | bool kernel_max_rollforward_success) override {} |
| 94 | |
May Lippert | 60aa3ca | 2018-08-15 16:55:29 -0700 | [diff] [blame] | 95 | void ReportEnterpriseUpdateSeenToDownloadDays( |
| 96 | bool has_time_restriction_policy, int time_to_update_days) override {} |
| 97 | |
Tianjie Xu | 1b66114 | 2017-09-28 14:03:42 -0700 | [diff] [blame] | 98 | private: |
Kelvin Zhang | 9a5e368 | 2021-03-29 12:58:48 -0400 | [diff] [blame] | 99 | DynamicPartitionControlInterface* dynamic_partition_control_{}; |
| 100 | const InstallPlan* install_plan_{}; |
Yifan Hong | c514f66 | 2021-02-04 11:18:43 -0800 | [diff] [blame] | 101 | |
Tianjie Xu | 1b66114 | 2017-09-28 14:03:42 -0700 | [diff] [blame] | 102 | DISALLOW_COPY_AND_ASSIGN(MetricsReporterAndroid); |
| 103 | }; |
| 104 | |
| 105 | } // namespace chromeos_update_engine |
| 106 | |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 107 | #endif // UPDATE_ENGINE_AOSP_METRICS_REPORTER_ANDROID_H_ |