blob: f890694d2c7b6e12a79be5d3dc7023f0c41b7b56 [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
59 * throttling state is determined in driver and HAL and must not be simply
60 * compared with these thresholds. To get accurate throttling status, use
61 * getCurrentTemperatures or registerThermalChangedCallback and listen.
Wei Wang84ce54e2018-10-18 13:56:03 -070062 */
63 getTemperatureThresholds(bool filterType, TemperatureType type)
64 generates (ThermalStatus status, vec<TemperatureThreshold> temperatureThresholds);
65
66 /**
67 * Register an IThermalChangedCallback, used by the Thermal HAL
68 * to send thermal events when thermal mitigation status changed.
69 * Multiple registrations with different IThermalChangedCallback must be allowed.
70 * Multiple registrations with same IThermalChangedCallback is not allowed, client
71 * should unregister the given IThermalChangedCallback first.
72 *
73 * @param callback the IThermalChangedCallback to use for sending
74 * thermal events (cannot be nullptr).
75 * @param filterType if filter for given sensor type.
76 * @param type the type to be filtered.
77 *
78 * @return status Status of the operation. If status code is FAILURE,
79 * the status.debugMessage must be populated with a human-readable error message.
80 */
81 registerThermalChangedCallback(IThermalChangedCallback callback,
82 bool filterType,
83 TemperatureType type)
84 generates (ThermalStatus status);
85
86 /**
87 * Register an IThermalChangedCallback, used by the Thermal HAL
88 * to send thermal events when thermal mitigation status changed.
89 *
90 * @param callback the IThermalChangedCallback to use for sending
91 * thermal events, or nullptr to set no callback.
92 *
93 * @return status Status of the operation. If status code is FAILURE,
94 * the status.debugMessage must be populated with a human-readable error message.
95 */
96 unregisterThermalChangedCallback(IThermalChangedCallback callback)
97 generates (ThermalStatus status);
98
99 /**
100 * Retrieves the cooling devices information.
101 *
102 * @param filterType whether to filter the result for a given type.
103 * @param type the CoolingDevice such as CPU/GPU.
104 *
105 * @return status Status of the operation. If status code is FAILURE,
106 * the status.debugMessage must be populated with the human-readable
107 * error message.
108 * @return devices If status code is SUCCESS, it's filled with the current
109 * cooling device information. The order of built-in cooling
110 * devices in the list must be kept the same regardless of the number
111 * of calls to this method even if they go offline, if these devices
112 * exist on boot. The method always returns and never removes from
113 * the list such cooling devices.
114 */
115 getCurrentCoolingDevices(bool filterType, CoolingType type)
116 generates (ThermalStatus status, vec<CoolingDevice> devices);
117};