vc: Fix handling volume state change which can be without device
Bug: 150670922
Tag: #feature
Sponsor: jpawlowski@
Test: Manual
Change-Id: Ibced293965d46fe93406fcfd9844018b206dfbc9
diff --git a/src/com/android/bluetooth/vc/VolumeControlService.java b/src/com/android/bluetooth/vc/VolumeControlService.java
index 8c55767..cb22e4d 100644
--- a/src/com/android/bluetooth/vc/VolumeControlService.java
+++ b/src/com/android/bluetooth/vc/VolumeControlService.java
@@ -426,14 +426,17 @@
}
void messageFromNative(VolumeControlStackEvent stackEvent) {
+
+ if (stackEvent.type == VolumeControlStackEvent.EVENT_TYPE_VOLUME_STATE_CHANGED) {
+ handleVolumeControlChanged(stackEvent.device, stackEvent.valueInt1,
+ stackEvent.valueInt2, stackEvent.valueBool1);
+ return;
+ }
+
Objects.requireNonNull(stackEvent.device,
"Device should never be null, event: " + stackEvent);
Intent intent = null;
- if (stackEvent.type == VolumeControlStackEvent.EVENT_TYPE_VOLUME_STATE_CHANGED) {
- handleVolumeControlChanged(stackEvent.device, stackEvent.valueInt1,
- stackEvent.valueInt2, stackEvent.valueBool1);
- }
if (intent != null) {
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT