| 1 |
/* |
| 2 |
** Copyright 2017, 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 |
package android.os; |
| 18 |
|
| 19 |
import android.os.CoolingDevice; |
| 20 |
import android.os.IThermalEventListener; |
| 21 |
import android.os.IThermalStatusListener; |
| 22 |
import android.os.Temperature; |
| 23 |
|
| 24 |
import java.util.List; |
| 25 |
|
| 26 |
/** |
| 27 |
* {@hide} |
| 28 |
*/ |
| 29 |
interface IThermalService { |
| 30 |
/** |
| 31 |
* Register a listener for thermal events. |
| 32 |
* @param listener the IThermalEventListener to be notified. |
| 33 |
* {@hide} |
| 34 |
*/ |
| 35 |
boolean registerThermalEventListener(in IThermalEventListener listener); |
| 36 |
|
| 37 |
/** |
| 38 |
* Register a listener for thermal events on given temperature type. |
| 39 |
* @param listener the IThermalEventListener to be notified. |
| 40 |
* @param type the temperature type IThermalEventListener to be notified. |
| 41 |
* @return true if registered successfully. |
| 42 |
* {@hide} |
| 43 |
*/ |
| 44 |
boolean registerThermalEventListenerWithType(in IThermalEventListener listener, in int type); |
| 45 |
|
| 46 |
/** |
| 47 |
* Unregister a previously-registered listener for thermal events. |
| 48 |
* @param listener the IThermalEventListener to no longer be notified. |
| 49 |
* @return true if unregistered successfully. |
| 50 |
* {@hide} |
| 51 |
*/ |
| 52 |
boolean unregisterThermalEventListener(in IThermalEventListener listener); |
| 53 |
|
| 54 |
/** |
| 55 |
* Get current temperature with its throttling status. |
| 56 |
* @return list of {@link android.os.Temperature}. |
| 57 |
* {@hide} |
| 58 |
*/ |
| 59 |
Temperature[] getCurrentTemperatures(); |
| 60 |
|
| 61 |
/** |
| 62 |
* Get current temperature with its throttling status on given temperature type. |
| 63 |
* @param type the temperature type to query. |
| 64 |
* @return list of {@link android.os.Temperature}. |
| 65 |
* {@hide} |
| 66 |
*/ |
| 67 |
Temperature[] getCurrentTemperaturesWithType(in int type); |
| 68 |
|
| 69 |
/** |
| 70 |
* Register a listener for thermal status change. |
| 71 |
* @param listener the {@link android.os.IThermalStatusListener} to be notified. |
| 72 |
* @return true if registered successfully. |
| 73 |
* {@hide} |
| 74 |
*/ |
| 75 |
boolean registerThermalStatusListener(in IThermalStatusListener listener); |
| 76 |
|
| 77 |
/** |
| 78 |
* Unregister a previously-registered listener for thermal status. |
| 79 |
* @param listener the {@link android.os.IThermalStatusListener} to no longer be notified. |
| 80 |
* @return true if unregistered successfully. |
| 81 |
* {@hide} |
| 82 |
*/ |
| 83 |
boolean unregisterThermalStatusListener(in IThermalStatusListener listener); |
| 84 |
|
| 85 |
/** |
| 86 |
* Get current thermal status. |
| 87 |
* @return status defined in {@link android.os.Temperature}. |
| 88 |
* {@hide} |
| 89 |
*/ |
| 90 |
int getCurrentThermalStatus(); |
| 91 |
|
| 92 |
/** |
| 93 |
* Get current cooling devices. |
| 94 |
* @return list of {@link android.os.CoolingDevice}. |
| 95 |
* {@hide} |
| 96 |
*/ |
| 97 |
CoolingDevice[] getCurrentCoolingDevices(); |
| 98 |
|
| 99 |
/** |
| 100 |
* Get current cooling devices on given type. |
| 101 |
* @param type the cooling device type to query. |
| 102 |
* @return list of {@link android.os.CoolingDevice}. |
| 103 |
* {@hide} |
| 104 |
*/ |
| 105 |
|
| 106 |
CoolingDevice[] getCurrentCoolingDevicesWithType(in int type); |
| 107 |
|
| 108 |
/** |
| 109 |
* @param forecastSeconds how many seconds ahead to forecast the provided headroom |
| 110 |
* @return forecasted thermal headroom, normalized such that 1.0 indicates that throttling will |
| 111 |
* occur; returns NaN if the headroom or forecast is unavailable |
| 112 |
*/ |
| 113 |
float getThermalHeadroom(int forecastSeconds); |
| 114 |
} |