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

Commit 793d1fc6 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Clean up android.tracing.client_side_proto_logging flag." into main

parents ffbe314b d9f09256
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -17,14 +17,6 @@ flag {
    bug: "323165543"
}

flag {
    name: "client_side_proto_logging"
    namespace: "windowing_tools"
    description: "Add support for client side protologging"
    is_fixed_read_only: true
    bug: "352538294"
}

flag {
    name: "imetracker_protolog"
    namespace: "windowing_tools"
+18 −56
Original line number Diff line number Diff line
@@ -180,7 +180,7 @@ public abstract class PerfettoProtoLogImpl extends IProtoLogClient.Stub implemen
    public void enable() {
        Producer.init(InitArguments.DEFAULTS);

        if (android.tracing.Flags.clientSideProtoLogging() && mConfigurationService != null) {
        if (mConfigurationService != null) {
            synchronized (mLogGroupsLock) {
                // Get the values on the main thread instead of the background worker thread because
                // if we register more groups in the future this might happen before the task
@@ -210,9 +210,7 @@ public abstract class PerfettoProtoLogImpl extends IProtoLogClient.Stub implemen

    @Nullable
    private static IProtoLogConfigurationService getConfigurationService() {
        if (android.tracing.Flags.clientSideProtoLogging()) {
        var service = ServiceManager.getService(PROTOLOG_CONFIGURATION_SERVICE);

        if (service != null) {
            return IProtoLogConfigurationService.Stub.asInterface(service);
        } else {
@@ -221,14 +219,13 @@ public abstract class PerfettoProtoLogImpl extends IProtoLogClient.Stub implemen
                    + "available for running configuration of which groups to log to logcat. "
                    + "We might also be missing viewer configs in the trace for decoding the "
                    + "messages.");
            }
        }

            // Will be null either because we are calling this before the service is ready and
            // registered with the service manager or because we are calling this from a service
            // that does not have access to the configuration service.
            return null;
        }
    }

    private void connectToConfigurationServiceAsync(@NonNull IProtoLogGroup... groups) {
        Objects.requireNonNull(mConfigurationService,
@@ -284,7 +281,7 @@ public abstract class PerfettoProtoLogImpl extends IProtoLogClient.Stub implemen
        mDataSource.unregisterOnFlushCallback(this);
        mDataSource.unregisterOnStopCallback(this);

        if (android.tracing.Flags.clientSideProtoLogging() && mConfigurationService != null) {
        if (mConfigurationService != null) {
            disconnectFromConfigurationServiceAsync();
        }

@@ -454,41 +451,10 @@ public abstract class PerfettoProtoLogImpl extends IProtoLogClient.Stub implemen
    @Deprecated
    public int onShellCommand(@NonNull ShellCommand shell) {
        PrintWriter pw = shell.getOutPrintWriter();

        if (android.tracing.Flags.clientSideProtoLogging()) {
        pw.println("Command deprecated. Please use 'cmd protolog_configuration' instead.");
        return -1;
    }

        String cmd = shell.getNextArg();
        if (cmd == null) {
            return unknownCommand(pw);
        }
        ArrayList<String> args = new ArrayList<>();
        String arg;
        while ((arg = shell.getNextArg()) != null) {
            args.add(arg);
        }
        final ILogger logger = (msg) -> logAndPrintln(pw, msg);
        String[] groups = args.toArray(new String[0]);
        switch (cmd) {
            case "start", "stop" -> {
                pw.println("Command not supported. "
                        + "Please start and stop ProtoLog tracing with Perfetto.");
                return -1;
            }
            case "enable-text" -> {
                return startLoggingToLogcat(groups, logger);
            }
            case "disable-text" -> {
                return stopLoggingToLogcat(groups, logger);
            }
            default -> {
                return unknownCommand(pw);
            }
        }
    }

    private void log(@NonNull LogLevel logLevel, @NonNull IProtoLogGroup group,
            @NonNull Message message, @Nullable Object[] args) {
        if (isProtoEnabled()) {
@@ -554,10 +520,6 @@ public abstract class PerfettoProtoLogImpl extends IProtoLogClient.Stub implemen
        Log.d(LOG_TAG, "Executing onTracingFlush");
        waitForExistingBackgroundTasksToComplete();

        if (!android.tracing.Flags.clientSideProtoLogging()) {
            dumpViewerConfig();
        }

        Log.d(LOG_TAG, "Finished onTracingFlush");
    }

+4 −6
Original line number Diff line number Diff line
@@ -1196,12 +1196,10 @@ public final class SystemServer implements Dumpable {
        t.traceEnd();

        // Orchestrates some ProtoLogging functionality.
        if (android.tracing.Flags.clientSideProtoLogging()) {
        t.traceBegin("StartProtoLogConfigurationService");
        ServiceManager.addService(
                Context.PROTOLOG_CONFIGURATION_SERVICE, new ProtoLogConfigurationServiceImpl());
        t.traceEnd();
        }

        t.traceBegin("InitializeProtoLog");
        ProtoLog.init(WmProtoLogGroups.values());