2 * Copyright (C) 2017 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef ANDROID_THERMALSERVICE_THERMALSERVICE_H
18 #define ANDROID_THERMALSERVICE_THERMALSERVICE_H
20 #include <android/os/BnThermalService.h>
21 #include <android/os/IThermalEventListener.h>
22 #include <android/os/Temperature.h>
23 #include <utils/Mutex.h>
24 #include <utils/String16.h>
25 #include <utils/Vector.h>
30 class ThermalService : public BnThermalService,
31 public IBinder::DeathRecipient {
33 ThermalService() : mThrottled(false) {};
34 void publish(const sp<ThermalService>& service);
35 binder::Status notifyThrottling(
36 const bool isThrottling, const Temperature& temperature);
40 Vector<sp<IThermalEventListener> > mListeners;
42 Temperature mThrottleTemperature;
44 binder::Status registerThermalEventListener(
45 const sp<IThermalEventListener>& listener);
46 binder::Status unregisterThermalEventListener(
47 const sp<IThermalEventListener>& listener);
48 binder::Status isThrottling(bool* _aidl_return);
49 void binderDied(const wp<IBinder>& who);
53 }; // namespace android
55 #endif // ANDROID_THERMALSERVICE_THERMALSERVICE_H