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

Commit c4489903 authored by Vishnu Nair's avatar Vishnu Nair Committed by Android (Google) Code Review
Browse files

Merge "[layertracegenerator] be more resilient to unknown layer ids" into udc-dev

parents a6e9dd2c 20e1f962
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -74,4 +74,23 @@ LayerCreationArgs LayerCreationArgs::fromOtherArgs(const LayerCreationArgs& othe
    return LayerCreationArgs(other.flinger, other.client, other.name, other.flags, other.metadata);
}

std::string LayerCreationArgs::getDebugString() const {
    std::stringstream stream;
    stream << "LayerCreationArgs{" << name << "[" << sequence << "] flags=" << flags
           << " pid=" << ownerPid << " uid=" << ownerUid;
    if (addToRoot) {
        stream << " addToRoot=" << addToRoot;
    }
    if (parentId != UNASSIGNED_LAYER_ID) {
        stream << " parentId=" << parentId;
    }
    if (layerIdToMirror != UNASSIGNED_LAYER_ID) {
        stream << " layerIdToMirror=" << layerIdToMirror;
    }
    if (layerStackToMirror != ui::INVALID_LAYER_STACK) {
        stream << " layerStackToMirror=" << layerStackToMirror.id;
    }
    return stream.str();
}

} // namespace android::surfaceflinger
+1 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ struct LayerCreationArgs {
                      bool internalLayer = false);
    LayerCreationArgs(std::optional<uint32_t> id, bool internalLayer = false);
    LayerCreationArgs() = default; // for tracing
    std::string getDebugString() const;

    android::SurfaceFlinger* flinger;
    sp<android::Client> client;
+4 −2
Original line number Diff line number Diff line
@@ -164,7 +164,8 @@ void LayerLifecycleManager::onHandlesDestroyed(const std::vector<uint32_t>& dest
    }
}

void LayerLifecycleManager::applyTransactions(const std::vector<TransactionState>& transactions) {
void LayerLifecycleManager::applyTransactions(const std::vector<TransactionState>& transactions,
                                              bool ignoreUnknownLayers) {
    for (const auto& transaction : transactions) {
        for (const auto& resolvedComposerState : transaction.states) {
            const auto& clientState = resolvedComposerState.state;
@@ -176,7 +177,8 @@ void LayerLifecycleManager::applyTransactions(const std::vector<TransactionState

            RequestedLayerState* layer = getLayerFromId(layerId);
            if (layer == nullptr) {
                LOG_ALWAYS_FATAL("%s Layer with layerid=%d not found", __func__, layerId);
                LOG_ALWAYS_FATAL_IF(!ignoreUnknownLayers, "%s Layer with layerid=%d not found",
                                    __func__, layerId);
                continue;
            }

+5 −1
Original line number Diff line number Diff line
@@ -39,7 +39,11 @@ class LayerLifecycleManager {
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>&);
    // Ignore unknown layers when interoping with legacy front end. In legacy we destroy
    // the layers it is unreachable. When using the LayerLifecycleManager for layer trace
    // generation we may encounter layers which are known because we don't have an explicit
    // lifecycle. Ignore these errors while we have to interop with legacy.
    void applyTransactions(const std::vector<TransactionState>&, bool ignoreUnknownLayers = false);
    // 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.
+1 −0
Original line number Diff line number Diff line
@@ -271,6 +271,7 @@ void TransactionTracing::updateStartingStateLocked(
        for (const proto::LayerState& layerState : transaction.layer_changes()) {
            auto it = mStartingStates.find(layerState.layer_id());
            if (it == mStartingStates.end()) {
                // TODO(b/238781169) make this log fatal when we switch over to using new fe
                ALOGW("Could not find layer id %d", layerState.layer_id());
                continue;
            }
Loading