1 /*
2  * Copyright (C) 2020 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 <android/frameworks/stats/1.0/IStats.h>
18 #include <android/frameworks/stats/1.0/types.h>
19 #include <stats_event.h>
20 
21 using namespace android::frameworks::stats::V1_0;
22 
23 namespace android {
24 namespace frameworks {
25 namespace stats {
26 namespace V1_0 {
27 namespace implementation {
28 
29 using android::hardware::Return;
30 
31 /**
32  * Implements the Stats HAL
33  */
34 class StatsHal : public IStats {
35 public:
36     StatsHal();
37 
38     /**
39      * Binder call to get SpeakerImpedance atom.
40      */
41     virtual Return<void> reportSpeakerImpedance(const SpeakerImpedance& speakerImpedance) override;
42 
43     /**
44      * Binder call to get HardwareFailed atom.
45      */
46     virtual Return<void> reportHardwareFailed(const HardwareFailed& hardwareFailed) override;
47 
48     /**
49      * Binder call to get PhysicalDropDetected atom.
50      */
51     virtual Return<void> reportPhysicalDropDetected(
52             const PhysicalDropDetected& physicalDropDetected) override;
53 
54     /**
55      * Binder call to get ChargeCyclesReported atom.
56      */
57     virtual Return<void> reportChargeCycles(const ChargeCycles& chargeCycles) override;
58 
59     /**
60      * Binder call to get BatteryHealthSnapshot atom.
61      */
62     virtual Return<void> reportBatteryHealthSnapshot(
63             const BatteryHealthSnapshotArgs& batteryHealthSnapshotArgs) override;
64 
65     /**
66      * Binder call to get SlowIo atom.
67      */
68     virtual Return<void> reportSlowIo(const SlowIo& slowIo) override;
69 
70     /**
71      * Binder call to get BatteryCausedShutdown atom.
72      */
73     virtual Return<void> reportBatteryCausedShutdown(
74             const BatteryCausedShutdown& batteryCausedShutdown) override;
75 
76     /**
77      * Binder call to get UsbPortOverheatEvent atom.
78      */
79     virtual Return<void> reportUsbPortOverheatEvent(
80             const UsbPortOverheatEvent& usbPortOverheatEvent) override;
81 
82     /**
83      * Binder call to get Speech DSP state atom.
84      */
85     virtual Return<void> reportSpeechDspStat(const SpeechDspStat& speechDspStat) override;
86 
87     /**
88      * Binder call to get vendor atom.
89      */
90     virtual Return<void> reportVendorAtom(const VendorAtom& vendorAtom) override;
91 };
92 
93 }  // namespace implementation
94 }  // namespace V1_0
95 }  // namespace stats
96 }  // namespace frameworks
97 }  // namespace android
98