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

Commit baf3b9b6 authored by Pavlin Radoslavov's avatar Pavlin Radoslavov
Browse files

Enable debug logs for Bluetooth AdapterService

Enabled log messages that are useful to debug the AdapterService state.
Remaining log messages are controlled by AdapterService.VERBOSE flag
and are disabled by default.

Bug: 31442739
Test: manual, and "frameworks/base/core/tests/bluetoothtests" unit tests
Change-Id: I7d81fd605f64e64f29aee37314821384234b286d
(cherry picked from commit 32a92489)
parent 2b8f0acc
Loading
Loading
Loading
Loading
+14 −8
Original line number Diff line number Diff line
@@ -87,7 +87,8 @@ import com.android.internal.app.IBatteryStats;

public class AdapterService extends Service {
    private static final String TAG = "BluetoothAdapterService";
    private static final boolean DBG = false;
    private static final boolean DBG = true;
    private static final boolean VERBOSE = false;
    private static final boolean TRACE_REF = false;
    private static final int MIN_ADVT_INSTANCES_FOR_MA = 5;
    private static final int MIN_OFFLOADED_FILTERS = 10;
@@ -2382,9 +2383,10 @@ public class AdapterService extends Service {
            }
        }

        debugLog("energyInfoCallback() status = " + status +
        verboseLog("energyInfoCallback() status = " + status +
                   "tx_time = " + tx_time + "rx_time = " + rx_time +
                "idle_time = " + idle_time + "energy_used = " + energy_used +
                   "idle_time = " + idle_time +
                   "energy_used = " + energy_used +
                   "ctrl_state = " + ctrl_state +
                   "traffic = " + Arrays.toString(data));
    }
@@ -2432,8 +2434,8 @@ public class AdapterService extends Service {
        enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);

        if (args.length > 0) {
            debugLog("dumpsys arguments, check for protobuf output: " +
                    TextUtils.join(" ", args));
            verboseLog("dumpsys arguments, check for protobuf output: "
                       + TextUtils.join(" ", args));
            if (args[0].startsWith("--proto")) {
                if (args[0].equals("--proto-java-bin")) {
                    dumpJava(fd);
@@ -2502,6 +2504,10 @@ public class AdapterService extends Service {
        if (DBG) Log.d(TAG, msg);
    }

    private void verboseLog(String msg) {
        if (VERBOSE) Log.v(TAG, msg);
    }

    private void errorLog(String msg) {
        Log.e(TAG, msg);
    }