Allow SurfaceFlinger to dump to proto
SurfaceFlinger dump to proto was broken due to another CL.
Test: "adb shell dumpsys SurfaceFlinger --proto" works correctly now
Change-Id: I574e2a0b22764928e5ebdf1bd3f76bf20612f879
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 875bef1..a38e3b3 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -3490,11 +3490,6 @@
const int pid = ipc->getCallingPid();
const int uid = ipc->getCallingUid();
- if (asProto) {
- // Return early as SurfaceFlinger does not support dumping sections in proto format
- return OK;
- }
-
if ((uid != AID_SHELL) &&
!PermissionCache::checkPermission(sDump, pid, uid)) {
result.appendFormat("Permission Denial: "
@@ -3514,6 +3509,13 @@
bool dumpAll = true;
size_t index = 0;
size_t numArgs = args.size();
+
+ if (asProto) {
+ LayersProto layersProto = dumpProtoInfo();
+ result.append(layersProto.SerializeAsString().c_str(), layersProto.ByteSize());
+ dumpAll = false;
+ }
+
if (numArgs) {
if ((index < numArgs) &&
(args[index] == String16("--list"))) {
@@ -3562,13 +3564,6 @@
dumpWideColorInfo(result);
dumpAll = false;
}
-
- if ((index < numArgs) && (args[index] == String16("--proto"))) {
- index++;
- LayersProto layersProto = dumpProtoInfo();
- result.append(layersProto.SerializeAsString().c_str(), layersProto.ByteSize());
- dumpAll = false;
- }
}
if (dumpAll) {