SF: correct runaway RegionSamplingThread timer

In some cases, the VSyncReactor timer would keep firing even
after the registration was stopped. This was because the
onDispSyncEvent callback would cancel its timer from within
its callback, and then VSR would not check if the callback
had stopped itself before rescheduling the callback again.

Fixes: 149221293
Test: 1 new unit test
Test: ensure timerDispatch thread is quiet when display off
Test: [todo] verify using powerStats procedure in bug.

Change-Id: I5314c8d01de7d125c31488e48c7f2c550d201701
diff --git a/services/surfaceflinger/Scheduler/VSyncReactor.cpp b/services/surfaceflinger/Scheduler/VSyncReactor.cpp
index da73e4e..949ba4c 100644
--- a/services/surfaceflinger/Scheduler/VSyncReactor.cpp
+++ b/services/surfaceflinger/Scheduler/VSyncReactor.cpp
@@ -98,6 +98,9 @@
 
         {
             std::lock_guard<std::mutex> lk(mMutex);
+            if (mStopped) {
+                return;
+            }
             auto const schedule_result = mRegistration.schedule(calculateWorkload(), vsynctime);
             LOG_ALWAYS_FATAL_IF((schedule_result != ScheduleResult::Scheduled),
                                 "Error rescheduling callback: rc %X", schedule_result);