Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
platform_frameworks_base-old
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Farzin Kazemzadeh
platform_frameworks_base-old
Commits
a892c635
Commit
a892c635
authored
1 year ago
by
Jean-Michel Trivi
Committed by
Android (Google) Code Review
1 year ago
Browse files
Options
Downloads
Plain Diff
Merge "AudioService: improve device connection failure logs" into main
parents
c22e70f3
b07a14bf
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
services/core/java/com/android/server/audio/AudioDeviceInventory.java
+34
-16
34 additions, 16 deletions
...e/java/com/android/server/audio/AudioDeviceInventory.java
with
34 additions
and
16 deletions
services/core/java/com/android/server/audio/AudioDeviceInventory.java
+
34
−
16
View file @
a892c635
...
...
@@ -891,7 +891,7 @@ public class AudioDeviceInventory {
if
(
mDeviceBroker
.
hasScheduledA2dpConnection
(
btDevice
))
{
AudioService
.
sDeviceLogger
.
enqueue
(
new
EventLogger
.
StringEvent
(
"A2dp config change ignored (scheduled connection change)"
)
.
print
L
og
(
TAG
));
.
print
Sl
og
(
EventLogger
.
Event
.
ALOGI
,
TAG
));
mmi
.
set
(
MediaMetrics
.
Property
.
EARLY_RETURN
,
"A2dp config change ignored"
)
.
record
();
return
;
...
...
@@ -928,7 +928,7 @@ public class AudioDeviceInventory {
"APM handleDeviceConfigChange failed for A2DP device addr="
+
address
+
" codec="
+
AudioSystem
.
audioFormatToString
(
codec
))
.
print
L
og
(
TAG
));
.
print
Sl
og
(
EventLogger
.
Event
.
ALOGE
,
TAG
));
// force A2DP device disconnection in case of error so that AudioService
// state is consistent with audio policy manager state
...
...
@@ -939,7 +939,7 @@ public class AudioDeviceInventory {
"APM handleDeviceConfigChange success for A2DP device addr="
+
address
+
" codec="
+
AudioSystem
.
audioFormatToString
(
codec
))
.
print
L
og
(
TAG
));
.
print
Sl
og
(
EventLogger
.
Event
.
ALOGI
,
TAG
));
}
}
}
...
...
@@ -1706,10 +1706,13 @@ public class AudioDeviceInventory {
if
(
res
!=
AudioSystem
.
AUDIO_STATUS_OK
)
{
final
String
reason
=
"not connecting device 0x"
+
Integer
.
toHexString
(
device
)
+
" due to command error "
+
res
;
Slog
.
e
(
TAG
,
reason
);
mmi
.
set
(
MediaMetrics
.
Property
.
EARLY_RETURN
,
reason
)
.
set
(
MediaMetrics
.
Property
.
STATE
,
MediaMetrics
.
Value
.
DISCONNECTED
)
.
record
();
AudioService
.
sDeviceLogger
.
enqueue
(
new
EventLogger
.
StringEvent
(
"APM failed to make available device 0x"
+
Integer
.
toHexString
(
device
)
+
"addr="
+
address
+
" error="
+
res
)
.
printSlog
(
EventLogger
.
Event
.
ALOGE
,
TAG
));
return
false
;
}
mConnectedDevices
.
put
(
deviceKey
,
new
DeviceInfo
(
device
,
deviceName
,
address
));
...
...
@@ -1735,7 +1738,8 @@ public class AudioDeviceInventory {
AudioService
.
sDeviceLogger
.
enqueue
(
new
EventLogger
.
StringEvent
(
"SCO "
+
(
AudioSystem
.
isInputDevice
(
device
)
?
"source"
:
"sink"
)
+
" device addr="
+
address
+
(
connect
?
" now available"
:
" made unavailable"
)).
printLog
(
TAG
));
+
(
connect
?
" now available"
:
" made unavailable"
))
.
printSlog
(
EventLogger
.
Event
.
ALOGI
,
TAG
));
}
mmi
.
set
(
MediaMetrics
.
Property
.
STATE
,
MediaMetrics
.
Value
.
CONNECTED
).
record
();
}
else
{
...
...
@@ -1991,14 +1995,15 @@ public class AudioDeviceInventory {
// double connection is made.
if
(
res
!=
AudioSystem
.
AUDIO_STATUS_OK
)
{
AudioService
.
sDeviceLogger
.
enqueue
(
new
EventLogger
.
StringEvent
(
"APM failed to make available A2DP device addr="
+
address
+
" error="
+
res
).
printLog
(
TAG
));
"APM failed to make available A2DP device addr="
+
Utils
.
anonymizeBluetoothAddress
(
address
)
+
" error="
+
res
).
printSlog
(
EventLogger
.
Event
.
ALOGE
,
TAG
));
// TODO: connection failed, stop here
// TODO: return;
}
else
{
AudioService
.
sDeviceLogger
.
enqueue
(
new
EventLogger
.
StringEvent
(
"A2DP sink device addr="
+
Utils
.
anonymizeBluetoothAddress
(
address
)
+
" now available"
).
print
L
og
(
TAG
));
+
" now available"
).
print
Sl
og
(
EventLogger
.
Event
.
ALOGI
,
TAG
));
}
// Reset A2DP suspend state each time a new sink is connected
...
...
@@ -2239,7 +2244,8 @@ public class AudioDeviceInventory {
// removing A2DP device not currently used by AudioPolicy, log but don't act on it
AudioService
.
sDeviceLogger
.
enqueue
((
new
EventLogger
.
StringEvent
(
"A2DP device "
+
Utils
.
anonymizeBluetoothAddress
(
address
)
+
" made unavailable, was not used"
)).
printLog
(
TAG
));
+
" made unavailable, was not used"
))
.
printSlog
(
EventLogger
.
Event
.
ALOGI
,
TAG
));
mmi
.
set
(
MediaMetrics
.
Property
.
EARLY_RETURN
,
"A2DP device made unavailable, was not used"
)
.
record
();
...
...
@@ -2257,13 +2263,13 @@ public class AudioDeviceInventory {
AudioService
.
sDeviceLogger
.
enqueue
(
new
EventLogger
.
StringEvent
(
"APM failed to make unavailable A2DP device addr="
+
Utils
.
anonymizeBluetoothAddress
(
address
)
+
" error="
+
res
).
print
L
og
(
TAG
));
+
" error="
+
res
).
print
Sl
og
(
EventLogger
.
Event
.
ALOGE
,
TAG
));
// TODO: failed to disconnect, stop here
// TODO: return;
}
else
{
AudioService
.
sDeviceLogger
.
enqueue
((
new
EventLogger
.
StringEvent
(
"A2DP device addr="
+
Utils
.
anonymizeBluetoothAddress
(
address
)
+
" made unavailable"
)).
print
L
og
(
TAG
));
+
" made unavailable"
)).
print
Sl
og
(
EventLogger
.
Event
.
ALOGI
,
TAG
));
}
mApmConnectedDevices
.
remove
(
AudioSystem
.
DEVICE_OUT_BLUETOOTH_A2DP
);
...
...
@@ -2296,10 +2302,22 @@ public class AudioDeviceInventory {
@GuardedBy
(
"mDevicesLock"
)
private
void
makeA2dpSrcAvailable
(
String
address
)
{
mAudioSystem
.
setDeviceConnectionState
(
new
AudioDeviceAttributes
(
final
int
res
=
mAudioSystem
.
setDeviceConnectionState
(
new
AudioDeviceAttributes
(
AudioSystem
.
DEVICE_IN_BLUETOOTH_A2DP
,
address
),
AudioSystem
.
DEVICE_STATE_AVAILABLE
,
AudioSystem
.
AUDIO_FORMAT_DEFAULT
);
if
(
res
!=
AudioSystem
.
AUDIO_STATUS_OK
)
{
AudioService
.
sDeviceLogger
.
enqueue
(
new
EventLogger
.
StringEvent
(
"APM failed to make available A2DP source device addr="
+
Utils
.
anonymizeBluetoothAddress
(
address
)
+
" error="
+
res
).
printSlog
(
EventLogger
.
Event
.
ALOGE
,
TAG
));
// TODO: connection failed, stop here
// TODO: return
}
else
{
AudioService
.
sDeviceLogger
.
enqueue
(
new
EventLogger
.
StringEvent
(
"A2DP source device addr="
+
Utils
.
anonymizeBluetoothAddress
(
address
)
+
" now available"
).
printSlog
(
EventLogger
.
Event
.
ALOGI
,
TAG
));
}
mConnectedDevices
.
put
(
DeviceInfo
.
makeDeviceListKey
(
AudioSystem
.
DEVICE_IN_BLUETOOTH_A2DP
,
address
),
new
DeviceInfo
(
AudioSystem
.
DEVICE_IN_BLUETOOTH_A2DP
,
""
,
address
));
...
...
@@ -2452,14 +2470,14 @@ public class AudioDeviceInventory {
if
(
res
!=
AudioSystem
.
AUDIO_STATUS_OK
)
{
AudioService
.
sDeviceLogger
.
enqueue
(
new
EventLogger
.
StringEvent
(
"APM failed to make available LE Audio device addr="
+
address
+
" error="
+
res
).
print
L
og
(
TAG
));
+
" error="
+
res
).
print
Sl
og
(
EventLogger
.
Event
.
ALOGE
,
TAG
));
// TODO: connection failed, stop here
// TODO: return;
}
else
{
AudioService
.
sDeviceLogger
.
enqueue
(
new
EventLogger
.
StringEvent
(
"LE Audio "
+
(
AudioSystem
.
isInputDevice
(
device
)
?
"source"
:
"sink"
)
+
" device addr="
+
Utils
.
anonymizeBluetoothAddress
(
address
)
+
" now available"
).
print
L
og
(
TAG
));
+
" now available"
).
print
Sl
og
(
EventLogger
.
Event
.
ALOGI
,
TAG
));
}
// Reset LEA suspend state each time a new sink is connected
mDeviceBroker
.
clearLeAudioSuspended
(
true
/* internalOnly */
);
...
...
@@ -2501,13 +2519,13 @@ public class AudioDeviceInventory {
if
(
res
!=
AudioSystem
.
AUDIO_STATUS_OK
)
{
AudioService
.
sDeviceLogger
.
enqueue
(
new
EventLogger
.
StringEvent
(
"APM failed to make unavailable LE Audio device addr="
+
address
+
" error="
+
res
).
print
L
og
(
TAG
));
+
" error="
+
res
).
print
Sl
og
(
EventLogger
.
Event
.
ALOGE
,
TAG
));
// TODO: failed to disconnect, stop here
// TODO: return;
}
else
{
AudioService
.
sDeviceLogger
.
enqueue
(
new
EventLogger
.
StringEvent
(
"LE Audio device addr="
+
Utils
.
anonymizeBluetoothAddress
(
address
)
+
" made unavailable"
).
print
L
og
(
TAG
));
+
" made unavailable"
).
print
Sl
og
(
EventLogger
.
Event
.
ALOGI
,
TAG
));
}
mConnectedDevices
.
remove
(
DeviceInfo
.
makeDeviceListKey
(
device
,
address
));
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment