SurfaceFlinger: make sure VsyncPredictor always maintains a valid slope
- Add a safety check around the predicated vsync period in case
the timestamps we got from present fences are incorrect.
We suspect this happens when the device is in AOD.
- Ignore present fences when device is in AOD.
Change-Id: Ib02287cb0b8e693b1f5f384d754c2c3d978024dc
Test: adb shell /data/nativetest64/libsurfaceflinger_unittest/libsurfaceflinger_unittest
Bug: 149299560
diff --git a/services/surfaceflinger/Scheduler/VSyncPredictor.h b/services/surfaceflinger/Scheduler/VSyncPredictor.h
index 532fe9e..ef1d88a 100644
--- a/services/surfaceflinger/Scheduler/VSyncPredictor.h
+++ b/services/surfaceflinger/Scheduler/VSyncPredictor.h
@@ -83,8 +83,8 @@
std::unordered_map<nsecs_t, std::tuple<nsecs_t, nsecs_t>> mutable mRateMap GUARDED_BY(mMutex);
- int lastTimestampIndex GUARDED_BY(mMutex) = 0;
- std::vector<nsecs_t> timestamps GUARDED_BY(mMutex);
+ int mLastTimestampIndex GUARDED_BY(mMutex) = 0;
+ std::vector<nsecs_t> mTimestamps GUARDED_BY(mMutex);
};
} // namespace android::scheduler