Loading android/app/src/com/android/bluetooth/le_audio/LeAudioService.java +3 −69 Original line number Diff line number Diff line Loading @@ -133,36 +133,6 @@ public class LeAudioService extends ProfileService { private BroadcastReceiver mBondStateChangedReceiver; private BroadcastReceiver mConnectionStateChangedReceiver; private volatile IBluetoothVolumeControl mVolumeControlProxy; VolumeControlService mVolumeControlService = null; private final ServiceConnection mVolumeControlProxyConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName className, IBinder service) { if (DBG) { Log.d(TAG, "mVolumeControlProxyConnection connected"); } synchronized (LeAudioService.this) { mVolumeControlProxy = IBluetoothVolumeControl.Stub.asInterface(service); mVolumeControlService = VolumeControlService.getVolumeControlService(); if (mVolumeControlService == null) { Log.e(TAG, "VolumeControlService is null when LeAudioService starts"); } } } @Override public void onServiceDisconnected(ComponentName className) { if (DBG) { Log.d(TAG, "mVolumeControlProxy disconnected"); } synchronized (LeAudioService.this) { mVolumeControlProxy = null; } } }; @Override protected IProfileServiceBinder initBinder() { return new BluetoothLeAudioBinder(this); Loading Loading @@ -209,10 +179,6 @@ public class LeAudioService extends ProfileService { mConnectionStateChangedReceiver = new ConnectionStateChangedReceiver(); registerReceiver(mConnectionStateChangedReceiver, filter); /* Bind Volume control service */ bindVolumeControlService(); // Mark service as started setLeAudioService(this); Loading Loading @@ -280,7 +246,6 @@ public class LeAudioService extends ProfileService { mAdapterService = null; mAudioManager = null; unbindVolumeControlService(); return true; } Loading Loading @@ -308,30 +273,6 @@ public class LeAudioService extends ProfileService { sLeAudioService = instance; } private void bindVolumeControlService() { synchronized (mVolumeControlProxyConnection) { Intent intent = new Intent(IBluetoothVolumeControl.class.getName()); ComponentName comp = intent.resolveSystemService(getPackageManager(), 0); intent.setComponent(comp); if (comp == null || !bindService(intent, mVolumeControlProxyConnection, 0)) { Log.wtf(TAG, "Could not bind to IBluetoothVolumeControl Service with " + intent); } } } private void unbindVolumeControlService() { synchronized (mVolumeControlProxyConnection) { if (mVolumeControlProxy != null) { if (DBG) { Log.d(TAG, "Unbinding mVolumeControlProxyConnection"); } mVolumeControlProxy = null; // Synchronization should make sure unbind can be successful unbindService(mVolumeControlProxyConnection); } } } public boolean connect(BluetoothDevice device) { if (DBG) { Log.d(TAG, "connect(): " + device); Loading Loading @@ -1278,16 +1219,9 @@ public class LeAudioService extends ProfileService { return; } if (mVolumeControlService == null) { Log.e(TAG, "VolumeControl no available "); return; } try { mVolumeControlProxy.setVolumeGroup(mActiveDeviceGroupId, volume, this.getAttributionSource()); } catch (RemoteException e) { Log.e(TAG, "Set Volume failed: " + e); VolumeControlService service = mServiceFactory.getVolumeControlService(); if (service != null) { service.setVolumeGroup(mActiveDeviceGroupId, volume); } } Loading android/app/src/com/android/bluetooth/vc/VolumeControlService.java +4 −1 Original line number Diff line number Diff line Loading @@ -413,7 +413,10 @@ public class VolumeControlService extends ProfileService { mVolumeControlNativeInterface.setVolume(device, volume); } void setVolumeGroup(int groupId, int volume) { /** * {@hide} */ public void setVolumeGroup(int groupId, int volume) { mVolumeControlNativeInterface.setVolumeGroup(groupId, volume); } Loading Loading
android/app/src/com/android/bluetooth/le_audio/LeAudioService.java +3 −69 Original line number Diff line number Diff line Loading @@ -133,36 +133,6 @@ public class LeAudioService extends ProfileService { private BroadcastReceiver mBondStateChangedReceiver; private BroadcastReceiver mConnectionStateChangedReceiver; private volatile IBluetoothVolumeControl mVolumeControlProxy; VolumeControlService mVolumeControlService = null; private final ServiceConnection mVolumeControlProxyConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName className, IBinder service) { if (DBG) { Log.d(TAG, "mVolumeControlProxyConnection connected"); } synchronized (LeAudioService.this) { mVolumeControlProxy = IBluetoothVolumeControl.Stub.asInterface(service); mVolumeControlService = VolumeControlService.getVolumeControlService(); if (mVolumeControlService == null) { Log.e(TAG, "VolumeControlService is null when LeAudioService starts"); } } } @Override public void onServiceDisconnected(ComponentName className) { if (DBG) { Log.d(TAG, "mVolumeControlProxy disconnected"); } synchronized (LeAudioService.this) { mVolumeControlProxy = null; } } }; @Override protected IProfileServiceBinder initBinder() { return new BluetoothLeAudioBinder(this); Loading Loading @@ -209,10 +179,6 @@ public class LeAudioService extends ProfileService { mConnectionStateChangedReceiver = new ConnectionStateChangedReceiver(); registerReceiver(mConnectionStateChangedReceiver, filter); /* Bind Volume control service */ bindVolumeControlService(); // Mark service as started setLeAudioService(this); Loading Loading @@ -280,7 +246,6 @@ public class LeAudioService extends ProfileService { mAdapterService = null; mAudioManager = null; unbindVolumeControlService(); return true; } Loading Loading @@ -308,30 +273,6 @@ public class LeAudioService extends ProfileService { sLeAudioService = instance; } private void bindVolumeControlService() { synchronized (mVolumeControlProxyConnection) { Intent intent = new Intent(IBluetoothVolumeControl.class.getName()); ComponentName comp = intent.resolveSystemService(getPackageManager(), 0); intent.setComponent(comp); if (comp == null || !bindService(intent, mVolumeControlProxyConnection, 0)) { Log.wtf(TAG, "Could not bind to IBluetoothVolumeControl Service with " + intent); } } } private void unbindVolumeControlService() { synchronized (mVolumeControlProxyConnection) { if (mVolumeControlProxy != null) { if (DBG) { Log.d(TAG, "Unbinding mVolumeControlProxyConnection"); } mVolumeControlProxy = null; // Synchronization should make sure unbind can be successful unbindService(mVolumeControlProxyConnection); } } } public boolean connect(BluetoothDevice device) { if (DBG) { Log.d(TAG, "connect(): " + device); Loading Loading @@ -1278,16 +1219,9 @@ public class LeAudioService extends ProfileService { return; } if (mVolumeControlService == null) { Log.e(TAG, "VolumeControl no available "); return; } try { mVolumeControlProxy.setVolumeGroup(mActiveDeviceGroupId, volume, this.getAttributionSource()); } catch (RemoteException e) { Log.e(TAG, "Set Volume failed: " + e); VolumeControlService service = mServiceFactory.getVolumeControlService(); if (service != null) { service.setVolumeGroup(mActiveDeviceGroupId, volume); } } Loading
android/app/src/com/android/bluetooth/vc/VolumeControlService.java +4 −1 Original line number Diff line number Diff line Loading @@ -413,7 +413,10 @@ public class VolumeControlService extends ProfileService { mVolumeControlNativeInterface.setVolume(device, volume); } void setVolumeGroup(int groupId, int volume) { /** * {@hide} */ public void setVolumeGroup(int groupId, int volume) { mVolumeControlNativeInterface.setVolumeGroup(groupId, volume); } Loading