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

Commit c0f57877 authored by Marie Janssen's avatar Marie Janssen
Browse files

Alternate dumpsys output for arguments

The metrics collection uses the dumpsys function with extra arguments to
provide different formatted output.

When arguments are provided, skip the normal output and use
alternatives.

Change-Id: Ie43b9134c4b21bb2761228934b954e68f2360c2f
parent 8088c73c
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ import android.os.RemoteCallbackList;
import android.os.RemoteException;
import android.os.SystemClock;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.EventLog;
import android.util.Log;
import android.util.Pair;
@@ -2152,6 +2153,16 @@ public class AdapterService extends Service {
    protected void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
        enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);

        if (args.length > 0) {
            debugLog("dumpsys arguments, skipping normal dumpsys: " +
                    TextUtils.join(" ", args));
            if (args[0].startsWith("--proto")) {
                dumpNative(fd, args);
                // TODO(jamuraa): gather protobuf details here and merge
            }
            return;
        }

        writer.println("Bluetooth Status");
        writer.println("  enabled: " + isEnabled());
        writer.println("  state: " + getState());