diff options
| -rw-r--r-- | libs/gui/BLASTBufferQueue.cpp | 5 | ||||
| -rw-r--r-- | libs/gui/include/gui/BLASTBufferQueue.h | 2 | ||||
| -rw-r--r-- | libs/gui/tests/EndToEndNativeInputTest.cpp | 14 | ||||
| -rw-r--r-- | services/surfaceflinger/BufferLayer.cpp | 2 | ||||
| -rw-r--r-- | services/surfaceflinger/BufferStateLayer.cpp | 2 | ||||
| -rw-r--r-- | services/surfaceflinger/Layer.cpp | 14 | ||||
| -rw-r--r-- | services/surfaceflinger/Layer.h | 1 | ||||
| -rw-r--r-- | services/surfaceflinger/tests/WindowInfosListener_test.cpp | 3 |
8 files changed, 37 insertions, 6 deletions
diff --git a/libs/gui/BLASTBufferQueue.cpp b/libs/gui/BLASTBufferQueue.cpp index 085a11a88e..f357c17e28 100644 --- a/libs/gui/BLASTBufferQueue.cpp +++ b/libs/gui/BLASTBufferQueue.cpp @@ -988,4 +988,9 @@ uint32_t BLASTBufferQueue::getLastTransformHint() const { } } +uint64_t BLASTBufferQueue::getLastAcquiredFrameNum() { + std::unique_lock _lock{mMutex}; + return mLastAcquiredFrameNumber; +} + } // namespace android diff --git a/libs/gui/include/gui/BLASTBufferQueue.h b/libs/gui/include/gui/BLASTBufferQueue.h index 615f284e42..698844c849 100644 --- a/libs/gui/include/gui/BLASTBufferQueue.h +++ b/libs/gui/include/gui/BLASTBufferQueue.h @@ -110,6 +110,8 @@ public: uint32_t getLastTransformHint() const; void flushShadowQueue(); + uint64_t getLastAcquiredFrameNum(); + virtual ~BLASTBufferQueue(); private: diff --git a/libs/gui/tests/EndToEndNativeInputTest.cpp b/libs/gui/tests/EndToEndNativeInputTest.cpp index 78a8b429c1..5daef0df28 100644 --- a/libs/gui/tests/EndToEndNativeInputTest.cpp +++ b/libs/gui/tests/EndToEndNativeInputTest.cpp @@ -931,6 +931,20 @@ TEST_F(InputSurfacesTest, strict_unobscured_input_cropped_window) { EXPECT_EQ(surface->consumeEvent(100), nullptr); } +TEST_F(InputSurfacesTest, ignore_touch_region_with_zero_sized_blast) { + std::unique_ptr<InputSurface> surface = makeSurface(100, 100); + + std::unique_ptr<BlastInputSurface> bufferSurface = + BlastInputSurface::makeBlastInputSurface(mComposerClient, 0, 0); + + surface->showAt(100, 100); + bufferSurface->mInputInfo.touchableRegion.orSelf(Rect(0, 0, 200, 200)); + bufferSurface->showAt(100, 100, Rect::EMPTY_RECT); + + injectTap(101, 101); + surface->expectTap(1, 1); +} + TEST_F(InputSurfacesTest, drop_input_policy) { std::unique_ptr<InputSurface> surface = makeSurface(100, 100); surface->doTransaction( diff --git a/services/surfaceflinger/BufferLayer.cpp b/services/surfaceflinger/BufferLayer.cpp index 71db330f01..8c97f127e5 100644 --- a/services/surfaceflinger/BufferLayer.cpp +++ b/services/surfaceflinger/BufferLayer.cpp @@ -831,7 +831,7 @@ void BufferLayer::updateCloneBufferInfo() { wp<Layer> tmpTouchableRegionCrop = mDrawingState.touchableRegionCrop; WindowInfo tmpInputInfo = mDrawingState.inputInfo; - mDrawingState = clonedFrom->mDrawingState; + cloneDrawingState(clonedFrom.get()); mDrawingState.touchableRegionCrop = tmpTouchableRegionCrop; mDrawingState.zOrderRelativeOf = tmpZOrderRelativeOf; diff --git a/services/surfaceflinger/BufferStateLayer.cpp b/services/surfaceflinger/BufferStateLayer.cpp index cd531d6afc..df91904ac8 100644 --- a/services/surfaceflinger/BufferStateLayer.cpp +++ b/services/surfaceflinger/BufferStateLayer.cpp @@ -66,7 +66,7 @@ BufferStateLayer::~BufferStateLayer() { // one of the layers, in this case the original layer, needs to handle the deletion. The // original layer and the clone should be removed at the same time so there shouldn't be any // issue with the clone layer trying to use the texture. - if (mBufferInfo.mBuffer != nullptr && !isClone()) { + if (mBufferInfo.mBuffer != nullptr) { callReleaseBufferCallback(mDrawingState.releaseBufferListener, mBufferInfo.mBuffer->getBuffer(), mBufferInfo.mFrameNumber, mBufferInfo.mFence, mTransformHint, diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index e2f34fabc2..4d804fa670 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -2213,6 +2213,8 @@ void Layer::fillInputFrameInfo(WindowInfo& info, const ui::Transform& toNonRotat info.frameRight = 0; info.frameBottom = 0; info.transform.reset(); + info.touchableRegion = Region(); + info.flags = WindowInfo::Flag::NOT_TOUCH_MODAL | WindowInfo::Flag::NOT_FOCUSABLE; return; } @@ -2485,8 +2487,7 @@ Region Layer::getVisibleRegion(const DisplayDevice* display) const { } void Layer::setInitialValuesForClone(const sp<Layer>& clonedFrom) { - // copy drawing state from cloned layer - mDrawingState = clonedFrom->mDrawingState; + cloneDrawingState(clonedFrom.get()); mClonedFrom = clonedFrom; } @@ -2521,7 +2522,7 @@ void Layer::updateClonedDrawingState(std::map<sp<Layer>, sp<Layer>>& clonedLayer // since we may be able to pull out other children that are still alive. if (isClonedFromAlive()) { sp<Layer> clonedFrom = getClonedFrom(); - mDrawingState = clonedFrom->mDrawingState; + cloneDrawingState(clonedFrom.get()); clonedLayersMap.emplace(clonedFrom, this); } @@ -2684,6 +2685,13 @@ bool Layer::setDropInputMode(gui::DropInputMode mode) { return true; } +void Layer::cloneDrawingState(const Layer* from) { + mDrawingState = from->mDrawingState; + // Skip callback info since they are not applicable for cloned layers. + mDrawingState.releaseBufferListener = nullptr; + mDrawingState.callbackHandles = {}; +} + // --------------------------------------------------------------------------- std::ostream& operator<<(std::ostream& stream, const Layer::FrameRate& rate) { diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h index b107f8e9d7..c1af4685f0 100644 --- a/services/surfaceflinger/Layer.h +++ b/services/surfaceflinger/Layer.h @@ -929,6 +929,7 @@ protected: bool isClone() { return mClonedFrom != nullptr; } bool isClonedFromAlive() { return getClonedFrom() != nullptr; } + void cloneDrawingState(const Layer* from); void updateClonedDrawingState(std::map<sp<Layer>, sp<Layer>>& clonedLayersMap); void updateClonedChildren(const sp<Layer>& mirrorRoot, std::map<sp<Layer>, sp<Layer>>& clonedLayersMap); diff --git a/services/surfaceflinger/tests/WindowInfosListener_test.cpp b/services/surfaceflinger/tests/WindowInfosListener_test.cpp index 89228d55e5..15b79be06c 100644 --- a/services/surfaceflinger/tests/WindowInfosListener_test.cpp +++ b/services/surfaceflinger/tests/WindowInfosListener_test.cpp @@ -110,11 +110,12 @@ TEST_F(WindowInfosListenerTest, WindowInfoChanged) { sp<SurfaceControl> surfaceControl = mClient->createSurface(String8(name.c_str()), 100, 100, PIXEL_FORMAT_RGBA_8888, ISurfaceComposerClient::eFXSurfaceBufferState); - + const Rect crop(0, 0, 100, 100); Transaction() .setLayerStack(surfaceControl, 0) .show(surfaceControl) .setLayer(surfaceControl, INT32_MAX - 1) + .setCrop(surfaceControl, crop) .setInputWindowInfo(surfaceControl, windowInfo) .apply(); |