SF: Fix threshold for next VSYNC
If debug.sf.phase_offset_threshold_for_next_vsync_ns is not set, the
threshold is set to the maximum nsecs_t value. A narrowing conversion
caused the value to overflow to -1, leading to garbage phase offsets.
Bug: 138813900
Bug: 139284671
Bug: 138942712
Test: dumpsys SurfaceFlinger --vsync
Test: atest google/perf/app-transition/app-transition-cold
Change-Id: Ib7f732be95d16d29f4a71602b56795bee09be37b
diff --git a/services/surfaceflinger/Scheduler/PhaseOffsets.cpp b/services/surfaceflinger/Scheduler/PhaseOffsets.cpp
index 9f8567d..1614ddc 100644
--- a/services/surfaceflinger/Scheduler/PhaseOffsets.cpp
+++ b/services/surfaceflinger/Scheduler/PhaseOffsets.cpp
@@ -24,7 +24,7 @@
namespace {
-std::optional<int> getProperty(const char* name) {
+std::optional<nsecs_t> getProperty(const char* name) {
char value[PROPERTY_VALUE_MAX];
property_get(name, value, "-1");
if (const int i = atoi(value); i != -1) return i;