Todd Poynor | 694553d | 2015-12-03 11:05:45 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 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 | #ifndef METRICSD_METRICS_COLLECTOR_SERVICE_IMPL_H_ |
| 18 | #define METRICSD_METRICS_COLLECTOR_SERVICE_IMPL_H_ |
| 19 | |
| 20 | // metrics_collector binder service implementation. Constructed by |
Todd Poynor | b77ae45 | 2016-01-04 14:11:25 -0800 | [diff] [blame] | 21 | // MetricsCollector. |
Todd Poynor | 694553d | 2015-12-03 11:05:45 -0800 | [diff] [blame] | 22 | |
| 23 | #include "android/brillo/metrics/BnMetricsCollectorService.h" |
| 24 | |
Todd Poynor | 694553d | 2015-12-03 11:05:45 -0800 | [diff] [blame] | 25 | #include <binder/Status.h> |
Todd Poynor | 694553d | 2015-12-03 11:05:45 -0800 | [diff] [blame] | 26 | |
Todd Poynor | b77ae45 | 2016-01-04 14:11:25 -0800 | [diff] [blame] | 27 | class MetricsCollector; |
Todd Poynor | 694553d | 2015-12-03 11:05:45 -0800 | [diff] [blame] | 28 | |
| 29 | class BnMetricsCollectorServiceImpl |
| 30 | : public android::brillo::metrics::BnMetricsCollectorService { |
| 31 | public: |
Todd Poynor | b77ae45 | 2016-01-04 14:11:25 -0800 | [diff] [blame] | 32 | // Passed a this pointer from the MetricsCollector object that constructs us. |
Todd Poynor | 694553d | 2015-12-03 11:05:45 -0800 | [diff] [blame] | 33 | explicit BnMetricsCollectorServiceImpl( |
Todd Poynor | b77ae45 | 2016-01-04 14:11:25 -0800 | [diff] [blame] | 34 | MetricsCollector* metrics_collector_service); |
Todd Poynor | 694553d | 2015-12-03 11:05:45 -0800 | [diff] [blame] | 35 | |
| 36 | virtual ~BnMetricsCollectorServiceImpl() = default; |
| 37 | |
Todd Poynor | 694553d | 2015-12-03 11:05:45 -0800 | [diff] [blame] | 38 | // Called by crash_reporter to report a userspace crash event. We relay |
Todd Poynor | b77ae45 | 2016-01-04 14:11:25 -0800 | [diff] [blame] | 39 | // this to MetricsCollector. |
Todd Poynor | 694553d | 2015-12-03 11:05:45 -0800 | [diff] [blame] | 40 | android::binder::Status notifyUserCrash(); |
| 41 | |
| 42 | private: |
Todd Poynor | b77ae45 | 2016-01-04 14:11:25 -0800 | [diff] [blame] | 43 | // MetricsCollector object that constructs us, we use this to call back |
| 44 | // to it. |
| 45 | MetricsCollector* metrics_collector_; |
Todd Poynor | 694553d | 2015-12-03 11:05:45 -0800 | [diff] [blame] | 46 | }; |
| 47 | |
| 48 | #endif // METRICSD_METRICS_COLLECTOR_SERVICE_IMPL_H_ |