diff options
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 19 | ||||
-rw-r--r-- | services/surfaceflinger/TimeStats/TimeStats.cpp | 2 |
2 files changed, 12 insertions, 9 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 488b9ef689..213160de6e 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -4485,7 +4485,8 @@ status_t SurfaceFlinger::doDump(int fd, const DumpArgs& args, const auto flag = args.empty() ? ""s : std::string(String8(args[0])); - if (const auto it = dumpers.find(flag); it != dumpers.end()) { + const auto it = dumpers.find(flag); + if (it != dumpers.end()) { (it->second)(args, asProto, result); } else if (!asProto) { dumpAllLocked(args, result); @@ -4495,13 +4496,15 @@ status_t SurfaceFlinger::doDump(int fd, const DumpArgs& args, mStateLock.unlock(); } - LayersProto layersProto = dumpProtoFromMainThread(); - if (asProto) { - result.append(layersProto.SerializeAsString().c_str(), layersProto.ByteSize()); - } else { - auto layerTree = LayerProtoParser::generateLayerTree(layersProto); - result.append(LayerProtoParser::layerTreeToString(layerTree)); - result.append("\n"); + if (it == dumpers.end()) { + const LayersProto layersProto = dumpProtoFromMainThread(); + if (asProto) { + result.append(layersProto.SerializeAsString()); + } else { + const auto layerTree = LayerProtoParser::generateLayerTree(layersProto); + result.append(LayerProtoParser::layerTreeToString(layerTree)); + result.append("\n"); + } } } write(fd, result.c_str(), result.size()); diff --git a/services/surfaceflinger/TimeStats/TimeStats.cpp b/services/surfaceflinger/TimeStats/TimeStats.cpp index 887b733532..93fe7d056c 100644 --- a/services/surfaceflinger/TimeStats/TimeStats.cpp +++ b/services/surfaceflinger/TimeStats/TimeStats.cpp @@ -601,7 +601,7 @@ void TimeStats::dump(bool asProto, std::optional<uint32_t> maxLayers, std::strin if (asProto) { ALOGD("Dumping TimeStats as proto"); SFTimeStatsGlobalProto timeStatsProto = mTimeStats.toProto(maxLayers); - result.append(timeStatsProto.SerializeAsString().c_str(), timeStatsProto.ByteSize()); + result.append(timeStatsProto.SerializeAsString()); } else { ALOGD("Dumping TimeStats as text"); result.append(mTimeStats.toString(maxLayers)); |