Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2022 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include <gmock/gmock.h> |
| 18 | #include <gtest/gtest.h> |
| 19 | |
Vishnu Nair | 2662ebb | 2023-08-31 23:20:46 +0000 | [diff] [blame] | 20 | #include <renderengine/mock/FakeExternalTexture.h> |
| 21 | |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 22 | #include "FrontEnd/LayerLifecycleManager.h" |
Vishnu Nair | 1391de2 | 2023-03-05 19:56:14 -0800 | [diff] [blame] | 23 | #include "LayerHierarchyTest.h" |
| 24 | #include "TransactionState.h" |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 25 | |
| 26 | using namespace android::surfaceflinger; |
| 27 | |
| 28 | namespace android::surfaceflinger::frontend { |
| 29 | |
Vishnu Nair | 2662ebb | 2023-08-31 23:20:46 +0000 | [diff] [blame] | 30 | using namespace ftl::flag_operators; |
| 31 | |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 32 | // To run test: |
| 33 | /** |
| 34 | mp :libsurfaceflinger_unittest && adb sync; adb shell \ |
| 35 | /data/nativetest/libsurfaceflinger_unittest/libsurfaceflinger_unittest \ |
| 36 | --gtest_filter="LayerLifecycleManagerTest.*" --gtest_repeat=100 \ |
| 37 | --gtest_shuffle \ |
| 38 | --gtest_brief=1 |
| 39 | */ |
| 40 | class ExpectLayerLifecycleListener : public LayerLifecycleManager::ILifecycleListener { |
| 41 | public: |
| 42 | void onLayerAdded(const RequestedLayerState& layer) override { |
Vishnu Nair | 150065b | 2023-04-17 19:14:11 -0700 | [diff] [blame] | 43 | mActualLayersAdded.push_back(layer.id); |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 44 | }; |
| 45 | void onLayerDestroyed(const RequestedLayerState& layer) override { |
| 46 | mActualLayersDestroyed.emplace(layer.id); |
| 47 | }; |
| 48 | |
Vishnu Nair | 150065b | 2023-04-17 19:14:11 -0700 | [diff] [blame] | 49 | void expectLayersAdded(const std::vector<uint32_t>& expectedLayersAdded) { |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 50 | EXPECT_EQ(expectedLayersAdded, mActualLayersAdded); |
| 51 | mActualLayersAdded.clear(); |
| 52 | } |
| 53 | void expectLayersDestroyed(const std::unordered_set<uint32_t>& expectedLayersDestroyed) { |
| 54 | EXPECT_EQ(expectedLayersDestroyed, mActualLayersDestroyed); |
| 55 | mActualLayersDestroyed.clear(); |
| 56 | } |
| 57 | |
Vishnu Nair | 150065b | 2023-04-17 19:14:11 -0700 | [diff] [blame] | 58 | std::vector<uint32_t> mActualLayersAdded; |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 59 | std::unordered_set<uint32_t> mActualLayersDestroyed; |
| 60 | }; |
| 61 | |
Vishnu Nair | 1391de2 | 2023-03-05 19:56:14 -0800 | [diff] [blame] | 62 | class LayerLifecycleManagerTest : public LayerHierarchyTestBase { |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 63 | protected: |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 64 | RequestedLayerState* getRequestedLayerState(LayerLifecycleManager& lifecycleManager, |
| 65 | uint32_t layerId) { |
| 66 | return lifecycleManager.getLayerFromId(layerId); |
| 67 | } |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 68 | }; |
| 69 | |
| 70 | TEST_F(LayerLifecycleManagerTest, addLayers) { |
| 71 | LayerLifecycleManager lifecycleManager; |
| 72 | auto listener = std::make_shared<ExpectLayerLifecycleListener>(); |
| 73 | lifecycleManager.addLifecycleListener(listener); |
| 74 | std::vector<std::unique_ptr<RequestedLayerState>> layers; |
| 75 | layers.emplace_back(rootLayer(1)); |
| 76 | layers.emplace_back(rootLayer(2)); |
| 77 | layers.emplace_back(rootLayer(3)); |
| 78 | lifecycleManager.addLayers(std::move(layers)); |
Vishnu Nair | 606d9d0 | 2023-08-19 14:20:18 -0700 | [diff] [blame] | 79 | lifecycleManager.onHandlesDestroyed({{1, "1"}, {2, "2"}, {3, "3"}}); |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 80 | EXPECT_TRUE(lifecycleManager.getGlobalChanges().test(RequestedLayerState::Changes::Hierarchy)); |
| 81 | lifecycleManager.commitChanges(); |
| 82 | EXPECT_FALSE(lifecycleManager.getGlobalChanges().test(RequestedLayerState::Changes::Hierarchy)); |
| 83 | listener->expectLayersAdded({1, 2, 3}); |
| 84 | listener->expectLayersDestroyed({1, 2, 3}); |
| 85 | } |
| 86 | |
| 87 | TEST_F(LayerLifecycleManagerTest, updateLayerStates) { |
| 88 | LayerLifecycleManager lifecycleManager; |
| 89 | std::vector<std::unique_ptr<RequestedLayerState>> layers; |
| 90 | layers.emplace_back(rootLayer(1)); |
| 91 | lifecycleManager.addLayers(std::move(layers)); |
Vishnu Nair | 1391de2 | 2023-03-05 19:56:14 -0800 | [diff] [blame] | 92 | lifecycleManager.applyTransactions(setZTransaction(1, 2)); |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 93 | |
| 94 | auto& managedLayers = lifecycleManager.getLayers(); |
| 95 | ASSERT_EQ(managedLayers.size(), 1u); |
| 96 | |
| 97 | EXPECT_EQ(managedLayers.front()->z, 2); |
| 98 | EXPECT_TRUE(managedLayers.front()->changes.test(RequestedLayerState::Changes::Z)); |
| 99 | |
| 100 | EXPECT_TRUE(lifecycleManager.getGlobalChanges().test(RequestedLayerState::Changes::Hierarchy)); |
| 101 | lifecycleManager.commitChanges(); |
| 102 | EXPECT_FALSE(lifecycleManager.getGlobalChanges().test(RequestedLayerState::Changes::Hierarchy)); |
| 103 | ASSERT_EQ(managedLayers.size(), 1u); |
| 104 | EXPECT_FALSE(managedLayers.front()->changes.test(RequestedLayerState::Changes::Z)); |
| 105 | |
| 106 | // apply transactions that do not affect the hierarchy |
Vishnu Nair | 1391de2 | 2023-03-05 19:56:14 -0800 | [diff] [blame] | 107 | std::vector<TransactionState> transactions; |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 108 | transactions.emplace_back(); |
| 109 | transactions.back().states.push_back({}); |
| 110 | transactions.back().states.front().state.backgroundBlurRadius = 22; |
| 111 | transactions.back().states.front().state.what = layer_state_t::eBackgroundBlurRadiusChanged; |
Vishnu Nair | 1391de2 | 2023-03-05 19:56:14 -0800 | [diff] [blame] | 112 | transactions.back().states.front().layerId = 1; |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 113 | lifecycleManager.applyTransactions(transactions); |
| 114 | EXPECT_FALSE(lifecycleManager.getGlobalChanges().test(RequestedLayerState::Changes::Hierarchy)); |
| 115 | lifecycleManager.commitChanges(); |
| 116 | EXPECT_FALSE(lifecycleManager.getGlobalChanges().test(RequestedLayerState::Changes::Hierarchy)); |
| 117 | EXPECT_EQ(managedLayers.front()->backgroundBlurRadius, 22u); |
| 118 | } |
| 119 | |
| 120 | TEST_F(LayerLifecycleManagerTest, layerWithoutHandleIsDestroyed) { |
| 121 | LayerLifecycleManager lifecycleManager; |
| 122 | auto listener = std::make_shared<ExpectLayerLifecycleListener>(); |
| 123 | lifecycleManager.addLifecycleListener(listener); |
| 124 | std::vector<std::unique_ptr<RequestedLayerState>> layers; |
| 125 | layers.emplace_back(rootLayer(1)); |
| 126 | layers.emplace_back(rootLayer(2)); |
| 127 | lifecycleManager.addLayers(std::move(layers)); |
Vishnu Nair | 606d9d0 | 2023-08-19 14:20:18 -0700 | [diff] [blame] | 128 | lifecycleManager.onHandlesDestroyed({{1, "1"}}); |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 129 | lifecycleManager.commitChanges(); |
| 130 | |
| 131 | SCOPED_TRACE("layerWithoutHandleIsDestroyed"); |
| 132 | listener->expectLayersAdded({1, 2}); |
| 133 | listener->expectLayersDestroyed({1}); |
| 134 | } |
| 135 | |
| 136 | TEST_F(LayerLifecycleManagerTest, rootLayerWithoutHandleIsDestroyed) { |
| 137 | LayerLifecycleManager lifecycleManager; |
| 138 | auto listener = std::make_shared<ExpectLayerLifecycleListener>(); |
| 139 | lifecycleManager.addLifecycleListener(listener); |
| 140 | std::vector<std::unique_ptr<RequestedLayerState>> layers; |
| 141 | layers.emplace_back(rootLayer(1)); |
| 142 | layers.emplace_back(rootLayer(2)); |
| 143 | lifecycleManager.addLayers(std::move(layers)); |
Vishnu Nair | 606d9d0 | 2023-08-19 14:20:18 -0700 | [diff] [blame] | 144 | lifecycleManager.onHandlesDestroyed({{1, "1"}}); |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 145 | lifecycleManager.commitChanges(); |
| 146 | listener->expectLayersAdded({1, 2}); |
| 147 | listener->expectLayersDestroyed({1}); |
| 148 | } |
| 149 | |
| 150 | TEST_F(LayerLifecycleManagerTest, offscreenLayerIsDestroyed) { |
| 151 | LayerLifecycleManager lifecycleManager; |
| 152 | auto listener = std::make_shared<ExpectLayerLifecycleListener>(); |
| 153 | lifecycleManager.addLifecycleListener(listener); |
| 154 | std::vector<std::unique_ptr<RequestedLayerState>> layers; |
| 155 | layers.emplace_back(rootLayer(1)); |
| 156 | layers.emplace_back(rootLayer(2)); |
| 157 | layers.emplace_back(childLayer(3, /*parent*/ 2)); |
| 158 | lifecycleManager.addLayers(std::move(layers)); |
| 159 | lifecycleManager.commitChanges(); |
| 160 | listener->expectLayersAdded({1, 2, 3}); |
| 161 | listener->expectLayersDestroyed({}); |
| 162 | |
Vishnu Nair | 1391de2 | 2023-03-05 19:56:14 -0800 | [diff] [blame] | 163 | lifecycleManager.applyTransactions(reparentLayerTransaction(3, UNASSIGNED_LAYER_ID)); |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 164 | lifecycleManager.commitChanges(); |
| 165 | listener->expectLayersAdded({}); |
| 166 | listener->expectLayersDestroyed({}); |
| 167 | |
Vishnu Nair | 606d9d0 | 2023-08-19 14:20:18 -0700 | [diff] [blame] | 168 | lifecycleManager.onHandlesDestroyed({{3, "3"}}); |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 169 | lifecycleManager.commitChanges(); |
| 170 | listener->expectLayersAdded({}); |
| 171 | listener->expectLayersDestroyed({3}); |
| 172 | } |
| 173 | |
| 174 | TEST_F(LayerLifecycleManagerTest, offscreenChildLayerWithHandleIsNotDestroyed) { |
| 175 | LayerLifecycleManager lifecycleManager; |
| 176 | auto listener = std::make_shared<ExpectLayerLifecycleListener>(); |
| 177 | lifecycleManager.addLifecycleListener(listener); |
| 178 | std::vector<std::unique_ptr<RequestedLayerState>> layers; |
| 179 | layers.emplace_back(rootLayer(1)); |
| 180 | layers.emplace_back(rootLayer(2)); |
| 181 | layers.emplace_back(childLayer(3, /*parent*/ 2)); |
| 182 | layers.emplace_back(childLayer(4, /*parent*/ 3)); |
| 183 | lifecycleManager.addLayers(std::move(layers)); |
| 184 | lifecycleManager.commitChanges(); |
| 185 | listener->expectLayersAdded({1, 2, 3, 4}); |
| 186 | listener->expectLayersDestroyed({}); |
| 187 | |
Vishnu Nair | 1391de2 | 2023-03-05 19:56:14 -0800 | [diff] [blame] | 188 | lifecycleManager.applyTransactions(reparentLayerTransaction(3, UNASSIGNED_LAYER_ID)); |
Vishnu Nair | 606d9d0 | 2023-08-19 14:20:18 -0700 | [diff] [blame] | 189 | lifecycleManager.onHandlesDestroyed({{3, "3"}}); |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 190 | lifecycleManager.commitChanges(); |
| 191 | listener->expectLayersAdded({}); |
| 192 | listener->expectLayersDestroyed({3}); |
| 193 | } |
| 194 | |
| 195 | TEST_F(LayerLifecycleManagerTest, offscreenChildLayerWithoutHandleIsDestroyed) { |
| 196 | LayerLifecycleManager lifecycleManager; |
| 197 | auto listener = std::make_shared<ExpectLayerLifecycleListener>(); |
| 198 | lifecycleManager.addLifecycleListener(listener); |
| 199 | std::vector<std::unique_ptr<RequestedLayerState>> layers; |
| 200 | layers.emplace_back(rootLayer(1)); |
| 201 | layers.emplace_back(rootLayer(2)); |
| 202 | layers.emplace_back(childLayer(3, /*parent*/ 2)); |
| 203 | layers.emplace_back(childLayer(4, /*parent*/ 3)); |
| 204 | lifecycleManager.addLayers(std::move(layers)); |
| 205 | lifecycleManager.commitChanges(); |
| 206 | listener->expectLayersAdded({1, 2, 3, 4}); |
| 207 | listener->expectLayersDestroyed({}); |
| 208 | |
Vishnu Nair | 1391de2 | 2023-03-05 19:56:14 -0800 | [diff] [blame] | 209 | lifecycleManager.applyTransactions(reparentLayerTransaction(3, UNASSIGNED_LAYER_ID)); |
Vishnu Nair | 606d9d0 | 2023-08-19 14:20:18 -0700 | [diff] [blame] | 210 | lifecycleManager.onHandlesDestroyed({{3, "3"}, {4, "4"}}); |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 211 | lifecycleManager.commitChanges(); |
| 212 | listener->expectLayersAdded({}); |
| 213 | listener->expectLayersDestroyed({3, 4}); |
| 214 | } |
| 215 | |
| 216 | TEST_F(LayerLifecycleManagerTest, reparentingDoesNotAffectRelativeZ) { |
| 217 | LayerLifecycleManager lifecycleManager; |
| 218 | auto listener = std::make_shared<ExpectLayerLifecycleListener>(); |
| 219 | lifecycleManager.addLifecycleListener(listener); |
| 220 | std::vector<std::unique_ptr<RequestedLayerState>> layers; |
| 221 | layers.emplace_back(rootLayer(1)); |
| 222 | layers.emplace_back(rootLayer(2)); |
| 223 | layers.emplace_back(childLayer(3, /*parent*/ 2)); |
| 224 | layers.emplace_back(childLayer(4, /*parent*/ 3)); |
| 225 | |
| 226 | lifecycleManager.addLayers(std::move(layers)); |
| 227 | lifecycleManager.commitChanges(); |
| 228 | listener->expectLayersAdded({1, 2, 3, 4}); |
| 229 | listener->expectLayersDestroyed({}); |
| 230 | |
Vishnu Nair | 1391de2 | 2023-03-05 19:56:14 -0800 | [diff] [blame] | 231 | lifecycleManager.applyTransactions(relativeLayerTransaction(4, 1)); |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 232 | EXPECT_TRUE(getRequestedLayerState(lifecycleManager, 4)->isRelativeOf); |
Vishnu Nair | 1391de2 | 2023-03-05 19:56:14 -0800 | [diff] [blame] | 233 | lifecycleManager.applyTransactions(reparentLayerTransaction(4, 2)); |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 234 | EXPECT_TRUE(getRequestedLayerState(lifecycleManager, 4)->isRelativeOf); |
| 235 | |
| 236 | lifecycleManager.commitChanges(); |
| 237 | listener->expectLayersAdded({}); |
| 238 | listener->expectLayersDestroyed({}); |
| 239 | } |
| 240 | |
| 241 | TEST_F(LayerLifecycleManagerTest, reparentingToNullRemovesRelativeZ) { |
| 242 | LayerLifecycleManager lifecycleManager; |
| 243 | auto listener = std::make_shared<ExpectLayerLifecycleListener>(); |
| 244 | lifecycleManager.addLifecycleListener(listener); |
| 245 | std::vector<std::unique_ptr<RequestedLayerState>> layers; |
| 246 | layers.emplace_back(rootLayer(1)); |
| 247 | layers.emplace_back(rootLayer(2)); |
| 248 | layers.emplace_back(childLayer(3, /*parent*/ 2)); |
| 249 | layers.emplace_back(childLayer(4, /*parent*/ 3)); |
| 250 | |
| 251 | lifecycleManager.addLayers(std::move(layers)); |
| 252 | lifecycleManager.commitChanges(); |
| 253 | listener->expectLayersAdded({1, 2, 3, 4}); |
| 254 | listener->expectLayersDestroyed({}); |
| 255 | |
Vishnu Nair | 1391de2 | 2023-03-05 19:56:14 -0800 | [diff] [blame] | 256 | lifecycleManager.applyTransactions(relativeLayerTransaction(4, 1)); |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 257 | EXPECT_TRUE(getRequestedLayerState(lifecycleManager, 4)->isRelativeOf); |
Vishnu Nair | 1391de2 | 2023-03-05 19:56:14 -0800 | [diff] [blame] | 258 | lifecycleManager.applyTransactions(reparentLayerTransaction(4, UNASSIGNED_LAYER_ID)); |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 259 | EXPECT_FALSE(getRequestedLayerState(lifecycleManager, 4)->isRelativeOf); |
| 260 | |
| 261 | lifecycleManager.commitChanges(); |
| 262 | listener->expectLayersAdded({}); |
| 263 | listener->expectLayersDestroyed({}); |
| 264 | } |
| 265 | |
| 266 | TEST_F(LayerLifecycleManagerTest, setZRemovesRelativeZ) { |
| 267 | LayerLifecycleManager lifecycleManager; |
| 268 | auto listener = std::make_shared<ExpectLayerLifecycleListener>(); |
| 269 | lifecycleManager.addLifecycleListener(listener); |
| 270 | std::vector<std::unique_ptr<RequestedLayerState>> layers; |
| 271 | layers.emplace_back(rootLayer(1)); |
| 272 | layers.emplace_back(rootLayer(2)); |
| 273 | layers.emplace_back(childLayer(3, /*parent*/ 2)); |
| 274 | layers.emplace_back(childLayer(4, /*parent*/ 3)); |
| 275 | |
| 276 | lifecycleManager.addLayers(std::move(layers)); |
| 277 | lifecycleManager.commitChanges(); |
| 278 | listener->expectLayersAdded({1, 2, 3, 4}); |
| 279 | listener->expectLayersDestroyed({}); |
| 280 | |
Vishnu Nair | 1391de2 | 2023-03-05 19:56:14 -0800 | [diff] [blame] | 281 | lifecycleManager.applyTransactions(relativeLayerTransaction(4, 1)); |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 282 | EXPECT_TRUE(getRequestedLayerState(lifecycleManager, 4)->isRelativeOf); |
Vishnu Nair | 1391de2 | 2023-03-05 19:56:14 -0800 | [diff] [blame] | 283 | lifecycleManager.applyTransactions(setZTransaction(4, 1)); |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 284 | EXPECT_FALSE(getRequestedLayerState(lifecycleManager, 4)->isRelativeOf); |
| 285 | |
| 286 | lifecycleManager.commitChanges(); |
| 287 | listener->expectLayersAdded({}); |
| 288 | listener->expectLayersDestroyed({}); |
| 289 | } |
| 290 | |
| 291 | TEST_F(LayerLifecycleManagerTest, canAddBackgroundLayer) { |
| 292 | LayerLifecycleManager lifecycleManager; |
| 293 | auto listener = std::make_shared<ExpectLayerLifecycleListener>(); |
| 294 | lifecycleManager.addLifecycleListener(listener); |
| 295 | |
| 296 | std::vector<std::unique_ptr<RequestedLayerState>> layers; |
| 297 | layers.emplace_back(rootLayer(1)); |
| 298 | lifecycleManager.addLayers(std::move(layers)); |
| 299 | |
| 300 | std::vector<TransactionState> transactions; |
| 301 | transactions.emplace_back(); |
| 302 | transactions.back().states.push_back({}); |
Vishnu Nair | d47bcee | 2023-02-24 18:08:51 +0000 | [diff] [blame] | 303 | transactions.back().states.front().state.bgColor.a = 0.5; |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 304 | transactions.back().states.front().state.what = layer_state_t::eBackgroundColorChanged; |
Vishnu Nair | 1391de2 | 2023-03-05 19:56:14 -0800 | [diff] [blame] | 305 | transactions.back().states.front().layerId = 1; |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 306 | lifecycleManager.applyTransactions(transactions); |
| 307 | |
| 308 | auto& managedLayers = lifecycleManager.getLayers(); |
| 309 | ASSERT_EQ(managedLayers.size(), 2u); |
| 310 | |
| 311 | EXPECT_TRUE(lifecycleManager.getGlobalChanges().test(RequestedLayerState::Changes::Hierarchy)); |
| 312 | lifecycleManager.commitChanges(); |
Vishnu Nair | 150065b | 2023-04-17 19:14:11 -0700 | [diff] [blame] | 313 | ASSERT_EQ(listener->mActualLayersAdded.size(), 2u); |
| 314 | auto bgLayerId = listener->mActualLayersAdded[1]; |
Vishnu Nair | d47bcee | 2023-02-24 18:08:51 +0000 | [diff] [blame] | 315 | listener->expectLayersAdded({1, bgLayerId}); |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 316 | listener->expectLayersDestroyed({}); |
Vishnu Nair | d47bcee | 2023-02-24 18:08:51 +0000 | [diff] [blame] | 317 | EXPECT_EQ(getRequestedLayerState(lifecycleManager, bgLayerId)->color.a, 0.5_hf); |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 318 | } |
| 319 | |
| 320 | TEST_F(LayerLifecycleManagerTest, canDestroyBackgroundLayer) { |
| 321 | LayerLifecycleManager lifecycleManager; |
| 322 | auto listener = std::make_shared<ExpectLayerLifecycleListener>(); |
| 323 | lifecycleManager.addLifecycleListener(listener); |
| 324 | |
| 325 | std::vector<std::unique_ptr<RequestedLayerState>> layers; |
| 326 | layers.emplace_back(rootLayer(1)); |
| 327 | lifecycleManager.addLayers(std::move(layers)); |
| 328 | |
| 329 | std::vector<TransactionState> transactions; |
| 330 | transactions.emplace_back(); |
| 331 | transactions.back().states.push_back({}); |
Vishnu Nair | d47bcee | 2023-02-24 18:08:51 +0000 | [diff] [blame] | 332 | transactions.back().states.front().state.bgColor.a = 0.5; |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 333 | transactions.back().states.front().state.what = layer_state_t::eBackgroundColorChanged; |
Vishnu Nair | 1391de2 | 2023-03-05 19:56:14 -0800 | [diff] [blame] | 334 | transactions.back().states.front().layerId = 1; |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 335 | transactions.emplace_back(); |
| 336 | transactions.back().states.push_back({}); |
Vishnu Nair | d47bcee | 2023-02-24 18:08:51 +0000 | [diff] [blame] | 337 | transactions.back().states.front().state.bgColor.a = 0; |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 338 | transactions.back().states.front().state.what = layer_state_t::eBackgroundColorChanged; |
Vishnu Nair | 1391de2 | 2023-03-05 19:56:14 -0800 | [diff] [blame] | 339 | transactions.back().states.front().layerId = 1; |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 340 | |
| 341 | lifecycleManager.applyTransactions(transactions); |
| 342 | |
| 343 | ASSERT_EQ(lifecycleManager.getLayers().size(), 1u); |
| 344 | ASSERT_EQ(lifecycleManager.getDestroyedLayers().size(), 1u); |
| 345 | |
| 346 | EXPECT_TRUE(lifecycleManager.getGlobalChanges().test(RequestedLayerState::Changes::Hierarchy)); |
| 347 | lifecycleManager.commitChanges(); |
Vishnu Nair | 150065b | 2023-04-17 19:14:11 -0700 | [diff] [blame] | 348 | ASSERT_EQ(listener->mActualLayersAdded.size(), 2u); |
| 349 | auto bgLayerId = listener->mActualLayersAdded[1]; |
Vishnu Nair | d47bcee | 2023-02-24 18:08:51 +0000 | [diff] [blame] | 350 | listener->expectLayersAdded({1, bgLayerId}); |
| 351 | listener->expectLayersDestroyed({bgLayerId}); |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 352 | } |
| 353 | |
| 354 | TEST_F(LayerLifecycleManagerTest, onParentDestroyDestroysBackgroundLayer) { |
| 355 | LayerLifecycleManager lifecycleManager; |
| 356 | auto listener = std::make_shared<ExpectLayerLifecycleListener>(); |
| 357 | lifecycleManager.addLifecycleListener(listener); |
| 358 | |
| 359 | std::vector<std::unique_ptr<RequestedLayerState>> layers; |
| 360 | layers.emplace_back(rootLayer(1)); |
| 361 | lifecycleManager.addLayers(std::move(layers)); |
| 362 | |
| 363 | std::vector<TransactionState> transactions; |
| 364 | transactions.emplace_back(); |
| 365 | transactions.back().states.push_back({}); |
Vishnu Nair | d47bcee | 2023-02-24 18:08:51 +0000 | [diff] [blame] | 366 | transactions.back().states.front().state.bgColor.a = 0.5; |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 367 | transactions.back().states.front().state.what = layer_state_t::eBackgroundColorChanged; |
Vishnu Nair | 1391de2 | 2023-03-05 19:56:14 -0800 | [diff] [blame] | 368 | transactions.back().states.front().layerId = 1; |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 369 | transactions.emplace_back(); |
| 370 | lifecycleManager.applyTransactions(transactions); |
Vishnu Nair | 606d9d0 | 2023-08-19 14:20:18 -0700 | [diff] [blame] | 371 | lifecycleManager.onHandlesDestroyed({{1, "1"}}); |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 372 | |
| 373 | ASSERT_EQ(lifecycleManager.getLayers().size(), 0u); |
| 374 | ASSERT_EQ(lifecycleManager.getDestroyedLayers().size(), 2u); |
| 375 | |
| 376 | EXPECT_TRUE(lifecycleManager.getGlobalChanges().test(RequestedLayerState::Changes::Hierarchy)); |
| 377 | lifecycleManager.commitChanges(); |
Vishnu Nair | 150065b | 2023-04-17 19:14:11 -0700 | [diff] [blame] | 378 | ASSERT_EQ(listener->mActualLayersAdded.size(), 2u); |
| 379 | auto bgLayerId = listener->mActualLayersAdded[1]; |
Vishnu Nair | d47bcee | 2023-02-24 18:08:51 +0000 | [diff] [blame] | 380 | listener->expectLayersAdded({1, bgLayerId}); |
| 381 | listener->expectLayersDestroyed({1, bgLayerId}); |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 382 | } |
| 383 | |
Vishnu Nair | 854ce1c | 2023-08-19 15:00:13 -0700 | [diff] [blame] | 384 | TEST_F(LayerLifecycleManagerTest, blurSetsVisibilityChangeFlag) { |
| 385 | // clear default color on layer so we start with a layer that does not draw anything. |
| 386 | setColor(1, {-1.f, -1.f, -1.f}); |
| 387 | mLifecycleManager.commitChanges(); |
| 388 | |
| 389 | // layer has something to draw |
| 390 | setBackgroundBlurRadius(1, 2); |
| 391 | EXPECT_TRUE( |
| 392 | mLifecycleManager.getGlobalChanges().test(RequestedLayerState::Changes::Visibility)); |
| 393 | mLifecycleManager.commitChanges(); |
| 394 | |
| 395 | // layer still has something to draw, so visibility shouldn't change |
| 396 | setBackgroundBlurRadius(1, 3); |
| 397 | EXPECT_FALSE( |
| 398 | mLifecycleManager.getGlobalChanges().test(RequestedLayerState::Changes::Visibility)); |
| 399 | mLifecycleManager.commitChanges(); |
| 400 | |
| 401 | // layer has nothing to draw |
| 402 | setBackgroundBlurRadius(1, 0); |
| 403 | EXPECT_TRUE( |
| 404 | mLifecycleManager.getGlobalChanges().test(RequestedLayerState::Changes::Visibility)); |
| 405 | mLifecycleManager.commitChanges(); |
| 406 | } |
| 407 | |
| 408 | TEST_F(LayerLifecycleManagerTest, colorSetsVisibilityChangeFlag) { |
| 409 | // clear default color on layer so we start with a layer that does not draw anything. |
| 410 | setColor(1, {-1.f, -1.f, -1.f}); |
| 411 | mLifecycleManager.commitChanges(); |
| 412 | |
| 413 | // layer has something to draw |
| 414 | setColor(1, {2.f, 3.f, 4.f}); |
| 415 | EXPECT_TRUE( |
| 416 | mLifecycleManager.getGlobalChanges().test(RequestedLayerState::Changes::Visibility)); |
| 417 | mLifecycleManager.commitChanges(); |
| 418 | |
| 419 | // layer still has something to draw, so visibility shouldn't change |
| 420 | setColor(1, {0.f, 0.f, 0.f}); |
| 421 | EXPECT_FALSE( |
| 422 | mLifecycleManager.getGlobalChanges().test(RequestedLayerState::Changes::Visibility)); |
| 423 | mLifecycleManager.commitChanges(); |
| 424 | |
| 425 | // layer has nothing to draw |
| 426 | setColor(1, {-1.f, -1.f, -1.f}); |
| 427 | EXPECT_TRUE( |
| 428 | mLifecycleManager.getGlobalChanges().test(RequestedLayerState::Changes::Visibility)); |
| 429 | mLifecycleManager.commitChanges(); |
| 430 | } |
| 431 | |
Vishnu Nair | 2662ebb | 2023-08-31 23:20:46 +0000 | [diff] [blame] | 432 | TEST_F(LayerLifecycleManagerTest, layerOpacityChangesSetsVisibilityChangeFlag) { |
| 433 | // add a default buffer and make the layer opaque |
| 434 | setFlags(1, layer_state_t::eLayerOpaque, layer_state_t::eLayerOpaque); |
| 435 | setBuffer(1, |
| 436 | std::make_shared< |
| 437 | renderengine::mock::FakeExternalTexture>(1U /*width*/, 1U /*height*/, |
| 438 | 1ULL /* bufferId */, |
| 439 | HAL_PIXEL_FORMAT_RGBA_8888, |
| 440 | GRALLOC_USAGE_PROTECTED /*usage*/)); |
| 441 | |
| 442 | mLifecycleManager.commitChanges(); |
| 443 | |
| 444 | // set new buffer but layer opacity doesn't change |
| 445 | setBuffer(1, |
| 446 | std::make_shared< |
| 447 | renderengine::mock::FakeExternalTexture>(1U /*width*/, 1U /*height*/, |
| 448 | 2ULL /* bufferId */, |
| 449 | HAL_PIXEL_FORMAT_RGBA_8888, |
| 450 | GRALLOC_USAGE_PROTECTED /*usage*/)); |
| 451 | EXPECT_EQ(mLifecycleManager.getGlobalChanges().get(), |
Vishnu Nair | df59f47 | 2024-05-17 16:51:33 +0000 | [diff] [blame] | 452 | ftl::Flags<RequestedLayerState::Changes>( |
Ady Abraham | 6846ade | 2024-05-20 21:58:27 +0000 | [diff] [blame] | 453 | RequestedLayerState::Changes::Buffer | RequestedLayerState::Changes::Content) |
Vishnu Nair | 2662ebb | 2023-08-31 23:20:46 +0000 | [diff] [blame] | 454 | .get()); |
| 455 | mLifecycleManager.commitChanges(); |
| 456 | |
| 457 | // change layer flags and confirm visibility flag is set |
| 458 | setFlags(1, layer_state_t::eLayerOpaque, 0); |
| 459 | EXPECT_TRUE( |
| 460 | mLifecycleManager.getGlobalChanges().test(RequestedLayerState::Changes::Visibility)); |
| 461 | mLifecycleManager.commitChanges(); |
| 462 | } |
| 463 | |
| 464 | TEST_F(LayerLifecycleManagerTest, bufferFormatChangesSetsVisibilityChangeFlag) { |
| 465 | // add a default buffer and make the layer opaque |
| 466 | setFlags(1, layer_state_t::eLayerOpaque, layer_state_t::eLayerOpaque); |
| 467 | setBuffer(1, |
| 468 | std::make_shared< |
| 469 | renderengine::mock::FakeExternalTexture>(1U /*width*/, 1U /*height*/, |
| 470 | 1ULL /* bufferId */, |
| 471 | HAL_PIXEL_FORMAT_RGBA_8888, |
| 472 | GRALLOC_USAGE_PROTECTED /*usage*/)); |
| 473 | |
| 474 | mLifecycleManager.commitChanges(); |
| 475 | |
| 476 | // set new buffer with an opaque buffer format |
| 477 | setBuffer(1, |
| 478 | std::make_shared< |
| 479 | renderengine::mock::FakeExternalTexture>(1U /*width*/, 1U /*height*/, |
| 480 | 2ULL /* bufferId */, |
| 481 | HAL_PIXEL_FORMAT_RGB_888, |
| 482 | GRALLOC_USAGE_PROTECTED /*usage*/)); |
| 483 | EXPECT_EQ(mLifecycleManager.getGlobalChanges().get(), |
Vishnu Nair | df59f47 | 2024-05-17 16:51:33 +0000 | [diff] [blame] | 484 | ftl::Flags<RequestedLayerState::Changes>( |
| 485 | RequestedLayerState::Changes::Buffer | RequestedLayerState::Changes::Content | |
| 486 | RequestedLayerState::Changes::VisibleRegion | |
Ady Abraham | 6846ade | 2024-05-20 21:58:27 +0000 | [diff] [blame] | 487 | RequestedLayerState::Changes::Visibility) |
Vishnu Nair | 2662ebb | 2023-08-31 23:20:46 +0000 | [diff] [blame] | 488 | .get()); |
| 489 | mLifecycleManager.commitChanges(); |
| 490 | } |
| 491 | |
| 492 | TEST_F(LayerLifecycleManagerTest, roundedCornerChangesSetsVisibilityChangeFlag) { |
| 493 | // add a default buffer and make the layer opaque |
| 494 | setFlags(1, layer_state_t::eLayerOpaque, layer_state_t::eLayerOpaque); |
| 495 | setBuffer(1, |
| 496 | std::make_shared< |
| 497 | renderengine::mock::FakeExternalTexture>(1U /*width*/, 1U /*height*/, |
| 498 | 1ULL /* bufferId */, |
| 499 | HAL_PIXEL_FORMAT_RGBA_8888, |
| 500 | GRALLOC_USAGE_PROTECTED /*usage*/)); |
| 501 | |
| 502 | mLifecycleManager.commitChanges(); |
| 503 | |
| 504 | // add rounded corners which should make the layer translucent |
| 505 | setRoundedCorners(1, 5.f); |
| 506 | EXPECT_EQ(mLifecycleManager.getGlobalChanges().get(), |
| 507 | ftl::Flags<RequestedLayerState::Changes>( |
| 508 | RequestedLayerState::Changes::AffectsChildren | |
| 509 | RequestedLayerState::Changes::Content | |
| 510 | RequestedLayerState::Changes::Geometry | |
Ady Abraham | 6846ade | 2024-05-20 21:58:27 +0000 | [diff] [blame] | 511 | RequestedLayerState::Changes::VisibleRegion) |
Vishnu Nair | 2662ebb | 2023-08-31 23:20:46 +0000 | [diff] [blame] | 512 | .get()); |
| 513 | mLifecycleManager.commitChanges(); |
| 514 | } |
| 515 | |
Vishnu Nair | 93e26b9 | 2023-10-16 21:36:51 -0700 | [diff] [blame] | 516 | // Even when it does not change visible region, we should mark alpha changes as affecting |
| 517 | // visible region because HWC impl depends on it. writeOutputIndependentGeometryStateToHWC |
| 518 | // is only called if we are updating geometry. |
| 519 | TEST_F(LayerLifecycleManagerTest, alphaChangesAlwaysSetsVisibleRegionFlag) { |
| 520 | mLifecycleManager.commitChanges(); |
| 521 | float startingAlpha = 0.5f; |
| 522 | setAlpha(1, startingAlpha); |
| 523 | |
| 524 | // this is expected because layer alpha changes from 1 to 0.5, it may no longer be opaque |
| 525 | EXPECT_EQ(mLifecycleManager.getGlobalChanges().string(), |
| 526 | ftl::Flags<RequestedLayerState::Changes>( |
| 527 | RequestedLayerState::Changes::Content | |
| 528 | RequestedLayerState::Changes::AffectsChildren | |
Vishnu Nair | ab94286 | 2024-06-13 22:59:06 -0700 | [diff] [blame] | 529 | RequestedLayerState::Changes::VisibleRegion | |
| 530 | RequestedLayerState::Changes::Input) |
Vishnu Nair | 93e26b9 | 2023-10-16 21:36:51 -0700 | [diff] [blame] | 531 | .string()); |
| 532 | EXPECT_EQ(mLifecycleManager.getChangedLayers()[0]->color.a, static_cast<half>(startingAlpha)); |
| 533 | mLifecycleManager.commitChanges(); |
| 534 | |
| 535 | float endingAlpha = 0.2f; |
| 536 | setAlpha(1, endingAlpha); |
| 537 | |
| 538 | // this is not expected but we should make sure this behavior does not change |
| 539 | EXPECT_EQ(mLifecycleManager.getGlobalChanges().string(), |
| 540 | ftl::Flags<RequestedLayerState::Changes>( |
| 541 | RequestedLayerState::Changes::Content | |
| 542 | RequestedLayerState::Changes::AffectsChildren | |
Vishnu Nair | ab94286 | 2024-06-13 22:59:06 -0700 | [diff] [blame] | 543 | RequestedLayerState::Changes::VisibleRegion | |
| 544 | RequestedLayerState::Changes::Input) |
Vishnu Nair | 93e26b9 | 2023-10-16 21:36:51 -0700 | [diff] [blame] | 545 | .string()); |
| 546 | EXPECT_EQ(mLifecycleManager.getChangedLayers()[0]->color.a, static_cast<half>(endingAlpha)); |
| 547 | mLifecycleManager.commitChanges(); |
| 548 | |
| 549 | EXPECT_EQ(mLifecycleManager.getGlobalChanges().string(), |
| 550 | ftl::Flags<RequestedLayerState::Changes>().string()); |
| 551 | } |
| 552 | |
Patrick Williams | d8edec0 | 2024-03-11 18:14:48 -0500 | [diff] [blame] | 553 | TEST_F(LayerLifecycleManagerTest, layerSecureChangesSetsVisibilityChangeFlag) { |
| 554 | // add a default buffer and make the layer secure |
| 555 | setFlags(1, layer_state_t::eLayerSecure, layer_state_t::eLayerSecure); |
| 556 | setBuffer(1, |
| 557 | std::make_shared<renderengine::mock:: |
| 558 | FakeExternalTexture>(1U /*width*/, 1U /*height*/, |
| 559 | 1ULL /* bufferId */, |
| 560 | HAL_PIXEL_FORMAT_RGBA_8888, |
| 561 | GRALLOC_USAGE_SW_READ_NEVER /*usage*/)); |
| 562 | |
| 563 | mLifecycleManager.commitChanges(); |
| 564 | |
| 565 | // set new buffer but layer secure doesn't change |
| 566 | setBuffer(1, |
| 567 | std::make_shared<renderengine::mock:: |
| 568 | FakeExternalTexture>(1U /*width*/, 1U /*height*/, |
| 569 | 2ULL /* bufferId */, |
| 570 | HAL_PIXEL_FORMAT_RGBA_8888, |
| 571 | GRALLOC_USAGE_SW_READ_NEVER /*usage*/)); |
| 572 | EXPECT_EQ(mLifecycleManager.getGlobalChanges().get(), |
Vishnu Nair | df59f47 | 2024-05-17 16:51:33 +0000 | [diff] [blame] | 573 | ftl::Flags<RequestedLayerState::Changes>( |
Ady Abraham | 6846ade | 2024-05-20 21:58:27 +0000 | [diff] [blame] | 574 | RequestedLayerState::Changes::Buffer | RequestedLayerState::Changes::Content) |
Patrick Williams | d8edec0 | 2024-03-11 18:14:48 -0500 | [diff] [blame] | 575 | .get()); |
| 576 | mLifecycleManager.commitChanges(); |
| 577 | |
| 578 | // change layer flags and confirm visibility flag is set |
| 579 | setFlags(1, layer_state_t::eLayerSecure, 0); |
| 580 | EXPECT_TRUE( |
| 581 | mLifecycleManager.getGlobalChanges().test(RequestedLayerState::Changes::Visibility)); |
| 582 | mLifecycleManager.commitChanges(); |
| 583 | } |
| 584 | |
Vishnu Nair | c5545d5 | 2024-05-22 17:28:49 -0700 | [diff] [blame] | 585 | TEST_F(LayerLifecycleManagerTest, isSimpleBufferUpdate) { |
| 586 | auto layer = rootLayer(1); |
| 587 | |
| 588 | // no buffer changes |
| 589 | EXPECT_FALSE(layer->isSimpleBufferUpdate({})); |
| 590 | |
| 591 | { |
| 592 | layer_state_t state; |
| 593 | state.what = layer_state_t::eBufferChanged; |
| 594 | EXPECT_TRUE(layer->isSimpleBufferUpdate(state)); |
| 595 | } |
| 596 | |
| 597 | { |
| 598 | layer_state_t state; |
| 599 | state.what = layer_state_t::eReparent | layer_state_t::eBufferChanged; |
| 600 | EXPECT_FALSE(layer->isSimpleBufferUpdate(state)); |
| 601 | } |
| 602 | |
| 603 | { |
| 604 | layer_state_t state; |
| 605 | state.what = layer_state_t::ePositionChanged | layer_state_t::eBufferChanged; |
| 606 | state.x = 9; |
| 607 | state.y = 10; |
| 608 | EXPECT_FALSE(layer->isSimpleBufferUpdate(state)); |
| 609 | } |
| 610 | |
| 611 | { |
| 612 | layer->x = 9; |
| 613 | layer->y = 10; |
| 614 | layer_state_t state; |
| 615 | state.what = layer_state_t::ePositionChanged | layer_state_t::eBufferChanged; |
| 616 | state.x = 9; |
| 617 | state.y = 10; |
| 618 | EXPECT_TRUE(layer->isSimpleBufferUpdate(state)); |
| 619 | } |
| 620 | } |
| 621 | |
Wenhui Yang | 4fafc90 | 2024-12-19 20:19:28 +0000 | [diff] [blame^] | 622 | TEST_F(LayerLifecycleManagerTest, layerWithBufferNeedsInputInfo) { |
| 623 | // If a layer has no buffer or no color, it doesn't have an input info |
| 624 | LayerHierarchyTestBase::createRootLayer(3); |
| 625 | setColor(3, {-1._hf, -1._hf, -1._hf}); |
Wenhui Yang | ab89d81 | 2024-09-11 23:21:38 +0000 | [diff] [blame] | 626 | mLifecycleManager.commitChanges(); |
| 627 | |
Wenhui Yang | 4fafc90 | 2024-12-19 20:19:28 +0000 | [diff] [blame^] | 628 | EXPECT_FALSE(getRequestedLayerState(mLifecycleManager, 3)->needsInputInfo()); |
| 629 | |
| 630 | setBuffer(3); |
| 631 | mLifecycleManager.commitChanges(); |
| 632 | |
| 633 | EXPECT_TRUE(getRequestedLayerState(mLifecycleManager, 3)->needsInputInfo()); |
| 634 | } |
| 635 | |
| 636 | TEST_F(LayerLifecycleManagerTest, layerWithColorNeedsInputInfo) { |
| 637 | // If a layer has no buffer or no color, it doesn't have an input info |
| 638 | LayerHierarchyTestBase::createRootLayer(4); |
| 639 | setColor(4, {-1._hf, -1._hf, -1._hf}); |
| 640 | mLifecycleManager.commitChanges(); |
| 641 | |
| 642 | EXPECT_FALSE(getRequestedLayerState(mLifecycleManager, 4)->needsInputInfo()); |
| 643 | |
| 644 | setColor(4, {1._hf, 0._hf, 0._hf}); |
| 645 | mLifecycleManager.commitChanges(); |
| 646 | |
| 647 | EXPECT_TRUE(getRequestedLayerState(mLifecycleManager, 4)->needsInputInfo()); |
Wenhui Yang | ab89d81 | 2024-09-11 23:21:38 +0000 | [diff] [blame] | 648 | } |
| 649 | |
Vishnu Nair | dc4d31b | 2022-11-17 03:20:58 +0000 | [diff] [blame] | 650 | } // namespace android::surfaceflinger::frontend |