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

Commit 2323071d authored by William Escande's avatar William Escande
Browse files

Log bluetooth state change in metrics

Bug: 278198192
Test: Unknown
Change-Id: I2fb2c6945e979e24eaae0d040d3f9ed530a2d64c
parent 7efc8cbf
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -90,6 +90,7 @@ import android.util.Log;
import android.util.Pair;
import android.util.proto.ProtoOutputStream;

import com.android.bluetooth.BluetoothStatsLog;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.modules.utils.SynchronousResultReceiver;
@@ -3094,6 +3095,19 @@ public class BluetoothManagerService extends IBluetoothManager.Stub {
            }
            mActiveLogs.add(
                    new ActiveLog(reason, packageName, enable, System.currentTimeMillis()));

            int state =
                    enable
                            ? BluetoothStatsLog.BLUETOOTH_ENABLED_STATE_CHANGED__STATE__ENABLED
                            : BluetoothStatsLog.BLUETOOTH_ENABLED_STATE_CHANGED__STATE__DISABLED;

            BluetoothStatsLog.write_non_chained(
                    BluetoothStatsLog.BLUETOOTH_ENABLED_STATE_CHANGED,
                    Binder.getCallingUid(),
                    null,
                    state,
                    reason,
                    packageName);
        }
    }