SF: Fix synthetic VSYNC after first powering on
After onActiveDisplayChangedLocked, isActiveDisplay was stale, so the
first powering on of a newly active display did not enable and resync
to hardware VSYNC, i.e. EventThread stayed in SyntheticVsync.
Also, merge EventThread APIs to enable/disable synthetic VSYNC.
Fixes: 264700488
Bug: 255635821
Test: dumpsys SurfaceFlinger --events
Change-Id: Ibd4099bb856adc11d887f3b7b9432fbc4cb2e33d
diff --git a/services/surfaceflinger/Scheduler/EventThread.h b/services/surfaceflinger/Scheduler/EventThread.h
index 347dc4a..5037860 100644
--- a/services/surfaceflinger/Scheduler/EventThread.h
+++ b/services/surfaceflinger/Scheduler/EventThread.h
@@ -106,11 +106,8 @@
virtual sp<EventThreadConnection> createEventConnection(
ResyncCallback, EventRegistrationFlags eventRegistration = {}) const = 0;
- // called before the screen is turned off from main thread
- virtual void onScreenReleased() = 0;
-
- // called after the screen is turned on from main thread
- virtual void onScreenAcquired() = 0;
+ // Feed clients with fake VSYNC, e.g. while the display is off.
+ virtual void enableSyntheticVsync(bool) = 0;
virtual void onHotplugReceived(PhysicalDisplayId displayId, bool connected) = 0;
@@ -159,11 +156,7 @@
VsyncEventData getLatestVsyncEventData(
const sp<EventThreadConnection>& connection) const override;
- // called before the screen is turned off from main thread
- void onScreenReleased() override;
-
- // called after the screen is turned on from main thread
- void onScreenAcquired() override;
+ void enableSyntheticVsync(bool) override;
void onHotplugReceived(PhysicalDisplayId displayId, bool connected) override;