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

Commit b1682328 authored by Chavi Weingarten's avatar Chavi Weingarten Committed by Android (Google) Code Review
Browse files

Merge "Add layers to proto by traversing children"

parents 5ada2be2 08f3cb2b
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -1893,6 +1893,16 @@ void Layer::setInputInfo(const InputWindowInfo& info) {
    setTransactionFlags(eTransactionNeeded);
}

void Layer::writeToProto(LayersProto& layersProto, uint32_t traceFlags) const {
    LayerProto* layerProto = layersProto.add_layers();
    writeToProtoDrawingState(layerProto, traceFlags);
    writeToProtoCommonState(layerProto, LayerVector::StateSet::Drawing, traceFlags);

    for (const sp<Layer>& layer : mDrawingChildren) {
        layer->writeToProto(layersProto, traceFlags);
    }
}

void Layer::writeToProtoDrawingState(LayerProto* layerInfo, uint32_t traceFlags) const {
    ui::Transform transform = getTransform();

@@ -2014,6 +2024,8 @@ void Layer::writeToProtoCommonState(LayerProto* layerInfo, LayerVector::StateSet
        } else {
            layerInfo->set_z_order_relative_of(-1);
        }

        layerInfo->set_is_relative_of(state.isRelativeOf);
    }

    if (traceFlags & SurfaceTracing::TRACE_INPUT) {
+3 −0
Original line number Diff line number Diff line
@@ -454,6 +454,9 @@ public:

    bool isRemovedFromCurrentState() const;

    void writeToProto(LayersProto& layersProto,
                      uint32_t traceFlags = SurfaceTracing::TRACE_ALL) const;

    // Write states that are modified by the main thread. This includes drawing
    // state as well as buffer data. This should be called in the main or tracing
    // thread.
+4 −15
Original line number Diff line number Diff line
@@ -4257,12 +4257,9 @@ void SurfaceFlinger::dumpWideColorInfo(std::string& result) const {

LayersProto SurfaceFlinger::dumpDrawingStateProto(uint32_t traceFlags) const {
    LayersProto layersProto;
    mDrawingState.traverseInZOrder([&](Layer* layer) {
        LayerProto* layerProto = layersProto.add_layers();
        layer->writeToProtoDrawingState(layerProto, traceFlags);
        layer->writeToProtoCommonState(layerProto, LayerVector::StateSet::Drawing, traceFlags);
    });

    for (const sp<Layer>& layer : mDrawingState.layersSortedByZ) {
        layer->writeToProto(layersProto, traceFlags);
    }
    return layersProto;
}

@@ -4286,15 +4283,7 @@ void SurfaceFlinger::dumpOffscreenLayersProto(LayersProto& layersProto, uint32_t
                                                traceFlags);
        layerProto->set_parent(offscreenRootLayerId);

        // Add children
        offscreenLayer->traverseInZOrder(LayerVector::StateSet::Drawing, [&](Layer* layer) {
            if (layer == offscreenLayer) {
                return;
            }
            LayerProto* childProto = layersProto.add_layers();
            layer->writeToProtoDrawingState(childProto, traceFlags);
            layer->writeToProtoCommonState(childProto, LayerVector::StateSet::Drawing, traceFlags);
        });
        offscreenLayer->writeToProto(layersProto, traceFlags);
    }
}

+2 −0
Original line number Diff line number Diff line
@@ -102,6 +102,8 @@ message LayerProto {
  // layer or set by a parent layer.
  float shadow_radius = 49;
  ColorTransformProto color_transform = 50;

  bool is_relative_of = 51;
}

message PositionProto {