diff options
author | Kweku Adams <kwekua@google.com> | 2018-04-03 16:31:10 -0700 |
---|---|---|
committer | Kweku Adams <kwekua@google.com> | 2018-04-12 14:23:15 -0700 |
commit | 1856a4cfcca8c18365e8fd855905b57679d3a280 (patch) | |
tree | 73f6f2214eef55092ff49d6af51a92f576fe4626 /libs/hwui/service/GraphicsStatsService.cpp | |
parent | a87e56c97ad578e2014c81a02d7d744b5850686f (diff) |
Adding privacy tags to graphicsstats proto.
Creating a copy of the graphicsstats proto so that one can be tagged
with privacy annotations and the other can be used internally while
still using the protobuf-cpp-lite library.
Bug: 72570104
Test: flash device and check incident output
Merged-In: I2d72e7bd17689c1401a16d5a13956e6528ddb525
Change-Id: I0a46ee6cc463b133925be1cf8dee8cf3d107930c
Diffstat (limited to 'libs/hwui/service/GraphicsStatsService.cpp')
-rw-r--r-- | libs/hwui/service/GraphicsStatsService.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/libs/hwui/service/GraphicsStatsService.cpp b/libs/hwui/service/GraphicsStatsService.cpp index 599226bebe84..7f8cb2d1f577 100644 --- a/libs/hwui/service/GraphicsStatsService.cpp +++ b/libs/hwui/service/GraphicsStatsService.cpp @@ -17,8 +17,8 @@ #include "GraphicsStatsService.h" #include "JankTracker.h" +#include "protos/graphicsstats.pb.h" -#include <frameworks/base/core/proto/android/service/graphicsstats.pb.h> #include <google/protobuf/io/zero_copy_stream_impl_lite.h> #include <log/log.h> @@ -41,10 +41,10 @@ static_assert(sizeof(sCurrentFileVersion) == sHeaderSize, "Header size is wrong" constexpr int sHistogramSize = ProfileData::HistogramSize(); -static bool mergeProfileDataIntoProto(service::GraphicsStatsProto* proto, +static bool mergeProfileDataIntoProto(protos::GraphicsStatsProto* proto, const std::string& package, int64_t versionCode, int64_t startTime, int64_t endTime, const ProfileData* data); -static void dumpAsTextToFd(service::GraphicsStatsProto* proto, int outFd); +static void dumpAsTextToFd(protos::GraphicsStatsProto* proto, int outFd); class FileDescriptor { public: @@ -104,7 +104,7 @@ private: }; bool GraphicsStatsService::parseFromFile(const std::string& path, - service::GraphicsStatsProto* output) { + protos::GraphicsStatsProto* output) { FileDescriptor fd{open(path.c_str(), O_RDONLY)}; if (!fd.valid()) { int err = errno; @@ -153,7 +153,7 @@ bool GraphicsStatsService::parseFromFile(const std::string& path, return success; } -bool mergeProfileDataIntoProto(service::GraphicsStatsProto* proto, const std::string& package, +bool mergeProfileDataIntoProto(protos::GraphicsStatsProto* proto, const std::string& package, int64_t versionCode, int64_t startTime, int64_t endTime, const ProfileData* data) { if (proto->stats_start() == 0 || proto->stats_start() > startTime) { @@ -193,7 +193,7 @@ bool mergeProfileDataIntoProto(service::GraphicsStatsProto* proto, const std::st data->histogramForEach([&](ProfileData::HistogramEntry entry) { if (hitMergeError) return; - service::GraphicsStatsHistogramBucketProto* bucket; + protos::GraphicsStatsHistogramBucketProto* bucket; if (creatingHistogram) { bucket = proto->add_histogram(); bucket->set_render_millis(entry.renderTimeMs); @@ -212,7 +212,7 @@ bool mergeProfileDataIntoProto(service::GraphicsStatsProto* proto, const std::st return !hitMergeError; } -static int32_t findPercentile(service::GraphicsStatsProto* proto, int percentile) { +static int32_t findPercentile(protos::GraphicsStatsProto* proto, int percentile) { int32_t pos = percentile * proto->summary().total_frames() / 100; int32_t remaining = proto->summary().total_frames() - pos; for (auto it = proto->histogram().rbegin(); it != proto->histogram().rend(); ++it) { @@ -224,7 +224,7 @@ static int32_t findPercentile(service::GraphicsStatsProto* proto, int percentile return 0; } -void dumpAsTextToFd(service::GraphicsStatsProto* proto, int fd) { +void dumpAsTextToFd(protos::GraphicsStatsProto* proto, int fd) { // This isn't a full validation, just enough that we can deref at will if (proto->package_name().empty() || !proto->has_summary()) { ALOGW("Skipping dump, invalid package_name() '%s' or summary %d", @@ -259,7 +259,7 @@ void dumpAsTextToFd(service::GraphicsStatsProto* proto, int fd) { void GraphicsStatsService::saveBuffer(const std::string& path, const std::string& package, int64_t versionCode, int64_t startTime, int64_t endTime, const ProfileData* data) { - service::GraphicsStatsProto statsProto; + protos::GraphicsStatsProto statsProto; if (!parseFromFile(path, &statsProto)) { statsProto.Clear(); } @@ -310,12 +310,12 @@ public: Dump(int outFd, DumpType type) : mFd(outFd), mType(type) {} int fd() { return mFd; } DumpType type() { return mType; } - service::GraphicsStatsServiceDumpProto& proto() { return mProto; } + protos::GraphicsStatsServiceDumpProto& proto() { return mProto; } private: int mFd; DumpType mType; - service::GraphicsStatsServiceDumpProto mProto; + protos::GraphicsStatsServiceDumpProto mProto; }; GraphicsStatsService::Dump* GraphicsStatsService::createDump(int outFd, DumpType type) { @@ -325,7 +325,7 @@ GraphicsStatsService::Dump* GraphicsStatsService::createDump(int outFd, DumpType void GraphicsStatsService::addToDump(Dump* dump, const std::string& path, const std::string& package, int64_t versionCode, int64_t startTime, int64_t endTime, const ProfileData* data) { - service::GraphicsStatsProto statsProto; + protos::GraphicsStatsProto statsProto; if (!path.empty() && !parseFromFile(path, &statsProto)) { statsProto.Clear(); } @@ -347,7 +347,7 @@ void GraphicsStatsService::addToDump(Dump* dump, const std::string& path, } void GraphicsStatsService::addToDump(Dump* dump, const std::string& path) { - service::GraphicsStatsProto statsProto; + protos::GraphicsStatsProto statsProto; if (!parseFromFile(path, &statsProto)) { return; } |