Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 191eeb8f authored by Vishnu Nair's avatar Vishnu Nair
Browse files

[LayerTraceGenerator] Ignore unknown handles

Ignore unknown handles when iteroping with legacy front end. In the
old world, we would create child layers which are not necessary with
the new front end. This means we will get notified for handle changes
that dont exist in the new front end.

Test: presubmit
Bug: 255901752
Change-Id: I669bcd7d635db6fa86cd3a64fc260178c2a85580
parent 81750625
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -71,12 +71,14 @@ void LayerLifecycleManager::addLayers(std::vector<std::unique_ptr<RequestedLayer
    }
}

void LayerLifecycleManager::onHandlesDestroyed(const std::vector<uint32_t>& destroyedHandles) {
void LayerLifecycleManager::onHandlesDestroyed(const std::vector<uint32_t>& destroyedHandles,
                                               bool ignoreUnknownHandles) {
    std::vector<uint32_t> layersToBeDestroyed;
    for (const auto& layerId : destroyedHandles) {
        auto it = mIdToLayer.find(layerId);
        if (it == mIdToLayer.end()) {
            LOG_ALWAYS_FATAL("%s Layerid not found %d", __func__, layerId);
            LOG_ALWAYS_FATAL_IF(!ignoreUnknownHandles, "%s Layerid not found %d", __func__,
                                layerId);
            continue;
        }
        RequestedLayerState& layer = it->second.owner;
+4 −1
Original line number Diff line number Diff line
@@ -40,7 +40,10 @@ public:
    // External state changes should be updated in the following order:
    void addLayers(std::vector<std::unique_ptr<RequestedLayerState>>);
    void applyTransactions(const std::vector<TransactionState>&);
    void onHandlesDestroyed(const std::vector<uint32_t>&);
    // Ignore unknown handles when iteroping with legacy front end. In the old world, we
    // would create child layers which are not necessary with the new front end. This means
    // we will get notified for handle changes that don't exist in the new front end.
    void onHandlesDestroyed(const std::vector<uint32_t>&, bool ignoreUnknownHandles = false);

    // Detaches the layer from its relative parent to prevent a loop in the
    // layer hierarchy. This overrides the RequestedLayerState and leaves
+1 −1
Original line number Diff line number Diff line
@@ -105,7 +105,7 @@ bool LayerTraceGenerator::generate(const proto::TransactionTraceFile& traceFile,
        // apply updates
        lifecycleManager.addLayers(std::move(addedLayers));
        lifecycleManager.applyTransactions(transactions);
        lifecycleManager.onHandlesDestroyed(destroyedHandles);
        lifecycleManager.onHandlesDestroyed(destroyedHandles, /*ignoreUnknownHandles=*/true);

        if (lifecycleManager.getGlobalChanges().test(
                    frontend::RequestedLayerState::Changes::Hierarchy)) {