Add Window Infos state to dumpsys
Update SurfaceFlinger and InputDispatcher dumpsys output to include
the vsync id and timestamp of Window Infos changes.
Bug: 279792237
Test: presubmits
Change-Id: I17fba2d09972467cfdd452e5041666ffbeabddc9
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp
index 8c08ef2..bf52502 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.cpp
+++ b/services/inputflinger/dispatcher/InputDispatcher.cpp
@@ -5572,6 +5572,14 @@
} else {
dump += INDENT "Displays: <none>\n";
}
+ dump += INDENT "Window Infos:\n";
+ dump += StringPrintf(INDENT2 "vsync id: %" PRId64 "\n", mWindowInfosVsyncId);
+ dump += StringPrintf(INDENT2 "timestamp (ns): %" PRId64 "\n", mWindowInfosTimestamp);
+ dump += "\n";
+ dump += StringPrintf(INDENT2 "max update delay (ns): %" PRId64 "\n", mMaxWindowInfosDelay);
+ dump += StringPrintf(INDENT2 "max update delay vsync id: %" PRId64 "\n",
+ mMaxWindowInfosDelayVsyncId);
+ dump += "\n";
if (!mGlobalMonitorsByDisplay.empty()) {
for (const auto& [displayId, monitors] : mGlobalMonitorsByDisplay) {
@@ -6580,12 +6588,11 @@
mLooper->wake();
}
-void InputDispatcher::onWindowInfosChanged(const std::vector<WindowInfo>& windowInfos,
- const std::vector<DisplayInfo>& displayInfos) {
+void InputDispatcher::onWindowInfosChanged(const gui::WindowInfosUpdate& update) {
// The listener sends the windows as a flattened array. Separate the windows by display for
// more convenient parsing.
std::unordered_map<int32_t, std::vector<sp<WindowInfoHandle>>> handlesPerDisplay;
- for (const auto& info : windowInfos) {
+ for (const auto& info : update.windowInfos) {
handlesPerDisplay.emplace(info.displayId, std::vector<sp<WindowInfoHandle>>());
handlesPerDisplay[info.displayId].push_back(sp<WindowInfoHandle>::make(info));
}
@@ -6600,13 +6607,22 @@
}
mDisplayInfos.clear();
- for (const auto& displayInfo : displayInfos) {
+ for (const auto& displayInfo : update.displayInfos) {
mDisplayInfos.emplace(displayInfo.displayId, displayInfo);
}
for (const auto& [displayId, handles] : handlesPerDisplay) {
setInputWindowsLocked(handles, displayId);
}
+
+ mWindowInfosVsyncId = update.vsyncId;
+ mWindowInfosTimestamp = update.timestamp;
+
+ int64_t delay = systemTime() - update.timestamp;
+ if (delay > mMaxWindowInfosDelay) {
+ mMaxWindowInfosDelay = delay;
+ mMaxWindowInfosDelayVsyncId = update.vsyncId;
+ }
}
// Wake up poll loop since it may need to make new input dispatching choices.
mLooper->wake();
@@ -6629,9 +6645,8 @@
}
void InputDispatcher::DispatcherWindowListener::onWindowInfosChanged(
- const std::vector<gui::WindowInfo>& windowInfos,
- const std::vector<DisplayInfo>& displayInfos) {
- mDispatcher.onWindowInfosChanged(windowInfos, displayInfos);
+ const gui::WindowInfosUpdate& update) {
+ mDispatcher.onWindowInfosChanged(update);
}
void InputDispatcher::cancelCurrentTouch() {