Loading services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -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 Loading services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp +17 −0 Original line number Diff line number Diff line Loading @@ -353,6 +353,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)); Loading Loading
services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -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 Loading
services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp +17 −0 Original line number Diff line number Diff line Loading @@ -353,6 +353,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)); Loading