Merge "AudioDeviceCallback: Resolve null type from map reference." into main
diff --git a/src/com/android/server/telecom/CallAudioRouteController.java b/src/com/android/server/telecom/CallAudioRouteController.java
index 57e64bb..4451a94 100644
--- a/src/com/android/server/telecom/CallAudioRouteController.java
+++ b/src/com/android/server/telecom/CallAudioRouteController.java
@@ -230,10 +230,12 @@
@Override
public void onCommunicationDeviceChanged(AudioDeviceInfo device) {
@AudioRoute.AudioRouteType int audioType = device != null
- ? DEVICE_INFO_TYPE_TO_AUDIO_ROUTE_TYPE.get(device.getType())
+ ? DEVICE_INFO_TYPE_TO_AUDIO_ROUTE_TYPE.getOrDefault(
+ device.getType(), TYPE_INVALID)
: TYPE_INVALID;
- Log.i(this, "onCommunicationDeviceChanged: %d", audioType);
- if (device != null && device.getType() == AudioDeviceInfo.TYPE_BUILTIN_SPEAKER) {
+ Log.i(this, "onCommunicationDeviceChanged: device (%s), audioType (%d)",
+ device, audioType);
+ if (audioType == TYPE_SPEAKER) {
if (mCurrentRoute.getType() != TYPE_SPEAKER) {
sendMessageWithSessionInfo(SPEAKER_ON);
}