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