1 /*
2  * Copyright (C) 2019 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 #pragma once
18 
19 #include <android-base/file.h>
20 #include <android-base/logging.h>
21 #include <android-base/strings.h>
22 #include <batteryservice/BatteryService.h>
23 
24 #include <string>
25 
26 namespace hardware {
27 namespace google {
28 namespace pixel {
29 namespace health {
30 
31 /**
32  * updateThermalState is called per battery status update.
33  * BatteryThermalControl monitors thermal framework and when device is charging
34  * or battery is full, it then disable SOC throtting by setting disabled in
35  * SOC thermal zone's mode.
36  */
37 class BatteryThermalControl {
38   public:
39     BatteryThermalControl(const std::string &path);
40     void updateThermalState(const struct android::BatteryProperties *props);
41 
42   private:
43     void setThermalMode(bool isEnable, bool isWeakCharger);
44 
45     const std::string mThermalSocMode;
46     bool mStatus;
47 };
48 
49 }  // namespace health
50 }  // namespace pixel
51 }  // namespace google
52 }  // namespace hardware
53