Replace surfaceflinger protobufs with protobuf-lite
Use lite protobufs for surfaceflinger to remove dependency on
libprotobuf-cpp-full, which will be removed from the platform.
Bug: 32417805
Test: builds
Change-Id: Ie27b253a2f6c1b296c4ae7c7cb056cd3c4c0dde6
diff --git a/cmds/surfacereplayer/replayer/Replayer.cpp b/cmds/surfacereplayer/replayer/Replayer.cpp
index ace10d1..a49da37 100644
--- a/cmds/surfacereplayer/replayer/Replayer.cpp
+++ b/cmds/surfacereplayer/replayer/Replayer.cpp
@@ -20,6 +20,8 @@
#include <android/native_window.h>
+#include <android-base/file.h>
+
#include <binder/IMemory.h>
#include <gui/BufferQueue.h>
@@ -61,14 +63,18 @@
mStopTimeStamp(stopHere) {
srand(RAND_COLOR_SEED);
- std::fstream input(filename, std::ios::in | std::ios::binary);
-
- mLoaded = mTrace.ParseFromIstream(&input);
- if (!mLoaded) {
+ std::string input;
+ if (!android::base::ReadFileToString(filename, &input, true)) {
std::cerr << "Trace did not load. Does " << filename << " exist?" << std::endl;
abort();
}
+ mLoaded = mTrace.ParseFromString(input);
+ if (!mLoaded) {
+ std::cerr << "Trace did not load." << std::endl;
+ abort();
+ }
+
mCurrentTime = mTrace.increment(0).time_stamp();
sReplayingManually.store(replayManually);