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