summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2017-08-15 17:52:22 -0700
committerJean-Michel Trivi <jmtrivi@google.com>2017-08-15 18:07:36 -0700
commit87a264dfdeef1c638095bde254ac6659e440172e (patch)
tree20b774a6bc525799a7f2b90507b2897dccf46fc5
parenta3c2cee05562838cf64e7d0946b2ea66e6541304 (diff)
downloadbase-87a264dfdeef1c638095bde254ac6659e440172e.tar.gz
AudioService: device connection intent: never send null action
Change 145c95342c9c removed a test on the type of device for which a ACTION_HEADSET_PLUG intent is broadcast. As a result, for some devices (e.g. DEVICE_OUT_USB_DEVICE), there is a code path in AudioService.sendDeviceConnectionIntent() where the intent's action is not set, causing a WTF exception to be thrown for the broadcast. The fix consists in always checking that the intent will be sent with a non-null action. Test: connect a USB device recognized as DEVICE_OUT_USB_DEVICE Bug: 64724117 Change-Id: Ib2a486d1fabbde58d6a8f8370d5803c694977ee1
-rw-r--r--services/core/java/com/android/server/audio/AudioService.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index cff917394ace..0326299f4efa 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -5433,6 +5433,10 @@ public class AudioService extends IAudioService.Stub
configureHdmiPlugIntent(intent, state);
}
+ if (intent.getAction() == null) {
+ return;
+ }
+
intent.putExtra(CONNECT_INTENT_KEY_STATE, state);
intent.putExtra(CONNECT_INTENT_KEY_ADDRESS, address);
intent.putExtra(CONNECT_INTENT_KEY_PORT_NAME, deviceName);
@@ -5506,9 +5510,7 @@ public class AudioService extends IAudioService.Stub
}
}
}
- if (device != AudioSystem.DEVICE_IN_WIRED_HEADSET) {
- sendDeviceConnectionIntent(device, state, address, deviceName);
- }
+ sendDeviceConnectionIntent(device, state, address, deviceName);
updateAudioRoutes(device, state);
}
}