healthd-ext: add suspend support for charger mode
Override ChargerEnableSuspend() function to true to support kernel
suspend and resume in charger mode.
Change-Id: I01ceaecf7e918504624b2bf1bfb34207fcde74e7
diff --git a/aidl/main.cpp b/aidl/main.cpp
index 943a537..7c8c7cd 100644
--- a/aidl/main.cpp
+++ b/aidl/main.cpp
@@ -18,6 +18,13 @@
#if !CHARGER_FORCE_NO_UI
using aidl::android::hardware::health::charger::ChargerCallback;
using aidl::android::hardware::health::charger::ChargerModeMain;
+namespace aidl::android::hardware::health {
+class ChargerCallbackImpl : public ChargerCallback {
+ public:
+ ChargerCallbackImpl(const std::shared_ptr<Health>& service) : ChargerCallback(service) {}
+ bool ChargerEnableSuspend() override { return true; }
+};
+} //namespace aidl::android::hardware::health
#endif
static constexpr const char* gInstanceName = "default";
@@ -78,7 +85,8 @@
if (argc >= 2 && argv[1] == gChargerArg) {
#if !CHARGER_FORCE_NO_UI
KLOG_INFO(LOG_TAG, "Starting charger mode with UI.");
- return ChargerModeMain(binder, std::make_shared<ChargerCallback>(binder));
+ auto charger_callback = std::make_shared<aidl::android::hardware::health::ChargerCallbackImpl>(binder);
+ return ChargerModeMain(binder, charger_callback);
#endif
KLOG_INFO(LOG_TAG, "Starting charger mode without UI.");
} else {