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