Inform SurfaceFlinger about displays which receive input
Right now, multiple display devices can share a layerstack.
This means that when constructing InputWindowInfo, its
impossible to know which display transform matches the
display viewport that inputflinger dispatches against. To
remedy this, have displaymanager inform surfaceflinger
which displays "receiveInput" using the same logic that
controls which display viewport it sends to inputflinger.
Bug: 179274888
Test: atest SetDisplayStateLockedTest
Change-Id: If0ffb1b5405f7e7dcdf8ea2f12c109d661a540fe
diff --git a/services/surfaceflinger/DisplayDevice.h b/services/surfaceflinger/DisplayDevice.h
index bf249cd..3c39a92 100644
--- a/services/surfaceflinger/DisplayDevice.h
+++ b/services/surfaceflinger/DisplayDevice.h
@@ -64,6 +64,7 @@
public:
constexpr static float sDefaultMinLumiance = 0.0;
constexpr static float sDefaultMaxLumiance = 500.0;
+ enum { eReceivesInput = 0x01 };
explicit DisplayDevice(DisplayDeviceCreationArgs& args);
@@ -90,6 +91,7 @@
void setLayerStack(ui::LayerStack);
void setDisplaySize(int width, int height);
void setProjection(ui::Rotation orientation, Rect viewport, Rect frame);
+ void setFlags(uint32_t flags);
ui::Rotation getPhysicalOrientation() const { return mPhysicalOrientation; }
ui::Rotation getOrientation() const { return mOrientation; }
@@ -102,6 +104,7 @@
const Rect& getOrientedDisplaySpaceRect() const;
bool needsFiltering() const;
ui::LayerStack getLayerStack() const;
+ bool receivesInput() const { return mFlags & eReceivesInput; }
// Returns the physical ID of this display. This function asserts the ID is physical and it
// shouldn't be called for other display types, e.g. virtual.
@@ -221,6 +224,8 @@
// TODO(b/74619554): Remove special cases for primary display.
const bool mIsPrimary;
+ uint32_t mFlags = 0;
+
std::optional<DeviceProductInfo> mDeviceProductInfo;
std::vector<ui::Hdr> mOverrideHdrTypes;
@@ -246,6 +251,7 @@
std::optional<Physical> physical;
sp<IGraphicBufferProducer> surface;
ui::LayerStack layerStack = ui::NO_LAYER_STACK;
+ uint32_t flags = 0;
Rect layerStackSpaceRect;
Rect orientedDisplaySpaceRect;
ui::Rotation orientation = ui::ROTATION_0;