Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a3d7bd39 authored by chaviw's avatar chaviw
Browse files

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
parent 15b519ba
Loading
Loading
Loading
Loading
+7 −12
Original line number Diff line number Diff line
@@ -3490,11 +3490,6 @@ status_t SurfaceFlinger::doDump(int fd, const Vector<String16>& args, bool asPro
    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 @@ status_t SurfaceFlinger::doDump(int fd, const Vector<String16>& args, bool asPro
        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 @@ status_t SurfaceFlinger::doDump(int fd, const Vector<String16>& args, bool asPro
                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) {