SF: fix frameTimelineVsyncId = 0
Fix a case where we would send 0 as the frame vsync id,
which is incorrect.
Test: expand notification shade + press power button
Bug: 181694819
Bug: 162890590
Change-Id: I7b910f9d022424a9a5246883d958f0c2a1933f5c
diff --git a/services/surfaceflinger/Scheduler/EventThread.cpp b/services/surfaceflinger/Scheduler/EventThread.cpp
index ba43e70..6553efe 100644
--- a/services/surfaceflinger/Scheduler/EventThread.cpp
+++ b/services/surfaceflinger/Scheduler/EventThread.cpp
@@ -354,7 +354,7 @@
return mTokenManager->generateTokenForPredictions(
{timestamp, deadlineTimestamp, expectedVSyncTimestamp});
}
- return static_cast<int64_t>(0);
+ return FrameTimelineInfo::INVALID_VSYNC_ID;
}();
mPendingEvents.push_back(makeVSync(mVSyncState->displayId, timestamp, ++mVSyncState->count,
@@ -494,10 +494,16 @@
const auto now = systemTime(SYSTEM_TIME_MONOTONIC);
const auto deadlineTimestamp = now + timeout.count();
const auto expectedVSyncTime = deadlineTimestamp + timeout.count();
- // TODO(b/162890590): use TokenManager to populate vsyncId
+ const int64_t vsyncId = [&] {
+ if (mTokenManager != nullptr) {
+ return mTokenManager->generateTokenForPredictions(
+ {now, deadlineTimestamp, expectedVSyncTime});
+ }
+ return FrameTimelineInfo::INVALID_VSYNC_ID;
+ }();
mPendingEvents.push_back(makeVSync(mVSyncState->displayId, now,
++mVSyncState->count, expectedVSyncTime,
- deadlineTimestamp, /*vsyncId=*/0));
+ deadlineTimestamp, vsyncId));
}
}
}