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 | // Client interface to IMetricsCollectorService. |
| 18 | |
| 19 | #ifndef METRICS_METRICS_COLLECTOR_SERVICE_CLIENT_H_ |
| 20 | #define METRICS_METRICS_COLLECTOR_SERVICE_CLIENT_H_ |
| 21 | |
| 22 | #include "android/brillo/metrics/IMetricsCollectorService.h" |
| 23 | |
| 24 | class MetricsCollectorServiceClient { |
| 25 | public: |
| 26 | MetricsCollectorServiceClient() = default; |
| 27 | ~MetricsCollectorServiceClient() = default; |
| 28 | |
| 29 | // Initialize. Returns true if OK, or false if IMetricsCollectorService |
| 30 | // is not registered. |
| 31 | bool Init(); |
| 32 | |
| 33 | // Called by crash_reporter to report a userspace crash event. Returns |
| 34 | // true if successfully called the IMetricsCollectorService method of the |
| 35 | // same name, or false if the service was not registered at Init() time. |
| 36 | bool notifyUserCrash(); |
| 37 | |
| 38 | private: |
| 39 | // IMetricsCollectorService binder proxy |
| 40 | android::sp<android::brillo::metrics::IMetricsCollectorService> |
| 41 | metrics_collector_service_; |
| 42 | }; |
| 43 | |
| 44 | #endif // METRICS_METRICS_COLLECTOR_SERVICE_CLIENT_H_ |