Loading libs/binder/include/binder/AppOpsManager.h +1 −1 Original line number Diff line number Diff line Loading @@ -108,7 +108,7 @@ public: OP_MANAGE_IPSEC_TUNNELS = 75, OP_START_FOREGROUND = 76, OP_BLUETOOTH_SCAN = 77, OP_USE_FACE = 78, OP_USE_BIOMETRIC = 78, }; AppOpsManager(); Loading services/surfaceflinger/LayerStats.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ bool LayerStats::isEnabled() { } void LayerStats::traverseLayerTreeStatsLocked( const std::vector<std::unique_ptr<LayerProtoParser::Layer>>& layerTree, const std::vector<LayerProtoParser::Layer*>& layerTree, const LayerProtoParser::LayerGlobal& layerGlobal, std::vector<std::string>* const outLayerShapeVec) { for (const auto& layer : layerTree) { Loading @@ -82,7 +82,7 @@ void LayerStats::traverseLayerTreeStatsLocked( base::StringAppendF(&key, ",%s", destinationSize(layer->hwcFrame.bottom - layer->hwcFrame.top, layerGlobal.resolution[1], false)); base::StringAppendF(&key, ",%s", scaleRatioWH(layer.get()).c_str()); base::StringAppendF(&key, ",%s", scaleRatioWH(layer).c_str()); base::StringAppendF(&key, ",%s", alpha(static_cast<float>(layer->color.a))); outLayerShapeVec->push_back(key); Loading @@ -98,7 +98,7 @@ void LayerStats::logLayerStats(const LayersProto& layersProto) { std::vector<std::string> layerShapeVec; std::lock_guard<std::mutex> lock(mMutex); traverseLayerTreeStatsLocked(layerTree, layerGlobal, &layerShapeVec); traverseLayerTreeStatsLocked(layerTree.topLevelLayers, layerGlobal, &layerShapeVec); std::string layerShapeKey = base::StringPrintf("%d,%s,%s,%s", static_cast<int32_t>(layerShapeVec.size()), Loading services/surfaceflinger/LayerStats.h +1 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ public: private: // Traverse layer tree to get all visible layers' stats void traverseLayerTreeStatsLocked( const std::vector<std::unique_ptr<LayerProtoParser::Layer>>& layerTree, const std::vector<LayerProtoParser::Layer*>& layerTree, const LayerProtoParser::LayerGlobal& layerGlobal, std::vector<std::string>* const outLayerShapeVec); // Convert layer's top-left position into 8x8 percentage of the display Loading services/surfaceflinger/SurfaceFlinger.cpp +6 −4 Original line number Diff line number Diff line Loading @@ -4620,10 +4620,12 @@ void SurfaceFlinger::dumpAllLocked(const Vector<String16>& args, size_t& index, mGraphicBufferProducerList.size(), mMaxGraphicBufferProducerListSize); colorizer.reset(result); { LayersProto layersProto = dumpProtoInfo(LayerVector::StateSet::Current); auto layerTree = LayerProtoParser::generateLayerTree(layersProto); result.append(LayerProtoParser::layersToString(std::move(layerTree)).c_str()); result.append(LayerProtoParser::layerTreeToString(layerTree).c_str()); result.append("\n"); } result.append("\nFrame-Composition information:\n"); dumpFrameCompositionInfo(result); Loading services/surfaceflinger/SurfaceTracing.cpp +17 −13 Original line number Diff line number Diff line Loading @@ -27,32 +27,36 @@ namespace android { void SurfaceTracing::enable() { ATRACE_CALL(); std::lock_guard<std::mutex> protoGuard(mTraceMutex); if (mEnabled) { return; } ATRACE_CALL(); mEnabled = true; std::lock_guard<std::mutex> protoGuard(mTraceMutex); mTrace.set_magic_number(uint64_t(LayersTraceFileProto_MagicNumber_MAGIC_NUMBER_H) << 32 | mTrace = std::make_unique<LayersTraceFileProto>(); mTrace->set_magic_number(uint64_t(LayersTraceFileProto_MagicNumber_MAGIC_NUMBER_H) << 32 | LayersTraceFileProto_MagicNumber_MAGIC_NUMBER_L); } status_t SurfaceTracing::disable() { ATRACE_CALL(); std::lock_guard<std::mutex> protoGuard(mTraceMutex); if (!mEnabled) { return NO_ERROR; } ATRACE_CALL(); std::lock_guard<std::mutex> protoGuard(mTraceMutex); mEnabled = false; status_t err(writeProtoFileLocked()); ALOGE_IF(err == PERMISSION_DENIED, "Could not save the proto file! Permission denied"); ALOGE_IF(err == NOT_ENOUGH_DATA, "Could not save the proto file! There are missing fields"); mTrace.Clear(); mTrace.reset(); return err; } bool SurfaceTracing::isEnabled() const { std::lock_guard<std::mutex> protoGuard(mTraceMutex); return mEnabled; } Loading @@ -61,29 +65,29 @@ void SurfaceTracing::traceLayers(const char* where, LayersProto layers) { if (!mEnabled) { return; } LayersTraceProto* entry = mTrace.add_entry(); LayersTraceProto* entry = mTrace->add_entry(); entry->set_elapsed_realtime_nanos(elapsedRealtimeNano()); entry->set_where(where); entry->mutable_layers()->Swap(&layers); constexpr int maxBufferedEntryCount = 3600; if (mTrace.entry_size() >= maxBufferedEntryCount) { if (mTrace->entry_size() >= maxBufferedEntryCount) { // TODO: flush buffered entries without disabling tracing ALOGE("too many buffered frames; force disable tracing"); mEnabled = false; writeProtoFileLocked(); mTrace.Clear(); mTrace.reset(); } } status_t SurfaceTracing::writeProtoFileLocked() { ATRACE_CALL(); if (!mTrace.IsInitialized()) { if (!mTrace->IsInitialized()) { return NOT_ENOUGH_DATA; } std::string output; if (!mTrace.SerializeToString(&output)) { if (!mTrace->SerializeToString(&output)) { return PERMISSION_DENIED; } if (!android::base::WriteStringToFile(output, mOutputFileName, true)) { Loading @@ -97,7 +101,7 @@ void SurfaceTracing::dump(String8& result) const { std::lock_guard<std::mutex> protoGuard(mTraceMutex); result.appendFormat("Tracing state: %s\n", mEnabled ? "enabled" : "disabled"); result.appendFormat(" number of entries: %d\n", mTrace.entry_size()); result.appendFormat(" number of entries: %d\n", mTrace ? mTrace->entry_size() : 0); } } // namespace android Loading
libs/binder/include/binder/AppOpsManager.h +1 −1 Original line number Diff line number Diff line Loading @@ -108,7 +108,7 @@ public: OP_MANAGE_IPSEC_TUNNELS = 75, OP_START_FOREGROUND = 76, OP_BLUETOOTH_SCAN = 77, OP_USE_FACE = 78, OP_USE_BIOMETRIC = 78, }; AppOpsManager(); Loading
services/surfaceflinger/LayerStats.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ bool LayerStats::isEnabled() { } void LayerStats::traverseLayerTreeStatsLocked( const std::vector<std::unique_ptr<LayerProtoParser::Layer>>& layerTree, const std::vector<LayerProtoParser::Layer*>& layerTree, const LayerProtoParser::LayerGlobal& layerGlobal, std::vector<std::string>* const outLayerShapeVec) { for (const auto& layer : layerTree) { Loading @@ -82,7 +82,7 @@ void LayerStats::traverseLayerTreeStatsLocked( base::StringAppendF(&key, ",%s", destinationSize(layer->hwcFrame.bottom - layer->hwcFrame.top, layerGlobal.resolution[1], false)); base::StringAppendF(&key, ",%s", scaleRatioWH(layer.get()).c_str()); base::StringAppendF(&key, ",%s", scaleRatioWH(layer).c_str()); base::StringAppendF(&key, ",%s", alpha(static_cast<float>(layer->color.a))); outLayerShapeVec->push_back(key); Loading @@ -98,7 +98,7 @@ void LayerStats::logLayerStats(const LayersProto& layersProto) { std::vector<std::string> layerShapeVec; std::lock_guard<std::mutex> lock(mMutex); traverseLayerTreeStatsLocked(layerTree, layerGlobal, &layerShapeVec); traverseLayerTreeStatsLocked(layerTree.topLevelLayers, layerGlobal, &layerShapeVec); std::string layerShapeKey = base::StringPrintf("%d,%s,%s,%s", static_cast<int32_t>(layerShapeVec.size()), Loading
services/surfaceflinger/LayerStats.h +1 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ public: private: // Traverse layer tree to get all visible layers' stats void traverseLayerTreeStatsLocked( const std::vector<std::unique_ptr<LayerProtoParser::Layer>>& layerTree, const std::vector<LayerProtoParser::Layer*>& layerTree, const LayerProtoParser::LayerGlobal& layerGlobal, std::vector<std::string>* const outLayerShapeVec); // Convert layer's top-left position into 8x8 percentage of the display Loading
services/surfaceflinger/SurfaceFlinger.cpp +6 −4 Original line number Diff line number Diff line Loading @@ -4620,10 +4620,12 @@ void SurfaceFlinger::dumpAllLocked(const Vector<String16>& args, size_t& index, mGraphicBufferProducerList.size(), mMaxGraphicBufferProducerListSize); colorizer.reset(result); { LayersProto layersProto = dumpProtoInfo(LayerVector::StateSet::Current); auto layerTree = LayerProtoParser::generateLayerTree(layersProto); result.append(LayerProtoParser::layersToString(std::move(layerTree)).c_str()); result.append(LayerProtoParser::layerTreeToString(layerTree).c_str()); result.append("\n"); } result.append("\nFrame-Composition information:\n"); dumpFrameCompositionInfo(result); Loading
services/surfaceflinger/SurfaceTracing.cpp +17 −13 Original line number Diff line number Diff line Loading @@ -27,32 +27,36 @@ namespace android { void SurfaceTracing::enable() { ATRACE_CALL(); std::lock_guard<std::mutex> protoGuard(mTraceMutex); if (mEnabled) { return; } ATRACE_CALL(); mEnabled = true; std::lock_guard<std::mutex> protoGuard(mTraceMutex); mTrace.set_magic_number(uint64_t(LayersTraceFileProto_MagicNumber_MAGIC_NUMBER_H) << 32 | mTrace = std::make_unique<LayersTraceFileProto>(); mTrace->set_magic_number(uint64_t(LayersTraceFileProto_MagicNumber_MAGIC_NUMBER_H) << 32 | LayersTraceFileProto_MagicNumber_MAGIC_NUMBER_L); } status_t SurfaceTracing::disable() { ATRACE_CALL(); std::lock_guard<std::mutex> protoGuard(mTraceMutex); if (!mEnabled) { return NO_ERROR; } ATRACE_CALL(); std::lock_guard<std::mutex> protoGuard(mTraceMutex); mEnabled = false; status_t err(writeProtoFileLocked()); ALOGE_IF(err == PERMISSION_DENIED, "Could not save the proto file! Permission denied"); ALOGE_IF(err == NOT_ENOUGH_DATA, "Could not save the proto file! There are missing fields"); mTrace.Clear(); mTrace.reset(); return err; } bool SurfaceTracing::isEnabled() const { std::lock_guard<std::mutex> protoGuard(mTraceMutex); return mEnabled; } Loading @@ -61,29 +65,29 @@ void SurfaceTracing::traceLayers(const char* where, LayersProto layers) { if (!mEnabled) { return; } LayersTraceProto* entry = mTrace.add_entry(); LayersTraceProto* entry = mTrace->add_entry(); entry->set_elapsed_realtime_nanos(elapsedRealtimeNano()); entry->set_where(where); entry->mutable_layers()->Swap(&layers); constexpr int maxBufferedEntryCount = 3600; if (mTrace.entry_size() >= maxBufferedEntryCount) { if (mTrace->entry_size() >= maxBufferedEntryCount) { // TODO: flush buffered entries without disabling tracing ALOGE("too many buffered frames; force disable tracing"); mEnabled = false; writeProtoFileLocked(); mTrace.Clear(); mTrace.reset(); } } status_t SurfaceTracing::writeProtoFileLocked() { ATRACE_CALL(); if (!mTrace.IsInitialized()) { if (!mTrace->IsInitialized()) { return NOT_ENOUGH_DATA; } std::string output; if (!mTrace.SerializeToString(&output)) { if (!mTrace->SerializeToString(&output)) { return PERMISSION_DENIED; } if (!android::base::WriteStringToFile(output, mOutputFileName, true)) { Loading @@ -97,7 +101,7 @@ void SurfaceTracing::dump(String8& result) const { std::lock_guard<std::mutex> protoGuard(mTraceMutex); result.appendFormat("Tracing state: %s\n", mEnabled ? "enabled" : "disabled"); result.appendFormat(" number of entries: %d\n", mTrace.entry_size()); result.appendFormat(" number of entries: %d\n", mTrace ? mTrace->entry_size() : 0); } } // namespace android