OSDN Git Service

Merge "Change UniquePtr to std::unique_ptr" into oc-mr1-dev
[android-x86/frameworks-native.git] / services / thermalservice / ThermalService.h
1 /*
2  * Copyright (C) 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 #ifndef ANDROID_THERMALSERVICE_THERMALSERVICE_H
18 #define ANDROID_THERMALSERVICE_THERMALSERVICE_H
19
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>
26
27 namespace android {
28 namespace os {
29
30 class ThermalService : public BnThermalService,
31                        public IBinder::DeathRecipient {
32 public:
33   ThermalService() : mThrottled(false) {};
34     void publish(const sp<ThermalService>& service);
35     binder::Status notifyThrottling(
36         const bool isThrottling, const Temperature& temperature);
37
38 private:
39     Mutex mListenersLock;
40     Vector<sp<IThermalEventListener> > mListeners;
41     bool mThrottled;
42     Temperature mThrottleTemperature;
43
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);
50 };
51
52 };  // namespace os
53 };  // namespace android
54
55 #endif // ANDROID_THERMALSERVICE_THERMALSERVICE_H