Use real InputWindowInfo for traces and dumps
Right now we use the InputWindowInfo stored in the drawingState.
However, that doesn't include all the data sent to InputDispatcher since
we fill a lot of the data in when calling fillInputInfo. Instead, call
fillInputInfo when ready to add proto data so the InputWindowInfo shows
what's actually being used.
Test: winscope shows correct information
Change-Id: I99fb3e3babc7b33af1f83eb22da2b027129f9f88
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index a34af17..25ae001 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -2195,7 +2195,7 @@
}
LayerProto* Layer::writeToProto(LayersProto& layersProto, uint32_t traceFlags,
- const DisplayDevice* display) const {
+ const DisplayDevice* display) {
LayerProto* layerProto = layersProto.add_layers();
writeToProtoDrawingState(layerProto, traceFlags, display);
writeToProtoCommonState(layerProto, LayerVector::StateSet::Drawing, traceFlags);
@@ -2216,7 +2216,7 @@
}
void Layer::writeToProtoDrawingState(LayerProto* layerInfo, uint32_t traceFlags,
- const DisplayDevice* display) const {
+ const DisplayDevice* display) {
ui::Transform transform = getTransform();
if (traceFlags & SurfaceTracing::TRACE_CRITICAL) {
@@ -2273,7 +2273,7 @@
}
void Layer::writeToProtoCommonState(LayerProto* layerInfo, LayerVector::StateSet stateSet,
- uint32_t traceFlags) const {
+ uint32_t traceFlags) {
const bool useDrawing = stateSet == LayerVector::StateSet::Drawing;
const LayerVector& children = useDrawing ? mDrawingChildren : mCurrentChildren;
const State& state = useDrawing ? mDrawingState : mCurrentState;
@@ -2343,7 +2343,14 @@
}
if (traceFlags & SurfaceTracing::TRACE_INPUT) {
- LayerProtoHelper::writeToProto(state.inputInfo, state.touchableRegionCrop,
+ InputWindowInfo info;
+ if (useDrawing) {
+ info = fillInputInfo();
+ } else {
+ info = state.inputInfo;
+ }
+
+ LayerProtoHelper::writeToProto(info, state.touchableRegionCrop,
[&]() { return layerInfo->mutable_input_window_info(); });
}