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

Commit 9e6b439b authored by Muhammad Qureshi's avatar Muhammad Qureshi Committed by Gerrit Code Review
Browse files

Merge "Migrate to BluetoothStatsLog from StatsLog"

parents b5b11641 fb731c46
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -40,7 +40,10 @@ cc_library_shared {
android_app {
    name: "Bluetooth",

    srcs: ["src/**/*.java"],
    srcs: [
        "src/**/*.java",
        ":statslog-bluetooth-java-gen",
    ],
    platform_apis: true,
    certificate: "platform",

@@ -79,3 +82,11 @@ android_app {
        "com.android.bluetooth.updatable",
    ],
}

genrule {
    name: "statslog-bluetooth-java-gen",
    tools: ["stats-log-api-gen"],
    cmd: "$(location stats-log-api-gen) --java $(out) --module bluetooth"
        + " --javaPackage com.android.bluetooth --javaClass BluetoothStatsLog --worksource",
    out: ["com/android/bluetooth/BluetoothStatsLog.java"],
}
+5 −5
Original line number Diff line number Diff line
@@ -32,9 +32,9 @@ import android.content.IntentFilter;
import android.media.AudioManager;
import android.os.HandlerThread;
import android.util.Log;
import android.util.StatsLog;

import com.android.bluetooth.BluetoothMetricsProto;
import com.android.bluetooth.BluetoothStatsLog;
import com.android.bluetooth.Utils;
import com.android.bluetooth.btservice.AdapterService;
import com.android.bluetooth.btservice.MetricsLogger;
@@ -927,7 +927,7 @@ public class A2dpService extends ProfileService {
                            boolean sameAudioFeedingParameters) {
        // Log codec config and capability metrics
        BluetoothCodecConfig codecConfig = codecStatus.getCodecConfig();
        StatsLog.write(StatsLog.BLUETOOTH_A2DP_CODEC_CONFIG_CHANGED,
        BluetoothStatsLog.write(BluetoothStatsLog.BLUETOOTH_A2DP_CODEC_CONFIG_CHANGED,
                mAdapterService.obfuscateAddress(device), codecConfig.getCodecType(),
                codecConfig.getCodecPriority(), codecConfig.getSampleRate(),
                codecConfig.getBitsPerSample(), codecConfig.getChannelMode(),
@@ -935,7 +935,7 @@ public class A2dpService extends ProfileService {
                codecConfig.getCodecSpecific3(), codecConfig.getCodecSpecific4());
        BluetoothCodecConfig[] codecCapabilities = codecStatus.getCodecsSelectableCapabilities();
        for (BluetoothCodecConfig codecCapability : codecCapabilities) {
            StatsLog.write(StatsLog.BLUETOOTH_A2DP_CODEC_CAPABILITY_CHANGED,
            BluetoothStatsLog.write(BluetoothStatsLog.BLUETOOTH_A2DP_CODEC_CAPABILITY_CHANGED,
                    mAdapterService.obfuscateAddress(device), codecCapability.getCodecType(),
                    codecCapability.getCodecPriority(), codecCapability.getSampleRate(),
                    codecCapability.getBitsPerSample(), codecCapability.getChannelMode(),
@@ -995,8 +995,8 @@ public class A2dpService extends ProfileService {
            mActiveDevice = device;
        }

        StatsLog.write(StatsLog.BLUETOOTH_ACTIVE_DEVICE_CHANGED, BluetoothProfile.A2DP,
                mAdapterService.obfuscateAddress(device));
        BluetoothStatsLog.write(BluetoothStatsLog.BLUETOOTH_ACTIVE_DEVICE_CHANGED,
                BluetoothProfile.A2DP, mAdapterService.obfuscateAddress(device));
        Intent intent = new Intent(BluetoothA2dp.ACTION_ACTIVE_DEVICE_CHANGED);
        intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
        intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT
+2 −2
Original line number Diff line number Diff line
@@ -54,8 +54,8 @@ import android.content.Intent;
import android.os.Looper;
import android.os.Message;
import android.util.Log;
import android.util.StatsLog;

import com.android.bluetooth.BluetoothStatsLog;
import com.android.bluetooth.btservice.ProfileService;
import com.android.bluetooth.statemachine.State;
import com.android.bluetooth.statemachine.StateMachine;
@@ -688,7 +688,7 @@ final class A2dpStateMachine extends StateMachine {
    private void broadcastAudioState(int newState, int prevState) {
        log("A2DP Playing state : device: " + mDevice + " State:" + audioStateToString(prevState)
                + "->" + audioStateToString(newState));
        StatsLog.write(StatsLog.BLUETOOTH_A2DP_PLAYBACK_STATE_CHANGED, newState);
        BluetoothStatsLog.write(BluetoothStatsLog.BLUETOOTH_A2DP_PLAYBACK_STATE_CHANGED, newState);
        Intent intent = new Intent(BluetoothA2dp.ACTION_PLAYING_STATE_CHANGED);
        intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mDevice);
        intent.putExtra(BluetoothProfile.EXTRA_PREVIOUS_STATE, prevState);
+3 −3
Original line number Diff line number Diff line
@@ -43,10 +43,10 @@ import android.os.SystemProperties;
import android.os.UserHandle;
import android.util.Log;
import android.util.Pair;
import android.util.StatsLog;

import androidx.annotation.VisibleForTesting;

import com.android.bluetooth.BluetoothStatsLog;
import com.android.bluetooth.Utils;
import com.android.bluetooth.btservice.RemoteDevices.DeviceProperties;

@@ -580,8 +580,8 @@ class AdapterProperties {
        Log.d(TAG,
                "PROFILE_CONNECTION_STATE_CHANGE: profile=" + profile + ", device=" + device + ", "
                        + prevState + " -> " + state);
        StatsLog.write(StatsLog.BLUETOOTH_CONNECTION_STATE_CHANGED, state, 0 /* deprecated */,
                profile, mService.obfuscateAddress(device));
        BluetoothStatsLog.write(BluetoothStatsLog.BLUETOOTH_CONNECTION_STATE_CHANGED, state,
                0 /* deprecated */, profile, mService.obfuscateAddress(device));

        if (!isNormalStateTransition(prevState, state)) {
            Log.w(TAG,
+4 −4
Original line number Diff line number Diff line
@@ -74,9 +74,9 @@ import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import android.util.SparseArray;
import android.util.StatsLog;

import com.android.bluetooth.BluetoothMetricsProto;
import com.android.bluetooth.BluetoothStatsLog;
import com.android.bluetooth.Utils;
import com.android.bluetooth.a2dp.A2dpService;
import com.android.bluetooth.a2dpsink.A2dpSinkService;
@@ -569,8 +569,8 @@ public class AdapterService extends Service {
        } catch (RemoteException e) {
            Log.w(TAG, "RemoteException trying to send a reset to BatteryStats");
        }
        StatsLog.write_non_chained(StatsLog.BLE_SCAN_STATE_CHANGED, -1, null,
                StatsLog.BLE_SCAN_STATE_CHANGED__STATE__RESET, false, false, false);
        BluetoothStatsLog.write_non_chained(BluetoothStatsLog.BLE_SCAN_STATE_CHANGED, -1, null,
                BluetoothStatsLog.BLE_SCAN_STATE_CHANGED__STATE__RESET, false, false, false);

        //Start Gatt service
        setProfileServiceState(GattService.class, BluetoothAdapter.STATE_ON);
@@ -2549,7 +2549,7 @@ public class AdapterService extends Service {
    }

    void logUserBondResponse(BluetoothDevice device, boolean accepted, int event) {
        StatsLog.write(StatsLog.BLUETOOTH_BOND_STATE_CHANGED,
        BluetoothStatsLog.write(BluetoothStatsLog.BLUETOOTH_BOND_STATE_CHANGED,
                obfuscateAddress(device), 0, device.getType(),
                BluetoothDevice.BOND_BONDING,
                event,
Loading