SF: fix SurfaceFlinger crash [1/1]
PD#SWPL-144146
Problem:
SurfaceFlinger crash. The race condition was described in
b/312686113#comment4.
Solution:
during VSyncDispatchTimerQueue deconstruction
skip timerCallback to avoid sf crash
Verify:
adt4, a TV set top box.
Bug: 312686113
Test: Suspend <-> resume for over 7 days. "Skip timerCallback" showed 15 times without SF crash.
Change-Id: I3cbf0294ee70dde697cba91962477d51c1bc986e
Signed-off-by: En Liu <en.liu@amlogic.com>
diff --git a/services/surfaceflinger/Scheduler/VSyncDispatchTimerQueue.h b/services/surfaceflinger/Scheduler/VSyncDispatchTimerQueue.h
index e0fb8f9..3d08410 100644
--- a/services/surfaceflinger/Scheduler/VSyncDispatchTimerQueue.h
+++ b/services/surfaceflinger/Scheduler/VSyncDispatchTimerQueue.h
@@ -148,6 +148,10 @@
std::mutex mutable mMutex;
+ // During VSyncDispatchTimerQueue deconstruction, skip timerCallback to
+ // avoid crash
+ bool mRunning = true;
+
static constexpr nsecs_t kInvalidTime = std::numeric_limits<int64_t>::max();
std::unique_ptr<TimeKeeper> const mTimeKeeper;
VsyncSchedule::TrackerPtr mTracker;