Skip to content

Commit

Permalink
android: use explicit earpiece device
Browse files Browse the repository at this point in the history
  • Loading branch information
z-dule committed Jun 14, 2024
1 parent 4cb671c commit 4ac3140
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,22 @@ public int EnableEarpiece(){
DoLog("EnableEarpiece()");

if (hasApi31()) {
_audio_manager.clearCommunicationDevice();
AudioDeviceInfo seldev = null;
List<AudioDeviceInfo> devices = _audio_manager.getAvailableCommunicationDevices();
for (AudioDeviceInfo device : devices) {
if (device.getType() == AudioDeviceInfo.TYPE_BUILTIN_EARPIECE) {
seldev = device;
break;
}
}
if (seldev == null) {
DoLog("EnableEarpiece(): no earpiece");
return -1;
}
else {
DoLog("EnableEarpiece: setting communication device");
_audio_manager.setCommunicationDevice(seldev);
}
}
else {
if(!hasEarpiece())
Expand Down

0 comments on commit 4ac3140

Please sign in to comment.