Loading android/app/src/com/android/bluetooth/le_audio/LeAudioService.java +3 −3 Original line number Diff line number Diff line Loading @@ -415,7 +415,7 @@ public class LeAudioService extends ProfileService { sLeAudioService = instance; } private int getGroupVolume(int groupId) { private int getAudioDeviceGroupVolume(int groupId) { if (mVolumeControlService == null) { mVolumeControlService = mServiceFactory.getVolumeControlService(); if (mVolumeControlService == null) { Loading @@ -424,7 +424,7 @@ public class LeAudioService extends ProfileService { } } return mVolumeControlService.getGroupVolume(groupId); return mVolumeControlService.getAudioDeviceGroupVolume(groupId); } public boolean connect(BluetoothDevice device) { Loading Loading @@ -926,7 +926,7 @@ public class LeAudioService extends ProfileService { } int volume = IBluetoothVolumeControl.VOLUME_CONTROL_UNKNOWN_VOLUME; if (mActiveAudioOutDevice != null) { volume = getGroupVolume(groupId); volume = getAudioDeviceGroupVolume(groupId); } mAudioManager.handleBluetoothActiveDeviceChanged(mActiveAudioOutDevice, Loading android/app/src/com/android/bluetooth/vc/VolumeControlService.java +14 −0 Original line number Diff line number Diff line Loading @@ -586,6 +586,11 @@ public class VolumeControlService extends ProfileService { * {@hide} */ public void setGroupVolume(int groupId, int volume) { if (volume < 0) { Log.w(TAG, "Tried to set invalid volume " + volume + ". Ignored."); return; } mGroupVolumeCache.put(groupId, volume); mVolumeControlNativeInterface.setGroupVolume(groupId, volume); } Loading Loading @@ -683,6 +688,15 @@ public class VolumeControlService extends ProfileService { } } /** * {@hide} */ public int getAudioDeviceGroupVolume(int groupId) { int volume = getGroupVolume(groupId); if (volume == IBluetoothVolumeControl.VOLUME_CONTROL_UNKNOWN_VOLUME) return -1; return getDeviceVolume(getBluetoothContextualVolumeStream(), volume); } int getDeviceVolume(int streamType, int bleVolume) { int deviceMaxVolume = mAudioManager.getStreamMaxVolume(streamType); Loading android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -1431,7 +1431,7 @@ public class LeAudioServiceTest { //Add location support. injectAudioConfChanged(groupId, availableContexts); doReturn(-1).when(mVolumeControlService).getGroupVolume(groupId); doReturn(-1).when(mVolumeControlService).getAudioDeviceGroupVolume(groupId); //Set group and device as active. injectGroupStatusChange(groupId, LeAudioStackEvent.GROUP_STATUS_ACTIVE); Loading @@ -1448,7 +1448,7 @@ public class LeAudioServiceTest { verify(mAudioManager, times(1)).handleBluetoothActiveDeviceChanged(eq(null), any(), any(BluetoothProfileConnectionInfo.class)); doReturn(100).when(mVolumeControlService).getGroupVolume(groupId); doReturn(100).when(mVolumeControlService).getAudioDeviceGroupVolume(groupId); //Set back to active and check if last volume is restored. injectGroupStatusChange(groupId, LeAudioStackEvent.GROUP_STATUS_ACTIVE); Loading Loading
android/app/src/com/android/bluetooth/le_audio/LeAudioService.java +3 −3 Original line number Diff line number Diff line Loading @@ -415,7 +415,7 @@ public class LeAudioService extends ProfileService { sLeAudioService = instance; } private int getGroupVolume(int groupId) { private int getAudioDeviceGroupVolume(int groupId) { if (mVolumeControlService == null) { mVolumeControlService = mServiceFactory.getVolumeControlService(); if (mVolumeControlService == null) { Loading @@ -424,7 +424,7 @@ public class LeAudioService extends ProfileService { } } return mVolumeControlService.getGroupVolume(groupId); return mVolumeControlService.getAudioDeviceGroupVolume(groupId); } public boolean connect(BluetoothDevice device) { Loading Loading @@ -926,7 +926,7 @@ public class LeAudioService extends ProfileService { } int volume = IBluetoothVolumeControl.VOLUME_CONTROL_UNKNOWN_VOLUME; if (mActiveAudioOutDevice != null) { volume = getGroupVolume(groupId); volume = getAudioDeviceGroupVolume(groupId); } mAudioManager.handleBluetoothActiveDeviceChanged(mActiveAudioOutDevice, Loading
android/app/src/com/android/bluetooth/vc/VolumeControlService.java +14 −0 Original line number Diff line number Diff line Loading @@ -586,6 +586,11 @@ public class VolumeControlService extends ProfileService { * {@hide} */ public void setGroupVolume(int groupId, int volume) { if (volume < 0) { Log.w(TAG, "Tried to set invalid volume " + volume + ". Ignored."); return; } mGroupVolumeCache.put(groupId, volume); mVolumeControlNativeInterface.setGroupVolume(groupId, volume); } Loading Loading @@ -683,6 +688,15 @@ public class VolumeControlService extends ProfileService { } } /** * {@hide} */ public int getAudioDeviceGroupVolume(int groupId) { int volume = getGroupVolume(groupId); if (volume == IBluetoothVolumeControl.VOLUME_CONTROL_UNKNOWN_VOLUME) return -1; return getDeviceVolume(getBluetoothContextualVolumeStream(), volume); } int getDeviceVolume(int streamType, int bleVolume) { int deviceMaxVolume = mAudioManager.getStreamMaxVolume(streamType); Loading
android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -1431,7 +1431,7 @@ public class LeAudioServiceTest { //Add location support. injectAudioConfChanged(groupId, availableContexts); doReturn(-1).when(mVolumeControlService).getGroupVolume(groupId); doReturn(-1).when(mVolumeControlService).getAudioDeviceGroupVolume(groupId); //Set group and device as active. injectGroupStatusChange(groupId, LeAudioStackEvent.GROUP_STATUS_ACTIVE); Loading @@ -1448,7 +1448,7 @@ public class LeAudioServiceTest { verify(mAudioManager, times(1)).handleBluetoothActiveDeviceChanged(eq(null), any(), any(BluetoothProfileConnectionInfo.class)); doReturn(100).when(mVolumeControlService).getGroupVolume(groupId); doReturn(100).when(mVolumeControlService).getAudioDeviceGroupVolume(groupId); //Set back to active and check if last volume is restored. injectGroupStatusChange(groupId, LeAudioStackEvent.GROUP_STATUS_ACTIVE); Loading