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

Commit 211b7d58 authored by William Escande's avatar William Escande Committed by David Duarte
Browse files

Log bluetooth state change in metrics

Bug: 278198192
Test: Unknown
(cherry picked from https://android-review.googlesource.com/q/commit:2323071db3688295f4ed2d4ee801b1276312bdc3)
Merged-In: I2fb2c6945e979e24eaae0d040d3f9ed530a2d64c
Change-Id: I2fb2c6945e979e24eaae0d040d3f9ed530a2d64c
parent 1b1b56f6
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -91,6 +91,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;
@@ -3134,6 +3135,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);
        }
    }