thermalservice: add HIDL ThermalCallback implementation
The IThermalCallback implementation in thermalserviced enables vendor
thermal management code to send thermal events to ThermalService.
Test: manual: marlin with modified thermal-engine.conf
Bug: 30982366
Change-Id: Ic566bc51aebcd03163f8909f846ee4f7025ed472
diff --git a/services/thermalservice/libthermalcallback/ThermalCallback.h b/services/thermalservice/libthermalcallback/ThermalCallback.h
new file mode 100644
index 0000000..3d72c68
--- /dev/null
+++ b/services/thermalservice/libthermalcallback/ThermalCallback.h
@@ -0,0 +1,43 @@
+#ifndef ANDROID_HARDWARE_THERMAL_V1_1_THERMALCALLBACK_H
+#define ANDROID_HARDWARE_THERMAL_V1_1_THERMALCALLBACK_H
+
+#include <android/hardware/thermal/1.1/IThermalCallback.h>
+#include <android/hardware/thermal/1.0/types.h>
+#include <android/os/Temperature.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+#include "services/thermalservice/ThermalService.h"
+
+namespace android {
+namespace hardware {
+namespace thermal {
+namespace V1_1 {
+namespace implementation {
+
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::os::ThermalService;
+
+class ThermalCallback : public IThermalCallback {
+ public:
+ // Register a binder ThermalService object for sending events
+ void registerThermalService(sp<ThermalService> thermalService);
+
+ // Methods from IThermalCallback::V1_1 follow.
+ Return<void> notifyThrottling(
+ bool isThrottling,
+ const android::hardware::thermal::V1_0::Temperature& temperature)
+ override;
+
+ private:
+ // Our registered binder ThermalService object to use for sending events
+ sp<android::os::ThermalService> mThermalService;
+};
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace thermal
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_THERMAL_V1_1_THERMALCALLBACK_H