Move toggling of kernel idle timer to SF
Idle timer is toggled from the SF code using the following logic:
- If the device policy refresh rate min = max, we turn off the timer.
- If the device policy refresh rate min > the device min,
we turn off the timer.
- Do not toggle the timer if deviceMin == policyMin.
- Timer is on in all other cases.
Bug: 140204874
Bug: 158012424
Bug: 145561154
Test: atest SurfaceFlinger_test
Test: atest libsurfaceflinger_unittest
Test: Select force 90hz through Developer Settings. Toggles timer off.
Test: Low brightness zone. Toggles timer off.
Change-Id: I9858765861a3b13e11c3930be8f77d85dae6c0c0
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 38db62b..ccaeb2d 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -535,6 +535,13 @@
void repaintEverythingForHWC() override;
// Called when kernel idle timer has expired. Used to update the refresh rate overlay.
void kernelTimerChanged(bool expired) override;
+ // Toggles the kernel idle timer on or off depending the policy decisions around refresh rates.
+ void toggleKernelIdleTimer();
+ // Keeps track of whether the kernel idle timer is currently enabled, so we don't have to
+ // make calls to sys prop each time.
+ bool mKernelIdleTimerEnabled = false;
+ // Keeps track of whether the kernel timer is supported on the SF side.
+ bool mSupportKernelIdleTimer = false;
/* ------------------------------------------------------------------------
* Message handling
*/