Changed ContainerLayer's isVisible method to always return false.
ContainerLayers should always be considered not visible so they don't get
calculated when computing visible regions. However, isVisible is also used when
sending window info to InputManager about which windows can be touched.
ContainerLayers should still be considered visible to InputManager. The
function canReceiveInput was added so it can return a different value than
isVisible which only means visible to the screen.
Test: No longer composer ContainerLayers
Bug: 123686354
Change-Id: Ib39952e89ffd4ea9618b6027e7da96ef175de058
diff --git a/services/surfaceflinger/ContainerLayer.cpp b/services/surfaceflinger/ContainerLayer.cpp
index ca49f6c..29b2b0c 100644
--- a/services/surfaceflinger/ContainerLayer.cpp
+++ b/services/surfaceflinger/ContainerLayer.cpp
@@ -29,6 +29,10 @@
void ContainerLayer::onDraw(const RenderArea&, const Region& /* clip */, bool) {}
bool ContainerLayer::isVisible() const {
+ return false;
+}
+
+bool ContainerLayer::canReceiveInput() const {
return !isHiddenByPolicy();
}
diff --git a/services/surfaceflinger/ContainerLayer.h b/services/surfaceflinger/ContainerLayer.h
index 413844b..becac10 100644
--- a/services/surfaceflinger/ContainerLayer.h
+++ b/services/surfaceflinger/ContainerLayer.h
@@ -33,6 +33,8 @@
bool useIdentityTransform) override;
bool isVisible() const override;
+ bool canReceiveInput() const override;
+
void setPerFrameData(DisplayId displayId, const ui::Transform& transform, const Rect& viewport,
int32_t supportedPerFrameMetadata) override;
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 2de169d..de728b4 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -2206,7 +2206,7 @@
// Position the touchable region relative to frame screen location and restrict it to frame
// bounds.
info.touchableRegion = info.touchableRegion.translate(info.frameLeft, info.frameTop);
- info.visible = isVisible();
+ info.visible = canReceiveInput();
return info;
}
@@ -2218,6 +2218,10 @@
return nullptr;
}
+bool Layer::canReceiveInput() const {
+ return isVisible();
+}
+
// ---------------------------------------------------------------------------
}; // namespace android
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index f099df6..653dc1d 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -387,6 +387,11 @@
bool isHiddenByPolicy() const;
/*
+ * Returns whether this layer can receive input.
+ */
+ virtual bool canReceiveInput() const;
+
+ /*
* isProtected - true if the layer may contain protected content in the
* GRALLOC_USAGE_PROTECTED sense.
*/