summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2018-12-07 03:01:41 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2018-12-07 03:01:41 +0000
commitd1b8b46e028f4cda74fa14323f0e6714e1401a51 (patch)
treea3c35a980560fecd4c36cfe75f806bad483c32e8
parentc4316eba65080fcab7b163124098537d7b2bcd5e (diff)
parent51625fa3f0663b5f12f0838a619c49a1bfc9533f (diff)
Merge "Input: Let WM compute touchable region 1/2"
-rw-r--r--services/surfaceflinger/Layer.cpp7
-rw-r--r--services/surfaceflinger/Layer.h2
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp5
3 files changed, 9 insertions, 5 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index d628995276..91be71e390 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -293,8 +293,10 @@ static FloatRect reduce(const FloatRect& win, const Region& exclude) {
return Region(Rect{win}).subtract(exclude).getBounds().toFloatRect();
}
-Rect Layer::computeScreenBounds() const {
- FloatRect bounds = computeBounds();
+Rect Layer::computeScreenBounds(bool reduceTransparentRegion) const {
+ const State& s(getDrawingState());
+ Region transparentRegion = reduceTransparentRegion ? getActiveTransparentRegion(s) : Region();
+ FloatRect bounds = computeBounds(transparentRegion);
ui::Transform t = getTransform();
// Transform to screen space.
bounds = t.transform(bounds);
@@ -2155,7 +2157,6 @@ InputWindowInfo Layer::fillInputInfo(const Rect& screenBounds) {
// 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.touchableRegion = info.touchableRegion.intersect(frame);
info.visible = isVisible();
return info;
}
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 9e910a80db..7b6709e20b 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -617,7 +617,7 @@ public:
ssize_t removeChild(const sp<Layer>& layer);
sp<Layer> getParent() const { return mCurrentParent.promote(); }
bool hasParent() const { return getParent() != nullptr; }
- Rect computeScreenBounds() const;
+ Rect computeScreenBounds(bool reduceTransparentRegion = true) const;
bool setChildLayer(const sp<Layer>& childLayer, int32_t z);
bool setChildRelativeLayer(const sp<Layer>& childLayer,
const sp<IBinder>& relativeToHandle, int32_t relativeZ);
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index a8442c58f2..a142928153 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2767,7 +2767,10 @@ void SurfaceFlinger::updateInputWindows() {
mDrawingState.traverseInReverseZOrder([&](Layer* layer) {
if (layer->hasInput()) {
- inputHandles.add(layer->fillInputInfo(layer->computeScreenBounds()));
+ // When calculating the screen bounds we ignore the transparent region since it may
+ // result in an unwanted offset.
+ inputHandles.add(layer->fillInputInfo(
+ layer->computeScreenBounds(false /* reduceTransparentRegion */)));
}
});
mInputFlinger->setInputWindows(inputHandles);