Loading TEST_MAPPING +0 −6 Original line number Diff line number Diff line Loading @@ -25,9 +25,6 @@ //{ // "name": "bluetooth-test-audio-hal-interface" //}, { "name": "net_test_audio_a2dp_hw" }, { "name": "net_test_audio_hearing_aid_hw" }, Loading Loading @@ -226,9 +223,6 @@ //{ // "name": "bluetooth-test-audio-hal-interface" //}, { "name": "net_test_audio_a2dp_hw" }, { "name": "net_test_audio_hearing_aid_hw" }, Loading android/app/Android.bp +0 −1 Original line number Diff line number Diff line Loading @@ -102,7 +102,6 @@ cc_library_shared { "lib-bt-packets-base", "libFraunhoferAAC", "libaconfig_storage_read_api_cc", "libaudio-a2dp-hw-utils", "libbase", "libbluetooth", "libbluetooth-dumpsys", Loading android/app/src/com/android/bluetooth/BluetoothMethodProxy.java +0 −9 Original line number Diff line number Diff line Loading @@ -44,9 +44,6 @@ import android.provider.Telephony; import android.util.Log; import com.android.bluetooth.bass_client.BassClientPeriodicAdvertisingManager; import com.android.bluetooth.gatt.AppAdvertiseStats; import com.android.bluetooth.gatt.ContextMap; import com.android.bluetooth.gatt.GattService; import com.android.internal.annotations.VisibleForTesting; import com.android.obex.HeaderSet; Loading Loading @@ -264,12 +261,6 @@ public class BluetoothMethodProxy { manager.transferSetInfo(bda, serviceData, advHandle, callback); } /** Proxies {@link AppAdvertiseStats}. */ public AppAdvertiseStats createAppAdvertiseStats( int appUid, int id, String name, ContextMap map, GattService service) { return new AppAdvertiseStats(appUid, id, name, map, service); } /** Proxies {@link Thread#start()}. */ public void threadStart(Thread thread) { thread.start(); Loading android/app/src/com/android/bluetooth/bass_client/BassClientService.java +78 −17 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static android.bluetooth.IBluetoothLeAudio.LE_AUDIO_GROUP_ID_INVALID; import static com.android.bluetooth.Utils.enforceBluetoothPrivilegedPermission; import static com.android.bluetooth.flags.Flags.leaudioAllowedContextMask; import static com.android.bluetooth.flags.Flags.leaudioBigDependsOnAudioState; import static com.android.bluetooth.flags.Flags.leaudioBroadcastAssistantPeripheralEntrustment; import static com.android.bluetooth.flags.Flags.leaudioBroadcastAudioHandoverPolicies; import static com.android.bluetooth.flags.Flags.leaudioBroadcastExtractPeriodicScannerFromStateMachine; Loading Loading @@ -1956,6 +1957,39 @@ public class BassClientService extends ProfileService { } } } if (leaudioBigDependsOnAudioState()) { BluetoothDevice srcDevice = getDeviceForSyncHandle(syncHandle); if (srcDevice == null) { log("No device found."); return; } PeriodicAdvertisementResult result = getPeriodicAdvertisementResult( srcDevice, getBroadcastIdForSyncHandle(syncHandle)); if (result == null) { log("No PA record found"); return; } BaseData baseData = getBase(syncHandle); if (baseData == null) { log("No BaseData found"); return; } PublicBroadcastData pbData = result.getPublicBroadcastData(); if (pbData == null) { log("No public broadcast data found, wait for BIG"); return; } if (!result.isNotified()) { result.setNotified(true); BluetoothLeBroadcastMetadata metaData = getBroadcastMetadataFromBaseData( baseData, srcDevice, syncHandle, pbData.isEncrypted()); log("Notify broadcast source found"); mCallbacks.notifySourceFound(metaData); } } } @Override Loading Loading @@ -2424,6 +2458,20 @@ public class BassClientService extends ProfileService { if (leaudioBroadcastAssistantPeripheralEntrustment()) { if (isLocalBroadcast(sourceMetadata)) { LeAudioService leAudioService = mServiceFactory.getLeAudioService(); if (leaudioBigDependsOnAudioState()) { if (leAudioService == null || !(leAudioService.isPaused(sourceMetadata.getBroadcastId()) || leAudioService.isPlaying(sourceMetadata.getBroadcastId()))) { Log.w(TAG, "addSource: Local source can't be add"); mCallbacks.notifySourceAddFailed( sink, sourceMetadata, BluetoothStatusCodes.ERROR_LOCAL_NOT_ENOUGH_RESOURCES); return; } } else { if (leAudioService == null || !leAudioService.isPlaying(sourceMetadata.getBroadcastId())) { Log.w(TAG, "addSource: Local source can't be add"); Loading @@ -2436,6 +2484,7 @@ public class BassClientService extends ProfileService { return; } } } } else { if (!isAllowedToAddSource()) { Log.d(TAG, "Add source to pending list"); Loading Loading @@ -2963,17 +3012,29 @@ public class BassClientService extends ProfileService { return; } for (Map.Entry<Integer, HashSet<BluetoothDevice>> entry : mLocalBroadcastReceivers.entrySet()) { Iterator<Map.Entry<Integer, HashSet<BluetoothDevice>>> iterator = mLocalBroadcastReceivers.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry<Integer, HashSet<BluetoothDevice>> entry = iterator.next(); Integer broadcastId = entry.getKey(); HashSet<BluetoothDevice> devices = entry.getValue(); if (leaudioBigDependsOnAudioState()) { /* If somehow there is a non configured/playing broadcast, let's remove it */ if (!(leAudioService.isPaused(broadcastId) || leAudioService.isPlaying(broadcastId))) { Log.w(TAG, "Non playing broadcast remove from receivers list"); iterator.remove(); continue; } } else { /* If somehow there is a non playing broadcast, let's remove it */ if (!leAudioService.isPlaying(broadcastId)) { Log.w(TAG, "Non playing broadcast remove from receivers list"); mLocalBroadcastReceivers.remove(broadcastId); iterator.remove(); continue; } } if (isIntentional) { /* Check if disconnecting device participated in this broadcast reception */ Loading @@ -2998,7 +3059,7 @@ public class BassClientService extends ProfileService { + "(broadcast ID: " + broadcastId + ") receivers - stopping broadcast"); mLocalBroadcastReceivers.remove(broadcastId); iterator.remove(); leAudioService.stopBroadcast(broadcastId); } else { /* Unintentional disconnection of primary device in private broadcast mode */ Loading @@ -3010,7 +3071,7 @@ public class BassClientService extends ProfileService { && (getConnectionState(d) == BluetoothProfile .STATE_CONNECTED))) { mLocalBroadcastReceivers.remove(broadcastId); iterator.remove(); leAudioService.stopBroadcast(broadcastId); continue; } Loading android/app/src/com/android/bluetooth/gatt/AdvertiseManager.java +16 −3 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ import android.os.RemoteException; import android.util.Log; import com.android.bluetooth.btservice.AdapterService; import com.android.bluetooth.gatt.GattService.AdvertiserMap; import com.android.internal.annotations.VisibleForTesting; import java.util.Collections; Loading @@ -53,7 +52,11 @@ public class AdvertiseManager { Map<IBinder, AdvertiserInfo> mAdvertisers = Collections.synchronizedMap(new HashMap<>()); static int sTempRegistrationId = -1; /** Constructor of {@link AdvertiseManager}. */ AdvertiseManager(GattService service) { this(service, AdvertiseManagerNativeInterface.getInstance(), new AdvertiserMap()); } @VisibleForTesting AdvertiseManager( GattService service, AdvertiseManagerNativeInterface nativeInterface, Loading @@ -70,6 +73,12 @@ public class AdvertiseManager { mHandler = new Handler(thread.getLooper()); } // TODO(b/327849650): We shouldn't need this, it should be safe to do in the cleanup method. But // it would be a logic change. void clear() { mAdvertiserMap.clear(); } void cleanup() { Log.d(TAG, "cleanup()"); mNativeInterface.cleanup(); Loading @@ -87,6 +96,10 @@ public class AdvertiseManager { } } void dump(StringBuilder sb) { mAdvertiserMap.dump(sb); } static class AdvertiserInfo { /* When id is negative, the registration is ongoing. When the registration finishes, id * becomes equal to advertiser_id */ Loading Loading @@ -263,7 +276,7 @@ public class AdvertiseManager { Log.d(TAG, "startAdvertisingSet() - reg_id=" + cbId + ", callback: " + binder); mAdvertiserMap.add(cbId, callback, mService); mAdvertiserMap.addAppAdvertiseStats(cbId, mService); mAdvertiserMap.recordAdvertiseStart( cbId, parameters, Loading Loading
TEST_MAPPING +0 −6 Original line number Diff line number Diff line Loading @@ -25,9 +25,6 @@ //{ // "name": "bluetooth-test-audio-hal-interface" //}, { "name": "net_test_audio_a2dp_hw" }, { "name": "net_test_audio_hearing_aid_hw" }, Loading Loading @@ -226,9 +223,6 @@ //{ // "name": "bluetooth-test-audio-hal-interface" //}, { "name": "net_test_audio_a2dp_hw" }, { "name": "net_test_audio_hearing_aid_hw" }, Loading
android/app/Android.bp +0 −1 Original line number Diff line number Diff line Loading @@ -102,7 +102,6 @@ cc_library_shared { "lib-bt-packets-base", "libFraunhoferAAC", "libaconfig_storage_read_api_cc", "libaudio-a2dp-hw-utils", "libbase", "libbluetooth", "libbluetooth-dumpsys", Loading
android/app/src/com/android/bluetooth/BluetoothMethodProxy.java +0 −9 Original line number Diff line number Diff line Loading @@ -44,9 +44,6 @@ import android.provider.Telephony; import android.util.Log; import com.android.bluetooth.bass_client.BassClientPeriodicAdvertisingManager; import com.android.bluetooth.gatt.AppAdvertiseStats; import com.android.bluetooth.gatt.ContextMap; import com.android.bluetooth.gatt.GattService; import com.android.internal.annotations.VisibleForTesting; import com.android.obex.HeaderSet; Loading Loading @@ -264,12 +261,6 @@ public class BluetoothMethodProxy { manager.transferSetInfo(bda, serviceData, advHandle, callback); } /** Proxies {@link AppAdvertiseStats}. */ public AppAdvertiseStats createAppAdvertiseStats( int appUid, int id, String name, ContextMap map, GattService service) { return new AppAdvertiseStats(appUid, id, name, map, service); } /** Proxies {@link Thread#start()}. */ public void threadStart(Thread thread) { thread.start(); Loading
android/app/src/com/android/bluetooth/bass_client/BassClientService.java +78 −17 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static android.bluetooth.IBluetoothLeAudio.LE_AUDIO_GROUP_ID_INVALID; import static com.android.bluetooth.Utils.enforceBluetoothPrivilegedPermission; import static com.android.bluetooth.flags.Flags.leaudioAllowedContextMask; import static com.android.bluetooth.flags.Flags.leaudioBigDependsOnAudioState; import static com.android.bluetooth.flags.Flags.leaudioBroadcastAssistantPeripheralEntrustment; import static com.android.bluetooth.flags.Flags.leaudioBroadcastAudioHandoverPolicies; import static com.android.bluetooth.flags.Flags.leaudioBroadcastExtractPeriodicScannerFromStateMachine; Loading Loading @@ -1956,6 +1957,39 @@ public class BassClientService extends ProfileService { } } } if (leaudioBigDependsOnAudioState()) { BluetoothDevice srcDevice = getDeviceForSyncHandle(syncHandle); if (srcDevice == null) { log("No device found."); return; } PeriodicAdvertisementResult result = getPeriodicAdvertisementResult( srcDevice, getBroadcastIdForSyncHandle(syncHandle)); if (result == null) { log("No PA record found"); return; } BaseData baseData = getBase(syncHandle); if (baseData == null) { log("No BaseData found"); return; } PublicBroadcastData pbData = result.getPublicBroadcastData(); if (pbData == null) { log("No public broadcast data found, wait for BIG"); return; } if (!result.isNotified()) { result.setNotified(true); BluetoothLeBroadcastMetadata metaData = getBroadcastMetadataFromBaseData( baseData, srcDevice, syncHandle, pbData.isEncrypted()); log("Notify broadcast source found"); mCallbacks.notifySourceFound(metaData); } } } @Override Loading Loading @@ -2424,6 +2458,20 @@ public class BassClientService extends ProfileService { if (leaudioBroadcastAssistantPeripheralEntrustment()) { if (isLocalBroadcast(sourceMetadata)) { LeAudioService leAudioService = mServiceFactory.getLeAudioService(); if (leaudioBigDependsOnAudioState()) { if (leAudioService == null || !(leAudioService.isPaused(sourceMetadata.getBroadcastId()) || leAudioService.isPlaying(sourceMetadata.getBroadcastId()))) { Log.w(TAG, "addSource: Local source can't be add"); mCallbacks.notifySourceAddFailed( sink, sourceMetadata, BluetoothStatusCodes.ERROR_LOCAL_NOT_ENOUGH_RESOURCES); return; } } else { if (leAudioService == null || !leAudioService.isPlaying(sourceMetadata.getBroadcastId())) { Log.w(TAG, "addSource: Local source can't be add"); Loading @@ -2436,6 +2484,7 @@ public class BassClientService extends ProfileService { return; } } } } else { if (!isAllowedToAddSource()) { Log.d(TAG, "Add source to pending list"); Loading Loading @@ -2963,17 +3012,29 @@ public class BassClientService extends ProfileService { return; } for (Map.Entry<Integer, HashSet<BluetoothDevice>> entry : mLocalBroadcastReceivers.entrySet()) { Iterator<Map.Entry<Integer, HashSet<BluetoothDevice>>> iterator = mLocalBroadcastReceivers.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry<Integer, HashSet<BluetoothDevice>> entry = iterator.next(); Integer broadcastId = entry.getKey(); HashSet<BluetoothDevice> devices = entry.getValue(); if (leaudioBigDependsOnAudioState()) { /* If somehow there is a non configured/playing broadcast, let's remove it */ if (!(leAudioService.isPaused(broadcastId) || leAudioService.isPlaying(broadcastId))) { Log.w(TAG, "Non playing broadcast remove from receivers list"); iterator.remove(); continue; } } else { /* If somehow there is a non playing broadcast, let's remove it */ if (!leAudioService.isPlaying(broadcastId)) { Log.w(TAG, "Non playing broadcast remove from receivers list"); mLocalBroadcastReceivers.remove(broadcastId); iterator.remove(); continue; } } if (isIntentional) { /* Check if disconnecting device participated in this broadcast reception */ Loading @@ -2998,7 +3059,7 @@ public class BassClientService extends ProfileService { + "(broadcast ID: " + broadcastId + ") receivers - stopping broadcast"); mLocalBroadcastReceivers.remove(broadcastId); iterator.remove(); leAudioService.stopBroadcast(broadcastId); } else { /* Unintentional disconnection of primary device in private broadcast mode */ Loading @@ -3010,7 +3071,7 @@ public class BassClientService extends ProfileService { && (getConnectionState(d) == BluetoothProfile .STATE_CONNECTED))) { mLocalBroadcastReceivers.remove(broadcastId); iterator.remove(); leAudioService.stopBroadcast(broadcastId); continue; } Loading
android/app/src/com/android/bluetooth/gatt/AdvertiseManager.java +16 −3 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ import android.os.RemoteException; import android.util.Log; import com.android.bluetooth.btservice.AdapterService; import com.android.bluetooth.gatt.GattService.AdvertiserMap; import com.android.internal.annotations.VisibleForTesting; import java.util.Collections; Loading @@ -53,7 +52,11 @@ public class AdvertiseManager { Map<IBinder, AdvertiserInfo> mAdvertisers = Collections.synchronizedMap(new HashMap<>()); static int sTempRegistrationId = -1; /** Constructor of {@link AdvertiseManager}. */ AdvertiseManager(GattService service) { this(service, AdvertiseManagerNativeInterface.getInstance(), new AdvertiserMap()); } @VisibleForTesting AdvertiseManager( GattService service, AdvertiseManagerNativeInterface nativeInterface, Loading @@ -70,6 +73,12 @@ public class AdvertiseManager { mHandler = new Handler(thread.getLooper()); } // TODO(b/327849650): We shouldn't need this, it should be safe to do in the cleanup method. But // it would be a logic change. void clear() { mAdvertiserMap.clear(); } void cleanup() { Log.d(TAG, "cleanup()"); mNativeInterface.cleanup(); Loading @@ -87,6 +96,10 @@ public class AdvertiseManager { } } void dump(StringBuilder sb) { mAdvertiserMap.dump(sb); } static class AdvertiserInfo { /* When id is negative, the registration is ongoing. When the registration finishes, id * becomes equal to advertiser_id */ Loading Loading @@ -263,7 +276,7 @@ public class AdvertiseManager { Log.d(TAG, "startAdvertisingSet() - reg_id=" + cbId + ", callback: " + binder); mAdvertiserMap.add(cbId, callback, mService); mAdvertiserMap.addAppAdvertiseStats(cbId, mService); mAdvertiserMap.recordAdvertiseStart( cbId, parameters, Loading