Loading services/surfaceflinger/FrontEnd/LayerHierarchy.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ auto layerZCompare = [](const std::pair<LayerHierarchy*, LayerHierarchy::Variant auto lhsLayer = lhs.first->getLayer(); auto rhsLayer = rhs.first->getLayer(); if (lhsLayer->layerStack.id != rhsLayer->layerStack.id) { return lhsLayer->layerStack.id > rhsLayer->layerStack.id; return lhsLayer->layerStack.id < rhsLayer->layerStack.id; } if (lhsLayer->z != rhsLayer->z) { return lhsLayer->z < rhsLayer->z; Loading services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -817,7 +817,8 @@ void LayerSnapshotBuilder::updateSnapshot(LayerSnapshot& snapshot, const Args& a snapshot.frameRateSelectionPriority = requested.frameRateSelectionPriority; } if (forceUpdate || snapshot.changes.any(RequestedLayerState::Changes::Content)) { if (forceUpdate || snapshot.changes.any(RequestedLayerState::Changes::Content) || snapshot.changes.any(RequestedLayerState::Changes::AffectsChildren)) { snapshot.color.rgb = requested.getColor().rgb; snapshot.isColorspaceAgnostic = requested.colorSpaceAgnostic; snapshot.backgroundBlurRadius = args.supportsBlur Loading Loading @@ -1069,6 +1070,10 @@ void LayerSnapshotBuilder::updateInput(LayerSnapshot& snapshot, // touches from going outside the cloned area. if (path.isClone()) { snapshot.inputInfo.inputConfig |= gui::WindowInfo::InputConfig::CLONE; // Cloned layers shouldn't handle watch outside since their z order is not determined by // WM or the client. snapshot.inputInfo.inputConfig.clear(gui::WindowInfo::InputConfig::WATCH_OUTSIDE_TOUCH); mNeedsTouchableRegionCrop.insert(path); } } Loading services/surfaceflinger/FrontEnd/RequestedLayerState.cpp +7 −7 Original line number Diff line number Diff line Loading @@ -32,10 +32,6 @@ using ftl::Flags; using namespace ftl::flag_operators; namespace { std::string layerIdToString(uint32_t layerId) { return layerId == UNASSIGNED_LAYER_ID ? "none" : std::to_string(layerId); } std::string layerIdsToString(const std::vector<uint32_t>& layerIds) { std::stringstream stream; stream << "{"; Loading Loading @@ -326,9 +322,13 @@ ui::Transform RequestedLayerState::getTransform(uint32_t displayRotationFlags) c std::string RequestedLayerState::getDebugString() const { std::stringstream debug; debug << "RequestedLayerState{" << name << " parent=" << layerIdToString(parentId) << " relativeParent=" << layerIdToString(relativeParentId) << " mirrorId=" << layerIdsToString(mirrorIds) << " handle=" << handleAlive << " z=" << z; debug << "RequestedLayerState{" << name; if (parentId != UNASSIGNED_LAYER_ID) debug << " parentId=" << parentId; if (relativeParentId != UNASSIGNED_LAYER_ID) debug << " relativeParentId=" << relativeParentId; if (!mirrorIds.empty()) debug << " mirrorId=" << layerIdsToString(mirrorIds); if (!handleAlive) debug << " !handle"; if (z != 0) debug << " z=" << z; if (layerStack.id != 0) debug << " layerStack=" << layerStack.id; return debug.str(); } Loading services/surfaceflinger/tests/unittests/LayerHierarchyTest.cpp +7 −8 Original line number Diff line number Diff line Loading @@ -662,10 +662,9 @@ TEST_F(LayerHierarchyTest, zorderRespectsLayerStack) { mLifecycleManager.commitChanges(); LayerHierarchyBuilder hierarchyBuilder(mLifecycleManager.getLayers()); UPDATE_AND_VERIFY(hierarchyBuilder); std::vector<uint32_t> expectedTraversalPath = {1, 11, 2, 21}; std::vector<uint32_t> expectedTraversalPath = {2, 21, 1, 11}; EXPECT_EQ(getTraversalPath(hierarchyBuilder.getHierarchy()), expectedTraversalPath); expectedTraversalPath = {1, 11, 2, 21}; EXPECT_EQ(getTraversalPathInZOrder(hierarchyBuilder.getHierarchy()), expectedTraversalPath); expectedTraversalPath = {}; EXPECT_EQ(getTraversalPath(hierarchyBuilder.getOffscreenHierarchy()), expectedTraversalPath); Loading @@ -678,7 +677,7 @@ TEST_F(LayerHierarchyTest, canMirrorDisplay) { setLayerStack(3, 1); UPDATE_AND_VERIFY(hierarchyBuilder); std::vector<uint32_t> expected = {3, 1, 11, 111, 12, 121, 122, 1221, 13, 2, std::vector<uint32_t> expected = {1, 11, 111, 12, 121, 122, 1221, 13, 2, 3, 1, 11, 111, 12, 121, 122, 1221, 13, 2}; EXPECT_EQ(getTraversalPath(hierarchyBuilder.getHierarchy()), expected); EXPECT_EQ(getTraversalPathInZOrder(hierarchyBuilder.getHierarchy()), expected); Loading @@ -693,7 +692,7 @@ TEST_F(LayerHierarchyTest, mirrorNonExistingDisplay) { setLayerStack(3, 1); UPDATE_AND_VERIFY(hierarchyBuilder); std::vector<uint32_t> expected = {3, 1, 11, 111, 12, 121, 122, 1221, 13, 2}; std::vector<uint32_t> expected = {1, 11, 111, 12, 121, 122, 1221, 13, 2, 3}; EXPECT_EQ(getTraversalPath(hierarchyBuilder.getHierarchy()), expected); EXPECT_EQ(getTraversalPathInZOrder(hierarchyBuilder.getHierarchy()), expected); expected = {}; Loading @@ -710,7 +709,7 @@ TEST_F(LayerHierarchyTest, newRootLayerIsMirrored) { createRootLayer(4); UPDATE_AND_VERIFY(hierarchyBuilder); std::vector<uint32_t> expected = {3, 1, 11, 111, 12, 121, 122, 1221, 13, 2, 4, std::vector<uint32_t> expected = {1, 11, 111, 12, 121, 122, 1221, 13, 2, 4, 3, 1, 11, 111, 12, 121, 122, 1221, 13, 2, 4}; EXPECT_EQ(getTraversalPath(hierarchyBuilder.getHierarchy()), expected); EXPECT_EQ(getTraversalPathInZOrder(hierarchyBuilder.getHierarchy()), expected); Loading @@ -729,7 +728,7 @@ TEST_F(LayerHierarchyTest, removedRootLayerIsNoLongerMirrored) { destroyLayerHandle(1); UPDATE_AND_VERIFY(hierarchyBuilder); std::vector<uint32_t> expected = {3, 2, 2}; std::vector<uint32_t> expected = {2, 3, 2}; EXPECT_EQ(getTraversalPath(hierarchyBuilder.getHierarchy()), expected); EXPECT_EQ(getTraversalPathInZOrder(hierarchyBuilder.getHierarchy()), expected); expected = {11, 111, 12, 121, 122, 1221, 13}; Loading services/surfaceflinger/tests/unittests/LayerHierarchyTest.h +11 −0 Original line number Diff line number Diff line Loading @@ -297,6 +297,17 @@ protected: mLifecycleManager.applyTransactions(transactions); } void setBackgroundBlurRadius(uint32_t id, uint32_t backgroundBlurRadius) { std::vector<TransactionState> transactions; transactions.emplace_back(); transactions.back().states.push_back({}); transactions.back().states.front().state.what = layer_state_t::eBackgroundBlurRadiusChanged; transactions.back().states.front().layerId = id; transactions.back().states.front().state.backgroundBlurRadius = backgroundBlurRadius; mLifecycleManager.applyTransactions(transactions); } LayerLifecycleManager mLifecycleManager; }; Loading Loading
services/surfaceflinger/FrontEnd/LayerHierarchy.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ auto layerZCompare = [](const std::pair<LayerHierarchy*, LayerHierarchy::Variant auto lhsLayer = lhs.first->getLayer(); auto rhsLayer = rhs.first->getLayer(); if (lhsLayer->layerStack.id != rhsLayer->layerStack.id) { return lhsLayer->layerStack.id > rhsLayer->layerStack.id; return lhsLayer->layerStack.id < rhsLayer->layerStack.id; } if (lhsLayer->z != rhsLayer->z) { return lhsLayer->z < rhsLayer->z; Loading
services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -817,7 +817,8 @@ void LayerSnapshotBuilder::updateSnapshot(LayerSnapshot& snapshot, const Args& a snapshot.frameRateSelectionPriority = requested.frameRateSelectionPriority; } if (forceUpdate || snapshot.changes.any(RequestedLayerState::Changes::Content)) { if (forceUpdate || snapshot.changes.any(RequestedLayerState::Changes::Content) || snapshot.changes.any(RequestedLayerState::Changes::AffectsChildren)) { snapshot.color.rgb = requested.getColor().rgb; snapshot.isColorspaceAgnostic = requested.colorSpaceAgnostic; snapshot.backgroundBlurRadius = args.supportsBlur Loading Loading @@ -1069,6 +1070,10 @@ void LayerSnapshotBuilder::updateInput(LayerSnapshot& snapshot, // touches from going outside the cloned area. if (path.isClone()) { snapshot.inputInfo.inputConfig |= gui::WindowInfo::InputConfig::CLONE; // Cloned layers shouldn't handle watch outside since their z order is not determined by // WM or the client. snapshot.inputInfo.inputConfig.clear(gui::WindowInfo::InputConfig::WATCH_OUTSIDE_TOUCH); mNeedsTouchableRegionCrop.insert(path); } } Loading
services/surfaceflinger/FrontEnd/RequestedLayerState.cpp +7 −7 Original line number Diff line number Diff line Loading @@ -32,10 +32,6 @@ using ftl::Flags; using namespace ftl::flag_operators; namespace { std::string layerIdToString(uint32_t layerId) { return layerId == UNASSIGNED_LAYER_ID ? "none" : std::to_string(layerId); } std::string layerIdsToString(const std::vector<uint32_t>& layerIds) { std::stringstream stream; stream << "{"; Loading Loading @@ -326,9 +322,13 @@ ui::Transform RequestedLayerState::getTransform(uint32_t displayRotationFlags) c std::string RequestedLayerState::getDebugString() const { std::stringstream debug; debug << "RequestedLayerState{" << name << " parent=" << layerIdToString(parentId) << " relativeParent=" << layerIdToString(relativeParentId) << " mirrorId=" << layerIdsToString(mirrorIds) << " handle=" << handleAlive << " z=" << z; debug << "RequestedLayerState{" << name; if (parentId != UNASSIGNED_LAYER_ID) debug << " parentId=" << parentId; if (relativeParentId != UNASSIGNED_LAYER_ID) debug << " relativeParentId=" << relativeParentId; if (!mirrorIds.empty()) debug << " mirrorId=" << layerIdsToString(mirrorIds); if (!handleAlive) debug << " !handle"; if (z != 0) debug << " z=" << z; if (layerStack.id != 0) debug << " layerStack=" << layerStack.id; return debug.str(); } Loading
services/surfaceflinger/tests/unittests/LayerHierarchyTest.cpp +7 −8 Original line number Diff line number Diff line Loading @@ -662,10 +662,9 @@ TEST_F(LayerHierarchyTest, zorderRespectsLayerStack) { mLifecycleManager.commitChanges(); LayerHierarchyBuilder hierarchyBuilder(mLifecycleManager.getLayers()); UPDATE_AND_VERIFY(hierarchyBuilder); std::vector<uint32_t> expectedTraversalPath = {1, 11, 2, 21}; std::vector<uint32_t> expectedTraversalPath = {2, 21, 1, 11}; EXPECT_EQ(getTraversalPath(hierarchyBuilder.getHierarchy()), expectedTraversalPath); expectedTraversalPath = {1, 11, 2, 21}; EXPECT_EQ(getTraversalPathInZOrder(hierarchyBuilder.getHierarchy()), expectedTraversalPath); expectedTraversalPath = {}; EXPECT_EQ(getTraversalPath(hierarchyBuilder.getOffscreenHierarchy()), expectedTraversalPath); Loading @@ -678,7 +677,7 @@ TEST_F(LayerHierarchyTest, canMirrorDisplay) { setLayerStack(3, 1); UPDATE_AND_VERIFY(hierarchyBuilder); std::vector<uint32_t> expected = {3, 1, 11, 111, 12, 121, 122, 1221, 13, 2, std::vector<uint32_t> expected = {1, 11, 111, 12, 121, 122, 1221, 13, 2, 3, 1, 11, 111, 12, 121, 122, 1221, 13, 2}; EXPECT_EQ(getTraversalPath(hierarchyBuilder.getHierarchy()), expected); EXPECT_EQ(getTraversalPathInZOrder(hierarchyBuilder.getHierarchy()), expected); Loading @@ -693,7 +692,7 @@ TEST_F(LayerHierarchyTest, mirrorNonExistingDisplay) { setLayerStack(3, 1); UPDATE_AND_VERIFY(hierarchyBuilder); std::vector<uint32_t> expected = {3, 1, 11, 111, 12, 121, 122, 1221, 13, 2}; std::vector<uint32_t> expected = {1, 11, 111, 12, 121, 122, 1221, 13, 2, 3}; EXPECT_EQ(getTraversalPath(hierarchyBuilder.getHierarchy()), expected); EXPECT_EQ(getTraversalPathInZOrder(hierarchyBuilder.getHierarchy()), expected); expected = {}; Loading @@ -710,7 +709,7 @@ TEST_F(LayerHierarchyTest, newRootLayerIsMirrored) { createRootLayer(4); UPDATE_AND_VERIFY(hierarchyBuilder); std::vector<uint32_t> expected = {3, 1, 11, 111, 12, 121, 122, 1221, 13, 2, 4, std::vector<uint32_t> expected = {1, 11, 111, 12, 121, 122, 1221, 13, 2, 4, 3, 1, 11, 111, 12, 121, 122, 1221, 13, 2, 4}; EXPECT_EQ(getTraversalPath(hierarchyBuilder.getHierarchy()), expected); EXPECT_EQ(getTraversalPathInZOrder(hierarchyBuilder.getHierarchy()), expected); Loading @@ -729,7 +728,7 @@ TEST_F(LayerHierarchyTest, removedRootLayerIsNoLongerMirrored) { destroyLayerHandle(1); UPDATE_AND_VERIFY(hierarchyBuilder); std::vector<uint32_t> expected = {3, 2, 2}; std::vector<uint32_t> expected = {2, 3, 2}; EXPECT_EQ(getTraversalPath(hierarchyBuilder.getHierarchy()), expected); EXPECT_EQ(getTraversalPathInZOrder(hierarchyBuilder.getHierarchy()), expected); expected = {11, 111, 12, 121, 122, 1221, 13}; Loading
services/surfaceflinger/tests/unittests/LayerHierarchyTest.h +11 −0 Original line number Diff line number Diff line Loading @@ -297,6 +297,17 @@ protected: mLifecycleManager.applyTransactions(transactions); } void setBackgroundBlurRadius(uint32_t id, uint32_t backgroundBlurRadius) { std::vector<TransactionState> transactions; transactions.emplace_back(); transactions.back().states.push_back({}); transactions.back().states.front().state.what = layer_state_t::eBackgroundBlurRadiusChanged; transactions.back().states.front().layerId = id; transactions.back().states.front().state.backgroundBlurRadius = backgroundBlurRadius; mLifecycleManager.applyTransactions(transactions); } LayerLifecycleManager mLifecycleManager; }; Loading