Loading android/app/src/com/android/bluetooth/avrcp/AvrcpTargetService.java +11 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import com.android.bluetooth.Utils; import com.android.bluetooth.a2dp.A2dpService; import com.android.bluetooth.btservice.MetricsLogger; import com.android.bluetooth.btservice.ProfileService; import com.android.bluetooth.btservice.ServiceFactory; import java.util.List; import java.util.Objects; Loading @@ -55,6 +56,7 @@ public class AvrcpTargetService extends ProfileService { private AvrcpBroadcastReceiver mReceiver; private AvrcpNativeInterface mNativeInterface; private AvrcpVolumeManager mVolumeManager; private ServiceFactory mFactory = new ServiceFactory(); // Only used to see if the metadata has changed from its previous value private MediaData mCurrentData; Loading Loading @@ -227,6 +229,15 @@ public class AvrcpTargetService extends ProfileService { public void storeVolumeForDevice(BluetoothDevice device) { if (device == null) return; List<BluetoothDevice> HAActiveDevices = null; if (mFactory.getHearingAidService() != null) { HAActiveDevices = mFactory.getHearingAidService().getActiveDevices(); } if (HAActiveDevices != null && (HAActiveDevices.get(0) != null || HAActiveDevices.get(1) != null)) { Log.d(TAG, "Do not store volume when Hearing Aid devices is active"); return; } mVolumeManager.storeVolumeForDevice(device); } Loading android/app/src/com/android/bluetooth/hearingaid/HearingAidService.java +10 −13 Original line number Diff line number Diff line Loading @@ -505,6 +505,15 @@ public class HearingAidService extends ProfileService { Long deviceHiSyncId = mDeviceHiSyncIdMap.getOrDefault(device, BluetoothHearingAid.HI_SYNC_ID_INVALID); if (deviceHiSyncId != mActiveDeviceHiSyncId) { // Give an early notification to A2DP that active device is being switched // to Hearing Aids before the Audio Service. final A2dpService a2dpService = mFactory.getA2dpService(); if (a2dpService != null) { if (DBG) { Log.d(TAG, "earlyNotifyHearingAidActive for " + device); } a2dpService.earlyNotifyHearingAidActive(); } mActiveDeviceHiSyncId = deviceHiSyncId; reportActiveDevice(device); } Loading @@ -519,7 +528,7 @@ public class HearingAidService extends ProfileService { * device; the second element is the right active device. If either or both side * is not active, it will be null on that position */ List<BluetoothDevice> getActiveDevices() { public List<BluetoothDevice> getActiveDevices() { if (DBG) { Log.d(TAG, "getActiveDevices"); } Loading Loading @@ -625,18 +634,6 @@ public class HearingAidService extends ProfileService { StatsLog.write(StatsLog.BLUETOOTH_ACTIVE_DEVICE_CHANGED, BluetoothProfile.HEARING_AID, mAdapterService.obfuscateAddress(device)); if (device != null) { // Give an early notification to A2DP that active device is being switched // to Hearing Aids before the Audio Service. final A2dpService a2dpService = mFactory.getA2dpService(); if (a2dpService != null) { if (DBG) { Log.d(TAG, "earlyNotifyHearingAidActive for " + device); } a2dpService.earlyNotifyHearingAidActive(); } } Intent intent = new Intent(BluetoothHearingAid.ACTION_ACTIVE_DEVICE_CHANGED); intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT Loading Loading
android/app/src/com/android/bluetooth/avrcp/AvrcpTargetService.java +11 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import com.android.bluetooth.Utils; import com.android.bluetooth.a2dp.A2dpService; import com.android.bluetooth.btservice.MetricsLogger; import com.android.bluetooth.btservice.ProfileService; import com.android.bluetooth.btservice.ServiceFactory; import java.util.List; import java.util.Objects; Loading @@ -55,6 +56,7 @@ public class AvrcpTargetService extends ProfileService { private AvrcpBroadcastReceiver mReceiver; private AvrcpNativeInterface mNativeInterface; private AvrcpVolumeManager mVolumeManager; private ServiceFactory mFactory = new ServiceFactory(); // Only used to see if the metadata has changed from its previous value private MediaData mCurrentData; Loading Loading @@ -227,6 +229,15 @@ public class AvrcpTargetService extends ProfileService { public void storeVolumeForDevice(BluetoothDevice device) { if (device == null) return; List<BluetoothDevice> HAActiveDevices = null; if (mFactory.getHearingAidService() != null) { HAActiveDevices = mFactory.getHearingAidService().getActiveDevices(); } if (HAActiveDevices != null && (HAActiveDevices.get(0) != null || HAActiveDevices.get(1) != null)) { Log.d(TAG, "Do not store volume when Hearing Aid devices is active"); return; } mVolumeManager.storeVolumeForDevice(device); } Loading
android/app/src/com/android/bluetooth/hearingaid/HearingAidService.java +10 −13 Original line number Diff line number Diff line Loading @@ -505,6 +505,15 @@ public class HearingAidService extends ProfileService { Long deviceHiSyncId = mDeviceHiSyncIdMap.getOrDefault(device, BluetoothHearingAid.HI_SYNC_ID_INVALID); if (deviceHiSyncId != mActiveDeviceHiSyncId) { // Give an early notification to A2DP that active device is being switched // to Hearing Aids before the Audio Service. final A2dpService a2dpService = mFactory.getA2dpService(); if (a2dpService != null) { if (DBG) { Log.d(TAG, "earlyNotifyHearingAidActive for " + device); } a2dpService.earlyNotifyHearingAidActive(); } mActiveDeviceHiSyncId = deviceHiSyncId; reportActiveDevice(device); } Loading @@ -519,7 +528,7 @@ public class HearingAidService extends ProfileService { * device; the second element is the right active device. If either or both side * is not active, it will be null on that position */ List<BluetoothDevice> getActiveDevices() { public List<BluetoothDevice> getActiveDevices() { if (DBG) { Log.d(TAG, "getActiveDevices"); } Loading Loading @@ -625,18 +634,6 @@ public class HearingAidService extends ProfileService { StatsLog.write(StatsLog.BLUETOOTH_ACTIVE_DEVICE_CHANGED, BluetoothProfile.HEARING_AID, mAdapterService.obfuscateAddress(device)); if (device != null) { // Give an early notification to A2DP that active device is being switched // to Hearing Aids before the Audio Service. final A2dpService a2dpService = mFactory.getA2dpService(); if (a2dpService != null) { if (DBG) { Log.d(TAG, "earlyNotifyHearingAidActive for " + device); } a2dpService.earlyNotifyHearingAidActive(); } } Intent intent = new Intent(BluetoothHearingAid.ACTION_ACTIVE_DEVICE_CHANGED); intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT Loading