blob: 3ea45909914670e1f37d7dd84a6853d8bb983350 [file] [log] [blame]
Wei Wang84ce54e2018-10-18 13:56:03 -07001/*
2 * Copyright (C) 2018 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 */
16package android.hardware.thermal@2.0;
17
18import android.hardware.thermal@1.0::IThermal;
19import android.hardware.thermal@1.0::ThermalStatus;
20import IThermalChangedCallback;
21
22interface IThermal extends @1.0::IThermal {
23
24 /**
25 * Retrieves temperatures in Celsius.
26 *
27 * @param filterType whether to filter the result for a given type.
28 * @param type the TemperatureType such as battery or skin.
29 *
30 * @return status Status of the operation. If status code is FAILURE,
31 * the status.debugMessage must be populated with a human-readable
32 * error message.
33 *
34 * @return temperatures If status code is SUCCESS, it's filled with the
35 * current temperatures. The order of temperatures of built-in
36 * devices (such as CPUs, GPUs and etc.) in the list must be kept
37 * the same regardless of the number of calls to this method even if
38 * they go offline, if these devices exist on boot. The method
39 * always returns and never removes such temperatures.
40 */
41 getCurrentTemperatures(bool filterType, TemperatureType type)
42 generates (ThermalStatus status, vec<Temperature> temperatures);
43
44 /**
Wei Wangc4c25592018-10-25 19:22:25 -070045 * Retrieves static temperature thresholds in Celsius.
Wei Wang84ce54e2018-10-18 13:56:03 -070046 *
47 * @param filterType whether to filter the result for a given type.
48 * @param type the TemperatureType such as battery or skin.
49 *
50 * @return status Status of the operation. If status code is FAILURE,
51 * the status.debugMessage must be populated with a human-readable error message.
52 * @return temperatureThresholds If status code is SUCCESS, it's filled with the
53 * temperatures thresholds. The order of temperatures of built-in
54 * devices (such as CPUs, GPUs and etc.) in the list must be kept
55 * the same regardless of the number of calls to this method even if
56 * they go offline, if these devices exist on boot. The method
Wei Wangc4c25592018-10-25 19:22:25 -070057 * always returns and never removes such temperatures. The thresholds
58 * are returned as static values and must not change across calls. The actual
Wei Wang84cf5c92019-02-20 11:39:14 -080059 * throttling state is determined in device thermal mitigation policy/agorithm
60 * which might not be simple thresholds so these values Thermal HAL provided
61 * may not be accurate to detemin the throttling status. To get accurate
62 * throttling status, use getCurrentTemperatures or registerThermalChangedCallback
63 * and listen to the callback.
Wei Wang84ce54e2018-10-18 13:56:03 -070064 */
65 getTemperatureThresholds(bool filterType, TemperatureType type)
66 generates (ThermalStatus status, vec<TemperatureThreshold> temperatureThresholds);
67
68 /**
69 * Register an IThermalChangedCallback, used by the Thermal HAL
Wei Wang84cf5c92019-02-20 11:39:14 -080070 * to receive thermal events when thermal mitigation status changed.
Wei Wang84ce54e2018-10-18 13:56:03 -070071 * Multiple registrations with different IThermalChangedCallback must be allowed.
72 * Multiple registrations with same IThermalChangedCallback is not allowed, client
73 * should unregister the given IThermalChangedCallback first.
74 *
Wei Wang84cf5c92019-02-20 11:39:14 -080075 * @param callback the IThermalChangedCallback to use for receiving
76 * thermal events (nullptr callback will lead to failure with status code FAILURE).
Wei Wang84ce54e2018-10-18 13:56:03 -070077 * @param filterType if filter for given sensor type.
78 * @param type the type to be filtered.
79 *
80 * @return status Status of the operation. If status code is FAILURE,
81 * the status.debugMessage must be populated with a human-readable error message.
82 */
83 registerThermalChangedCallback(IThermalChangedCallback callback,
84 bool filterType,
85 TemperatureType type)
86 generates (ThermalStatus status);
87
88 /**
Wei Wang84cf5c92019-02-20 11:39:14 -080089 * Unregister an IThermalChangedCallback, used by the Thermal HAL
90 * to receive thermal events when thermal mitigation status changed.
Wei Wang84ce54e2018-10-18 13:56:03 -070091 *
Wei Wang84cf5c92019-02-20 11:39:14 -080092 * @param callback the IThermalChangedCallback used for receiving
93 * thermal events (nullptr callback will lead to failure with status code FAILURE).
Wei Wang84ce54e2018-10-18 13:56:03 -070094 *
95 * @return status Status of the operation. If status code is FAILURE,
96 * the status.debugMessage must be populated with a human-readable error message.
97 */
98 unregisterThermalChangedCallback(IThermalChangedCallback callback)
99 generates (ThermalStatus status);
100
101 /**
102 * Retrieves the cooling devices information.
103 *
104 * @param filterType whether to filter the result for a given type.
105 * @param type the CoolingDevice such as CPU/GPU.
106 *
107 * @return status Status of the operation. If status code is FAILURE,
108 * the status.debugMessage must be populated with the human-readable
109 * error message.
110 * @return devices If status code is SUCCESS, it's filled with the current
111 * cooling device information. The order of built-in cooling
112 * devices in the list must be kept the same regardless of the number
113 * of calls to this method even if they go offline, if these devices
114 * exist on boot. The method always returns and never removes from
115 * the list such cooling devices.
116 */
117 getCurrentCoolingDevices(bool filterType, CoolingType type)
118 generates (ThermalStatus status, vec<CoolingDevice> devices);
119};