summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Shunkai Yao <yaoshunkai@google.com> 2023-08-18 18:54:25 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-08-18 18:54:25 +0000
commit415f0ea89708bf5f88914a6c9a8ee81a339aa7ad (patch)
treed4e03c9528729ff811f8893a160fa45f52403161
parente65f6c729b687553a0e2bafd0600d92c9a2c28a9 (diff)
parent484fac0fb7399507dbb7f0cc7ae54ba8140d9cfd (diff)
Merge "Add device logger for active device and action state change" into main
-rw-r--r--services/core/java/com/android/server/audio/AudioService.java7
-rw-r--r--services/core/java/com/android/server/audio/BtHelper.java5
2 files changed, 12 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index 3f50dfd33f42..0bc047271bab 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -7636,6 +7636,10 @@ public class AudioService extends IAudioService.Stub
throw new IllegalArgumentException("Illegal BluetoothProfile profile for device "
+ previousDevice + " -> " + newDevice + ". Got: " + profile);
}
+
+ sDeviceLogger.enqueue(new EventLogger.StringEvent("BlutoothActiveDeviceChanged for "
+ + BluetoothProfile.getProfileName(profile) + ", device update " + previousDevice
+ + " -> " + newDevice));
AudioDeviceBroker.BtDeviceChangedData data =
new AudioDeviceBroker.BtDeviceChangedData(newDevice, previousDevice, info,
"AudioService");
@@ -9685,6 +9689,9 @@ public class AudioService extends IAudioService.Stub
}
} else if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, -1);
+ sDeviceLogger.enqueue(new EventLogger.StringEvent(
+ "BluetoothAdapter ACTION_STATE_CHANGED with state " + state));
+
if (state == BluetoothAdapter.STATE_OFF ||
state == BluetoothAdapter.STATE_TURNING_OFF) {
mDeviceBroker.disconnectAllBluetoothProfiles();
diff --git a/services/core/java/com/android/server/audio/BtHelper.java b/services/core/java/com/android/server/audio/BtHelper.java
index a4d26d3e96c0..b350363f32e1 100644
--- a/services/core/java/com/android/server/audio/BtHelper.java
+++ b/services/core/java/com/android/server/audio/BtHelper.java
@@ -459,6 +459,8 @@ public class BtHelper {
//@GuardedBy("AudioDeviceBroker.mDeviceStateLock")
/*package*/ synchronized void onBtProfileDisconnected(int profile) {
+ AudioService.sDeviceLogger.enqueue(new EventLogger.StringEvent(
+ "BT profile " + BluetoothProfile.getProfileName(profile) + " disconnected"));
switch (profile) {
case BluetoothProfile.A2DP:
mA2dp = null;
@@ -487,6 +489,9 @@ public class BtHelper {
@GuardedBy("AudioDeviceBroker.mDeviceStateLock")
/*package*/ synchronized void onBtProfileConnected(int profile, BluetoothProfile proxy) {
+ AudioService.sDeviceLogger.enqueue(new EventLogger.StringEvent(
+ "BT profile " + BluetoothProfile.getProfileName(profile) + " connected to proxy "
+ + proxy));
if (profile == BluetoothProfile.HEADSET) {
onHeadsetProfileConnected((BluetoothHeadset) proxy);
return;