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

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

Merge changes I9d86ba78,I20b8b262 into main

* changes:
  Remove command handling in PerfettoProtoLogImpl
  Ensure we always have a logger
parents c1095d06 8528462f
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -205,10 +205,11 @@ public class PerfettoProtoLogImpl extends IProtoLogClient.Stub implements IProto

    @Override
    public void toggleLogcat(boolean enabled, String[] groups) {
        final ILogger logger = (message) -> Log.d(LOG_TAG, message);
        if (enabled) {
            startLoggingToLogcat(groups, null);
            startLoggingToLogcat(groups, logger);
        } else {
            stopLoggingToLogcat(groups, null);
            stopLoggingToLogcat(groups, logger);
        }
    }

@@ -218,7 +219,7 @@ public class PerfettoProtoLogImpl extends IProtoLogClient.Stub implements IProto
     * @param logger A logger to write status updates to
     * @return status code
     */
    public int startLoggingToLogcat(String[] groups, ILogger logger) {
    public int startLoggingToLogcat(String[] groups, @NonNull ILogger logger) {
        if (mViewerConfigReader != null) {
            mViewerConfigReader.loadViewerConfig(groups, logger);
        }
@@ -231,7 +232,7 @@ public class PerfettoProtoLogImpl extends IProtoLogClient.Stub implements IProto
     * @param logger A logger to write status updates to
     * @return status code
     */
    public int stopLoggingToLogcat(String[] groups, ILogger logger) {
    public int stopLoggingToLogcat(String[] groups, @NonNull ILogger logger) {
        if (mViewerConfigReader != null) {
            mViewerConfigReader.unloadViewerConfig(groups, logger);
        }
@@ -265,8 +266,15 @@ public class PerfettoProtoLogImpl extends IProtoLogClient.Stub implements IProto
    /**
     * Responds to a shell command.
     */
    @Deprecated
    public int onShellCommand(ShellCommand shell) {
        PrintWriter pw = shell.getOutPrintWriter();

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

        String cmd = shell.getNextArg();
        if (cmd == null) {
            return unknownCommand(pw);