diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-01-11 22:19:32 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-01-11 22:19:32 +0000 |
commit | 592fc6986c0cdcd3885ef5fd0c07c1162b7bf910 (patch) | |
tree | 5e3cd09398ba0691418e83c85973ee0a4bb4122b | |
parent | 8748247dc23093761cc62c8feda4ff88bab46d22 (diff) | |
parent | 196f68cffb90b111581e6a47ec0ce2c1fd70e7d8 (diff) | |
download | native-592fc6986c0cdcd3885ef5fd0c07c1162b7bf910.tar.gz |
Merge cherrypicks of ['googleplex-android-review.googlesource.com/25851257'] into 24Q1-release.
Change-Id: Ib75bc18824fdb205f0add1b9ee99bd7759a762aa
-rw-r--r-- | services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp | 4 | ||||
-rw-r--r-- | services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp | 17 |
2 files changed, 19 insertions, 2 deletions
diff --git a/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp b/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp index ad5e42be37..bb32afa991 100644 --- a/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp +++ b/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp @@ -1217,8 +1217,8 @@ void LayerSnapshotBuilder::updateTouchableRegionCrop(const Args& args) { Rect inputBoundsInDisplaySpace = getInputBoundsInDisplaySpace(*cropLayerSnapshot, inputBounds, displayInfo.transform); - snapshot->inputInfo.touchableRegion = snapshot->inputInfo.touchableRegion.intersect( - displayInfo.transform.transform(inputBoundsInDisplaySpace)); + snapshot->inputInfo.touchableRegion = + snapshot->inputInfo.touchableRegion.intersect(inputBoundsInDisplaySpace); } // If the layer is a clone, we need to crop the input region to cloned root to prevent diff --git a/services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp b/services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp index 50cd784725..f7492c32af 100644 --- a/services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp +++ b/services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp @@ -354,6 +354,23 @@ TEST_F(LayerSnapshotTest, CanCropTouchableRegion) { EXPECT_EQ(getSnapshot({.id = 111})->inputInfo.touchableRegion.bounds(), modifiedTouchCrop); } +TEST_F(LayerSnapshotTest, CanCropTouchableRegionWithDisplayTransform) { + DisplayInfo displayInfo; + displayInfo.transform = ui::Transform(ui::Transform::RotationFlags::ROT_90, 1000, 1000); + mFrontEndDisplayInfos.emplace_or_replace(ui::LayerStack::fromValue(1), displayInfo); + + Rect touchCrop{300, 300, 400, 500}; + createRootLayer(3); + setCrop(3, touchCrop); + setLayerStack(3, 1); + Region touch{Rect{0, 0, 1000, 1000}}; + setTouchableRegionCrop(3, touch, /*touchCropId=*/3, /*replaceTouchableRegionWithCrop=*/false); + + UPDATE_AND_VERIFY(mSnapshotBuilder, {1, 11, 111, 12, 121, 122, 1221, 13, 2, 3}); + Rect rotatedCrop = {500, 300, 700, 400}; + EXPECT_EQ(getSnapshot({.id = 3})->inputInfo.touchableRegion.bounds(), rotatedCrop); +} + TEST_F(LayerSnapshotTest, blurUpdatesWhenAlphaChanges) { int blurRadius = 42; setBackgroundBlurRadius(1221, static_cast<uint32_t>(blurRadius)); |