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

Commit 533c2f80 authored by Nataniel Borges's avatar Nataniel Borges
Browse files

Add API for writing SF traces to file

Currently the API supports only starting or stopping the trace, and writes to file when the trace is stopped. However, in some scenarios we would like to maintain the trace active, and just dump the trace.

Bug: 205138504
Test: all API, check if files are created under /data/misc/wmtrace
Change-Id: I0102d5f9a96afc159372c5b8ad2261b72f13462f
parent 129a513d
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -5605,9 +5605,9 @@ status_t SurfaceFlinger::CheckTransactCodeCredentials(uint32_t code) {
        code == IBinder::SYSPROPS_TRANSACTION) {
        return OK;
    }
    // Numbers from 1000 to 1041 are currently used for backdoors. The code
    // Numbers from 1000 to 1042 are currently used for backdoors. The code
    // in onTransact verifies that the user is root, and has access to use SF.
    if (code >= 1000 && code <= 1041) {
    if (code >= 1000 && code <= 1042) {
        ALOGV("Accessing SurfaceFlinger through backdoor code: %u", code);
        return OK;
    }
@@ -6062,6 +6062,16 @@ status_t SurfaceFlinger::onTransact(uint32_t code, const Parcel& data, Parcel* r
                reply->writeInt32(NO_ERROR);
                return NO_ERROR;
            }
            case 1042: { // Write layers trace or transaction trace to file
                if (mTransactionTracing) {
                    mTransactionTracing->writeToFile();
                }
                if (mLayerTracingEnabled) {
                    mLayerTracing.writeToFile();
                }
                reply->writeInt32(NO_ERROR);
                return NO_ERROR;
            }
        }
    }
    return err;