hwc/qdutils/qservice: Add dynamic idle timeout support
Add support for dynamically setting idle timeout values.
Move default idle timeout setting to IdleInvalidator.
Fix static var naming, handle errors from IdleInvalidator in hwc.
Property debug.hwc.idletime is removed with this change.
Example:
1) Set idle timeout to 100ms
adb shell service call display.qservice 16 i32 100
16 is the code for SET_IDLE_TIMEOUT, 100 is time in ms
2) Disable idle timeout
adb shell service call display.qservice 16 i32 0
Change-Id: I60e15a3ac869b4e9f4015b3be50a35c90d00d404
diff --git a/libqdutils/idle_invalidator.h b/libqdutils/idle_invalidator.h
index a881c4b..52334a0 100644
--- a/libqdutils/idle_invalidator.h
+++ b/libqdutils/idle_invalidator.h
@@ -37,16 +37,18 @@
typedef void (*InvalidatorHandler)(void*);
class IdleInvalidator : public android::Thread {
+ IdleInvalidator();
void *mHwcContext;
int mTimeoutEventFd;
static InvalidatorHandler mHandler;
static android::sp<IdleInvalidator> sInstance;
- public:
- IdleInvalidator();
+public:
+ ~IdleInvalidator();
/* init timer obj */
- int init(InvalidatorHandler reg_handler, void* user_data, unsigned int
- idleSleepTime);
+ int init(InvalidatorHandler reg_handler, void* user_data);
+ bool setIdleTimeout(const uint32_t& timeout);
+
/*Overrides*/
virtual bool threadLoop();
virtual int readyToRun();