summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--OWNERS23
-rw-r--r--OWNERS_automotive3
-rw-r--r--OWNERS_build1
-rw-r--r--OWNERS_channel_sounding9
-rw-r--r--OWNERS_chromeos22
-rw-r--r--OWNERS_content2
-rw-r--r--OWNERS_cs2
-rw-r--r--OWNERS_hearingaid1
-rw-r--r--OWNERS_leaudio3
-rw-r--r--TEST_MAPPING6
-rw-r--r--android/BluetoothLegacyMigration/OWNERS5
-rw-r--r--android/ChannelSoundingTestApp/OWNERS1
-rw-r--r--android/apishim/OWNERS6
-rw-r--r--android/app/OWNERS15
-rw-r--r--android/app/jni/OWNERS4
-rw-r--r--android/app/res/values-as/strings.xml8
-rw-r--r--android/app/src/com/android/bluetooth/BluetoothObexTransport.java6
-rw-r--r--android/app/src/com/android/bluetooth/a2dp/A2dpNativeInterface.java15
-rw-r--r--android/app/src/com/android/bluetooth/a2dp/A2dpService.java1
-rw-r--r--android/app/src/com/android/bluetooth/a2dpsink/A2dpSinkNativeInterface.java15
-rw-r--r--android/app/src/com/android/bluetooth/a2dpsink/OWNERS1
-rw-r--r--android/app/src/com/android/bluetooth/avrcp/AvrcpNativeInterface.java16
-rw-r--r--android/app/src/com/android/bluetooth/avrcpcontroller/OWNERS1
-rw-r--r--android/app/src/com/android/bluetooth/bass_client/OWNERS1
-rw-r--r--android/app/src/com/android/bluetooth/btservice/AdapterProperties.java16
-rw-r--r--android/app/src/com/android/bluetooth/btservice/AdapterService.java38
-rw-r--r--android/app/src/com/android/bluetooth/btservice/BluetoothSocketManagerBinder.java11
-rw-r--r--android/app/src/com/android/bluetooth/content_profiles/OWNERS1
-rw-r--r--android/app/src/com/android/bluetooth/csip/OWNERS1
-rw-r--r--android/app/src/com/android/bluetooth/gatt/GattService.java22
-rw-r--r--android/app/src/com/android/bluetooth/hearingaid/OWNERS1
-rw-r--r--android/app/src/com/android/bluetooth/hfp/HeadsetNativeInterface.java9
-rw-r--r--android/app/src/com/android/bluetooth/hfp/HeadsetService.java11
-rw-r--r--android/app/src/com/android/bluetooth/hfp/HeadsetStateMachine.java9
-rw-r--r--android/app/src/com/android/bluetooth/hfpclient/NativeInterface.java9
-rw-r--r--android/app/src/com/android/bluetooth/hfpclient/OWNERS1
-rw-r--r--android/app/src/com/android/bluetooth/hid/HidDeviceNativeInterface.java11
-rw-r--r--android/app/src/com/android/bluetooth/hid/HidHostService.java16
-rw-r--r--android/app/src/com/android/bluetooth/le_audio/LeAudioService.java10
-rw-r--r--android/app/src/com/android/bluetooth/le_audio/OWNERS1
-rw-r--r--android/app/src/com/android/bluetooth/map/OWNERS1
-rw-r--r--android/app/src/com/android/bluetooth/mapclient/OWNERS2
-rw-r--r--android/app/src/com/android/bluetooth/mcp/MediaControlProfile.java4
-rw-r--r--android/app/src/com/android/bluetooth/mcp/OWNERS1
-rw-r--r--android/app/src/com/android/bluetooth/opp/BluetoothOppHandoverReceiver.java6
-rw-r--r--android/app/src/com/android/bluetooth/opp/BluetoothOppManager.java13
-rw-r--r--android/app/src/com/android/bluetooth/opp/BluetoothOppPreference.java23
-rw-r--r--android/app/src/com/android/bluetooth/opp/BluetoothOppReceiver.java5
-rw-r--r--android/app/src/com/android/bluetooth/opp/BluetoothOppService.java6
-rw-r--r--android/app/src/com/android/bluetooth/opp/BluetoothOppTransfer.java18
-rw-r--r--android/app/src/com/android/bluetooth/opp/OWNERS1
-rw-r--r--android/app/src/com/android/bluetooth/pan/OWNERS1
-rw-r--r--android/app/src/com/android/bluetooth/pan/PanService.java18
-rw-r--r--android/app/src/com/android/bluetooth/pbap/OWNERS1
-rw-r--r--android/app/src/com/android/bluetooth/pbapclient/OWNERS2
-rw-r--r--android/app/src/com/android/bluetooth/sap/OWNERS1
-rw-r--r--android/app/src/com/android/bluetooth/sdp/SdpManager.java25
-rw-r--r--android/app/src/com/android/bluetooth/vc/OWNERS1
-rw-r--r--android/app/tests/OWNERS1
-rw-r--r--android/app/tests/instrumentation/com/android/bluetooth/btservice/AdapterServiceTest.java1
-rw-r--r--android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppBtEnableActivityTest.java1
-rw-r--r--android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppBtEnablingActivityTest.java1
-rw-r--r--android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppLauncherActivityTest.java1
-rw-r--r--android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppServiceCleanupTest.java1
-rw-r--r--android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppUtilityTest.java1
-rw-r--r--android/app/tests/instrumentation/com/android/bluetooth/opp/IncomingFileConfirmActivityTest.java1
-rw-r--r--android/app/tests/instrumentation/com/android/bluetooth/pbap/BluetoothPbapActivityTest.java1
-rw-r--r--android/app/tests/instrumentation/com/android/bluetooth/telephony/CallInfoTest.java1
-rw-r--r--android/app/tests/unit/Android.bp2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/OWNERS2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/ObexAppParametersTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/SignedLongLongTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpCodecConfigTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpServiceBinderTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpServiceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpStateMachineTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/a2dpsink/A2dpSinkServiceBinderTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/a2dpsink/A2dpSinkServiceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/a2dpsink/A2dpSinkStateMachineTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/a2dpsink/A2dpSinkStreamHandlerTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/a2dpsink/StackEventTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/audio_util/BrowsablePlayerConnectorTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/audio_util/BrowserPlayerWrapperTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/audio_util/GPMWrapperTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/audio_util/ImageTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/audio_util/MediaPlayerListTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/audio_util/MediaPlayerWrapperTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/audio_util/MetadataTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpBipObexServerTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpCoverArtStorageTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpPassthroughTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpTargetServiceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpVolumeManagerTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcp/CoverArtTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpBipClientTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerNativeInterfaceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerServiceBinderTest.java14
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerServiceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachineTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpCoverArtProviderTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpCoverArtStorageTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpItemTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpPlayerTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/BrowseNodeTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/BrowseTreeTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/PlayerApplicationSettingsTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/StackEventTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipAttachmentFormatTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipDatetimeTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipEncodingTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipImageDescriptorTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipImageFormatTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipImagePropertiesTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipImageTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipPixelTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipTransformationTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/RequestGetImagePropertiesTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/RequestGetImageTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/bas/BatteryServiceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/bas/BatteryStateMachineTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/bass_client/BaseDataTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/bass_client/BassClientServiceBinderTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/bass_client/BassClientServiceTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/bass_client/BassClientStateMachineTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/bass_client/OWNERS1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/bass_client/PeriodicAdvertisementResultTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/bass_client/PublicBroadcastDataTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/btservice/ActiveDeviceManagerTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterPropertiesTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterServiceBinderTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterServiceTest.java7
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterSuspendTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/btservice/BondStateMachineTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/btservice/CompanionManagerTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/btservice/ConfigTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/btservice/DataMigrationTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/btservice/MetricsLoggerTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/btservice/PhonePolicyTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/btservice/ProfileServiceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/btservice/RemoteDevicesTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/btservice/SilenceDeviceManagerTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/btservice/bluetoothKeystore/BluetoothKeystoreServiceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/btservice/storage/AudioPolicyEntityTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/btservice/storage/DatabaseManagerTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/content_profiles/ContentProfileErrorReportUtilsTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/content_profiles/OWNERS1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/csip/CsipSetCoordinatorServiceBinderTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/csip/CsipSetCoordinatorServiceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/csip/CsipSetCoordinatorStateMachineTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/csip/OWNERS1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/gatt/AdvertiseBinderTest.kt2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/gatt/DistanceMeasurementBinderTest.kt2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/gatt/GattServiceBinderTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/gatt/GattServiceTest.java4
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hap/HapClientNativeCallbackTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hap/HapClientServiceBinderTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hap/HapClientServiceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hap/HapClientStackEventTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hap/HapClientStateMachineTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hearingaid/HearingAidNativeInterfaceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hearingaid/HearingAidServiceBinderTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hearingaid/HearingAidServiceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hearingaid/HearingAidStateMachineTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hearingaid/OWNERS1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hfp/AtPhonebookTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetAgIndicatorEnableStateTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetClccResponseTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetPhoneStateTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetServiceAndStateMachineTest.java42
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetServiceBinderTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetServiceTest.java4
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetStackEventTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetStateMachineTest.java50
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetVendorSpecificResultCodeTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hfpclient/HeadsetClientServiceBinderTest.java56
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hfpclient/HeadsetClientServiceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachineTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hfpclient/HfpNativeInterfaceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hfpclient/StackEventTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hfpclient/VendorCommandResponseProcessorTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hfpclient/connserv/HeadsetClientServiceInterfaceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hfpclient/connserv/HfpClientCallTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hfpclient/connserv/HfpClientConnectionServiceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hfpclient/connserv/HfpClientConnectionTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hfpclient/connserv/HfpClientDeviceBlockTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hid/HidDeviceNativeInterfaceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hid/HidDeviceServiceBinderTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hid/HidDeviceServiceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hid/HidHostServiceBinderTest.java36
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/hid/HidHostServiceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/le_audio/ContentControlIdKeeperTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioBroadcastServiceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioBroadcasterNativeInterfaceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioNativeInterfaceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceBinderTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceTest.java8
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioStateMachineTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioTmapGattServerTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/le_audio/OWNERS1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/le_scan/MsftAdvMonitorTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/le_scan/ScanBinderTest.kt2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/le_scan/ScanClientTest.kt90
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/le_scan/ScanControllerTest.java540
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapAccountItemTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapAppParamsTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapContentObserverTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapContentTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapConvoContactElementTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapConvoListingElementTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapConvoListingTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapFolderElementTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapMasInstanceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapMessageListingElementTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapMessageListingTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapObexServerTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapServiceBinderTest.java22
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapServiceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapSmsPduTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapUtilsTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapbMessageEmailTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapbMessageMimeTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapbMessageSmsTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapbMessageTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapbMessageVCardTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/map/ConvoContactInfoTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/map/EventTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/map/FilterInfoTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/map/MapContactTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/map/MsgTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/map/OWNERS1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/map/SmsMmsContactsTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/mapapi/BluetoothMapContractTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/mapapi/BluetoothMapEmailProviderTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/mapapi/BluetoothMapIMProviderTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/mapapi/OWNERS1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/mapclient/BmessageTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/mapclient/EventReportTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/mapclient/MapClientContentTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/mapclient/MapClientServiceBinderTest.java20
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/mapclient/MapClientServiceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/mapclient/MapClientStateMachineTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/mapclient/MessageTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/mapclient/MessagesFilterTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/mapclient/MessagesListingTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/mapclient/MnsObexServerTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/mapclient/OWNERS1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/mapclient/ObexTimeTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/mcp/McpServiceBinderTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/mcp/McpServiceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/mcp/MediaControlGattServiceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/mcp/MediaControlProfileTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/mcp/OWNERS1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/obex/OWNERS1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppBatchTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppHandoverReceiverTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppManagerTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppNotificationTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppObexClientSessionTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppObexServerSessionTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppPreferenceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppReceiveFileInfoTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppReceiverTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppSendFileInfoTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppServiceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppShareInfoTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppTransferActivityTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppTransferHistoryTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppTransferTest.java3
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppUtilityTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/opp/OWNERS1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pan/OWNERS1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pan/PanServiceBinderTest.java18
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pan/PanServiceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapAuthenticatorTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapCallLogComposerTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapConfigTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapObexServerTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapServiceBinderTest.java14
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapServiceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapSimVcardManagerTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapUtilsTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapVcardManagerNestedClassesTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapVcardManagerTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbap/HandlerForStringBufferTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbap/OWNERS1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbap/PbapStateMachineTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbapclient/OWNERS1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapApplicationParametersTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientAccountAuthenticatorServiceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientAccountAuthenticatorTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientAccountManagerTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientConnectionHandlerTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientContactsStorageTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientObexAuthenticatorTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientObexClientTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientObexTransportTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientServiceBinderTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientServiceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientSocketTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientStateMachineOldTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientStateMachineTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapPhonebookMetadataTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapPhonebookTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapSdpRecordTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbapclient/PhonebookPullRequestTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbapclient/RequestPullPhonebookMetadataTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbapclient/RequestPullPhonebookTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/sap/OWNERS1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/sap/SapMessageTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/sap/SapRilReceiverHidlTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/sap/SapRilReceiverTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/sap/SapServerTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/sap/SapServiceBinderTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/sap/SapServiceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/tbs/TbsGattTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/tbs/TbsGenericTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/tbs/TbsServiceBinderTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/telephony/BluetoothCallTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/vc/OWNERS1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/vc/VolumeControlInputDescriptorTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/vc/VolumeControlNativeCallbackTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/vc/VolumeControlOffsetDescriptorTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/vc/VolumeControlServiceBinderTest.java2
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/vc/VolumeControlServiceTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/vc/VolumeControlStateMachineTest.java1
-rw-r--r--android/leaudio/OWNERS1
-rw-r--r--android/pandora/OWNERS2
-rw-r--r--android/pandora/mmi2grpc/mmi2grpc/_audio.py2
-rw-r--r--android/pandora/mmi2grpc/mmi2grpc/hap.py7
-rw-r--r--android/pandora/server/configs/PtsBotTest.xml1
-rw-r--r--android/pandora/server/src/Hap.kt66
-rw-r--r--android/pandora/server/src/LeAudio.kt96
-rw-r--r--android/pandora/server/src/Pan.kt1
-rw-r--r--android/pandora/test/pairing/OWNERS2
-rw-r--r--apex/OWNERS4
-rw-r--r--apex/hiddenapi/OWNERS5
-rw-r--r--apex/permissions/OWNERS1
-rwxr-xr-xbuild.py1
-rw-r--r--common/OWNERS1
-rw-r--r--flags/Android.bp1
-rw-r--r--flags/BUILD.gn1
-rw-r--r--flags/OWNERS3
-rw-r--r--flags/a2dp.aconfig10
-rw-r--r--flags/adapter.aconfig10
-rw-r--r--flags/bta_dm.aconfig10
-rw-r--r--flags/connectivity.aconfig24
-rw-r--r--flags/framework.aconfig10
-rw-r--r--flags/gap.aconfig74
-rw-r--r--flags/hfp.aconfig20
-rw-r--r--flags/hid.aconfig30
-rw-r--r--flags/leaudio.aconfig57
-rw-r--r--flags/mcp.aconfig13
-rw-r--r--flags/opp.aconfig10
-rw-r--r--flags/pairing.aconfig10
-rw-r--r--floss/OWNERS1
-rw-r--r--floss/pandora/OWNERS4
-rw-r--r--framework/OWNERS4
-rw-r--r--framework/java/android/bluetooth/BluetoothAdapter.java6
-rw-r--r--framework/java/android/bluetooth/OWNERS5
-rw-r--r--framework/tests/bumble/src/android/bluetooth/DckScanTest.kt2
-rw-r--r--framework/tests/bumble/src/android/bluetooth/GattClientTest.java8
-rw-r--r--framework/tests/bumble/src/android/bluetooth/hid/HidHeadTrackerTest.java9
-rw-r--r--framework/tests/bumble/src/android/bluetooth/hid/HidHostDualModeTest.java6
-rw-r--r--framework/tests/bumble/src/android/bluetooth/hid/OWNERS3
-rw-r--r--framework/tests/bumble/src/android/bluetooth/pairing/OWNERS3
-rw-r--r--framework/tests/bumble/src/android/bluetooth/pairing/PairingTest.java101
-rw-r--r--framework/tests/bumble/src/android/bluetooth/service_discovery/OWNERS3
-rw-r--r--framework/tests/bumble/src/android/bluetooth/sockets/OWNERS3
-rw-r--r--framework/tests/metrics/OWNERS3
-rw-r--r--framework/tests/unit/src/android/bluetooth/BluetoothCodecConfigTest.java2
-rw-r--r--framework/tests/unit/src/android/bluetooth/BluetoothCodecStatusTest.java2
-rw-r--r--framework/tests/unit/src/android/bluetooth/BluetoothLeAudioCodecConfigTest.java2
-rw-r--r--framework/tests/unit/src/android/bluetooth/BluetoothUuidTest.java2
-rw-r--r--framework/tests/unit/src/android/bluetooth/le/ScanFilterTest.java2
-rw-r--r--framework/tests/unit/src/android/bluetooth/le/ScanRecordTest.java2
-rw-r--r--framework/tests/unit/src/android/bluetooth/le/ScanSettingsTest.java2
-rw-r--r--framework/tests/util/src/BlockingBluetoothAdapter.kt13
-rw-r--r--pandora/OWNERS2
-rw-r--r--pandora/interfaces/pandora_experimental/hap.proto12
-rw-r--r--pandora/interfaces/pandora_experimental/le_audio.proto25
-rw-r--r--service/OWNERS1
-rw-r--r--service/src/com/android/server/bluetooth/BluetoothManagerService.java30
-rw-r--r--service/tests/src/com/android/server/bluetooth/BluetoothManagerServiceTest.java29
-rw-r--r--sysprop/OWNERS1
-rw-r--r--system/BUILD.gn1
-rw-r--r--system/OWNERS18
-rw-r--r--system/bta/Android.bp68
-rw-r--r--system/bta/dm/bta_dm_act.cc2
-rw-r--r--system/bta/dm/bta_dm_disc.cc9
-rw-r--r--system/bta/dm/bta_dm_int.h4
-rw-r--r--system/bta/gatt/bta_gattc_act.cc272
-rw-r--r--system/bta/gatt/bta_gattc_utils.cc266
-rw-r--r--system/bta/hearing_aid/OWNERS1
-rw-r--r--system/bta/hearing_aid/hearing_aid_test.cc474
-rw-r--r--system/bta/hh/bta_hh_le.cc72
-rw-r--r--system/bta/include/OWNERS1
-rw-r--r--system/bta/le_audio/OWNERS1
-rw-r--r--system/bta/le_audio/client.cc27
-rw-r--r--system/bta/le_audio/codec_manager.cc7
-rw-r--r--system/bta/le_audio/codec_manager_test.cc4
-rw-r--r--system/bta/le_audio/device_groups.cc24
-rw-r--r--system/bta/le_audio/le_audio_client_test.cc472
-rw-r--r--system/bta/le_audio/metrics_collector.cc6
-rw-r--r--system/bta/le_audio/metrics_collector_test.cc10
-rw-r--r--system/bta/le_audio/state_machine.cc14
-rw-r--r--system/bta/test/common/btif_storage_mock.cc15
-rw-r--r--system/bta/test/common/btif_storage_mock.h12
-rw-r--r--system/btcore/Android.bp40
-rw-r--r--system/btcore/BUILD.gn34
-rw-r--r--system/btcore/fuzzer/Android.bp97
-rw-r--r--system/btcore/fuzzer/README.md56
-rw-r--r--system/btcore/fuzzer/btcore_device_class_fuzzer.cpp70
-rw-r--r--system/btcore/fuzzer/btcore_module_fuzzer.cpp48
-rw-r--r--system/btcore/fuzzer/btcore_property_fuzzer.cpp96
-rw-r--r--system/btcore/include/device_class.h95
-rw-r--r--system/btcore/include/device_features.h27
-rw-r--r--system/btcore/include/event_mask.h28
-rw-r--r--system/btcore/include/iac.h28
-rw-r--r--system/btcore/include/property.h76
-rw-r--r--system/btcore/include/version.h29
-rw-r--r--system/btcore/src/device_class.cc167
-rw-r--r--system/btcore/src/property.cc217
-rw-r--r--system/btcore/test/device_class_test.cc224
-rw-r--r--system/btcore/test/property_test.cc269
-rw-r--r--system/btif/src/OWNERS1
-rw-r--r--system/btif/src/btif_a2dp_source.cc8
-rw-r--r--system/btif/src/btif_dm.cc10
-rw-r--r--system/btif/src/btif_hh.cc4
-rw-r--r--system/common/Android.bp11
-rw-r--r--system/common/BUILD.gn2
-rw-r--r--system/common/metrics.cc94
-rw-r--r--system/common/metrics.h66
-rw-r--r--system/common/metrics_linux.cc47
-rw-r--r--system/gd/Android.bp2
-rw-r--r--system/gd/common/audit_log.cc6
-rw-r--r--system/gd/hal/BUILD.gn5
-rw-r--r--system/gd/hal/snoop_logger.cc14
-rw-r--r--system/gd/hal/snoop_logger.h10
-rw-r--r--system/gd/hci/acl_manager.cc10
-rw-r--r--system/gd/hci/acl_manager.h6
-rw-r--r--system/gd/hci/acl_manager/le_impl.h34
-rw-r--r--system/gd/hci/acl_manager/le_impl_test.cc326
-rw-r--r--system/gd/metrics/BUILD.gn5
-rw-r--r--system/gd/metrics/chromeos/OWNERS1
-rw-r--r--system/gd/metrics/counter_metrics.h9
-rw-r--r--system/gd/metrics/linux/OWNERS1
-rw-r--r--system/gd/os/android/metrics.cc56
-rw-r--r--system/gd/os/chromeos/metrics.cc14
-rw-r--r--system/gd/os/host/metrics.cc14
-rw-r--r--system/gd/os/linux/metrics.cc15
-rw-r--r--system/gd/os/metrics.h17
-rw-r--r--system/gd/rust/linux/OWNERS1
-rw-r--r--system/gd/rust/topshim/OWNERS1
-rw-r--r--system/gd/storage/storage_module.cc7
-rw-r--r--system/log/OWNERS1
-rw-r--r--system/main/shim/acl.cc11
-rw-r--r--system/main/shim/acl.h2
-rw-r--r--system/main/shim/acl_api.cc6
-rw-r--r--system/main/shim/acl_api.h2
-rw-r--r--system/main/shim/stack.cc33
-rw-r--r--system/stack/acl/btm_acl.cc8
-rw-r--r--system/stack/btm/btm_ble_sec.cc12
-rw-r--r--system/stack/btm/btm_dev.cc6
-rw-r--r--system/stack/btm/btm_sec.cc16
-rw-r--r--system/stack/btm/security_event_parser.cc7
-rw-r--r--system/stack/btu/btu_hcif.cc38
-rw-r--r--system/stack/eatt/eatt_impl.h6
-rw-r--r--system/stack/gatt/gatt_api.cc82
-rw-r--r--system/stack/gatt/gatt_auth.cc15
-rw-r--r--system/stack/gatt/gatt_cl.cc49
-rw-r--r--system/stack/gatt/gatt_main.cc119
-rw-r--r--system/stack/gatt/gatt_sr.cc46
-rw-r--r--system/stack/gatt/gatt_utils.cc192
-rw-r--r--system/stack/include/l2cap_interface.h15
-rw-r--r--system/stack/l2cap/internal/l2c_api.h14
-rw-r--r--system/stack/l2cap/l2c_api.h2
-rw-r--r--system/stack/l2cap/l2c_ble_conn_params.cc20
-rw-r--r--system/stack/l2cap/l2cap_api.cc7
-rw-r--r--system/stack/mmc/OWNERS1
-rw-r--r--system/stack/test/eatt/eatt_test.cc1
-rw-r--r--system/stack/test/gatt/gatt_sr_test.cc22
-rw-r--r--system/stack/test/sdp/stack_sdp_test.cc2
-rw-r--r--system/test/Android.bp15
-rw-r--r--system/test/mock/mock_bta_hearing_aid_audio_source.cc43
-rw-r--r--system/test/mock/mock_main_shim_acl.cc6
-rw-r--r--system/test/mock/mock_main_shim_acl_api.cc6
-rw-r--r--system/test/mock/mock_main_shim_acl_api.h15
-rw-r--r--system/test/mock/mock_stack_gap_conn_interface.cc (renamed from system/test/mock/mock_stack_gap_conn.cc)53
-rw-r--r--system/test/mock/mock_stack_gap_conn_interface.h63
-rw-r--r--system/test/mock/mock_stack_l2cap_interface.h3
-rw-r--r--system/test/suite/adapter/adapter_unittest.cc51
-rw-r--r--system/test/suite/adapter/bluetooth_test.cc28
-rw-r--r--tools/OWNERS5
-rw-r--r--tools/lint/OWNERS2
-rw-r--r--tools/rootcanal/OWNERS3
495 files changed, 2768 insertions, 4880 deletions
diff --git a/OWNERS b/OWNERS
index 82367c3a5f..c73a7053d5 100644
--- a/OWNERS
+++ b/OWNERS
@@ -1,19 +1,6 @@
-# Bug component: 27441
+set noparent
-# Project owners
-girardier@google.com #{LAST_RESORT_SUGGESTION}
-muhammadfalam@google.com #{LAST_RESORT_SUGGESTION}
-siyuanh@google.com #{LAST_RESORT_SUGGESTION}
-okamil@google.com #{LAST_RESORT_SUGGESTION}
-wescande@google.com #{LAST_RESORT_SUGGESTION}
-
-# Per-file ownership
-
-# Build files / test_config / presubmit / preupload / linter file
-per-file *.cfg,.cfg,TEST_MAPPING,*.bp,*.xml,.clang-tidy,pyrightconfig.json=file:/OWNERS_build
-
-# ChromeOS team owns Linux build files
-# - build.py is used for Linux build
-# - *.gn is for GN build rules
-# - Cargo.toml is for Rust build rules
-per-file build.py,*.gn,Cargo.toml=file:/OWNERS_chromeos
+girardier@google.com
+muhammadfalam@google.com
+okamil@google.com
+siyuanh@google.com
diff --git a/OWNERS_automotive b/OWNERS_automotive
deleted file mode 100644
index 20c7ac685b..0000000000
--- a/OWNERS_automotive
+++ /dev/null
@@ -1,3 +0,0 @@
-# Project owners
-cmanton@google.com
-salsavage@google.com
diff --git a/OWNERS_build b/OWNERS_build
deleted file mode 100644
index 5b3f4bad26..0000000000
--- a/OWNERS_build
+++ /dev/null
@@ -1 +0,0 @@
-wescande@google.com
diff --git a/OWNERS_channel_sounding b/OWNERS_channel_sounding
deleted file mode 100644
index 10a8fa893a..0000000000
--- a/OWNERS_channel_sounding
+++ /dev/null
@@ -1,9 +0,0 @@
-# Pixel DRI
-aliceypkuo@google.com
-chienyuanhuang@google.com
-
-# Bluetooth Ranging DRI
-steveliu@google.com
-
-# Bluetooth Stack Reviewer
-henrichataing@google.com
diff --git a/OWNERS_chromeos b/OWNERS_chromeos
deleted file mode 100644
index 075a04e5e3..0000000000
--- a/OWNERS_chromeos
+++ /dev/null
@@ -1,22 +0,0 @@
-# Project owners
-abhishekpandit@google.com
-
-# Audio
-enshuo@google.com
-hychao@google.com
-jrwu@google.com
-whalechang@google.com
-
-# General review
-michaelfsun@google.com
-laikatherine@google.com
-yinghsu@google.com
-apusaka@google.com
-deanliao@google.com
-chharry@google.com
-melhuishj@google.com
-johnlai@google.com
-mmandlik@google.com
-sarveshkalwit@google.com
-howardchung@google.com
-jiangzp@google.com
diff --git a/OWNERS_content b/OWNERS_content
deleted file mode 100644
index 883d5dc782..0000000000
--- a/OWNERS_content
+++ /dev/null
@@ -1,2 +0,0 @@
-klhyun@google.com
-hdmoon@google.com
diff --git a/OWNERS_cs b/OWNERS_cs
deleted file mode 100644
index 1cebb11002..0000000000
--- a/OWNERS_cs
+++ /dev/null
@@ -1,2 +0,0 @@
-steveliu@google.com
-zning@google.com
diff --git a/OWNERS_hearingaid b/OWNERS_hearingaid
deleted file mode 100644
index d1c75de900..0000000000
--- a/OWNERS_hearingaid
+++ /dev/null
@@ -1 +0,0 @@
-henrichataing@google.com
diff --git a/OWNERS_leaudio b/OWNERS_leaudio
deleted file mode 100644
index 30db38d799..0000000000
--- a/OWNERS_leaudio
+++ /dev/null
@@ -1,3 +0,0 @@
-siyuanh@google.com
-jpawlowski@google.com
-rongxuan@google.com
diff --git a/TEST_MAPPING b/TEST_MAPPING
index b1cc9a7594..c807f7d8ec 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -133,9 +133,6 @@
"name": "net_test_bta_security"
},
{
- "name": "net_test_btcore"
- },
- {
"name": "net_test_btif"
},
{
@@ -365,9 +362,6 @@
"name": "net_test_bta_security"
},
{
- "name": "net_test_btcore"
- },
- {
"name": "net_test_btif"
},
{
diff --git a/android/BluetoothLegacyMigration/OWNERS b/android/BluetoothLegacyMigration/OWNERS
deleted file mode 100644
index 66467c7b3e..0000000000
--- a/android/BluetoothLegacyMigration/OWNERS
+++ /dev/null
@@ -1,5 +0,0 @@
-# Reviewers for /android/BluetoothLegacyMigration
-
-eruffieux@google.com
-siyuanh@google.com
-wescande@google.com
diff --git a/android/ChannelSoundingTestApp/OWNERS b/android/ChannelSoundingTestApp/OWNERS
deleted file mode 100644
index 29d6f601cc..0000000000
--- a/android/ChannelSoundingTestApp/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_cs
diff --git a/android/apishim/OWNERS b/android/apishim/OWNERS
deleted file mode 100644
index 586d2866f1..0000000000
--- a/android/apishim/OWNERS
+++ /dev/null
@@ -1,6 +0,0 @@
-# Reviewers for /android/apishim
-
-eruffieux@google.com
-jpawlowski@google.com
-siyuanh@google.com
-wescande@google.com
diff --git a/android/app/OWNERS b/android/app/OWNERS
deleted file mode 100644
index 7b7e2e6679..0000000000
--- a/android/app/OWNERS
+++ /dev/null
@@ -1,15 +0,0 @@
-# Reviewers for /android/app
-
-bhaktha@google.com
-eruffieux@google.com
-hallstrom@google.com
-henrichataing@google.com
-jpawlowski@google.com
-okamil@google.com
-poahlo@google.com
-siyuanh@google.com
-wescande@google.com
-rwt@google.com
-
-# Reviewers for Channel Sounding related files
-per-file /src/com/android/bluetooth/gatt/DistanceMeasurement*.java=file:/OWNERS_channel_sounding
diff --git a/android/app/jni/OWNERS b/android/app/jni/OWNERS
deleted file mode 100644
index 826f56b4e0..0000000000
--- a/android/app/jni/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-per-file com_android_bluetooth_hearing_aid.cpp=file:/OWNERS_hearingaid
-per-file com_android_bluetooth_csip_set_coordinator.cpp=file:/OWNERS_leaudio
-per-file com_android_bluetooth_le_audio.cpp=file:/OWNERS_leaudio
-per-file com_android_bluetooth_vc.cpp=file:/OWNERS_leaudio
diff --git a/android/app/res/values-as/strings.xml b/android/app/res/values-as/strings.xml
index 2776941946..c53ee123e2 100644
--- a/android/app/res/values-as/strings.xml
+++ b/android/app/res/values-as/strings.xml
@@ -35,7 +35,7 @@
<string name="incoming_file_confirm_content" msgid="6573502088511901157">"অন্তৰ্গামী ফাইল গ্ৰহণ কৰিবনে?"</string>
<string name="incoming_file_confirm_cancel" msgid="9205906062663982692">"প্ৰত্যাখ্যান কৰক"</string>
<string name="incoming_file_confirm_ok" msgid="5046926299036238623">"গ্ৰহণ কৰক"</string>
- <string name="incoming_file_confirm_timeout_ok" msgid="8612187577686515660">"ঠিক"</string>
+ <string name="incoming_file_confirm_timeout_ok" msgid="8612187577686515660">"ঠিক আছে"</string>
<string name="incoming_file_confirm_timeout_content" msgid="3221412098281076974">"\"<xliff:g id="SENDER">%1$s</xliff:g>\"ৰ পৰা লাভ কৰা ফাইলটো গ্ৰহণ কৰোঁতে সময় ওকলিছে"</string>
<string name="incoming_file_confirm_Notification_title" msgid="5381395500920804895">"অন্তৰ্গামী ফাইল"</string>
<string name="incoming_file_confirm_Notification_content" msgid="2669135531488877921">"<xliff:g id="SENDER">%1$s</xliff:g> এটা ফাইল পঠিয়াবলৈ সাজু: <xliff:g id="FILE">%2$s</xliff:g>"</string>
@@ -58,18 +58,18 @@
<string name="download_fail_line1" msgid="3149552664349685007">"ফাইল লাভ কৰা নহ\'ল"</string>
<string name="download_fail_line2" msgid="4289018531070750414">"ফাইল: <xliff:g id="FILE">%1$s</xliff:g>"</string>
<string name="download_fail_line3" msgid="2214989413171231684">"কাৰণ: <xliff:g id="REASON">%1$s</xliff:g>"</string>
- <string name="download_fail_ok" msgid="3272322648250767032">"ঠিক"</string>
+ <string name="download_fail_ok" msgid="3272322648250767032">"ঠিক আছে"</string>
<string name="download_succ_line5" msgid="1720346308221503270">"ফাইল লাভ কৰা হ’ল"</string>
<string name="download_succ_ok" msgid="7488662808922799824">"খোলক"</string>
<string name="upload_line1" msgid="1912803923255989287">"প্ৰতি: \"<xliff:g id="RECIPIENT">%1$s</xliff:g>\""</string>
<string name="upload_line3" msgid="5964902647036741603">"ফাইলৰ প্ৰকাৰ: <xliff:g id="TYPE">%1$s</xliff:g> (<xliff:g id="SIZE">%2$s</xliff:g>)"</string>
<string name="upload_line5" msgid="3477751464103201364">"ফাইল প্ৰেৰণ কৰি থকা হৈছে…"</string>
<string name="upload_succ_line5" msgid="165979135931118211">"ফাইল প্ৰেৰণ কৰা হ’ল"</string>
- <string name="upload_succ_ok" msgid="6797291708604959167">"ঠিক"</string>
+ <string name="upload_succ_ok" msgid="6797291708604959167">"ঠিক আছে"</string>
<string name="upload_fail_line1" msgid="7044307783071776426">"\"<xliff:g id="RECIPIENT">%1$s</xliff:g>\"লৈ ফাইলটো পঠিয়াব পৰা নগ\'ল।"</string>
<string name="upload_fail_line1_2" msgid="6102642590057711459">"ফাইল: <xliff:g id="FILE">%1$s</xliff:g>"</string>
<string name="upload_fail_cancel" msgid="1632528037932779727">"বন্ধ কৰক"</string>
- <string name="bt_error_btn_ok" msgid="2802751202009957372">"ঠিক"</string>
+ <string name="bt_error_btn_ok" msgid="2802751202009957372">"ঠিক আছে"</string>
<string name="unknown_file" msgid="3719981572107052685">"অজ্ঞাত ফাইল"</string>
<string name="unknown_file_desc" msgid="9185609398960437760">"এইধৰণৰ ফাইল পৰিচালনা কৰিবলৈ কোনো এপ্ নাই। \n"</string>
<string name="not_exist_file" msgid="5097565588949092486">"কোনো ফাইল নাই"</string>
diff --git a/android/app/src/com/android/bluetooth/BluetoothObexTransport.java b/android/app/src/com/android/bluetooth/BluetoothObexTransport.java
index 3c57ec1600..d101f1736e 100644
--- a/android/app/src/com/android/bluetooth/BluetoothObexTransport.java
+++ b/android/app/src/com/android/bluetooth/BluetoothObexTransport.java
@@ -18,7 +18,6 @@ package com.android.bluetooth;
import android.annotation.SuppressLint;
import android.bluetooth.BluetoothSocket;
-import com.android.bluetooth.flags.Flags;
import com.android.obex.ObexTransport;
import java.io.DataInputStream;
@@ -112,10 +111,7 @@ public class BluetoothObexTransport implements ObexTransport {
if (mSocket == null) {
return null;
}
- String identityAddress =
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(mSocket.getRemoteDevice())
- : mSocket.getRemoteDevice().getIdentityAddress();
+ String identityAddress = Utils.getBrEdrAddress(mSocket.getRemoteDevice());
return mSocket.getConnectionType() == BluetoothSocket.TYPE_RFCOMM
? identityAddress
: mSocket.getRemoteDevice().getAddress();
diff --git a/android/app/src/com/android/bluetooth/a2dp/A2dpNativeInterface.java b/android/app/src/com/android/bluetooth/a2dp/A2dpNativeInterface.java
index fe74b2facd..688f57ce8a 100644
--- a/android/app/src/com/android/bluetooth/a2dp/A2dpNativeInterface.java
+++ b/android/app/src/com/android/bluetooth/a2dp/A2dpNativeInterface.java
@@ -29,8 +29,6 @@ import android.bluetooth.BluetoothCodecType;
import android.bluetooth.BluetoothDevice;
import com.android.bluetooth.Utils;
-import com.android.bluetooth.btservice.AdapterService;
-import com.android.bluetooth.flags.Flags;
import com.android.internal.annotations.VisibleForTesting;
import java.lang.annotation.Native;
@@ -41,15 +39,12 @@ import java.util.List;
public class A2dpNativeInterface {
private static final String TAG = A2dpNativeInterface.class.getSimpleName();
- private final AdapterService mAdapterService;
@Native private final A2dpNativeCallback mNativeCallback;
private BluetoothCodecType[] mSupportedCodecTypes;
@VisibleForTesting
- A2dpNativeInterface(
- @NonNull AdapterService adapterService, @NonNull A2dpNativeCallback nativeCallback) {
- mAdapterService = requireNonNull(adapterService);
+ A2dpNativeInterface(@NonNull A2dpNativeCallback nativeCallback) {
mNativeCallback = requireNonNull(nativeCallback);
}
@@ -132,15 +127,11 @@ public class A2dpNativeInterface {
return setCodecConfigPreferenceNative(getByteAddress(device), codecConfigArray);
}
- private byte[] getByteAddress(BluetoothDevice device) {
+ private static byte[] getByteAddress(BluetoothDevice device) {
if (device == null) {
return Utils.getBytesFromAddress("00:00:00:00:00:00");
}
- if (Flags.identityAddressNullIfNotKnown()) {
- return Utils.getByteBrEdrAddress(device);
- } else {
- return mAdapterService.getByteIdentityAddress(device);
- }
+ return Utils.getByteBrEdrAddress(device);
}
private native void initNative(
diff --git a/android/app/src/com/android/bluetooth/a2dp/A2dpService.java b/android/app/src/com/android/bluetooth/a2dp/A2dpService.java
index de37a5b3f4..6633e4e2ea 100644
--- a/android/app/src/com/android/bluetooth/a2dp/A2dpService.java
+++ b/android/app/src/com/android/bluetooth/a2dp/A2dpService.java
@@ -125,7 +125,6 @@ public class A2dpService extends ProfileService {
nativeInterface,
() ->
new A2dpNativeInterface(
- adapterService,
new A2dpNativeCallback(adapterService, this)));
mDatabaseManager = requireNonNull(mAdapterService.getDatabase());
mAudioManager = requireNonNull(getSystemService(AudioManager.class));
diff --git a/android/app/src/com/android/bluetooth/a2dpsink/A2dpSinkNativeInterface.java b/android/app/src/com/android/bluetooth/a2dpsink/A2dpSinkNativeInterface.java
index e3b4c400a3..6822e4e734 100644
--- a/android/app/src/com/android/bluetooth/a2dpsink/A2dpSinkNativeInterface.java
+++ b/android/app/src/com/android/bluetooth/a2dpsink/A2dpSinkNativeInterface.java
@@ -23,7 +23,6 @@ import android.util.Log;
import com.android.bluetooth.Utils;
import com.android.bluetooth.btservice.AdapterService;
-import com.android.bluetooth.flags.Flags;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
@@ -78,14 +77,6 @@ public class A2dpSinkNativeInterface {
return mAdapterService.getDeviceFromByte(address);
}
- private byte[] getByteAddress(BluetoothDevice device) {
- if (Flags.identityAddressNullIfNotKnown()) {
- return Utils.getByteBrEdrAddress(device);
- } else {
- return mAdapterService.getByteIdentityAddress(device);
- }
- }
-
/**
* Initiates an A2DP connection to a remote device.
*
@@ -93,7 +84,7 @@ public class A2dpSinkNativeInterface {
* @return true on success, otherwise false.
*/
public boolean connectA2dpSink(BluetoothDevice device) {
- return connectA2dpNative(getByteAddress(device));
+ return connectA2dpNative(Utils.getByteBrEdrAddress(device));
}
/**
@@ -103,7 +94,7 @@ public class A2dpSinkNativeInterface {
* @return true on success, otherwise false.
*/
public boolean disconnectA2dpSink(BluetoothDevice device) {
- return disconnectA2dpNative(getByteAddress(device));
+ return disconnectA2dpNative(Utils.getByteBrEdrAddress(device));
}
/**
@@ -120,7 +111,7 @@ public class A2dpSinkNativeInterface {
// Translate to byte address for JNI. Use an all 0 MAC for no active device
byte[] address = null;
if (device != null) {
- address = getByteAddress(device);
+ address = Utils.getByteBrEdrAddress(device);
} else {
address = Utils.getBytesFromAddress("00:00:00:00:00:00");
}
diff --git a/android/app/src/com/android/bluetooth/a2dpsink/OWNERS b/android/app/src/com/android/bluetooth/a2dpsink/OWNERS
deleted file mode 100644
index ecd59038a1..0000000000
--- a/android/app/src/com/android/bluetooth/a2dpsink/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_automotive
diff --git a/android/app/src/com/android/bluetooth/avrcp/AvrcpNativeInterface.java b/android/app/src/com/android/bluetooth/avrcp/AvrcpNativeInterface.java
index 720ce84dd8..85d1043023 100644
--- a/android/app/src/com/android/bluetooth/avrcp/AvrcpNativeInterface.java
+++ b/android/app/src/com/android/bluetooth/avrcp/AvrcpNativeInterface.java
@@ -28,7 +28,6 @@ import com.android.bluetooth.audio_util.PlayStatus;
import com.android.bluetooth.audio_util.PlayerInfo;
import com.android.bluetooth.audio_util.PlayerSettingsManager.PlayerSettingsValues;
import com.android.bluetooth.btservice.AdapterService;
-import com.android.bluetooth.flags.Flags;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
@@ -93,10 +92,7 @@ public class AvrcpNativeInterface {
}
void setBipClientStatus(BluetoothDevice device, boolean connected) {
- String identityAddress =
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(device)
- : mAdapterService.getIdentityAddress(device.getAddress());
+ String identityAddress = Utils.getBrEdrAddress(device);
setBipClientStatusNative(identityAddress, connected);
}
@@ -237,10 +233,7 @@ public class AvrcpNativeInterface {
}
boolean disconnectDevice(BluetoothDevice device) {
- String identityAddress =
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(device)
- : mAdapterService.getIdentityAddress(device.getAddress());
+ String identityAddress = Utils.getBrEdrAddress(device);
d("disconnectDevice: identityAddress=" + identityAddress);
return disconnectDeviceNative(identityAddress);
}
@@ -278,10 +271,7 @@ public class AvrcpNativeInterface {
void sendVolumeChanged(BluetoothDevice device, int volume) {
d("sendVolumeChanged: volume=" + volume);
- String identityAddress =
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(device)
- : mAdapterService.getIdentityAddress(device.getAddress());
+ String identityAddress = Utils.getBrEdrAddress(device);
sendVolumeChangedNative(identityAddress, volume);
}
diff --git a/android/app/src/com/android/bluetooth/avrcpcontroller/OWNERS b/android/app/src/com/android/bluetooth/avrcpcontroller/OWNERS
deleted file mode 100644
index ecd59038a1..0000000000
--- a/android/app/src/com/android/bluetooth/avrcpcontroller/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_automotive
diff --git a/android/app/src/com/android/bluetooth/bass_client/OWNERS b/android/app/src/com/android/bluetooth/bass_client/OWNERS
deleted file mode 100644
index a7d77894ba..0000000000
--- a/android/app/src/com/android/bluetooth/bass_client/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_leaudio
diff --git a/android/app/src/com/android/bluetooth/btservice/AdapterProperties.java b/android/app/src/com/android/bluetooth/btservice/AdapterProperties.java
index bd483f5925..013c799af7 100644
--- a/android/app/src/com/android/bluetooth/btservice/AdapterProperties.java
+++ b/android/app/src/com/android/bluetooth/btservice/AdapterProperties.java
@@ -55,7 +55,6 @@ import androidx.annotation.VisibleForTesting;
import com.android.bluetooth.BluetoothStatsLog;
import com.android.bluetooth.Utils;
import com.android.bluetooth.btservice.RemoteDevices.DeviceProperties;
-import com.android.bluetooth.flags.Flags;
import com.android.modules.utils.build.SdkLevel;
import java.io.FileDescriptor;
@@ -531,10 +530,7 @@ class AdapterProperties {
void cleanupPrevBondRecordsFor(BluetoothDevice device) {
String address = device.getAddress();
- String identityAddress =
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(device, mService)
- : mService.getIdentityAddress(address);
+ String identityAddress = Utils.getBrEdrAddress(device, mService);
int deviceType = mRemoteDevices.getDeviceProperties(device).getDeviceType();
debugLog("cleanupPrevBondRecordsFor: " + device + ", device type: " + deviceType);
if (identityAddress == null) {
@@ -547,10 +543,7 @@ class AdapterProperties {
for (BluetoothDevice existingDevice : mBondedDevices) {
String existingAddress = existingDevice.getAddress();
- String existingIdentityAddress =
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(existingDevice, mService)
- : mService.getIdentityAddress(existingAddress);
+ String existingIdentityAddress = Utils.getBrEdrAddress(existingDevice, mService);
int existingDeviceType =
mRemoteDevices.getDeviceProperties(existingDevice).getDeviceType();
@@ -1100,10 +1093,7 @@ class AdapterProperties {
StringBuilder sb = new StringBuilder();
for (BluetoothDevice device : mBondedDevices) {
String address = device.getAddress();
- String brEdrAddress =
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(device)
- : mService.getIdentityAddress(address);
+ String brEdrAddress = Utils.getBrEdrAddress(device);
if (brEdrAddress.equals(address)) {
writer.println(
" "
diff --git a/android/app/src/com/android/bluetooth/btservice/AdapterService.java b/android/app/src/com/android/bluetooth/btservice/AdapterService.java
index 9bec63769d..182e75cceb 100644
--- a/android/app/src/com/android/bluetooth/btservice/AdapterService.java
+++ b/android/app/src/com/android/bluetooth/btservice/AdapterService.java
@@ -2689,12 +2689,8 @@ public class AdapterService extends Service {
return Utils.getBytesFromAddress(deviceProp.getIdentityAddress());
}
- if (Flags.identityAddressNullIfNotKnown()) {
- // Return null if identity address unknown
- return null;
- } else {
- return Utils.getByteAddress(device);
- }
+ // Return null if identity address unknown
+ return null;
}
public BluetoothDevice getDeviceFromByte(byte[] address) {
@@ -2712,14 +2708,9 @@ public class AdapterService extends Service {
DeviceProperties deviceProp = mRemoteDevices.getDeviceProperties(device);
if (deviceProp != null && deviceProp.getIdentityAddress() != null) {
return deviceProp.getIdentityAddress();
- } else {
- if (Flags.identityAddressNullIfNotKnown()) {
- // Return null if identity address unknown
- return null;
- } else {
- return address;
- }
}
+ // Return null if identity address unknown
+ return null;
}
/**
@@ -2745,11 +2736,7 @@ public class AdapterService extends Service {
}
identityAddressType = deviceProp.getIdentityAddressType();
} else {
- if (Flags.identityAddressNullIfNotKnown()) {
- identityAddress = null;
- } else {
- identityAddress = address;
- }
+ identityAddress = null;
}
return new BluetoothAddress(identityAddress, identityAddressType);
@@ -3119,16 +3106,13 @@ public class AdapterService extends Service {
public int getConnectionState(BluetoothDevice device) {
final String address = device.getAddress();
- if (Flags.apiGetConnectionStateUsingIdentityAddress()) {
- int connectionState = mNativeInterface.getConnectionState(getBytesFromAddress(address));
- final String identityAddress = getIdentityAddress(address);
- if (identityAddress != null) {
- connectionState |=
- mNativeInterface.getConnectionState(getBytesFromAddress(identityAddress));
- }
- return connectionState;
+ int connectionState = mNativeInterface.getConnectionState(getBytesFromAddress(address));
+ final String identityAddress = getIdentityAddress(address);
+ if (identityAddress != null) {
+ connectionState |=
+ mNativeInterface.getConnectionState(getBytesFromAddress(identityAddress));
}
- return mNativeInterface.getConnectionState(getBytesFromAddress(address));
+ return connectionState;
}
int getConnectionHandle(BluetoothDevice device, int transport) {
diff --git a/android/app/src/com/android/bluetooth/btservice/BluetoothSocketManagerBinder.java b/android/app/src/com/android/bluetooth/btservice/BluetoothSocketManagerBinder.java
index f9dcbe8017..0bdebd30e5 100644
--- a/android/app/src/com/android/bluetooth/btservice/BluetoothSocketManagerBinder.java
+++ b/android/app/src/com/android/bluetooth/btservice/BluetoothSocketManagerBinder.java
@@ -29,7 +29,6 @@ import android.os.ParcelUuid;
import android.util.Log;
import com.android.bluetooth.Utils;
-import com.android.bluetooth.flags.Flags;
class BluetoothSocketManagerBinder extends IBluetoothSocketManager.Stub {
private static final String TAG = BluetoothSocketManagerBinder.class.getSimpleName();
@@ -58,10 +57,7 @@ class BluetoothSocketManagerBinder extends IBluetoothSocketManager.Stub {
return null;
}
- String brEdrAddress =
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(device)
- : mService.getIdentityAddress(device.getAddress());
+ String brEdrAddress = Utils.getBrEdrAddress(device);
Log.i(
TAG,
@@ -118,10 +114,7 @@ class BluetoothSocketManagerBinder extends IBluetoothSocketManager.Stub {
mService.enforceCallingOrSelfPermission(BLUETOOTH_PRIVILEGED, null);
enforceSocketOffloadSupport(type);
}
- String brEdrAddress =
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(device)
- : mService.getIdentityAddress(device.getAddress());
+ String brEdrAddress = Utils.getBrEdrAddress(device);
Log.i(
TAG,
diff --git a/android/app/src/com/android/bluetooth/content_profiles/OWNERS b/android/app/src/com/android/bluetooth/content_profiles/OWNERS
deleted file mode 100644
index 8f87191393..0000000000
--- a/android/app/src/com/android/bluetooth/content_profiles/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_content \ No newline at end of file
diff --git a/android/app/src/com/android/bluetooth/csip/OWNERS b/android/app/src/com/android/bluetooth/csip/OWNERS
deleted file mode 100644
index a7d77894ba..0000000000
--- a/android/app/src/com/android/bluetooth/csip/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_leaudio
diff --git a/android/app/src/com/android/bluetooth/gatt/GattService.java b/android/app/src/com/android/bluetooth/gatt/GattService.java
index 6e5faefa9f..10190b09ef 100644
--- a/android/app/src/com/android/bluetooth/gatt/GattService.java
+++ b/android/app/src/com/android/bluetooth/gatt/GattService.java
@@ -1025,8 +1025,7 @@ public class GattService extends ProfileService {
if (!checkConnectPermissionForDataDelivery(this, source, TAG, "registerClient")) {
return;
}
- if (Flags.gattClientDynamicAllocation()
- && mClientMap.countByAppUid(Binder.getCallingUid()) >= GATT_CLIENT_LIMIT_PER_APP) {
+ if (mClientMap.countByAppUid(Binder.getCallingUid()) >= GATT_CLIENT_LIMIT_PER_APP) {
Log.w(TAG, "registerClient() - failed due to too many clients");
callbackToApp(() -> callback.onClientRegistered(BluetoothGatt.GATT_FAILURE, 0));
return;
@@ -2320,21 +2319,14 @@ public class GattService extends ProfileService {
int handle = 0;
Integer connId = 0;
- if (!Flags.gattServerRequestsFix()) {
- HandleMap.Entry entry = mHandleMap.getByRequestId(requestId);
- if (entry != null) {
- handle = entry.mHandle;
- }
- connId = mServerMap.connIdByAddress(serverIf, address);
+ HandleMap.RequestData requestData = mHandleMap.getRequestDataByRequestId(requestId);
+ if (requestData != null) {
+ handle = requestData.handle();
+ connId = requestData.connId();
} else {
- HandleMap.RequestData requestData = mHandleMap.getRequestDataByRequestId(requestId);
- if (requestData != null) {
- handle = requestData.handle();
- connId = requestData.connId();
- } else {
- connId = mServerMap.connIdByAddress(serverIf, address);
- }
+ connId = mServerMap.connIdByAddress(serverIf, address);
}
+
mNativeInterface.gattServerSendResponse(
serverIf,
connId != null ? connId : 0,
diff --git a/android/app/src/com/android/bluetooth/hearingaid/OWNERS b/android/app/src/com/android/bluetooth/hearingaid/OWNERS
deleted file mode 100644
index bbaa85ddbb..0000000000
--- a/android/app/src/com/android/bluetooth/hearingaid/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_hearingaid
diff --git a/android/app/src/com/android/bluetooth/hfp/HeadsetNativeInterface.java b/android/app/src/com/android/bluetooth/hfp/HeadsetNativeInterface.java
index 5afe78cee5..e3816ed636 100644
--- a/android/app/src/com/android/bluetooth/hfp/HeadsetNativeInterface.java
+++ b/android/app/src/com/android/bluetooth/hfp/HeadsetNativeInterface.java
@@ -24,7 +24,6 @@ import android.util.Log;
import com.android.bluetooth.Utils;
import com.android.bluetooth.btservice.AdapterService;
-import com.android.bluetooth.flags.Flags;
import com.android.internal.annotations.GuardedBy;
/**
@@ -84,16 +83,12 @@ public class HeadsetNativeInterface {
return mAdapterService.getDeviceFromByte(address);
}
- private byte[] getByteAddress(BluetoothDevice device) {
+ private static byte[] getByteAddress(BluetoothDevice device) {
if (device == null) {
// Set bt_stack's active device to default if java layer set active device to null
return Utils.getBytesFromAddress("00:00:00:00:00:00");
}
- if (Flags.identityAddressNullIfNotKnown()) {
- return Utils.getByteBrEdrAddress(device);
- } else {
- return mAdapterService.getByteIdentityAddress(device);
- }
+ return Utils.getByteBrEdrAddress(device);
}
void onConnectionStateChanged(int state, byte[] address) {
diff --git a/android/app/src/com/android/bluetooth/hfp/HeadsetService.java b/android/app/src/com/android/bluetooth/hfp/HeadsetService.java
index c5ab1f8dde..ce7c623aaf 100644
--- a/android/app/src/com/android/bluetooth/hfp/HeadsetService.java
+++ b/android/app/src/com/android/bluetooth/hfp/HeadsetService.java
@@ -1105,10 +1105,7 @@ public class HeadsetService extends ProfileService {
} else {
broadcastActiveDevice(null);
}
-
- if (Flags.updateActiveDeviceInBandRingtone()) {
- updateInbandRinging(null, true);
- }
+ updateInbandRinging(null, true);
}
}
@@ -1222,9 +1219,7 @@ public class HeadsetService extends ProfileService {
broadcastActiveDevice(mActiveDevice);
}
}
- if (Flags.updateActiveDeviceInBandRingtone()) {
- updateInbandRinging(device, true);
- }
+ updateInbandRinging(device, true);
}
return true;
}
@@ -1941,7 +1936,7 @@ public class HeadsetService extends ProfileService {
if (getConnectedDevices().size() > 1
|| isHeadsetClientConnected()
- || (Flags.updateActiveDeviceInBandRingtone() && mActiveDevice == null)) {
+ || mActiveDevice == null) {
mInbandRingingRuntimeDisable = true;
} else {
mInbandRingingRuntimeDisable = false;
diff --git a/android/app/src/com/android/bluetooth/hfp/HeadsetStateMachine.java b/android/app/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
index 6ea741af32..3c2fe0f8bf 100644
--- a/android/app/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
+++ b/android/app/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
@@ -58,6 +58,7 @@ import com.android.bluetooth.btservice.MetricsLogger;
import com.android.bluetooth.btservice.ProfileService;
import com.android.bluetooth.btservice.storage.DatabaseManager;
import com.android.bluetooth.flags.Flags;
+import com.android.bluetooth.util.SystemProperties;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.State;
import com.android.internal.util.StateMachine;
@@ -187,6 +188,9 @@ class HeadsetStateMachine extends StateMachine {
BluetoothAssignedNumbers.GOOGLE);
}
+ @VisibleForTesting
+ static final String HFP_VOLUME_CONTROL_ENABLED = "bluetooth.hfp_volume_control.enabled";
+
private HeadsetStateMachine(
BluetoothDevice device,
Looper looper,
@@ -2026,7 +2030,10 @@ class HeadsetStateMachine extends StateMachine {
}
if (volumeType == HeadsetHalConstants.VOLUME_TYPE_SPK) {
mSpeakerVolume = volume;
- int flag = (mCurrentState == mAudioOn) ? AudioManager.FLAG_SHOW_UI : 0;
+ boolean showVolume =
+ !Flags.hfpVolumeControlProperty()
+ || SystemProperties.getBoolean(HFP_VOLUME_CONTROL_ENABLED, true);
+ int flag = showVolume && (mCurrentState == mAudioOn) ? AudioManager.FLAG_SHOW_UI : 0;
int volStream =
deprecateStreamBtSco()
? AudioManager.STREAM_VOICE_CALL
diff --git a/android/app/src/com/android/bluetooth/hfpclient/NativeInterface.java b/android/app/src/com/android/bluetooth/hfpclient/NativeInterface.java
index fbb68747fe..bcbb49fba6 100644
--- a/android/app/src/com/android/bluetooth/hfpclient/NativeInterface.java
+++ b/android/app/src/com/android/bluetooth/hfpclient/NativeInterface.java
@@ -27,7 +27,6 @@ import android.util.Log;
import com.android.bluetooth.Utils;
import com.android.bluetooth.btservice.AdapterService;
-import com.android.bluetooth.flags.Flags;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
@@ -334,12 +333,8 @@ public class NativeInterface {
return mAdapterService.getDeviceFromByte(address);
}
- private byte[] getByteAddress(BluetoothDevice device) {
- if (Flags.identityAddressNullIfNotKnown()) {
- return Utils.getByteBrEdrAddress(device);
- } else {
- return mAdapterService.getByteIdentityAddress(device);
- }
+ private static byte[] getByteAddress(BluetoothDevice device) {
+ return Utils.getByteBrEdrAddress(device);
}
// Callbacks from the native back into the java framework. All callbacks are routed via the
diff --git a/android/app/src/com/android/bluetooth/hfpclient/OWNERS b/android/app/src/com/android/bluetooth/hfpclient/OWNERS
deleted file mode 100644
index ecd59038a1..0000000000
--- a/android/app/src/com/android/bluetooth/hfpclient/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_automotive
diff --git a/android/app/src/com/android/bluetooth/hid/HidDeviceNativeInterface.java b/android/app/src/com/android/bluetooth/hid/HidDeviceNativeInterface.java
index 2ca9078103..dc269b7abf 100644
--- a/android/app/src/com/android/bluetooth/hid/HidDeviceNativeInterface.java
+++ b/android/app/src/com/android/bluetooth/hid/HidDeviceNativeInterface.java
@@ -29,7 +29,6 @@ import android.util.Log;
import com.android.bluetooth.Utils;
import com.android.bluetooth.btservice.AdapterService;
-import com.android.bluetooth.flags.Flags;
import com.android.internal.annotations.VisibleForTesting;
/** HID Device Native Interface to/from JNI. */
@@ -123,7 +122,7 @@ public class HidDeviceNativeInterface {
* @return the result of the native call
*/
public boolean connect(BluetoothDevice device) {
- return connectNative(getByteAddress(device));
+ return connectNative(Utils.getByteBrEdrAddress(device));
}
/**
@@ -243,14 +242,6 @@ public class HidDeviceNativeInterface {
return mAdapterService.getDeviceFromByte(address);
}
- private byte[] getByteAddress(BluetoothDevice device) {
- if (Flags.identityAddressNullIfNotKnown()) {
- return Utils.getByteBrEdrAddress(device);
- } else {
- return mAdapterService.getByteIdentityAddress(device);
- }
- }
-
private native void initNative();
private native void cleanupNative();
diff --git a/android/app/src/com/android/bluetooth/hid/HidHostService.java b/android/app/src/com/android/bluetooth/hid/HidHostService.java
index 1eac6ed336..68c2be4a8b 100644
--- a/android/app/src/com/android/bluetooth/hid/HidHostService.java
+++ b/android/app/src/com/android/bluetooth/hid/HidHostService.java
@@ -162,14 +162,6 @@ public class HidHostService extends ProfileService {
setHidHostService(null);
}
- private byte[] getIdentityAddress(BluetoothDevice device) {
- if (Flags.identityAddressNullIfNotKnown()) {
- return Utils.getByteBrEdrAddress(mAdapterService, device);
- } else {
- return mAdapterService.getByteIdentityAddress(device);
- }
- }
-
private byte[] getByteAddress(BluetoothDevice device, int transport) {
final ParcelUuid[] uuids = mAdapterService.getRemoteUuids(device);
@@ -177,14 +169,14 @@ public class HidHostService extends ProfileService {
// Use pseudo address when HOGP is to be used
return Utils.getByteAddress(device);
} else if (transport == BluetoothDevice.TRANSPORT_BREDR) {
- // Use identity address if HID is to be used
- return getIdentityAddress(device);
+ // Use BR/EDR address if HID is to be used
+ return Utils.getByteBrEdrAddress(mAdapterService, device);
} else { // BluetoothDevice.TRANSPORT_AUTO
boolean hidSupported = Utils.arrayContains(uuids, BluetoothUuid.HID);
// Prefer HID over HOGP
if (hidSupported) {
- // Use identity address if HID is available
- return getIdentityAddress(device);
+ // Use BR/EDR address if HID is available
+ return Utils.getByteBrEdrAddress(mAdapterService, device);
} else {
// Otherwise use pseudo address
return Utils.getByteAddress(device);
diff --git a/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java b/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java
index 4f0d215e5b..54ced65311 100644
--- a/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java
+++ b/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java
@@ -348,7 +348,7 @@ public class LeAudioService extends ProfileService {
mLostLeadDeviceWhileStreaming = null;
mCurrentLeadDevice = null;
mInbandRingtoneEnabled = isInbandRingtoneEnabled;
- mAvailableContexts = Flags.leaudioUnicastNoAvailableContexts() ? null : 0;
+ mAvailableContexts = null;
mInputSelectableConfig = new ArrayList<>();
mOutputSelectableConfig = new ArrayList<>();
mInactivatedDueToContextType = false;
@@ -3371,11 +3371,6 @@ public class LeAudioService extends ProfileService {
boolean inputCodecOrFreqChanged) {
Log.i(TAG, "notifyAudioFrameworkForCodecConfigUpdate groupId: " + groupId);
- if (!Flags.leaudioCodecConfigCallbackOrderFix()) {
- Log.d(TAG, "leaudio_codec_config_callback_order_fix is not enabled");
- return;
- }
-
if (mActiveAudioOutDevice != null && outputCodecOrFreqChanged) {
int volume = getAudioDeviceGroupVolume(groupId);
@@ -4347,8 +4342,7 @@ public class LeAudioService extends ProfileService {
if (getConnectedPeerDevices(groupId).isEmpty()) {
descriptor.mIsConnected = false;
descriptor.mAutoActiveModeEnabled = true;
- descriptor.mAvailableContexts =
- Flags.leaudioUnicastNoAvailableContexts() ? null : 0;
+ descriptor.mAvailableContexts = null;
if (descriptor.isActive()) {
/* Notify Native layer */
removeActiveDevice(hasFallbackDevice);
diff --git a/android/app/src/com/android/bluetooth/le_audio/OWNERS b/android/app/src/com/android/bluetooth/le_audio/OWNERS
deleted file mode 100644
index a7d77894ba..0000000000
--- a/android/app/src/com/android/bluetooth/le_audio/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_leaudio
diff --git a/android/app/src/com/android/bluetooth/map/OWNERS b/android/app/src/com/android/bluetooth/map/OWNERS
deleted file mode 100644
index 8f87191393..0000000000
--- a/android/app/src/com/android/bluetooth/map/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_content \ No newline at end of file
diff --git a/android/app/src/com/android/bluetooth/mapclient/OWNERS b/android/app/src/com/android/bluetooth/mapclient/OWNERS
deleted file mode 100644
index b0b54fc3d2..0000000000
--- a/android/app/src/com/android/bluetooth/mapclient/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-include /OWNERS_automotive
-include /OWNERS_content
diff --git a/android/app/src/com/android/bluetooth/mcp/MediaControlProfile.java b/android/app/src/com/android/bluetooth/mcp/MediaControlProfile.java
index b96923ca7d..aff115c59e 100644
--- a/android/app/src/com/android/bluetooth/mcp/MediaControlProfile.java
+++ b/android/app/src/com/android/bluetooth/mcp/MediaControlProfile.java
@@ -39,7 +39,6 @@ import com.android.bluetooth.audio_util.MediaData;
import com.android.bluetooth.audio_util.MediaPlayerList;
import com.android.bluetooth.audio_util.MediaPlayerWrapper;
import com.android.bluetooth.btservice.AdapterService;
-import com.android.bluetooth.flags.Flags;
import com.android.bluetooth.le_audio.ContentControlIdKeeper;
import com.android.internal.annotations.VisibleForTesting;
@@ -409,8 +408,7 @@ public class MediaControlProfile implements MediaControlServiceCallbacks {
+ Request.Opcodes.toString(request.opcode()));
Request.Results status = Request.Results.COMMAND_CANNOT_BE_COMPLETED;
- if (Flags.mcpAllowPlayWithoutActivePlayer()
- && !Utils.isPtsTestMode()
+ if (!Utils.isPtsTestMode()
&& mMediaPlayerList.getActivePlayer() == null
&& request.opcode() == Request.Opcodes.PLAY) {
Log.d(TAG, "Player is not active. GMCS send media key for PLAY");
diff --git a/android/app/src/com/android/bluetooth/mcp/OWNERS b/android/app/src/com/android/bluetooth/mcp/OWNERS
deleted file mode 100644
index a7d77894ba..0000000000
--- a/android/app/src/com/android/bluetooth/mcp/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_leaudio
diff --git a/android/app/src/com/android/bluetooth/opp/BluetoothOppHandoverReceiver.java b/android/app/src/com/android/bluetooth/opp/BluetoothOppHandoverReceiver.java
index 81c59f8ad2..d87bd420fe 100644
--- a/android/app/src/com/android/bluetooth/opp/BluetoothOppHandoverReceiver.java
+++ b/android/app/src/com/android/bluetooth/opp/BluetoothOppHandoverReceiver.java
@@ -25,7 +25,6 @@ import android.util.Log;
import com.android.bluetooth.BluetoothMethodProxy;
import com.android.bluetooth.Utils;
-import com.android.bluetooth.flags.Flags;
import java.util.ArrayList;
@@ -82,10 +81,7 @@ public class BluetoothOppHandoverReceiver extends BroadcastReceiver {
if (device == null) {
return;
}
- String brEdrAddress =
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(device)
- : device.getIdentityAddress();
+ String brEdrAddress = Utils.getBrEdrAddress(device);
Log.d(TAG, "Adding " + brEdrAddress + " to acceptlist");
BluetoothOppManager.getInstance(context).addToAcceptlist(brEdrAddress);
} else if (action.equals(Constants.ACTION_STOP_HANDOVER)) {
diff --git a/android/app/src/com/android/bluetooth/opp/BluetoothOppManager.java b/android/app/src/com/android/bluetooth/opp/BluetoothOppManager.java
index 730c1e9ce2..c745f243d4 100644
--- a/android/app/src/com/android/bluetooth/opp/BluetoothOppManager.java
+++ b/android/app/src/com/android/bluetooth/opp/BluetoothOppManager.java
@@ -54,7 +54,6 @@ import com.android.bluetooth.BluetoothStatsLog;
import com.android.bluetooth.R;
import com.android.bluetooth.Utils;
import com.android.bluetooth.content_profiles.ContentProfileErrorReportUtils;
-import com.android.bluetooth.flags.Flags;
import com.android.internal.annotations.VisibleForTesting;
import java.util.ArrayList;
@@ -480,11 +479,7 @@ public class BluetoothOppManager {
}
values.put(BluetoothShare.MIMETYPE, contentType);
- values.put(
- BluetoothShare.DESTINATION,
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(mRemoteDevice)
- : mRemoteDevice.getIdentityAddress());
+ values.put(BluetoothShare.DESTINATION, Utils.getBrEdrAddress(mRemoteDevice));
values.put(BluetoothShare.TIMESTAMP, ts);
if (mIsHandoverInitiated) {
values.put(
@@ -512,11 +507,7 @@ public class BluetoothOppManager {
ContentValues values = new ContentValues();
values.put(BluetoothShare.URI, mUri);
values.put(BluetoothShare.MIMETYPE, mTypeOfSingleFile);
- values.put(
- BluetoothShare.DESTINATION,
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(mRemoteDevice)
- : mRemoteDevice.getIdentityAddress());
+ values.put(BluetoothShare.DESTINATION, Utils.getBrEdrAddress(mRemoteDevice));
if (mIsHandoverInitiated) {
values.put(
BluetoothShare.USER_CONFIRMATION,
diff --git a/android/app/src/com/android/bluetooth/opp/BluetoothOppPreference.java b/android/app/src/com/android/bluetooth/opp/BluetoothOppPreference.java
index 6164cb4f58..114adfe631 100644
--- a/android/app/src/com/android/bluetooth/opp/BluetoothOppPreference.java
+++ b/android/app/src/com/android/bluetooth/opp/BluetoothOppPreference.java
@@ -32,7 +32,6 @@
package com.android.bluetooth.opp;
-import android.annotation.SuppressLint;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothUtils;
import android.content.Context;
@@ -41,7 +40,6 @@ import android.content.SharedPreferences.Editor;
import android.util.Log;
import com.android.bluetooth.Utils;
-import com.android.bluetooth.flags.Flags;
import java.util.HashMap;
@@ -87,11 +85,11 @@ public class BluetoothOppPreference {
}
private static String getChannelKey(BluetoothDevice remoteDevice, int uuid) {
- return getBrEdrAddress(remoteDevice) + "_" + Integer.toHexString(uuid);
+ return Utils.getBrEdrAddress(remoteDevice) + "_" + Integer.toHexString(uuid);
}
public String getName(BluetoothDevice remoteDevice) {
- String identityAddress = getBrEdrAddress(remoteDevice);
+ String identityAddress = Utils.getBrEdrAddress(remoteDevice);
if (identityAddress != null && identityAddress.equals("FF:FF:FF:00:00:00")) {
return "localhost";
}
@@ -113,7 +111,8 @@ public class BluetoothOppPreference {
Log.v(
TAG,
"getChannel for "
- + BluetoothUtils.toAnonymizedAddress(getBrEdrAddress(remoteDevice))
+ + BluetoothUtils.toAnonymizedAddress(
+ Utils.getBrEdrAddress(remoteDevice))
+ "_"
+ Integer.toHexString(uuid)
+ " as "
@@ -123,7 +122,7 @@ public class BluetoothOppPreference {
}
public void setName(BluetoothDevice remoteDevice, String name) {
- String brEdrAddress = getBrEdrAddress(remoteDevice);
+ String brEdrAddress = Utils.getBrEdrAddress(remoteDevice);
Log.v(
TAG,
"setName for " + BluetoothUtils.toAnonymizedAddress(brEdrAddress) + " to " + name);
@@ -139,7 +138,7 @@ public class BluetoothOppPreference {
Log.v(
TAG,
"setChannel for "
- + BluetoothUtils.toAnonymizedAddress(getBrEdrAddress(remoteDevice))
+ + BluetoothUtils.toAnonymizedAddress(Utils.getBrEdrAddress(remoteDevice))
+ "_"
+ Integer.toHexString(uuid)
+ " to "
@@ -163,7 +162,7 @@ public class BluetoothOppPreference {
public void removeName(BluetoothDevice remoteDevice) {
Editor ed = mNamePreference.edit();
- String key = getBrEdrAddress(remoteDevice);
+ String key = Utils.getBrEdrAddress(remoteDevice);
ed.remove(key);
ed.apply();
mNames.remove(key);
@@ -175,12 +174,4 @@ public class BluetoothOppPreference {
Log.d(TAG, "Dumping Channels: ");
Log.d(TAG, mChannels.toString());
}
-
- @SuppressLint("AndroidFrameworkRequiresPermission")
- private static String getBrEdrAddress(BluetoothDevice device) {
- if (Flags.identityAddressNullIfNotKnown()) {
- return Utils.getBrEdrAddress(device);
- }
- return device.getIdentityAddress();
- }
}
diff --git a/android/app/src/com/android/bluetooth/opp/BluetoothOppReceiver.java b/android/app/src/com/android/bluetooth/opp/BluetoothOppReceiver.java
index eb9b7f91c4..77dadd9a65 100644
--- a/android/app/src/com/android/bluetooth/opp/BluetoothOppReceiver.java
+++ b/android/app/src/com/android/bluetooth/opp/BluetoothOppReceiver.java
@@ -52,7 +52,6 @@ import com.android.bluetooth.BluetoothStatsLog;
import com.android.bluetooth.R;
import com.android.bluetooth.Utils;
import com.android.bluetooth.content_profiles.ContentProfileErrorReportUtils;
-import com.android.bluetooth.flags.Flags;
/**
* Receives and handles: system broadcasts; Intents from other applications; Intents from
@@ -81,9 +80,7 @@ public class BluetoothOppReceiver extends BroadcastReceiver {
TAG,
"Received BT device selected intent, bt device: "
+ BluetoothUtils.toAnonymizedAddress(
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(remoteDevice)
- : remoteDevice.getIdentityAddress()));
+ Utils.getBrEdrAddress(remoteDevice)));
// Insert transfer session record to database
mOppManager.startTransfer(remoteDevice);
diff --git a/android/app/src/com/android/bluetooth/opp/BluetoothOppService.java b/android/app/src/com/android/bluetooth/opp/BluetoothOppService.java
index 2548b9e45c..f043cbcc53 100644
--- a/android/app/src/com/android/bluetooth/opp/BluetoothOppService.java
+++ b/android/app/src/com/android/bluetooth/opp/BluetoothOppService.java
@@ -121,7 +121,7 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti
// Since ContentObserver is created with Handler, onChange() can be called
// even after the observer is unregistered.
- if (Flags.oppIgnoreContentObserverAfterServiceStop() && mObserver != this) {
+ if (mObserver != this) {
Log.d(TAG, "onChange() called after stop() is called.");
return;
}
@@ -1346,9 +1346,7 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti
+ socket
+ " \n :device :"
+ BluetoothUtils.toAnonymizedAddress(
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(device, mAdapterService)
- : mAdapterService.getIdentityAddress(device.getAddress())));
+ Utils.getBrEdrAddress(device, mAdapterService)));
if (!mAcceptNewConnections) {
Log.d(TAG, " onConnect BluetoothSocket :" + socket + " rejected");
return false;
diff --git a/android/app/src/com/android/bluetooth/opp/BluetoothOppTransfer.java b/android/app/src/com/android/bluetooth/opp/BluetoothOppTransfer.java
index 1ff73d1b48..5e92f1e81e 100644
--- a/android/app/src/com/android/bluetooth/opp/BluetoothOppTransfer.java
+++ b/android/app/src/com/android/bluetooth/opp/BluetoothOppTransfer.java
@@ -63,7 +63,6 @@ import com.android.bluetooth.BluetoothObexTransport;
import com.android.bluetooth.BluetoothStatsLog;
import com.android.bluetooth.Utils;
import com.android.bluetooth.content_profiles.ContentProfileErrorReportUtils;
-import com.android.bluetooth.flags.Flags;
import com.android.internal.annotations.VisibleForTesting;
import com.android.obex.ObexTransport;
@@ -116,7 +115,8 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch
Log.e(
TAG,
"device : "
- + BluetoothUtils.toAnonymizedAddress(getBrEdrAddress(device))
+ + BluetoothUtils.toAnonymizedAddress(
+ Utils.getBrEdrAddress(device))
+ " mBatch :"
+ mBatch
+ " mCurrentShare :"
@@ -133,7 +133,8 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch
Log.v(
TAG,
"Device :"
- + BluetoothUtils.toAnonymizedAddress(getBrEdrAddress(device))
+ + BluetoothUtils.toAnonymizedAddress(
+ Utils.getBrEdrAddress(device))
+ "- OPP device: "
+ mBatch.mDestination
+ " \n mCurrentShare.mConfirm == "
@@ -180,8 +181,8 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch
3);
return;
}
- String deviceIdentityAddress = getBrEdrAddress(device);
- String transferDeviceIdentityAddress = getBrEdrAddress(mDevice);
+ String deviceIdentityAddress = Utils.getBrEdrAddress(device);
+ String transferDeviceIdentityAddress = Utils.getBrEdrAddress(mDevice);
if (deviceIdentityAddress == null
|| transferDeviceIdentityAddress == null
|| !deviceIdentityAddress.equalsIgnoreCase(
@@ -1008,11 +1009,4 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch
}
}
}
-
- private static String getBrEdrAddress(BluetoothDevice device) {
- if (Flags.identityAddressNullIfNotKnown()) {
- return Utils.getBrEdrAddress(device);
- }
- return device.getIdentityAddress();
- }
}
diff --git a/android/app/src/com/android/bluetooth/opp/OWNERS b/android/app/src/com/android/bluetooth/opp/OWNERS
deleted file mode 100644
index 8f87191393..0000000000
--- a/android/app/src/com/android/bluetooth/opp/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_content \ No newline at end of file
diff --git a/android/app/src/com/android/bluetooth/pan/OWNERS b/android/app/src/com/android/bluetooth/pan/OWNERS
deleted file mode 100644
index 8f87191393..0000000000
--- a/android/app/src/com/android/bluetooth/pan/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_content \ No newline at end of file
diff --git a/android/app/src/com/android/bluetooth/pan/PanService.java b/android/app/src/com/android/bluetooth/pan/PanService.java
index 5c2dfdf2a7..9196288928 100644
--- a/android/app/src/com/android/bluetooth/pan/PanService.java
+++ b/android/app/src/com/android/bluetooth/pan/PanService.java
@@ -50,7 +50,6 @@ import com.android.bluetooth.Utils;
import com.android.bluetooth.btservice.AdapterService;
import com.android.bluetooth.btservice.ProfileService;
import com.android.bluetooth.btservice.storage.DatabaseManager;
-import com.android.bluetooth.flags.Flags;
import com.android.internal.annotations.VisibleForTesting;
import com.android.modules.utils.HandlerExecutor;
@@ -99,9 +98,7 @@ public class PanService extends ProfileService {
Log.e(TAG, "Error setting up tether interface: " + error);
for (BluetoothDevice device : mPanDevices.keySet()) {
mNativeInterface.disconnect(
- Flags.panUseIdentityAddress()
- ? Utils.getByteBrEdrAddress(mAdapterService, device)
- : Utils.getByteAddress(device));
+ Utils.getByteBrEdrAddress(mAdapterService, device));
}
mPanDevices.clear();
mIsTethering = false;
@@ -212,9 +209,7 @@ public class PanService extends ProfileService {
case MESSAGE_CONNECT:
BluetoothDevice connectDevice = (BluetoothDevice) msg.obj;
if (!mNativeInterface.connect(
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getByteBrEdrAddress(mAdapterService, connectDevice)
- : mAdapterService.getByteIdentityAddress(connectDevice))) {
+ Utils.getByteBrEdrAddress(mAdapterService, connectDevice))) {
handlePanDeviceStateChange(
connectDevice,
null,
@@ -232,9 +227,7 @@ public class PanService extends ProfileService {
case MESSAGE_DISCONNECT:
BluetoothDevice disconnectDevice = (BluetoothDevice) msg.obj;
if (!mNativeInterface.disconnect(
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getByteBrEdrAddress(mAdapterService, disconnectDevice)
- : mAdapterService.getByteIdentityAddress(disconnectDevice))) {
+ Utils.getByteBrEdrAddress(mAdapterService, disconnectDevice))) {
handlePanDeviceStateChange(
disconnectDevice,
mPanIfName,
@@ -504,10 +497,7 @@ public class PanService extends ProfileService {
"handlePanDeviceStateChange BT tethering is off/Local role"
+ " is PANU drop the connection");
mPanDevices.remove(device);
- mNativeInterface.disconnect(
- Flags.panUseIdentityAddress()
- ? Utils.getByteBrEdrAddress(mAdapterService, device)
- : Utils.getByteAddress(device));
+ mNativeInterface.disconnect(Utils.getByteBrEdrAddress(mAdapterService, device));
return;
}
Log.d(TAG, "handlePanDeviceStateChange LOCAL_NAP_ROLE:REMOTE_PANU_ROLE");
diff --git a/android/app/src/com/android/bluetooth/pbap/OWNERS b/android/app/src/com/android/bluetooth/pbap/OWNERS
deleted file mode 100644
index 8f87191393..0000000000
--- a/android/app/src/com/android/bluetooth/pbap/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_content \ No newline at end of file
diff --git a/android/app/src/com/android/bluetooth/pbapclient/OWNERS b/android/app/src/com/android/bluetooth/pbapclient/OWNERS
deleted file mode 100644
index b0b54fc3d2..0000000000
--- a/android/app/src/com/android/bluetooth/pbapclient/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-include /OWNERS_automotive
-include /OWNERS_content
diff --git a/android/app/src/com/android/bluetooth/sap/OWNERS b/android/app/src/com/android/bluetooth/sap/OWNERS
deleted file mode 100644
index 8f87191393..0000000000
--- a/android/app/src/com/android/bluetooth/sap/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_content \ No newline at end of file
diff --git a/android/app/src/com/android/bluetooth/sdp/SdpManager.java b/android/app/src/com/android/bluetooth/sdp/SdpManager.java
index 3a316f8457..de6193aeb2 100644
--- a/android/app/src/com/android/bluetooth/sdp/SdpManager.java
+++ b/android/app/src/com/android/bluetooth/sdp/SdpManager.java
@@ -35,7 +35,6 @@ import android.util.Log;
import com.android.bluetooth.Utils;
import com.android.bluetooth.btservice.AbstractionLayer;
import com.android.bluetooth.btservice.AdapterService;
-import com.android.bluetooth.flags.Flags;
import com.android.internal.annotations.GuardedBy;
import java.util.ArrayList;
@@ -143,16 +142,10 @@ public class SdpManager {
SdpSearchInstance getSearchInstance(byte[] address, byte[] uuidBytes) {
String addressString = Utils.getAddressStringFromByte(address);
- addressString =
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(addressString, mAdapterService)
- : mAdapterService.getIdentityAddress(addressString);
+ addressString = Utils.getBrEdrAddress(addressString, mAdapterService);
ParcelUuid uuid = Utils.byteArrayToUuid(uuidBytes)[0];
for (SdpSearchInstance inst : mList) {
- String instAddressString =
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(inst.getDevice(), mAdapterService)
- : mAdapterService.getIdentityAddress(inst.getDevice().getAddress());
+ String instAddressString = Utils.getBrEdrAddress(inst.getDevice(), mAdapterService);
if (instAddressString.equals(addressString) && inst.getUuid().equals(uuid)) {
return inst;
}
@@ -161,15 +154,9 @@ public class SdpManager {
}
boolean isSearching(BluetoothDevice device, ParcelUuid uuid) {
- String addressString =
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(device, mAdapterService)
- : mAdapterService.getIdentityAddress(device.getAddress());
+ String addressString = Utils.getBrEdrAddress(device, mAdapterService);
for (SdpSearchInstance inst : mList) {
- String instAddressString =
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(inst.getDevice(), mAdapterService)
- : mAdapterService.getIdentityAddress(inst.getDevice().getAddress());
+ String instAddressString = Utils.getBrEdrAddress(inst.getDevice(), mAdapterService);
if (instAddressString != null
&& addressString != null
&& instAddressString.equals(addressString)
@@ -473,9 +460,7 @@ public class SdpManager {
inst.startSearch(); // Trigger timeout message
mNativeInterface.sdpSearch(
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getByteBrEdrAddress(inst.getDevice())
- : mAdapterService.getByteIdentityAddress(inst.getDevice()),
+ Utils.getByteBrEdrAddress(inst.getDevice()),
Utils.uuidToByteArray(inst.getUuid()));
} else { // Else queue is empty.
Log.d(
diff --git a/android/app/src/com/android/bluetooth/vc/OWNERS b/android/app/src/com/android/bluetooth/vc/OWNERS
deleted file mode 100644
index a7d77894ba..0000000000
--- a/android/app/src/com/android/bluetooth/vc/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_leaudio
diff --git a/android/app/tests/OWNERS b/android/app/tests/OWNERS
deleted file mode 100644
index ecd59038a1..0000000000
--- a/android/app/tests/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_automotive
diff --git a/android/app/tests/instrumentation/com/android/bluetooth/btservice/AdapterServiceTest.java b/android/app/tests/instrumentation/com/android/bluetooth/btservice/AdapterServiceTest.java
index 768c62ee34..33dd02ef1f 100644
--- a/android/app/tests/instrumentation/com/android/bluetooth/btservice/AdapterServiceTest.java
+++ b/android/app/tests/instrumentation/com/android/bluetooth/btservice/AdapterServiceTest.java
@@ -97,6 +97,7 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
+/** Test cases for {@link AdapterService}. */
@MediumTest
@RunWith(ParameterizedAndroidJunit4.class)
public class AdapterServiceTest {
diff --git a/android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppBtEnableActivityTest.java b/android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppBtEnableActivityTest.java
index 23b8b132f3..98af642bfd 100644
--- a/android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppBtEnableActivityTest.java
+++ b/android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppBtEnableActivityTest.java
@@ -47,6 +47,7 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
+/** Test cases for {@link BluetoothOppBtEnableActivity}. */
public class BluetoothOppBtEnableActivityTest {
Intent mIntent;
diff --git a/android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppBtEnablingActivityTest.java b/android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppBtEnablingActivityTest.java
index d31d579e47..0a7003909d 100644
--- a/android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppBtEnablingActivityTest.java
+++ b/android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppBtEnablingActivityTest.java
@@ -51,6 +51,7 @@ import org.mockito.Spy;
import java.util.concurrent.atomic.AtomicBoolean;
+/** Test cases for {@link BluetoothOppBtEnablingActivity}. */
@RunWith(AndroidJUnit4.class)
public class BluetoothOppBtEnablingActivityTest {
@Rule public final MockitoRule mMockitoRule = new MockitoRule();
diff --git a/android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppLauncherActivityTest.java b/android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppLauncherActivityTest.java
index 7bb7bbfbc3..3e656d6169 100644
--- a/android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppLauncherActivityTest.java
+++ b/android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppLauncherActivityTest.java
@@ -74,6 +74,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+/** Test cases for {@link BluetoothOppLauncherActivity}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class BluetoothOppLauncherActivityTest {
diff --git a/android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppServiceCleanupTest.java b/android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppServiceCleanupTest.java
index a1cb6e8fa9..7d72d8fc1e 100644
--- a/android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppServiceCleanupTest.java
+++ b/android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppServiceCleanupTest.java
@@ -36,6 +36,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
+/** Test cases for {@link BluetoothOppServiceCleanup}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class BluetoothOppServiceCleanupTest {
diff --git a/android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppUtilityTest.java b/android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppUtilityTest.java
index 92423c17ea..c27d16d8f8 100644
--- a/android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppUtilityTest.java
+++ b/android/app/tests/instrumentation/com/android/bluetooth/opp/BluetoothOppUtilityTest.java
@@ -35,6 +35,7 @@ import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Spy;
+/** Test cases for {@link BluetoothOppUtility}. */
public class BluetoothOppUtilityTest {
@Rule public final MockitoRule mMockitoRule = new MockitoRule();
diff --git a/android/app/tests/instrumentation/com/android/bluetooth/opp/IncomingFileConfirmActivityTest.java b/android/app/tests/instrumentation/com/android/bluetooth/opp/IncomingFileConfirmActivityTest.java
index 473b55c3e0..305fc53fc7 100644
--- a/android/app/tests/instrumentation/com/android/bluetooth/opp/IncomingFileConfirmActivityTest.java
+++ b/android/app/tests/instrumentation/com/android/bluetooth/opp/IncomingFileConfirmActivityTest.java
@@ -69,6 +69,7 @@ import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
// Long class name cause problem with Junit4. It will raise java.lang.NoClassDefFoundError
+/** Test cases for {@link BluetoothOppIncomingFileConfirmActivity}. */
@RunWith(AndroidJUnit4.class)
public class IncomingFileConfirmActivityTest {
@Rule public final MockitoRule mMockitoRule = new MockitoRule();
diff --git a/android/app/tests/instrumentation/com/android/bluetooth/pbap/BluetoothPbapActivityTest.java b/android/app/tests/instrumentation/com/android/bluetooth/pbap/BluetoothPbapActivityTest.java
index 09316dbc78..acd8a49077 100644
--- a/android/app/tests/instrumentation/com/android/bluetooth/pbap/BluetoothPbapActivityTest.java
+++ b/android/app/tests/instrumentation/com/android/bluetooth/pbap/BluetoothPbapActivityTest.java
@@ -55,6 +55,7 @@ import org.junit.runner.RunWith;
import java.util.concurrent.atomic.AtomicBoolean;
+/** Test cases for {@link BluetoothPbapActivity}. */
@LargeTest
@RunWith(AndroidJUnit4.class)
public class BluetoothPbapActivityTest {
diff --git a/android/app/tests/instrumentation/com/android/bluetooth/telephony/CallInfoTest.java b/android/app/tests/instrumentation/com/android/bluetooth/telephony/CallInfoTest.java
index 18a4b4d053..f407f971d5 100644
--- a/android/app/tests/instrumentation/com/android/bluetooth/telephony/CallInfoTest.java
+++ b/android/app/tests/instrumentation/com/android/bluetooth/telephony/CallInfoTest.java
@@ -52,6 +52,7 @@ import java.util.LinkedHashSet;
import java.util.List;
import java.util.UUID;
+/** Test cases for {@link CallInfo}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class CallInfoTest {
diff --git a/android/app/tests/unit/Android.bp b/android/app/tests/unit/Android.bp
index a5b7dc36c8..6bf4f72d9f 100644
--- a/android/app/tests/unit/Android.bp
+++ b/android/app/tests/unit/Android.bp
@@ -69,7 +69,7 @@ android_test {
"src/**/*.kt",
],
jacoco: {
- include_filter: ["android.bluetooth.*"],
+ include_filter: ["com.android.bluetooth.*"],
exclude_filter: [],
},
diff --git a/android/app/tests/unit/src/com/android/bluetooth/OWNERS b/android/app/tests/unit/src/com/android/bluetooth/OWNERS
deleted file mode 100644
index 621eaef441..0000000000
--- a/android/app/tests/unit/src/com/android/bluetooth/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-# MessageQueue-related classes
-per-file TestLooper.java = mfasheh@google.com, shayba@google.com \ No newline at end of file
diff --git a/android/app/tests/unit/src/com/android/bluetooth/ObexAppParametersTest.java b/android/app/tests/unit/src/com/android/bluetooth/ObexAppParametersTest.java
index 1166a4ae10..dec896c409 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/ObexAppParametersTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/ObexAppParametersTest.java
@@ -30,6 +30,7 @@ import org.junit.runner.RunWith;
import java.nio.ByteBuffer;
import java.util.Arrays;
+/** Test cases for {@link ObexAppParameters}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class ObexAppParametersTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/SignedLongLongTest.java b/android/app/tests/unit/src/com/android/bluetooth/SignedLongLongTest.java
index 00b4306532..e473bc2d5a 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/SignedLongLongTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/SignedLongLongTest.java
@@ -25,7 +25,7 @@ import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
-/** Test for SignedLongLong.java */
+/** Test cases for {@link SignedLongLong}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class SignedLongLongTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpCodecConfigTest.java b/android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpCodecConfigTest.java
index 8f5dd839ae..5476f25186 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpCodecConfigTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpCodecConfigTest.java
@@ -44,6 +44,7 @@ import org.mockito.Mock;
import java.util.Arrays;
+/** Test cases for {@link A2dpCodecConfig}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class A2dpCodecConfigTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpServiceBinderTest.java b/android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpServiceBinderTest.java
index 65d00773ba..a754fe5376 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpServiceBinderTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpServiceBinderTest.java
@@ -46,7 +46,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-/** Test cases for {@link A2dpServiceBinder} */
+/** Test cases for {@link A2dpServiceBinder}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class A2dpServiceBinderTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpServiceTest.java
index b2fb43b362..4cfd988490 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpServiceTest.java
@@ -82,6 +82,7 @@ import java.time.Duration;
import java.util.Arrays;
import java.util.List;
+/** Test cases for {@link A2dpService}. */
@MediumTest
@RunWith(ParameterizedAndroidJunit4.class)
public class A2dpServiceTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpStateMachineTest.java b/android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpStateMachineTest.java
index c44094bd2c..72b776ed42 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpStateMachineTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpStateMachineTest.java
@@ -69,6 +69,7 @@ import org.mockito.hamcrest.MockitoHamcrest;
import java.util.Arrays;
+/** Test cases for {@link A2dpStateMachine}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class A2dpStateMachineTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/a2dpsink/A2dpSinkServiceBinderTest.java b/android/app/tests/unit/src/com/android/bluetooth/a2dpsink/A2dpSinkServiceBinderTest.java
index 6f7723caa9..bf2db08235 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/a2dpsink/A2dpSinkServiceBinderTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/a2dpsink/A2dpSinkServiceBinderTest.java
@@ -37,7 +37,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-/** Test cases for {@link A2dpSinkServiceBinder} */
+/** Test cases for {@link A2dpSinkServiceBinder}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class A2dpSinkServiceBinderTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/a2dpsink/A2dpSinkServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/a2dpsink/A2dpSinkServiceTest.java
index 8b108c65e5..d9b8bf0ede 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/a2dpsink/A2dpSinkServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/a2dpsink/A2dpSinkServiceTest.java
@@ -54,6 +54,7 @@ import org.mockito.Mock;
import java.util.ArrayList;
import java.util.List;
+/** Test cases for {@link A2dpSinkService}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class A2dpSinkServiceTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/a2dpsink/A2dpSinkStateMachineTest.java b/android/app/tests/unit/src/com/android/bluetooth/a2dpsink/A2dpSinkStateMachineTest.java
index 5641fbe7fc..c61300d7d2 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/a2dpsink/A2dpSinkStateMachineTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/a2dpsink/A2dpSinkStateMachineTest.java
@@ -48,6 +48,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
+/** Test cases for {@link A2dpSinkStateMachine}. */
@RunWith(AndroidJUnit4.class)
public class A2dpSinkStateMachineTest {
@Rule public final MockitoRule mMockitoRule = new MockitoRule();
diff --git a/android/app/tests/unit/src/com/android/bluetooth/a2dpsink/A2dpSinkStreamHandlerTest.java b/android/app/tests/unit/src/com/android/bluetooth/a2dpsink/A2dpSinkStreamHandlerTest.java
index 0870b09f51..afb9715fe0 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/a2dpsink/A2dpSinkStreamHandlerTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/a2dpsink/A2dpSinkStreamHandlerTest.java
@@ -49,6 +49,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
+/** Test cases for {@link A2dpSinkStreamHandler}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class A2dpSinkStreamHandlerTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/a2dpsink/StackEventTest.java b/android/app/tests/unit/src/com/android/bluetooth/a2dpsink/StackEventTest.java
index 5a0b67d77e..0057695df6 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/a2dpsink/StackEventTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/a2dpsink/StackEventTest.java
@@ -31,6 +31,7 @@ import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
+/** Test cases for {@link StackEvent}. */
@RunWith(AndroidJUnit4.class)
public class StackEventTest {
private final BluetoothDevice mDevice = getTestDevice(21);
diff --git a/android/app/tests/unit/src/com/android/bluetooth/audio_util/BrowsablePlayerConnectorTest.java b/android/app/tests/unit/src/com/android/bluetooth/audio_util/BrowsablePlayerConnectorTest.java
index 47109d6b16..63899b1004 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/audio_util/BrowsablePlayerConnectorTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/audio_util/BrowsablePlayerConnectorTest.java
@@ -47,6 +47,7 @@ import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
+/** Test cases for {@link BrowsablePlayerConnector}. */
@RunWith(AndroidJUnit4.class)
public final class BrowsablePlayerConnectorTest {
private static final int TIMEOUT_MS = 300;
diff --git a/android/app/tests/unit/src/com/android/bluetooth/audio_util/BrowserPlayerWrapperTest.java b/android/app/tests/unit/src/com/android/bluetooth/audio_util/BrowserPlayerWrapperTest.java
index 7d77021833..dfc3103acc 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/audio_util/BrowserPlayerWrapperTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/audio_util/BrowserPlayerWrapperTest.java
@@ -57,6 +57,7 @@ import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
+/** Test cases for {@link BrowserPlayerWrapper}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class BrowserPlayerWrapperTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/audio_util/GPMWrapperTest.java b/android/app/tests/unit/src/com/android/bluetooth/audio_util/GPMWrapperTest.java
index 74d63bddbf..261cea6c24 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/audio_util/GPMWrapperTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/audio_util/GPMWrapperTest.java
@@ -37,6 +37,7 @@ import org.junit.runner.RunWith;
import java.util.ArrayList;
import java.util.List;
+/** Test cases for {@link GPMWrapper}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class GPMWrapperTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/audio_util/ImageTest.java b/android/app/tests/unit/src/com/android/bluetooth/audio_util/ImageTest.java
index a74a0e7789..588c34d55b 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/audio_util/ImageTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/audio_util/ImageTest.java
@@ -49,6 +49,7 @@ import org.mockito.Mock;
import java.io.InputStream;
+/** Test cases for {@link Image}. */
@RunWith(AndroidJUnit4.class)
public class ImageTest {
private Context mTargetContext;
diff --git a/android/app/tests/unit/src/com/android/bluetooth/audio_util/MediaPlayerListTest.java b/android/app/tests/unit/src/com/android/bluetooth/audio_util/MediaPlayerListTest.java
index c7d5458ca2..1eb7960fe8 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/audio_util/MediaPlayerListTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/audio_util/MediaPlayerListTest.java
@@ -49,6 +49,7 @@ import org.mockito.Mock;
import java.util.ArrayList;
+/** Test cases for {@link MediaPlayerList}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class MediaPlayerListTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/audio_util/MediaPlayerWrapperTest.java b/android/app/tests/unit/src/com/android/bluetooth/audio_util/MediaPlayerWrapperTest.java
index ca7d227747..0a2991cecf 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/audio_util/MediaPlayerWrapperTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/audio_util/MediaPlayerWrapperTest.java
@@ -54,6 +54,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+/** Test cases for {@link MediaPlayerWrapper}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class MediaPlayerWrapperTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/audio_util/MetadataTest.java b/android/app/tests/unit/src/com/android/bluetooth/audio_util/MetadataTest.java
index b0ac35637d..fafeb1e459 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/audio_util/MetadataTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/audio_util/MetadataTest.java
@@ -51,6 +51,7 @@ import org.mockito.Mock;
import java.io.InputStream;
+/** Test cases for {@link Metadata}. */
@RunWith(AndroidJUnit4.class)
public class MetadataTest {
private Context mTargetContext;
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpBipObexServerTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpBipObexServerTest.java
index d67e19ee60..d8e35e3eef 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpBipObexServerTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpBipObexServerTest.java
@@ -47,6 +47,7 @@ import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
+/** Test cases for {@link AvrcpBipObexServer}. */
@RunWith(AndroidJUnit4.class)
public class AvrcpBipObexServerTest {
private static final String TYPE_GET_LINKED_THUMBNAIL = "x-bt/img-thm";
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpCoverArtStorageTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpCoverArtStorageTest.java
index 46e24db940..6655ead6ac 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpCoverArtStorageTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpCoverArtStorageTest.java
@@ -35,6 +35,7 @@ import org.junit.runner.RunWith;
import java.io.InputStream;
+/** Test cases for {@link AvrcpCoverArtStorage}. */
@RunWith(AndroidJUnit4.class)
public class AvrcpCoverArtStorageTest {
private Resources mTestResources;
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpPassthroughTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpPassthroughTest.java
index 8dbaf5833b..0876c4ae55 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpPassthroughTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpPassthroughTest.java
@@ -9,6 +9,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
+/** Test cases for {@link AvrcpPassthrough}. */
@RunWith(JUnit4.class)
public final class AvrcpPassthroughTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpTargetServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpTargetServiceTest.java
index 1111e05af7..42ff54db9a 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpTargetServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpTargetServiceTest.java
@@ -59,6 +59,7 @@ import org.mockito.Mock;
import java.util.ArrayList;
import java.util.List;
+/** Test cases for {@link AvrcpTargetService}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class AvrcpTargetServiceTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpVolumeManagerTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpVolumeManagerTest.java
index 4ce83f3a56..dee01695ba 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpVolumeManagerTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcp/AvrcpVolumeManagerTest.java
@@ -47,6 +47,7 @@ import org.junit.rules.TestName;
import org.junit.runner.RunWith;
import org.mockito.Mock;
+/** Test cases for {@link AvrcpVolumeManager}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class AvrcpVolumeManagerTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcp/CoverArtTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcp/CoverArtTest.java
index 1312a589aa..11631341ac 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcp/CoverArtTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcp/CoverArtTest.java
@@ -42,6 +42,7 @@ import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.Arrays;
+/** Test cases for {@link CoverArt}. */
@RunWith(AndroidJUnit4.class)
public class CoverArtTest {
private Resources mTestResources;
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpBipClientTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpBipClientTest.java
index 16360b5cce..9276985e84 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpBipClientTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpBipClientTest.java
@@ -42,6 +42,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
+/** Test cases for {@link AvrcpBipClient}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class AvrcpBipClientTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerNativeInterfaceTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerNativeInterfaceTest.java
index 6364c499a4..6c2841efe7 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerNativeInterfaceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerNativeInterfaceTest.java
@@ -25,6 +25,7 @@ import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
+/** Test cases for {@link AvrcpControllerNativeInterface}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class AvrcpControllerNativeInterfaceTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerServiceBinderTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerServiceBinderTest.java
index efd371dfdd..e994e5bb0d 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerServiceBinderTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerServiceBinderTest.java
@@ -24,6 +24,7 @@ import static com.android.bluetooth.TestUtils.getTestDevice;
import static org.mockito.Mockito.verify;
import android.bluetooth.BluetoothDevice;
+import android.content.AttributionSource;
import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;
@@ -34,7 +35,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-/** Test cases for {@link AvrcpControllerServiceBinder} */
+/** Test cases for {@link AvrcpControllerServiceBinder}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class AvrcpControllerServiceBinderTest {
@@ -43,6 +44,7 @@ public class AvrcpControllerServiceBinderTest {
@Mock private AvrcpControllerService mService;
+ private final AttributionSource mAttributionSource = new AttributionSource.Builder(1).build();
private final BluetoothDevice mDevice = getTestDevice(49);
private AvrcpControllerServiceBinder mBinder;
@@ -54,7 +56,7 @@ public class AvrcpControllerServiceBinderTest {
@Test
public void getConnectedDevices_callsServiceMethod() {
- mBinder.getConnectedDevices(null);
+ mBinder.getConnectedDevices(mAttributionSource);
verify(mService).getConnectedDevices();
}
@@ -62,24 +64,24 @@ public class AvrcpControllerServiceBinderTest {
public void getDevicesMatchingConnectionStates_callsServiceMethod() {
int[] states = new int[] {STATE_CONNECTED};
- mBinder.getDevicesMatchingConnectionStates(states, null);
+ mBinder.getDevicesMatchingConnectionStates(states, mAttributionSource);
verify(mService).getDevicesMatchingConnectionStates(states);
}
@Test
public void getConnectionState_callsServiceMethod() {
- mBinder.getConnectionState(mDevice, null);
+ mBinder.getConnectionState(mDevice, mAttributionSource);
verify(mService).getConnectionState(mDevice);
}
@Test
public void sendGroupNavigationCmd_notImplemented_doesNothing() {
- mBinder.sendGroupNavigationCmd(mDevice, 1, 2, null);
+ mBinder.sendGroupNavigationCmd(mDevice, 1, 2, mAttributionSource);
}
@Test
public void getPlayerSettings_notImplemented_doesNothing() {
- mBinder.getPlayerSettings(mDevice, null);
+ mBinder.getPlayerSettings(mDevice, mAttributionSource);
}
@Test
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerServiceTest.java
index ee46a1accd..abed5c7f6b 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerServiceTest.java
@@ -62,6 +62,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+/** Test cases for {@link AvrcpControllerService}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class AvrcpControllerServiceTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachineTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachineTest.java
index 43688601fe..76bc1c60de 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachineTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachineTest.java
@@ -68,6 +68,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
+/** Test cases for {@link AvrcpControllerStateMachine}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class AvrcpControllerStateMachineTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpCoverArtProviderTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpCoverArtProviderTest.java
index b2fbbe132f..5fb2c5edfa 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpCoverArtProviderTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpCoverArtProviderTest.java
@@ -38,6 +38,7 @@ import org.mockito.Mock;
import java.io.FileNotFoundException;
+/** Test cases for {@link AvrcpCoverArtProvider}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class AvrcpCoverArtProviderTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpCoverArtStorageTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpCoverArtStorageTest.java
index 33aa418fda..1e23a27ae8 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpCoverArtStorageTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpCoverArtStorageTest.java
@@ -39,7 +39,7 @@ import org.junit.runner.RunWith;
import java.io.InputStream;
-/** A test suite for the AvrcpCoverArtStorage class. */
+/** Test cases for {@link AvrcpCoverArtStorage}. */
@RunWith(AndroidJUnit4.class)
public final class AvrcpCoverArtStorageTest {
private final Context mTargetContext =
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpItemTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpItemTest.java
index 40c03dd0ae..a11423a34c 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpItemTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpItemTest.java
@@ -33,7 +33,7 @@ import com.google.common.testing.EqualsTester;
import org.junit.Test;
import org.junit.runner.RunWith;
-/** A test suite for the AvrcpItem class. */
+/** Test cases for {@link AvrcpItem}. */
@RunWith(AndroidJUnit4.class)
public final class AvrcpItemTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpPlayerTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpPlayerTest.java
index 95d12cb2a1..e7794c8077 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpPlayerTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpPlayerTest.java
@@ -31,6 +31,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.mockito.Mock;
+/** Test cases for {@link AvrcpPlayer}. */
public class AvrcpPlayerTest {
@Rule public final MockitoRule mMockitoRule = new MockitoRule();
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/BrowseNodeTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/BrowseNodeTest.java
index aa06d75c77..d978cecccf 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/BrowseNodeTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/BrowseNodeTest.java
@@ -40,6 +40,7 @@ import org.junit.runner.RunWith;
import java.util.ArrayList;
import java.util.List;
+/** Test cases for {@link BrowseNode}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class BrowseNodeTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/BrowseTreeTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/BrowseTreeTest.java
index 5d359d1ef4..0439478842 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/BrowseTreeTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/BrowseTreeTest.java
@@ -28,6 +28,7 @@ import org.junit.Test;
import java.util.Set;
+/** Test cases for {@link BrowseTree}. */
public class BrowseTreeTest {
private static final String ILLEGAL_ID = "illegal_id";
private static final String TEST_HANDLE = "test_handle";
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/PlayerApplicationSettingsTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/PlayerApplicationSettingsTest.java
index a106f6e97f..17dca38977 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/PlayerApplicationSettingsTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/PlayerApplicationSettingsTest.java
@@ -26,6 +26,7 @@ import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
+/** Test cases for {@link PlayerApplicationSettings}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class PlayerApplicationSettingsTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/StackEventTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/StackEventTest.java
index ded802cbb7..005e96d4e2 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/StackEventTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/StackEventTest.java
@@ -24,6 +24,7 @@ import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
+/** Test cases for {@link StackEvent}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class StackEventTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipAttachmentFormatTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipAttachmentFormatTest.java
index 68b06e5c95..bc3873aee7 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipAttachmentFormatTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipAttachmentFormatTest.java
@@ -31,7 +31,7 @@ import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
-/** A test suite for the BipAttachmentFormat class */
+/** Test cases for {@link BipAttachmentFormat}. */
@RunWith(AndroidJUnit4.class)
public class BipAttachmentFormatTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipDatetimeTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipDatetimeTest.java
index abdee02e65..025abaa8ec 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipDatetimeTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipDatetimeTest.java
@@ -32,7 +32,7 @@ import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
-/** A test suite for the BipDateTime class */
+/** Test cases for {@link BipDatetime}. */
@RunWith(AndroidJUnit4.class)
public class BipDatetimeTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipEncodingTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipEncodingTest.java
index dd6c498679..0c637f6777 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipEncodingTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipEncodingTest.java
@@ -23,7 +23,7 @@ import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
-/** A test suite for the BipEncoding class */
+/** Test cases for {@link BipEncoding}. */
@RunWith(AndroidJUnit4.class)
public class BipEncodingTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipImageDescriptorTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipImageDescriptorTest.java
index 0d87190643..75ac3ac536 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipImageDescriptorTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipImageDescriptorTest.java
@@ -25,7 +25,7 @@ import com.google.common.testing.EqualsTester;
import org.junit.Test;
import org.junit.runner.RunWith;
-/** A test suite for the BipImageDescriptor class */
+/** Test cases for {@link BipImageDescriptor}. */
@RunWith(AndroidJUnit4.class)
public class BipImageDescriptorTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipImageFormatTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipImageFormatTest.java
index 2ee0bda8bb..4fb29f0699 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipImageFormatTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipImageFormatTest.java
@@ -25,7 +25,7 @@ import com.google.common.testing.EqualsTester;
import org.junit.Test;
import org.junit.runner.RunWith;
-/** A test suite for the BipImageFormat class */
+/** Test cases for {@link BipImageFormat}. */
@RunWith(AndroidJUnit4.class)
public class BipImageFormatTest {
@Test
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipImagePropertiesTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipImagePropertiesTest.java
index a1c9829273..e8cd024158 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipImagePropertiesTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipImagePropertiesTest.java
@@ -27,7 +27,7 @@ import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
-/** A test suite for the BipImageProperties class */
+/** Test cases for {@link BipImageProperties}. */
@RunWith(AndroidJUnit4.class)
public class BipImagePropertiesTest {
private static final String IMAGE_HANDLE = "123456789";
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipImageTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipImageTest.java
index ca98f02d21..b4d81ca7f9 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipImageTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipImageTest.java
@@ -33,7 +33,7 @@ import org.junit.runner.RunWith;
import java.io.InputStream;
-/** A test suite for the BipImage class */
+/** Test cases for {@link BipImage}. */
@RunWith(AndroidJUnit4.class)
public class BipImageTest {
private static final String sImageHandle = "123456789";
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipPixelTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipPixelTest.java
index 1f47f0c606..51df561043 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipPixelTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipPixelTest.java
@@ -23,7 +23,7 @@ import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
-/** A test suite for the BipPixel class */
+/** Test cases for {@link BipPixel}. */
@RunWith(AndroidJUnit4.class)
public class BipPixelTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipTransformationTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipTransformationTest.java
index 7d5eb5a986..bfaa399881 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipTransformationTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipTransformationTest.java
@@ -23,7 +23,7 @@ import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
-/** A test suite for the BipTransformation class */
+/** Test cases for {@link BipTransformation}. */
@RunWith(AndroidJUnit4.class)
public class BipTransformationTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/RequestGetImagePropertiesTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/RequestGetImagePropertiesTest.java
index 9633aa4f95..2ad0923cb2 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/RequestGetImagePropertiesTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/RequestGetImagePropertiesTest.java
@@ -24,6 +24,7 @@ import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
+/** Test cases for {@link RequestGetImageProperties}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class RequestGetImagePropertiesTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/RequestGetImageTest.java b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/RequestGetImageTest.java
index 4d5ca54dfb..f1e4b1f001 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/RequestGetImageTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/RequestGetImageTest.java
@@ -24,6 +24,7 @@ import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
+/** Test cases for {@link RequestGetImage}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class RequestGetImageTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/bas/BatteryServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/bas/BatteryServiceTest.java
index 84c9640524..f12a91f276 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/bas/BatteryServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/bas/BatteryServiceTest.java
@@ -54,6 +54,7 @@ import org.mockito.Mock;
import java.util.List;
+/** Test cases for {@link BatteryService}. */
@MediumTest
@RunWith(JUnit4.class)
public class BatteryServiceTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/bas/BatteryStateMachineTest.java b/android/app/tests/unit/src/com/android/bluetooth/bas/BatteryStateMachineTest.java
index 5e439f826b..982400f2fb 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/bas/BatteryStateMachineTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/bas/BatteryStateMachineTest.java
@@ -50,6 +50,7 @@ import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.mockito.Mock;
+/** Test cases for {@link BatteryStateMachine}. */
@SmallTest
@RunWith(JUnit4.class)
public class BatteryStateMachineTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/bass_client/BaseDataTest.java b/android/app/tests/unit/src/com/android/bluetooth/bass_client/BaseDataTest.java
index c8305744e2..2b644a3853 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/bass_client/BaseDataTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/bass_client/BaseDataTest.java
@@ -28,6 +28,7 @@ import org.junit.runners.JUnit4;
import java.util.Random;
+/** Test cases for {@link BaseData}. */
@RunWith(JUnit4.class)
public class BaseDataTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/bass_client/BassClientServiceBinderTest.java b/android/app/tests/unit/src/com/android/bluetooth/bass_client/BassClientServiceBinderTest.java
index 584f0cdeea..84b34536d2 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/bass_client/BassClientServiceBinderTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/bass_client/BassClientServiceBinderTest.java
@@ -50,7 +50,7 @@ import org.mockito.Mockito;
import java.util.Collections;
import java.util.List;
-/** Test cases for {@link BassClientServiceBinder} */
+/** Test cases for {@link BassClientServiceBinder}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class BassClientServiceBinderTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/bass_client/BassClientServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/bass_client/BassClientServiceTest.java
index 464cb5c652..bbdc6bb9b1 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/bass_client/BassClientServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/bass_client/BassClientServiceTest.java
@@ -123,7 +123,7 @@ import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
-/** Tests for {@link BassClientService} */
+/** Test cases for {@link BassClientService}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class BassClientServiceTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/bass_client/BassClientStateMachineTest.java b/android/app/tests/unit/src/com/android/bluetooth/bass_client/BassClientStateMachineTest.java
index 6915785794..c0f21e18fb 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/bass_client/BassClientStateMachineTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/bass_client/BassClientStateMachineTest.java
@@ -130,6 +130,7 @@ import java.util.List;
import java.util.Random;
import java.util.UUID;
+/** Test cases for {@link BassClientStateMachine}. */
@MediumTest
@RunWith(JUnit4.class)
public class BassClientStateMachineTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/bass_client/OWNERS b/android/app/tests/unit/src/com/android/bluetooth/bass_client/OWNERS
deleted file mode 100644
index a7d77894ba..0000000000
--- a/android/app/tests/unit/src/com/android/bluetooth/bass_client/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_leaudio
diff --git a/android/app/tests/unit/src/com/android/bluetooth/bass_client/PeriodicAdvertisementResultTest.java b/android/app/tests/unit/src/com/android/bluetooth/bass_client/PeriodicAdvertisementResultTest.java
index d7d0605fb5..bec7426b66 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/bass_client/PeriodicAdvertisementResultTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/bass_client/PeriodicAdvertisementResultTest.java
@@ -29,6 +29,7 @@ import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
+/** Test cases for {@link PeriodicAdvertisementResult}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class PeriodicAdvertisementResultTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/bass_client/PublicBroadcastDataTest.java b/android/app/tests/unit/src/com/android/bluetooth/bass_client/PublicBroadcastDataTest.java
index 48c2b7935c..422225a419 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/bass_client/PublicBroadcastDataTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/bass_client/PublicBroadcastDataTest.java
@@ -28,6 +28,7 @@ import org.junit.runners.JUnit4;
import java.util.Random;
+/** Test cases for {@link PublicBroadcastData}. */
@RunWith(JUnit4.class)
public class PublicBroadcastDataTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/btservice/ActiveDeviceManagerTest.java b/android/app/tests/unit/src/com/android/bluetooth/btservice/ActiveDeviceManagerTest.java
index 55dddd2cf2..29ea7be622 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/btservice/ActiveDeviceManagerTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/btservice/ActiveDeviceManagerTest.java
@@ -83,6 +83,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
+/** Test cases for {@link ActiveDeviceManager}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class ActiveDeviceManagerTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterPropertiesTest.java b/android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterPropertiesTest.java
index db3a61cb3a..8699768543 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterPropertiesTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterPropertiesTest.java
@@ -44,6 +44,7 @@ import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
+/** Test cases for {@link AdapterProperties}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class AdapterPropertiesTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterServiceBinderTest.java b/android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterServiceBinderTest.java
index 7e143a2851..dcf1aaf4bc 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterServiceBinderTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterServiceBinderTest.java
@@ -42,7 +42,7 @@ import org.mockito.Mockito;
import java.io.FileDescriptor;
-/** Test cases for {@link AdapterServiceBinder} */
+/** Test cases for {@link AdapterServiceBinder}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class AdapterServiceBinderTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterServiceTest.java
index a9e01b3086..6c7b1ed44e 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterServiceTest.java
@@ -907,10 +907,6 @@ public class AdapterServiceTest {
// Create device properties
RemoteDevices remoteDevices = mAdapterService.getRemoteDevices();
remoteDevices.addDeviceProperties(Utils.getBytesFromAddress((TEST_BT_ADDR_1)));
- String identityAddress = mAdapterService.getIdentityAddress(TEST_BT_ADDR_1);
- if (!Flags.identityAddressNullIfNotKnown()) {
- assertThat(identityAddress).isEqualTo(TEST_BT_ADDR_1);
- }
// Trigger address consolidate callback
remoteDevices.addressConsolidateCallback(
@@ -918,7 +914,7 @@ public class AdapterServiceTest {
Utils.getBytesFromAddress(TEST_BT_ADDR_2));
// Verify we can get correct identity address
- identityAddress = mAdapterService.getIdentityAddress(TEST_BT_ADDR_1);
+ String identityAddress = mAdapterService.getIdentityAddress(TEST_BT_ADDR_1);
assertThat(identityAddress).isEqualTo(TEST_BT_ADDR_2);
assertThat(mLooper.nextMessage()).isNull();
}
@@ -955,7 +951,6 @@ public class AdapterServiceTest {
}
@Test
- @EnableFlags(Flags.FLAG_IDENTITY_ADDRESS_NULL_IF_NOT_KNOWN)
public void testIdentityAddressNullIfUnknown() {
BluetoothDevice device = getTestDevice(0);
diff --git a/android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterSuspendTest.java b/android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterSuspendTest.java
index bc86ce8ee1..ee866721a5 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterSuspendTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterSuspendTest.java
@@ -41,6 +41,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
+/** Test cases for {@link AdapterSuspend}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class AdapterSuspendTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/btservice/BondStateMachineTest.java b/android/app/tests/unit/src/com/android/bluetooth/btservice/BondStateMachineTest.java
index f420ffb43f..c08eaa32e4 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/btservice/BondStateMachineTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/btservice/BondStateMachineTest.java
@@ -49,6 +49,7 @@ import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
+/** Test cases for {@link BondStateMachine}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class BondStateMachineTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/btservice/CompanionManagerTest.java b/android/app/tests/unit/src/com/android/bluetooth/btservice/CompanionManagerTest.java
index bea6e8ea6d..72b5389982 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/btservice/CompanionManagerTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/btservice/CompanionManagerTest.java
@@ -40,6 +40,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
+/** Test cases for {@link CompanionManager}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class CompanionManagerTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/btservice/ConfigTest.java b/android/app/tests/unit/src/com/android/bluetooth/btservice/ConfigTest.java
index 704234cf1e..e338d8b9df 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/btservice/ConfigTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/btservice/ConfigTest.java
@@ -26,6 +26,7 @@ import org.junit.runners.JUnit4;
import java.util.Arrays;
+/** Test cases for {@link Config}. */
@RunWith(JUnit4.class)
public final class ConfigTest {
@Test
diff --git a/android/app/tests/unit/src/com/android/bluetooth/btservice/DataMigrationTest.java b/android/app/tests/unit/src/com/android/bluetooth/btservice/DataMigrationTest.java
index ec8bfd09be..2b7a5d26b9 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/btservice/DataMigrationTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/btservice/DataMigrationTest.java
@@ -61,6 +61,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+/** Test cases for {@link DataMigration}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class DataMigrationTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/btservice/MetricsLoggerTest.java b/android/app/tests/unit/src/com/android/bluetooth/btservice/MetricsLoggerTest.java
index ae3db21382..54e986d93d 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/btservice/MetricsLoggerTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/btservice/MetricsLoggerTest.java
@@ -58,7 +58,7 @@ import java.time.ZoneId;
import java.util.HashMap;
import java.util.Map;
-/** Unit tests for {@link MetricsLogger} */
+/** Test cases for {@link MetricsLogger}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class MetricsLoggerTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/btservice/PhonePolicyTest.java b/android/app/tests/unit/src/com/android/bluetooth/btservice/PhonePolicyTest.java
index 28188621a0..068379dfe4 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/btservice/PhonePolicyTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/btservice/PhonePolicyTest.java
@@ -80,6 +80,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+/** Test cases for {@link PhonePolicy}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class PhonePolicyTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/btservice/ProfileServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/btservice/ProfileServiceTest.java
index 960374ddae..1a1b2258ce 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/btservice/ProfileServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/btservice/ProfileServiceTest.java
@@ -65,6 +65,7 @@ import java.util.Map;
import java.util.concurrent.FutureTask;
import java.util.stream.Collectors;
+/** Test cases for {@link ProfileService}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class ProfileServiceTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/btservice/RemoteDevicesTest.java b/android/app/tests/unit/src/com/android/bluetooth/btservice/RemoteDevicesTest.java
index 4a261c1b06..2f50505082 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/btservice/RemoteDevicesTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/btservice/RemoteDevicesTest.java
@@ -57,6 +57,7 @@ import org.mockito.hamcrest.MockitoHamcrest;
import java.util.ArrayList;
+/** Test cases for {@link RemoteDevices}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class RemoteDevicesTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/btservice/SilenceDeviceManagerTest.java b/android/app/tests/unit/src/com/android/bluetooth/btservice/SilenceDeviceManagerTest.java
index 8cbf61d8d8..a5a87971fb 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/btservice/SilenceDeviceManagerTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/btservice/SilenceDeviceManagerTest.java
@@ -49,6 +49,7 @@ import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
+/** Test cases for {@link SilenceDeviceManager}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class SilenceDeviceManagerTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/btservice/bluetoothKeystore/BluetoothKeystoreServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/btservice/bluetoothKeystore/BluetoothKeystoreServiceTest.java
index 0b3cc08343..3047b07016 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/btservice/bluetoothKeystore/BluetoothKeystoreServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/btservice/bluetoothKeystore/BluetoothKeystoreServiceTest.java
@@ -42,6 +42,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+/** Test cases for {@link BluetoothKeystoreService}. */
@RunWith(JUnit4.class)
public final class BluetoothKeystoreServiceTest {
private static final String TAG = BluetoothKeystoreServiceTest.class.getSimpleName();
diff --git a/android/app/tests/unit/src/com/android/bluetooth/btservice/storage/AudioPolicyEntityTest.java b/android/app/tests/unit/src/com/android/bluetooth/btservice/storage/AudioPolicyEntityTest.java
index 317153b64b..87c102438f 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/btservice/storage/AudioPolicyEntityTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/btservice/storage/AudioPolicyEntityTest.java
@@ -24,6 +24,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
+/** Test cases for {@link AudioPolicyEntity}. */
@RunWith(JUnit4.class)
public final class AudioPolicyEntityTest {
@Test
diff --git a/android/app/tests/unit/src/com/android/bluetooth/btservice/storage/DatabaseManagerTest.java b/android/app/tests/unit/src/com/android/bluetooth/btservice/storage/DatabaseManagerTest.java
index 21449beaf5..f3adb8244b 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/btservice/storage/DatabaseManagerTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/btservice/storage/DatabaseManagerTest.java
@@ -73,6 +73,7 @@ import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
+/** Test cases for {@link DatabaseManager}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public final class DatabaseManagerTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/content_profiles/ContentProfileErrorReportUtilsTest.java b/android/app/tests/unit/src/com/android/bluetooth/content_profiles/ContentProfileErrorReportUtilsTest.java
index e682e9af17..2a86f1291e 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/content_profiles/ContentProfileErrorReportUtilsTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/content_profiles/ContentProfileErrorReportUtilsTest.java
@@ -25,6 +25,7 @@ import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
+/** Test cases for {@link ContentProfileErrorReportUtils}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class ContentProfileErrorReportUtilsTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/content_profiles/OWNERS b/android/app/tests/unit/src/com/android/bluetooth/content_profiles/OWNERS
deleted file mode 100644
index 8f87191393..0000000000
--- a/android/app/tests/unit/src/com/android/bluetooth/content_profiles/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_content \ No newline at end of file
diff --git a/android/app/tests/unit/src/com/android/bluetooth/csip/CsipSetCoordinatorServiceBinderTest.java b/android/app/tests/unit/src/com/android/bluetooth/csip/CsipSetCoordinatorServiceBinderTest.java
index 81adae18f4..916fe65f2f 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/csip/CsipSetCoordinatorServiceBinderTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/csip/CsipSetCoordinatorServiceBinderTest.java
@@ -39,7 +39,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-/** Test cases for {@link CsipSetCoordinatorServiceBinder} */
+/** Test cases for {@link CsipSetCoordinatorServiceBinder}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class CsipSetCoordinatorServiceBinderTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/csip/CsipSetCoordinatorServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/csip/CsipSetCoordinatorServiceTest.java
index 72fbd125b6..80d06fc4c4 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/csip/CsipSetCoordinatorServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/csip/CsipSetCoordinatorServiceTest.java
@@ -82,6 +82,7 @@ import org.mockito.hamcrest.MockitoHamcrest;
import java.util.List;
import java.util.UUID;
+/** Test cases for {@link CsipSetCoordinatorService}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class CsipSetCoordinatorServiceTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/csip/CsipSetCoordinatorStateMachineTest.java b/android/app/tests/unit/src/com/android/bluetooth/csip/CsipSetCoordinatorStateMachineTest.java
index 4c9cd6fb5e..339bb318be 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/csip/CsipSetCoordinatorStateMachineTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/csip/CsipSetCoordinatorStateMachineTest.java
@@ -51,6 +51,7 @@ import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.Mockito;
+/** Test cases for {@link CsipSetCoordinatorStateMachine}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class CsipSetCoordinatorStateMachineTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/csip/OWNERS b/android/app/tests/unit/src/com/android/bluetooth/csip/OWNERS
deleted file mode 100644
index a7d77894ba..0000000000
--- a/android/app/tests/unit/src/com/android/bluetooth/csip/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_leaudio
diff --git a/android/app/tests/unit/src/com/android/bluetooth/gatt/AdvertiseBinderTest.kt b/android/app/tests/unit/src/com/android/bluetooth/gatt/AdvertiseBinderTest.kt
index 6b038678f0..467c5e9815 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/gatt/AdvertiseBinderTest.kt
+++ b/android/app/tests/unit/src/com/android/bluetooth/gatt/AdvertiseBinderTest.kt
@@ -37,7 +37,7 @@ import org.mockito.Mockito.mock
import org.mockito.Mockito.verify
import org.mockito.kotlin.whenever
-/** Test cases for [AdvertiseBinder] */
+/** Test cases for [AdvertiseBinder]. */
@SmallTest
@RunWith(AndroidJUnit4::class)
class AdvertiseBinderTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/gatt/DistanceMeasurementBinderTest.kt b/android/app/tests/unit/src/com/android/bluetooth/gatt/DistanceMeasurementBinderTest.kt
index b20eda9a17..ac890b1ef5 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/gatt/DistanceMeasurementBinderTest.kt
+++ b/android/app/tests/unit/src/com/android/bluetooth/gatt/DistanceMeasurementBinderTest.kt
@@ -42,7 +42,7 @@ import org.mockito.Mockito.mock
import org.mockito.Mockito.verify
import org.mockito.kotlin.whenever
-/** Test cases for [DistanceMeasurementBinder] */
+/** Test cases for [DistanceMeasurementBinder]. */
@SmallTest
@RunWith(AndroidJUnit4::class)
class DistanceMeasurementBinderTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/gatt/GattServiceBinderTest.java b/android/app/tests/unit/src/com/android/bluetooth/gatt/GattServiceBinderTest.java
index f9bb1d556d..b956bec5cc 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/gatt/GattServiceBinderTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/gatt/GattServiceBinderTest.java
@@ -42,7 +42,7 @@ import org.mockito.Mock;
import java.util.UUID;
-/** Test cases for {@link GattServiceBinder} */
+/** Test cases for {@link GattServiceBinder}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class GattServiceBinderTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/gatt/GattServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/gatt/GattServiceTest.java
index 76d6dd53ff..1e8a55b994 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/gatt/GattServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/gatt/GattServiceTest.java
@@ -42,7 +42,6 @@ import android.content.res.Resources;
import android.location.LocationManager;
import android.os.Bundle;
import android.os.Process;
-import android.platform.test.flag.junit.SetFlagsRule;
import android.provider.Settings;
import android.test.mock.MockContentProvider;
import android.test.mock.MockContentResolver;
@@ -54,7 +53,6 @@ import androidx.test.runner.AndroidJUnit4;
import com.android.bluetooth.TestUtils;
import com.android.bluetooth.btservice.AdapterService;
import com.android.bluetooth.btservice.CompanionManager;
-import com.android.bluetooth.flags.Flags;
import com.android.bluetooth.le_scan.PeriodicScanManager;
import com.android.bluetooth.le_scan.ScanManager;
import com.android.bluetooth.le_scan.ScanObjectsFactory;
@@ -79,7 +77,6 @@ import java.util.UUID;
@RunWith(AndroidJUnit4.class)
public class GattServiceTest {
@Rule public final MockitoRule mMockitoRule = new MockitoRule();
- @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
@Mock private ContextMap<IBluetoothGattCallback> mClientMap;
@Mock private ScanManager mScanManager;
@@ -443,7 +440,6 @@ public class GattServiceTest {
@Test
public void registerClient_checkLimitPerApp() {
- mSetFlagsRule.enableFlags(Flags.FLAG_GATT_CLIENT_DYNAMIC_ALLOCATION);
doReturn(GattService.GATT_CLIENT_LIMIT_PER_APP).when(mClientMap).countByAppUid(anyInt());
UUID uuid = UUID.randomUUID();
IBluetoothGattCallback callback = mock(IBluetoothGattCallback.class);
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hap/HapClientNativeCallbackTest.java b/android/app/tests/unit/src/com/android/bluetooth/hap/HapClientNativeCallbackTest.java
index 5e1218b202..004051b041 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hap/HapClientNativeCallbackTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hap/HapClientNativeCallbackTest.java
@@ -35,6 +35,7 @@ import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
+/** Test cases for {@link HapClientNativeCallback}. */
public class HapClientNativeCallbackTest {
@Rule public final MockitoRule mMockitoRule = new MockitoRule();
@Rule public Expect expect = Expect.create();
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hap/HapClientServiceBinderTest.java b/android/app/tests/unit/src/com/android/bluetooth/hap/HapClientServiceBinderTest.java
index 3544578497..3178045545 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hap/HapClientServiceBinderTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hap/HapClientServiceBinderTest.java
@@ -44,7 +44,7 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
-/** Test cases for {@link HapClientServiceBinder} */
+/** Test cases for {@link HapClientServiceBinder}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class HapClientServiceBinderTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hap/HapClientServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/hap/HapClientServiceTest.java
index 045ed21e09..1cf197294b 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hap/HapClientServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hap/HapClientServiceTest.java
@@ -92,6 +92,7 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
+/** Test cases for {@link HapClientService}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class HapClientServiceTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hap/HapClientStackEventTest.java b/android/app/tests/unit/src/com/android/bluetooth/hap/HapClientStackEventTest.java
index 01a12b7a9b..1f40cec30e 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hap/HapClientStackEventTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hap/HapClientStackEventTest.java
@@ -22,6 +22,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
+/** Test cases for {@link HapClientStackEvent}. */
@RunWith(JUnit4.class)
public final class HapClientStackEventTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hap/HapClientStateMachineTest.java b/android/app/tests/unit/src/com/android/bluetooth/hap/HapClientStateMachineTest.java
index f953dc47ff..83bd1ee7d8 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hap/HapClientStateMachineTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hap/HapClientStateMachineTest.java
@@ -63,6 +63,7 @@ import org.mockito.InOrder;
import org.mockito.Mock;
import org.mockito.hamcrest.MockitoHamcrest;
+/** Test cases for {@link HapClientStateMachine}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class HapClientStateMachineTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hearingaid/HearingAidNativeInterfaceTest.java b/android/app/tests/unit/src/com/android/bluetooth/hearingaid/HearingAidNativeInterfaceTest.java
index 6b32743a7b..cf2e78e06a 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hearingaid/HearingAidNativeInterfaceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hearingaid/HearingAidNativeInterfaceTest.java
@@ -40,6 +40,7 @@ import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.Mockito;
+/** Test cases for {@link HearingAidNativeInterface}. */
public class HearingAidNativeInterfaceTest {
@Rule public final MockitoRule mMockitoRule = new MockitoRule();
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hearingaid/HearingAidServiceBinderTest.java b/android/app/tests/unit/src/com/android/bluetooth/hearingaid/HearingAidServiceBinderTest.java
index 8dae3bf594..ac740f3a16 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hearingaid/HearingAidServiceBinderTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hearingaid/HearingAidServiceBinderTest.java
@@ -46,7 +46,7 @@ import org.mockito.Mock;
import java.util.ArrayList;
import java.util.List;
-/** Test cases for {@link HearingAidServiceBinder} */
+/** Test cases for {@link HearingAidServiceBinder}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class HearingAidServiceBinderTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hearingaid/HearingAidServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/hearingaid/HearingAidServiceTest.java
index a284d6a414..760489f724 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hearingaid/HearingAidServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hearingaid/HearingAidServiceTest.java
@@ -80,6 +80,7 @@ import org.mockito.hamcrest.MockitoHamcrest;
import java.util.List;
+/** Test cases for {@link HearingAidService}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class HearingAidServiceTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hearingaid/HearingAidStateMachineTest.java b/android/app/tests/unit/src/com/android/bluetooth/hearingaid/HearingAidStateMachineTest.java
index 07cd5703ff..6511691991 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hearingaid/HearingAidStateMachineTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hearingaid/HearingAidStateMachineTest.java
@@ -57,6 +57,7 @@ import org.mockito.InOrder;
import org.mockito.Mock;
import org.mockito.hamcrest.MockitoHamcrest;
+/** Test cases for {@link HearingAidStateMachine}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class HearingAidStateMachineTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hearingaid/OWNERS b/android/app/tests/unit/src/com/android/bluetooth/hearingaid/OWNERS
deleted file mode 100644
index bbaa85ddbb..0000000000
--- a/android/app/tests/unit/src/com/android/bluetooth/hearingaid/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_hearingaid
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hfp/AtPhonebookTest.java b/android/app/tests/unit/src/com/android/bluetooth/hfp/AtPhonebookTest.java
index b54da60e79..1d7a9a2bdb 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hfp/AtPhonebookTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hfp/AtPhonebookTest.java
@@ -56,6 +56,7 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Spy;
+/** Test cases for {@link AtPhonebook}. */
@RunWith(AndroidJUnit4.class)
public class AtPhonebookTest {
@Rule public final MockitoRule mMockitoRule = new MockitoRule();
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetAgIndicatorEnableStateTest.java b/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetAgIndicatorEnableStateTest.java
index 8fa050b679..462182fe54 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetAgIndicatorEnableStateTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetAgIndicatorEnableStateTest.java
@@ -24,6 +24,7 @@ import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
+/** Test cases for {@link HeadsetAgIndicatorEnableState}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class HeadsetAgIndicatorEnableStateTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetClccResponseTest.java b/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetClccResponseTest.java
index 63e0f2632d..9350e3bc5c 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetClccResponseTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetClccResponseTest.java
@@ -24,6 +24,7 @@ import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
+/** Test cases for {@link HeadsetClccResponse}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class HeadsetClccResponseTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetPhoneStateTest.java b/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetPhoneStateTest.java
index edcf484239..0c808f1352 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetPhoneStateTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetPhoneStateTest.java
@@ -43,7 +43,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-/** Unit test to verify various methods in {@link HeadsetPhoneState} */
+/** Test cases for {@link HeadsetPhoneState}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class HeadsetPhoneStateTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetServiceAndStateMachineTest.java b/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetServiceAndStateMachineTest.java
index 835f03aaa2..4040b31d53 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetServiceAndStateMachineTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetServiceAndStateMachineTest.java
@@ -89,6 +89,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
+/** Test cases for {@link HeadsetServiceAndStateMachine}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class HeadsetServiceAndStateMachineTest {
@@ -490,7 +491,6 @@ public class HeadsetServiceAndStateMachineTest {
/** Test the value of isInbandRingingEnabled will be changed with the change of active device */
@Test
public void testIsInbandRingingEnabled_SwitchActiveDevice() {
- mSetFlagsRule.enableFlags(Flags.FLAG_UPDATE_ACTIVE_DEVICE_IN_BAND_RINGTONE);
BluetoothDevice device = getTestDevice(0);
connectTestDevice(device);
@@ -936,14 +936,8 @@ public class HeadsetServiceAndStateMachineTest {
BluetoothDevice deviceB = getTestDevice(1);
connectTestDevice(deviceB);
InOrder inOrder = inOrder(mNativeInterface);
- if (!Flags.updateActiveDeviceInBandRingtone()) {
- inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(true));
- inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false));
- inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false));
- } else {
- inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false));
- inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false));
- }
+ inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false));
+ inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false));
// Set active device to device B
assertThat(mHeadsetService.setActiveDevice(deviceB)).isTrue();
mTestLooper.dispatchAll();
@@ -1003,14 +997,8 @@ public class HeadsetServiceAndStateMachineTest {
connectTestDevice(deviceA);
BluetoothDevice deviceB = getTestDevice(1);
connectTestDevice(deviceB);
- if (!Flags.updateActiveDeviceInBandRingtone()) {
- inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(true));
- inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false));
- inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false));
- } else {
- inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false));
- inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false));
- }
+ inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false));
+ inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false));
// Set active device to device B
assertThat(mHeadsetService.setActiveDevice(deviceB)).isTrue();
mTestLooper.dispatchAll();
@@ -1070,14 +1058,8 @@ public class HeadsetServiceAndStateMachineTest {
BluetoothDevice deviceB = getTestDevice(1);
connectTestDevice(deviceB);
InOrder inOrder = inOrder(mNativeInterface);
- if (!Flags.updateActiveDeviceInBandRingtone()) {
- inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(true));
- inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false));
- inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false));
- } else {
- inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false));
- inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false));
- }
+ inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false));
+ inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false));
// Set active device to device B
assertThat(mHeadsetService.setActiveDevice(deviceB)).isTrue();
mTestLooper.dispatchAll();
@@ -1122,14 +1104,8 @@ public class HeadsetServiceAndStateMachineTest {
BluetoothDevice deviceB = getTestDevice(1);
connectTestDevice(deviceB);
InOrder inOrder = inOrder(mNativeInterface);
- if (!Flags.updateActiveDeviceInBandRingtone()) {
- inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(true));
- inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false));
- inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false));
- } else {
- inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false));
- inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false));
- }
+ inOrder.verify(mNativeInterface).sendBsir(eq(deviceA), eq(false));
+ inOrder.verify(mNativeInterface).sendBsir(eq(deviceB), eq(false));
// Set active device to device B
assertThat(mHeadsetService.setActiveDevice(deviceB)).isTrue();
mTestLooper.dispatchAll();
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetServiceBinderTest.java b/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetServiceBinderTest.java
index 73f3610505..efbbe34e56 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetServiceBinderTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetServiceBinderTest.java
@@ -36,7 +36,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-/** Test cases for {@link HeadsetServiceBinder} */
+/** Test cases for {@link HeadsetServiceBinder}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class HeadsetServiceBinderTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetServiceTest.java
index b16578c823..8526408a6d 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetServiceTest.java
@@ -84,7 +84,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Set;
-/** Tests for {@link HeadsetService} */
+/** Test cases for {@link HeadsetService}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class HeadsetServiceTest {
@@ -1247,7 +1247,6 @@ public class HeadsetServiceTest {
}
@Test
- @EnableFlags({Flags.FLAG_UPDATE_ACTIVE_DEVICE_IN_BAND_RINGTONE})
public void testIncomingCallDeviceConnect_InbandRingStatus() {
when(mDatabaseManager.getProfileConnectionPolicy(
any(BluetoothDevice.class), eq(BluetoothProfile.HEADSET)))
@@ -1269,7 +1268,6 @@ public class HeadsetServiceTest {
}
@Test
- @EnableFlags({Flags.FLAG_UPDATE_ACTIVE_DEVICE_IN_BAND_RINGTONE})
public void testIncomingCallWithDeviceAudioConnected() {
ArrayList<BluetoothDevice> connectedDevices = new ArrayList<>();
when(mDatabaseManager.getProfileConnectionPolicy(
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetStackEventTest.java b/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetStackEventTest.java
index d5f66da856..43e0d3d58e 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetStackEventTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetStackEventTest.java
@@ -28,6 +28,7 @@ import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
+/** Test cases for {@link HeadsetStackEvent}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class HeadsetStackEventTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetStateMachineTest.java b/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetStateMachineTest.java
index 68c17a10f8..529110f7d2 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetStateMachineTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetStateMachineTest.java
@@ -69,10 +69,12 @@ import com.android.bluetooth.TestUtils;
import com.android.bluetooth.Utils;
import com.android.bluetooth.btservice.ActiveDeviceManager;
import com.android.bluetooth.btservice.AdapterService;
+import com.android.bluetooth.btservice.PhonePolicy;
import com.android.bluetooth.btservice.RemoteDevices;
import com.android.bluetooth.btservice.SilenceDeviceManager;
import com.android.bluetooth.btservice.storage.DatabaseManager;
import com.android.bluetooth.flags.Flags;
+import com.android.bluetooth.util.SystemProperties;
import org.junit.After;
import org.junit.Before;
@@ -86,7 +88,7 @@ import org.mockito.Mockito;
import java.util.ArrayList;
-/** Tests for {@link HeadsetStateMachine} */
+/** Test cases for {@link HeadsetStateMachine}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class HeadsetStateMachineTest {
@@ -121,6 +123,7 @@ public class HeadsetStateMachineTest {
private MockContentResolver mMockContentResolver;
@Mock private HeadsetNativeInterface mNativeInterface;
@Mock private RemoteDevices mRemoteDevices;
+ @Mock private SystemProperties.MockableSystemProperties mProperties;
@Before
public void setUp() throws Exception {
@@ -175,6 +178,8 @@ public class HeadsetStateMachineTest {
mAdapterService,
mNativeInterface,
mSystemInterface);
+
+ SystemProperties.mProperties = mProperties;
}
@After
@@ -1765,6 +1770,49 @@ public class HeadsetStateMachineTest {
verify(mockAudioManager).setStreamVolume(AudioManager.STREAM_VOICE_CALL, 2, 0);
}
+ @RequiresFlagsEnabled(Flags.FLAG_HFP_VOLUME_CONTROL_PROPERTY)
+ @Test
+ public void testProcessVolumeEventAudioConnected_withVolumeControlEnabled_ShowUiFlagEnabled() {
+ doReturn(true)
+ .when(mProperties)
+ .getBoolean(eq(HeadsetStateMachine.HFP_VOLUME_CONTROL_ENABLED), anyBoolean());
+
+ setUpAudioOnState();
+
+ when(mHeadsetService.getActiveDevice()).thenReturn(mDevice);
+ AudioManager mockAudioManager = mock(AudioManager.class);
+ when(mockAudioManager.getStreamVolume(anyInt())).thenReturn(1);
+ when(mSystemInterface.getAudioManager()).thenReturn(mockAudioManager);
+
+ mHeadsetStateMachine.processVolumeEvent(HeadsetHalConstants.VOLUME_TYPE_SPK, 2);
+
+ var flagsCaptor = ArgumentCaptor.forClass(Integer.class);
+ verify(mockAudioManager).setStreamVolume(anyInt(), anyInt(), flagsCaptor.capture());
+ assertThat(flagsCaptor.getValue() & AudioManager.FLAG_SHOW_UI)
+ .isEqualTo(AudioManager.FLAG_SHOW_UI);
+ }
+
+ @RequiresFlagsEnabled(Flags.FLAG_HFP_VOLUME_CONTROL_PROPERTY)
+ @Test
+ public void testProcessVolumeEventAudioConnected_withVolumeControlEnabled_ShowUiFlagDisabled() {
+ doReturn(false)
+ .when(mProperties)
+ .getBoolean(eq(HeadsetStateMachine.HFP_VOLUME_CONTROL_ENABLED), anyBoolean());
+
+ setUpAudioOnState();
+
+ when(mHeadsetService.getActiveDevice()).thenReturn(mDevice);
+ AudioManager mockAudioManager = mock(AudioManager.class);
+ when(mockAudioManager.getStreamVolume(anyInt())).thenReturn(1);
+ when(mSystemInterface.getAudioManager()).thenReturn(mockAudioManager);
+
+ mHeadsetStateMachine.processVolumeEvent(HeadsetHalConstants.VOLUME_TYPE_SPK, 2);
+
+ var flagsCaptor = ArgumentCaptor.forClass(Integer.class);
+ verify(mockAudioManager).setStreamVolume(anyInt(), anyInt(), flagsCaptor.capture());
+ assertThat(flagsCaptor.getValue() & AudioManager.FLAG_SHOW_UI).isEqualTo(0);
+ }
+
@Test
public void testVolumeChangeEvent_fromIntentWhenAudioOn() {
setUpAudioOnState();
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetVendorSpecificResultCodeTest.java b/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetVendorSpecificResultCodeTest.java
index cfb1dea03c..8afc87f7ab 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetVendorSpecificResultCodeTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hfp/HeadsetVendorSpecificResultCodeTest.java
@@ -28,6 +28,7 @@ import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
+/** Test cases for {@link HeadsetVendorSpecificResultCode}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class HeadsetVendorSpecificResultCodeTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hfpclient/HeadsetClientServiceBinderTest.java b/android/app/tests/unit/src/com/android/bluetooth/hfpclient/HeadsetClientServiceBinderTest.java
index 3a1a31d085..ff08ed765a 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hfpclient/HeadsetClientServiceBinderTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hfpclient/HeadsetClientServiceBinderTest.java
@@ -25,6 +25,7 @@ import static com.android.bluetooth.TestUtils.getTestDevice;
import static org.mockito.Mockito.verify;
import android.bluetooth.BluetoothDevice;
+import android.content.AttributionSource;
import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;
@@ -35,7 +36,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-/** Test cases for {@link HeadsetClientServiceBinder} */
+/** Test cases for {@link HeadsetClientServiceBinder}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class HeadsetClientServiceBinderTest {
@@ -43,6 +44,7 @@ public class HeadsetClientServiceBinderTest {
@Mock private HeadsetClientService mService;
+ private final AttributionSource mAttributionSource = new AttributionSource.Builder(1).build();
private final BluetoothDevice mDevice = getTestDevice(54);
private HeadsetClientServiceBinder mBinder;
@@ -54,21 +56,21 @@ public class HeadsetClientServiceBinderTest {
@Test
public void connect_callsServiceMethod() {
- mBinder.connect(mDevice, null);
+ mBinder.connect(mDevice, mAttributionSource);
verify(mService).connect(mDevice);
}
@Test
public void disconnect_callsServiceMethod() {
- mBinder.disconnect(mDevice, null);
+ mBinder.disconnect(mDevice, mAttributionSource);
verify(mService).disconnect(mDevice);
}
@Test
public void getConnectedDevices_callsServiceMethod() {
- mBinder.getConnectedDevices(null);
+ mBinder.getConnectedDevices(mAttributionSource);
verify(mService).getConnectedDevices();
}
@@ -76,14 +78,14 @@ public class HeadsetClientServiceBinderTest {
@Test
public void getDevicesMatchingConnectionStates_callsServiceMethod() {
int[] states = new int[] {STATE_CONNECTED};
- mBinder.getDevicesMatchingConnectionStates(states, null);
+ mBinder.getDevicesMatchingConnectionStates(states, mAttributionSource);
verify(mService).getDevicesMatchingConnectionStates(states);
}
@Test
public void getConnectionState_callsServiceMethod() {
- mBinder.getConnectionState(mDevice, null);
+ mBinder.getConnectionState(mDevice, mAttributionSource);
verify(mService).getConnectionState(mDevice);
}
@@ -91,35 +93,35 @@ public class HeadsetClientServiceBinderTest {
@Test
public void setConnectionPolicy_callsServiceMethod() {
int connectionPolicy = CONNECTION_POLICY_ALLOWED;
- mBinder.setConnectionPolicy(mDevice, connectionPolicy, null);
+ mBinder.setConnectionPolicy(mDevice, connectionPolicy, mAttributionSource);
verify(mService).setConnectionPolicy(mDevice, connectionPolicy);
}
@Test
public void getConnectionPolicy_callsServiceMethod() {
- mBinder.getConnectionPolicy(mDevice, null);
+ mBinder.getConnectionPolicy(mDevice, mAttributionSource);
verify(mService).getConnectionPolicy(mDevice);
}
@Test
public void startVoiceRecognition_callsServiceMethod() {
- mBinder.startVoiceRecognition(mDevice, null);
+ mBinder.startVoiceRecognition(mDevice, mAttributionSource);
verify(mService).startVoiceRecognition(mDevice);
}
@Test
public void stopVoiceRecognition_callsServiceMethod() {
- mBinder.stopVoiceRecognition(mDevice, null);
+ mBinder.stopVoiceRecognition(mDevice, mAttributionSource);
verify(mService).stopVoiceRecognition(mDevice);
}
@Test
public void getAudioState_callsServiceMethod() {
- mBinder.getAudioState(mDevice, null);
+ mBinder.getAudioState(mDevice, mAttributionSource);
verify(mService).getAudioState(mDevice);
}
@@ -127,28 +129,28 @@ public class HeadsetClientServiceBinderTest {
@Test
public void setAudioRouteAllowed_callsServiceMethod() {
boolean allowed = true;
- mBinder.setAudioRouteAllowed(mDevice, allowed, null);
+ mBinder.setAudioRouteAllowed(mDevice, allowed, mAttributionSource);
verify(mService).setAudioRouteAllowed(mDevice, allowed);
}
@Test
public void getAudioRouteAllowed_callsServiceMethod() {
- mBinder.getAudioRouteAllowed(mDevice, null);
+ mBinder.getAudioRouteAllowed(mDevice, mAttributionSource);
verify(mService).getAudioRouteAllowed(mDevice);
}
@Test
public void connectAudio_callsServiceMethod() {
- mBinder.connectAudio(mDevice, null);
+ mBinder.connectAudio(mDevice, mAttributionSource);
verify(mService).connectAudio(mDevice);
}
@Test
public void disconnectAudio_callsServiceMethod() {
- mBinder.disconnectAudio(mDevice, null);
+ mBinder.disconnectAudio(mDevice, mAttributionSource);
verify(mService).disconnectAudio(mDevice);
}
@@ -156,35 +158,35 @@ public class HeadsetClientServiceBinderTest {
@Test
public void acceptCall_callsServiceMethod() {
int flag = 2;
- mBinder.acceptCall(mDevice, flag, null);
+ mBinder.acceptCall(mDevice, flag, mAttributionSource);
verify(mService).acceptCall(mDevice, flag);
}
@Test
public void rejectCall_callsServiceMethod() {
- mBinder.rejectCall(mDevice, null);
+ mBinder.rejectCall(mDevice, mAttributionSource);
verify(mService).rejectCall(mDevice);
}
@Test
public void holdCall_callsServiceMethod() {
- mBinder.holdCall(mDevice, null);
+ mBinder.holdCall(mDevice, mAttributionSource);
verify(mService).holdCall(mDevice);
}
@Test
public void terminateCall_callsServiceMethod() {
- mBinder.terminateCall(mDevice, null, null);
+ mBinder.terminateCall(mDevice, null, mAttributionSource);
verify(mService).terminateCall(mDevice, null);
}
@Test
public void explicitCallTransfer_callsServiceMethod() {
- mBinder.explicitCallTransfer(mDevice, null);
+ mBinder.explicitCallTransfer(mDevice, mAttributionSource);
verify(mService).explicitCallTransfer(mDevice);
}
@@ -192,7 +194,7 @@ public class HeadsetClientServiceBinderTest {
@Test
public void enterPrivateMode_callsServiceMethod() {
int index = 1;
- mBinder.enterPrivateMode(mDevice, index, null);
+ mBinder.enterPrivateMode(mDevice, index, mAttributionSource);
verify(mService).enterPrivateMode(mDevice, index);
}
@@ -200,7 +202,7 @@ public class HeadsetClientServiceBinderTest {
@Test
public void dial_callsServiceMethod() {
String number = "12532523";
- mBinder.dial(mDevice, number, null);
+ mBinder.dial(mDevice, number, mAttributionSource);
verify(mService).dial(mDevice, number);
}
@@ -208,21 +210,21 @@ public class HeadsetClientServiceBinderTest {
@Test
public void sendDTMF_callsServiceMethod() {
byte code = 21;
- mBinder.sendDTMF(mDevice, code, null);
+ mBinder.sendDTMF(mDevice, code, mAttributionSource);
verify(mService).sendDTMF(mDevice, code);
}
@Test
public void getLastVoiceTagNumber_callsServiceMethod() {
- mBinder.getLastVoiceTagNumber(mDevice, null);
+ mBinder.getLastVoiceTagNumber(mDevice, mAttributionSource);
verify(mService).getLastVoiceTagNumber(mDevice);
}
@Test
public void getCurrentAgEvents_callsServiceMethod() {
- mBinder.getCurrentAgEvents(mDevice, null);
+ mBinder.getCurrentAgEvents(mDevice, mAttributionSource);
verify(mService).getCurrentAgEvents(mDevice);
}
@@ -232,14 +234,14 @@ public class HeadsetClientServiceBinderTest {
int vendorId = 5;
String cmd = "test_command";
- mBinder.sendVendorAtCommand(mDevice, vendorId, cmd, null);
+ mBinder.sendVendorAtCommand(mDevice, vendorId, cmd, mAttributionSource);
verify(mService).sendVendorAtCommand(mDevice, vendorId, cmd);
}
@Test
public void getCurrentAgFeatures_callsServiceMethod() {
- mBinder.getCurrentAgFeatures(mDevice, null);
+ mBinder.getCurrentAgFeatures(mDevice, mAttributionSource);
verify(mService).getCurrentAgFeaturesBundle(mDevice);
}
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hfpclient/HeadsetClientServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/hfpclient/HeadsetClientServiceTest.java
index a8a81b0440..5e6eac9d11 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hfpclient/HeadsetClientServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hfpclient/HeadsetClientServiceTest.java
@@ -62,6 +62,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
+/** Test cases for {@link HeadsetClientService}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class HeadsetClientServiceTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachineTest.java b/android/app/tests/unit/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachineTest.java
index 7e47efeb4a..1395089d3f 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachineTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachineTest.java
@@ -84,6 +84,7 @@ import org.mockito.hamcrest.MockitoHamcrest;
import java.util.List;
import java.util.Set;
+/** Test cases for {@link HeadsetClientStateMachine}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class HeadsetClientStateMachineTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hfpclient/HfpNativeInterfaceTest.java b/android/app/tests/unit/src/com/android/bluetooth/hfpclient/HfpNativeInterfaceTest.java
index bd480693e8..681d98e56b 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hfpclient/HfpNativeInterfaceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hfpclient/HfpNativeInterfaceTest.java
@@ -33,6 +33,7 @@ import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
+/** Test cases for {@link HfpNativeInterface}. */
public class HfpNativeInterfaceTest {
private static final byte[] TEST_DEVICE_ADDRESS =
new byte[] {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hfpclient/StackEventTest.java b/android/app/tests/unit/src/com/android/bluetooth/hfpclient/StackEventTest.java
index cb397e29ec..350f332b58 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hfpclient/StackEventTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hfpclient/StackEventTest.java
@@ -26,6 +26,7 @@ import org.junit.runner.RunWith;
import java.lang.reflect.Field;
+/** Test cases for {@link StackEvent}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class StackEventTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hfpclient/VendorCommandResponseProcessorTest.java b/android/app/tests/unit/src/com/android/bluetooth/hfpclient/VendorCommandResponseProcessorTest.java
index 0c9522b05b..2b7ca8da47 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hfpclient/VendorCommandResponseProcessorTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hfpclient/VendorCommandResponseProcessorTest.java
@@ -39,6 +39,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
+/** Test cases for {@link VendorCommandResponseProcessor}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class VendorCommandResponseProcessorTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hfpclient/connserv/HeadsetClientServiceInterfaceTest.java b/android/app/tests/unit/src/com/android/bluetooth/hfpclient/connserv/HeadsetClientServiceInterfaceTest.java
index 11d5a02a56..86daa5adae 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hfpclient/connserv/HeadsetClientServiceInterfaceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hfpclient/connserv/HeadsetClientServiceInterfaceTest.java
@@ -39,6 +39,7 @@ import org.mockito.Mock;
import java.util.List;
import java.util.Set;
+/** Test cases for {@link HeadsetClientServiceInterface}. */
@RunWith(AndroidJUnit4.class)
public class HeadsetClientServiceInterfaceTest {
@Rule public final MockitoRule mMockitoRule = new MockitoRule();
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hfpclient/connserv/HfpClientCallTest.java b/android/app/tests/unit/src/com/android/bluetooth/hfpclient/connserv/HfpClientCallTest.java
index d622a00666..a0d622cf15 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hfpclient/connserv/HfpClientCallTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hfpclient/connserv/HfpClientCallTest.java
@@ -28,6 +28,7 @@ import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
+/** Test cases for {@link HfpClientCall}. */
@RunWith(AndroidJUnit4.class)
public class HfpClientCallTest {
private static final int TEST_ID = 0;
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hfpclient/connserv/HfpClientConnectionServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/hfpclient/connserv/HfpClientConnectionServiceTest.java
index d6cffe4f20..ba858947f1 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hfpclient/connserv/HfpClientConnectionServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hfpclient/connserv/HfpClientConnectionServiceTest.java
@@ -64,6 +64,7 @@ import org.mockito.Mock;
import java.util.Arrays;
import java.util.List;
+/** Test cases for {@link HfpClientConnectionService}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class HfpClientConnectionServiceTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hfpclient/connserv/HfpClientConnectionTest.java b/android/app/tests/unit/src/com/android/bluetooth/hfpclient/connserv/HfpClientConnectionTest.java
index 5423abf868..31a3a61073 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hfpclient/connserv/HfpClientConnectionTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hfpclient/connserv/HfpClientConnectionTest.java
@@ -46,6 +46,7 @@ import org.mockito.junit.MockitoJUnitRunner;
import java.util.Set;
+/** Test cases for {@link HfpClientConnection}. */
@MediumTest
@RunWith(MockitoJUnitRunner.class)
public class HfpClientConnectionTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hfpclient/connserv/HfpClientDeviceBlockTest.java b/android/app/tests/unit/src/com/android/bluetooth/hfpclient/connserv/HfpClientDeviceBlockTest.java
index 09178c30d5..85388f52a4 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hfpclient/connserv/HfpClientDeviceBlockTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hfpclient/connserv/HfpClientDeviceBlockTest.java
@@ -35,13 +35,13 @@ import androidx.test.filters.MediumTest;
import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
+/** Test cases for {@link HfpClientDeviceBlock}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class HfpClientDeviceBlockTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hid/HidDeviceNativeInterfaceTest.java b/android/app/tests/unit/src/com/android/bluetooth/hid/HidDeviceNativeInterfaceTest.java
index d393b8dc65..b67eadbdb8 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hid/HidDeviceNativeInterfaceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hid/HidDeviceNativeInterfaceTest.java
@@ -34,6 +34,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.mockito.Mock;
+/** Test cases for {@link HidDeviceNativeInterface}. */
public class HidDeviceNativeInterfaceTest {
private static final byte[] TEST_DEVICE_ADDRESS =
new byte[] {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hid/HidDeviceServiceBinderTest.java b/android/app/tests/unit/src/com/android/bluetooth/hid/HidDeviceServiceBinderTest.java
index 4369e85310..ad15865941 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hid/HidDeviceServiceBinderTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hid/HidDeviceServiceBinderTest.java
@@ -42,7 +42,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-/** Test cases for {@link HidDeviceServiceBinder} */
+/** Test cases for {@link HidDeviceServiceBinder}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class HidDeviceServiceBinderTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hid/HidDeviceServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/hid/HidDeviceServiceTest.java
index a242f054a7..cff2659d8a 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hid/HidDeviceServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hid/HidDeviceServiceTest.java
@@ -74,6 +74,7 @@ import org.mockito.InOrder;
import org.mockito.Mock;
import org.mockito.hamcrest.MockitoHamcrest;
+/** Test cases for {@link HidDeviceService}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class HidDeviceServiceTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hid/HidHostServiceBinderTest.java b/android/app/tests/unit/src/com/android/bluetooth/hid/HidHostServiceBinderTest.java
index e2b15ebdba..2c393118bb 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hid/HidHostServiceBinderTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hid/HidHostServiceBinderTest.java
@@ -25,6 +25,7 @@ import static com.android.bluetooth.TestUtils.getTestDevice;
import static org.mockito.Mockito.verify;
import android.bluetooth.BluetoothDevice;
+import android.content.AttributionSource;
import android.platform.test.flag.junit.SetFlagsRule;
import androidx.test.filters.SmallTest;
@@ -46,6 +47,7 @@ public class HidHostServiceBinderTest {
@Mock private HidHostService mService;
+ private final AttributionSource mAttributionSource = new AttributionSource.Builder(1).build();
private final BluetoothDevice mDevice = getTestDevice(50);
private HidHostServiceBinder mBinder;
@@ -57,19 +59,19 @@ public class HidHostServiceBinderTest {
@Test
public void connect_callsServiceMethod() {
- mBinder.connect(mDevice, null);
+ mBinder.connect(mDevice, mAttributionSource);
verify(mService).connect(mDevice);
}
@Test
public void disconnect_callsServiceMethod() {
- mBinder.disconnect(mDevice, null);
+ mBinder.disconnect(mDevice, mAttributionSource);
verify(mService).disconnect(mDevice);
}
@Test
public void getConnectedDevices_callsServiceMethod() {
- mBinder.getConnectedDevices(null);
+ mBinder.getConnectedDevices(mAttributionSource);
verify(mService).getDevicesMatchingConnectionStates(new int[] {STATE_CONNECTED});
}
@@ -77,13 +79,13 @@ public class HidHostServiceBinderTest {
public void getDevicesMatchingConnectionStates_callsServiceMethod() {
int[] states = new int[] {STATE_CONNECTED};
- mBinder.getDevicesMatchingConnectionStates(states, null);
+ mBinder.getDevicesMatchingConnectionStates(states, mAttributionSource);
verify(mService).getDevicesMatchingConnectionStates(states);
}
@Test
public void getConnectionState_callsServiceMethod() {
- mBinder.getConnectionState(mDevice, null);
+ mBinder.getConnectionState(mDevice, mAttributionSource);
verify(mService).getConnectionState(mDevice);
}
@@ -91,13 +93,13 @@ public class HidHostServiceBinderTest {
public void setConnectionPolicy_callsServiceMethod() {
int connectionPolicy = CONNECTION_POLICY_ALLOWED;
- mBinder.setConnectionPolicy(mDevice, connectionPolicy, null);
+ mBinder.setConnectionPolicy(mDevice, connectionPolicy, mAttributionSource);
verify(mService).setConnectionPolicy(mDevice, connectionPolicy);
}
@Test
public void getConnectionPolicy_callsServiceMethod() {
- mBinder.getConnectionPolicy(mDevice, null);
+ mBinder.getConnectionPolicy(mDevice, mAttributionSource);
verify(mService).getConnectionPolicy(mDevice);
}
@@ -105,25 +107,25 @@ public class HidHostServiceBinderTest {
public void setPreferredTransport_callsServiceMethod() {
int preferredTransport = BluetoothDevice.TRANSPORT_AUTO;
- mBinder.setPreferredTransport(mDevice, preferredTransport, null);
+ mBinder.setPreferredTransport(mDevice, preferredTransport, mAttributionSource);
verify(mService).setPreferredTransport(mDevice, preferredTransport);
}
@Test
public void getPreferredTransport_callsServiceMethod() {
- mBinder.getPreferredTransport(mDevice, null);
+ mBinder.getPreferredTransport(mDevice, mAttributionSource);
verify(mService).getPreferredTransport(mDevice);
}
@Test
public void getProtocolMode_callsServiceMethod() {
- mBinder.getProtocolMode(mDevice, null);
+ mBinder.getProtocolMode(mDevice, mAttributionSource);
verify(mService).getProtocolMode(mDevice);
}
@Test
public void virtualUnplug_callsServiceMethod() {
- mBinder.virtualUnplug(mDevice, null);
+ mBinder.virtualUnplug(mDevice, mAttributionSource);
verify(mService).virtualUnplug(mDevice);
}
@@ -131,7 +133,7 @@ public class HidHostServiceBinderTest {
public void setProtocolMode_callsServiceMethod() {
int protocolMode = 1;
- mBinder.setProtocolMode(mDevice, protocolMode, null);
+ mBinder.setProtocolMode(mDevice, protocolMode, mAttributionSource);
verify(mService).setProtocolMode(mDevice, protocolMode);
}
@@ -141,7 +143,7 @@ public class HidHostServiceBinderTest {
byte reportId = 2;
int bufferSize = 16;
- mBinder.getReport(mDevice, reportType, reportId, bufferSize, null);
+ mBinder.getReport(mDevice, reportType, reportId, bufferSize, mAttributionSource);
verify(mService).getReport(mDevice, reportType, reportId, bufferSize);
}
@@ -150,7 +152,7 @@ public class HidHostServiceBinderTest {
byte reportType = 1;
String report = "test_report";
- mBinder.setReport(mDevice, reportType, report, null);
+ mBinder.setReport(mDevice, reportType, report, mAttributionSource);
verify(mService).setReport(mDevice, reportType, report);
}
@@ -158,7 +160,7 @@ public class HidHostServiceBinderTest {
public void sendData_callsServiceMethod() {
String report = "test_report";
- mBinder.sendData(mDevice, report, null);
+ mBinder.sendData(mDevice, report, mAttributionSource);
verify(mService).sendData(mDevice, report);
}
@@ -166,13 +168,13 @@ public class HidHostServiceBinderTest {
public void setIdleTime_callsServiceMethod() {
byte idleTime = 1;
- mBinder.setIdleTime(mDevice, idleTime, null);
+ mBinder.setIdleTime(mDevice, idleTime, mAttributionSource);
verify(mService).setIdleTime(mDevice, idleTime);
}
@Test
public void getIdleTime_callsServiceMethod() {
- mBinder.getIdleTime(mDevice, null);
+ mBinder.getIdleTime(mDevice, mAttributionSource);
verify(mService).getIdleTime(mDevice);
}
diff --git a/android/app/tests/unit/src/com/android/bluetooth/hid/HidHostServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/hid/HidHostServiceTest.java
index 10f5f3257f..bc0d0167c0 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/hid/HidHostServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/hid/HidHostServiceTest.java
@@ -51,6 +51,7 @@ import org.mockito.Mock;
import java.util.List;
+/** Test cases for {@link HidHostService}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class HidHostServiceTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/le_audio/ContentControlIdKeeperTest.java b/android/app/tests/unit/src/com/android/bluetooth/le_audio/ContentControlIdKeeperTest.java
index 0fc41d3d0c..03f7fb345d 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/le_audio/ContentControlIdKeeperTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/le_audio/ContentControlIdKeeperTest.java
@@ -41,6 +41,7 @@ import org.mockito.Mock;
import java.util.Map;
import java.util.UUID;
+/** Test cases for {@link ContentControlIdKeeper}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class ContentControlIdKeeperTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioBroadcastServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioBroadcastServiceTest.java
index e1569ea836..5f3beeea95 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioBroadcastServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioBroadcastServiceTest.java
@@ -113,6 +113,7 @@ import org.mockito.hamcrest.MockitoHamcrest;
import java.util.ArrayList;
import java.util.List;
+/** Test cases for {@link LeAudioBroadcastService}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class LeAudioBroadcastServiceTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioBroadcasterNativeInterfaceTest.java b/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioBroadcasterNativeInterfaceTest.java
index f9c57e1494..c3dc110482 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioBroadcasterNativeInterfaceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioBroadcasterNativeInterfaceTest.java
@@ -35,6 +35,7 @@ import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
+/** Test cases for {@link LeAudioBroadcasterNativeInterface}. */
@RunWith(AndroidJUnit4.class)
public class LeAudioBroadcasterNativeInterfaceTest {
@Rule public final MockitoRule mMockitoRule = new MockitoRule();
diff --git a/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioNativeInterfaceTest.java b/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioNativeInterfaceTest.java
index 369304c608..978b2b192a 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioNativeInterfaceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioNativeInterfaceTest.java
@@ -36,6 +36,7 @@ import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
+/** Test cases for {@link LeAudioNativeInterface}. */
@RunWith(AndroidJUnit4.class)
public class LeAudioNativeInterfaceTest {
@Rule public final MockitoRule mMockitoRule = new MockitoRule();
diff --git a/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceBinderTest.java b/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceBinderTest.java
index 68677ffedb..623ced680c 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceBinderTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceBinderTest.java
@@ -48,7 +48,7 @@ import org.mockito.Mockito;
import java.util.UUID;
-/** Test cases for {@link LeAudioServiceBinder} */
+/** Test cases for {@link LeAudioServiceBinder}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class LeAudioServiceBinderTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceTest.java
index cf836ddc3c..b69b864bb4 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceTest.java
@@ -123,6 +123,7 @@ import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
+/** Test cases for {@link LeAudioService}. */
@MediumTest
@RunWith(ParameterizedAndroidJunit4.class)
public class LeAudioServiceTest {
@@ -210,8 +211,6 @@ public class LeAudioServiceTest {
public static List<FlagsParameterization> getParams() {
return FlagsParameterization.progressionOf(
Flags.FLAG_LEAUDIO_BROADCAST_PRIMARY_GROUP_SELECTION,
- Flags.FLAG_LEAUDIO_CODEC_CONFIG_CALLBACK_ORDER_FIX,
- Flags.FLAG_LEAUDIO_UNICAST_NO_AVAILABLE_CONTEXTS,
Flags.FLAG_LEAUDIO_BROADCAST_API_MANAGE_PRIMARY_GROUP,
Flags.FLAG_DO_NOT_HARDCODE_TMAP_ROLE_MASK);
}
@@ -1842,7 +1841,6 @@ public class LeAudioServiceTest {
/** Test native interface group status message handling */
@Test
- @EnableFlags(Flags.FLAG_LEAUDIO_CODEC_CONFIG_CALLBACK_ORDER_FIX)
public void testMessageFromNativeGroupCodecConfigChangedNonActiveDevice() {
onGroupCodecConfChangedCallbackCalled = false;
@@ -1928,7 +1926,6 @@ public class LeAudioServiceTest {
/** Test native interface group status message handling */
@Test
- @EnableFlags(Flags.FLAG_LEAUDIO_CODEC_CONFIG_CALLBACK_ORDER_FIX)
public void testMessageFromNativeGroupCodecConfigChangedActiveDevice_DifferentConfiguration() {
onGroupCodecConfChangedCallbackCalled = false;
@@ -2838,7 +2835,6 @@ public class LeAudioServiceTest {
* </pre>
*/
@Test
- @EnableFlags(Flags.FLAG_LEAUDIO_UNICAST_NO_AVAILABLE_CONTEXTS)
public void testActivateGroupWhenAvailableContextAreBack_Scenario1() {
int groupId = 1;
/* AUDIO_DIRECTION_OUTPUT_BIT = 0x01 */
@@ -2922,7 +2918,6 @@ public class LeAudioServiceTest {
* </pre>
*/
@Test
- @EnableFlags(Flags.FLAG_LEAUDIO_UNICAST_NO_AVAILABLE_CONTEXTS)
public void testActivateDeviceWhenAvailableContextAreBack_Scenario2() {
int groupId = 1;
/* AUDIO_DIRECTION_OUTPUT_BIT = 0x01 */
@@ -3020,7 +3015,6 @@ public class LeAudioServiceTest {
* 4. The available contexts are updated with non-zero value. Group becomes active.
*/
@Test
- @EnableFlags(Flags.FLAG_LEAUDIO_UNICAST_NO_AVAILABLE_CONTEXTS)
public void testActivateDeviceWhenAvailableContextAreBack_Scenario3() {
int groupId = 1;
/* AUDIO_DIRECTION_OUTPUT_BIT = 0x01 */
diff --git a/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioStateMachineTest.java b/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioStateMachineTest.java
index 3057a13b55..ad88d08b6e 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioStateMachineTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioStateMachineTest.java
@@ -58,6 +58,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
+/** Test cases for {@link LeAudioStateMachine}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class LeAudioStateMachineTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioTmapGattServerTest.java b/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioTmapGattServerTest.java
index abb4ddd7a7..a7955e76f9 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioTmapGattServerTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioTmapGattServerTest.java
@@ -44,6 +44,7 @@ import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
+/** Test cases for {@link LeAudioTmapGattServer}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class LeAudioTmapGattServerTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/le_audio/OWNERS b/android/app/tests/unit/src/com/android/bluetooth/le_audio/OWNERS
deleted file mode 100644
index a7d77894ba..0000000000
--- a/android/app/tests/unit/src/com/android/bluetooth/le_audio/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_leaudio
diff --git a/android/app/tests/unit/src/com/android/bluetooth/le_scan/MsftAdvMonitorTest.java b/android/app/tests/unit/src/com/android/bluetooth/le_scan/MsftAdvMonitorTest.java
index 6e396df67e..c717d7f013 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/le_scan/MsftAdvMonitorTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/le_scan/MsftAdvMonitorTest.java
@@ -25,6 +25,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
+/** Test cases for {@link MsftAdvMonitor}. */
@RunWith(JUnit4.class)
public final class MsftAdvMonitorTest {
private static final String TAG = MsftAdvMonitorTest.class.getSimpleName();
diff --git a/android/app/tests/unit/src/com/android/bluetooth/le_scan/ScanBinderTest.kt b/android/app/tests/unit/src/com/android/bluetooth/le_scan/ScanBinderTest.kt
index 3424c48a54..238b4c5b29 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/le_scan/ScanBinderTest.kt
+++ b/android/app/tests/unit/src/com/android/bluetooth/le_scan/ScanBinderTest.kt
@@ -39,7 +39,7 @@ import org.mockito.Mock
import org.mockito.Mockito.mock
import org.mockito.Mockito.verify
-/** Test cases for [ScanBinder] */
+/** Test cases for [ScanBinder]. */
@SmallTest
@RunWith(AndroidJUnit4::class)
class ScanBinderTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/le_scan/ScanClientTest.kt b/android/app/tests/unit/src/com/android/bluetooth/le_scan/ScanClientTest.kt
new file mode 100644
index 0000000000..3cff05a6fe
--- /dev/null
+++ b/android/app/tests/unit/src/com/android/bluetooth/le_scan/ScanClientTest.kt
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2025 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.bluetooth.le_scan
+
+import android.bluetooth.le.ScanFilter
+import android.bluetooth.le.ScanSettings
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import androidx.test.filters.SmallTest
+import com.google.common.testing.EqualsTester
+import com.google.common.truth.Truth.assertThat
+import org.junit.Test
+import org.junit.runner.RunWith
+
+/** Test cases for [ScanClient]. */
+@SmallTest
+@RunWith(AndroidJUnit4::class)
+class ScanClientTest {
+
+ private val scanClient = ScanClient(1)
+
+ @Test
+ fun constructor() {
+ val scanClientWithDefaultSettings = ScanClient(1)
+ assertThat(scanClientWithDefaultSettings.mSettings.scanMode)
+ .isEqualTo(ScanSettings.SCAN_MODE_LOW_LATENCY)
+ }
+
+ @Test
+ fun constructor_withFilters() {
+ val filters = listOf(ScanFilter.Builder().build())
+ val scanSettings = ScanSettings.Builder().build()
+ val scanClientWithFilters = ScanClient(1, scanSettings, filters)
+ assertThat(scanClientWithFilters.mFilters).isEqualTo(filters)
+ }
+
+ @Test
+ fun constructor_withAppUid() {
+ val appUid = 1234
+ val scanSettings = ScanSettings.Builder().build()
+ val scanClientWithAppUid = ScanClient(1, scanSettings, null, appUid)
+ assertThat(scanClientWithAppUid.mAppUid).isEqualTo(appUid)
+ }
+
+ @Test
+ fun equals() {
+ val scanSettings = ScanSettings.Builder().build()
+ EqualsTester()
+ .addEqualityGroup(
+ ScanClient(1, scanSettings, null),
+ ScanClient(1, scanSettings, null),
+ ScanClient(1, scanSettings, listOf(ScanFilter.Builder().build())),
+ ScanClient(1, scanSettings, null, 1234),
+ ScanClient(1, scanSettings, null, 5678),
+ )
+ .addEqualityGroup(ScanClient(2, scanSettings, null))
+ .testEquals()
+ }
+
+ @Test
+ fun toString_doesNotCrash() {
+ scanClient.toString()
+ }
+
+ @Test
+ fun updateScanMode() {
+ val newScanMode = ScanSettings.SCAN_MODE_BALANCED
+ val updated = scanClient.updateScanMode(newScanMode)
+ assertThat(updated).isTrue()
+ assertThat(scanClient.mSettings.scanMode).isEqualTo(newScanMode)
+
+ val sameScanMode = scanClient.mSettings.scanMode
+ val notUpdated = scanClient.updateScanMode(sameScanMode)
+ assertThat(notUpdated).isFalse()
+ assertThat(scanClient.mSettings.scanMode).isEqualTo(sameScanMode)
+ }
+}
diff --git a/android/app/tests/unit/src/com/android/bluetooth/le_scan/ScanControllerTest.java b/android/app/tests/unit/src/com/android/bluetooth/le_scan/ScanControllerTest.java
index f1d428906b..8b6ec0548d 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/le_scan/ScanControllerTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/le_scan/ScanControllerTest.java
@@ -19,6 +19,8 @@ package com.android.bluetooth.le_scan;
import static android.bluetooth.BluetoothProfile.STATE_CONNECTED;
import static android.bluetooth.BluetoothProfile.STATE_CONNECTING;
+import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
+
import static com.android.bluetooth.TestUtils.MockitoRule;
import static com.android.bluetooth.TestUtils.getTestDevice;
@@ -55,7 +57,6 @@ import android.platform.test.flag.junit.SetFlagsRule;
import androidx.test.filters.SmallTest;
import androidx.test.platform.app.InstrumentationRegistry;
-import com.android.bluetooth.TestLooper;
import com.android.bluetooth.TestUtils;
import com.android.bluetooth.btservice.AdapterService;
import com.android.bluetooth.btservice.CompanionManager;
@@ -79,23 +80,30 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
+import java.util.UUID;
/** Test cases for {@link ScanController}. */
@SmallTest
@RunWith(TestParameterInjector.class)
public class ScanControllerTest {
+
@Rule public final MockitoRule mMockitoRule = new MockitoRule();
@Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
- @Mock private ScannerMap mScannerMap;
- @Mock private ScannerMap.ScannerApp mApp;
- @Mock private PeriodicScanManager mPeriodicScanManager;
- @Mock private ScanManager mScanManager;
- @Mock private Resources mResources;
- @Mock private AdapterService mAdapterService;
@Mock private GattObjectsFactory mGattObjectsFactory;
@Mock private ScanObjectsFactory mScanObjectsFactory;
+ @Mock private AdapterService mAdapterService;
@Mock private GattNativeInterface mNativeInterface;
+ @Mock private PeriodicScanManager mPeriodicScanManager;
+ @Mock private Resources mResources;
+ @Mock private ScanManager mScanManager;
+ @Mock private ScannerMap mScannerMap;
+ @Mock private ScannerMap.ScannerApp mApp;
+
+ private static final int TEST_SCANNER_ID = 1;
+ private static final int TEST_STATUS = 0;
+ private static final int TEST_ACTION = 1;
+ private static final int TEST_CLIENT_IF = 2;
private final BluetoothAdapter mAdapter =
InstrumentationRegistry.getInstrumentation()
@@ -104,11 +112,10 @@ public class ScanControllerTest {
.getAdapter();
private final BluetoothDevice mDevice = getTestDevice(89);
private final AttributionSource mAttributionSource = mAdapter.getAttributionSource();
- private final Context mContext =
- InstrumentationRegistry.getInstrumentation().getTargetContext();
+ private final Context mContext = getInstrumentation().getTargetContext();
- private ScanController mScanController;
private CompanionManager mBtCompanionManager;
+ private ScanController mScanController;
@Before
public void setUp() throws Exception {
@@ -120,7 +127,6 @@ public class ScanControllerTest {
.when(mScanObjectsFactory)
.createScanManager(any(), any(), any(), any());
doReturn(mPeriodicScanManager).when(mScanObjectsFactory).createPeriodicScanManager();
-
doReturn(mResources).when(mAdapterService).getResources();
doReturn(mContext.getPackageManager()).when(mAdapterService).getPackageManager();
doReturn(mContext.getSharedPreferences("ScanControllerTest", Context.MODE_PRIVATE))
@@ -133,9 +139,6 @@ public class ScanControllerTest {
mBtCompanionManager = new CompanionManager(mAdapterService, null);
doReturn(mBtCompanionManager).when(mAdapterService).getCompanionManager();
- TestLooper testLooper = new TestLooper();
- testLooper.startAutoDispatch();
-
mScanController = new ScanController(mAdapterService);
mScanController.setScannerMap(mScannerMap);
}
@@ -143,183 +146,21 @@ public class ScanControllerTest {
@After
public void tearDown() throws Exception {
mScanController.cleanup();
-
GattObjectsFactory.setInstanceForTesting(null);
ScanObjectsFactory.setInstanceForTesting(null);
}
@Test
- public void testParseBatchTimestamp() {
- long timestampNanos = mScanController.parseTimestampNanos(new byte[] {-54, 7});
- assertThat(timestampNanos).isEqualTo(99700000000L);
- }
-
- @Test
- public void continuePiStartScan() {
- int scannerId = 1;
-
- ScanController.PendingIntentInfo pii =
- new ScanController.PendingIntentInfo(
- null, new ScanSettings.Builder().build(), null, null, 0);
- mApp.mInfo = pii;
-
- AppScanStats appScanStats = mock(AppScanStats.class);
- doReturn(appScanStats).when(mScannerMap).getAppScanStatsById(scannerId);
-
- mScanController.continuePiStartScan(scannerId, mApp);
-
- verify(appScanStats)
- .recordScanStart(pii.settings(), pii.filters(), false, false, scannerId, null);
- verify(mScanManager).startScan(any());
- }
-
- @Test
- public void continuePiStartScanCheckUid() {
- int scannerId = 1;
-
- ScanController.PendingIntentInfo pii =
- new ScanController.PendingIntentInfo(
- null, new ScanSettings.Builder().build(), null, null, 123);
- mApp.mInfo = pii;
-
- AppScanStats appScanStats = mock(AppScanStats.class);
- doReturn(appScanStats).when(mScannerMap).getAppScanStatsById(scannerId);
-
- mScanController.continuePiStartScan(scannerId, mApp);
-
- verify(appScanStats)
- .recordScanStart(pii.settings(), pii.filters(), false, false, scannerId, null);
+ public void notifyProfileConnectionStateChange_notify_scanManager() {
+ mScanController.notifyProfileConnectionStateChange(
+ BluetoothProfile.A2DP, STATE_CONNECTING, STATE_CONNECTED);
verify(mScanManager)
- .startScan(
- argThat(
- new ArgumentMatcher<ScanClient>() {
- @Override
- public boolean matches(ScanClient client) {
- return pii.callingUid() == client.mAppUid;
- }
- }));
- }
-
- @Test
- public void onBatchScanReportsInternal_deliverBatchScan_full(
- @TestParameter boolean expectResults) throws RemoteException {
- int status = 1;
- int scannerId = 2;
- int reportType = ScanManager.SCAN_RESULT_TYPE_FULL;
- int numRecords = 1;
- byte[] recordData =
- new byte[] {
- 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00
- };
-
- Set<ScanClient> scanClientSet = new HashSet<>();
- ScanClient scanClient = new ScanClient(scannerId);
- scanClient.mAssociatedDevices = new ArrayList<>();
- if (expectResults) {
- scanClient.mHasScanWithoutLocationPermission = true;
- }
- scanClientSet.add(scanClient);
- doReturn(scanClientSet).when(mScanManager).getFullBatchScanQueue();
- doReturn(mApp).when(mScannerMap).getById(scanClient.mScannerId);
- IScannerCallback callback = mock(IScannerCallback.class);
- mApp.mCallback = callback;
-
- mScanController.onBatchScanReportsInternal(
- status, scannerId, reportType, numRecords, recordData);
- verify(mScanManager).callbackDone(scannerId, status);
- if (expectResults) {
- verify(callback).onBatchScanResults(any());
- } else {
- verify(callback, never()).onBatchScanResults(any());
- }
- }
-
- @Test
- public void onBatchScanReportsInternal_deliverBatchScan_truncated(
- @TestParameter boolean expectResults) throws RemoteException {
- int status = 1;
- int scannerId = 2;
- int reportType = ScanManager.SCAN_RESULT_TYPE_TRUNCATED;
- int numRecords = 1;
- byte[] recordData =
- new byte[] {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x04, 0x02, 0x02, 0x00, 0x00, 0x02
- };
-
- Set<ScanClient> scanClientSet = new HashSet<>();
- ScanClient scanClient = new ScanClient(scannerId);
- scanClient.mAssociatedDevices = new ArrayList<>();
- if (expectResults) {
- scanClient.mAssociatedDevices.add("02:00:00:00:00:00");
- }
- scanClientSet.add(scanClient);
- doReturn(scanClientSet).when(mScanManager).getBatchScanQueue();
- doReturn(mApp).when(mScannerMap).getById(scanClient.mScannerId);
- IScannerCallback callback = mock(IScannerCallback.class);
- mApp.mCallback = callback;
-
- mScanController.onBatchScanReportsInternal(
- status, scannerId, reportType, numRecords, recordData);
- verify(mScanManager).callbackDone(scannerId, status);
- if (expectResults) {
- verify(callback).onBatchScanResults(any());
- } else {
- verify(callback, never()).onBatchScanResults(any());
- }
- }
-
- @Test
- public void enforceReportDelayFloor() {
- long reportDelayFloorHigher = ScanController.DEFAULT_REPORT_DELAY_FLOOR + 1;
- ScanSettings scanSettings =
- new ScanSettings.Builder().setReportDelay(reportDelayFloorHigher).build();
-
- ScanSettings newScanSettings = mScanController.enforceReportDelayFloor(scanSettings);
-
- assertThat(newScanSettings.getReportDelayMillis())
- .isEqualTo(scanSettings.getReportDelayMillis());
-
- ScanSettings scanSettingsFloor = new ScanSettings.Builder().setReportDelay(1).build();
-
- ScanSettings newScanSettingsFloor =
- mScanController.enforceReportDelayFloor(scanSettingsFloor);
-
- assertThat(newScanSettingsFloor.getReportDelayMillis())
- .isEqualTo(ScanController.DEFAULT_REPORT_DELAY_FLOOR);
- }
-
- @Test
- public void registerScanner() throws Exception {
- IScannerCallback callback = mock(IScannerCallback.class);
- WorkSource workSource = mock(WorkSource.class);
-
- AppScanStats appScanStats = mock(AppScanStats.class);
- doReturn(appScanStats).when(mScannerMap).getAppScanStatsByUid(Binder.getCallingUid());
-
- mScanController.registerScanner(callback, workSource, mAttributionSource);
- verify(mScannerMap)
- .add(
- any(),
- eq(mAttributionSource),
- eq(workSource),
- eq(callback),
- any(),
- eq(mScanController));
- verify(mScanManager).registerScanner(any());
- }
-
- @Test
- public void flushPendingBatchResults() {
- int scannerId = 3;
-
- mScanController.flushPendingBatchResults(scannerId, mAttributionSource);
- verify(mScanManager).flushBatchScanResults(new ScanClient(scannerId));
+ .handleBluetoothProfileConnectionStateChanged(
+ BluetoothProfile.A2DP, STATE_CONNECTING, STATE_CONNECTED);
}
@Test
public void onScanResult_remoteException_clientDied() throws Exception {
- int scannerId = 1;
-
int eventType = 0;
int addressType = 0;
String address = "02:00:00:00:00:00";
@@ -331,22 +172,19 @@ public class ScanControllerTest {
int periodicAdvInt = 0;
byte[] advData = new byte[0];
- ScanClient scanClient = new ScanClient(scannerId);
+ ScanClient scanClient = new ScanClient(TEST_SCANNER_ID);
scanClient.mHasNetworkSettingsPermission = true;
scanClient.mSettings =
new ScanSettings.Builder()
.setCallbackType(ScanSettings.CALLBACK_TYPE_ALL_MATCHES)
.setLegacy(false)
.build();
-
AppScanStats appScanStats = mock(AppScanStats.class);
IScannerCallback callback = mock(IScannerCallback.class);
-
mApp.mCallback = callback;
mApp.mAppScanStats = appScanStats;
scanClient.mStats = appScanStats;
Set<ScanClient> scanClientSet = Collections.singleton(scanClient);
-
doReturn(address).when(mAdapterService).getIdentityAddress(anyString());
doReturn(scanClientSet).when(mScanManager).getRegularScanQueue();
doReturn(mApp).when(mScannerMap).getById(scanClient.mScannerId);
@@ -369,66 +207,179 @@ public class ScanControllerTest {
address);
assertThat(scanClient.mAppDied).isTrue();
- verify(appScanStats).recordScanStop(scannerId);
+ verify(appScanStats).recordScanStop(TEST_SCANNER_ID);
}
@Test
- public void registerSync() {
- ScanResult scanResult = new ScanResult(mDevice, 1, 2, 3, 4, 5, 6, 7, null, 8);
- int skip = 1;
- int timeout = 2;
- IPeriodicAdvertisingCallback callback = mock(IPeriodicAdvertisingCallback.class);
+ public void onScannerRegistered_success_callback() throws RemoteException {
+ long uuidLsb = 12345L;
+ long uuidMsb = 67890L;
+ UUID uuid = new UUID(uuidMsb, uuidLsb);
+ IScannerCallback callback = mock(IScannerCallback.class);
+ mApp.mCallback = callback;
+ doReturn(mApp).when(mScannerMap).getByUuid(uuid);
- mScanController.registerSync(scanResult, skip, timeout, callback, mAttributionSource);
- verify(mPeriodicScanManager).startSync(scanResult, skip, timeout, callback);
+ mScanController.onScannerRegistered(TEST_STATUS, TEST_SCANNER_ID, uuidLsb, uuidMsb);
+
+ verify(mApp).linkToDeath(any());
+ verify(callback).onScannerRegistered(TEST_STATUS, TEST_SCANNER_ID);
+ assertThat(mApp.mId).isEqualTo(TEST_SCANNER_ID);
}
@Test
- public void transferSync() {
- int serviceData = 1;
- int syncHandle = 2;
+ public void onScanFilterEnableDisabled_callbackDone_scanManager() {
+ mScanController.onScanFilterEnableDisabled(TEST_ACTION, TEST_STATUS, TEST_CLIENT_IF);
+ verify(mScanManager).callbackDone(TEST_CLIENT_IF, TEST_STATUS);
+ }
- mScanController.transferSync(mDevice, serviceData, syncHandle, mAttributionSource);
- verify(mPeriodicScanManager).transferSync(mDevice, serviceData, syncHandle);
+ @Test
+ public void onScanFilterParamsConfigured_callbackDone_scanManager() {
+ int availableSpace = 3;
+
+ mScanController.onScanFilterParamsConfigured(
+ TEST_ACTION, TEST_STATUS, TEST_CLIENT_IF, availableSpace);
+ verify(mScanManager).callbackDone(TEST_CLIENT_IF, TEST_STATUS);
}
@Test
- public void transferSetInfo() {
- int serviceData = 1;
- int advHandle = 2;
- IPeriodicAdvertisingCallback callback = mock(IPeriodicAdvertisingCallback.class);
+ public void onScanFilterConfig_callbackDone_scanManager() {
+ int filterType = 3;
+ int availableSpace = 4;
- mScanController.transferSetInfo(
- mDevice, serviceData, advHandle, callback, mAttributionSource);
- verify(mPeriodicScanManager).transferSetInfo(mDevice, serviceData, advHandle, callback);
+ mScanController.onScanFilterConfig(
+ TEST_ACTION, TEST_STATUS, TEST_CLIENT_IF, filterType, availableSpace);
+ verify(mScanManager).callbackDone(TEST_CLIENT_IF, TEST_STATUS);
}
@Test
- public void unregisterSync() {
- IPeriodicAdvertisingCallback callback = mock(IPeriodicAdvertisingCallback.class);
+ public void onBatchScanStorageConfigured_callbackDone_scanManager() {
+ mScanController.onBatchScanStorageConfigured(TEST_STATUS, TEST_CLIENT_IF);
+ verify(mScanManager).callbackDone(TEST_CLIENT_IF, TEST_STATUS);
+ }
- mScanController.unregisterSync(callback, mAttributionSource);
- verify(mPeriodicScanManager).stopSync(callback);
+ @Test
+ public void onBatchScanStartStopped_callbackDone_scanManager() {
+ int startStopAction = 0;
+
+ mScanController.onBatchScanStartStopped(startStopAction, TEST_STATUS, TEST_CLIENT_IF);
+ verify(mScanManager).callbackDone(TEST_CLIENT_IF, TEST_STATUS);
}
@Test
- public void profileConnectionStateChanged_notifyScanManager() {
- mScanController.notifyProfileConnectionStateChange(
- BluetoothProfile.A2DP, STATE_CONNECTING, STATE_CONNECTED);
- verify(mScanManager)
- .handleBluetoothProfileConnectionStateChanged(
- BluetoothProfile.A2DP, STATE_CONNECTING, STATE_CONNECTED);
+ public void onBatchScanReportsInternal_deliverBatchScan(
+ @TestParameter boolean expectResults, @TestParameter boolean isTruncated)
+ throws RemoteException {
+ int reportType =
+ isTruncated
+ ? ScanManager.SCAN_RESULT_TYPE_TRUNCATED
+ : ScanManager.SCAN_RESULT_TYPE_FULL;
+ int numRecords = 1;
+ final byte[] recordData;
+ if (isTruncated) {
+ recordData =
+ new byte[] {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x04, 0x02, 0x02, 0x00, 0x00, 0x02
+ };
+ } else {
+ recordData =
+ new byte[] {
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00
+ };
+ }
+
+ Set<ScanClient> scanClientSet = new HashSet<>();
+ ScanClient scanClient = new ScanClient(TEST_SCANNER_ID);
+ scanClient.mAssociatedDevices = new ArrayList<>();
+ if (expectResults) {
+ if (isTruncated) {
+ scanClient.mAssociatedDevices.add("02:00:00:00:00:00");
+ } else {
+ scanClient.mHasScanWithoutLocationPermission = true;
+ }
+ }
+ scanClientSet.add(scanClient);
+ if (isTruncated) {
+ doReturn(scanClientSet).when(mScanManager).getBatchScanQueue();
+ } else {
+ doReturn(scanClientSet).when(mScanManager).getFullBatchScanQueue();
+ }
+ doReturn(mApp).when(mScannerMap).getById(scanClient.mScannerId);
+ IScannerCallback callback = mock(IScannerCallback.class);
+ mApp.mCallback = callback;
+
+ mScanController.onBatchScanReportsInternal(
+ TEST_STATUS, TEST_SCANNER_ID, reportType, numRecords, recordData);
+ verify(mScanManager).callbackDone(TEST_SCANNER_ID, TEST_STATUS);
+ if (expectResults) {
+ verify(callback).onBatchScanResults(any());
+ } else {
+ verify(callback, never()).onBatchScanResults(any());
+ }
}
@Test
- public void onTrackAdvFoundLost() throws Exception {
- int scannerId = 1;
+ public void parseTimestampNanos() {
+ long timestampNanos = mScanController.parseTimestampNanos(new byte[] {-54, 7});
+ assertThat(timestampNanos).isEqualTo(99700000000L);
+ }
+
+ @Test
+ public void createOnTrackAdvFoundLostObject() {
int advPacketLen = 1;
byte[] advPacket = new byte[] {0x02};
int scanResponseLen = 3;
byte[] scanResponse = new byte[] {0x04};
int filtIndex = 5;
+ int advState = ScanController.ADVT_STATE_ONFOUND;
+ int advInfoPresent = 7;
+ String address = "00:11:22:33:FF:EE";
+ int addrType = BluetoothDevice.ADDRESS_TYPE_RANDOM;
+ int txPower = 9;
+ int rssiValue = 10;
+ int timeStamp = 11;
+
+ AdvtFilterOnFoundOnLostInfo advtFilterOnFoundOnLostInfo =
+ new AdvtFilterOnFoundOnLostInfo(
+ TEST_SCANNER_ID,
+ advPacketLen,
+ ByteString.copyFrom(advPacket),
+ scanResponseLen,
+ ByteString.copyFrom(scanResponse),
+ filtIndex,
+ advState,
+ advInfoPresent,
+ address,
+ addrType,
+ txPower,
+ rssiValue,
+ timeStamp);
+ AdvtFilterOnFoundOnLostInfo advtFilterOnFoundOnLostInfoCreated =
+ mScanController.createOnTrackAdvFoundLostObject(
+ TEST_SCANNER_ID,
+ advPacketLen,
+ advPacket,
+ scanResponseLen,
+ scanResponse,
+ filtIndex,
+ advState,
+ advInfoPresent,
+ address,
+ addrType,
+ txPower,
+ rssiValue,
+ timeStamp);
+
+ assertThat(advtFilterOnFoundOnLostInfo).isEqualTo(advtFilterOnFoundOnLostInfoCreated);
+ }
+
+ @Test
+ public void onTrackAdvFoundLost() throws RemoteException {
+ int advPacketLen = 1;
+ byte[] advPacket = new byte[] {0x02};
+ int scanResponseLen = 3;
+ byte[] scanResponse = new byte[] {0x04};
+ int filtIndex = 5;
int advState = ScanController.ADVT_STATE_ONFOUND;
int advInfoPresent = 7;
String address = "00:11:22:33:FF:EE";
@@ -437,7 +388,7 @@ public class ScanControllerTest {
int rssiValue = 10;
int timeStamp = 11;
- ScanClient scanClient = new ScanClient(scannerId);
+ ScanClient scanClient = new ScanClient(TEST_SCANNER_ID);
scanClient.mHasNetworkSettingsPermission = true;
scanClient.mSettings =
new ScanSettings.Builder()
@@ -448,15 +399,14 @@ public class ScanControllerTest {
ScannerMap.ScannerApp app = mock(ScannerMap.ScannerApp.class);
IScannerCallback callback = mock(IScannerCallback.class);
-
app.mCallback = callback;
- doReturn(app).when(mScannerMap).getById(scannerId);
+ doReturn(app).when(mScannerMap).getById(TEST_SCANNER_ID);
doReturn(scanClientSet).when(mScanManager).getRegularScanQueue();
AdvtFilterOnFoundOnLostInfo advtFilterOnFoundOnLostInfo =
new AdvtFilterOnFoundOnLostInfo(
- scannerId,
+ TEST_SCANNER_ID,
advPacketLen,
ByteString.copyFrom(advPacket),
scanResponseLen,
@@ -477,4 +427,152 @@ public class ScanControllerTest {
assertThat(result.getValue().getDevice().getAddress()).isEqualTo(address);
assertThat(result.getValue().getDevice().getAddressType()).isEqualTo(addrType);
}
+
+ @Test
+ public void registerScanner() {
+ IScannerCallback callback = mock(IScannerCallback.class);
+ WorkSource workSource = mock(WorkSource.class);
+ AppScanStats appScanStats = mock(AppScanStats.class);
+ doReturn(appScanStats).when(mScannerMap).getAppScanStatsByUid(Binder.getCallingUid());
+
+ mScanController.registerScanner(callback, workSource, mAttributionSource);
+ verify(mScannerMap)
+ .add(
+ any(),
+ eq(mAttributionSource),
+ eq(workSource),
+ eq(callback),
+ any(),
+ eq(mScanController));
+ verify(mScanManager).registerScanner(any());
+ }
+
+ @Test
+ public void unregisterScanner() {
+ mScanController.unregisterScanner(TEST_SCANNER_ID, mAttributionSource);
+
+ verify(mScannerMap).remove(TEST_SCANNER_ID);
+ verify(mScanManager).unregisterScanner(TEST_SCANNER_ID);
+ }
+
+ @Test
+ public void continuePiStartScan() {
+ ScanController.PendingIntentInfo pii =
+ new ScanController.PendingIntentInfo(
+ null, new ScanSettings.Builder().build(), null, null, 0);
+ mApp.mInfo = pii;
+
+ AppScanStats appScanStats = mock(AppScanStats.class);
+ doReturn(appScanStats).when(mScannerMap).getAppScanStatsById(TEST_SCANNER_ID);
+
+ mScanController.continuePiStartScan(TEST_SCANNER_ID, mApp);
+
+ verify(appScanStats)
+ .recordScanStart(
+ pii.settings(), pii.filters(), false, false, TEST_SCANNER_ID, null);
+ verify(mScanManager).startScan(any());
+ }
+
+ @Test
+ public void continuePiStartScanCheckUid() {
+ ScanController.PendingIntentInfo pii =
+ new ScanController.PendingIntentInfo(
+ null, new ScanSettings.Builder().build(), null, null, 123);
+ mApp.mInfo = pii;
+
+ AppScanStats appScanStats = mock(AppScanStats.class);
+ doReturn(appScanStats).when(mScannerMap).getAppScanStatsById(TEST_SCANNER_ID);
+
+ mScanController.continuePiStartScan(TEST_SCANNER_ID, mApp);
+
+ verify(appScanStats)
+ .recordScanStart(
+ pii.settings(), pii.filters(), false, false, TEST_SCANNER_ID, null);
+ verify(mScanManager)
+ .startScan(
+ argThat(
+ new ArgumentMatcher<ScanClient>() {
+ @Override
+ public boolean matches(ScanClient client) {
+ return pii.callingUid() == client.mAppUid;
+ }
+ }));
+ }
+
+ @Test
+ public void flushPendingBatchResults() {
+ mScanController.flushPendingBatchResults(TEST_SCANNER_ID, mAttributionSource);
+ verify(mScanManager).flushBatchScanResults(new ScanClient(TEST_SCANNER_ID));
+ }
+
+ @Test
+ public void registerSync() {
+ ScanResult scanResult = new ScanResult(mDevice, 1, 2, 3, 4, 5, 6, 7, null, 8);
+ int skip = 1;
+ int timeout = 2;
+ IPeriodicAdvertisingCallback callback = mock(IPeriodicAdvertisingCallback.class);
+
+ mScanController.registerSync(scanResult, skip, timeout, callback, mAttributionSource);
+ verify(mPeriodicScanManager).startSync(scanResult, skip, timeout, callback);
+ }
+
+ @Test
+ public void unregisterSync() {
+ IPeriodicAdvertisingCallback callback = mock(IPeriodicAdvertisingCallback.class);
+
+ mScanController.unregisterSync(callback, mAttributionSource);
+ verify(mPeriodicScanManager).stopSync(callback);
+ }
+
+ @Test
+ public void transferSync() {
+ int serviceData = 1;
+ int syncHandle = 2;
+
+ mScanController.transferSync(mDevice, serviceData, syncHandle, mAttributionSource);
+ verify(mPeriodicScanManager).transferSync(mDevice, serviceData, syncHandle);
+ }
+
+ @Test
+ public void transferSetInfo() {
+ int serviceData = 1;
+ int advHandle = 2;
+ IPeriodicAdvertisingCallback callback = mock(IPeriodicAdvertisingCallback.class);
+
+ mScanController.transferSetInfo(
+ mDevice, serviceData, advHandle, callback, mAttributionSource);
+ verify(mPeriodicScanManager).transferSetInfo(mDevice, serviceData, advHandle, callback);
+ }
+
+ @Test
+ public void enforceReportDelayFloor() {
+ long reportDelayFloorHigher = ScanController.DEFAULT_REPORT_DELAY_FLOOR + 1;
+ ScanSettings scanSettings =
+ new ScanSettings.Builder().setReportDelay(reportDelayFloorHigher).build();
+ ScanSettings newScanSettings = mScanController.enforceReportDelayFloor(scanSettings);
+
+ assertThat(newScanSettings.getReportDelayMillis())
+ .isEqualTo(scanSettings.getReportDelayMillis());
+
+ ScanSettings scanSettingsFloor = new ScanSettings.Builder().setReportDelay(1).build();
+ ScanSettings newScanSettingsFloor =
+ mScanController.enforceReportDelayFloor(scanSettingsFloor);
+
+ assertThat(newScanSettingsFloor.getReportDelayMillis())
+ .isEqualTo(ScanController.DEFAULT_REPORT_DELAY_FLOOR);
+ }
+
+ @Test
+ public void dumpRegisterId_doesNotCrash() {
+ StringBuilder sb = new StringBuilder();
+ mScanController.dumpRegisterId(sb);
+ assertThat(sb.toString()).isNotNull();
+ }
+
+ @Test
+ public void dump_doesNotCrash() {
+ StringBuilder sb = new StringBuilder();
+ mScanController.dump(sb);
+ assertThat(sb.toString()).isNotNull();
+ }
}
diff --git a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapAccountItemTest.java b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapAccountItemTest.java
index 6e493ee6d5..64d6192271 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapAccountItemTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapAccountItemTest.java
@@ -26,6 +26,7 @@ import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
+/** Test cases for {@link BluetoothMapAccountItem}. */
@RunWith(AndroidJUnit4.class)
public class BluetoothMapAccountItemTest {
private static final String TEST_NAME = "test_name";
diff --git a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapAppParamsTest.java b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapAppParamsTest.java
index c0defe0c21..8803980264 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapAppParamsTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapAppParamsTest.java
@@ -30,6 +30,7 @@ import org.junit.runner.RunWith;
import java.nio.ByteBuffer;
+/** Test cases for {@link BluetoothMapAppParams}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class BluetoothMapAppParamsTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapContentObserverTest.java b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapContentObserverTest.java
index b131039e99..d17d1e0a85 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapContentObserverTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapContentObserverTest.java
@@ -74,6 +74,7 @@ import java.util.HashSet;
import java.util.Map;
import java.util.concurrent.TimeUnit;
+/** Test cases for {@link BluetoothMapContentObserver}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class BluetoothMapContentObserverTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapContentTest.java b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapContentTest.java
index b149953287..ae34c71782 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapContentTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapContentTest.java
@@ -68,6 +68,7 @@ import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.HashMap;
+/** Test cases for {@link BluetoothMapContent}. */
@RunWith(AndroidJUnit4.class)
public class BluetoothMapContentTest {
private static final String TEST_TEXT = "text";
diff --git a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapConvoContactElementTest.java b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapConvoContactElementTest.java
index 6e8f60f5ce..ed57d98121 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapConvoContactElementTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapConvoContactElementTest.java
@@ -34,6 +34,7 @@ import java.io.StringReader;
import java.io.StringWriter;
import java.text.SimpleDateFormat;
+/** Test cases for {@link BluetoothMapConvoContactElement}. */
@RunWith(AndroidJUnit4.class)
public class BluetoothMapConvoContactElementTest {
private static final String TEST_UCI = "test_bt_uci";
diff --git a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapConvoListingElementTest.java b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapConvoListingElementTest.java
index da6e865ab3..e0227b86cb 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapConvoListingElementTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapConvoListingElementTest.java
@@ -38,6 +38,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+/** Test cases for {@link BluetoothMapConvoListingElement}. */
@RunWith(AndroidJUnit4.class)
public class BluetoothMapConvoListingElementTest {
private static final long TEST_ID = 1111;
diff --git a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapConvoListingTest.java b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapConvoListingTest.java
index e333d7b4bb..d2a0f0ebcb 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapConvoListingTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapConvoListingTest.java
@@ -31,6 +31,7 @@ import org.junit.runner.RunWith;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
+/** Test cases for {@link BluetoothMapConvoListing}. */
@RunWith(AndroidJUnit4.class)
public class BluetoothMapConvoListingTest {
private static final long TEST_LAST_ACTIVITY_EARLIEST = 0;
diff --git a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapFolderElementTest.java b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapFolderElementTest.java
index 0ba98aef33..4b974cd2bc 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapFolderElementTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapFolderElementTest.java
@@ -24,6 +24,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+/** Test cases for {@link BluetoothMapFolderElement}. */
@RunWith(AndroidJUnit4.class)
public class BluetoothMapFolderElementTest {
private static final boolean TEST_HAS_SMS_MMS_CONTENT = true;
diff --git a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapMasInstanceTest.java b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapMasInstanceTest.java
index 87c33d6588..dd56b933c2 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapMasInstanceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapMasInstanceTest.java
@@ -33,6 +33,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
+/** Test cases for {@link BluetoothMapMasInstance}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class BluetoothMapMasInstanceTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapMessageListingElementTest.java b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapMessageListingElementTest.java
index bf58abaebc..de6e1f25bb 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapMessageListingElementTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapMessageListingElementTest.java
@@ -35,6 +35,7 @@ import java.io.StringReader;
import java.io.StringWriter;
import java.text.SimpleDateFormat;
+/** Test cases for {@link BluetoothMapMessageListingElement}. */
@RunWith(AndroidJUnit4.class)
public class BluetoothMapMessageListingElementTest {
private static final long TEST_CP_HANDLE = 1;
diff --git a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapMessageListingTest.java b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapMessageListingTest.java
index d78405aff4..f748832912 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapMessageListingTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapMessageListingTest.java
@@ -37,6 +37,7 @@ import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
+/** Test cases for {@link BluetoothMapMessageListing}. */
@RunWith(AndroidJUnit4.class)
public class BluetoothMapMessageListingTest {
private static final long TEST_DATE_TIME_EARLIEST = 0;
diff --git a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapObexServerTest.java b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapObexServerTest.java
index a5c4b8425e..27bca34f3a 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapObexServerTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapObexServerTest.java
@@ -50,6 +50,7 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Spy;
+/** Test cases for {@link BluetoothMapObexServer}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class BluetoothMapObexServerTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapServiceBinderTest.java b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapServiceBinderTest.java
index b3125460c4..01f83b4eac 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapServiceBinderTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapServiceBinderTest.java
@@ -25,6 +25,7 @@ import static com.android.bluetooth.TestUtils.getTestDevice;
import static org.mockito.Mockito.verify;
import android.bluetooth.BluetoothDevice;
+import android.content.AttributionSource;
import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;
@@ -35,7 +36,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-/** Test cases for {@link BluetoothMapServiceBinder} */
+/** Test cases for {@link BluetoothMapServiceBinder}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class BluetoothMapServiceBinderTest {
@@ -44,6 +45,7 @@ public class BluetoothMapServiceBinderTest {
@Mock private BluetoothMapService mService;
+ private final AttributionSource mAttributionSource = new AttributionSource.Builder(1).build();
private final BluetoothDevice mDevice = getTestDevice(98);
private BluetoothMapServiceBinder mBinder;
@@ -55,13 +57,13 @@ public class BluetoothMapServiceBinderTest {
@Test
public void disconnect_callsServiceMethod() {
- mBinder.disconnect(mDevice, null);
+ mBinder.disconnect(mDevice, mAttributionSource);
verify(mService).disconnect(mDevice);
}
@Test
public void getConnectedDevices_callsServiceMethod() {
- mBinder.getConnectedDevices(null);
+ mBinder.getConnectedDevices(mAttributionSource);
verify(mService).getConnectedDevices();
}
@@ -69,13 +71,13 @@ public class BluetoothMapServiceBinderTest {
public void getDevicesMatchingConnectionStates_callsServiceMethod() {
int[] states = new int[] {STATE_CONNECTED};
- mBinder.getDevicesMatchingConnectionStates(states, null);
+ mBinder.getDevicesMatchingConnectionStates(states, mAttributionSource);
verify(mService).getDevicesMatchingConnectionStates(states);
}
@Test
public void getConnectionState_callsServiceMethod() {
- mBinder.getConnectionState(mDevice, null);
+ mBinder.getConnectionState(mDevice, mAttributionSource);
verify(mService).getConnectionState(mDevice);
}
@@ -83,31 +85,31 @@ public class BluetoothMapServiceBinderTest {
public void setConnectionPolicy_callsServiceMethod() {
int connectionPolicy = CONNECTION_POLICY_ALLOWED;
- mBinder.setConnectionPolicy(mDevice, connectionPolicy, null);
+ mBinder.setConnectionPolicy(mDevice, connectionPolicy, mAttributionSource);
verify(mService).setConnectionPolicy(mDevice, connectionPolicy);
}
@Test
public void getConnectionPolicy_callsServiceMethod() {
- mBinder.getConnectionPolicy(mDevice, null);
+ mBinder.getConnectionPolicy(mDevice, mAttributionSource);
verify(mService).getConnectionPolicy(mDevice);
}
@Test
public void getState_callsServiceMethod() {
- mBinder.getState(null);
+ mBinder.getState(mAttributionSource);
verify(mService).getState();
}
@Test
public void isConnected_callsServiceStaticMethod() {
- mBinder.isConnected(mDevice, null);
+ mBinder.isConnected(mDevice, mAttributionSource);
verify(mService).getConnectionState(mDevice);
}
@Test
public void getClient_callsServiceStaticMethod() {
- mBinder.getClient(null);
+ mBinder.getClient(mAttributionSource);
verify(mService).getRemoteDevice();
}
diff --git a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapServiceTest.java
index f2c455bbc1..2e61805948 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapServiceTest.java
@@ -45,6 +45,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
+/** Test cases for {@link BluetoothMapService}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class BluetoothMapServiceTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapSmsPduTest.java b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapSmsPduTest.java
index 2f96c2ead9..01c05e37e8 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapSmsPduTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapSmsPduTest.java
@@ -48,6 +48,7 @@ import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.List;
+/** Test cases for {@link BluetoothMapSmsPdu}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class BluetoothMapSmsPduTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapUtilsTest.java b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapUtilsTest.java
index 57467027e1..9325a8fcff 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapUtilsTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapUtilsTest.java
@@ -30,6 +30,7 @@ import org.junit.runner.RunWith;
import java.nio.charset.StandardCharsets;
+/** Test cases for {@link BluetoothMapUtils}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class BluetoothMapUtilsTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapbMessageEmailTest.java b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapbMessageEmailTest.java
index b3094670e2..3d4b2e53d7 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapbMessageEmailTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapbMessageEmailTest.java
@@ -29,6 +29,7 @@ import org.junit.runner.RunWith;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
+/** Test cases for {@link BluetoothMapbMessageEmail}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class BluetoothMapbMessageEmailTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapbMessageMimeTest.java b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapbMessageMimeTest.java
index 7aa1ad9b1c..af8e22b461 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapbMessageMimeTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapbMessageMimeTest.java
@@ -33,6 +33,7 @@ import java.util.Arrays;
import java.util.Date;
import java.util.Locale;
+/** Test cases for {@link BluetoothMapbMessageMime}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class BluetoothMapbMessageMimeTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapbMessageSmsTest.java b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapbMessageSmsTest.java
index 9cec017f97..478a594859 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapbMessageSmsTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapbMessageSmsTest.java
@@ -38,6 +38,7 @@ import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.List;
+/** Test cases for {@link BluetoothMapbMessageSms}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class BluetoothMapbMessageSmsTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapbMessageTest.java b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapbMessageTest.java
index d778b412a6..aaa8914b41 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapbMessageTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapbMessageTest.java
@@ -31,6 +31,7 @@ import org.junit.runner.RunWith;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
+/** Test cases for {@link BluetoothMapbMessage}. */
@RunWith(AndroidJUnit4.class)
public class BluetoothMapbMessageTest {
private static final String TEST_VERSION_STRING = "1.0";
diff --git a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapbMessageVCardTest.java b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapbMessageVCardTest.java
index 69a57b83b2..d9823360db 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapbMessageVCardTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/map/BluetoothMapbMessageVCardTest.java
@@ -31,6 +31,7 @@ import org.junit.runner.RunWith;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
+/** Test cases for {@link BluetoothMapbMessageVCard}. */
@RunWith(AndroidJUnit4.class)
public class BluetoothMapbMessageVCardTest {
private static final String TEST_NAME = "test_name";
diff --git a/android/app/tests/unit/src/com/android/bluetooth/map/ConvoContactInfoTest.java b/android/app/tests/unit/src/com/android/bluetooth/map/ConvoContactInfoTest.java
index fc99e7134e..bf0936428e 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/map/ConvoContactInfoTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/map/ConvoContactInfoTest.java
@@ -28,6 +28,7 @@ import com.android.bluetooth.mapapi.BluetoothMapContract;
import org.junit.Test;
import org.junit.runner.RunWith;
+/** Test cases for {@link ConvoContactInfo}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class ConvoContactInfoTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/map/EventTest.java b/android/app/tests/unit/src/com/android/bluetooth/map/EventTest.java
index edd0863d4b..13de9d11ab 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/map/EventTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/map/EventTest.java
@@ -39,6 +39,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+/** Test cases for {@link Event}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class EventTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/map/FilterInfoTest.java b/android/app/tests/unit/src/com/android/bluetooth/map/FilterInfoTest.java
index 7042e34980..b8d8de4d36 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/map/FilterInfoTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/map/FilterInfoTest.java
@@ -32,6 +32,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+/** Test cases for {@link FilterInfo}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class FilterInfoTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/map/MapContactTest.java b/android/app/tests/unit/src/com/android/bluetooth/map/MapContactTest.java
index 93babf8f81..c55efd2b77 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/map/MapContactTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/map/MapContactTest.java
@@ -26,6 +26,7 @@ import com.android.bluetooth.SignedLongLong;
import org.junit.Test;
import org.junit.runner.RunWith;
+/** Test cases for {@link MapContact}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class MapContactTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/map/MsgTest.java b/android/app/tests/unit/src/com/android/bluetooth/map/MsgTest.java
index 4a0963cd78..98450d3e6d 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/map/MsgTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/map/MsgTest.java
@@ -26,6 +26,7 @@ import com.google.common.testing.EqualsTester;
import org.junit.Test;
import org.junit.runner.RunWith;
+/** Test cases for {@link Msg}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class MsgTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/map/OWNERS b/android/app/tests/unit/src/com/android/bluetooth/map/OWNERS
deleted file mode 100644
index 8f87191393..0000000000
--- a/android/app/tests/unit/src/com/android/bluetooth/map/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_content \ No newline at end of file
diff --git a/android/app/tests/unit/src/com/android/bluetooth/map/SmsMmsContactsTest.java b/android/app/tests/unit/src/com/android/bluetooth/map/SmsMmsContactsTest.java
index fdf2ee67e1..525143d623 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/map/SmsMmsContactsTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/map/SmsMmsContactsTest.java
@@ -39,6 +39,7 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Spy;
+/** Test cases for {@link SmsMmsContacts}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class SmsMmsContactsTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/mapapi/BluetoothMapContractTest.java b/android/app/tests/unit/src/com/android/bluetooth/mapapi/BluetoothMapContractTest.java
index 021c1ae82f..d7690e732c 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/mapapi/BluetoothMapContractTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/mapapi/BluetoothMapContractTest.java
@@ -25,6 +25,7 @@ import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
+/** Test cases for {@link BluetoothMapContract}. */
@RunWith(AndroidJUnit4.class)
public class BluetoothMapContractTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/mapapi/BluetoothMapEmailProviderTest.java b/android/app/tests/unit/src/com/android/bluetooth/mapapi/BluetoothMapEmailProviderTest.java
index 1dadfd906d..348f374211 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/mapapi/BluetoothMapEmailProviderTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/mapapi/BluetoothMapEmailProviderTest.java
@@ -47,6 +47,7 @@ import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
+/** Test cases for {@link BluetoothMapEmailProvider}. */
@RunWith(AndroidJUnit4.class)
public class BluetoothMapEmailProviderTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/mapapi/BluetoothMapIMProviderTest.java b/android/app/tests/unit/src/com/android/bluetooth/mapapi/BluetoothMapIMProviderTest.java
index 2fccf754e5..774e8c5f20 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/mapapi/BluetoothMapIMProviderTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/mapapi/BluetoothMapIMProviderTest.java
@@ -56,6 +56,7 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+/** Test cases for {@link BluetoothMapIMProvider}. */
@RunWith(AndroidJUnit4.class)
public class BluetoothMapIMProviderTest {
private static final String TAG = BluetoothMapIMProviderTest.class.getSimpleName();
diff --git a/android/app/tests/unit/src/com/android/bluetooth/mapapi/OWNERS b/android/app/tests/unit/src/com/android/bluetooth/mapapi/OWNERS
deleted file mode 100644
index 8f87191393..0000000000
--- a/android/app/tests/unit/src/com/android/bluetooth/mapapi/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_content \ No newline at end of file
diff --git a/android/app/tests/unit/src/com/android/bluetooth/mapclient/BmessageTest.java b/android/app/tests/unit/src/com/android/bluetooth/mapclient/BmessageTest.java
index 06d66600d7..89471435f7 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/mapclient/BmessageTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/mapclient/BmessageTest.java
@@ -26,6 +26,7 @@ import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
+/** Test cases for {@link Bmessage}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class BmessageTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/mapclient/EventReportTest.java b/android/app/tests/unit/src/com/android/bluetooth/mapclient/EventReportTest.java
index 05facb51cc..b48868aba5 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/mapclient/EventReportTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/mapclient/EventReportTest.java
@@ -33,6 +33,7 @@ import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
+/** Test cases for {@link EventReport}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class EventReportTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/mapclient/MapClientContentTest.java b/android/app/tests/unit/src/com/android/bluetooth/mapclient/MapClientContentTest.java
index 09d946390b..32980a2068 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/mapclient/MapClientContentTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/mapclient/MapClientContentTest.java
@@ -65,6 +65,7 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
+/** Test cases for {@link MapClientContent}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class MapClientContentTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/mapclient/MapClientServiceBinderTest.java b/android/app/tests/unit/src/com/android/bluetooth/mapclient/MapClientServiceBinderTest.java
index a67a5c3981..98279f3d8d 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/mapclient/MapClientServiceBinderTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/mapclient/MapClientServiceBinderTest.java
@@ -24,6 +24,7 @@ import static com.android.bluetooth.TestUtils.getTestDevice;
import static org.mockito.Mockito.verify;
import android.bluetooth.BluetoothDevice;
+import android.content.AttributionSource;
import android.net.Uri;
import androidx.test.filters.MediumTest;
@@ -35,7 +36,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-/** Test cases for {@link MapClientServiceBinder} */
+/** Test cases for {@link MapClientServiceBinder}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class MapClientServiceBinderTest {
@@ -44,6 +45,7 @@ public class MapClientServiceBinderTest {
@Mock private MapClientService mService;
+ private final AttributionSource mAttributionSource = new AttributionSource.Builder(1).build();
private final BluetoothDevice mDevice = getTestDevice(65);
private MapClientServiceBinder mBinder;
@@ -55,19 +57,19 @@ public class MapClientServiceBinderTest {
@Test
public void connect_callsServiceMethod() {
- mBinder.connect(mDevice, null);
+ mBinder.connect(mDevice, mAttributionSource);
verify(mService).connect(mDevice);
}
@Test
public void disconnect_callsServiceMethod() {
- mBinder.disconnect(mDevice, null);
+ mBinder.disconnect(mDevice, mAttributionSource);
verify(mService).disconnect(mDevice);
}
@Test
public void getConnectedDevices_callsServiceMethod() {
- mBinder.getConnectedDevices(null);
+ mBinder.getConnectedDevices(mAttributionSource);
verify(mService).getConnectedDevices();
}
@@ -75,13 +77,13 @@ public class MapClientServiceBinderTest {
public void getDevicesMatchingConnectionStates_callsServiceMethod() {
int[] states = new int[] {STATE_CONNECTED};
- mBinder.getDevicesMatchingConnectionStates(states, null);
+ mBinder.getDevicesMatchingConnectionStates(states, mAttributionSource);
verify(mService).getDevicesMatchingConnectionStates(states);
}
@Test
public void getConnectionState_callsServiceMethod() {
- mBinder.getConnectionState(mDevice, null);
+ mBinder.getConnectionState(mDevice, mAttributionSource);
verify(mService).getConnectionState(mDevice);
}
@@ -89,13 +91,13 @@ public class MapClientServiceBinderTest {
public void setConnectionPolicy_callsServiceMethod() {
int connectionPolicy = CONNECTION_POLICY_ALLOWED;
- mBinder.setConnectionPolicy(mDevice, connectionPolicy, null);
+ mBinder.setConnectionPolicy(mDevice, connectionPolicy, mAttributionSource);
verify(mService).setConnectionPolicy(mDevice, connectionPolicy);
}
@Test
public void getConnectionPolicy_callsServiceMethod() {
- mBinder.getConnectionPolicy(mDevice, null);
+ mBinder.getConnectionPolicy(mDevice, mAttributionSource);
verify(mService).getConnectionPolicy(mDevice);
}
@@ -104,7 +106,7 @@ public class MapClientServiceBinderTest {
Uri[] contacts = new Uri[] {};
String message = "test_message";
- mBinder.sendMessage(mDevice, contacts, message, null, null, null);
+ mBinder.sendMessage(mDevice, contacts, message, null, null, mAttributionSource);
verify(mService).sendMessage(mDevice, contacts, message, null, null);
}
diff --git a/android/app/tests/unit/src/com/android/bluetooth/mapclient/MapClientServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/mapclient/MapClientServiceTest.java
index 66f04951ee..8ea8c2bba8 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/mapclient/MapClientServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/mapclient/MapClientServiceTest.java
@@ -64,6 +64,7 @@ import org.mockito.Mock;
import java.util.ArrayList;
import java.util.List;
+/** Test cases for {@link MapClientService}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class MapClientServiceTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/mapclient/MapClientStateMachineTest.java b/android/app/tests/unit/src/com/android/bluetooth/mapclient/MapClientStateMachineTest.java
index 73280280ca..e2ec29a16c 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/mapclient/MapClientStateMachineTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/mapclient/MapClientStateMachineTest.java
@@ -101,6 +101,7 @@ import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
+/** Test cases for {@link MapClientStateMachine}. */
@MediumTest
@RunWith(ParameterizedAndroidJunit4.class)
public class MapClientStateMachineTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/mapclient/MessageTest.java b/android/app/tests/unit/src/com/android/bluetooth/mapclient/MessageTest.java
index 967e5b209d..154f5140ca 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/mapclient/MessageTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/mapclient/MessageTest.java
@@ -26,6 +26,7 @@ import org.junit.runner.RunWith;
import java.util.HashMap;
+/** Test cases for {@link Message}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class MessageTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/mapclient/MessagesFilterTest.java b/android/app/tests/unit/src/com/android/bluetooth/mapclient/MessagesFilterTest.java
index 5433d67897..7b148666f5 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/mapclient/MessagesFilterTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/mapclient/MessagesFilterTest.java
@@ -26,6 +26,7 @@ import org.junit.runner.RunWith;
import java.util.Calendar;
+/** Test cases for {@link MessagesFilter}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class MessagesFilterTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/mapclient/MessagesListingTest.java b/android/app/tests/unit/src/com/android/bluetooth/mapclient/MessagesListingTest.java
index ab6e7a46a4..4a821e1cbe 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/mapclient/MessagesListingTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/mapclient/MessagesListingTest.java
@@ -26,6 +26,7 @@ import org.junit.runner.RunWith;
import java.io.ByteArrayInputStream;
+/** Test cases for {@link MessagesListing}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class MessagesListingTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/mapclient/MnsObexServerTest.java b/android/app/tests/unit/src/com/android/bluetooth/mapclient/MnsObexServerTest.java
index 2abea296e7..56b0a6d0eb 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/mapclient/MnsObexServerTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/mapclient/MnsObexServerTest.java
@@ -41,6 +41,7 @@ import org.mockito.Mock;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
+/** Test cases for {@link MnsObexServer}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class MnsObexServerTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/mapclient/OWNERS b/android/app/tests/unit/src/com/android/bluetooth/mapclient/OWNERS
deleted file mode 100644
index 8f87191393..0000000000
--- a/android/app/tests/unit/src/com/android/bluetooth/mapclient/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_content \ No newline at end of file
diff --git a/android/app/tests/unit/src/com/android/bluetooth/mapclient/ObexTimeTest.java b/android/app/tests/unit/src/com/android/bluetooth/mapclient/ObexTimeTest.java
index 6f8bad385c..d6fb3090b1 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/mapclient/ObexTimeTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/mapclient/ObexTimeTest.java
@@ -29,6 +29,7 @@ import java.time.Instant;
import java.util.Date;
import java.util.TimeZone;
+/** Test cases for {@link ObexTime}. */
@RunWith(AndroidJUnit4.class)
@SuppressLint("UndefinedEquals")
public class ObexTimeTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/mcp/McpServiceBinderTest.java b/android/app/tests/unit/src/com/android/bluetooth/mcp/McpServiceBinderTest.java
index dc21e810b8..534f8f1d18 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/mcp/McpServiceBinderTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/mcp/McpServiceBinderTest.java
@@ -34,7 +34,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-/** Test cases for {@link McpServiceBinder} */
+/** Test cases for {@link McpServiceBinder}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class McpServiceBinderTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/mcp/McpServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/mcp/McpServiceTest.java
index 5ff65a4f8c..c32483fcdc 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/mcp/McpServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/mcp/McpServiceTest.java
@@ -38,6 +38,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
+/** Test cases for {@link McpService}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class McpServiceTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/mcp/MediaControlGattServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/mcp/MediaControlGattServiceTest.java
index 6b3df639aa..9a88458050 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/mcp/MediaControlGattServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/mcp/MediaControlGattServiceTest.java
@@ -57,6 +57,7 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
+/** Test cases for {@link MediaControlGattService}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class MediaControlGattServiceTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/mcp/MediaControlProfileTest.java b/android/app/tests/unit/src/com/android/bluetooth/mcp/MediaControlProfileTest.java
index 0aa5f199d5..35ba769a81 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/mcp/MediaControlProfileTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/mcp/MediaControlProfileTest.java
@@ -52,6 +52,7 @@ import org.mockito.Mock;
import java.util.HashMap;
import java.util.UUID;
+/** Test cases for {@link MediaControlProfile}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class MediaControlProfileTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/mcp/OWNERS b/android/app/tests/unit/src/com/android/bluetooth/mcp/OWNERS
deleted file mode 100644
index a7d77894ba..0000000000
--- a/android/app/tests/unit/src/com/android/bluetooth/mcp/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_leaudio
diff --git a/android/app/tests/unit/src/com/android/bluetooth/obex/OWNERS b/android/app/tests/unit/src/com/android/bluetooth/obex/OWNERS
deleted file mode 100644
index 8f87191393..0000000000
--- a/android/app/tests/unit/src/com/android/bluetooth/obex/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_content \ No newline at end of file
diff --git a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppBatchTest.java b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppBatchTest.java
index e3f764d2bc..6017de3b42 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppBatchTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppBatchTest.java
@@ -38,6 +38,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
+/** Test cases for {@link BluetoothOppBatch}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class BluetoothOppBatchTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppHandoverReceiverTest.java b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppHandoverReceiverTest.java
index daa65ebba6..cbc97b1242 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppHandoverReceiverTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppHandoverReceiverTest.java
@@ -49,6 +49,7 @@ import org.mockito.Spy;
import java.util.ArrayList;
import java.util.List;
+/** Test cases for {@link BluetoothOppHandoverReceiver}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class BluetoothOppHandoverReceiverTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppManagerTest.java b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppManagerTest.java
index b20858b647..6d9edf9aec 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppManagerTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppManagerTest.java
@@ -56,6 +56,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
+/** Test cases for {@link BluetoothOppManager}. */
@RunWith(AndroidJUnit4.class)
public class BluetoothOppManagerTest {
Context mContext;
diff --git a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppNotificationTest.java b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppNotificationTest.java
index 5e5d11ce4d..928cfcae60 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppNotificationTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppNotificationTest.java
@@ -58,6 +58,7 @@ import org.mockito.Mock;
import java.util.Locale;
+/** Test cases for {@link BluetoothOppNotification}. */
@RunWith(AndroidJUnit4.class)
public class BluetoothOppNotificationTest {
static final int TIMEOUT_MS = 3000;
diff --git a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppObexClientSessionTest.java b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppObexClientSessionTest.java
index b216680836..083a7d1508 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppObexClientSessionTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppObexClientSessionTest.java
@@ -59,6 +59,7 @@ import java.io.OutputStream;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
+/** Test cases for {@link BluetoothOppObexClientSession}. */
@RunWith(AndroidJUnit4.class)
public class BluetoothOppObexClientSessionTest {
@Rule public final MockitoRule mMockitoRule = new MockitoRule();
diff --git a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppObexServerSessionTest.java b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppObexServerSessionTest.java
index 1e850d057b..8a93a3f0ac 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppObexServerSessionTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppObexServerSessionTest.java
@@ -62,6 +62,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+/** Test cases for {@link BluetoothOppObexServerSession}. */
@RunWith(AndroidJUnit4.class)
public class BluetoothOppObexServerSessionTest {
@Rule public final MockitoRule mMockitoRule = new MockitoRule();
diff --git a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppPreferenceTest.java b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppPreferenceTest.java
index 91b1b0b65d..f0f4fe71dc 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppPreferenceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppPreferenceTest.java
@@ -40,6 +40,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+/** Test cases for {@link BluetoothOppPreference}. */
@RunWith(AndroidJUnit4.class)
public class BluetoothOppPreferenceTest {
Context mContext;
diff --git a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppReceiveFileInfoTest.java b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppReceiveFileInfoTest.java
index 3f74ac90d1..b532222f5f 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppReceiveFileInfoTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppReceiveFileInfoTest.java
@@ -41,6 +41,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+/** Test cases for {@link BluetoothOppReceiveFileInfo}. */
@RunWith(AndroidJUnit4.class)
public class BluetoothOppReceiveFileInfoTest {
Context mContext;
diff --git a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppReceiverTest.java b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppReceiverTest.java
index 0a144d7b35..8ff6fab596 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppReceiverTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppReceiverTest.java
@@ -61,6 +61,7 @@ import org.mockito.Mock;
import java.util.ArrayList;
import java.util.List;
+/** Test cases for {@link BluetoothOppReceiver}. */
@RunWith(AndroidJUnit4.class)
public class BluetoothOppReceiverTest {
@Rule public final MockitoRule mMockitoRule = new MockitoRule();
diff --git a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppSendFileInfoTest.java b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppSendFileInfoTest.java
index d76517320e..20725f3600 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppSendFileInfoTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppSendFileInfoTest.java
@@ -52,6 +52,7 @@ import org.mockito.Mock;
import java.io.FileInputStream;
import java.io.IOException;
+/** Test cases for {@link BluetoothOppSendFileInfo}. */
@RunWith(TestParameterInjector.class)
public class BluetoothOppSendFileInfoTest {
Context mContext;
diff --git a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppServiceTest.java
index a065757c01..e5db783227 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppServiceTest.java
@@ -52,6 +52,7 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
+/** Test cases for {@link BluetoothOppService}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class BluetoothOppServiceTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppShareInfoTest.java b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppShareInfoTest.java
index 212f1ffef7..7e37021813 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppShareInfoTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppShareInfoTest.java
@@ -27,6 +27,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+/** Test cases for {@link BluetoothOppShareInfo}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class BluetoothOppShareInfoTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppTransferActivityTest.java b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppTransferActivityTest.java
index ece55f357e..c0cf0349fe 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppTransferActivityTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppTransferActivityTest.java
@@ -56,6 +56,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
+/** Test cases for {@link BluetoothOppTransferActivity}. */
@RunWith(AndroidJUnit4.class)
public class BluetoothOppTransferActivityTest {
@Rule public final MockitoRule mMockitoRule = new MockitoRule();
diff --git a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppTransferHistoryTest.java b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppTransferHistoryTest.java
index 3d313bdfb5..1e84a06020 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppTransferHistoryTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppTransferHistoryTest.java
@@ -63,7 +63,7 @@ import org.mockito.Spy;
import java.util.ArrayList;
import java.util.List;
-/** This class will also test BluetoothOppTransferAdapter */
+/** Test cases for {@link BluetoothOppTransferHistory} and {@link BluetoothOppTransferAdapter}. */
@RunWith(AndroidJUnit4.class)
public class BluetoothOppTransferHistoryTest {
@Rule public final MockitoRule mMockitoRule = new MockitoRule();
diff --git a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppTransferTest.java b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppTransferTest.java
index f6c393909c..57365d631c 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppTransferTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppTransferTest.java
@@ -51,7 +51,6 @@ import androidx.test.runner.AndroidJUnit4;
import com.android.bluetooth.BluetoothMethodProxy;
import com.android.bluetooth.BluetoothObexTransport;
-import com.android.bluetooth.flags.Flags;
import com.android.obex.ObexTransport;
import org.junit.After;
@@ -63,6 +62,7 @@ import org.mockito.Mock;
import java.util.Objects;
+/** Test cases for {@link BluetoothOppTransfer}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class BluetoothOppTransferTest {
@@ -390,7 +390,6 @@ public class BluetoothOppTransferTest {
@Test
public void oppConnectionReceiver_onReceiveWithActionSdpRecord_withoutSdpRecord() {
- mSetFlagRule.enableFlags(Flags.FLAG_IDENTITY_ADDRESS_NULL_IF_NOT_KNOWN);
BluetoothDevice device =
InstrumentationRegistry.getInstrumentation()
.getTargetContext()
diff --git a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppUtilityTest.java b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppUtilityTest.java
index cadff94862..e99d7800a0 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppUtilityTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppUtilityTest.java
@@ -64,6 +64,7 @@ import java.util.List;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
+/** Test cases for {@link BluetoothOppUtility}. */
public class BluetoothOppUtilityTest {
@Rule public final MockitoRule mMockitoRule = new MockitoRule();
diff --git a/android/app/tests/unit/src/com/android/bluetooth/opp/OWNERS b/android/app/tests/unit/src/com/android/bluetooth/opp/OWNERS
deleted file mode 100644
index 8f87191393..0000000000
--- a/android/app/tests/unit/src/com/android/bluetooth/opp/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_content \ No newline at end of file
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pan/OWNERS b/android/app/tests/unit/src/com/android/bluetooth/pan/OWNERS
deleted file mode 100644
index 8f87191393..0000000000
--- a/android/app/tests/unit/src/com/android/bluetooth/pan/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_content \ No newline at end of file
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pan/PanServiceBinderTest.java b/android/app/tests/unit/src/com/android/bluetooth/pan/PanServiceBinderTest.java
index 1ba4881c90..53fa3d4226 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pan/PanServiceBinderTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pan/PanServiceBinderTest.java
@@ -25,6 +25,7 @@ import static com.android.bluetooth.TestUtils.getTestDevice;
import static org.mockito.Mockito.verify;
import android.bluetooth.BluetoothDevice;
+import android.content.AttributionSource;
import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;
@@ -35,7 +36,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-/** Test cases for {@link PanServiceBinder} */
+/** Test cases for {@link PanServiceBinder}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class PanServiceBinderTest {
@@ -44,6 +45,7 @@ public class PanServiceBinderTest {
@Mock private PanService mService;
+ private final AttributionSource mAttributionSource = new AttributionSource.Builder(1).build();
private final BluetoothDevice mDevice = getTestDevice(64);
private PanServiceBinder mBinder;
@@ -55,19 +57,19 @@ public class PanServiceBinderTest {
@Test
public void connect_callsServiceMethod() {
- mBinder.connect(mDevice, null);
+ mBinder.connect(mDevice, mAttributionSource);
verify(mService).connect(mDevice);
}
@Test
public void disconnect_callsServiceMethod() {
- mBinder.disconnect(mDevice, null);
+ mBinder.disconnect(mDevice, mAttributionSource);
verify(mService).disconnect(mDevice);
}
@Test
public void getConnectedDevices_callsServiceMethod() {
- mBinder.getConnectedDevices(null);
+ mBinder.getConnectedDevices(mAttributionSource);
verify(mService).getConnectedDevices();
}
@@ -75,13 +77,13 @@ public class PanServiceBinderTest {
public void getDevicesMatchingConnectionStates_callsServiceMethod() {
int[] states = new int[] {STATE_CONNECTED};
- mBinder.getDevicesMatchingConnectionStates(states, null);
+ mBinder.getDevicesMatchingConnectionStates(states, mAttributionSource);
verify(mService).getDevicesMatchingConnectionStates(states);
}
@Test
public void getConnectionState_callsServiceMethod() {
- mBinder.getConnectionState(mDevice, null);
+ mBinder.getConnectionState(mDevice, mAttributionSource);
verify(mService).getConnectionState(mDevice);
}
@@ -89,13 +91,13 @@ public class PanServiceBinderTest {
public void setConnectionPolicy_callsServiceMethod() {
int connectionPolicy = CONNECTION_POLICY_ALLOWED;
- mBinder.setConnectionPolicy(mDevice, connectionPolicy, null);
+ mBinder.setConnectionPolicy(mDevice, connectionPolicy, mAttributionSource);
verify(mService).setConnectionPolicy(mDevice, connectionPolicy);
}
@Test
public void isTetheringOn_callsServiceMethod() {
- mBinder.isTetheringOn(null);
+ mBinder.isTetheringOn(mAttributionSource);
verify(mService).isTetheringOn();
}
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pan/PanServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/pan/PanServiceTest.java
index 1621909b73..ca91194688 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pan/PanServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pan/PanServiceTest.java
@@ -60,6 +60,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
+/** Test cases for {@link PanService}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class PanServiceTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapAuthenticatorTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapAuthenticatorTest.java
index 78d61ff046..8ace3204d5 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapAuthenticatorTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapAuthenticatorTest.java
@@ -34,6 +34,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
+/** Test cases for {@link BluetoothPbapAuthenticator}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class BluetoothPbapAuthenticatorTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapCallLogComposerTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapCallLogComposerTest.java
index 73aa0f015f..40bdec97be 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapCallLogComposerTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapCallLogComposerTest.java
@@ -49,6 +49,7 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Spy;
+/** Test cases for {@link BluetoothPbapCallLogComposer}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class BluetoothPbapCallLogComposerTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapConfigTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapConfigTest.java
index a95fbcc461..3e4f84b144 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapConfigTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapConfigTest.java
@@ -36,6 +36,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
+/** Test cases for {@link BluetoothPbapConfig}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class BluetoothPbapConfigTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapObexServerTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapObexServerTest.java
index a833c6134b..2baf4075cd 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapObexServerTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapObexServerTest.java
@@ -77,6 +77,7 @@ import org.mockito.Spy;
import java.io.IOException;
import java.io.OutputStream;
+/** Test cases for {@link BluetoothPbapObexServer}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class BluetoothPbapObexServerTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapServiceBinderTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapServiceBinderTest.java
index 2397f3897a..2142eba264 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapServiceBinderTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapServiceBinderTest.java
@@ -25,6 +25,7 @@ import static com.android.bluetooth.TestUtils.getTestDevice;
import static org.mockito.Mockito.verify;
import android.bluetooth.BluetoothDevice;
+import android.content.AttributionSource;
import androidx.test.filters.MediumTest;
import androidx.test.runner.AndroidJUnit4;
@@ -35,7 +36,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-/** Test cases for {@link BluetoothPbapServiceBinder} */
+/** Test cases for {@link BluetoothPbapServiceBinder}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class BluetoothPbapServiceBinderTest {
@@ -44,6 +45,7 @@ public class BluetoothPbapServiceBinderTest {
@Mock private BluetoothPbapService mService;
+ private final AttributionSource mAttributionSource = new AttributionSource.Builder(1).build();
private final BluetoothDevice mDevice = getTestDevice(60);
private BluetoothPbapServiceBinder mBinder;
@@ -55,14 +57,14 @@ public class BluetoothPbapServiceBinderTest {
@Test
public void disconnect_callsServiceMethod() {
- mBinder.disconnect(mDevice, null);
+ mBinder.disconnect(mDevice, mAttributionSource);
verify(mService).disconnect(mDevice);
}
@Test
public void getConnectedDevices_callsServiceMethod() {
- mBinder.getConnectedDevices(null);
+ mBinder.getConnectedDevices(mAttributionSource);
verify(mService).getConnectedDevices();
}
@@ -70,14 +72,14 @@ public class BluetoothPbapServiceBinderTest {
@Test
public void getDevicesMatchingConnectionStates_callsServiceMethod() {
int[] states = new int[] {STATE_CONNECTED};
- mBinder.getDevicesMatchingConnectionStates(states, null);
+ mBinder.getDevicesMatchingConnectionStates(states, mAttributionSource);
verify(mService).getDevicesMatchingConnectionStates(states);
}
@Test
public void getConnectionState_callsServiceMethod() {
- mBinder.getConnectionState(mDevice, null);
+ mBinder.getConnectionState(mDevice, mAttributionSource);
verify(mService).getConnectionState(mDevice);
}
@@ -85,7 +87,7 @@ public class BluetoothPbapServiceBinderTest {
@Test
public void setConnectionPolicy_callsServiceMethod() {
int connectionPolicy = CONNECTION_POLICY_ALLOWED;
- mBinder.setConnectionPolicy(mDevice, connectionPolicy, null);
+ mBinder.setConnectionPolicy(mDevice, connectionPolicy, mAttributionSource);
verify(mService).setConnectionPolicy(mDevice, connectionPolicy);
}
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapServiceTest.java
index e19ca130bf..27eb54f24f 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapServiceTest.java
@@ -68,6 +68,7 @@ import org.mockito.Spy;
import java.util.List;
+/** Test cases for {@link BluetoothPbapService}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class BluetoothPbapServiceTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapSimVcardManagerTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapSimVcardManagerTest.java
index 4afce15b68..75728b2c05 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapSimVcardManagerTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapSimVcardManagerTest.java
@@ -56,6 +56,7 @@ import java.util.Collections;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
+/** Test cases for {@link BluetoothPbapSimVcardManager}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class BluetoothPbapSimVcardManagerTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapUtilsTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapUtilsTest.java
index df448082c2..cb0530c641 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapUtilsTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapUtilsTest.java
@@ -60,6 +60,7 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
+/** Test cases for {@link BluetoothPbapUtils}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class BluetoothPbapUtilsTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapVcardManagerNestedClassesTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapVcardManagerNestedClassesTest.java
index e95e90088a..1ecc61ae71 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapVcardManagerNestedClassesTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapVcardManagerNestedClassesTest.java
@@ -43,6 +43,7 @@ import org.mockito.Mock;
import java.util.concurrent.atomic.AtomicInteger;
+/** Test cases for {@link BluetoothPbapVcardManagerNestedClasses}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class BluetoothPbapVcardManagerNestedClassesTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapVcardManagerTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapVcardManagerTest.java
index 3b6034cd33..56ba69d410 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapVcardManagerTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapVcardManagerTest.java
@@ -52,6 +52,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
+/** Test cases for {@link BluetoothPbapVcardManager}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class BluetoothPbapVcardManagerTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbap/HandlerForStringBufferTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbap/HandlerForStringBufferTest.java
index 9382902122..d5e4068122 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbap/HandlerForStringBufferTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbap/HandlerForStringBufferTest.java
@@ -40,6 +40,7 @@ import org.mockito.Mock;
import java.io.IOException;
import java.io.OutputStream;
+/** Test cases for {@link HandlerForStringBuffer}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class HandlerForStringBufferTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbap/OWNERS b/android/app/tests/unit/src/com/android/bluetooth/pbap/OWNERS
deleted file mode 100644
index 8f87191393..0000000000
--- a/android/app/tests/unit/src/com/android/bluetooth/pbap/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_content \ No newline at end of file
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbap/PbapStateMachineTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbap/PbapStateMachineTest.java
index c46ea24702..d83d663ff8 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbap/PbapStateMachineTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbap/PbapStateMachineTest.java
@@ -45,6 +45,7 @@ import org.mockito.Mock;
import java.io.IOException;
import java.io.InputStream;
+/** Test cases for {@link PbapStateMachine}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class PbapStateMachineTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/OWNERS b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/OWNERS
deleted file mode 100644
index 8f87191393..0000000000
--- a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_content \ No newline at end of file
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapApplicationParametersTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapApplicationParametersTest.java
index 8f8c076648..18e91bef08 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapApplicationParametersTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapApplicationParametersTest.java
@@ -24,6 +24,7 @@ import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
+/** Test cases for {@link PbapApplicationParameters}. */
@RunWith(AndroidJUnit4.class)
public class PbapApplicationParametersTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientAccountAuthenticatorServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientAccountAuthenticatorServiceTest.java
index dfc7c322a5..6cfec032ba 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientAccountAuthenticatorServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientAccountAuthenticatorServiceTest.java
@@ -36,6 +36,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
+/** Test cases for {@link PbapClientAccountAuthenticatorService}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class PbapClientAccountAuthenticatorServiceTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientAccountAuthenticatorTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientAccountAuthenticatorTest.java
index fce20be7ad..8b1bcee2fa 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientAccountAuthenticatorTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientAccountAuthenticatorTest.java
@@ -35,6 +35,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
+/** Test cases for {@link PbapClientAccountAuthenticator}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class PbapClientAccountAuthenticatorTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientAccountManagerTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientAccountManagerTest.java
index e3ed3884a4..075fa2eddb 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientAccountManagerTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientAccountManagerTest.java
@@ -61,6 +61,7 @@ import org.mockito.Mock;
import java.util.List;
+/** Test cases for {@link PbapClientAccountManager}. */
@RunWith(AndroidJUnit4.class)
public class PbapClientAccountManagerTest {
private static final String ACCOUNT_TYPE = "com.android.bluetooth.pbapclient.account";
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientConnectionHandlerTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientConnectionHandlerTest.java
index eef3517311..b76cb683df 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientConnectionHandlerTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientConnectionHandlerTest.java
@@ -44,6 +44,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
+/** Test cases for {@link PbapClientConnectionHandler}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class PbapClientConnectionHandlerTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientContactsStorageTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientContactsStorageTest.java
index afd2c2a085..fdd4473648 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientContactsStorageTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientContactsStorageTest.java
@@ -67,6 +67,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+/** Test cases for {@link PbapClientContactsStorage}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class PbapClientContactsStorageTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientObexAuthenticatorTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientObexAuthenticatorTest.java
index 45476f1b73..5846e6fb08 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientObexAuthenticatorTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientObexAuthenticatorTest.java
@@ -27,6 +27,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+/** Test cases for {@link PbapClientObexAuthenticator}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class PbapClientObexAuthenticatorTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientObexClientTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientObexClientTest.java
index ef315042d2..ac82e6be59 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientObexClientTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientObexClientTest.java
@@ -67,6 +67,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+/** Test cases for {@link PbapClientObexClient}. */
@RunWith(AndroidJUnit4.class)
public class PbapClientObexClientTest {
private static final int TEST_L2CAP_PSM = 4098;
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientObexTransportTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientObexTransportTest.java
index dfcc542467..fda3858c81 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientObexTransportTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientObexTransportTest.java
@@ -42,6 +42,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+/** Test cases for {@link PbapClientObexTransport}. */
@RunWith(AndroidJUnit4.class)
public class PbapClientObexTransportTest {
@Rule public final MockitoRule mMockitoRule = new MockitoRule();
@@ -183,7 +184,6 @@ public class PbapClientObexTransportTest {
public void testGetRemoteAddress_transportRfcomm_returnsDeviceIdentityAddress() {
doReturn(BluetoothSocket.TYPE_RFCOMM).when(mMockSocket).getConnectionType();
PbapClientObexTransport transport = new PbapClientObexTransport(mMockSocket);
- // See "Flags.identityAddressNullIfNotKnown():"
// Identity address won't be "known" by the stack for a test device, so it'll return null.
// assertThat(transport.getRemoteAddress()).isNull();
assertThat(transport.getRemoteAddress()).isEqualTo(mTestDevice.getAddress());
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientServiceBinderTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientServiceBinderTest.java
index 94b51136dd..a54827346b 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientServiceBinderTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientServiceBinderTest.java
@@ -47,7 +47,7 @@ import org.mockito.Mock;
import java.util.List;
-/** Test cases for {@link PbapClientServiceBinder} */
+/** Test cases for {@link PbapClientServiceBinder}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class PbapClientServiceBinderTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientServiceTest.java
index bf3014a7ac..302f432d21 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientServiceTest.java
@@ -84,6 +84,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+/** Test cases for {@link PbapClientService}. */
@MediumTest
@RunWith(ParameterizedAndroidJunit4.class)
public class PbapClientServiceTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientSocketTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientSocketTest.java
index 64f1979437..28b00d2c53 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientSocketTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientSocketTest.java
@@ -38,6 +38,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+/** Test cases for {@link PbapClientSocket}. */
@RunWith(AndroidJUnit4.class)
public class PbapClientSocketTest {
@Rule public final MockitoRule mMockitoRule = new MockitoRule();
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientStateMachineOldTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientStateMachineOldTest.java
index 73c1722e75..c1cdc928a8 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientStateMachineOldTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientStateMachineOldTest.java
@@ -53,6 +53,7 @@ import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.Mockito;
+/** Test cases for {@link PbapClientStateMachineOld}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class PbapClientStateMachineOldTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientStateMachineTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientStateMachineTest.java
index d9b8bef9d4..cf3e39ed48 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientStateMachineTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientStateMachineTest.java
@@ -63,6 +63,7 @@ import org.mockito.Mock;
import java.util.ArrayList;
import java.util.List;
+/** Test cases for {@link PbapClientStateMachine}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class PbapClientStateMachineTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapPhonebookMetadataTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapPhonebookMetadataTest.java
index 2abafedf77..05a9b43198 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapPhonebookMetadataTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapPhonebookMetadataTest.java
@@ -23,6 +23,7 @@ import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
+/** Test cases for {@link PbapPhonebookMetadata}. */
@RunWith(AndroidJUnit4.class)
public class PbapPhonebookMetadataTest {
private static final int SIZE = 5;
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapPhonebookTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapPhonebookTest.java
index 5c24a9f794..fff637e015 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapPhonebookTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapPhonebookTest.java
@@ -32,6 +32,7 @@ import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
+/** Test cases for {@link PbapPhonebook}. */
@RunWith(AndroidJUnit4.class)
public class PbapPhonebookTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapSdpRecordTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapSdpRecordTest.java
index 3248d6e9db..caeb536a3f 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapSdpRecordTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapSdpRecordTest.java
@@ -32,6 +32,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+/** Test cases for {@link PbapSdpRecord}. */
@RunWith(AndroidJUnit4.class)
public class PbapSdpRecordTest {
private BluetoothDevice mTestDevice;
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PhonebookPullRequestTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PhonebookPullRequestTest.java
index 10526bac41..e7df7f174f 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PhonebookPullRequestTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PhonebookPullRequestTest.java
@@ -35,6 +35,7 @@ import org.junit.runner.RunWith;
import java.util.ArrayList;
import java.util.List;
+/** Test cases for {@link PhonebookPullRequest}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class PhonebookPullRequestTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/RequestPullPhonebookMetadataTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/RequestPullPhonebookMetadataTest.java
index 2e404f9614..42e0f1e4fe 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/RequestPullPhonebookMetadataTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/RequestPullPhonebookMetadataTest.java
@@ -37,6 +37,7 @@ import org.junit.runner.RunWith;
import java.io.IOException;
import java.nio.ByteBuffer;
+/** Test cases for {@link RequestPullPhonebookMetadata}. */
@RunWith(AndroidJUnit4.class)
public class RequestPullPhonebookMetadataTest {
private static final String PHONEBOOK_NAME = "phonebook";
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/RequestPullPhonebookTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/RequestPullPhonebookTest.java
index 551d3e3d2f..cec2030657 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/RequestPullPhonebookTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/RequestPullPhonebookTest.java
@@ -34,6 +34,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+/** Test cases for {@link RequestPullPhonebook}. */
@RunWith(AndroidJUnit4.class)
public class RequestPullPhonebookTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/sap/OWNERS b/android/app/tests/unit/src/com/android/bluetooth/sap/OWNERS
deleted file mode 100644
index 8f87191393..0000000000
--- a/android/app/tests/unit/src/com/android/bluetooth/sap/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_content \ No newline at end of file
diff --git a/android/app/tests/unit/src/com/android/bluetooth/sap/SapMessageTest.java b/android/app/tests/unit/src/com/android/bluetooth/sap/SapMessageTest.java
index 174e71a954..5e1db970cd 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/sap/SapMessageTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/sap/SapMessageTest.java
@@ -55,6 +55,7 @@ import org.mockito.Mockito;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
+/** Test cases for {@link SapMessage}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class SapMessageTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/sap/SapRilReceiverHidlTest.java b/android/app/tests/unit/src/com/android/bluetooth/sap/SapRilReceiverHidlTest.java
index 5d30fa6e93..70eb47e560 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/sap/SapRilReceiverHidlTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/sap/SapRilReceiverHidlTest.java
@@ -70,6 +70,7 @@ import org.mockito.Spy;
import java.util.ArrayList;
import java.util.Arrays;
+/** Test cases for {@link SapRilReceiverHidl}. */
@LargeTest
@RunWith(AndroidJUnit4.class)
public class SapRilReceiverHidlTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/sap/SapRilReceiverTest.java b/android/app/tests/unit/src/com/android/bluetooth/sap/SapRilReceiverTest.java
index 80983b2eef..ae4e35a715 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/sap/SapRilReceiverTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/sap/SapRilReceiverTest.java
@@ -73,6 +73,7 @@ import org.mockito.Spy;
import java.util.Arrays;
+/** Test cases for {@link SapRilReceiver}. */
@LargeTest
@RunWith(AndroidJUnit4.class)
public class SapRilReceiverTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/sap/SapServerTest.java b/android/app/tests/unit/src/com/android/bluetooth/sap/SapServerTest.java
index 69d6434ff2..b6a90affd5 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/sap/SapServerTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/sap/SapServerTest.java
@@ -83,6 +83,7 @@ import org.mockito.Spy;
import java.io.InputStream;
import java.io.OutputStream;
+/** Test cases for {@link SapServer}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class SapServerTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/sap/SapServiceBinderTest.java b/android/app/tests/unit/src/com/android/bluetooth/sap/SapServiceBinderTest.java
index 10d1a092e0..7ee0e89bfb 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/sap/SapServiceBinderTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/sap/SapServiceBinderTest.java
@@ -38,7 +38,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-/** Test cases for {@link SapServiceBinder} */
+/** Test cases for {@link SapServiceBinder}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class SapServiceBinderTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/sap/SapServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/sap/SapServiceTest.java
index 06d41b2db8..db9dcb14a2 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/sap/SapServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/sap/SapServiceTest.java
@@ -46,6 +46,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
+/** Test cases for {@link SapService}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class SapServiceTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/tbs/TbsGattTest.java b/android/app/tests/unit/src/com/android/bluetooth/tbs/TbsGattTest.java
index 81d7bc1bd5..35ab51cb25 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/tbs/TbsGattTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/tbs/TbsGattTest.java
@@ -56,6 +56,7 @@ import java.util.Map;
import java.util.TreeMap;
import java.util.UUID;
+/** Test cases for {@link TbsGatt}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class TbsGattTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/tbs/TbsGenericTest.java b/android/app/tests/unit/src/com/android/bluetooth/tbs/TbsGenericTest.java
index 381da33bc0..73822ed8b4 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/tbs/TbsGenericTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/tbs/TbsGenericTest.java
@@ -52,6 +52,7 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
+/** Test cases for {@link TbsGeneric}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class TbsGenericTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/tbs/TbsServiceBinderTest.java b/android/app/tests/unit/src/com/android/bluetooth/tbs/TbsServiceBinderTest.java
index 7758d101b1..66f70c1354 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/tbs/TbsServiceBinderTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/tbs/TbsServiceBinderTest.java
@@ -40,7 +40,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
-/** Test cases for {@link TbsServiceBinder} */
+/** Test cases for {@link TbsServiceBinder}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class TbsServiceBinderTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/telephony/BluetoothCallTest.java b/android/app/tests/unit/src/com/android/bluetooth/telephony/BluetoothCallTest.java
index 441ac2b603..d3145bde1b 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/telephony/BluetoothCallTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/telephony/BluetoothCallTest.java
@@ -33,6 +33,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
+/** Test cases for {@link BluetoothCall}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class BluetoothCallTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/vc/OWNERS b/android/app/tests/unit/src/com/android/bluetooth/vc/OWNERS
deleted file mode 100644
index a7d77894ba..0000000000
--- a/android/app/tests/unit/src/com/android/bluetooth/vc/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_leaudio
diff --git a/android/app/tests/unit/src/com/android/bluetooth/vc/VolumeControlInputDescriptorTest.java b/android/app/tests/unit/src/com/android/bluetooth/vc/VolumeControlInputDescriptorTest.java
index eac31c5d95..091c85b761 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/vc/VolumeControlInputDescriptorTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/vc/VolumeControlInputDescriptorTest.java
@@ -38,6 +38,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
+/** Test cases for {@link VolumeControlInputDescriptor}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class VolumeControlInputDescriptorTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/vc/VolumeControlNativeCallbackTest.java b/android/app/tests/unit/src/com/android/bluetooth/vc/VolumeControlNativeCallbackTest.java
index e474775f88..f239ca9bbd 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/vc/VolumeControlNativeCallbackTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/vc/VolumeControlNativeCallbackTest.java
@@ -45,6 +45,7 @@ import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
+/** Test cases for {@link VolumeControlNativeCallback}. */
@RunWith(AndroidJUnit4.class)
public class VolumeControlNativeCallbackTest {
@Rule public final MockitoRule mMockitoRule = new MockitoRule();
diff --git a/android/app/tests/unit/src/com/android/bluetooth/vc/VolumeControlOffsetDescriptorTest.java b/android/app/tests/unit/src/com/android/bluetooth/vc/VolumeControlOffsetDescriptorTest.java
index 4f7389b8f8..a0f6f450de 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/vc/VolumeControlOffsetDescriptorTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/vc/VolumeControlOffsetDescriptorTest.java
@@ -25,6 +25,7 @@ import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
+/** Test cases for {@link VolumeControlOffsetDescriptor}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class VolumeControlOffsetDescriptorTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/vc/VolumeControlServiceBinderTest.java b/android/app/tests/unit/src/com/android/bluetooth/vc/VolumeControlServiceBinderTest.java
index 32296381c8..f2167cf4f6 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/vc/VolumeControlServiceBinderTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/vc/VolumeControlServiceBinderTest.java
@@ -38,7 +38,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-/** Test cases for {@link VolumeControlServiceBinder} */
+/** Test cases for {@link VolumeControlServiceBinder}. */
@SmallTest
@RunWith(AndroidJUnit4.class)
public class VolumeControlServiceBinderTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/vc/VolumeControlServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/vc/VolumeControlServiceTest.java
index 9412ebfe40..b7bc838af4 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/vc/VolumeControlServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/vc/VolumeControlServiceTest.java
@@ -96,6 +96,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.stream.IntStream;
+/** Test cases for {@link VolumeControlService}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class VolumeControlServiceTest {
diff --git a/android/app/tests/unit/src/com/android/bluetooth/vc/VolumeControlStateMachineTest.java b/android/app/tests/unit/src/com/android/bluetooth/vc/VolumeControlStateMachineTest.java
index 40b274f7e6..7570c7d387 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/vc/VolumeControlStateMachineTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/vc/VolumeControlStateMachineTest.java
@@ -63,6 +63,7 @@ import org.mockito.InOrder;
import org.mockito.Mock;
import org.mockito.hamcrest.MockitoHamcrest;
+/** Test cases for {@link VolumeControlStateMachine}. */
@MediumTest
@RunWith(AndroidJUnit4.class)
public class VolumeControlStateMachineTest {
diff --git a/android/leaudio/OWNERS b/android/leaudio/OWNERS
deleted file mode 100644
index a7d77894ba..0000000000
--- a/android/leaudio/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_leaudio
diff --git a/android/pandora/OWNERS b/android/pandora/OWNERS
deleted file mode 100644
index c199a82a60..0000000000
--- a/android/pandora/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-# Bug component: 1099313
-girardier@google.com
diff --git a/android/pandora/mmi2grpc/mmi2grpc/_audio.py b/android/pandora/mmi2grpc/mmi2grpc/_audio.py
index 7bc97167a8..6ab5b148ff 100644
--- a/android/pandora/mmi2grpc/mmi2grpc/_audio.py
+++ b/android/pandora/mmi2grpc/mmi2grpc/_audio.py
@@ -18,7 +18,7 @@ import math
import os
from threading import Thread
-# import numpy as np
+import numpy as np
# from scipy.io import wavfile
SINE_FREQUENCY = 440
diff --git a/android/pandora/mmi2grpc/mmi2grpc/hap.py b/android/pandora/mmi2grpc/mmi2grpc/hap.py
index bd2fd83643..99202e9f7f 100644
--- a/android/pandora/mmi2grpc/mmi2grpc/hap.py
+++ b/android/pandora/mmi2grpc/mmi2grpc/hap.py
@@ -28,7 +28,8 @@ from pandora.security_grpc import Security
from pandora.security_pb2 import LE_LEVEL3, PairingEventAnswer
from pandora_experimental.gatt_grpc import GATT
from pandora_experimental.hap_grpc import HAP
-from pandora_experimental.hap_pb2 import HaPlaybackAudioRequest
+from pandora_experimental.le_audio_pb2 import LeAudioPlaybackAudioRequest
+from pandora_experimental.le_audio_grpc import LeAudio
BASE_UUID = uuid.UUID("00000000-0000-1000-8000-00805F9B34FB")
SINK_ASE_UUID = 0x2BC4
@@ -60,9 +61,9 @@ class HAPProxy(ProfileProxy):
self.connection = None
def convert_frame(data):
- return HaPlaybackAudioRequest(data=data, source=self.source)
+ return LeAudioPlaybackAudioRequest(data=data)
- self.audio = AudioSignal(lambda frames: self.hap.HaPlaybackAudio(map(convert_frame, frames)),
+ self.audio = AudioSignal(lambda frames: self.le_audio.LeAudioPlaybackAudio(map(convert_frame, frames)),
AUDIO_SIGNAL_AMPLITUDE, AUDIO_SIGNAL_SAMPLING_RATE)
def test_started(self, test: str, **kwargs):
diff --git a/android/pandora/server/configs/PtsBotTest.xml b/android/pandora/server/configs/PtsBotTest.xml
index 2acbd64521..60a609cc56 100644
--- a/android/pandora/server/configs/PtsBotTest.xml
+++ b/android/pandora/server/configs/PtsBotTest.xml
@@ -35,6 +35,7 @@
<target_preparer class="com.android.tradefed.targetprep.PythonVirtualenvPreparer">
<option name="dep-module" value="grpcio" />
<option name="dep-module" value="protobuf==3.20.1" />
+ <option name="dep-module" value="numpy" />
<!-- Re-enable when A2DP audio streaming tests are active, disabling to speed up atest runtime
(installation takes roughly 30s each time, never cached) -->
diff --git a/android/pandora/server/src/Hap.kt b/android/pandora/server/src/Hap.kt
index ddecaeb773..a242f4bcf2 100644
--- a/android/pandora/server/src/Hap.kt
+++ b/android/pandora/server/src/Hap.kt
@@ -29,8 +29,6 @@ import android.bluetooth.BluetoothProfile.CONNECTION_POLICY_ALLOWED
import android.bluetooth.BluetoothProfile.STATE_CONNECTED
import android.content.Context
import android.content.IntentFilter
-import android.media.AudioManager
-import android.media.AudioTrack
import android.util.Log
import com.google.protobuf.Empty
import io.grpc.Status
@@ -61,7 +59,6 @@ class Hap(val context: Context) : HAPImplBase(), Closeable {
private val bluetoothManager = context.getSystemService(BluetoothManager::class.java)!!
private val bluetoothAdapter = bluetoothManager.adapter
- private val audioManager = context.getSystemService(AudioManager::class.java)!!
private val bluetoothHapClient =
getProfileProxy<BluetoothHapClient>(context, BluetoothProfile.HAP_CLIENT)
@@ -79,8 +76,6 @@ class Hap(val context: Context) : HAPImplBase(), Closeable {
)
.shareIn(scope, SharingStarted.Eagerly)
- private var audioTrack: AudioTrack? = null
-
private class PresetInfoChanged(
var connection: Connection,
var presetInfoList: List<BluetoothHapPresetInfo>,
@@ -287,67 +282,6 @@ class Hap(val context: Context) : HAPImplBase(), Closeable {
}
}
- override fun haPlaybackAudio(
- responseObserver: StreamObserver<Empty>
- ): StreamObserver<HaPlaybackAudioRequest> {
- Log.i(TAG, "haPlaybackAudio")
-
- if (audioTrack == null) {
- audioTrack = buildAudioTrack()
- }
-
- // Play an audio track.
- audioTrack!!.play()
-
- if (audioTrack!!.getPlayState() != AudioTrack.PLAYSTATE_PLAYING) {
- responseObserver.onError(
- Status.UNKNOWN.withDescription("AudioTrack is not started").asException()
- )
- }
-
- // Volume is maxed out to avoid any amplitude modification of the provided audio data,
- // enabling the test runner to do comparisons between input and output audio signal.
- // Any volume modification should be done before providing the audio data.
- if (audioManager.isVolumeFixed) {
- Log.w(TAG, "Volume is fixed, cannot max out the volume")
- } else {
- val maxVolume = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC)
- if (audioManager.getStreamVolume(AudioManager.STREAM_MUSIC) < maxVolume) {
- audioManager.setStreamVolume(
- AudioManager.STREAM_MUSIC,
- maxVolume,
- AudioManager.FLAG_SHOW_UI,
- )
- }
- }
-
- return object : StreamObserver<HaPlaybackAudioRequest> {
- override fun onNext(request: HaPlaybackAudioRequest) {
- val data = request.data.toByteArray()
- val written = synchronized(audioTrack!!) { audioTrack!!.write(data, 0, data.size) }
- if (written != data.size) {
- responseObserver.onError(
- Status.UNKNOWN.withDescription("AudioTrack write failed").asException()
- )
- }
- }
-
- override fun onError(t: Throwable) {
- t.printStackTrace()
- val sw = StringWriter()
- t.printStackTrace(PrintWriter(sw))
- responseObserver.onError(
- Status.UNKNOWN.withCause(t).withDescription(sw.toString()).asException()
- )
- }
-
- override fun onCompleted() {
- responseObserver.onNext(Empty.getDefaultInstance())
- responseObserver.onCompleted()
- }
- }
- }
-
override fun waitPresetChanged(
request: Empty,
responseObserver: StreamObserver<WaitPresetChangedResponse>,
diff --git a/android/pandora/server/src/LeAudio.kt b/android/pandora/server/src/LeAudio.kt
index 7e7e7e6147..7677f9ea71 100644
--- a/android/pandora/server/src/LeAudio.kt
+++ b/android/pandora/server/src/LeAudio.kt
@@ -25,9 +25,11 @@ import android.bluetooth.BluetoothProfile.STATE_DISCONNECTED
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
-import android.media.*
+import android.media.AudioTrack
+import android.media.AudioManager
import android.util.Log
import com.google.protobuf.Empty
+import io.grpc.Status
import io.grpc.stub.StreamObserver
import java.io.Closeable
import kotlinx.coroutines.CoroutineScope
@@ -41,6 +43,8 @@ import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.shareIn
import pandora.LeAudioGrpc.LeAudioImplBase
import pandora.LeAudioProto.*
+import java.io.PrintWriter
+import java.io.StringWriter
@kotlinx.coroutines.ExperimentalCoroutinesApi
class LeAudio(val context: Context) : LeAudioImplBase(), Closeable {
@@ -57,6 +61,8 @@ class LeAudio(val context: Context) : LeAudioImplBase(), Closeable {
private val bluetoothLeAudio =
getProfileProxy<BluetoothLeAudio>(context, BluetoothProfile.LE_AUDIO)
+ private var audioTrack: AudioTrack? = null
+
init {
scope = CoroutineScope(Dispatchers.Default)
val intentFilter = IntentFilter()
@@ -98,4 +104,92 @@ class LeAudio(val context: Context) : LeAudioImplBase(), Closeable {
Empty.getDefaultInstance()
}
}
+
+ override fun leAudioStart(request: LeAudioStartRequest, responseObserver: StreamObserver<Empty>) {
+ grpcUnary<Empty>(scope, responseObserver) {
+ if (audioTrack == null) {
+ audioTrack = buildAudioTrack()
+ }
+ val device = request.connection.toBluetoothDevice(bluetoothAdapter)
+ Log.i(TAG, "start: device=$device")
+
+ if (bluetoothLeAudio.getConnectionState(device) != BluetoothLeAudio.STATE_CONNECTED) {
+ throw RuntimeException("Device is not connected, cannot start")
+ }
+
+ // Configure the selected device as active device if it is not
+ // already.
+ bluetoothLeAudio.setActiveDevice(device)
+
+ // Play an audio track.
+ audioTrack!!.play()
+
+ Empty.getDefaultInstance()
+ }
+ }
+
+ override fun leAudioStop(request: LeAudioStopRequest, responseObserver: StreamObserver<Empty>) {
+ grpcUnary<Empty>(scope, responseObserver) {
+ checkNotNull(audioTrack) { "No track to pause!" }
+
+ // Play an audio track.
+ audioTrack!!.pause()
+
+ Empty.getDefaultInstance()
+ }
+ }
+
+ override fun leAudioPlaybackAudio(
+ responseObserver: StreamObserver<LeAudioPlaybackAudioResponse>
+ ): StreamObserver<LeAudioPlaybackAudioRequest> {
+ Log.i(TAG, "leAudioPlaybackAudio")
+
+ if (audioTrack!!.getPlayState() != AudioTrack.PLAYSTATE_PLAYING) {
+ responseObserver.onError(
+ Status.UNKNOWN.withDescription("AudioTrack is not started").asException()
+ )
+ }
+
+ // Volume is maxed out to avoid any amplitude modification of the provided audio data,
+ // enabling the test runner to do comparisons between input and output audio signal.
+ // Any volume modification should be done before providing the audio data.
+ if (audioManager.isVolumeFixed) {
+ Log.w(TAG, "Volume is fixed, cannot max out the volume")
+ } else {
+ val maxVolume = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC)
+ if (audioManager.getStreamVolume(AudioManager.STREAM_MUSIC) < maxVolume) {
+ audioManager.setStreamVolume(
+ AudioManager.STREAM_MUSIC,
+ maxVolume,
+ AudioManager.FLAG_SHOW_UI,
+ )
+ }
+ }
+
+ return object : StreamObserver<LeAudioPlaybackAudioRequest> {
+ override fun onNext(request: LeAudioPlaybackAudioRequest) {
+ val data = request.data.toByteArray()
+ val written = synchronized(audioTrack!!) { audioTrack!!.write(data, 0, data.size) }
+ if (written != data.size) {
+ responseObserver.onError(
+ Status.UNKNOWN.withDescription("AudioTrack write failed").asException()
+ )
+ }
+ }
+
+ override fun onError(t: Throwable) {
+ t.printStackTrace()
+ val sw = StringWriter()
+ t.printStackTrace(PrintWriter(sw))
+ responseObserver.onError(
+ Status.UNKNOWN.withCause(t).withDescription(sw.toString()).asException()
+ )
+ }
+
+ override fun onCompleted() {
+ responseObserver.onNext(LeAudioPlaybackAudioResponse.getDefaultInstance())
+ responseObserver.onCompleted()
+ }
+ }
+ }
}
diff --git a/android/pandora/server/src/Pan.kt b/android/pandora/server/src/Pan.kt
index 62334af83b..6961eea7dd 100644
--- a/android/pandora/server/src/Pan.kt
+++ b/android/pandora/server/src/Pan.kt
@@ -67,6 +67,7 @@ class Pan(private val context: Context) : PANImplBase(), Closeable {
}
override fun close() {
+ mTetheringManager.stopTethering(TETHERING_BLUETOOTH)
bluetoothAdapter.closeProfileProxy(BluetoothProfile.PAN, bluetoothPan)
mScope.cancel()
}
diff --git a/android/pandora/test/pairing/OWNERS b/android/pandora/test/pairing/OWNERS
deleted file mode 100644
index b430ae987d..0000000000
--- a/android/pandora/test/pairing/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-# Bug component: 27441
-rwt@google.com
diff --git a/apex/OWNERS b/apex/OWNERS
deleted file mode 100644
index cc88477d0e..0000000000
--- a/apex/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# Reviewers for /apex
-
-wescande@google.com
-
diff --git a/apex/hiddenapi/OWNERS b/apex/hiddenapi/OWNERS
deleted file mode 100644
index ac8a2b627c..0000000000
--- a/apex/hiddenapi/OWNERS
+++ /dev/null
@@ -1,5 +0,0 @@
-# soong-team@ as the hiddenapi files are tightly coupled with Soong
-file:platform/build/soong:/OWNERS
-
-# compat-team@ for changes to hiddenapi files
-file:tools/platform-compat:/OWNERS
diff --git a/apex/permissions/OWNERS b/apex/permissions/OWNERS
deleted file mode 100644
index 8b8ec67028..0000000000
--- a/apex/permissions/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-per-file *.xml,OWNERS = file:platform/frameworks/base:/data/etc/OWNERS
diff --git a/build.py b/build.py
index 1f2a925351..de97ce855e 100755
--- a/build.py
+++ b/build.py
@@ -86,7 +86,6 @@ HOST_TESTS = [
# 'bluetooth_test_common',
# 'bluetoothtbd_test',
# 'net_test_avrcp',
- # 'net_test_btcore',
# 'net_test_types',
# 'net_test_btm_iso',
# 'net_test_btpackets',
diff --git a/common/OWNERS b/common/OWNERS
deleted file mode 100644
index 5b3f4bad26..0000000000
--- a/common/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-wescande@google.com
diff --git a/flags/Android.bp b/flags/Android.bp
index 80a57891a5..6f1e67e262 100644
--- a/flags/Android.bp
+++ b/flags/Android.bp
@@ -34,7 +34,6 @@ aconfig_declarations {
"le_scanning.aconfig",
"leaudio.aconfig",
"mapclient.aconfig",
- "mcp.aconfig",
"metric.aconfig",
"opp.aconfig",
"pairing.aconfig",
diff --git a/flags/BUILD.gn b/flags/BUILD.gn
index da5aa8621b..a53cb379fe 100644
--- a/flags/BUILD.gn
+++ b/flags/BUILD.gn
@@ -27,7 +27,6 @@ aconfig("bluetooth_flags_c_lib") {
"le_scanning.aconfig",
"leaudio.aconfig",
"mapclient.aconfig",
- "mcp.aconfig",
"metric.aconfig",
"opp.aconfig",
"pairing.aconfig",
diff --git a/flags/OWNERS b/flags/OWNERS
deleted file mode 100644
index b4f2f7376b..0000000000
--- a/flags/OWNERS
+++ /dev/null
@@ -1,3 +0,0 @@
-# Bug component: 1387432
-girardier@google.com
-wescande@google.com
diff --git a/flags/a2dp.aconfig b/flags/a2dp.aconfig
index e7b9aa21b0..1fd8bbd085 100644
--- a/flags/a2dp.aconfig
+++ b/flags/a2dp.aconfig
@@ -115,3 +115,13 @@ flag {
purpose: PURPOSE_BUGFIX
}
}
+
+flag {
+ name: "avdtp_prevent_double_suspend"
+ namespace: "bluetooth"
+ description: "Add state to prevent sending multiple AVDTP Suspend command in a row"
+ bug: "402241316"
+ metadata {
+ purpose: PURPOSE_BUGFIX
+ }
+}
diff --git a/flags/adapter.aconfig b/flags/adapter.aconfig
index 0195723932..39e681be16 100644
--- a/flags/adapter.aconfig
+++ b/flags/adapter.aconfig
@@ -9,6 +9,16 @@ flag {
}
flag {
+ name: "call_bluetooth_ready_before_profiles_start"
+ namespace: "bluetooth"
+ description: "Initiates the adapter properties before starting profiles"
+ bug: "405437771"
+ metadata {
+ purpose: PURPOSE_BUGFIX
+ }
+}
+
+flag {
name: "empty_names_are_invalid"
namespace: "bluetooth"
description: "Make sure the names used in the stack are valid"
diff --git a/flags/bta_dm.aconfig b/flags/bta_dm.aconfig
index 19e8418785..be510f63cd 100644
--- a/flags/bta_dm.aconfig
+++ b/flags/bta_dm.aconfig
@@ -9,16 +9,6 @@ flag {
}
flag {
- name: "cancel_open_discovery_client"
- namespace: "bluetooth"
- description: "Cancel connection from discovery client correctly"
- bug: "356168480"
- metadata {
- purpose: PURPOSE_BUGFIX
- }
-}
-
-flag {
name: "extend_and_randomize_role_switch_delay"
namespace: "bluetooth"
description: "Fix the possible conflicts between role switch and authentication"
diff --git a/flags/connectivity.aconfig b/flags/connectivity.aconfig
index 482c7e68e8..738c294078 100644
--- a/flags/connectivity.aconfig
+++ b/flags/connectivity.aconfig
@@ -2,30 +2,6 @@ package: "com.android.bluetooth.flags"
container: "com.android.bt"
flag {
- name: "api_get_connection_state_using_identity_address"
- namespace: "bluetooth"
- description: "Use identity address to check current connection state"
- bug: "319471537"
-}
-
-flag {
- name: "use_le_shim_connection_map_guard"
- namespace: "bluetooth"
- description: "Guard the le shim connection map with a mutex"
- bug: "302054609"
-}
-
-flag {
- name: "improve_create_connection_for_already_connecting_device"
- namespace: "bluetooth"
- description: "Make sure to not stop controller with create connection cancel when not needed"
- bug: "356593752"
- metadata {
- purpose: PURPOSE_BUGFIX
- }
-}
-
-flag {
name: "allow_gatt_connect_from_the_apps_without_making_leaudio_device_active"
namespace: "bluetooth"
description: "Allows for GATT connection without making LeAudio device active after connection"
diff --git a/flags/framework.aconfig b/flags/framework.aconfig
index dc48541118..0151b46c70 100644
--- a/flags/framework.aconfig
+++ b/flags/framework.aconfig
@@ -10,16 +10,6 @@ flag {
}
flag {
- name: "identity_address_null_if_not_known"
- namespace: "bluetooth"
- description: "Return null for identity address if identity address is not known"
- bug: "317120534"
- metadata {
- purpose: PURPOSE_BUGFIX
- }
-}
-
-flag {
name: "support_bluetooth_quality_report_v6"
is_exported: true
namespace: "bluetooth"
diff --git a/flags/gap.aconfig b/flags/gap.aconfig
index edc7874fb5..1124679d42 100644
--- a/flags/gap.aconfig
+++ b/flags/gap.aconfig
@@ -50,33 +50,6 @@ flag {
}
flag {
- name: "gatt_client_dynamic_allocation"
- namespace: "bluetooth"
- description: "Allocate GATT clients in heap to unlimit the number of clients"
- bug: "348559823"
-}
-
-flag {
- name: "gatt_fix_multiple_direct_connect"
- namespace: "bluetooth"
- description: "Do not remove device when multiple clients attempt to connect"
- bug: "349232327"
- metadata {
- purpose: PURPOSE_BUGFIX
- }
-}
-
-flag {
- name: "pan_use_identity_address"
- namespace: "bluetooth"
- description: "Use identity address when communicate with native interface"
- bug: "351961492"
- metadata {
- purpose: PURPOSE_BUGFIX
- }
-}
-
-flag {
name: "android_os_identifier"
namespace: "bluetooth"
description: "Add a custom service to provide Android OS identifier"
@@ -97,26 +70,6 @@ flag {
}
flag {
- name: "gatt_disconnect_fix"
- namespace: "bluetooth"
- description: "Fix GATT disconnect handling"
- bug: "361538527"
- metadata {
- purpose: PURPOSE_BUGFIX
- }
-}
-
-flag {
- name: "gatt_server_requests_fix"
- namespace: "bluetooth"
- description: "Fix GATT server handling"
- bug: "361331170"
- metadata {
- purpose: PURPOSE_BUGFIX
- }
-}
-
-flag {
name: "le_scan_msft_support"
namespace: "bluetooth"
description: "Support MSFT HCI extension for LE Scanning. go/bt-msft-aosp-dd"
@@ -300,3 +253,30 @@ flag {
purpose: PURPOSE_BUGFIX
}
}
+
+flag {
+ name: "le_disconnect_notification_handling"
+ namespace: "bluetooth"
+ description: "Fix LE link disconnection notification to stack's upper layers"
+ bug: "403433488"
+ metadata {
+ purpose: PURPOSE_BUGFIX
+ }
+}
+
+flag {
+ name: "rssi_scan_filter"
+ namespace: "bluetooth"
+ description: "Add RSSI ScanFilter"
+ bug: "404986559"
+}
+
+flag {
+ name: "fix_private_gatt_advertising_not_working"
+ namespace: "bluetooth"
+ description: "Fix that private GATT advertising is handled as a normal GATT"
+ bug: "405315235"
+ metadata {
+ purpose: PURPOSE_BUGFIX
+ }
+}
diff --git a/flags/hfp.aconfig b/flags/hfp.aconfig
index c1611242aa..14a91bdc6e 100644
--- a/flags/hfp.aconfig
+++ b/flags/hfp.aconfig
@@ -74,16 +74,6 @@ flag {
}
flag {
- name: "update_active_device_in_band_ringtone"
- namespace: "bluetooth"
- description: "Active device update the in band ringtone, but how ringtone is played is still decided by the headset"
- bug: "349318724"
- metadata {
- purpose: PURPOSE_BUGFIX
- }
-}
-
-flag {
name: "choose_wrong_hfp_codec_in_specific_config"
namespace: "bluetooth"
description: "Flag to fix codec selection in nego when the peer device only support NB and SWB."
@@ -132,3 +122,13 @@ flag {
purpose: PURPOSE_BUGFIX
}
}
+
+flag {
+ name: "hfp_volume_control_property"
+ namespace: "bluetooth"
+ description: "Check system property before hands-free volume UI request."
+ bug: "404152232"
+ metadata {
+ purpose: PURPOSE_BUGFIX
+ }
+}
diff --git a/flags/hid.aconfig b/flags/hid.aconfig
index ee5728c94f..350367818b 100644
--- a/flags/hid.aconfig
+++ b/flags/hid.aconfig
@@ -20,16 +20,6 @@ flag {
}
flag {
- name: "serialize_hogp_and_dis"
- namespace: "bluetooth"
- description: "start HOGP service discovery only after DIS discovery is finished"
- bug: "367910199"
- metadata {
- purpose: PURPOSE_BUGFIX
- }
-}
-
-flag {
name: "dont_send_hid_set_idle"
namespace: "bluetooth"
description: "Don't send the SET IDLE HID message"
@@ -40,16 +30,6 @@ flag {
}
flag {
- name: "forward_get_set_report_failure_to_uhid"
- namespace: "bluetooth"
- description: "Forward GET/SET REPORT reply to UHID even when the request fails"
- bug: "369748430"
- metadata {
- purpose: PURPOSE_BUGFIX
- }
-}
-
-flag {
name: "remove_pending_hid_connection"
namespace: "bluetooth"
description: "Remove the pending BTA HH connection instance when the device is removed"
@@ -128,3 +108,13 @@ flag {
purpose: PURPOSE_BUGFIX
}
}
+
+flag {
+ name: "simpler_hid_connection_policy"
+ namespace: "bluetooth"
+ description: "Simplify native HID host connection policy enforcement"
+ bug: "404590499"
+ metadata {
+ purpose: PURPOSE_BUGFIX
+ }
+}
diff --git a/flags/leaudio.aconfig b/flags/leaudio.aconfig
index a2f77b5658..7a917fbaca 100644
--- a/flags/leaudio.aconfig
+++ b/flags/leaudio.aconfig
@@ -44,16 +44,6 @@ flag {
}
flag {
- name: "leaudio_codec_config_callback_order_fix"
- namespace: "bluetooth"
- description: "Fix for the order on the callback"
- bug: "326442537"
- metadata {
- purpose: PURPOSE_BUGFIX
- }
-}
-
-flag {
name: "leaudio_allow_leaudio_only_devices"
namespace: "bluetooth"
description: "Enable Le Audio for LeAudio only devices"
@@ -61,16 +51,6 @@ flag {
}
flag {
- name: "leaudio_mono_location_errata"
- namespace: "bluetooth"
- description: "Add mono location as per Bluetooth Assigned Numbers"
- bug: "331139722"
- metadata {
- purpose: PURPOSE_BUGFIX
- }
-}
-
-flag {
name: "leaudio_mono_location_errata_api"
is_exported: true
namespace: "bluetooth"
@@ -79,13 +59,6 @@ flag {
}
flag {
- name: "le_audio_support_unidirectional_voice_assistant"
- namespace: "bluetooth"
- description: "Allow to create unidirectional stream for VOICEASSISTANT"
- bug: "332510824"
-}
-
-flag {
name: "run_clock_recovery_in_worker_thread"
namespace: "bluetooth"
description: "Fix thread ownership issue in clock_recovery"
@@ -116,16 +89,6 @@ flag {
}
flag {
- name: "leaudio_speed_up_reconfiguration_between_call"
- namespace: "bluetooth"
- description: "Fix reconfiguration time between call and media"
- bug: "352686917"
- metadata {
- purpose: PURPOSE_BUGFIX
- }
-}
-
-flag {
name: "leaudio_set_codec_config_preference"
namespace: "bluetooth"
description: "New apis to set codec config preference"
@@ -157,26 +120,6 @@ flag {
}
flag {
- name: "leaudio_unicast_no_available_contexts"
- namespace: "bluetooth"
- description: "Fix handling initial zero available contexts"
- bug: "367325041"
- metadata {
- purpose: PURPOSE_BUGFIX
- }
-}
-
-flag {
- name: "leaudio_improve_switch_during_phone_call"
- namespace: "bluetooth"
- description: "Fix audio slip to speaker while switching bt audio device during phonecall"
- bug: "369322905"
- metadata {
- purpose: PURPOSE_BUGFIX
- }
-}
-
-flag {
name: "leaudio_sort_scans_to_sync_by_fails"
namespace: "bluetooth"
description: "Sort scan results for source sync by fails counter"
diff --git a/flags/mcp.aconfig b/flags/mcp.aconfig
deleted file mode 100644
index 80567acae7..0000000000
--- a/flags/mcp.aconfig
+++ /dev/null
@@ -1,13 +0,0 @@
-package: "com.android.bluetooth.flags"
-container: "com.android.bt"
-
-flag {
- name: "mcp_allow_play_without_active_player"
- namespace: "bluetooth"
- description: "Handle LeAudio play same as in AVRCP in case player is not active"
- bug: "337169240"
- metadata {
- purpose: PURPOSE_BUGFIX
- }
-
-}
diff --git a/flags/opp.aconfig b/flags/opp.aconfig
index 6d1a13bf21..cdba75b756 100644
--- a/flags/opp.aconfig
+++ b/flags/opp.aconfig
@@ -2,16 +2,6 @@ package: "com.android.bluetooth.flags"
container: "com.android.bt"
flag {
- name: "opp_ignore_content_observer_after_service_stop"
- namespace: "bluetooth"
- description: "When OppService.stop() is called, previously posted ContentObserver.onChange() should not run"
- bug: "346467641"
- metadata {
- purpose: PURPOSE_BUGFIX
- }
-}
-
-flag {
name: "opp_set_insets_for_edge_to_edge"
namespace: "bluetooth"
description: "Set proper insets in BluetoothOppTransferHistory to adapt to edge-to-edge."
diff --git a/flags/pairing.aconfig b/flags/pairing.aconfig
index f30410db17..faae7d2618 100644
--- a/flags/pairing.aconfig
+++ b/flags/pairing.aconfig
@@ -270,3 +270,13 @@ flag {
purpose: PURPOSE_BUGFIX
}
}
+
+flag {
+ name: "unrelated_device_smp_cancellation"
+ namespace: "bluetooth"
+ description: "Don't cancel SMP pairing if encryption fails for unrelated device"
+ bug: "404658828"
+ metadata {
+ purpose: PURPOSE_BUGFIX
+ }
+}
diff --git a/floss/OWNERS b/floss/OWNERS
deleted file mode 100644
index a823e6e1dd..0000000000
--- a/floss/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_chromeos
diff --git a/floss/pandora/OWNERS b/floss/pandora/OWNERS
deleted file mode 100644
index ca4001b6d4..0000000000
--- a/floss/pandora/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# Reviewers for /floss/pandora
-
-johnlai@google.com
-chharry@google.com
diff --git a/framework/OWNERS b/framework/OWNERS
deleted file mode 100644
index 40a43c47cb..0000000000
--- a/framework/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-hallstrom@google.com
-okamil@google.com
-siyuanh@google.com
-wescande@google.com
diff --git a/framework/java/android/bluetooth/BluetoothAdapter.java b/framework/java/android/bluetooth/BluetoothAdapter.java
index 1b37497323..b7feb11e19 100644
--- a/framework/java/android/bluetooth/BluetoothAdapter.java
+++ b/framework/java/android/bluetooth/BluetoothAdapter.java
@@ -3460,14 +3460,14 @@ public final class BluetoothAdapter {
BiFunction<Context, BluetoothAdapter, BluetoothProfile> constructor =
PROFILE_CONSTRUCTORS.get(profile);
- BluetoothProfile profileProxy = constructor.apply(context, this);
- ProfileConnection connection = new ProfileConnection(profile, listener, executor);
-
if (constructor == null) {
Log.e(TAG, "getProfileProxy(): Unknown profile " + profile);
return false;
}
+ BluetoothProfile profileProxy = constructor.apply(context, this);
+ ProfileConnection connection = new ProfileConnection(profile, listener, executor);
+
synchronized (sProfileLock) {
// Synchronize with the binder callback to prevent performing the
// ProfileConnection.connect concurrently
diff --git a/framework/java/android/bluetooth/OWNERS b/framework/java/android/bluetooth/OWNERS
deleted file mode 100644
index 757ed73819..0000000000
--- a/framework/java/android/bluetooth/OWNERS
+++ /dev/null
@@ -1,5 +0,0 @@
-per-file BluetoothHearingAid.java=file:/OWNERS_hearingaid
-per-file BluetoothCsipSetCoordinator.java=file:/OWNERS_leaudio
-per-file BluetoothLeAudio*.java=file:/OWNERS_leaudio
-per-file BluetoothLeBroadcast*.java=file:/OWNERS_leaudio
-per-file BluetoothVolumeControl.java=file:/OWNERS_leaudio
diff --git a/framework/tests/bumble/src/android/bluetooth/DckScanTest.kt b/framework/tests/bumble/src/android/bluetooth/DckScanTest.kt
index 8660a4076b..845862b71a 100644
--- a/framework/tests/bumble/src/android/bluetooth/DckScanTest.kt
+++ b/framework/tests/bumble/src/android/bluetooth/DckScanTest.kt
@@ -32,6 +32,7 @@ import kotlinx.coroutines.flow.first
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withTimeout
import org.junit.Assume.assumeTrue
+import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -99,6 +100,7 @@ class DckScanTest(
}
@Test
+ @Ignore("b/404159990")
fun scanForUuid_remoteFound() {
// Assume isRemoteAdvertisingWithUuid is true to skip tests in which
// device is not advertising with UUID
diff --git a/framework/tests/bumble/src/android/bluetooth/GattClientTest.java b/framework/tests/bumble/src/android/bluetooth/GattClientTest.java
index 9b631dce91..6e6337279e 100644
--- a/framework/tests/bumble/src/android/bluetooth/GattClientTest.java
+++ b/framework/tests/bumble/src/android/bluetooth/GattClientTest.java
@@ -422,7 +422,6 @@ public class GattClientTest {
}
@Test
- @RequiresFlagsEnabled(Flags.FLAG_GATT_FIX_MULTIPLE_DIRECT_CONNECT)
public void connectMultiple_closeOne_shouldSuccess() {
BluetoothGattCallback gattCallback = mock(BluetoothGattCallback.class);
BluetoothGattCallback gattCallback2 = mock(BluetoothGattCallback.class);
@@ -435,11 +434,11 @@ public class GattClientTest {
BluetoothGatt gatt2 = device.connectGatt(mContext, false, gattCallback2);
try {
- gatt.disconnect();
- gatt.close();
-
verify(gattCallback2, timeout(1000))
.onConnectionStateChange(eq(gatt2), eq(GATT_SUCCESS), eq(STATE_CONNECTED));
+
+ gatt.disconnect();
+ gatt.close();
} finally {
gatt2.disconnect();
gatt2.close();
@@ -696,7 +695,6 @@ public class GattClientTest {
// Check if we can have 100 simultaneous clients
@Test
- @RequiresFlagsEnabled(Flags.FLAG_GATT_CLIENT_DYNAMIC_ALLOCATION)
public void connectGatt_multipleClients() {
registerGattService();
diff --git a/framework/tests/bumble/src/android/bluetooth/hid/HidHeadTrackerTest.java b/framework/tests/bumble/src/android/bluetooth/hid/HidHeadTrackerTest.java
index 38527362ba..3df5075936 100644
--- a/framework/tests/bumble/src/android/bluetooth/hid/HidHeadTrackerTest.java
+++ b/framework/tests/bumble/src/android/bluetooth/hid/HidHeadTrackerTest.java
@@ -64,6 +64,7 @@ import android.util.Log;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.platform.app.InstrumentationRegistry;
+import com.android.bluetooth.flags.Flags;
import com.android.compatibility.common.util.AdoptShellPermissionsRule;
import org.hamcrest.CustomTypeSafeMatcher;
@@ -353,6 +354,7 @@ public class HidHeadTrackerTest {
BluetoothDevice.ACTION_UUID,
BluetoothDevice.ACTION_ACL_CONNECTED,
BluetoothDevice.ACTION_ACL_DISCONNECTED,
+ BluetoothHidHost.ACTION_CONNECTION_STATE_CHANGED,
BluetoothDevice.ACTION_FOUND);
}
@@ -405,6 +407,7 @@ public class HidHeadTrackerTest {
unregisterIntentActions(
BluetoothDevice.ACTION_UUID,
BluetoothDevice.ACTION_ACL_CONNECTED,
+ BluetoothHidHost.ACTION_CONNECTION_STATE_CHANGED,
BluetoothDevice.ACTION_FOUND);
}
@@ -490,8 +493,10 @@ public class HidHeadTrackerTest {
*/
private void verifyTransportSwitch(BluetoothDevice device, int fromTransport, int toTransport) {
assertThat(fromTransport).isNotEqualTo(toTransport);
- verifyConnectionState(mBumbleDevice, equalTo(fromTransport), equalTo(STATE_DISCONNECTING));
-
+ if (!Flags.ignoreUnselectedHidTransportStates()) {
+ verifyConnectionState(
+ mBumbleDevice, equalTo(fromTransport), equalTo(STATE_DISCONNECTING));
+ }
// Capture the next intent with filter
// Filter is necessary as otherwise it will corrupt all other unordered verifications
final Intent[] savedIntent = {null};
diff --git a/framework/tests/bumble/src/android/bluetooth/hid/HidHostDualModeTest.java b/framework/tests/bumble/src/android/bluetooth/hid/HidHostDualModeTest.java
index fb89c738ad..45c329e460 100644
--- a/framework/tests/bumble/src/android/bluetooth/hid/HidHostDualModeTest.java
+++ b/framework/tests/bumble/src/android/bluetooth/hid/HidHostDualModeTest.java
@@ -66,6 +66,7 @@ import android.util.Log;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.platform.app.InstrumentationRegistry;
+import com.android.bluetooth.flags.Flags;
import com.android.compatibility.common.util.AdoptShellPermissionsRule;
import org.hamcrest.CustomTypeSafeMatcher;
@@ -503,8 +504,9 @@ public class HidHostDualModeTest {
*/
private void verifyTransportSwitch(BluetoothDevice device, int fromTransport, int toTransport) {
assertThat(fromTransport).isNotEqualTo(toTransport);
- verifyConnectionState(mDevice, equalTo(fromTransport), equalTo(STATE_DISCONNECTING));
-
+ if (!Flags.ignoreUnselectedHidTransportStates()) {
+ verifyConnectionState(mDevice, equalTo(fromTransport), equalTo(STATE_DISCONNECTING));
+ }
// Capture the next intent with filter
// Filter is necessary as otherwise it will corrupt all other unordered verifications
final Intent[] savedIntent = {null};
diff --git a/framework/tests/bumble/src/android/bluetooth/hid/OWNERS b/framework/tests/bumble/src/android/bluetooth/hid/OWNERS
deleted file mode 100644
index 75539edb09..0000000000
--- a/framework/tests/bumble/src/android/bluetooth/hid/OWNERS
+++ /dev/null
@@ -1,3 +0,0 @@
-# Bug component: 27441
-# Project owners
-rwt@google.com
diff --git a/framework/tests/bumble/src/android/bluetooth/pairing/OWNERS b/framework/tests/bumble/src/android/bluetooth/pairing/OWNERS
deleted file mode 100644
index 75539edb09..0000000000
--- a/framework/tests/bumble/src/android/bluetooth/pairing/OWNERS
+++ /dev/null
@@ -1,3 +0,0 @@
-# Bug component: 27441
-# Project owners
-rwt@google.com
diff --git a/framework/tests/bumble/src/android/bluetooth/pairing/PairingTest.java b/framework/tests/bumble/src/android/bluetooth/pairing/PairingTest.java
index 37dc344cb5..ecb400deb3 100644
--- a/framework/tests/bumble/src/android/bluetooth/pairing/PairingTest.java
+++ b/framework/tests/bumble/src/android/bluetooth/pairing/PairingTest.java
@@ -32,6 +32,7 @@ import android.bluetooth.BluetoothHidHost;
import android.bluetooth.BluetoothManager;
import android.bluetooth.BluetoothProfile;
import android.bluetooth.BluetoothStatusCodes;
+import android.bluetooth.BluetoothSocket;
import android.bluetooth.PandoraDevice;
import android.bluetooth.StreamObserverSpliterator;
import android.bluetooth.Utils;
@@ -41,6 +42,7 @@ import android.bluetooth.test_utils.BlockingBluetoothAdapter;
import android.bluetooth.test_utils.EnableBluetoothRule;
import android.content.Context;
import android.os.ParcelUuid;
+import android.util.Log;
import android.platform.test.annotations.RequiresFlagsEnabled;
import android.platform.test.flag.junit.CheckFlagsRule;
import android.platform.test.flag.junit.DeviceFlagsValueProvider;
@@ -80,6 +82,9 @@ import java.time.Duration;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.io.IOException;
@RunWith(TestParameterInjector.class)
public class PairingTest {
@@ -87,6 +92,7 @@ public class PairingTest {
private static final Duration BOND_INTENT_TIMEOUT = Duration.ofSeconds(10);
private static final int TEST_DELAY_MS = 1000;
+ private static final int TEST_PSM = 5;
private static final ParcelUuid BATTERY_UUID =
ParcelUuid.fromString("0000180F-0000-1000-8000-00805F9B34FB");
@@ -836,6 +842,101 @@ public class PairingTest {
intentReceiver.close();
}
+ /**
+ * Test pending LE L2CAP socket connection and LE pairing
+ *
+ * <p>Prerequisites:
+ *
+ * <ol>
+ * <li>Bumble and Android are not bonded
+ * </ol>
+ *
+ * <p>Steps:
+ *
+ * <ol>
+ * <li>Make Remote device non-connectable over LE
+ * <li>Initiate LE socket connection from DUT to Remote device
+ * <li>Initiate LE pairing from DUT to Remote device
+ * <li>Start LE Advertisement from Remote device after few seconds
+ * </ol>
+ *
+ * <p>Expectation: LE connection should be created and LE Pairing should succeed.
+ */
+ @Test
+ public void testCreateLeSocket_BondLe() throws Exception {
+ IntentReceiver intentReceiver = new IntentReceiver.Builder(sTargetContext,
+ BluetoothDevice.ACTION_ACL_CONNECTED,
+ BluetoothDevice.ACTION_PAIRING_REQUEST,
+ BluetoothDevice.ACTION_BOND_STATE_CHANGED)
+ .build();
+
+ StreamObserver<PairingEventAnswer> pairingEventAnswerObserver =
+ mBumble.security()
+ .withDeadlineAfter(BOND_INTENT_TIMEOUT.toMillis(), TimeUnit.MILLISECONDS)
+ .onPairing(mPairingEventStreamObserver);
+
+ BluetoothSocket bluetoothSocket = mBumbleDevice.createL2capChannel(TEST_PSM);
+
+ ExecutorService executor = Executors.newSingleThreadExecutor();
+ executor.submit(() -> {
+ try {
+ bluetoothSocket.connect();
+ } catch (IOException e) {
+ Log.e(TAG, "Exception during socket connection: " + e);
+ }
+ });
+ executor.shutdown();
+
+ // Wait for LE L2CAP socket connection above to be called and reach BT stack
+ Thread.sleep(2000);
+
+ mBumbleDevice.createBond(BluetoothDevice.TRANSPORT_LE);
+
+ /* Make LE L2CAP socket connection and LE Bond calls to wait for few seconds
+ and start LE advertisement from remote device. */
+ Thread.sleep(3000);
+
+ // Start LE advertisement from Bumble
+ AdvertiseRequest.Builder advRequestBuilder =
+ AdvertiseRequest.newBuilder().setLegacy(true)
+ .setConnectable(true)
+ .setOwnAddressType(OwnAddressType.PUBLIC);
+
+ StreamObserverSpliterator<AdvertiseResponse> responseObserver =
+ new StreamObserverSpliterator<>();
+ mBumble.host().advertise(advRequestBuilder.build(), responseObserver);
+
+ intentReceiver.verifyReceivedOrdered(
+ hasAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED),
+ hasExtra(BluetoothDevice.EXTRA_DEVICE, mBumbleDevice),
+ hasExtra(BluetoothDevice.EXTRA_BOND_STATE, BluetoothDevice.BOND_BONDING));
+
+ intentReceiver.verifyReceivedOrdered(
+ hasAction(BluetoothDevice.ACTION_ACL_CONNECTED),
+ hasExtra(BluetoothDevice.EXTRA_DEVICE, mBumbleDevice),
+ hasExtra(BluetoothDevice.EXTRA_TRANSPORT, BluetoothDevice.TRANSPORT_LE));
+
+ intentReceiver.verifyReceivedOrdered(
+ hasAction(BluetoothDevice.ACTION_PAIRING_REQUEST),
+ hasExtra(BluetoothDevice.EXTRA_DEVICE, mBumbleDevice),
+ hasExtra(
+ BluetoothDevice.EXTRA_PAIRING_VARIANT,
+ BluetoothDevice.PAIRING_VARIANT_CONSENT));
+ mBumbleDevice.setPairingConfirmation(true);
+
+ PairingEvent pairingEvent = mPairingEventStreamObserver.iterator().next();
+ assertThat(pairingEvent.hasJustWorks()).isTrue();
+ pairingEventAnswerObserver.onNext(
+ PairingEventAnswer.newBuilder().setEvent(pairingEvent).setConfirm(true).build());
+
+ intentReceiver.verifyReceivedOrdered(
+ hasAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED),
+ hasExtra(BluetoothDevice.EXTRA_DEVICE, mBumbleDevice),
+ hasExtra(BluetoothDevice.EXTRA_BOND_STATE, BluetoothDevice.BOND_BONDED));
+
+ intentReceiver.close();
+ }
+
/** Helper/testStep functions goes here */
/**
diff --git a/framework/tests/bumble/src/android/bluetooth/service_discovery/OWNERS b/framework/tests/bumble/src/android/bluetooth/service_discovery/OWNERS
deleted file mode 100644
index 353b5d03a5..0000000000
--- a/framework/tests/bumble/src/android/bluetooth/service_discovery/OWNERS
+++ /dev/null
@@ -1,3 +0,0 @@
-# Bug component: 27441
-# Project owners
-jpawlowski@google.com
diff --git a/framework/tests/bumble/src/android/bluetooth/sockets/OWNERS b/framework/tests/bumble/src/android/bluetooth/sockets/OWNERS
deleted file mode 100644
index f9b588d2e9..0000000000
--- a/framework/tests/bumble/src/android/bluetooth/sockets/OWNERS
+++ /dev/null
@@ -1,3 +0,0 @@
-# Project owners
-bhaktha@google.com
-poahlo@google.com
diff --git a/framework/tests/metrics/OWNERS b/framework/tests/metrics/OWNERS
deleted file mode 100644
index 01d41baf7e..0000000000
--- a/framework/tests/metrics/OWNERS
+++ /dev/null
@@ -1,3 +0,0 @@
-# Bug component: 1099313
-# Project owners
-ahujapalash@google.com
diff --git a/framework/tests/unit/src/android/bluetooth/BluetoothCodecConfigTest.java b/framework/tests/unit/src/android/bluetooth/BluetoothCodecConfigTest.java
index d2ca867f01..1129a2c8db 100644
--- a/framework/tests/unit/src/android/bluetooth/BluetoothCodecConfigTest.java
+++ b/framework/tests/unit/src/android/bluetooth/BluetoothCodecConfigTest.java
@@ -26,7 +26,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
-/** Unit test cases for {@link BluetoothCodecConfig}. */
+/** Test cases for {@link BluetoothCodecConfig}. */
@RunWith(AndroidJUnit4.class)
public class BluetoothCodecConfigTest {
diff --git a/framework/tests/unit/src/android/bluetooth/BluetoothCodecStatusTest.java b/framework/tests/unit/src/android/bluetooth/BluetoothCodecStatusTest.java
index 25b1812bf5..33aae7f0e6 100644
--- a/framework/tests/unit/src/android/bluetooth/BluetoothCodecStatusTest.java
+++ b/framework/tests/unit/src/android/bluetooth/BluetoothCodecStatusTest.java
@@ -26,7 +26,7 @@ import org.junit.runner.RunWith;
import java.util.List;
-/** Unit test cases for {@link BluetoothCodecStatus}. */
+/** Test cases for {@link BluetoothCodecStatus}. */
@RunWith(AndroidJUnit4.class)
public class BluetoothCodecStatusTest {
diff --git a/framework/tests/unit/src/android/bluetooth/BluetoothLeAudioCodecConfigTest.java b/framework/tests/unit/src/android/bluetooth/BluetoothLeAudioCodecConfigTest.java
index 7a8f16d778..095e8dc5c2 100644
--- a/framework/tests/unit/src/android/bluetooth/BluetoothLeAudioCodecConfigTest.java
+++ b/framework/tests/unit/src/android/bluetooth/BluetoothLeAudioCodecConfigTest.java
@@ -24,7 +24,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
-/** Unit test cases for {@link BluetoothLeAudioCodecConfig}. */
+/** Test cases for {@link BluetoothLeAudioCodecConfig}. */
@RunWith(AndroidJUnit4.class)
public class BluetoothLeAudioCodecConfigTest {
diff --git a/framework/tests/unit/src/android/bluetooth/BluetoothUuidTest.java b/framework/tests/unit/src/android/bluetooth/BluetoothUuidTest.java
index 808f1cf95f..4a36c65f40 100644
--- a/framework/tests/unit/src/android/bluetooth/BluetoothUuidTest.java
+++ b/framework/tests/unit/src/android/bluetooth/BluetoothUuidTest.java
@@ -27,7 +27,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-/** Unit test cases for {@link BluetoothUuid}. */
+/** Test cases for {@link BluetoothUuid}. */
@RunWith(JUnit4.class)
public class BluetoothUuidTest {
diff --git a/framework/tests/unit/src/android/bluetooth/le/ScanFilterTest.java b/framework/tests/unit/src/android/bluetooth/le/ScanFilterTest.java
index 18dc031429..c204028f4f 100644
--- a/framework/tests/unit/src/android/bluetooth/le/ScanFilterTest.java
+++ b/framework/tests/unit/src/android/bluetooth/le/ScanFilterTest.java
@@ -25,7 +25,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-/** Test for Bluetooth LE {@link ScanFilter}. */
+/** Test cases for {@link ScanFilter}. */
@RunWith(JUnit4.class)
public class ScanFilterTest {
diff --git a/framework/tests/unit/src/android/bluetooth/le/ScanRecordTest.java b/framework/tests/unit/src/android/bluetooth/le/ScanRecordTest.java
index 4292583191..68463b4f78 100644
--- a/framework/tests/unit/src/android/bluetooth/le/ScanRecordTest.java
+++ b/framework/tests/unit/src/android/bluetooth/le/ScanRecordTest.java
@@ -34,7 +34,7 @@ import java.util.List;
import java.util.function.Predicate;
/**
- * Unit test cases for {@link ScanRecord}.
+ * Test cases for {@link ScanRecord}.
*
* <p>To run this test, use adb shell am instrument -e class 'android.bluetooth.ScanRecordTest' -w
* 'com.android.bluetooth.tests/android.bluetooth.BluetoothTestRunner'
diff --git a/framework/tests/unit/src/android/bluetooth/le/ScanSettingsTest.java b/framework/tests/unit/src/android/bluetooth/le/ScanSettingsTest.java
index b9ee993b82..2af50ae5da 100644
--- a/framework/tests/unit/src/android/bluetooth/le/ScanSettingsTest.java
+++ b/framework/tests/unit/src/android/bluetooth/le/ScanSettingsTest.java
@@ -41,7 +41,7 @@ import org.junit.rules.TestRule;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-/** Test for Bluetooth LE {@link ScanSettings}. */
+/** Test cases for {@link ScanSettings}. */
@RunWith(JUnit4.class)
public class ScanSettingsTest {
@Rule
diff --git a/framework/tests/util/src/BlockingBluetoothAdapter.kt b/framework/tests/util/src/BlockingBluetoothAdapter.kt
index 13ea7aee9b..5d55b80c51 100644
--- a/framework/tests/util/src/BlockingBluetoothAdapter.kt
+++ b/framework/tests/util/src/BlockingBluetoothAdapter.kt
@@ -145,22 +145,14 @@ object BlockingBluetoothAdapter {
Log.e(TAG, "disable: Failed")
return false
}
- // Notify that disable was call.
- state.wasDisabled = true
return state.waitForStateWithTimeout(stateChangeTimeout, STATE_OFF)
}
}
private class AdapterStateListener(context: Context, private val adapter: BluetoothAdapter) {
- private val STATE_UNKNOWN = -42
private val STATE_BLE_TURNING_ON = 14 // BluetoothAdapter.STATE_BLE_TURNING_ON
private val STATE_BLE_TURNING_OFF = 16 // BluetoothAdapter.STATE_BLE_TURNING_OFF
- // Set to true once a call to disable is made, in order to force the differentiation between the
- // various state hidden within STATE_OFF (OFF, BLE_TURNING_ON, BLE_TURNING_OFF)
- // Once true, getter will return STATE_OFF when there has not been any callback sent to it
- var wasDisabled = false
-
val adapterStateFlow =
callbackFlow<Intent> {
val broadcastReceiver =
@@ -184,10 +176,8 @@ private class AdapterStateListener(context: Context, private val adapter: Blueto
state
} else if (adapter.isLeEnabled()) {
STATE_BLE_ON
- } else if (wasDisabled) {
- STATE_OFF
} else {
- STATE_UNKNOWN
+ STATE_OFF
}
}
@@ -200,7 +190,6 @@ private class AdapterStateListener(context: Context, private val adapter: Blueto
// Cts cannot use BluetoothAdapter.nameForState prior to T, some module test on R
private fun nameForState(state: Int): String {
return when (state) {
- STATE_UNKNOWN -> "UNKNOWN: State is oneOf(OFF, BLE_TURNING_ON, BLE_TURNING_OFF)"
STATE_OFF -> "OFF"
STATE_TURNING_ON -> "TURNING_ON"
STATE_ON -> "ON"
diff --git a/pandora/OWNERS b/pandora/OWNERS
deleted file mode 100644
index 14634f3b78..0000000000
--- a/pandora/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-# Project owners
-girardier@google.com
diff --git a/pandora/interfaces/pandora_experimental/hap.proto b/pandora/interfaces/pandora_experimental/hap.proto
index 5847887529..d56fdb515d 100644
--- a/pandora/interfaces/pandora_experimental/hap.proto
+++ b/pandora/interfaces/pandora_experimental/hap.proto
@@ -28,8 +28,6 @@ service HAP {
rpc SetNextPreset(SetNextPresetRequest) returns (google.protobuf.Empty);
// Set next preset
rpc SetPreviousPreset(SetPreviousPresetRequest) returns (google.protobuf.Empty);
- // Playback audio
- rpc HaPlaybackAudio(stream HaPlaybackAudioRequest) returns (google.protobuf.Empty);
// Set preset name
rpc WritePresetName(WritePresetNameRequest) returns (google.protobuf.Empty);
// Get preset record
@@ -50,16 +48,6 @@ message GetFeaturesResponse{
int32 features = 1;
}
-// Request of the `PlaybackAudio` method.
-message HaPlaybackAudioRequest {
- // Low Energy connection.
- Connection connection = 1;
- // Audio data to playback.
- // `data` should be interleaved stereo frames with 16-bit signed little-endian
- // linear PCM samples at 44100Hz sample rate
- bytes data = 2;
-}
-
// Request of the `SetActivePreset` method.
message SetActivePresetRequest {
// Connection crafted by grpc server
diff --git a/pandora/interfaces/pandora_experimental/le_audio.proto b/pandora/interfaces/pandora_experimental/le_audio.proto
index 4500564991..4628ac9a2e 100644
--- a/pandora/interfaces/pandora_experimental/le_audio.proto
+++ b/pandora/interfaces/pandora_experimental/le_audio.proto
@@ -10,8 +10,33 @@ package pandora;
// Service to trigger LE Audio procedures.
service LeAudio {
rpc Open(OpenRequest) returns (google.protobuf.Empty);
+ // Playback audio
+ rpc LeAudioPlaybackAudio(stream LeAudioPlaybackAudioRequest) returns (LeAudioPlaybackAudioResponse);
+ // Start an opened stream.
+ rpc LeAudioStart(LeAudioStartRequest) returns (google.protobuf.Empty);
+ // Stop an opened stream.
+ rpc LeAudioStop(LeAudioStopRequest) returns (google.protobuf.Empty);
}
message OpenRequest {
Connection connection = 1;
}
+
+// Request for the `LeAudioStart` method.
+message LeAudioStartRequest {
+ Connection connection = 1;
+}
+
+// Request of the `PlaybackAudio` method.
+message LeAudioPlaybackAudioRequest {
+ // Audio data to playback.
+ bytes data = 1;
+}
+
+// Response of the `LeAudioPlaybackAudio` method.
+message LeAudioPlaybackAudioResponse {}
+
+// Request of the `LeAudioStop` method.
+message LeAudioStopRequest {
+ Connection connection = 1;
+}
diff --git a/service/OWNERS b/service/OWNERS
deleted file mode 100644
index 5b3f4bad26..0000000000
--- a/service/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-wescande@google.com
diff --git a/service/src/com/android/server/bluetooth/BluetoothManagerService.java b/service/src/com/android/server/bluetooth/BluetoothManagerService.java
index 5f13b6266a..b797d6ceac 100644
--- a/service/src/com/android/server/bluetooth/BluetoothManagerService.java
+++ b/service/src/com/android/server/bluetooth/BluetoothManagerService.java
@@ -1391,15 +1391,31 @@ class BluetoothManagerService {
}
// If we tried to enable BT while BT was in the process of shutting down,
// wait for the BT process to fully tear down and then force a restart
- // here. This is a bit of a hack (b/29363429).
+ // here. This is a bit of a hack (b/29363429).
if (prevState == STATE_BLE_TURNING_OFF && newState == STATE_OFF) {
- if (mEnable) {
- Log.d(TAG, "Entering STATE_OFF but mEnabled is true; restarting.");
- if (!Flags.systemServerRemoveExtraThreadJump()) {
- waitForState(STATE_OFF);
+ if (Flags.enableBleWhileDisablingAirplane()) {
+ if (mHandler.hasMessages(0, ON_AIRPLANE_MODE_CHANGED_TOKEN)) {
+ mHandler.removeCallbacksAndMessages(ON_AIRPLANE_MODE_CHANGED_TOKEN);
+ Log.d(TAG, "Handling delayed airplane mode event");
+ handleAirplaneModeChanged(AirplaneModeListener.isOnOverrode());
+ }
+ if (mEnable && !isBinding()) {
+ Log.d(TAG, "Entering STATE_OFF but mEnabled is true; restarting.");
+ if (!Flags.systemServerRemoveExtraThreadJump()) {
+ waitForState(STATE_OFF);
+ }
+ mHandler.sendEmptyMessageDelayed(
+ MESSAGE_RESTART_BLUETOOTH_SERVICE, getServiceRestartMs());
+ }
+ } else {
+ if (mEnable) {
+ Log.d(TAG, "Entering STATE_OFF but mEnabled is true; restarting.");
+ if (!Flags.systemServerRemoveExtraThreadJump()) {
+ waitForState(STATE_OFF);
+ }
+ mHandler.sendEmptyMessageDelayed(
+ MESSAGE_RESTART_BLUETOOTH_SERVICE, getServiceRestartMs());
}
- mHandler.sendEmptyMessageDelayed(
- MESSAGE_RESTART_BLUETOOTH_SERVICE, getServiceRestartMs());
}
}
if (newState == STATE_ON || newState == STATE_BLE_ON) {
diff --git a/service/tests/src/com/android/server/bluetooth/BluetoothManagerServiceTest.java b/service/tests/src/com/android/server/bluetooth/BluetoothManagerServiceTest.java
index 5e2b66ac06..e825940e90 100644
--- a/service/tests/src/com/android/server/bluetooth/BluetoothManagerServiceTest.java
+++ b/service/tests/src/com/android/server/bluetooth/BluetoothManagerServiceTest.java
@@ -617,6 +617,35 @@ public class BluetoothManagerServiceTest {
assertThat(mLooper.nextMessage()).isNull(); // Must not create a MESSAGE_ENABLE
}
+ @Test
+ @EnableFlags({
+ Flags.FLAG_SYSTEM_SERVER_REMOVE_EXTRA_THREAD_JUMP,
+ Flags.FLAG_ENABLE_BLE_WHILE_DISABLING_AIRPLANE
+ })
+ public void enableBle_whenDisableAirplaneIsDelayed_startBluetooth() throws Exception {
+ mManagerService.enable("enableBle_whenDisableAirplaneIsDelayed_startBluetooth");
+ IBluetoothCallback btCallback = transition_offToOn();
+ mManagerService.onAirplaneModeChanged(true);
+ assertThat(mManagerService.getState()).isEqualTo(STATE_TURNING_OFF);
+
+ // Generate an event that will be delayed due to the TURNING_OFF state
+ mManagerService.onAirplaneModeChanged(false);
+
+ transition_onToBleOn(btCallback);
+ mInOrder.verify(mAdapterBinder).bleOnToOff(any());
+ assertThat(mManagerService.getState()).isEqualTo(STATE_BLE_TURNING_OFF);
+
+ // As soon as we left BLE_ON, generate a call from 3p app that request to turn on Bluetooth
+ mManagerService.enableBle("enableBle_whenDisableAirplaneIsDelayed_startBluetooth", mBinder);
+
+ // When all the profile are started, adapterService consider it is ON
+ btCallback.onBluetoothStateChange(STATE_BLE_TURNING_OFF, STATE_OFF);
+ syncHandler(MESSAGE_BLUETOOTH_STATE_CHANGE);
+
+ transition_offToOn();
+ assertThat(mManagerService.getState()).isEqualTo(STATE_ON);
+ }
+
@SafeVarargs
private void verifyIntentSent(Matcher<Intent>... matchers) {
mInOrder.verify(mContext)
diff --git a/sysprop/OWNERS b/sysprop/OWNERS
deleted file mode 100644
index 5b3f4bad26..0000000000
--- a/sysprop/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-wescande@google.com
diff --git a/system/BUILD.gn b/system/BUILD.gn
index 48b6207a60..1d6325e6d9 100644
--- a/system/BUILD.gn
+++ b/system/BUILD.gn
@@ -41,7 +41,6 @@ group("bluetooth") {
#if (use.test) {
#group("bluetooth_tests") {
#deps = [
- #"//bt/system/btcore:net_test_btcore",
#"//bt/system/common:bluetooth_test_common",
#"//bt/system/profile/avrcp:net_test_avrcp",
#"//bt/system/service:bluetoothtbd_test",
diff --git a/system/OWNERS b/system/OWNERS
deleted file mode 100644
index b2acb91716..0000000000
--- a/system/OWNERS
+++ /dev/null
@@ -1,18 +0,0 @@
-# Reviewers for /system
-
-bhaktha@google.com
-eruffieux@google.com
-hallstrom@google.com
-henrichataing@google.com
-jpawlowski@google.com
-okamil@google.com
-poahlo@google.com
-rongxuan@google.com
-rwt@google.com
-wescande@google.com
-
-# Reviewers for Channel Sounding related files
-per-file /bta/ras/*=file:/OWNERS_channel_sounding
-per-file /gd/hal/ranging_hal*=file:/OWNERS_channel_sounding
-per-file /gd/hci/distance_measurement_*=file:/OWNERS_channel_sounding
-per-file /main/shim/distance_measurement_manager*=file:/OWNERS_channel_sounding
diff --git a/system/bta/Android.bp b/system/bta/Android.bp
index 5a8f721ebd..22074caf65 100644
--- a/system/bta/Android.bp
+++ b/system/bta/Android.bp
@@ -1347,6 +1347,74 @@ cc_test {
}
cc_test {
+ name: "bluetooth_hearing_aid_test",
+ test_suites: ["general-tests"],
+ defaults: [
+ "fluoride_bta_defaults",
+ "mts_defaults",
+ ],
+ host_supported: true,
+ include_dirs: [
+ "packages/modules/Bluetooth/system",
+ "packages/modules/Bluetooth/system/bta/include",
+ "packages/modules/Bluetooth/system/bta/test/common",
+ "packages/modules/Bluetooth/system/stack/include",
+ ],
+ srcs: [
+ ":TestCommonMockFunctions",
+ ":TestMockBtaHearingAidAudioSource",
+ ":TestMockDevice",
+ ":TestMockMainShim",
+ ":TestMockMainShimEntry",
+ ":TestMockStackBtmInterface",
+ ":TestMockStackBtmIso",
+ ":TestMockStackGapConnInterface",
+ ":TestMockStackL2cap",
+ ":TestStubOsi",
+ "gatt/database.cc",
+ "gatt/database_builder.cc",
+ "hearing_aid/hearing_aid.cc",
+ "hearing_aid/hearing_aid_test.cc",
+ "test/common/bta_gatt_api_mock.cc",
+ "test/common/bta_gatt_queue_mock.cc",
+ "test/common/btif_storage_mock.cc",
+ "test/common/btm_api_mock.cc",
+ ],
+ shared_libs: [
+ "libbase",
+ "libcrypto",
+ "liblog",
+ ],
+ static_libs: [
+ "bluetooth_flags_c_lib_for_test",
+ "libaconfig_storage_read_api_cc",
+ "libbluetooth-types",
+ "libbluetooth_crypto_toolbox",
+ "libbluetooth_gd",
+ "libbluetooth_log",
+ "libbt-audio-asrc",
+ "libbt-btu-main-thread",
+ "libbt-common",
+ "libbt-platform-protos-lite",
+ "libchrome",
+ "libevent",
+ "libg722codec",
+ "libgmock",
+ "server_configurable_flags",
+ ],
+ sanitize: {
+ cfi: true,
+ scs: true,
+ address: true,
+ all_undefined: true,
+ integer_overflow: true,
+ diag: {
+ undefined: true,
+ },
+ },
+}
+
+cc_test {
name: "bluetooth_hh_test",
test_suites: ["general-tests"],
defaults: [
diff --git a/system/bta/dm/bta_dm_act.cc b/system/bta/dm/bta_dm_act.cc
index 48e0f16c99..ddc481171f 100644
--- a/system/bta/dm/bta_dm_act.cc
+++ b/system/bta/dm/bta_dm_act.cc
@@ -545,7 +545,7 @@ void bta_dm_remove_device(const RawAddress& target) {
if (le_connected || bredr_connected) {
// Wait for all transports to be disconnected
- tBTA_DM_REMOVE_PENDNIG node = {pseudo_addr, identity_addr, le_connected, bredr_connected};
+ tBTA_DM_REMOVE_PENDING node = {pseudo_addr, identity_addr, le_connected, bredr_connected};
bta_dm_cb.pending_removals.push_back(node);
log::info(
"Waiting for disconnection over LE:{}, BR/EDR:{} for pseudo address: {}, identity "
diff --git a/system/bta/dm/bta_dm_disc.cc b/system/bta/dm/bta_dm_disc.cc
index b3f010e86e..79d3421361 100644
--- a/system/bta/dm/bta_dm_disc.cc
+++ b/system/bta/dm/bta_dm_disc.cc
@@ -152,8 +152,7 @@ gatt_interface_t& get_gatt_interface() { return *gatt_interface; }
void bta_dm_disc_gatt_cancel_open(const RawAddress& bd_addr) {
get_gatt_interface().BTA_GATTC_CancelOpen(0, bd_addr, false);
- if (com::android::bluetooth::flags::cancel_open_discovery_client() &&
- bta_dm_discovery_cb.client_if != BTA_GATTS_INVALID_IF) {
+ if (bta_dm_discovery_cb.client_if != BTA_GATTS_INVALID_IF) {
get_gatt_interface().BTA_GATTC_CancelOpen(bta_dm_discovery_cb.client_if, bd_addr, true);
}
}
@@ -559,11 +558,7 @@ static void bta_dm_gatt_disc_complete(tCONN_ID conn_id, tGATT_STATUS status) {
} else {
log::info("Discovery complete for invalid conn ID. Will pick up next job");
- if (com::android::bluetooth::flags::cancel_open_discovery_client()) {
- bta_dm_close_gatt_conn(bta_dm_discovery_cb.conn_id);
- } else {
- bta_dm_discovery_cb.conn_id = GATT_INVALID_CONN_ID;
- }
+ bta_dm_close_gatt_conn(bta_dm_discovery_cb.conn_id);
if (bta_dm_discovery_cb.transports & BT_TRANSPORT_BR_EDR) {
log::info("classic discovery still pending {}", bta_dm_discovery_cb.peer_bdaddr);
return;
diff --git a/system/bta/dm/bta_dm_int.h b/system/bta/dm/bta_dm_int.h
index 521a8072de..26f7e4d97c 100644
--- a/system/bta/dm/bta_dm_int.h
+++ b/system/bta/dm/bta_dm_int.h
@@ -81,7 +81,7 @@ inline std::string device_info_text(tBTA_DM_DEV_INFO info) {
#define BTA_DM_PM_EXECUTE 3
typedef uint8_t tBTA_DM_PM_REQ;
-struct tBTA_DM_REMOVE_PENDNIG {
+struct tBTA_DM_REMOVE_PENDING {
RawAddress pseudo_addr;
RawAddress identity_addr;
bool le_connected;
@@ -215,7 +215,7 @@ typedef struct {
#endif
alarm_t* switch_delay_timer;
- std::list<tBTA_DM_REMOVE_PENDNIG> pending_removals;
+ std::list<tBTA_DM_REMOVE_PENDING> pending_removals;
} tBTA_DM_CB;
/* DI control block */
diff --git a/system/bta/gatt/bta_gattc_act.cc b/system/bta/gatt/bta_gattc_act.cc
index 3b6069b1a1..346d7c3d6a 100644
--- a/system/bta/gatt/bta_gattc_act.cc
+++ b/system/bta/gatt/bta_gattc_act.cc
@@ -132,28 +132,17 @@ void bta_gattc_disable() {
return;
}
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- if (!bta_gattc_cb.cl_rcb_map.empty()) {
- bta_gattc_cb.state = BTA_GATTC_STATE_DISABLING;
- }
-
- // An entry can be erased during deregister, use a copied collection
- std::vector<tGATT_IF> gatt_ifs;
- for (auto& [gatt_if, p_rcb] : bta_gattc_cb.cl_rcb_map) {
- gatt_ifs.push_back(gatt_if);
- }
- for (auto& gatt_if : gatt_ifs) {
- bta_gattc_deregister(bta_gattc_cb.cl_rcb_map[gatt_if].get());
- }
- } else {
- for (i = 0; i < BTA_GATTC_CL_MAX; i++) {
- if (!bta_gattc_cb.cl_rcb[i].in_use) {
- continue;
- }
+ if (!bta_gattc_cb.cl_rcb_map.empty()) {
+ bta_gattc_cb.state = BTA_GATTC_STATE_DISABLING;
+ }
- bta_gattc_cb.state = BTA_GATTC_STATE_DISABLING;
- bta_gattc_deregister(&bta_gattc_cb.cl_rcb[i]);
- }
+ // An entry can be erased during deregister, use a copied collection
+ std::vector<tGATT_IF> gatt_ifs;
+ for (auto& [gatt_if, p_rcb] : bta_gattc_cb.cl_rcb_map) {
+ gatt_ifs.push_back(gatt_if);
+ }
+ for (auto& gatt_if : gatt_ifs) {
+ bta_gattc_deregister(bta_gattc_cb.cl_rcb_map[gatt_if].get());
}
/* no registered apps, indicate disable completed */
@@ -187,55 +176,25 @@ void bta_gattc_register(const Uuid& app_uuid, const std::string& name, tBTA_GATT
bta_gattc_enable();
}
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- client_if = GATT_Register(app_uuid, name, &bta_gattc_cl_cback, eatt_support);
- if (client_if == 0) {
- log::error("Register with GATT stack failed");
- status = GATT_ERROR;
- } else {
- auto p_rcb = std::make_unique<tBTA_GATTC_RCB>();
- p_rcb->in_use = true;
- p_rcb->p_cback = p_cback;
- p_rcb->app_uuid = app_uuid;
- p_rcb->client_if = client_if;
- bta_gattc_cb.cl_rcb_map.emplace(client_if, std::move(p_rcb));
-
- log::debug(
- "Registered GATT client interface {} with uuid={}, starting it on "
- "main thread",
- client_if, app_uuid.ToString());
-
- do_in_main_thread(base::BindOnce(&bta_gattc_start_if, client_if));
- status = GATT_SUCCESS;
- }
+ client_if = GATT_Register(app_uuid, name, &bta_gattc_cl_cback, eatt_support);
+ if (client_if == 0) {
+ log::error("Register with GATT stack failed");
+ status = GATT_ERROR;
} else {
- for (uint8_t i = 0; i < BTA_GATTC_CL_MAX; i++) {
- if (!bta_gattc_cb.cl_rcb[i].in_use) {
- bta_gattc_cb.cl_rcb[i].client_if =
- GATT_Register(app_uuid, "GattClient", &bta_gattc_cl_cback, eatt_support);
- if (bta_gattc_cb.cl_rcb[i].client_if == 0) {
- log::error("Register with GATT stack failed with index {}, trying next index", i);
- status = GATT_ERROR;
- } else {
- bta_gattc_cb.cl_rcb[i].in_use = true;
- bta_gattc_cb.cl_rcb[i].p_cback = p_cback;
- bta_gattc_cb.cl_rcb[i].app_uuid = app_uuid;
-
- /* BTA use the same client interface as BTE GATT statck */
- client_if = bta_gattc_cb.cl_rcb[i].client_if;
-
- log::debug(
- "Registered GATT client interface {} with uuid={}, starting it on "
- "main thread",
- client_if, app_uuid.ToString());
-
- do_in_main_thread(base::BindOnce(&bta_gattc_start_if, client_if));
-
- status = GATT_SUCCESS;
- break;
- }
- }
- }
+ auto p_rcb = std::make_unique<tBTA_GATTC_RCB>();
+ p_rcb->in_use = true;
+ p_rcb->p_cback = p_cback;
+ p_rcb->app_uuid = app_uuid;
+ p_rcb->client_if = client_if;
+ bta_gattc_cb.cl_rcb_map.emplace(client_if, std::move(p_rcb));
+
+ log::debug(
+ "Registered GATT client interface {} with uuid={}, starting it on "
+ "main thread",
+ client_if, app_uuid.ToString());
+
+ do_in_main_thread(base::BindOnce(&bta_gattc_start_if, client_if));
+ status = GATT_SUCCESS;
}
if (!cb.is_null()) {
@@ -258,26 +217,13 @@ void bta_gattc_deregister(tBTA_GATTC_RCB* p_clreg) {
continue;
}
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- if (bta_gattc_cb.bg_track[i].cif_set.contains(p_clreg->client_if)) {
- bta_gattc_mark_bg_conn(p_clreg->client_if, bta_gattc_cb.bg_track[i].remote_bda, false);
- if (!GATT_CancelConnect(p_clreg->client_if, bta_gattc_cb.bg_track[i].remote_bda, false)) {
- log::warn(
- "Unable to cancel GATT connection client_if:{} peer:{} "
- "is_direct:{}",
- p_clreg->client_if, bta_gattc_cb.bg_track[i].remote_bda, false);
- }
- }
- } else {
- if (bta_gattc_cb.bg_track[i].cif_mask &
- ((tBTA_GATTC_CIF_MASK)1 << (p_clreg->client_if - 1))) {
- bta_gattc_mark_bg_conn(p_clreg->client_if, bta_gattc_cb.bg_track[i].remote_bda, false);
- if (!GATT_CancelConnect(p_clreg->client_if, bta_gattc_cb.bg_track[i].remote_bda, false)) {
- log::warn(
- "Unable to cancel GATT connection client_if:{} peer:{} "
- "is_direct:{}",
- p_clreg->client_if, bta_gattc_cb.bg_track[i].remote_bda, false);
- }
+ if (bta_gattc_cb.bg_track[i].cif_set.contains(p_clreg->client_if)) {
+ bta_gattc_mark_bg_conn(p_clreg->client_if, bta_gattc_cb.bg_track[i].remote_bda, false);
+ if (!GATT_CancelConnect(p_clreg->client_if, bta_gattc_cb.bg_track[i].remote_bda, false)) {
+ log::warn(
+ "Unable to cancel GATT connection client_if:{} peer:{} "
+ "is_direct:{}",
+ p_clreg->client_if, bta_gattc_cb.bg_track[i].remote_bda, false);
}
}
}
@@ -288,38 +234,23 @@ void bta_gattc_deregister(tBTA_GATTC_RCB* p_clreg) {
}
/* close all CLCB related to this app */
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- for (auto& p_clcb : bta_gattc_cb.clcb_set) {
- if (!p_clcb->in_use || p_clcb->p_rcb != p_clreg) {
- continue;
- }
- p_clreg->dereg_pending = true;
-
- tBTA_GATTC_DATA gattc_data = {
- .hdr =
- {
- .event = BTA_GATTC_API_CLOSE_EVT,
- .layer_specific = static_cast<uint16_t>(p_clcb->bta_conn_id),
- },
- };
- bta_gattc_close(p_clcb.get(), &gattc_data);
- }
- // deallocated clcbs will not be accessed. Let them be claened up.
- bta_gattc_cleanup_clcb();
- } else {
- for (size_t i = 0; i < BTA_GATTC_CLCB_MAX; i++) {
- if (!bta_gattc_cb.clcb[i].in_use || (bta_gattc_cb.clcb[i].p_rcb != p_clreg)) {
- continue;
- }
-
- p_clreg->dereg_pending = true;
-
- BT_HDR_RIGID buf;
- buf.event = BTA_GATTC_API_CLOSE_EVT;
- buf.layer_specific = static_cast<uint16_t>(bta_gattc_cb.clcb[i].bta_conn_id);
- bta_gattc_close(&bta_gattc_cb.clcb[i], (tBTA_GATTC_DATA*)&buf);
+ for (auto& p_clcb : bta_gattc_cb.clcb_set) {
+ if (!p_clcb->in_use || p_clcb->p_rcb != p_clreg) {
+ continue;
}
+ p_clreg->dereg_pending = true;
+
+ tBTA_GATTC_DATA gattc_data = {
+ .hdr =
+ {
+ .event = BTA_GATTC_API_CLOSE_EVT,
+ .layer_specific = static_cast<uint16_t>(p_clcb->bta_conn_id),
+ },
+ };
+ bta_gattc_close(p_clcb.get(), &gattc_data);
}
+ // deallocated clcbs will not be accessed. Let them be claened up.
+ bta_gattc_cleanup_clcb();
}
/** process connect API request */
@@ -736,21 +667,12 @@ void bta_gattc_close(tBTA_GATTC_CLCB* p_clcb, const tBTA_GATTC_DATA* p_data) {
/** when a SRCB finished discovery, tell all related clcb */
void bta_gattc_reset_discover_st(tBTA_GATTC_SERV* p_srcb, tGATT_STATUS status) {
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- for (auto& p_clcb : bta_gattc_cb.clcb_set) {
- if (p_clcb->p_srcb != p_srcb) {
- continue;
- }
- p_clcb->status = status;
- bta_gattc_sm_execute(p_clcb.get(), BTA_GATTC_DISCOVER_CMPL_EVT, NULL);
- }
- } else {
- for (size_t i = 0; i < BTA_GATTC_CLCB_MAX; i++) {
- if (bta_gattc_cb.clcb[i].p_srcb == p_srcb) {
- bta_gattc_cb.clcb[i].status = status;
- bta_gattc_sm_execute(&bta_gattc_cb.clcb[i], BTA_GATTC_DISCOVER_CMPL_EVT, NULL);
- }
+ for (auto& p_clcb : bta_gattc_cb.clcb_set) {
+ if (p_clcb->p_srcb != p_srcb) {
+ continue;
}
+ p_clcb->status = status;
+ bta_gattc_sm_execute(p_clcb.get(), BTA_GATTC_DISCOVER_CMPL_EVT, NULL);
}
}
@@ -777,23 +699,13 @@ void bta_gattc_disc_close(tBTA_GATTC_CLCB* p_clcb, const tBTA_GATTC_DATA* p_data
/** when a SRCB start discovery, tell all related clcb and set the state */
static void bta_gattc_set_discover_st(tBTA_GATTC_SERV* p_srcb) {
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- for (auto& p_clcb : bta_gattc_cb.clcb_set) {
- if (p_clcb->p_srcb != p_srcb) {
- continue;
- }
- p_clcb->status = GATT_SUCCESS;
- p_clcb->state = BTA_GATTC_DISCOVER_ST;
- p_clcb->request_during_discovery = BTA_GATTC_DISCOVER_REQ_NONE;
- }
- } else {
- for (size_t i = 0; i < BTA_GATTC_CLCB_MAX; i++) {
- if (bta_gattc_cb.clcb[i].p_srcb == p_srcb) {
- bta_gattc_cb.clcb[i].status = GATT_SUCCESS;
- bta_gattc_cb.clcb[i].state = BTA_GATTC_DISCOVER_ST;
- bta_gattc_cb.clcb[i].request_during_discovery = BTA_GATTC_DISCOVER_REQ_NONE;
- }
+ for (auto& p_clcb : bta_gattc_cb.clcb_set) {
+ if (p_clcb->p_srcb != p_srcb) {
+ continue;
}
+ p_clcb->status = GATT_SUCCESS;
+ p_clcb->state = BTA_GATTC_DISCOVER_ST;
+ p_clcb->request_during_discovery = BTA_GATTC_DISCOVER_REQ_NONE;
}
}
@@ -1422,12 +1334,8 @@ static void bta_gattc_deregister_cmpl(tBTA_GATTC_RCB* p_clreg) {
memset(&cb_data, 0, sizeof(tBTA_GATTC));
GATT_Deregister(p_clreg->client_if);
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- if (bta_gattc_cb.cl_rcb_map.erase(p_clreg->client_if) == 0) {
- log::warn("deregistered unknown rcb client_if={}", p_clreg->client_if);
- }
- } else {
- memset(p_clreg, 0, sizeof(tBTA_GATTC_RCB));
+ if (bta_gattc_cb.cl_rcb_map.erase(p_clreg->client_if) == 0) {
+ log::warn("deregistered unknown rcb client_if={}", p_clreg->client_if);
}
cb_data.reg_oper.client_if = client_if;
@@ -1490,20 +1398,11 @@ void bta_gattc_process_api_refresh(const RawAddress& remote_bda) {
if (p_srvc_cb->connected && p_srvc_cb->num_clcb != 0) {
bool found = false;
tBTA_GATTC_CLCB* p_clcb = &bta_gattc_cb.clcb[0];
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- for (auto& p_clcb_i : bta_gattc_cb.clcb_set) {
- if (p_clcb_i->in_use && p_clcb_i->p_srcb == p_srvc_cb) {
- p_clcb = p_clcb_i.get();
- found = true;
- break;
- }
- }
- } else {
- for (size_t i = 0; i < BTA_GATTC_CLCB_MAX; i++, p_clcb++) {
- if (p_clcb->in_use && p_clcb->p_srcb == p_srvc_cb) {
- found = true;
- break;
- }
+ for (auto& p_clcb_i : bta_gattc_cb.clcb_set) {
+ if (p_clcb_i->in_use && p_clcb_i->p_srcb == p_srvc_cb) {
+ p_clcb = p_clcb_i.get();
+ found = true;
+ break;
}
}
if (found) {
@@ -1563,38 +1462,19 @@ static bool bta_gattc_process_srvc_chg_ind(tCONN_ID conn_id, tBTA_GATTC_RCB* p_c
/* not an opened connection; or connection busy */
/* search for first available clcb and start discovery */
if (p_clcb == NULL || (p_clcb && p_clcb->p_q_cmd != NULL)) {
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- for (auto& p_clcb_i : bta_gattc_cb.clcb_set) {
- if (p_clcb_i->in_use && p_clcb_i->p_srcb == p_srcb && p_clcb_i->p_q_cmd == NULL) {
- p_clcb = p_clcb_i.get();
- break;
- }
- }
- } else {
- for (size_t i = 0; i < BTA_GATTC_CLCB_MAX; i++) {
- if (bta_gattc_cb.clcb[i].in_use && bta_gattc_cb.clcb[i].p_srcb == p_srcb &&
- bta_gattc_cb.clcb[i].p_q_cmd == NULL) {
- p_clcb = &bta_gattc_cb.clcb[i];
- break;
- }
+ for (auto& p_clcb_i : bta_gattc_cb.clcb_set) {
+ if (p_clcb_i->in_use && p_clcb_i->p_srcb == p_srcb && p_clcb_i->p_q_cmd == NULL) {
+ p_clcb = p_clcb_i.get();
+ break;
}
}
}
// Use a busy CLCB to start discovery if no CLCB is available, this will be queued.
if (com::android::bluetooth::flags::start_discover_service_changed() && p_clcb == NULL) {
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- for (auto& p_clcb_i : bta_gattc_cb.clcb_set) {
- if (p_clcb_i->in_use && p_clcb_i->p_srcb == p_srcb) {
- p_clcb = p_clcb_i.get();
- break;
- }
- }
- } else {
- for (size_t i = 0; i < BTA_GATTC_CLCB_MAX; i++) {
- if (bta_gattc_cb.clcb[i].in_use && bta_gattc_cb.clcb[i].p_srcb == p_srcb) {
- p_clcb = &bta_gattc_cb.clcb[i];
- break;
- }
+ for (auto& p_clcb_i : bta_gattc_cb.clcb_set) {
+ if (p_clcb_i->in_use && p_clcb_i->p_srcb == p_srcb) {
+ p_clcb = p_clcb_i.get();
+ break;
}
}
}
diff --git a/system/bta/gatt/bta_gattc_utils.cc b/system/bta/gatt/bta_gattc_utils.cc
index 1541f391ca..523cf90fe5 100644
--- a/system/bta/gatt/bta_gattc_utils.cc
+++ b/system/bta/gatt/bta_gattc_utils.cc
@@ -25,7 +25,6 @@
#define LOG_TAG "bt_bta_gattc"
#include <bluetooth/log.h>
-#include <com_android_bluetooth_flags.h>
#include <cstdint>
@@ -58,23 +57,11 @@ static uint8_t ble_acceptlist_size() {
*
******************************************************************************/
tBTA_GATTC_RCB* bta_gattc_cl_get_regcb(uint8_t client_if) {
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- auto it = bta_gattc_cb.cl_rcb_map.find(client_if);
- if (it == bta_gattc_cb.cl_rcb_map.end()) {
- return NULL;
- } else {
- return it->second.get();
- }
- } else {
- uint8_t i = 0;
- tBTA_GATTC_RCB* p_clrcb = &bta_gattc_cb.cl_rcb[0];
-
- for (i = 0; i < BTA_GATTC_CL_MAX; i++, p_clrcb++) {
- if (p_clrcb->in_use && p_clrcb->client_if == client_if) {
- return p_clrcb;
- }
- }
+ auto it = bta_gattc_cb.cl_rcb_map.find(client_if);
+ if (it == bta_gattc_cb.cl_rcb_map.end()) {
return NULL;
+ } else {
+ return it->second.get();
}
}
/*******************************************************************************
@@ -86,20 +73,7 @@ tBTA_GATTC_RCB* bta_gattc_cl_get_regcb(uint8_t client_if) {
* Returns pointer to the regcb
*
******************************************************************************/
-uint8_t bta_gattc_num_reg_app(void) {
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- return (uint8_t)bta_gattc_cb.cl_rcb_map.size();
- } else {
- uint8_t i = 0, j = 0;
-
- for (i = 0; i < BTA_GATTC_CL_MAX; i++) {
- if (bta_gattc_cb.cl_rcb[i].in_use) {
- j++;
- }
- }
- return j;
- }
-}
+uint8_t bta_gattc_num_reg_app(void) { return (uint8_t)bta_gattc_cb.cl_rcb_map.size(); }
/*******************************************************************************
*
* Function bta_gattc_find_clcb_by_cif
@@ -111,21 +85,10 @@ uint8_t bta_gattc_num_reg_app(void) {
******************************************************************************/
tBTA_GATTC_CLCB* bta_gattc_find_clcb_by_cif(uint8_t client_if, const RawAddress& remote_bda,
tBT_TRANSPORT transport) {
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- for (auto& p_clcb : bta_gattc_cb.clcb_set) {
- if (p_clcb->in_use && p_clcb->p_rcb->client_if == client_if &&
- p_clcb->transport == transport && p_clcb->bda == remote_bda) {
- return p_clcb.get();
- }
- }
- } else {
- tBTA_GATTC_CLCB* p_clcb = &bta_gattc_cb.clcb[0];
-
- for (size_t i = 0; i < BTA_GATTC_CLCB_MAX; i++, p_clcb++) {
- if (p_clcb->in_use && p_clcb->p_rcb->client_if == client_if &&
- p_clcb->transport == transport && p_clcb->bda == remote_bda) {
- return p_clcb;
- }
+ for (auto& p_clcb : bta_gattc_cb.clcb_set) {
+ if (p_clcb->in_use && p_clcb->p_rcb->client_if == client_if && p_clcb->transport == transport &&
+ p_clcb->bda == remote_bda) {
+ return p_clcb.get();
}
}
return NULL;
@@ -140,19 +103,9 @@ tBTA_GATTC_CLCB* bta_gattc_find_clcb_by_cif(uint8_t client_if, const RawAddress&
*
******************************************************************************/
tBTA_GATTC_CLCB* bta_gattc_find_clcb_by_conn_id(tCONN_ID conn_id) {
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- for (auto& p_clcb : bta_gattc_cb.clcb_set) {
- if (p_clcb != NULL && p_clcb->in_use && p_clcb->bta_conn_id == conn_id) {
- return p_clcb.get();
- }
- }
- } else {
- tBTA_GATTC_CLCB* p_clcb = &bta_gattc_cb.clcb[0];
-
- for (size_t i = 0; i < BTA_GATTC_CLCB_MAX; i++, p_clcb++) {
- if (p_clcb->in_use && p_clcb->bta_conn_id == conn_id) {
- return p_clcb;
- }
+ for (auto& p_clcb : bta_gattc_cb.clcb_set) {
+ if (p_clcb != NULL && p_clcb->in_use && p_clcb->bta_conn_id == conn_id) {
+ return p_clcb.get();
}
}
return NULL;
@@ -171,63 +124,30 @@ tBTA_GATTC_CLCB* bta_gattc_clcb_alloc(tGATT_IF client_if, const RawAddress& remo
tBT_TRANSPORT transport) {
tBTA_GATTC_CLCB* p_clcb = NULL;
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- bta_gattc_cleanup_clcb();
- auto [p_clcb_i, b] = bta_gattc_cb.clcb_set.emplace(std::make_unique<tBTA_GATTC_CLCB>());
- p_clcb = p_clcb_i->get();
+ bta_gattc_cleanup_clcb();
+ auto [p_clcb_i, b] = bta_gattc_cb.clcb_set.emplace(std::make_unique<tBTA_GATTC_CLCB>());
+ p_clcb = p_clcb_i->get();
- p_clcb->in_use = true;
- p_clcb->status = GATT_SUCCESS;
- p_clcb->transport = transport;
- p_clcb->bda = remote_bda;
- p_clcb->p_q_cmd = NULL;
+ p_clcb->in_use = true;
+ p_clcb->status = GATT_SUCCESS;
+ p_clcb->transport = transport;
+ p_clcb->bda = remote_bda;
+ p_clcb->p_q_cmd = NULL;
- p_clcb->p_rcb = bta_gattc_cl_get_regcb(client_if);
+ p_clcb->p_rcb = bta_gattc_cl_get_regcb(client_if);
- p_clcb->p_srcb = bta_gattc_find_srcb(remote_bda);
- if (p_clcb->p_srcb == NULL) {
- p_clcb->p_srcb = bta_gattc_srcb_alloc(remote_bda);
- }
+ p_clcb->p_srcb = bta_gattc_find_srcb(remote_bda);
+ if (p_clcb->p_srcb == NULL) {
+ p_clcb->p_srcb = bta_gattc_srcb_alloc(remote_bda);
+ }
- if (p_clcb->p_rcb != NULL && p_clcb->p_srcb != NULL) {
- p_clcb->p_srcb->num_clcb++;
- p_clcb->p_rcb->num_clcb++;
- } else {
- /* release this clcb if clcb or srcb allocation failed */
- bta_gattc_cb.clcb_set.erase(p_clcb_i);
- p_clcb = NULL;
- }
+ if (p_clcb->p_rcb != NULL && p_clcb->p_srcb != NULL) {
+ p_clcb->p_srcb->num_clcb++;
+ p_clcb->p_rcb->num_clcb++;
} else {
- for (int i_clcb = 0; i_clcb < BTA_GATTC_CLCB_MAX; i_clcb++) {
- if (!bta_gattc_cb.clcb[i_clcb].in_use) {
-#if (BTA_GATT_DEBUG == TRUE)
- log::verbose("found clcb:{} available", i_clcb);
-#endif
- p_clcb = &bta_gattc_cb.clcb[i_clcb];
- p_clcb->in_use = true;
- p_clcb->status = GATT_SUCCESS;
- p_clcb->transport = transport;
- p_clcb->bda = remote_bda;
- p_clcb->p_q_cmd = NULL;
-
- p_clcb->p_rcb = bta_gattc_cl_get_regcb(client_if);
-
- p_clcb->p_srcb = bta_gattc_find_srcb(remote_bda);
- if (p_clcb->p_srcb == NULL) {
- p_clcb->p_srcb = bta_gattc_srcb_alloc(remote_bda);
- }
-
- if (p_clcb->p_rcb != NULL && p_clcb->p_srcb != NULL) {
- p_clcb->p_srcb->num_clcb++;
- p_clcb->p_rcb->num_clcb++;
- } else {
- /* release this clcb if clcb or srcb allocation failed */
- p_clcb->in_use = false;
- p_clcb = NULL;
- }
- break;
- }
- }
+ /* release this clcb if clcb or srcb allocation failed */
+ bta_gattc_cb.clcb_set.erase(p_clcb_i);
+ p_clcb = NULL;
}
return p_clcb;
}
@@ -330,9 +250,7 @@ void bta_gattc_clcb_dealloc(tBTA_GATTC_CLCB* p_clcb) {
p_clcb->status = GATT_SUCCESS;
// in bta_gattc_sm_execute(), p_clcb is accessed again so we dealloc clcb later.
// it will be claned up when the client is deregistered or a new clcb is allocated.
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- bta_gattc_cb.clcb_pending_dealloc.insert(p_clcb);
- }
+ bta_gattc_cb.clcb_pending_dealloc.insert(p_clcb);
}
/*******************************************************************************
@@ -643,39 +561,21 @@ bool bta_gattc_mark_bg_conn(tGATT_IF client_if, const RawAddress& remote_bda_ptr
for (i = 0; i < ble_acceptlist_size(); i++, p_bg_tck++) {
if (p_bg_tck->in_use &&
((p_bg_tck->remote_bda == remote_bda_ptr) || (p_bg_tck->remote_bda.IsEmpty()))) {
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- auto& p_cif_set = p_bg_tck->cif_set;
- if (add) { /* mask on the cif bit */
- p_cif_set.insert(client_if);
- } else {
- if (client_if != 0) {
- p_cif_set.erase(client_if);
- } else {
- p_cif_set.clear();
- }
- }
- /* no BG connection for this device, make it available */
- if (p_bg_tck->cif_set.empty()) {
- p_bg_tck->in_use = false;
- p_bg_tck->remote_bda = RawAddress::kEmpty;
- }
+ auto& p_cif_set = p_bg_tck->cif_set;
+ if (add) { /* mask on the cif bit */
+ p_cif_set.insert(client_if);
} else {
- p_cif_mask = &p_bg_tck->cif_mask;
-
- if (add) { /* mask on the cif bit */
- *p_cif_mask |= (1 << (client_if - 1));
+ if (client_if != 0) {
+ p_cif_set.erase(client_if);
} else {
- if (client_if != 0) {
- *p_cif_mask &= (~(1 << (client_if - 1)));
- } else {
- *p_cif_mask = 0;
- }
- }
- /* no BG connection for this device, make it available */
- if (p_bg_tck->cif_mask == 0) {
- *p_bg_tck = tBTA_GATTC_BG_TCK{};
+ p_cif_set.clear();
}
}
+ /* no BG connection for this device, make it available */
+ if (p_bg_tck->cif_set.empty()) {
+ p_bg_tck->in_use = false;
+ p_bg_tck->remote_bda = RawAddress::kEmpty;
+ }
return true;
}
}
@@ -688,12 +588,7 @@ bool bta_gattc_mark_bg_conn(tGATT_IF client_if, const RawAddress& remote_bda_ptr
p_bg_tck->in_use = true;
p_bg_tck->remote_bda = remote_bda_ptr;
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- p_bg_tck->cif_set = {client_if};
- } else {
- p_cif_mask = &p_bg_tck->cif_mask;
- *p_cif_mask = ((tBTA_GATTC_CIF_MASK)1 << (client_if - 1));
- }
+ p_bg_tck->cif_set = {client_if};
return true;
}
}
@@ -719,15 +614,8 @@ bool bta_gattc_check_bg_conn(tGATT_IF client_if, const RawAddress& remote_bda, u
for (i = 0; i < ble_acceptlist_size() && !is_bg_conn; i++, p_bg_tck++) {
if (p_bg_tck->in_use &&
(p_bg_tck->remote_bda == remote_bda || p_bg_tck->remote_bda.IsEmpty())) {
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- if (p_bg_tck->cif_set.contains(client_if) && role == HCI_ROLE_CENTRAL) {
- is_bg_conn = true;
- }
- } else {
- if (((p_bg_tck->cif_mask & ((tBTA_GATTC_CIF_MASK)1 << (client_if - 1))) != 0) &&
- role == HCI_ROLE_CENTRAL) {
- is_bg_conn = true;
- }
+ if (p_bg_tck->cif_set.contains(client_if) && role == HCI_ROLE_CENTRAL) {
+ is_bg_conn = true;
}
}
}
@@ -938,58 +826,28 @@ void bta_gatt_client_dump(int fd) {
stream << " -- used: " << entry_count << "\n";
entry_count = 0;
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- stream << " ->cl_rcb (dynamic)\n";
- for (auto& [i, p_cl_rcb] : bta_gattc_cb.cl_rcb_map) {
- entry_count++;
- stream << " client_if: " << +p_cl_rcb->client_if << " app uuids: " << p_cl_rcb->app_uuid
- << " clcb_num: " << +p_cl_rcb->num_clcb;
- stream << "\n";
- }
- } else {
- stream << " ->cl_rcb (BTA_GATTC_CL_MAX=" << BTA_GATTC_CL_MAX << ")\n";
- for (int i = 0; i < BTA_GATTC_CL_MAX; i++) {
- tBTA_GATTC_RCB* p_cl_rcb = &bta_gattc_cb.cl_rcb[i];
- if (!p_cl_rcb->in_use) {
- continue;
- }
- entry_count++;
- stream << " client_if: " << +p_cl_rcb->client_if << " app uuids: " << p_cl_rcb->app_uuid
- << " clcb_num: " << +p_cl_rcb->num_clcb;
- stream << "\n";
- }
+ stream << " ->cl_rcb (dynamic)\n";
+ for (auto& [i, p_cl_rcb] : bta_gattc_cb.cl_rcb_map) {
+ entry_count++;
+ stream << " client_if: " << +p_cl_rcb->client_if << " app uuids: " << p_cl_rcb->app_uuid
+ << " clcb_num: " << +p_cl_rcb->num_clcb;
+ stream << "\n";
}
stream << " -- used: " << entry_count << "\n";
entry_count = 0;
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- stream << " ->clcb (dynamic)\n";
- for (auto& p_clcb : bta_gattc_cb.clcb_set) {
- if (!p_clcb->in_use) {
- continue;
- }
- entry_count++;
- stream << " conn_id: " << loghex(p_clcb->bta_conn_id)
- << " address: " << p_clcb->bda.ToRedactedStringForLogging()
- << " transport: " << bt_transport_text(p_clcb->transport)
- << " state: " << bta_clcb_state_text(p_clcb->state);
- stream << "\n";
- }
- } else {
- stream << " ->clcb (BTA_GATTC_CLCB_MAX=" << BTA_GATTC_CLCB_MAX << ")\n";
- for (size_t i = 0; i < BTA_GATTC_CLCB_MAX; i++) {
- tBTA_GATTC_CLCB* p_clcb = &bta_gattc_cb.clcb[i];
- if (!p_clcb->in_use) {
- continue;
- }
- entry_count++;
- stream << " conn_id: " << loghex(p_clcb->bta_conn_id)
- << " address: " << p_clcb->bda.ToRedactedStringForLogging()
- << " transport: " << bt_transport_text(p_clcb->transport)
- << " state: " << bta_clcb_state_text(p_clcb->state);
- stream << "\n";
+ stream << " ->clcb (dynamic)\n";
+ for (auto& p_clcb : bta_gattc_cb.clcb_set) {
+ if (!p_clcb->in_use) {
+ continue;
}
+ entry_count++;
+ stream << " conn_id: " << loghex(p_clcb->bta_conn_id)
+ << " address: " << p_clcb->bda.ToRedactedStringForLogging()
+ << " transport: " << bt_transport_text(p_clcb->transport)
+ << " state: " << bta_clcb_state_text(p_clcb->state);
+ stream << "\n";
}
stream << " -- used: " << entry_count << "\n";
diff --git a/system/bta/hearing_aid/OWNERS b/system/bta/hearing_aid/OWNERS
deleted file mode 100644
index bbaa85ddbb..0000000000
--- a/system/bta/hearing_aid/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_hearingaid
diff --git a/system/bta/hearing_aid/hearing_aid_test.cc b/system/bta/hearing_aid/hearing_aid_test.cc
new file mode 100644
index 0000000000..2090df9d81
--- /dev/null
+++ b/system/bta/hearing_aid/hearing_aid_test.cc
@@ -0,0 +1,474 @@
+/*
+ * Copyright 2025 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <base/bind_helpers.h>
+#include <base/functional/bind.h>
+#include <base/strings/string_number_conversions.h>
+#include <bluetooth/log.h>
+#include <com_android_bluetooth_flags.h>
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+#include <log/log.h>
+#include <osi/include/alarm.h>
+#include <string.h>
+#include <sys/socket.h>
+
+#include <variant>
+
+#include "bta/le_audio/le_audio_types.h"
+#include "bta_gatt_api_mock.h"
+#include "bta_gatt_queue_mock.h"
+#include "bta_hearing_aid_api.h"
+#include "btif_storage_mock.h"
+#include "btm_api_mock.h"
+#include "gatt/database_builder.h"
+#include "hardware/bt_gatt_types.h"
+#include "hci/controller_interface_mock.h"
+#include "stack/include/bt_uuid16.h"
+#include "stack/include/btm_status.h"
+#include "test/common/mock_functions.h"
+#include "test/mock/mock_main_shim_entry.h"
+#include "test/mock/mock_stack_gap_conn_interface.h"
+#include "test/mock/mock_stack_l2cap_interface.h"
+#include "types/bt_transport.h"
+
+static std::map<const char*, bool> fake_osi_bool_props;
+
+namespace bluetooth {
+namespace hearing_aid {
+namespace internal {
+namespace {
+
+using base::HexEncode;
+
+using namespace bluetooth::hearing_aid;
+
+using ::bluetooth::hearing_aid::ConnectionState;
+using ::bluetooth::hearing_aid::HearingAidCallbacks;
+using ::bluetooth::hearing_aid::HearingAidInterface;
+
+using ::testing::_;
+using ::testing::AnyNumber;
+using ::testing::DoAll;
+using ::testing::DoDefault;
+using ::testing::Invoke;
+using ::testing::Mock;
+using ::testing::NiceMock;
+using ::testing::NotNull;
+using ::testing::Return;
+using ::testing::SaveArg;
+using ::testing::Sequence;
+using ::testing::SetArgPointee;
+using ::testing::WithArg;
+
+RawAddress GetTestAddress(int index) {
+ CHECK_LT(index, UINT8_MAX);
+ RawAddress result = {{0xC0, 0xDE, 0xC0, 0xDE, 0x00, static_cast<uint8_t>(index)}};
+ return result;
+}
+
+static uint16_t GetTestConnId(const RawAddress& address) {
+ return address.address[RawAddress::kLength - 1];
+}
+
+class MockHearingAidCallbacks : public HearingAidCallbacks {
+public:
+ MockHearingAidCallbacks() = default;
+ MockHearingAidCallbacks(const MockHearingAidCallbacks&) = delete;
+ ~MockHearingAidCallbacks() override = default;
+
+ MOCK_METHOD((void), OnConnectionState, (ConnectionState state, const RawAddress& address),
+ (override));
+ MOCK_METHOD((void), OnDeviceAvailable,
+ (uint8_t capabilities, uint64_t hiSyncId, const RawAddress& address), (override));
+};
+
+class HearingAidTestBase : public ::testing::Test {
+protected:
+ Uuid HEARING_AID_UUID = Uuid::FromString("FDF0");
+ Uuid READ_ONLY_PROPERTIES_UUID = Uuid::FromString("6333651e-c481-4a3e-9169-7c902aad37bb");
+ Uuid AUDIO_CONTROL_POINT_UUID = Uuid::FromString("f0d4de7e-4a88-476c-9d9f-1937b0996cc0");
+ Uuid AUDIO_STATUS_UUID = Uuid::FromString("38663f1a-e711-4cac-b641-326b56404837");
+ Uuid VOLUME_UUID = Uuid::FromString("00e4ca9e-ab14-41e4-8823-f9e70c7e91df");
+ Uuid LE_PSM_UUID = Uuid::FromString("2d410339-82b6-42aa-b34e-e2e01df8cc1a");
+
+ void set_sample_database(uint16_t conn_id) {
+ static constexpr uint16_t kGapSvcStartHdl = 0x0001;
+ static constexpr uint16_t kGapDeviceNameValHdl = 0x0003;
+ static constexpr uint16_t kGapSvcEndHdl = kGapDeviceNameValHdl;
+
+ static constexpr uint16_t kSvcStartHdl = 0x0010;
+ static constexpr uint16_t kReadOnlyProperties = 0x0012;
+ static constexpr uint16_t kAudioControlPoint = 0x0015;
+ static constexpr uint16_t kAudioStatusPoint = 0x0018;
+ static constexpr uint16_t kVolume = 0x001B;
+ static constexpr uint16_t kLePsm = 0x001E;
+ static constexpr uint16_t kSvcEndHdl = kLePsm;
+
+ gatt::DatabaseBuilder bob;
+
+ /* Generic Access Service */
+ bob.AddService(kGapSvcStartHdl, kGapDeviceNameValHdl, Uuid::From16Bit(0x1800), true);
+ /* Device Name Char. */
+ bob.AddCharacteristic(kGapDeviceNameValHdl - 1, kGapDeviceNameValHdl, Uuid::From16Bit(0x2a00),
+ GATT_CHAR_PROP_BIT_READ);
+
+ /* ASHA Service */
+ bob.AddService(kSvcStartHdl, kSvcEndHdl, HEARING_AID_UUID, true);
+ bob.AddCharacteristic(kReadOnlyProperties - 1, kReadOnlyProperties, READ_ONLY_PROPERTIES_UUID,
+ GATT_CHAR_PROP_BIT_READ);
+ bob.AddCharacteristic(kAudioControlPoint - 1, kAudioControlPoint, AUDIO_CONTROL_POINT_UUID,
+ GATT_CHAR_PROP_BIT_READ | GATT_CHAR_PROP_BIT_WRITE_NR);
+ bob.AddCharacteristic(kAudioStatusPoint - 1, kAudioStatusPoint, AUDIO_STATUS_UUID,
+ GATT_CHAR_PROP_BIT_READ | GATT_CHAR_PROP_BIT_NOTIFY);
+ bob.AddDescriptor(kAudioStatusPoint + 1, Uuid::From16Bit(GATT_UUID_CHAR_CLIENT_CONFIG));
+ bob.AddCharacteristic(kVolume - 1, kVolume, VOLUME_UUID, GATT_CHAR_PROP_BIT_WRITE_NR);
+ bob.AddCharacteristic(kLePsm - 1, kLePsm, LE_PSM_UUID, GATT_CHAR_PROP_BIT_READ);
+
+ services_map[conn_id] = bob.Build().Services();
+
+ ON_CALL(gatt_queue, ReadCharacteristic(conn_id, _, _, _))
+ .WillByDefault(Invoke(
+ [this](uint16_t conn_id, uint16_t handle, GATT_READ_OP_CB cb, void* cb_data) {
+ auto* svc = gatt::FindService(services_map[conn_id], handle);
+ if (svc == nullptr) {
+ return;
+ }
+
+ std::vector<uint8_t> value;
+ tGATT_STATUS status = GATT_SUCCESS;
+
+ switch (handle) {
+ case kReadOnlyProperties:
+ value.resize(17);
+ value.assign(17, 0x01);
+ break;
+ case kAudioStatusPoint:
+ value.resize(1);
+ value.assign(1, 0);
+ break;
+ case kLePsm:
+ value.resize(2);
+ value.assign(2, 0x0080);
+ break;
+ /* passthrough */
+ default:
+ status = GATT_READ_NOT_PERMIT;
+ break;
+ }
+
+ if (cb) {
+ cb(conn_id, status, handle, value.size(), value.data(), cb_data);
+ }
+ }));
+
+ /* default action for GetCharacteristic function call */
+ ON_CALL(gatt_interface, GetCharacteristic(_, _))
+ .WillByDefault(
+ Invoke([&](uint16_t conn_id, uint16_t handle) -> const gatt::Characteristic* {
+ std::list<gatt::Service>& services = services_map[conn_id];
+ for (auto const& service : services) {
+ for (auto const& characteristic : service.characteristics) {
+ if (characteristic.value_handle == handle) {
+ return &characteristic;
+ }
+ }
+ }
+
+ return nullptr;
+ }));
+
+ ON_CALL(gatt_interface, ServiceSearchRequest(_, _))
+ .WillByDefault(WithArg<0>(
+ Invoke([&](uint16_t conn_id) { InjectSearchCompleteEvent(conn_id); })));
+
+ /* default action for GetServices function call */
+ ON_CALL(gatt_interface, GetServices(_))
+ .WillByDefault(WithArg<0>(Invoke([&](uint16_t conn_id) -> std::list<gatt::Service>* {
+ return &services_map[conn_id];
+ })));
+
+ /* default action for RegisterForNotifications function call */
+ ON_CALL(gatt_interface, RegisterForNotifications(gatt_if, _, _))
+ .WillByDefault(Return(GATT_SUCCESS));
+
+ /* default action for DeregisterForNotifications function call */
+ ON_CALL(gatt_interface, DeregisterForNotifications(gatt_if, _, _))
+ .WillByDefault(Return(GATT_SUCCESS));
+
+ /* default action for WriteDescriptor function call */
+ ON_CALL(gatt_queue, WriteDescriptor(_, _, _, _, _, _))
+ .WillByDefault(Invoke([](uint16_t conn_id, uint16_t handle, std::vector<uint8_t> value,
+ tGATT_WRITE_TYPE /*write_type*/, GATT_WRITE_OP_CB cb,
+ void* cb_data) -> void {
+ if (cb) {
+ cb(conn_id, GATT_SUCCESS, handle, value.size(), value.data(), cb_data);
+ }
+ }));
+ }
+
+ void SetUp(void) override {
+ fake_osi_bool_props.clear();
+ bluetooth::manager::SetMockBtmInterface(&btm_interface);
+ bluetooth::storage::SetMockBtifStorageInterface(&btif_storage_interface_);
+ gatt::SetMockBtaGattInterface(&gatt_interface);
+ gatt::SetMockBtaGattQueue(&gatt_queue);
+ callbacks.reset(new MockHearingAidCallbacks());
+ bluetooth::hci::testing::mock_controller_ =
+ std::make_unique<NiceMock<bluetooth::hci::testing::MockControllerInterface>>();
+ bluetooth::testing::stack::l2cap::set_interface(&mock_stack_l2cap_interface_);
+ bluetooth::testing::stack::gap_conn::set_interface(&mock_stack_gap_conn_interface_);
+
+ encryption_result = true;
+
+ ON_CALL(mock_stack_l2cap_interface_, L2CA_UpdateBleConnParams(_, _, _, _, _, _, _))
+ .WillByDefault(Invoke([&](const RawAddress& /*rem_bda*/, uint16_t min_int,
+ uint16_t /*max_int*/, uint16_t latency, uint16_t timeout,
+ uint16_t /*min_ce_len*/, uint16_t /*max_ce_len*/) {
+ req_int = min_int;
+ req_latency = latency;
+ req_timeout = timeout;
+ return true;
+ }));
+
+ ON_CALL(mock_stack_gap_conn_interface_, GAP_ConnOpen(_, _, _, _, _, _, _, _, _, _, _))
+ .WillByDefault(Invoke([&](const char* /* p_serv_name */, uint8_t /*service_id*/,
+ bool /*is_server*/, const RawAddress* p_rem_bda,
+ uint16_t /*psm*/, uint16_t /*le_mps*/,
+ tL2CAP_CFG_INFO* /*p_cfg*/, tL2CAP_ERTM_INFO* /*ertm_info*/,
+ uint16_t /*security*/, tGAP_CONN_CALLBACK* p_cb,
+ tBT_TRANSPORT /*transport*/) {
+ InjectConnUpdateEvent(p_rem_bda->address[5], req_int, req_latency, req_timeout);
+
+ gap_conn_cb = p_cb;
+ if (gap_conn_cb) {
+ gap_conn_cb(0xFFFF, GAP_EVT_CONN_OPENED, nullptr);
+ }
+ return 1;
+ }));
+
+ ON_CALL(mock_stack_gap_conn_interface_, GAP_ConnGetRemoteAddr(_))
+ .WillByDefault(Invoke([&](uint16_t /*gap_handle*/) { return &test_address; }));
+
+ /* by default connect only direct connection requests */
+ ON_CALL(gatt_interface, Open(_, _, _, _))
+ .WillByDefault(Invoke([&](tGATT_IF /*client_if*/, const RawAddress& remote_bda,
+ tBTM_BLE_CONN_TYPE connection_type, bool /*opportunistic*/) {
+ if (connection_type == BTM_BLE_DIRECT_CONNECTION) {
+ InjectConnectedEvent(remote_bda, GetTestConnId(remote_bda));
+ }
+ }));
+
+ ON_CALL(gatt_interface, Close(_)).WillByDefault(Invoke([&](uint16_t conn_id) {
+ /* We arrive here once, when we call Disconnect; and second time, after
+ * we send OnGattDisconnected - but device was already removed */
+ if (connected_devices.count(conn_id) > 0) {
+ InjectDisconnectedEvent(conn_id);
+ }
+ }));
+ }
+
+ void TearDown(void) override {
+ services_map.clear();
+ gatt::SetMockBtaGattQueue(nullptr);
+ gatt::SetMockBtaGattInterface(nullptr);
+ bluetooth::manager::SetMockBtmInterface(nullptr);
+ bluetooth::hci::testing::mock_controller_.reset();
+ bluetooth::testing::stack::l2cap::reset_interface();
+ bluetooth::testing::stack::gap_conn::reset_interface();
+ Mock::VerifyAndClearExpectations(&*callbacks);
+ Mock::VerifyAndClearExpectations(&gatt_queue);
+ Mock::VerifyAndClearExpectations(&gatt_interface);
+ Mock::VerifyAndClearExpectations(&btm_interface);
+ callbacks.reset();
+ }
+
+ void InjectConnectedEvent(const RawAddress& address, uint16_t conn_id,
+ tGATT_STATUS status = GATT_SUCCESS) {
+ tBTA_GATTC_OPEN event_data = {
+ .status = status,
+ .conn_id = conn_id,
+ .client_if = gatt_if,
+ .remote_bda = address,
+ .transport = BT_TRANSPORT_LE,
+ .mtu = 240,
+ };
+ connected_devices[conn_id] = address;
+ gatt_callback(BTA_GATTC_OPEN_EVT, (tBTA_GATTC*)&event_data);
+ }
+
+ void InjectConnUpdateEvent(uint16_t conn_id, uint16_t interval, uint16_t latency,
+ uint16_t timeout, tGATT_STATUS status = GATT_SUCCESS) {
+ tBTA_GATTC_CONN_UPDATE event_data = {
+ .conn_id = conn_id,
+ .interval = interval,
+ .latency = latency,
+ .timeout = timeout,
+ .status = status,
+ };
+
+ gatt_callback(BTA_GATTC_CONN_UPDATE_EVT, (tBTA_GATTC*)&event_data);
+ }
+
+ void InjectDisconnectedEvent(uint16_t conn_id,
+ tGATT_DISCONN_REASON reason = GATT_CONN_TERMINATE_LOCAL_HOST,
+ bool allow_fake_conn = false) {
+ if (!allow_fake_conn) {
+ ASSERT_NE(connected_devices.count(conn_id), 0u);
+ }
+
+ tBTA_GATTC_CLOSE event_data = {
+ .conn_id = conn_id,
+ .status = GATT_SUCCESS,
+ .client_if = gatt_if,
+ .remote_bda = connected_devices[conn_id],
+ .reason = reason,
+ };
+
+ connected_devices.erase(conn_id);
+ gatt_callback(BTA_GATTC_CLOSE_EVT, (tBTA_GATTC*)&event_data);
+ }
+
+ void InjectSearchCompleteEvent(uint16_t conn_id) {
+ tBTA_GATTC_SEARCH_CMPL event_data = {
+ .conn_id = conn_id,
+ .status = GATT_SUCCESS,
+ };
+
+ gatt_callback(BTA_GATTC_SEARCH_CMPL_EVT, (tBTA_GATTC*)&event_data);
+ }
+
+ void InjectNotificationEvent(const RawAddress& test_address, uint16_t conn_id, uint16_t handle,
+ std::vector<uint8_t> value, bool indicate = false) {
+ tBTA_GATTC_NOTIFY event_data = {
+ .conn_id = conn_id,
+ .bda = test_address,
+ .handle = handle,
+ .len = (uint8_t)value.size(),
+ .is_notify = !indicate,
+ };
+
+ ASSERT_TRUE(value.size() < GATT_MAX_ATTR_LEN);
+ std::copy(value.begin(), value.end(), event_data.value);
+ gatt_callback(BTA_GATTC_NOTIF_EVT, (tBTA_GATTC*)&event_data);
+ }
+
+ void SetEncryptionResult(const RawAddress& address, bool success) {
+ encryption_result = success;
+
+ ON_CALL(btm_interface, BTM_IsEncrypted(address, _)).WillByDefault(Return(encryption_result));
+
+ ON_CALL(btm_interface, IsDeviceBonded(address, _)).WillByDefault(Return(true));
+ }
+
+ std::unique_ptr<MockHearingAidCallbacks> callbacks;
+ bluetooth::manager::MockBtmInterface btm_interface;
+ bluetooth::storage::MockBtifStorageInterface btif_storage_interface_;
+ gatt::MockBtaGattInterface gatt_interface;
+ gatt::MockBtaGattQueue gatt_queue;
+ tBTA_GATTC_CBACK* gatt_callback;
+ const uint8_t gatt_if = 0xfe;
+ std::map<uint8_t, RawAddress> connected_devices;
+ std::map<uint16_t, std::list<gatt::Service>> services_map;
+ bluetooth::testing::stack::l2cap::Mock mock_stack_l2cap_interface_;
+ bluetooth::testing::stack::gap_conn::Mock mock_stack_gap_conn_interface_;
+ tGAP_CONN_CALLBACK* gap_conn_cb;
+ uint16_t req_int;
+ uint16_t req_latency;
+ uint16_t req_timeout;
+ bool encryption_result;
+ const RawAddress test_address = GetTestAddress(1);
+};
+
+class HearingAidTest : public HearingAidTestBase {
+ void SetUp(void) override {
+ HearingAidTestBase::SetUp();
+ BtaAppRegisterCallback app_register_callback;
+ EXPECT_CALL(gatt_interface, AppRegister(_, _, _, _))
+ .WillOnce(DoAll(SaveArg<1>(&gatt_callback), SaveArg<2>(&app_register_callback)));
+ HearingAid::Initialize(callbacks.get(), base::DoNothing());
+ ASSERT_TRUE(gatt_callback);
+ ASSERT_TRUE(app_register_callback);
+ app_register_callback.Run(gatt_if, GATT_SUCCESS);
+ ASSERT_TRUE(HearingAid::IsHearingAidRunning());
+ Mock::VerifyAndClearExpectations(&gatt_interface);
+ }
+ void TearDown(void) override {
+ EXPECT_CALL(gatt_interface, AppDeregister(gatt_if));
+ if (HearingAid::IsHearingAidRunning()) {
+ HearingAid::CleanUp();
+ }
+ ASSERT_FALSE(HearingAid::IsHearingAidRunning());
+ gatt_callback = nullptr;
+ HearingAidTestBase::TearDown();
+ }
+};
+
+/* Test that hearing aid is initialized and cleaned up */
+TEST_F(HearingAidTestBase, initialize) {
+ ASSERT_FALSE(HearingAid::IsHearingAidRunning());
+ HearingAid::Initialize(callbacks.get(), base::DoNothing());
+ ASSERT_TRUE(HearingAid::IsHearingAidRunning());
+ HearingAid::CleanUp();
+ ASSERT_FALSE(HearingAid::IsHearingAidRunning());
+}
+
+/* Test that connect cancellation works */
+TEST_F(HearingAidTest, disconnect_when_connecting) {
+ /* Override the default action to prevent us sending the connected event */
+ EXPECT_CALL(gatt_interface, Open(gatt_if, test_address, BTM_BLE_DIRECT_CONNECTION, _))
+ .WillOnce(Return());
+ EXPECT_CALL(*callbacks, OnDeviceAvailable(_, _, test_address)).Times(0);
+ HearingAid::Connect(test_address);
+
+ /* Single call from HearingAid:Disconnect*/
+ EXPECT_CALL(*callbacks, OnConnectionState(ConnectionState::DISCONNECTED, test_address)).Times(1);
+ EXPECT_CALL(gatt_interface, CancelOpen(_, test_address, _)).Times(AnyNumber());
+ EXPECT_CALL(gatt_interface, Close(_)).Times(0);
+ HearingAid::Disconnect(test_address);
+}
+
+/* Test that connect works and Connected state gets reported */
+TEST_F(HearingAidTest, connect) {
+ set_sample_database(1);
+
+ EXPECT_CALL(gatt_interface, Open(gatt_if, test_address, BTM_BLE_DIRECT_CONNECTION, _));
+ EXPECT_CALL(*callbacks, OnConnectionState(ConnectionState::CONNECTED, test_address));
+ EXPECT_CALL(*callbacks, OnDeviceAvailable(_, _, test_address));
+ ON_CALL(btm_interface, BTM_IsEncrypted(test_address, _)).WillByDefault(Return(true));
+
+ HearingAid::Connect(test_address);
+}
+
+/* Test that connected device can be disconnected */
+TEST_F(HearingAidTest, disconnect_when_connected) {
+ set_sample_database(1);
+
+ ON_CALL(btm_interface, BTM_IsEncrypted(test_address, _)).WillByDefault(Return(true));
+ EXPECT_CALL(*callbacks, OnConnectionState(ConnectionState::CONNECTED, test_address)).Times(1);
+ EXPECT_CALL(*callbacks, OnDeviceAvailable(_, _, test_address));
+ HearingAid::Connect(test_address);
+
+ /* First call from HearingAid:Disconnect. Second call from OnGattDisconnected*/
+ EXPECT_CALL(*callbacks, OnConnectionState(ConnectionState::DISCONNECTED, test_address)).Times(2);
+ EXPECT_CALL(gatt_interface, Close(_)).Times(2);
+ HearingAid::Disconnect(test_address);
+}
+
+} // namespace
+} // namespace internal
+} // namespace hearing_aid
+} // namespace bluetooth
diff --git a/system/bta/hh/bta_hh_le.cc b/system/bta/hh/bta_hh_le.cc
index 6dc6365562..9cbd8569ab 100644
--- a/system/bta/hh/bta_hh_le.cc
+++ b/system/bta/hh/bta_hh_le.cc
@@ -925,14 +925,8 @@ static void bta_hh_le_dis_cback(const RawAddress& addr, tDIS_VALUE* p_dis_value)
p_cb->dscp_info.version = p_dis_value->pnp_id.product_version;
}
- /* TODO(b/367910199): un-serialize once multiservice HoGP is implemented */
- if (com::android::bluetooth::flags::serialize_hogp_and_dis()) {
- Uuid pri_srvc = Uuid::From16Bit(UUID_SERVCLASS_LE_HID);
- BTA_GATTC_ServiceSearchRequest(p_cb->conn_id, pri_srvc);
- return;
- }
-
- bta_hh_le_open_cmpl(p_cb);
+ Uuid pri_srvc = Uuid::From16Bit(UUID_SERVCLASS_LE_HID);
+ BTA_GATTC_ServiceSearchRequest(p_cb->conn_id, pri_srvc);
}
/*******************************************************************************
@@ -950,23 +944,16 @@ static void bta_hh_le_pri_service_discovery(tBTA_HH_DEV_CB* p_cb) {
p_cb->disc_active |= (BTA_HH_LE_DISC_HIDS | BTA_HH_LE_DISC_DIS);
- /* read DIS info */
+ /* read DIS info. If failed, continue to discover HoGP services. */
if (!DIS_ReadDISInfo(p_cb->link_spec.addrt.bda, bta_hh_le_dis_cback, DIS_ATTR_PNP_ID_BIT)) {
log::error("read DIS failed");
p_cb->disc_active &= ~BTA_HH_LE_DISC_DIS;
- } else {
- /* TODO(b/367910199): un-serialize once multiservice HoGP is implemented */
- if (com::android::bluetooth::flags::serialize_hogp_and_dis()) {
- log::debug("Waiting for DIS result before starting HoGP service discovery");
- return;
- }
+ Uuid pri_srvc = Uuid::From16Bit(UUID_SERVCLASS_LE_HID);
+ BTA_GATTC_ServiceSearchRequest(p_cb->conn_id, pri_srvc);
+ return;
}
- /* in parallel */
- /* start primary service discovery for HID service */
- Uuid pri_srvc = Uuid::From16Bit(UUID_SERVCLASS_LE_HID);
- BTA_GATTC_ServiceSearchRequest(p_cb->conn_id, pri_srvc);
- return;
+ log::debug("Waiting for DIS result before starting HoGP service discovery");
}
/*******************************************************************************
@@ -1860,17 +1847,13 @@ static void read_report_cb(tCONN_ID conn_id, tGATT_STATUS status, uint16_t handl
log::warn("Unexpected Read response, w4_evt={}", bta_hh_event_text(p_dev_cb->w4_evt));
return;
}
- if (com::android::bluetooth::flags::forward_get_set_report_failure_to_uhid()) {
- p_dev_cb->w4_evt = BTA_HH_EMPTY_EVT;
- }
+ p_dev_cb->w4_evt = BTA_HH_EMPTY_EVT;
uint8_t hid_handle = p_dev_cb->hid_handle;
const gatt::Characteristic* p_char = BTA_GATTC_GetCharacteristic(conn_id, handle);
if (p_char == nullptr) {
log::error("Unknown handle");
- if (com::android::bluetooth::flags::forward_get_set_report_failure_to_uhid()) {
- send_read_report_reply(hid_handle, BTA_HH_ERR, nullptr);
- }
+ send_read_report_reply(hid_handle, BTA_HH_ERR, nullptr);
return;
}
@@ -1884,16 +1867,10 @@ static void read_report_cb(tCONN_ID conn_id, tGATT_STATUS status, uint16_t handl
break;
default:
log::error("Unexpected Read UUID: {}", p_char->uuid.ToString());
- if (com::android::bluetooth::flags::forward_get_set_report_failure_to_uhid()) {
- send_read_report_reply(hid_handle, BTA_HH_ERR, nullptr);
- }
+ send_read_report_reply(hid_handle, BTA_HH_ERR, nullptr);
return;
}
- if (!com::android::bluetooth::flags::forward_get_set_report_failure_to_uhid()) {
- p_dev_cb->w4_evt = BTA_HH_EMPTY_EVT;
- }
-
if (status != GATT_SUCCESS) {
send_read_report_reply(hid_handle, BTA_HH_ERR, nullptr);
return;
@@ -1937,9 +1914,7 @@ static void bta_hh_le_get_rpt(tBTA_HH_DEV_CB* p_cb, tBTA_HH_RPT_TYPE r_type, uin
if (p_rpt == nullptr) {
log::error("no matching report");
- if (com::android::bluetooth::flags::forward_get_set_report_failure_to_uhid()) {
- send_read_report_reply(p_cb->hid_handle, BTA_HH_ERR, nullptr);
- }
+ send_read_report_reply(p_cb->hid_handle, BTA_HH_ERR, nullptr);
return;
}
@@ -1982,17 +1957,13 @@ static void write_report_cb(tCONN_ID conn_id, tGATT_STATUS status, uint16_t hand
}
log::verbose("w4_evt:{}", bta_hh_event_text(p_dev_cb->w4_evt));
- if (com::android::bluetooth::flags::forward_get_set_report_failure_to_uhid()) {
- p_dev_cb->w4_evt = BTA_HH_EMPTY_EVT;
- }
+ p_dev_cb->w4_evt = BTA_HH_EMPTY_EVT;
uint8_t hid_handle = p_dev_cb->hid_handle;
const gatt::Characteristic* p_char = BTA_GATTC_GetCharacteristic(conn_id, handle);
if (p_char == nullptr) {
log::error("Unknown characteristic handle: {}", handle);
- if (com::android::bluetooth::flags::forward_get_set_report_failure_to_uhid()) {
- send_write_report_reply(hid_handle, BTA_HH_ERR, cb_evt);
- }
+ send_write_report_reply(hid_handle, BTA_HH_ERR, cb_evt);
return;
}
@@ -2000,17 +1971,10 @@ static void write_report_cb(tCONN_ID conn_id, tGATT_STATUS status, uint16_t hand
if (uuid16 != GATT_UUID_HID_REPORT && uuid16 != GATT_UUID_HID_BT_KB_INPUT &&
uuid16 != GATT_UUID_HID_BT_MOUSE_INPUT && uuid16 != GATT_UUID_HID_BT_KB_OUTPUT) {
log::error("Unexpected characteristic UUID: {}", p_char->uuid.ToString());
- if (com::android::bluetooth::flags::forward_get_set_report_failure_to_uhid()) {
- send_write_report_reply(hid_handle, BTA_HH_ERR, cb_evt);
- }
+ send_write_report_reply(hid_handle, BTA_HH_ERR, cb_evt);
return;
}
- /* Set Report finished */
- if (!com::android::bluetooth::flags::forward_get_set_report_failure_to_uhid()) {
- p_dev_cb->w4_evt = BTA_HH_EMPTY_EVT;
- }
-
if (status == GATT_SUCCESS) {
send_write_report_reply(hid_handle, BTA_HH_OK, cb_evt);
} else {
@@ -2033,9 +1997,7 @@ static void bta_hh_le_write_rpt(tBTA_HH_DEV_CB* p_cb, tBTA_HH_RPT_TYPE r_type, B
if (p_buf == NULL || p_buf->len == 0) {
log::error("Illegal data");
- if (com::android::bluetooth::flags::forward_get_set_report_failure_to_uhid()) {
- send_write_report_reply(p_cb->hid_handle, BTA_HH_ERR, w4_evt);
- }
+ send_write_report_reply(p_cb->hid_handle, BTA_HH_ERR, w4_evt);
return;
}
@@ -2047,9 +2009,7 @@ static void bta_hh_le_write_rpt(tBTA_HH_DEV_CB* p_cb, tBTA_HH_RPT_TYPE r_type, B
p_rpt = bta_hh_le_find_rpt_by_idtype(p_cb->hid_srvc.report, p_cb->mode, r_type, rpt_id);
if (p_rpt == NULL) {
log::error("no matching report");
- if (com::android::bluetooth::flags::forward_get_set_report_failure_to_uhid()) {
- send_write_report_reply(p_cb->hid_handle, BTA_HH_ERR, w4_evt);
- }
+ send_write_report_reply(p_cb->hid_handle, BTA_HH_ERR, w4_evt);
osi_free(p_buf);
return;
}
diff --git a/system/bta/include/OWNERS b/system/bta/include/OWNERS
deleted file mode 100644
index 9dfb8422a1..0000000000
--- a/system/bta/include/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-per-file bta_hearing_aid_api.h=file:/OWNERS_hearingaid
diff --git a/system/bta/le_audio/OWNERS b/system/bta/le_audio/OWNERS
deleted file mode 100644
index a7d77894ba..0000000000
--- a/system/bta/le_audio/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_leaudio
diff --git a/system/bta/le_audio/client.cc b/system/bta/le_audio/client.cc
index 43c5100b02..ff1b7e2c77 100644
--- a/system/bta/le_audio/client.cc
+++ b/system/bta/le_audio/client.cc
@@ -1332,11 +1332,6 @@ public:
in_call_ = in_call;
- if (!com::android::bluetooth::flags::leaudio_speed_up_reconfiguration_between_call()) {
- log::debug("leaudio_speed_up_reconfiguration_between_call flag is not enabled");
- return;
- }
-
if (active_group_id_ == bluetooth::groups::kGroupUnknown) {
log::debug("There is no active group");
return;
@@ -1641,11 +1636,6 @@ public:
}
void PrepareStreamForAConversational(LeAudioDeviceGroup* group) {
- if (!com::android::bluetooth::flags::leaudio_improve_switch_during_phone_call()) {
- log::info("Flag leaudio_improve_switch_during_phone_call is not enabled");
- return;
- }
-
log::debug("group_id: {}", group->group_id_);
auto remote_direction = bluetooth::le_audio::types::kLeAudioDirectionSink;
@@ -1794,14 +1784,10 @@ public:
/* Reset sink and source listener notified status */
sink_monitor_notified_status_ = std::nullopt;
source_monitor_notified_status_ = std::nullopt;
- if (com::android::bluetooth::flags::leaudio_codec_config_callback_order_fix()) {
- SendAudioGroupSelectableCodecConfigChanged(group);
- SendAudioGroupCurrentCodecConfigChanged(group);
- callbacks_->OnGroupStatus(active_group_id_, GroupStatus::ACTIVE);
- } else {
- callbacks_->OnGroupStatus(active_group_id_, GroupStatus::ACTIVE);
- SendAudioGroupSelectableCodecConfigChanged(group);
- }
+
+ SendAudioGroupSelectableCodecConfigChanged(group);
+ SendAudioGroupCurrentCodecConfigChanged(group);
+ callbacks_->OnGroupStatus(active_group_id_, GroupStatus::ACTIVE);
}
void SetEnableState(const RawAddress& address, bool enabled) override {
@@ -5451,11 +5437,6 @@ public:
remote_metadata.source.set(LeAudioContextType::CONVERSATIONAL);
}
- if (!com::android::bluetooth::flags::leaudio_speed_up_reconfiguration_between_call()) {
- UpdateSinkLocalMetadataContextTypes(remote_metadata.source);
- UpdateSourceLocalMetadataContextTypes(remote_metadata.sink);
- }
-
if (IsInVoipCall()) {
log::debug("Unsetting RINGTONE from remote sink");
remote_metadata.sink.unset(LeAudioContextType::RINGTONE);
diff --git a/system/bta/le_audio/codec_manager.cc b/system/bta/le_audio/codec_manager.cc
index 104d397833..03ea6eede7 100644
--- a/system/bta/le_audio/codec_manager.cc
+++ b/system/bta/le_audio/codec_manager.cc
@@ -787,11 +787,8 @@ public:
bool UpdateCisMonoConfiguration(const std::vector<struct types::cis>& cises,
const stream_parameters& stream_params, uint8_t direction) {
- if (!LeAudioHalVerifier::SupportsStreamActiveApi() ||
- !com::android::bluetooth::flags::leaudio_mono_location_errata()) {
- log::error(
- "SupportsStreamActiveApi() not supported or leaudio_mono_location_errata flag is not "
- "enabled. Mono stream cannot be enabled");
+ if (!LeAudioHalVerifier::SupportsStreamActiveApi()) {
+ log::error("SupportsStreamActiveApi() not supported. Mono stream cannot be enabled");
return false;
}
diff --git a/system/bta/le_audio/codec_manager_test.cc b/system/bta/le_audio/codec_manager_test.cc
index c69464b72e..f238b959f8 100644
--- a/system/bta/le_audio/codec_manager_test.cc
+++ b/system/bta/le_audio/codec_manager_test.cc
@@ -369,8 +369,6 @@ public:
// Disable codec extensibility by default
osi_property_set_bool(kPropLeAudioCodecExtensibility, false);
- com::android::bluetooth::flags::provider_->leaudio_mono_location_errata(false);
-
CodecManagerTestBase::SetUp();
}
};
@@ -542,7 +540,6 @@ TEST_F(CodecManagerTestAdsp, testStreamConfigurationAdspDownMix) {
}
TEST_F(CodecManagerTestAdsp, testStreamConfigurationMono) {
- com::android::bluetooth::flags::provider_->leaudio_mono_location_errata(true);
const std::vector<bluetooth::le_audio::btle_audio_codec_config_t> offloading_preference(0);
codec_manager->Start(offloading_preference);
@@ -1343,7 +1340,6 @@ TEST_F(CodecManagerTestHost, test_dont_call_hal_for_config) {
}
TEST_F(CodecManagerTestAdsp, testStreamConfigurationVendor) {
- com::android::bluetooth::flags::provider_->leaudio_mono_location_errata(true);
osi_property_set_bool(kPropLeAudioCodecExtensibility, true);
const std::vector<bluetooth::le_audio::btle_audio_codec_config_t> offloading_preference(0);
diff --git a/system/bta/le_audio/device_groups.cc b/system/bta/le_audio/device_groups.cc
index 43f27c0a31..6b1f98a6f8 100644
--- a/system/bta/le_audio/device_groups.cc
+++ b/system/bta/le_audio/device_groups.cc
@@ -862,8 +862,7 @@ LeAudioDeviceGroup::GetAudioSetConfigurationRequirements(types::LeAudioContextTy
continue;
}
- if ((com::android::bluetooth::flags::le_audio_support_unidirectional_voice_assistant() &&
- ctx_type == types::LeAudioContextType::VOICEASSISTANTS) ||
+ if (ctx_type == types::LeAudioContextType::VOICEASSISTANTS ||
ctx_type == types::LeAudioContextType::GAME) {
// For GAME and VOICE ASSISTANT, ignore direction if it is not supported only on a single
// direction.
@@ -1689,19 +1688,16 @@ bool LeAudioDeviceGroup::IsAudioSetConfigurationSupported(
continue;
}
- if (com::android::bluetooth::flags::le_audio_support_unidirectional_voice_assistant()) {
- // Verify the direction requirements.
- if (direction == types::kLeAudioDirectionSink &&
- requirements.sink_requirements->size() == 0) {
- log::debug("There is no requirement for Sink direction.");
- return false;
- }
+ // Verify the direction requirements.
+ if (direction == types::kLeAudioDirectionSink && requirements.sink_requirements->size() == 0) {
+ log::debug("There is no requirement for Sink direction.");
+ return false;
+ }
- if (direction == types::kLeAudioDirectionSource &&
- requirements.source_requirements->size() == 0) {
- log::debug("There is no requirement for source direction.");
- return false;
- }
+ if (direction == types::kLeAudioDirectionSource &&
+ requirements.source_requirements->size() == 0) {
+ log::debug("There is no requirement for source direction.");
+ return false;
}
// Match with requirement first if we have
diff --git a/system/bta/le_audio/le_audio_client_test.cc b/system/bta/le_audio/le_audio_client_test.cc
index 02104518d2..69cd0fe768 100644
--- a/system/bta/le_audio/le_audio_client_test.cc
+++ b/system/bta/le_audio/le_audio_client_test.cc
@@ -4792,7 +4792,6 @@ TEST_F(UnicastTest, GroupSetActiveNonConnectedGroup) {
}
TEST_F(UnicastTest, GroupSetActive_CurrentCodecSentOfActive) {
- com::android::bluetooth::flags::provider_->leaudio_codec_config_callback_order_fix(true);
const RawAddress test_address0 = GetTestAddress(0);
int group_id = bluetooth::groups::kGroupUnknown;
@@ -5023,7 +5022,6 @@ TEST_F(UnicastTest, GroupSetActive_and_InactiveDuringStreamConfiguration) {
}
TEST_F(UnicastTest, AnotherGroupSetActive_DuringMediaStream) {
- com::android::bluetooth::flags::provider_->leaudio_improve_switch_during_phone_call(true);
const RawAddress test_address0 = GetTestAddress(0);
const RawAddress test_address1 = GetTestAddress(1);
int group_id_1 = 1;
@@ -5102,7 +5100,6 @@ TEST_F(UnicastTest, AnotherGroupSetActive_DuringMediaStream) {
}
TEST_F(UnicastTest, AnotherGroupSetActive_DuringVoip) {
- com::android::bluetooth::flags::provider_->leaudio_improve_switch_during_phone_call(true);
const RawAddress test_address0 = GetTestAddress(0);
const RawAddress test_address1 = GetTestAddress(1);
int group_id_1 = 1;
@@ -5175,7 +5172,6 @@ TEST_F(UnicastTest, AnotherGroupSetActive_DuringVoip) {
}
TEST_F(UnicastTest, GroupSetActive_and_GroupSetInactive_DuringPhoneCall) {
- com::android::bluetooth::flags::provider_->leaudio_improve_switch_during_phone_call(true);
const RawAddress test_address0 = GetTestAddress(0);
int group_id = bluetooth::groups::kGroupUnknown;
@@ -5222,7 +5218,6 @@ TEST_F(UnicastTest, GroupSetActive_and_GroupSetInactive_DuringPhoneCall) {
}
TEST_F(UnicastTest, GroupSetActive_DuringPhoneCall_ThenResume) {
- com::android::bluetooth::flags::provider_->leaudio_improve_switch_during_phone_call(true);
const RawAddress test_address0 = GetTestAddress(0);
int group_id = bluetooth::groups::kGroupUnknown;
@@ -6578,7 +6573,6 @@ TEST_F(UnicastTest, SpeakerStreamingNonDefault) {
}
TEST_F(UnicastTest, TestUnidirectionalGameAndLiveRecording) {
- com::android::bluetooth::flags::provider_->le_audio_support_unidirectional_voice_assistant(true);
const RawAddress test_address0 = GetTestAddress(0);
int group_id = bluetooth::groups::kGroupUnknown;
@@ -6769,7 +6763,6 @@ TEST_F(UnicastTest, TestUnidirectionalGameAndLiveRecordingMicOnlyDev) {
}
TEST_F(UnicastTest, TestUnidirectionalVoiceAssistant_Sink) {
- com::android::bluetooth::flags::provider_->le_audio_support_unidirectional_voice_assistant(true);
const RawAddress test_address0 = GetTestAddress(0);
int group_id = bluetooth::groups::kGroupUnknown;
@@ -6843,7 +6836,6 @@ TEST_F(UnicastTest, TestUnidirectionalVoiceAssistant_Sink) {
}
TEST_F(UnicastTest, TestUnidirectionalVoiceAssistant_Source) {
- com::android::bluetooth::flags::provider_->le_audio_support_unidirectional_voice_assistant(true);
const RawAddress test_address0 = GetTestAddress(0);
int group_id = bluetooth::groups::kGroupUnknown;
@@ -8837,111 +8829,7 @@ TEST_F(UnicastTest, TwoEarbudsStopConversational_StartStreamSonification) {
Mock::VerifyAndClearExpectations(&mock_state_machine_);
}
-TEST_F(UnicastTest, TwoEarbudsStreamingContextSwitchReconfigure) {
- // TODO(b/352686917). Remove the test when flag will be removing
- com::android::bluetooth::flags::provider_->leaudio_speed_up_reconfiguration_between_call(false);
-
- uint8_t group_size = 2;
- int group_id = 2;
-
- // Report working CSIS
- ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true));
-
- ON_CALL(mock_csis_client_module_, GetDesiredSize(group_id))
- .WillByDefault(Invoke([&](int /*group_id*/) { return group_size; }));
-
- // First earbud
- const RawAddress test_address0 = GetTestAddress(0);
- EXPECT_CALL(mock_btif_storage_, AddLeaudioAutoconnect(test_address0, true)).Times(1);
- ConnectCsisDevice(test_address0, 1 /*conn_id*/, codec_spec_conf::kLeAudioLocationFrontLeft,
- codec_spec_conf::kLeAudioLocationFrontLeft, group_size, group_id, 1 /* rank*/);
-
- // Second earbud
- const RawAddress test_address1 = GetTestAddress(1);
- EXPECT_CALL(mock_btif_storage_, AddLeaudioAutoconnect(test_address1, true)).Times(1);
- ConnectCsisDevice(test_address1, 2 /*conn_id*/, codec_spec_conf::kLeAudioLocationFrontRight,
- codec_spec_conf::kLeAudioLocationFrontRight, group_size, group_id, 2 /* rank*/,
- true /*connect_through_csis*/);
-
- constexpr int gmcs_ccid = 1;
- constexpr int gtbs_ccid = 2;
-
- // Start streaming MEDIA
- EXPECT_CALL(*mock_le_audio_source_hal_client_, Start(_, _, _)).Times(1);
- EXPECT_CALL(*mock_le_audio_sink_hal_client_, Start(_, _, _)).Times(1);
- LeAudioClient::Get()->SetCcidInformation(gmcs_ccid, 4 /* Media */);
- LeAudioClient::Get()->SetCcidInformation(gtbs_ccid, 2 /* Phone */);
- LeAudioClient::Get()->GroupSetActive(group_id);
- SyncOnMainLoop();
-
- types::BidirectionalPair<std::vector<uint8_t>> ccids = {.sink = {gmcs_ccid}, .source = {}};
- EXPECT_CALL(mock_state_machine_, StartStream(_, _, _, ccids)).Times(1);
- StartStreaming(AUDIO_USAGE_MEDIA, AUDIO_CONTENT_TYPE_MUSIC, group_id);
-
- SyncOnMainLoop();
- Mock::VerifyAndClearExpectations(&mock_state_machine_);
- Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_);
- Mock::VerifyAndClearExpectations(mock_le_audio_source_hal_client_);
-
- // Verify Data transfer on two peer sinks
- uint8_t cis_count_out = 2;
- uint8_t cis_count_in = 0;
- TestAudioDataTransfer(group_id, cis_count_out, cis_count_in, 1920);
-
- // Stop
- StopStreaming(group_id);
- // simulate suspend timeout passed, alarm executing
- fake_osi_alarm_set_on_mloop_.cb(fake_osi_alarm_set_on_mloop_.data);
- Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_);
-
- log::info("SetInCall is used by GTBS - and only then we can expect CCID to be set.");
- LeAudioClient::Get()->SetInCall(true);
-
- // Conversational is a bidirectional scenario so expect GTBS CCID
- // in the metadata for both directions. Can be called twice when one
- // direction resume after the other and metadata is updated.
- ccids = {.sink = {gtbs_ccid}, .source = {gtbs_ccid}};
- EXPECT_CALL(mock_state_machine_,
- StartStream(_, types::LeAudioContextType::CONVERSATIONAL, _, ccids))
- .Times(AtLeast(1));
- StartStreaming(AUDIO_USAGE_VOICE_COMMUNICATION, AUDIO_CONTENT_TYPE_SPEECH, group_id);
-
- SyncOnMainLoop();
- Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_);
- Mock::VerifyAndClearExpectations(mock_le_audio_source_hal_client_);
-
- // Verify Data transfer on two peer sinks and one source
- cis_count_out = 2;
- cis_count_in = 2;
- TestAudioDataTransfer(group_id, cis_count_out, cis_count_in, 1920, 40);
-
- log::info("End call");
- LeAudioClient::Get()->SetInCall(false);
- UpdateLocalSourceMetadata(AUDIO_USAGE_UNKNOWN, AUDIO_CONTENT_TYPE_UNKNOWN, false);
- UpdateLocalSinkMetadata(std::nullopt);
- // Stop
- StopStreaming(group_id, true);
-
- log::info("Switch back to MEDIA");
- ccids = {.sink = {gmcs_ccid}, .source = {}};
- types::BidirectionalPair<types::AudioContexts> contexts = {
- .sink = types::AudioContexts(types::LeAudioContextType::MEDIA),
- .source = types::AudioContexts()};
- EXPECT_CALL(mock_state_machine_,
- ConfigureStream(_, bluetooth::le_audio::types::LeAudioContextType::MEDIA, contexts,
- ccids, _))
- .Times(1);
- StartStreaming(AUDIO_USAGE_MEDIA, AUDIO_CONTENT_TYPE_MUSIC, group_id, AUDIO_SOURCE_INVALID, true);
-
- SyncOnMainLoop();
- Mock::VerifyAndClearExpectations(&mock_state_machine_);
- Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_);
- Mock::VerifyAndClearExpectations(mock_le_audio_source_hal_client_);
-}
-
TEST_F(UnicastTest, TwoEarbudsStreamingContextSwitchReconfigure_SpeedUpReconfigFlagEnabled) {
- com::android::bluetooth::flags::provider_->leaudio_speed_up_reconfiguration_between_call(true);
-
uint8_t group_size = 2;
int group_id = 2;
@@ -10937,79 +10825,7 @@ TEST_F(UnicastTest, SwitchBetweenSoundEffectAndMicrophoneScenario) {
* What we can do now is to keep streaming (and reconfigure if needed for the
* use case).
*/
-TEST_F(UnicastTest, UpdateNotSupportedContextTypeUnspecifiedAvailable) {
- // TODO(b/352686917). Remove the test when flag will be removing
- com::android::bluetooth::flags::provider_->leaudio_speed_up_reconfiguration_between_call(false);
-
- const RawAddress test_address0 = GetTestAddress(0);
- int group_id = bluetooth::groups::kGroupUnknown;
-
- available_snk_context_types_ =
- (types::LeAudioContextType::RINGTONE | types::LeAudioContextType::CONVERSATIONAL |
- types::LeAudioContextType::UNSPECIFIED | types::LeAudioContextType::MEDIA)
- .value();
- supported_snk_context_types_ = available_snk_context_types_;
- available_src_context_types_ = available_snk_context_types_;
- supported_src_context_types_ = available_src_context_types_;
-
- SetSampleDatabaseEarbudsValid(1, test_address0, codec_spec_conf::kLeAudioLocationStereo,
- codec_spec_conf::kLeAudioLocationStereo, default_channel_cnt,
- default_channel_cnt, 0x0004, false /*add_csis*/, true /*add_cas*/,
- true /*add_pacs*/, default_ase_cnt /*add_ascs_cnt*/, 1 /*set_size*/,
- 0 /*rank*/);
- EXPECT_CALL(mock_audio_hal_client_callbacks_,
- OnConnectionState(ConnectionState::CONNECTED, test_address0))
- .Times(1);
- EXPECT_CALL(mock_audio_hal_client_callbacks_,
- OnGroupNodeStatus(test_address0, _, GroupNodeStatus::ADDED))
- .WillOnce(DoAll(SaveArg<1>(&group_id)));
-
- ConnectLeAudio(test_address0);
- ASSERT_NE(group_id, bluetooth::groups::kGroupUnknown);
-
- // Start streaming
- uint8_t cis_count_out = 1;
- uint8_t cis_count_in = 0;
-
- LeAudioClient::Get()->SetInCall(true);
-
- // Audio sessions are started only when device gets active
- EXPECT_CALL(*mock_le_audio_source_hal_client_, Start(_, _, _)).Times(1);
- EXPECT_CALL(*mock_le_audio_sink_hal_client_, Start(_, _, _)).Times(1);
- LeAudioClient::Get()->GroupSetActive(group_id);
- SyncOnMainLoop();
-
- StartStreaming(AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE, AUDIO_CONTENT_TYPE_UNKNOWN, group_id);
- LocalAudioSourceResume();
- LocalAudioSinkResume();
-
- Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_);
- Mock::VerifyAndClearExpectations(mock_le_audio_source_hal_client_);
- SyncOnMainLoop();
-
- // Verify Data transfer on one audio source cis
- TestAudioDataTransfer(group_id, cis_count_out, cis_count_in, 1920);
-
- LeAudioClient::Get()->SetInCall(false);
- LocalAudioSinkSuspend();
- UpdateLocalSinkMetadata(std::nullopt);
-
- /* We should use GAME configuration, but do not send the GAME context type, as
- * it is not available on the remote device.
- */
- EXPECT_CALL(mock_state_machine_, StopStream(_)).Times(0);
- types::BidirectionalPair<types::AudioContexts> contexts = {
- .sink = types::AudioContexts(types::LeAudioContextType::UNSPECIFIED),
- .source = types::AudioContexts()};
- EXPECT_CALL(mock_state_machine_, StartStream(_, types::LeAudioContextType::GAME, contexts, _))
- .Times(1);
- UpdateLocalSourceMetadata(AUDIO_USAGE_GAME, AUDIO_CONTENT_TYPE_UNKNOWN, false);
- SyncOnMainLoop();
-}
-
TEST_F(UnicastTest, UpdateNotSupportedContextTypeUnspecifiedAvailable_SpeedUpReconfigFlagEnabled) {
- com::android::bluetooth::flags::provider_->leaudio_speed_up_reconfiguration_between_call(true);
-
const RawAddress test_address0 = GetTestAddress(0);
int group_id = bluetooth::groups::kGroupUnknown;
@@ -11081,146 +10897,7 @@ TEST_F(UnicastTest, UpdateNotSupportedContextTypeUnspecifiedAvailable_SpeedUpRec
* always results with one bidirectional context, so that the remote device
* is not confused about our intentions.
*/
-TEST_F(UnicastTest, UpdateMultipleBidirContextTypes) {
- // TODO(b/352686917). Remove the test when flag will be removing
- com::android::bluetooth::flags::provider_->leaudio_speed_up_reconfiguration_between_call(false);
-
- const RawAddress test_address0 = GetTestAddress(0);
- int group_id = bluetooth::groups::kGroupUnknown;
-
- available_snk_context_types_ = (types::LeAudioContextType::CONVERSATIONAL |
- types::LeAudioContextType::GAME | types::LeAudioContextType::LIVE)
- .value();
- supported_snk_context_types_ =
- available_snk_context_types_ |
- types::AudioContexts(types::LeAudioContextType::UNSPECIFIED).value();
- available_src_context_types_ = available_snk_context_types_;
- supported_src_context_types_ =
- available_src_context_types_ |
- types::AudioContexts(types::LeAudioContextType::UNSPECIFIED).value();
-
- SetSampleDatabaseEarbudsValid(1, test_address0, codec_spec_conf::kLeAudioLocationAnyLeft,
- codec_spec_conf::kLeAudioLocationStereo, default_channel_cnt,
- default_channel_cnt, 0x0024, false /*add_csis*/, true /*add_cas*/,
- true /*add_pacs*/, default_ase_cnt /*add_ascs_cnt*/, 1 /*set_size*/,
- 0 /*rank*/);
- EXPECT_CALL(mock_audio_hal_client_callbacks_,
- OnConnectionState(ConnectionState::CONNECTED, test_address0))
- .Times(1);
- EXPECT_CALL(mock_audio_hal_client_callbacks_,
- OnGroupNodeStatus(test_address0, _, GroupNodeStatus::ADDED))
- .WillOnce(DoAll(SaveArg<1>(&group_id)));
-
- ConnectLeAudio(test_address0);
- ASSERT_NE(group_id, bluetooth::groups::kGroupUnknown);
-
- // Audio sessions are started only when device gets active
- EXPECT_CALL(*mock_le_audio_source_hal_client_, Start(_, _, _)).Times(1);
- EXPECT_CALL(*mock_le_audio_sink_hal_client_, Start(_, _, _)).Times(1);
- LeAudioClient::Get()->GroupSetActive(group_id);
- SyncOnMainLoop();
-
- // When the local audio sink resumes expect only LIVE context
- types::BidirectionalPair<types::AudioContexts> contexts = {
- .sink = types::AudioContexts(types::LeAudioContextType::LIVE),
- .source = types::AudioContexts(types::LeAudioContextType::LIVE)};
- EXPECT_CALL(mock_state_machine_,
- StartStream(_, bluetooth::le_audio::types::LeAudioContextType::LIVE, contexts, _))
- .Times(1);
-
- // 1) Start the recording. Sink resume will trigger the reconfiguration
- // ---------------------------------------------------------------------
- ASSERT_NE(nullptr, unicast_sink_hal_cb_);
- UpdateLocalSinkMetadata(AUDIO_SOURCE_MIC);
- LocalAudioSinkResume();
-
- Mock::VerifyAndClearExpectations(mock_le_audio_source_hal_client_);
- Mock::VerifyAndClearExpectations(mock_le_audio_sink_hal_client_);
- Mock::VerifyAndClearExpectations(&mock_state_machine_);
-
- /* After the reconfiguration the local Audio Sink HAL has to resume again */
- LocalAudioSourceResume();
- LocalAudioSinkResume();
-
- Mock::VerifyAndClearExpectations(mock_le_audio_source_hal_client_);
- Mock::VerifyAndClearExpectations(mock_le_audio_sink_hal_client_);
- Mock::VerifyAndClearExpectations(&mock_state_machine_);
-
- // Verify Data transfer on one audio source and sink cis
- uint8_t cis_count_out = 1;
- uint8_t cis_count_in = 1;
- TestAudioDataTransfer(group_id, cis_count_out, cis_count_in, 1920, 40);
-
- // Stop
- StopStreaming(group_id);
- Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_);
-
- // 2) Now set in call preference to get CONVERSATIONAL into the mix
- // -----------------------------------------------------------------
- LeAudioClient::Get()->SetInCall(true);
-
- // Verify that we only got CONVERSATIONAL context and no LIVE
- contexts = {.sink = types::AudioContexts(types::LeAudioContextType::CONVERSATIONAL),
- .source = types::AudioContexts(types::LeAudioContextType::CONVERSATIONAL)};
- EXPECT_CALL(mock_state_machine_,
- StartStream(_, bluetooth::le_audio::types::LeAudioContextType::CONVERSATIONAL,
- contexts, _))
- .Times(1);
-
- // Start with ringtone on local source
- ASSERT_NE(nullptr, unicast_sink_hal_cb_);
- StartStreaming(AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE, AUDIO_CONTENT_TYPE_UNKNOWN, group_id);
-
- // Resume both directions
- LocalAudioSourceResume();
- LocalAudioSinkResume();
-
- Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_);
- Mock::VerifyAndClearExpectations(mock_le_audio_source_hal_client_);
- Mock::VerifyAndClearExpectations(&mock_state_machine_);
-
- // Verify Data transfer on one audio source cis
- cis_count_out = 1;
- cis_count_in = 1;
- TestAudioDataTransfer(group_id, cis_count_out, cis_count_in, 1920, 40);
-
- // 3) Disable call so we could go to GAME
- // ---------------------------------------
- LeAudioClient::Get()->SetInCall(false);
-
- /* Start the game on local source - expect no previous sink (LIVE) metadata */
- EXPECT_CALL(mock_state_machine_, StopStream(_)).Times(0);
- contexts = {.sink = types::AudioContexts(types::LeAudioContextType::GAME),
- .source = types::AudioContexts(types::LeAudioContextType::GAME)};
- EXPECT_CALL(mock_state_machine_, StartStream(_, types::LeAudioContextType::GAME, contexts, _))
- .Times(1);
- UpdateLocalSourceMetadata(AUDIO_USAGE_GAME, AUDIO_CONTENT_TYPE_UNKNOWN, false);
-
- /* If the above triggers reconfiguration, Audio Hal action is needed to
- * restart the stream.
- */
- LocalAudioSourceResume();
- LocalAudioSinkResume();
- Mock::VerifyAndClearExpectations(&mock_state_machine_);
-
- // 4) Stop streaming
- // ------------------
- StopStreaming(group_id);
- Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_);
-
- // Release
- EXPECT_CALL(*mock_le_audio_source_hal_client_, Stop()).Times(1);
- EXPECT_CALL(*mock_le_audio_source_hal_client_, OnDestroyed()).Times(1);
- EXPECT_CALL(*mock_le_audio_sink_hal_client_, OnDestroyed()).Times(1);
- do_in_main_thread(base::BindOnce(
- [](LeAudioClient* client) { client->GroupSetActive(bluetooth::groups::kGroupUnknown); },
- LeAudioClient::Get()));
- SyncOnMainLoop();
-}
-
TEST_F(UnicastTest, UpdateMultipleBidirContextTypes_SpeedUpReconfigFlagEnabled) {
- com::android::bluetooth::flags::provider_->leaudio_speed_up_reconfiguration_between_call(true);
-
const RawAddress test_address0 = GetTestAddress(0);
int group_id = bluetooth::groups::kGroupUnknown;
@@ -11444,154 +11121,7 @@ TEST_F(UnicastTest, UpdateDisableLocalAudioSinkOnGame) {
}
/* Start music when in a call, end the call, continue with music only */
-TEST_F(UnicastTest, MusicDuringCallContextTypes) {
- // TODO(b/352686917). Remove the test when flag will be removing
- com::android::bluetooth::flags::provider_->leaudio_speed_up_reconfiguration_between_call(false);
-
- const RawAddress test_address0 = GetTestAddress(0);
- int group_id = bluetooth::groups::kGroupUnknown;
-
- available_snk_context_types_ =
- (types::LeAudioContextType::CONVERSATIONAL | types::LeAudioContextType::RINGTONE |
- types::LeAudioContextType::GAME | types::LeAudioContextType::MEDIA |
- types::LeAudioContextType::LIVE | types::LeAudioContextType::NOTIFICATIONS)
- .value();
- supported_snk_context_types_ =
- available_snk_context_types_ |
- types::AudioContexts(types::LeAudioContextType::UNSPECIFIED).value();
- available_src_context_types_ = available_snk_context_types_;
- available_src_context_types_ &=
- ~((types::LeAudioContextType::NOTIFICATIONS | types::LeAudioContextType::MEDIA).value());
- supported_src_context_types_ =
- available_src_context_types_ |
- types::AudioContexts(types::LeAudioContextType::UNSPECIFIED).value();
-
- SetSampleDatabaseEarbudsValid(1, test_address0, codec_spec_conf::kLeAudioLocationAnyLeft,
- codec_spec_conf::kLeAudioLocationStereo, default_channel_cnt,
- default_channel_cnt, 0x0024, false /*add_csis*/, true /*add_cas*/,
- true /*add_pacs*/, default_ase_cnt /*add_ascs_cnt*/, 1 /*set_size*/,
- 0 /*rank*/);
- EXPECT_CALL(mock_audio_hal_client_callbacks_,
- OnConnectionState(ConnectionState::CONNECTED, test_address0))
- .Times(1);
- EXPECT_CALL(mock_audio_hal_client_callbacks_,
- OnGroupNodeStatus(test_address0, _, GroupNodeStatus::ADDED))
- .WillOnce(DoAll(SaveArg<1>(&group_id)));
-
- ConnectLeAudio(test_address0);
- ASSERT_NE(group_id, bluetooth::groups::kGroupUnknown);
-
- // Audio sessions are started only when device gets active
- EXPECT_CALL(*mock_le_audio_source_hal_client_, Start(_, _, _)).Times(1);
- EXPECT_CALL(*mock_le_audio_sink_hal_client_, Start(_, _, _)).Times(1);
- LeAudioClient::Get()->GroupSetActive(group_id);
- SyncOnMainLoop();
-
- log::info("TESTPOINT 1: Start with the call first");
- // -----------------------------
- // CONVERSATIONAL is from In Call preference, and RINGTONE is from metadata
- LeAudioClient::Get()->SetInCall(true);
- types::BidirectionalPair<types::AudioContexts> contexts = {
- .sink = types::AudioContexts(types::LeAudioContextType::RINGTONE |
- types::LeAudioContextType::CONVERSATIONAL),
- .source = types::AudioContexts(types::LeAudioContextType::CONVERSATIONAL)};
- EXPECT_CALL(mock_state_machine_,
- StartStream(_, bluetooth::le_audio::types::LeAudioContextType::CONVERSATIONAL,
- contexts, _))
- .Times(1);
- StartStreaming(AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE, AUDIO_CONTENT_TYPE_UNKNOWN, group_id);
- LocalAudioSinkResume();
-
- // Verify
- Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_);
- Mock::VerifyAndClearExpectations(mock_le_audio_source_hal_client_);
- Mock::VerifyAndClearExpectations(&mock_state_machine_);
-
- // Verify Data transfer
- uint8_t cis_count_out = 1;
- uint8_t cis_count_in = 1;
- TestAudioDataTransfer(group_id, cis_count_out, cis_count_in, 1920, 40);
-
- log::info("TESTPOINT 2: Start MEDIA during the call, expect MEDIA only on the remote sink");
- contexts = {.sink = types::AudioContexts(types::LeAudioContextType::CONVERSATIONAL |
- types::LeAudioContextType::MEDIA),
- .source = types::AudioContexts(types::LeAudioContextType::CONVERSATIONAL)};
- EXPECT_CALL(mock_state_machine_,
- StartStream(_, bluetooth::le_audio::types::LeAudioContextType::CONVERSATIONAL,
- contexts, _))
- .Times(1);
- UpdateLocalSourceMetadata(AUDIO_USAGE_MEDIA, AUDIO_CONTENT_TYPE_MUSIC, false);
- SyncOnMainLoop();
-
- Mock::VerifyAndClearExpectations(&mock_state_machine_);
- Mock::VerifyAndClearExpectations(mock_le_audio_source_hal_client_);
- Mock::VerifyAndClearExpectations(mock_le_audio_sink_hal_client_);
-
- log::info(
- "TESTPOINT 3: Disable In Call preference but do not suspend the local sink. Play "
- "notification on the same stream.");
- // Verify both context are sent as the metadata.
- // ---------------------------------------
- LeAudioClient::Get()->SetInCall(false);
-
- EXPECT_CALL(mock_state_machine_, StopStream(_)).Times(0);
- contexts = {.sink = types::AudioContexts(types::LeAudioContextType::NOTIFICATIONS |
- types::LeAudioContextType::CONVERSATIONAL),
- .source = types::AudioContexts(types::LeAudioContextType::CONVERSATIONAL)};
- EXPECT_CALL(mock_state_machine_,
- StartStream(_, types::LeAudioContextType::CONVERSATIONAL, contexts, _))
- .Times(1);
- UpdateLocalSourceMetadata(AUDIO_USAGE_NOTIFICATION, AUDIO_CONTENT_TYPE_UNKNOWN,
- /*reconfigure=*/false);
- Mock::VerifyAndClearExpectations(&mock_state_machine_);
- Mock::VerifyAndClearExpectations(mock_le_audio_source_hal_client_);
- Mock::VerifyAndClearExpectations(mock_le_audio_sink_hal_client_);
-
- log::info("TESTPOINT 4: Disable call so we could go back to MEDIA");
- // ---------------------------------------
- // Suspend should stop the stream
- EXPECT_CALL(mock_state_machine_, StopStream(_)).Times(1);
- UpdateLocalSinkMetadata(std::nullopt);
- LocalAudioSourceSuspend();
- LocalAudioSinkSuspend();
- // simulate suspend timeout passed, alarm executing
- fake_osi_alarm_set_on_mloop_.cb(fake_osi_alarm_set_on_mloop_.data);
- Mock::VerifyAndClearExpectations(&mock_state_machine_);
-
- // Restart the stream with MEDIA
- contexts = {.sink = types::AudioContexts(types::LeAudioContextType::MEDIA),
- .source = types::AudioContexts()};
- EXPECT_CALL(mock_state_machine_, StartStream(_, types::LeAudioContextType::MEDIA, contexts, _))
- .Times(1);
- UpdateLocalSourceMetadata(AUDIO_USAGE_MEDIA, AUDIO_CONTENT_TYPE_MUSIC,
- /*reconfigure=*/false);
- Mock::VerifyAndClearExpectations(mock_le_audio_source_hal_client_);
- Mock::VerifyAndClearExpectations(mock_le_audio_sink_hal_client_);
-
- /* The source needs to resume to reconfigure to MEDIA */
- LocalAudioSourceResume(/*expect_confirm=*/false);
- LocalAudioSourceResume(/*expect_confirm=*/true);
- Mock::VerifyAndClearExpectations(&mock_state_machine_);
- Mock::VerifyAndClearExpectations(mock_le_audio_source_hal_client_);
- Mock::VerifyAndClearExpectations(mock_le_audio_sink_hal_client_);
-
- log::info("TESTPOINT 5: Stop streaming");
- // ------------------
- StopStreaming(group_id);
- Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_);
-
- // Release
- EXPECT_CALL(*mock_le_audio_source_hal_client_, Stop()).Times(1);
- EXPECT_CALL(*mock_le_audio_source_hal_client_, OnDestroyed()).Times(1);
- EXPECT_CALL(*mock_le_audio_sink_hal_client_, OnDestroyed()).Times(1);
- do_in_main_thread(base::BindOnce(
- [](LeAudioClient* client) { client->GroupSetActive(bluetooth::groups::kGroupUnknown); },
- LeAudioClient::Get()));
- SyncOnMainLoop();
-}
-
TEST_F(UnicastTest, MetadataUpdateDuringReconfiguration) {
- com::android::bluetooth::flags::provider_->leaudio_speed_up_reconfiguration_between_call(true);
const RawAddress test_address0 = GetTestAddress(0);
int group_id = bluetooth::groups::kGroupUnknown;
@@ -11664,8 +11194,6 @@ TEST_F(UnicastTest, MetadataUpdateDuringReconfiguration) {
}
TEST_F(UnicastTest, MusicDuringCallContextTypes_SpeedUpReconfigFlagEnabled) {
- com::android::bluetooth::flags::provider_->leaudio_speed_up_reconfiguration_between_call(true);
-
const RawAddress test_address0 = GetTestAddress(0);
int group_id = bluetooth::groups::kGroupUnknown;
diff --git a/system/bta/le_audio/metrics_collector.cc b/system/bta/le_audio/metrics_collector.cc
index a4fb4a353d..24da2e085c 100644
--- a/system/bta/le_audio/metrics_collector.cc
+++ b/system/bta/le_audio/metrics_collector.cc
@@ -25,9 +25,9 @@
#include <unordered_map>
#include <vector>
-#include "common/metrics.h"
#include "hardware/bt_le_audio.h"
#include "le_audio_types.h"
+#include "os/metrics.h"
#include "types/raw_address.h"
namespace bluetooth::le_audio {
@@ -199,7 +199,7 @@ public:
device_address[i] = device_metric->address_;
}
- bluetooth::common::LogLeAudioConnectionSessionReported(
+ bluetooth::os::LogMetricLeAudioConnectionSessionReported(
group_size_, group_id_, connection_duration_nanos, device_connecting_offset_nanos,
device_connected_offset_nanos, device_connection_duration_nanos,
device_connection_statuses, device_disconnection_statuses, device_address,
@@ -278,7 +278,7 @@ void MetricsCollector::OnBroadcastStateChanged(bool started) {
broadcast_beginning_timepoint_ = std::chrono::high_resolution_clock::now();
} else {
auto broadcast_ending_timepoint_ = std::chrono::high_resolution_clock::now();
- bluetooth::common::LogLeAudioBroadcastSessionReported(
+ bluetooth::os::LogMetricLeAudioBroadcastSessionReported(
get_timedelta_nanos(broadcast_beginning_timepoint_, broadcast_ending_timepoint_));
broadcast_beginning_timepoint_ = kInvalidTimePoint;
}
diff --git a/system/bta/le_audio/metrics_collector_test.cc b/system/bta/le_audio/metrics_collector_test.cc
index c94db90ad6..199199bf8a 100644
--- a/system/bta/le_audio/metrics_collector_test.cc
+++ b/system/bta/le_audio/metrics_collector_test.cc
@@ -23,7 +23,7 @@
#include <cstdint>
#include <vector>
-#include "common/metrics.h"
+#include "os/metrics.h"
#include "types/raw_address.h"
using testing::_;
@@ -57,9 +57,9 @@ std::vector<int64_t> last_streaming_duration_nanos;
std::vector<int32_t> last_streaming_context_type;
namespace bluetooth {
-namespace common {
+namespace os {
-void LogLeAudioConnectionSessionReported(
+void LogMetricLeAudioConnectionSessionReported(
int32_t group_size, int32_t group_metric_id, int64_t connection_duration_nanos,
const std::vector<int64_t>& device_connecting_offset_nanos,
const std::vector<int64_t>& device_connected_offset_nanos,
@@ -85,11 +85,11 @@ void LogLeAudioConnectionSessionReported(
last_streaming_context_type = streaming_context_type;
}
-void LogLeAudioBroadcastSessionReported(int64_t duration_nanos) {
+void LogMetricLeAudioBroadcastSessionReported(int64_t duration_nanos) {
last_broadcast_duration_nanos = duration_nanos;
}
-} // namespace common
+} // namespace os
} // namespace bluetooth
namespace bluetooth::le_audio {
diff --git a/system/bta/le_audio/state_machine.cc b/system/bta/le_audio/state_machine.cc
index e5ce67cf9d..b3f20fba39 100644
--- a/system/bta/le_audio/state_machine.cc
+++ b/system/bta/le_audio/state_machine.cc
@@ -681,8 +681,16 @@ public:
kLogHciEvent, group->group_id_, leAudioDevice->address_,
kLogSetDataPathOp + "cis_h:" + loghex(conn_handle) + " STATUS=" + loghex(status));
+ /* Find ASE and later update state for the given cis.*/
+ auto ase = leAudioDevice->GetFirstActiveAseByCisAndDataPathState(CisState::CONNECTED,
+ DataPathState::CONFIGURING);
+
if (status) {
- log::error("failed to setup data path");
+ log::error("Failed to setup data path for {}, cis handle: {:#x}, error: {:#x}",
+ leAudioDevice->address_, conn_handle, status);
+ if (ase && ase->cis_conn_hdl == conn_handle) {
+ ase->data_path_state = DataPathState::IDLE;
+ }
StopStream(group);
return;
@@ -696,10 +704,6 @@ public:
return;
}
- /* Update state for the given cis.*/
- auto ase = leAudioDevice->GetFirstActiveAseByCisAndDataPathState(CisState::CONNECTED,
- DataPathState::CONFIGURING);
-
if (!ase || ase->cis_conn_hdl != conn_handle) {
log::error("Cannot find ase by handle {}", conn_handle);
return;
diff --git a/system/bta/test/common/btif_storage_mock.cc b/system/bta/test/common/btif_storage_mock.cc
index 7e4a4e5118..f5eb38939e 100644
--- a/system/bta/test/common/btif_storage_mock.cc
+++ b/system/bta/test/common/btif_storage_mock.cc
@@ -19,6 +19,7 @@
#include <bluetooth/log.h>
+#include "bta_hearing_aid_api.h"
#include "btif/include/btif_profile_storage.h"
#include "btif/include/btif_storage.h"
@@ -134,3 +135,17 @@ bt_status_t btif_storage_get_remote_device_property(const RawAddress* address,
log::assert_that(btif_storage_interface != nullptr, "Mock storage module not set!");
return btif_storage_interface->GetRemoteDeviceProperty(address, property);
}
+
+/** Get the hearing aid device properties. */
+bool btif_storage_get_hearing_aid_prop(const RawAddress& address, uint8_t* capabilities,
+ uint64_t* hi_sync_id, uint16_t* render_delay,
+ uint16_t* preparation_delay, uint16_t* codecs) {
+ log::assert_that(btif_storage_interface != nullptr, "Mock storage module not set!");
+ return btif_storage_interface->GetHearingAidProp(address, capabilities, hi_sync_id, render_delay,
+ preparation_delay, codecs);
+}
+
+void btif_storage_add_hearing_aid(const HearingDevice& dev_info) {
+ log::assert_that(btif_storage_interface != nullptr, "Mock storage module not set!");
+ return btif_storage_interface->AddHearingAid(&dev_info);
+}
diff --git a/system/bta/test/common/btif_storage_mock.h b/system/bta/test/common/btif_storage_mock.h
index 8809643f70..25f9bbdde0 100644
--- a/system/bta/test/common/btif_storage_mock.h
+++ b/system/bta/test/common/btif_storage_mock.h
@@ -21,6 +21,8 @@
#include "include/hardware/bluetooth.h"
#include "types/raw_address.h"
+struct HearingDevice;
+
namespace bluetooth {
namespace storage {
@@ -50,6 +52,11 @@ public:
virtual bt_status_t GetRemoteDeviceProperty(const RawAddress* address,
bt_property_t* property) = 0;
+ virtual bool GetHearingAidProp(const RawAddress& address, uint8_t* capabilities,
+ uint64_t* hi_sync_id, uint16_t* render_delay,
+ uint16_t* preparation_delay, uint16_t* codecs) = 0;
+ virtual void AddHearingAid(const HearingDevice* dev_info) = 0;
+
virtual ~BtifStorageInterface() = default;
};
@@ -88,6 +95,11 @@ public:
MOCK_METHOD((void), RemoveLeaudioHas, (const RawAddress& address), (override));
MOCK_METHOD((bt_status_t), GetRemoteDeviceProperty,
(const RawAddress* address, bt_property_t* property), (override));
+ MOCK_METHOD((bool), GetHearingAidProp,
+ (const RawAddress& address, uint8_t* capabilities, uint64_t* hi_sync_id,
+ uint16_t* render_delay, uint16_t* preparation_delay, uint16_t* codecs),
+ (override));
+ MOCK_METHOD((void), AddHearingAid, (const HearingDevice* dev_info), (override));
};
/**
diff --git a/system/btcore/Android.bp b/system/btcore/Android.bp
index 6a0350afcb..b02ead0f8d 100644
--- a/system/btcore/Android.bp
+++ b/system/btcore/Android.bp
@@ -20,10 +20,8 @@ cc_library_static {
"packages/modules/Bluetooth/system/gd",
],
srcs: [
- "src/device_class.cc",
"src/module.cc",
"src/osi_module.cc",
- "src/property.cc",
],
header_libs: ["libbluetooth_headers"],
static_libs: [
@@ -50,41 +48,3 @@ cc_library_headers {
],
min_sdk_version: "30",
}
-
-// Note: It's good to get the tests compiled both for the host and the target so
-// we get to test with both Bionic libc and glibc
-// libbtcore unit tests for target and host
-cc_test {
- name: "net_test_btcore",
- test_suites: ["general-tests"],
- defaults: [
- "fluoride_defaults",
- "mts_defaults",
- ],
- local_include_dirs: ["include"],
- include_dirs: ["packages/modules/Bluetooth/system"],
- srcs: [
- "test/device_class_test.cc",
- "test/property_test.cc",
- ],
- shared_libs: [
- "libbase",
- "liblog",
- ],
- static_libs: [
- "libbluetooth-types",
- "libbluetooth_log",
- "libbtcore",
- "libchrome",
- "libcom.android.sysprop.bluetooth.wrapped",
- "libosi",
- ],
- host_supported: true,
- test_options: {
- unit_test: true,
- },
- sanitize: {
- address: true,
- },
- header_libs: ["libbluetooth_headers"],
-}
diff --git a/system/btcore/BUILD.gn b/system/btcore/BUILD.gn
index 76853554cf..abfbd328ee 100644
--- a/system/btcore/BUILD.gn
+++ b/system/btcore/BUILD.gn
@@ -16,11 +16,9 @@
static_library("btcore") {
sources = [
- "src/device_class.cc",
"src/hal_util.cc",
"src/module.cc",
"src/osi_module.cc",
- "src/property.cc",
]
include_dirs = [
@@ -33,35 +31,3 @@ static_library("btcore") {
"//bt/system/log:log_defaults",
]
}
-
-if (use.test) {
- executable("net_test_btcore") {
- sources = [
- "test/device_class_test.cc",
- "test/property_test.cc",
- ]
-
- include_dirs = [
- "include",
- "//bt/system",
- ]
-
- deps = [
- "//bt/system/btcore",
- "//bt/system/osi",
- "//bt/system/types",
- ]
-
- configs += [
- "//bt/system:external_gtest_main",
- "//bt/system:target_defaults",
- "//bt/system/log:log_defaults",
- ]
-
- libs = [
- "pthread",
- "rt",
- "dl",
- ]
- }
-}
diff --git a/system/btcore/fuzzer/Android.bp b/system/btcore/fuzzer/Android.bp
deleted file mode 100644
index 07b8c28f89..0000000000
--- a/system/btcore/fuzzer/Android.bp
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package {
- // See: http://go/android-license-faq
- // A large-scale-change added 'default_applicable_licenses' to import
- // all of the 'license_kinds' from "system_bt_license"
- // to get the below license kinds:
- // SPDX-license-identifier-Apache-2.0
- default_applicable_licenses: ["system_bt_license"],
-}
-
-cc_defaults {
- name: "btcore_fuzz_defaults",
- shared_libs: [
- "libcrypto",
- "libstatslog_bt",
- ],
- static_libs: [
- "libbase",
- "libbluetooth-types",
- "libbluetooth_crypto_toolbox",
- "libbluetooth_log",
- "libbt-common",
- "libbtcore",
- "libchrome",
- "libcom.android.sysprop.bluetooth.wrapped",
- "libevent",
- "liblog",
- "libmodpb64",
- "libosi",
- "libprotobuf-cpp-lite",
- ],
- include_dirs: [
- "packages/modules/Bluetooth/system",
- ],
- header_libs: [
- "libbluetooth_headers",
- ],
- fuzz_config: {
- cc: ["android-bluetooth-security@google.com"],
- componentid: 27441,
- hotlists: [
- "4593311",
- ],
- description: "The fuzzer targets the APIs of libbtcore",
- vector: "local_no_privileges_required",
- service_privilege: "privileged",
- users: "multi_user",
- fuzzed_code_usage: "shipped",
- },
-}
-
-cc_fuzz {
- name: "btcore_device_class_fuzzer",
- defaults: [
- "btcore_fuzz_defaults",
- ],
- srcs: [
- "btcore_device_class_fuzzer.cpp",
- ],
-}
-
-cc_fuzz {
- name: "btcore_property_fuzzer",
- defaults: [
- "btcore_fuzz_defaults",
- ],
- srcs: [
- "btcore_property_fuzzer.cpp",
- ],
-
-}
-
-cc_fuzz {
- name: "btcore_module_fuzzer",
- enabled: false,
- defaults: [
- "btcore_fuzz_defaults",
- ],
- srcs: [
- "btcore_module_fuzzer.cpp",
- ],
-}
diff --git a/system/btcore/fuzzer/README.md b/system/btcore/fuzzer/README.md
deleted file mode 100644
index cf770e4385..0000000000
--- a/system/btcore/fuzzer/README.md
+++ /dev/null
@@ -1,56 +0,0 @@
-# Fuzzers for libbtcore
-
-## Plugin Design Considerations
-The fuzzer plugins for `libbtcore` are designed based on the understanding of the
-source code and tries to achieve the following:
-
-##### Maximize code coverage
-The configuration parameters are not hard-coded, but instead selected based on
-incoming data. This ensures more code paths are reached by the fuzzers.
-
-Fuzzers assigns values to the following parameters to pass on to libbtcore:
-1. Bluetooth Device Type (parameter name: `deviceType`)
-2. Bluetooth Adapter Visibility Mode (parameter name: `mode`)
-3. Bluetooth Address (parameter name: `btAddress`)
-4. Bluetooth Device Class parameter (parameter name: `deviceClassT`)
-
-| Parameter| Valid Values| Configured Value|
-|------------- |-------------| ----- |
-| `deviceType` | 0.`BT_DEVICE_DEVTYPE_BREDR` 1.`BT_DEVICE_DEVTYPE_BLE` 2.`BT_DEVICE_DEVTYPE_DUAL` | Value obtained from FuzzedDataProvider |
-| `mode` | 0.`BT_SCAN_MODE_NONE` 1.`BT_SCAN_MODE_CONNECTABLE` 2.`BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE` | Value obtained from FuzzedDataProvider |
-| `btAddress` | Values inside array ranges from `0x0` to `0xFF` | Value obtained from FuzzedDataProvider |
-| `deviceClassT` | Values inside array ranges from `0x0` to `0xFF` | Value obtained from FuzzedDataProvider |
-This also ensures that the plugins are always deterministic for any given input.
-
-##### Maximize utilization of input data
-The plugins feed the entire input data to the module.
-This ensures that the plugins tolerates any kind of input (empty, huge,
-malformed, etc) and doesn't `exit()` on any input and thereby increasing the
-chance of identifying vulnerabilities.
-
-## Build
-
-This describes steps to build btcore_device_class_fuzzer, btcore_property_fuzzer and btcore_module_fuzzer binaries.
-
-### Android
-
-#### Steps to build
-Build the fuzzer
-```
- $ mm -j$(nproc) btcore_device_class_fuzzer
- $ mm -j$(nproc) btcore_property_fuzzer
- $ mm -j$(nproc) btcore_module_fuzzer
-```
-### Steps to run
-
-To run on device
-```
- $ adb sync data
- $ adb shell /data/fuzz/arm64/btcore_device_class_fuzzer/btcore_device_class_fuzzer
- $ adb shell /data/fuzz/arm64/btcore_property_fuzzer/btcore_property_fuzzer
- $ adb shell /data/fuzz/arm64/btcore_module_fuzzer/btcore_module_fuzzer
-```
-
-## References:
- * http://llvm.org/docs/LibFuzzer.html
- * https://github.com/google/oss-fuzz
diff --git a/system/btcore/fuzzer/btcore_device_class_fuzzer.cpp b/system/btcore/fuzzer/btcore_device_class_fuzzer.cpp
deleted file mode 100644
index fef1e33370..0000000000
--- a/system/btcore/fuzzer/btcore_device_class_fuzzer.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <fuzzer/FuzzedDataProvider.h>
-
-#include "btcore/include/device_class.h"
-
-class BTCoreDeviceClassFuzzer {
-public:
- void process(const uint8_t* data, size_t size);
-
-private:
- std::unique_ptr<FuzzedDataProvider> mFdp = nullptr;
-};
-
-void BTCoreDeviceClassFuzzer::process(const uint8_t* data, size_t size) {
- mFdp = std::make_unique<FuzzedDataProvider>(data, size);
- size_t dcStreamSize = sizeof(bt_device_class_t) * sizeof(uint8_t);
-
- std::vector<uint8_t> dcStreamSrc(dcStreamSize, 0x0);
- mFdp->ConsumeData(dcStreamSrc.data(), dcStreamSize);
-
- bt_device_class_t deviceClass;
- device_class_from_stream(&deviceClass, dcStreamSrc.data());
-
- std::vector<uint8_t> dcStreamDst(dcStreamSize, 0x0);
- (void)device_class_to_stream(&deviceClass, dcStreamDst.data(), dcStreamSize);
-
- device_class_set_limited(&deviceClass, mFdp->ConsumeBool());
- (void)device_class_get_limited(&deviceClass);
-
- int val = mFdp->ConsumeIntegral<int>();
- device_class_set_major_device(&deviceClass, val);
- (void)device_class_get_major_device(&deviceClass);
-
- val = mFdp->ConsumeIntegral<int>();
- device_class_set_minor_device(&deviceClass, val);
- (void)device_class_get_minor_device(&deviceClass);
-
- device_class_set_information(&deviceClass, mFdp->ConsumeBool());
- (void)device_class_get_information(&deviceClass);
-
- bt_device_class_t deviceClassCopy;
- (void)device_class_copy(&deviceClassCopy, &deviceClass);
- (void)device_class_equals(&deviceClass, &deviceClassCopy);
-
- val = mFdp->ConsumeIntegralInRange(1, INT_MAX);
- device_class_from_int(&deviceClass, val);
- (void)device_class_to_int(&deviceClass);
-}
-
-extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
- BTCoreDeviceClassFuzzer btCoreDeviceClassFuzzer;
- btCoreDeviceClassFuzzer.process(data, size);
- return 0;
-}
diff --git a/system/btcore/fuzzer/btcore_module_fuzzer.cpp b/system/btcore/fuzzer/btcore_module_fuzzer.cpp
deleted file mode 100644
index adb21b724d..0000000000
--- a/system/btcore/fuzzer/btcore_module_fuzzer.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "btcore/include/hal_util.h"
-#include "btcore/include/module.h"
-
-extern const module_t osi_module;
-
-extern "C" {
-struct android_namespace_t* android_get_exported_namespace(const char*) { return nullptr; }
-}
-
-class BTCoreModuleFuzzer {
-public:
- void process();
-};
-
-void BTCoreModuleFuzzer::process() {
- const bt_interface_t* interface;
- (void)hal_util_load_bt_library(&interface);
- module_management_start();
- module_init(&osi_module);
- (void)module_start_up(&osi_module);
- (void)get_module(osi_module.name);
- module_shut_down(&osi_module);
- module_clean_up(&osi_module);
- module_management_stop();
-}
-
-extern "C" int LLVMFuzzerTestOneInput(const uint8_t*, size_t) {
- BTCoreModuleFuzzer btCoreModuleFuzzer;
- btCoreModuleFuzzer.process();
- return 0;
-}
diff --git a/system/btcore/fuzzer/btcore_property_fuzzer.cpp b/system/btcore/fuzzer/btcore_property_fuzzer.cpp
deleted file mode 100644
index eabcf505c3..0000000000
--- a/system/btcore/fuzzer/btcore_property_fuzzer.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <fuzzer/FuzzedDataProvider.h>
-
-#include "btcore/include/property.h"
-#include "types/bluetooth/uuid.h"
-#include "types/raw_address.h"
-
-using bluetooth::Uuid;
-
-constexpr int32_t kRandomStringLength = 256;
-
-class BTCorePropertyFuzzer {
-public:
- void process(const uint8_t* data, size_t size);
-
-private:
- std::unique_ptr<FuzzedDataProvider> mFdp = nullptr;
-};
-
-void BTCorePropertyFuzzer::process(const uint8_t* data, size_t size) {
- mFdp = std::make_unique<FuzzedDataProvider>(data, size);
- uint8_t addr[RawAddress::kLength];
- mFdp->ConsumeData(addr, sizeof(uint8_t) * RawAddress::kLength);
- RawAddress btAddress = {addr};
- bt_property_t* property = property_new_addr(&btAddress);
- property_as_addr(property);
- property_free(property);
-
- bt_device_class_t deviceClass = {{mFdp->ConsumeIntegral<uint8_t>(),
- mFdp->ConsumeIntegral<uint8_t>(),
- mFdp->ConsumeIntegral<uint8_t>()}};
- property = property_new_device_class(&deviceClass);
-
- const bt_device_class_t* pDeviceClass = property_as_device_class(property);
- (void)device_class_to_int(pDeviceClass);
- property_free(property);
-
- bt_device_type_t deviceType = (bt_device_type_t)(mFdp->ConsumeIntegral<uint32_t>());
- property = property_new_device_type(deviceType);
- (void)property_as_device_type(property);
- property_free(property);
-
- uint32_t timeout = mFdp->ConsumeIntegral<uint32_t>();
- property = property_new_discoverable_timeout(timeout);
- (void)property_as_discoverable_timeout(property);
- property_free(property);
-
- std::string name = mFdp->ConsumeRandomLengthString(kRandomStringLength);
- property = property_new_name(name.c_str());
- (void)property_as_name(property);
- property_free(property);
-
- int8_t rssi = mFdp->ConsumeIntegral<int8_t>();
- property = property_new_rssi(rssi);
- (void)property_as_rssi(property);
- property_free(property);
-
- size_t uuidSize = sizeof(uint8_t) * bluetooth::Uuid::kNumBytes128;
- uint8_t uuid[bluetooth::Uuid::kNumBytes128];
- mFdp->ConsumeData(uuid, uuidSize);
- Uuid uuidBE = Uuid::From128BitBE(uuid);
- property = property_new_uuids(&uuidBE, 1);
- size_t uuidCount;
- (void)property_as_uuids(property, &uuidCount);
- property_free(property);
-
- mFdp->ConsumeData(uuid, uuidSize);
- Uuid uuidLE = Uuid::From128BitLE(uuid);
- Uuid uuids[] = {uuidBE, uuidLE};
- bt_property_t* propertySrc = property_new_uuids(uuids, std::size(uuids));
- bt_property_t propertyDest;
- (void)property_copy(&propertyDest, propertySrc);
- property_free(propertySrc);
-}
-
-extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
- BTCorePropertyFuzzer btCorePropertyFuzzer;
- btCorePropertyFuzzer.process(data, size);
- return 0;
-}
diff --git a/system/btcore/include/device_class.h b/system/btcore/include/device_class.h
deleted file mode 100644
index 6f56b119b0..0000000000
--- a/system/btcore/include/device_class.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/******************************************************************************
- *
- * Copyright 2014 Google, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************/
-
-#pragma once
-
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-
-// Provides Class Of Device primitive as specified in the bluetooth spec.
-// [Class Of Device]
-// (https://www.bluetooth.org/en-us/specification/assigned-numbers/baseband)
-
-// Device class may be defined in other structures.
-// Only use defined methods to manipulate internals.
-typedef struct bt_device_class_t {
- uint8_t _[3]; // Do not access directly; use methods below.
-} bt_device_class_t;
-
-// Copies the |data| class of device stream into device class |dc|. |dc|
-// and |data| must not be NULL.
-void device_class_from_stream(bt_device_class_t* dc, const uint8_t* data);
-
-// Serializes the device class |dc| to pointer argument |data| in big endian
-// format. |len| must contain the buffer size of |data|. Returns the actual
-// number of bytes copied into |data|. |dc| and |data| must not be NULL.
-int device_class_to_stream(const bt_device_class_t* dc, uint8_t* data, size_t len);
-
-// Copies the |data| class of device integer into device class |dc|. |dc|
-// must not be NULL.
-void device_class_from_int(bt_device_class_t* dc, int data);
-
-// Returns the device class |dc| in integer format. |dc| must not be NULL.
-int device_class_to_int(const bt_device_class_t* dc);
-
-// Compares and returns |true| if two device classes |p1| and |p2| are equal.
-// False otherwise.
-bool device_class_equals(const bt_device_class_t* p1, const bt_device_class_t* p2);
-
-// Copies and returns |true| if the device class was successfully copied from
-// |p2| into |p1|. False otherwise.
-bool device_class_copy(bt_device_class_t* dest, const bt_device_class_t* src);
-
-// Query, getters and setters for the major device class. |dc| must not be
-// NULL.
-int device_class_get_major_device(const bt_device_class_t* dc);
-void device_class_set_major_device(bt_device_class_t* dc, int val);
-
-// Query, getters and setters for the minor device class. |dc| must not be NULL.
-int device_class_get_minor_device(const bt_device_class_t* dc);
-void device_class_set_minor_device(bt_device_class_t* dc, int val);
-
-// Query, getters and setters for the various major service class features.
-// |dc| must not be NULL.
-bool device_class_get_limited(const bt_device_class_t* dc);
-void device_class_set_limited(bt_device_class_t* dc, bool set);
-
-bool device_class_get_positioning(const bt_device_class_t* dc);
-void device_class_set_positioning(bt_device_class_t* dc, bool set);
-
-bool device_class_get_networking(const bt_device_class_t* dc);
-void device_class_set_networking(bt_device_class_t* dc, bool set);
-
-bool device_class_get_rendering(const bt_device_class_t* dc);
-void device_class_set_rendering(bt_device_class_t* dc, bool set);
-
-bool device_class_get_capturing(const bt_device_class_t* dc);
-void device_class_set_capturing(bt_device_class_t* dc, bool set);
-
-bool device_class_get_object_transfer(const bt_device_class_t* dc);
-void device_class_set_object_transfer(bt_device_class_t* dc, bool set);
-
-bool device_class_get_audio(const bt_device_class_t* dc);
-void device_class_set_audio(bt_device_class_t* dc, bool set);
-
-bool device_class_get_telephony(const bt_device_class_t* dc);
-void device_class_set_telephony(bt_device_class_t* dc, bool set);
-
-bool device_class_get_information(const bt_device_class_t* dc);
-void device_class_set_information(bt_device_class_t* dc, bool set);
diff --git a/system/btcore/include/device_features.h b/system/btcore/include/device_features.h
deleted file mode 100644
index 13f8653635..0000000000
--- a/system/btcore/include/device_features.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/******************************************************************************
- *
- * Copyright 2014 Google, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************/
-
-#pragma once
-
-#include <stdint.h>
-
-// Represents a page of device feature enabled/disabled bits returned
-// by the local controller. See the bluetooth spec for bit indexes.
-typedef struct {
- uint8_t as_array[8];
-} bt_device_features_t;
diff --git a/system/btcore/include/event_mask.h b/system/btcore/include/event_mask.h
deleted file mode 100644
index f811c78c8e..0000000000
--- a/system/btcore/include/event_mask.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/******************************************************************************
- *
- * Copyright 2014 Google, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************/
-
-#pragma once
-
-#include <stdint.h>
-
-// Represents a mask which can be used to tell the controller which
-// HCI events the stack wishes to be informed about. See the bluetooth
-// spec for more information on what each bit means.
-typedef struct {
- const uint8_t as_array[8];
-} bt_event_mask_t;
diff --git a/system/btcore/include/iac.h b/system/btcore/include/iac.h
deleted file mode 100644
index 39c830e54b..0000000000
--- a/system/btcore/include/iac.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/******************************************************************************
- *
- * Copyright 2014 Google, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************/
-
-#pragma once
-
-#include <stdint.h>
-
-// Inquiry Access Code
-// [Bluetooth Baseband]
-// (https://www.bluetooth.org/en-us/specification/assigned-numbers/baseband)
-typedef struct {
- uint8_t iac[3];
-} __attribute__((packed)) bt_inquiry_access_code_t;
diff --git a/system/btcore/include/property.h b/system/btcore/include/property.h
deleted file mode 100644
index f8e06150ad..0000000000
--- a/system/btcore/include/property.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/******************************************************************************
- *
- * Copyright 2014 Google, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************/
-
-#pragma once
-
-#include <hardware/bluetooth.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#include "btcore/include/device_class.h"
-#include "types/bluetooth/uuid.h"
-#include "types/raw_address.h"
-
-// Copies an array of consecutive properties of |count| to a newly
-// allocated array. |properties| must not be NULL.
-bt_property_t* property_copy_array(const bt_property_t* properties, size_t count);
-
-// Copies |src| to |dest|. Returns the value of |dest|.
-// |src| and |dest| must not be NULL.
-bt_property_t* property_copy(bt_property_t* dest, const bt_property_t* src);
-
-// Returns true if the value of the two properties |p1| and |p2| are equal.
-// |p1| and |p2| must not be NULL.
-bool property_equals(const bt_property_t* p1, const bt_property_t* p2);
-
-// Property resource allocations. Caller is expected to free |property|
-// using |property_free| or |property_free_array|.
-// Parameter must not be NULL. A copy of the parameter is made and
-// stored in the property.
-bt_property_t* property_new_addr(const RawAddress* addr);
-bt_property_t* property_new_device_class(const bt_device_class_t* dc);
-bt_property_t* property_new_device_type(bt_device_type_t device_type);
-bt_property_t* property_new_discoverable_timeout(const uint32_t timeout);
-bt_property_t* property_new_name(const char* name);
-bt_property_t* property_new_rssi(const int8_t rssi);
-bt_property_t* property_new_uuids(const bluetooth::Uuid* uuid, size_t count);
-
-// Property resource frees both property and value.
-void property_free(bt_property_t* property);
-void property_free_array(bt_property_t* properties, size_t count);
-
-// Value check convenience methods. The contents of the property are
-// checked for the respective validity and returns true, false otherwise.
-// |property| must not be NULL.
-bool property_is_addr(const bt_property_t* property);
-bool property_is_device_class(const bt_property_t* property);
-bool property_is_device_type(const bt_property_t* property);
-bool property_is_discoverable_timeout(const bt_property_t* property);
-bool property_is_name(const bt_property_t* property);
-bool property_is_rssi(const bt_property_t* property);
-bool property_is_uuids(const bt_property_t* property);
-
-// Value conversion convenience methods. The contents of the property are
-// properly typed and returned to the caller. |property| must not be NULL.
-const RawAddress* property_as_addr(const bt_property_t* property);
-const bt_device_class_t* property_as_device_class(const bt_property_t* property);
-bt_device_type_t property_as_device_type(const bt_property_t* property);
-uint32_t property_as_discoverable_timeout(const bt_property_t* property);
-const bt_bdname_t* property_as_name(const bt_property_t* property);
-int8_t property_as_rssi(const bt_property_t* property);
-const bluetooth::Uuid* property_as_uuids(const bt_property_t* property, size_t* count);
diff --git a/system/btcore/include/version.h b/system/btcore/include/version.h
deleted file mode 100644
index d7787c7409..0000000000
--- a/system/btcore/include/version.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/******************************************************************************
- *
- * Copyright 2014 Google, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************/
-
-#pragma once
-
-#include <stdint.h>
-
-typedef struct {
- uint8_t hci_version;
- uint16_t hci_revision;
- uint8_t lmp_version;
- uint16_t manufacturer;
- uint16_t lmp_subversion;
-} bt_version_t;
diff --git a/system/btcore/src/device_class.cc b/system/btcore/src/device_class.cc
deleted file mode 100644
index 08d2ae191a..0000000000
--- a/system/btcore/src/device_class.cc
+++ /dev/null
@@ -1,167 +0,0 @@
-/******************************************************************************
- *
- * Copyright 2014 Google, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************/
-
-#include "btcore/include/device_class.h"
-
-#include <arpa/inet.h>
-#include <bluetooth/log.h>
-#include <endian.h>
-#include <string.h>
-
-using namespace bluetooth;
-
-typedef struct _bt_device_class_t {
- uint32_t unused : 2; // LSBs
- uint32_t minor_device : 6;
- uint32_t major_device : 5;
- uint32_t major_service : 11; // MSBs
-} __attribute__((__packed__)) _bt_device_class_t;
-
-// Convenience to interpret raw device class bytes.
-#define DC(x) ((_bt_device_class_t*)(x))
-
-// Ensure the internal device class implementation and public one
-// have equal size.
-static_assert(sizeof(_bt_device_class_t) == sizeof(bt_device_class_t),
- "Internal and external device class implementation should have the same size");
-
-// [Major Service Classes]
-// (https://www.bluetooth.org/en-us/specification/assigned-numbers/baseband)
-enum {
- DC_LIMITED_DISCOVERABLE_MODE = 0x0001,
- DC_RESERVED14 = 0x0002,
- DC_RESERVED15 = 0x0004,
- DC_POSITIONING = 0x0008,
- DC_NETWORKING = 0x0010,
- DC_RENDERING = 0x0020,
- DC_CAPTURING = 0x0040,
- DC_OBJECT_TRANSFER = 0x0080,
- DC_AUDIO = 0x0100,
- DC_TELEPHONY = 0x0200,
- DC_INFORMATION = 0x0400,
-};
-
-static bool device_class_get_major_service_(const bt_device_class_t* dc, int bitmask);
-static void device_class_clr_major_service_(bt_device_class_t* dc, int bitmask);
-static void device_class_set_major_service_(bt_device_class_t* dc, int bitmask);
-
-void device_class_from_stream(bt_device_class_t* dc, const uint8_t* data) {
- log::assert_that(dc != NULL, "assert failed: dc != NULL");
- log::assert_that(data != NULL, "assert failed: data != NULL");
- *dc = *(bt_device_class_t*)data;
-}
-
-int device_class_to_stream(const bt_device_class_t* dc, uint8_t* data, size_t len) {
- log::assert_that(dc != NULL, "assert failed: dc != NULL");
- log::assert_that(data != NULL, "assert failed: data != NULL");
- log::assert_that(len >= sizeof(bt_device_class_t),
- "assert failed: len >= sizeof(bt_device_class_t)");
- for (size_t i = 0; i < sizeof(bt_device_class_t); ++i) {
- data[i] = dc->_[i];
- }
- return sizeof(bt_device_class_t);
-}
-
-void device_class_from_int(bt_device_class_t* dc, int data) {
- log::assert_that(dc != NULL, "assert failed: dc != NULL");
- log::assert_that(data != 0, "assert failed: data != 0");
- // Careful with endianess.
- dc->_[0] = data & 0xff;
- dc->_[1] = (data >> 8) & 0xff;
- dc->_[2] = (data >> 16) & 0xff;
-}
-
-int device_class_to_int(const bt_device_class_t* dc) {
- log::assert_that(dc != NULL, "assert failed: dc != NULL");
- // Careful with endianess.
- int val = 0;
- memcpy(&val, dc, sizeof(*dc));
- return static_cast<int>(le32toh(val) & 0xffffff);
-}
-
-bool device_class_equals(const bt_device_class_t* p1, const bt_device_class_t* p2) {
- log::assert_that(p1 != NULL, "assert failed: p1 != NULL");
- log::assert_that(p2 != NULL, "assert failed: p2 != NULL");
- return memcmp(p1, p2, sizeof(bt_device_class_t)) == 0;
-}
-
-bool device_class_copy(bt_device_class_t* dest, const bt_device_class_t* src) {
- log::assert_that(dest != NULL, "assert failed: dest != NULL");
- log::assert_that(src != NULL, "assert failed: src != NULL");
- return memcpy(dest, src, sizeof(bt_device_class_t)) == dest;
-}
-
-int device_class_get_major_device(const bt_device_class_t* dc) {
- log::assert_that(dc != NULL, "assert failed: dc != NULL");
- return DC(dc)->major_device;
-}
-
-void device_class_set_major_device(bt_device_class_t* dc, int val) {
- log::assert_that(dc != NULL, "assert failed: dc != NULL");
- DC(dc)->major_device = val;
-}
-
-int device_class_get_minor_device(const bt_device_class_t* dc) {
- log::assert_that(dc != NULL, "assert failed: dc != NULL");
- return DC(dc)->minor_device;
-}
-
-void device_class_set_minor_device(bt_device_class_t* dc, int val) {
- log::assert_that(dc != NULL, "assert failed: dc != NULL");
- DC(dc)->minor_device = val;
-}
-
-bool device_class_get_information(const bt_device_class_t* dc) {
- log::assert_that(dc != NULL, "assert failed: dc != NULL");
- return device_class_get_major_service_(dc, DC_INFORMATION);
-}
-
-void device_class_set_information(bt_device_class_t* dc, bool set) {
- log::assert_that(dc != NULL, "assert failed: dc != NULL");
- if (set) {
- device_class_set_major_service_(dc, DC_INFORMATION);
- } else {
- device_class_clr_major_service_(dc, DC_INFORMATION);
- }
-}
-
-bool device_class_get_limited(const bt_device_class_t* dc) {
- log::assert_that(dc != NULL, "assert failed: dc != NULL");
- return device_class_get_major_service_(dc, DC_LIMITED_DISCOVERABLE_MODE);
-}
-
-void device_class_set_limited(bt_device_class_t* dc, bool set) {
- log::assert_that(dc != NULL, "assert failed: dc != NULL");
- if (set) {
- device_class_set_major_service_(dc, DC_LIMITED_DISCOVERABLE_MODE);
- } else {
- device_class_clr_major_service_(dc, DC_LIMITED_DISCOVERABLE_MODE);
- }
-}
-
-static bool device_class_get_major_service_(const bt_device_class_t* dc, int bitmask) {
- return DC(dc)->major_service & bitmask;
-}
-
-static void device_class_clr_major_service_(bt_device_class_t* dc, int bitmask) {
- DC(dc)->major_service &= ~bitmask;
-}
-
-static void device_class_set_major_service_(bt_device_class_t* dc, int bitmask) {
- DC(dc)->major_service |= bitmask;
-}
diff --git a/system/btcore/src/property.cc b/system/btcore/src/property.cc
deleted file mode 100644
index 0379229432..0000000000
--- a/system/btcore/src/property.cc
+++ /dev/null
@@ -1,217 +0,0 @@
-/******************************************************************************
- *
- * Copyright 2014 Google, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************/
-
-#include "btcore/include/property.h"
-
-#include <bluetooth/log.h>
-#include <string.h>
-
-#include "btcore/include/device_class.h"
-#include "osi/include/allocator.h"
-#include "osi/include/compat.h"
-#include "types/bluetooth/uuid.h"
-#include "types/raw_address.h"
-
-using bluetooth::Uuid;
-using namespace bluetooth;
-
-static bt_property_t* property_new_(void* val, size_t len, bt_property_type_t type);
-
-bt_property_t* property_copy_array(const bt_property_t* properties, size_t count) {
- log::assert_that(properties != NULL, "assert failed: properties != NULL");
- bt_property_t* clone = static_cast<bt_property_t*>(osi_calloc(sizeof(bt_property_t) * count));
-
- memcpy(&clone[0], &properties[0], sizeof(bt_property_t) * count);
- for (size_t i = 0; i < count; ++i) {
- clone[i].val = osi_calloc(clone[i].len);
- memcpy(clone[i].val, properties[i].val, clone[i].len);
- }
-
- return clone;
-}
-
-bt_property_t* property_copy(bt_property_t* dest, const bt_property_t* src) {
- log::assert_that(dest != NULL, "assert failed: dest != NULL");
- log::assert_that(src != NULL, "assert failed: src != NULL");
- return (bt_property_t*)memcpy(dest, src, sizeof(bt_property_t));
-}
-
-bool property_equals(const bt_property_t* p1, const bt_property_t* p2) {
- // Two null properties are not the same. May need to revisit that
- // decision when we have a test case that exercises that condition.
- if (!p1 || !p2 || p1->type != p2->type) {
- return false;
- }
-
- // Although the Bluetooth name is a 249-byte array, the implementation
- // treats it like a variable-length array with its size specified in the
- // property's `len` field. We special-case the equivalence of BDNAME
- // types here by truncating the larger, zero-padded name to its string
- // length and comparing against the shorter name.
- //
- // Note: it may be the case that both strings are zero-padded but that
- // hasn't come up yet so this implementation doesn't handle it.
- if (p1->type == BT_PROPERTY_BDNAME && p1->len != p2->len) {
- const bt_property_t *shorter = p1, *longer = p2;
- if (p1->len > p2->len) {
- shorter = p2;
- longer = p1;
- }
- return strlen((const char*)longer->val) == (size_t)shorter->len &&
- !memcmp(longer->val, shorter->val, shorter->len);
- }
-
- return p1->len == p2->len && !memcmp(p1->val, p2->val, p1->len);
-}
-
-bt_property_t* property_new_addr(const RawAddress* addr) {
- log::assert_that(addr != NULL, "assert failed: addr != NULL");
- return property_new_((void*)addr, sizeof(RawAddress), BT_PROPERTY_BDADDR);
-}
-
-bt_property_t* property_new_device_class(const bt_device_class_t* dc) {
- log::assert_that(dc != NULL, "assert failed: dc != NULL");
- return property_new_((void*)dc, sizeof(bt_device_class_t), BT_PROPERTY_CLASS_OF_DEVICE);
-}
-
-bt_property_t* property_new_device_type(bt_device_type_t type) {
- return property_new_((void*)&type, sizeof(bt_device_type_t), BT_PROPERTY_TYPE_OF_DEVICE);
-}
-
-bt_property_t* property_new_discoverable_timeout(const uint32_t timeout) {
- return property_new_((void*)&timeout, sizeof(uint32_t), BT_PROPERTY_ADAPTER_DISCOVERABLE_TIMEOUT);
-}
-
-bt_property_t* property_new_name(const char* name) {
- log::assert_that(name != NULL, "assert failed: name != NULL");
- return property_new_((void*)name, sizeof(bt_bdname_t), BT_PROPERTY_BDNAME);
-}
-
-bt_property_t* property_new_rssi(int8_t rssi) {
- return property_new_((void*)&rssi, sizeof(int8_t), BT_PROPERTY_REMOTE_RSSI);
-}
-
-bt_property_t* property_new_uuids(const Uuid* uuid, size_t count) {
- log::assert_that(uuid != NULL, "assert failed: uuid != NULL");
- return property_new_((void*)uuid, sizeof(Uuid) * count, BT_PROPERTY_UUIDS);
-}
-
-void property_free(bt_property_t* property) { property_free_array(property, 1); }
-
-void property_free_array(bt_property_t* properties, size_t count) {
- if (properties == NULL) {
- return;
- }
-
- for (size_t i = 0; i < count; ++i) {
- osi_free(properties[i].val);
- }
-
- osi_free(properties);
-}
-
-bool property_is_addr(const bt_property_t* property) {
- log::assert_that(property != NULL, "assert failed: property != NULL");
- return property->type == BT_PROPERTY_BDADDR;
-}
-
-bool property_is_device_class(const bt_property_t* property) {
- log::assert_that(property != NULL, "assert failed: property != NULL");
- return property->type == BT_PROPERTY_CLASS_OF_DEVICE;
-}
-
-bool property_is_device_type(const bt_property_t* property) {
- log::assert_that(property != NULL, "assert failed: property != NULL");
- return property->type == BT_PROPERTY_TYPE_OF_DEVICE;
-}
-
-bool property_is_discoverable_timeout(const bt_property_t* property) {
- log::assert_that(property != NULL, "assert failed: property != NULL");
- return property->type == BT_PROPERTY_ADAPTER_DISCOVERABLE_TIMEOUT;
-}
-
-bool property_is_name(const bt_property_t* property) {
- log::assert_that(property != NULL, "assert failed: property != NULL");
- return property->type == BT_PROPERTY_BDNAME;
-}
-
-bool property_is_rssi(const bt_property_t* property) {
- log::assert_that(property != NULL, "assert failed: property != NULL");
- return property->type == BT_PROPERTY_REMOTE_RSSI;
-}
-
-bool property_is_uuids(const bt_property_t* property) {
- log::assert_that(property != NULL, "assert failed: property != NULL");
- return property->type == BT_PROPERTY_UUIDS;
-}
-
-// Convenience conversion methods to property values
-const RawAddress* property_as_addr(const bt_property_t* property) {
- log::assert_that(property_is_addr(property), "assert failed: property_is_addr(property)");
- return (const RawAddress*)property->val;
-}
-
-const bt_device_class_t* property_as_device_class(const bt_property_t* property) {
- log::assert_that(property_is_device_class(property),
- "assert failed: property_is_device_class(property)");
- return (const bt_device_class_t*)property->val;
-}
-
-bt_device_type_t property_as_device_type(const bt_property_t* property) {
- log::assert_that(property_is_device_type(property),
- "assert failed: property_is_device_type(property)");
- return *(const bt_device_type_t*)property->val;
-}
-
-uint32_t property_as_discoverable_timeout(const bt_property_t* property) {
- log::assert_that(property_is_discoverable_timeout(property),
- "assert failed: property_is_discoverable_timeout(property)");
- return *(const uint32_t*)property->val;
-}
-
-const bt_bdname_t* property_as_name(const bt_property_t* property) {
- log::assert_that(property_is_name(property), "assert failed: property_is_name(property)");
- return (const bt_bdname_t*)property->val;
-}
-
-int8_t property_as_rssi(const bt_property_t* property) {
- log::assert_that(property_is_rssi(property), "assert failed: property_is_rssi(property)");
- return *(const int8_t*)property->val;
-}
-
-const Uuid* property_as_uuids(const bt_property_t* property, size_t* count) {
- log::assert_that(property_is_uuids(property), "assert failed: property_is_uuids(property)");
- *count = sizeof(Uuid) / property->len;
- return (const Uuid*)property->val;
-}
-
-static bt_property_t* property_new_(void* val, size_t len, bt_property_type_t type) {
- bt_property_t* property = static_cast<bt_property_t*>(osi_calloc(sizeof(bt_property_t)));
-
- property->val = osi_calloc(len + 1);
- if (type == BT_PROPERTY_BDNAME) {
- osi_strlcpy((char*)property->val, (const char*)val, len);
- } else {
- memcpy(property->val, val, len);
- }
-
- property->type = type;
- property->len = len;
-
- return property;
-}
diff --git a/system/btcore/test/device_class_test.cc b/system/btcore/test/device_class_test.cc
deleted file mode 100644
index ed5f9581f0..0000000000
--- a/system/btcore/test/device_class_test.cc
+++ /dev/null
@@ -1,224 +0,0 @@
-/******************************************************************************
- *
- * Copyright 2014 Google, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************/
-
-#include "btcore/include/device_class.h"
-
-#include <arpa/inet.h>
-#include <gtest/gtest.h>
-
-static ::testing::AssertionResult check_bitfield(const char* m_expr, const char* n_expr, int m,
- int n) {
- if (m == n) {
- return ::testing::AssertionSuccess();
- }
-
- std::stringstream ss;
-
- ss.str("");
- ss << std::showbase << std::hex << std::setw(8) << std::setfill('0') << m;
- std::string expected_str = ss.str();
-
- ss.str("");
- ss << std::showbase << std::hex << std::setw(8) << std::setfill('0') << n;
- std::string actual_str = ss.str();
-
- return ::testing::AssertionFailure()
- << m_expr << " and " << n_expr << " ( " << expected_str << " vs " << actual_str << " )";
-}
-
-class DeviceClassTest : public ::testing::Test {};
-
-TEST_F(DeviceClassTest, cod_sizeof) {
- uint8_t dc_stream[] = {0x00, 0x00, 0x00, 0x00};
- bt_device_class_t dc0;
- device_class_from_stream(&dc0, dc_stream);
- EXPECT_EQ((size_t)3, sizeof(dc0));
-}
-
-TEST_F(DeviceClassTest, simple) {
- uint8_t dc_stream[][sizeof(bt_device_class_t)] = {
- {0x00, 0x00, 0x00}, {0xff, 0xff, 0xff}, {0xaa, 0x55, 0xaa},
- {0x01, 0x23, 0x45}, {0x20, 0x07, 0x14},
- };
-
- for (size_t i = 0; i < sizeof(dc_stream) / sizeof(bt_device_class_t); i++) {
- bt_device_class_t dc;
- device_class_from_stream(&dc, (uint8_t*)&dc_stream[i]);
-
- uint8_t* to_stream = (uint8_t*)&dc;
- EXPECT_PRED_FORMAT2(check_bitfield, (unsigned)dc_stream[i][0], to_stream[0]);
- EXPECT_PRED_FORMAT2(check_bitfield, (unsigned)dc_stream[i][1], to_stream[1]);
- EXPECT_PRED_FORMAT2(check_bitfield, (unsigned)dc_stream[i][2], to_stream[2]);
- }
-}
-
-TEST_F(DeviceClassTest, to_stream) {
- {
- bt_device_class_t dc;
-
- uint8_t dc_stream0[] = {0x00, 0x00, 0x00, 0xaa};
- device_class_from_stream(&dc, dc_stream0);
-
- uint8_t dc_stream1[] = {0x00, 0x00, 0x00, 0x00};
- int rc = device_class_to_stream(&dc, dc_stream1, sizeof(dc_stream1));
- EXPECT_EQ(3, rc);
-
- uint32_t val = 0;
- memcpy(&val, &dc, sizeof(dc));
- EXPECT_PRED_FORMAT2(check_bitfield, 0x00000000, val);
-
- EXPECT_PRED_FORMAT2(check_bitfield, 0x00, dc_stream1[0]);
- EXPECT_PRED_FORMAT2(check_bitfield, 0x00, dc_stream1[1]);
- EXPECT_PRED_FORMAT2(check_bitfield, 0x00, dc_stream1[2]);
- }
-
- {
- uint8_t dc_stream0[] = {0xaa, 0x55, 0xaa, 0x55};
- uint8_t dc_stream1[] = {0x00, 0x00, 0x00, 0x00};
-
- bt_device_class_t dc;
- device_class_from_stream(&dc, dc_stream0);
-
- int rc = device_class_to_stream(&dc, dc_stream1, sizeof(dc_stream1));
- EXPECT_EQ(3, rc);
- uint32_t val = 0;
- memcpy(&val, &dc, sizeof(dc));
- EXPECT_PRED_FORMAT2(check_bitfield, 0x00aa55aa, val);
-
- EXPECT_PRED_FORMAT2(check_bitfield, 0xaa, dc_stream1[0]);
- EXPECT_PRED_FORMAT2(check_bitfield, 0x55, dc_stream1[1]);
- EXPECT_PRED_FORMAT2(check_bitfield, 0xaa, dc_stream1[2]);
- }
-
- {
- uint8_t dc_stream0[] = {0x01, 0x23, 0x45, 0x67};
- uint8_t dc_stream1[] = {0x00, 0x00, 0x00, 0x00};
-
- bt_device_class_t dc;
- device_class_from_stream(&dc, dc_stream0);
-
- int rc = device_class_to_stream(&dc, dc_stream1, sizeof(dc_stream1));
- EXPECT_EQ(3, rc);
- uint32_t val = 0;
- memcpy(&val, &dc, sizeof(dc));
- EXPECT_PRED_FORMAT2(check_bitfield, 0x452301, val);
-
- EXPECT_PRED_FORMAT2(check_bitfield, 0x01, dc_stream1[0]);
- EXPECT_PRED_FORMAT2(check_bitfield, 0x23, dc_stream1[1]);
- EXPECT_PRED_FORMAT2(check_bitfield, 0x45, dc_stream1[2]);
- }
-}
-
-TEST_F(DeviceClassTest, limited_discoverable_mode) {
- uint8_t dc_stream[] = {0x00, 0x00, 0x00};
- bt_device_class_t dc;
- device_class_from_stream(&dc, dc_stream);
- uint32_t test = 0;
- memcpy(&test, &dc, sizeof(dc));
-
- EXPECT_FALSE(device_class_get_limited(&dc));
- EXPECT_EQ((unsigned)0x00000000, test);
-
- device_class_set_limited(&dc, true);
- test = 0;
- memcpy(&test, &dc, sizeof(dc));
- EXPECT_TRUE(device_class_get_limited(&dc));
- EXPECT_EQ((unsigned)0x00002000, test);
-
- device_class_set_limited(&dc, false);
- test = 0;
- memcpy(&test, &dc, sizeof(dc));
- EXPECT_FALSE(device_class_get_limited(&dc));
- EXPECT_EQ((unsigned)0x00000000, test);
-
- device_class_set_limited(&dc, true);
- test = 0;
- memcpy(&test, &dc, sizeof(dc));
- EXPECT_PRED_FORMAT2(check_bitfield, 0x00002000, test);
-
- device_class_set_limited(&dc, false);
- test = 0;
- memcpy(&test, &dc, sizeof(dc));
- EXPECT_PRED_FORMAT2(check_bitfield, 0x00000000, test);
-}
-
-TEST_F(DeviceClassTest, equals) {
- uint8_t dc_stream0[] = {0x00, 0x01, 0x02};
- uint8_t dc_stream1[] = {0x00, 0x02, 0x03};
-
- bt_device_class_t dc0;
- device_class_from_stream(&dc0, dc_stream0);
- bt_device_class_t dc1;
- device_class_from_stream(&dc1, dc_stream1);
- EXPECT_FALSE(device_class_equals(&dc0, &dc1));
-}
-
-TEST_F(DeviceClassTest, copy) {
- uint8_t dc_stream0[] = {0xaa, 0x55, 0x33};
- bt_device_class_t dc0;
- device_class_from_stream(&dc0, dc_stream0);
- bt_device_class_t dc1;
- EXPECT_TRUE(device_class_copy(&dc1, &dc0));
- EXPECT_TRUE(device_class_equals(&dc0, &dc1));
-}
-
-TEST_F(DeviceClassTest, from_int) {
- bt_device_class_t dc1;
- int cod1 = 0x5a020c; // 5898764
- device_class_from_int(&dc1, cod1);
-
- uint8_t dc_stream[] = {0x0c, 0x02, 0x5a};
- bt_device_class_t dc2;
- device_class_from_stream(&dc2, dc_stream);
- EXPECT_TRUE(device_class_equals(&dc1, &dc2));
-}
-
-TEST_F(DeviceClassTest, to_int) {
- bt_device_class_t dc1 = {{0x0c, 0x02, 0x5a}};
- int cod1 = device_class_to_int(&dc1);
-
- EXPECT_EQ(dc1._[0], 0x0c);
- EXPECT_EQ(dc1._[1], 0x02);
- EXPECT_EQ(dc1._[2], 0x5a);
-
- bt_device_class_t dc2;
- uint8_t dc_stream[] = {0x0c, 0x02, 0x5a};
- device_class_from_stream(&dc2, dc_stream);
-
- EXPECT_EQ(dc2._[0], 0x0c);
- EXPECT_EQ(dc2._[1], 0x02);
- EXPECT_EQ(dc2._[2], 0x5a);
-
- int cod2 = device_class_to_int(&dc2);
- EXPECT_EQ(cod1, cod2);
- EXPECT_EQ(cod1, 0x5a020c); // 5898764
-}
-
-TEST_F(DeviceClassTest, endian) {
- bt_device_class_t dc;
- int cod1 = 0x200714; // 2098964
- device_class_from_int(&dc, cod1);
-
- EXPECT_EQ(dc._[0], 0x14);
- EXPECT_EQ(dc._[1], 0x07);
- EXPECT_EQ(dc._[2], 0x20);
-
- int cod2 = device_class_to_int(&dc);
- EXPECT_EQ(cod1, cod2);
- EXPECT_EQ(cod2, 0x200714); // 2098964
-}
diff --git a/system/btcore/test/property_test.cc b/system/btcore/test/property_test.cc
deleted file mode 100644
index 7477bca1a9..0000000000
--- a/system/btcore/test/property_test.cc
+++ /dev/null
@@ -1,269 +0,0 @@
-/******************************************************************************
- *
- * Copyright 2014 Google, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************/
-
-#include "btcore/include/property.h"
-
-#include <arpa/inet.h>
-#include <gtest/gtest.h>
-
-#include "types/bluetooth/uuid.h"
-#include "types/raw_address.h"
-
-using bluetooth::Uuid;
-
-class PropertyTest : public ::testing::Test {};
-
-TEST_F(PropertyTest, addr) {
- RawAddress addr0 = {{0x1, 0x2, 0x3, 0x4, 0x5, 0x6}};
- bt_property_t* property = property_new_addr(&addr0);
-
- EXPECT_EQ(addr0.address[0], ((uint8_t*)property->val)[0]);
- EXPECT_EQ(addr0.address[1], ((uint8_t*)property->val)[1]);
- EXPECT_EQ(addr0.address[2], ((uint8_t*)property->val)[2]);
- EXPECT_EQ(addr0.address[3], ((uint8_t*)property->val)[3]);
- EXPECT_EQ(addr0.address[4], ((uint8_t*)property->val)[4]);
- EXPECT_EQ(addr0.address[5], ((uint8_t*)property->val)[5]);
- EXPECT_EQ(BT_PROPERTY_BDADDR, property->type);
- EXPECT_EQ((int)sizeof(RawAddress), property->len);
-
- const RawAddress* addr1 = property_as_addr(property);
- EXPECT_EQ(addr0.address[0], addr1->address[0]);
-
- property_free(property);
-}
-
-TEST_F(PropertyTest, device_class) {
- bt_device_class_t dc0 = {{0x01, 0x23, 0x45}};
- bt_property_t* property = property_new_device_class(&dc0);
-
- EXPECT_EQ(dc0._[0], ((uint8_t*)property->val)[0]);
- EXPECT_EQ(dc0._[1], ((uint8_t*)property->val)[1]);
- EXPECT_EQ(dc0._[2], ((uint8_t*)property->val)[2]);
- EXPECT_EQ(BT_PROPERTY_CLASS_OF_DEVICE, property->type);
- EXPECT_EQ((int)sizeof(bt_device_class_t), property->len);
-
- const bt_device_class_t* dc1 = property_as_device_class(property);
- int dc_int = device_class_to_int(dc1);
- EXPECT_EQ(0x452301, dc_int);
-
- property_free(property);
-}
-
-TEST_F(PropertyTest, device_type) {
- bt_device_type_t dt0 = (bt_device_type_t)1;
- bt_property_t* property = property_new_device_type(dt0);
-
- EXPECT_EQ((int)dt0, *(int*)property->val);
- EXPECT_EQ(BT_PROPERTY_TYPE_OF_DEVICE, property->type);
- EXPECT_EQ((int)sizeof(bt_device_type_t), property->len);
-
- bt_device_type_t dt1 = property_as_device_type(property);
- EXPECT_EQ(1, (int)dt1);
-
- property_free(property);
-}
-
-TEST_F(PropertyTest, discovery_timeout) {
- uint32_t timeout0 = 12345;
- bt_property_t* property = property_new_discoverable_timeout(timeout0);
-
- EXPECT_EQ(timeout0, *(uint32_t*)property->val);
- EXPECT_EQ(BT_PROPERTY_ADAPTER_DISCOVERABLE_TIMEOUT, property->type);
- EXPECT_EQ((int)sizeof(uint32_t), property->len);
-
- uint32_t timeout1 = property_as_discoverable_timeout(property);
- EXPECT_EQ(timeout0, timeout1);
-
- property_free(property);
-}
-
-TEST_F(PropertyTest, name) {
- const char* name0 = "My btcore name";
- bt_property_t* property = property_new_name(name0);
-
- EXPECT_EQ(0, strcmp((char*)name0, (char*)property->val));
- EXPECT_EQ(BT_PROPERTY_BDNAME, property->type);
- EXPECT_EQ((int)sizeof(bt_bdname_t), property->len);
-
- const bt_bdname_t* name1 = property_as_name(property);
- EXPECT_EQ(0, strcmp((char*)name0, (char*)name1->name));
-
- property_free(property);
-}
-
-TEST_F(PropertyTest, rssi) {
- int8_t rssi0 = -56;
- bt_property_t* property = property_new_rssi(rssi0);
-
- EXPECT_EQ(*(int8_t*)property->val, rssi0);
- EXPECT_EQ(BT_PROPERTY_REMOTE_RSSI, property->type);
- EXPECT_EQ((int)sizeof(int8_t), property->len);
-
- int8_t rss1 = property_as_rssi(property);
- EXPECT_EQ(rssi0, rss1);
-
- property_free(property);
-}
-
-TEST_F(PropertyTest, uuids) {
- Uuid uuid0 = Uuid::From128BitBE({{
- 0x00,
- 0x11,
- 0x22,
- 0x33,
- 0x44,
- 0x55,
- 0x66,
- 0x77,
- 0x88,
- 0x99,
- 0xaa,
- 0xbb,
- 0xcc,
- 0xdd,
- 0xee,
- 0xff,
- }});
- bt_property_t* property = property_new_uuids(&uuid0, 1);
-
- EXPECT_EQ(0, memcmp(uuid0.To128BitBE().data(), property->val, sizeof(Uuid)));
- EXPECT_EQ(BT_PROPERTY_UUIDS, property->type);
- EXPECT_EQ((int)sizeof(Uuid), property->len);
-
- size_t uuid_cnt1;
- const Uuid* uuid1 = property_as_uuids(property, &uuid_cnt1);
- EXPECT_EQ(uuid0, *uuid1);
-
- property_free(property);
-}
-
-TEST_F(PropertyTest, copy) {
- {
- Uuid uuids[] = {
- Uuid::From128BitBE({{
- 0x00,
- 0x11,
- 0x22,
- 0x33,
- 0x44,
- 0x55,
- 0x66,
- 0x77,
- 0x88,
- 0x99,
- 0xaa,
- 0xbb,
- 0xcc,
- 0xdd,
- 0xee,
- 0xff,
- }}),
- Uuid::From128BitBE({{
- 0xf0,
- 0xe1,
- 0xd2,
- 0xc3,
- 0xf4,
- 0xe5,
- 0xd6,
- 0xc7,
- 0xf8,
- 0xe9,
- 0xda,
- 0xcb,
- 0xfc,
- 0xed,
- 0xde,
- 0xcf,
- }}),
- };
-
- bt_property_t* property0 = property_new_uuids(uuids, sizeof(uuids) / sizeof(Uuid));
-
- bt_property_t property1;
- property_copy(&property1, property0);
- EXPECT_TRUE(property_equals(property0, &property1));
-
- property_free(property0);
- }
-}
-
-TEST_F(PropertyTest, equals) {
- {
- RawAddress addr0 = {{0x1, 0x2, 0x3, 0x4, 0x5, 0x6}};
- bt_property_t* property0 = property_new_addr(&addr0);
-
- bt_device_class_t dc0 = {{0x01, 0x23, 0x45}};
- bt_property_t* property1 = property_new_device_class(&dc0);
-
- EXPECT_FALSE(property_equals(property0, property1));
-
- property_free(property0);
- property_free(property1);
- }
-
- {
- RawAddress addr = {{0x1, 0x2, 0x3, 0x4, 0x5, 0x6}};
- bt_property_t* property0 = property_new_addr(&addr);
- bt_property_t* property1 = property_new_addr(&addr);
-
- EXPECT_TRUE(property_equals(property0, property1));
-
- property_free(property0);
- property_free(property1);
- }
-
- {
- RawAddress addr0 = {{0x1, 0x2, 0x3, 0x4, 0x5, 0x6}};
- bt_property_t* property0 = property_new_addr(&addr0);
-
- RawAddress addr1 = {{0x1, 0x2, 0x3, 0x4, 0x5, 0xff}};
- bt_property_t* property1 = property_new_addr(&addr1);
-
- EXPECT_FALSE(property_equals(property0, property1));
-
- property_free(property0);
- property_free(property1);
- }
-
- {
- const char* name0 = "My btcore name";
- bt_property_t* property0 = property_new_name(name0);
-
- const char* name1 = "My btcore name";
- bt_property_t* property1 = property_new_name(name1);
-
- EXPECT_TRUE(property_equals(property0, property1));
-
- property_free(property0);
- property_free(property1);
- }
-
- {
- const char* name0 = "My btcore name";
- bt_property_t* property0 = property_new_name(name0);
-
- const char* name1 = "My btcore name ";
- bt_property_t* property1 = property_new_name(name1);
-
- EXPECT_FALSE(property_equals(property0, property1));
-
- property_free(property0);
- property_free(property1);
- }
-}
diff --git a/system/btif/src/OWNERS b/system/btif/src/OWNERS
deleted file mode 100644
index e495e167d4..0000000000
--- a/system/btif/src/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-per-file btif_hearing_aid.cc=file:/OWNERS_hearingaid
diff --git a/system/btif/src/btif_a2dp_source.cc b/system/btif/src/btif_a2dp_source.cc
index 20805a92bd..5bf2ef0d87 100644
--- a/system/btif/src/btif_a2dp_source.cc
+++ b/system/btif/src/btif_a2dp_source.cc
@@ -48,7 +48,6 @@
#include "btif_hf.h"
#include "btm_iso_api.h"
#include "common/message_loop_thread.h"
-#include "common/metrics.h"
#include "common/repeating_timer.h"
#include "common/time_util.h"
#include "hardware/bt_av.h"
@@ -1302,8 +1301,7 @@ static void btm_read_rssi_cb(void* data) {
return;
}
- bluetooth::shim::LogMetricReadRssiResult(result->rem_bda,
- bluetooth::common::kUnknownConnectionHandle,
+ bluetooth::shim::LogMetricReadRssiResult(result->rem_bda, bluetooth::os::kUnknownConnectionHandle,
result->hci_status, result->rssi);
log::warn("device: {}, rssi: {}", result->rem_bda, result->rssi);
@@ -1321,7 +1319,7 @@ static void btm_read_failed_contact_counter_cb(void* data) {
return;
}
bluetooth::shim::LogMetricReadFailedContactCounterResult(
- result->rem_bda, bluetooth::common::kUnknownConnectionHandle, result->hci_status,
+ result->rem_bda, bluetooth::os::kUnknownConnectionHandle, result->hci_status,
result->failed_contact_counter);
log::warn("device: {}, Failed Contact Counter: {}", result->rem_bda,
@@ -1340,7 +1338,7 @@ static void btm_read_tx_power_cb(void* data) {
return;
}
bluetooth::shim::LogMetricReadTxPowerLevelResult(result->rem_bda,
- bluetooth::common::kUnknownConnectionHandle,
+ bluetooth::os::kUnknownConnectionHandle,
result->hci_status, result->tx_power);
log::warn("device: {}, Tx Power: {}", result->rem_bda, result->tx_power);
diff --git a/system/btif/src/btif_dm.cc b/system/btif/src/btif_dm.cc
index 44b876af4e..e10606b9dd 100644
--- a/system/btif/src/btif_dm.cc
+++ b/system/btif/src/btif_dm.cc
@@ -1486,7 +1486,7 @@ static void btif_dm_search_devices_evt(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH*
auto triple = eir_uuids_cache.try_emplace(bdaddr, std::set<Uuid>{});
uuid_iter = std::get<0>(triple);
}
- log::info("EIR UUIDs for {}:", bdaddr);
+ log::info("EIR UUIDs for {}", bdaddr);
for (int i = 0; i < num_uuids; ++i) {
Uuid uuid = Uuid::From16Bit(p_uuid16[i]);
log::info("{}", uuid.ToString());
@@ -1609,7 +1609,7 @@ static void btif_on_service_discovery_results(RawAddress bd_addr,
if (results_for_bonding_device) {
// success for SDP
bluetooth::metrics::LogSDPComplete(bd_addr, tBTA_STATUS::BTA_SUCCESS);
- log::info("SDP finished for {}:", bd_addr);
+ log::info("SDP finished for {}", bd_addr);
pairing_cb.sdp_over_classic = btif_dm_pairing_cb_t::ServiceDiscoveryState::FINISHED;
}
@@ -1620,7 +1620,7 @@ static void btif_on_service_discovery_results(RawAddress bd_addr,
bt_property_t& le_prop = uuid_props[1];
if ((result == BTA_SUCCESS) && !uuids_param.empty()) {
- log::info("New UUIDs for {}:", bd_addr);
+ log::info("New UUIDs for {}", bd_addr);
for (const auto& uuid : uuids_param) {
if (btif_should_ignore_uuid(uuid)) {
continue;
@@ -1758,7 +1758,7 @@ static void btif_on_gatt_results(RawAddress bd_addr, std::vector<bluetooth::Uuid
bool lea_supported = is_le_audio_capable_during_service_discovery(bd_addr);
if (is_transport_le) {
- log::info("New GATT over LE UUIDs for {}:", bd_addr);
+ log::info("New GATT over LE UUIDs for {}", bd_addr);
BTM_LogHistory(kBtmLogTag, bd_addr, "Discovered GATT services using LE transport");
if (btif_is_gatt_service_discovery_post_pairing(bd_addr)) {
pairing_cb.gatt_over_le = btif_dm_pairing_cb_t::ServiceDiscoveryState::FINISHED;
@@ -1786,7 +1786,7 @@ static void btif_on_gatt_results(RawAddress bd_addr, std::vector<bluetooth::Uuid
}
}
} else {
- log::debug("New GATT over SDP UUIDs for {}:", bd_addr);
+ log::debug("New GATT over SDP UUIDs for {}", bd_addr);
BTM_LogHistory(kBtmLogTag, bd_addr, "Discovered GATT services using SDP transport");
}
diff --git a/system/btif/src/btif_hh.cc b/system/btif/src/btif_hh.cc
index 36ad3d148e..28ed77113d 100644
--- a/system/btif/src/btif_hh.cc
+++ b/system/btif/src/btif_hh.cc
@@ -749,9 +749,7 @@ static void hh_get_rpt_handler(tBTA_HH_HSDATA& hs_data) {
HAL_CBACK(bt_hh_callbacks, handshake_cb, (RawAddress*)&(p_dev->link_spec.addrt.bda),
p_dev->link_spec.addrt.type, p_dev->link_spec.transport,
(bthh_status_t)hs_data.status);
- if (com::android::bluetooth::flags::forward_get_set_report_failure_to_uhid()) {
- bta_hh_co_get_rpt_rsp(p_dev->dev_handle, (tBTA_HH_STATUS)hs_data.status, NULL, 0);
- }
+ bta_hh_co_get_rpt_rsp(p_dev->dev_handle, (tBTA_HH_STATUS)hs_data.status, NULL, 0);
}
}
diff --git a/system/common/Android.bp b/system/common/Android.bp
index c192613dbc..a22a733e75 100644
--- a/system/common/Android.bp
+++ b/system/common/Android.bp
@@ -32,17 +32,6 @@ cc_library_static {
canonical_path_from_root: false,
export_proto_headers: true,
},
- target: {
- android: {
- srcs: [
- "metrics.cc",
- ],
- static_libs: ["libstatslog_bt"],
- },
- host: {
- srcs: ["metrics_linux.cc"],
- },
- },
shared_libs: [
"libcrypto",
"libcutils",
diff --git a/system/common/BUILD.gn b/system/common/BUILD.gn
index 50ec9c1dd0..5b0852bd36 100644
--- a/system/common/BUILD.gn
+++ b/system/common/BUILD.gn
@@ -19,8 +19,6 @@ static_library("common") {
"address_obfuscator.cc",
"le_conn_params.cc",
"message_loop_thread.cc",
- "metric_id_allocator.cc",
- "metrics_linux.cc",
"os_utils.cc",
"repeating_timer.cc",
"stop_watch_legacy.cc",
diff --git a/system/common/metrics.cc b/system/common/metrics.cc
deleted file mode 100644
index c6c0977115..0000000000
--- a/system/common/metrics.cc
+++ /dev/null
@@ -1,94 +0,0 @@
-/******************************************************************************
- *
- * Copyright 2016 Google, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************/
-
-#include "common/metrics.h"
-
-#include <bluetooth/log.h>
-#include <frameworks/proto_logging/stats/enums/bluetooth/le/enums.pb.h>
-#include <statslog_bt.h>
-
-#include <cstdint>
-#include <vector>
-
-#include "main/shim/metric_id_api.h"
-#include "types/raw_address.h"
-
-namespace bluetooth {
-namespace common {
-
-void LogRemoteVersionInfo(uint16_t handle, uint8_t status, uint8_t version,
- uint16_t manufacturer_name, uint16_t subversion) {
- int ret = stats_write(BLUETOOTH_REMOTE_VERSION_INFO_REPORTED, handle, status, version,
- manufacturer_name, subversion);
- if (ret < 0) {
- log::warn(
- "failed for handle {}, status 0x{:x}, version 0x{:x}, "
- "manufacturer_name 0x{:x}, subversion 0x{:x}, error {}",
- handle, status, version, manufacturer_name, subversion, ret);
- }
-}
-
-void LogLeAudioConnectionSessionReported(
- int32_t group_size, int32_t group_metric_id, int64_t connection_duration_nanos,
- const std::vector<int64_t>& device_connecting_offset_nanos,
- const std::vector<int64_t>& device_connected_offset_nanos,
- const std::vector<int64_t>& device_connection_duration_nanos,
- const std::vector<int32_t>& device_connection_status,
- const std::vector<int32_t>& device_disconnection_status,
- const std::vector<RawAddress>& device_address,
- const std::vector<int64_t>& streaming_offset_nanos,
- const std::vector<int64_t>& streaming_duration_nanos,
- const std::vector<int32_t>& streaming_context_type) {
- std::vector<int32_t> device_metric_id(device_address.size());
- for (uint64_t i = 0; i < device_address.size(); i++) {
- if (!device_address[i].IsEmpty()) {
- device_metric_id[i] = bluetooth::shim::AllocateIdFromMetricIdAllocator(device_address[i]);
- } else {
- device_metric_id[i] = 0;
- }
- }
- int ret = stats_write(LE_AUDIO_CONNECTION_SESSION_REPORTED, group_size, group_metric_id,
- connection_duration_nanos, device_connecting_offset_nanos,
- device_connected_offset_nanos, device_connection_duration_nanos,
- device_connection_status, device_disconnection_status, device_metric_id,
- streaming_offset_nanos, streaming_duration_nanos, streaming_context_type);
- if (ret < 0) {
- log::warn(
- "failed for group {}device_connecting_offset_nanos[{}], "
- "device_connected_offset_nanos[{}], "
- "device_connection_duration_nanos[{}], device_connection_status[{}], "
- "device_disconnection_status[{}], device_metric_id[{}], "
- "streaming_offset_nanos[{}], streaming_duration_nanos[{}], "
- "streaming_context_type[{}]",
- group_metric_id, device_connecting_offset_nanos.size(),
- device_connected_offset_nanos.size(), device_connection_duration_nanos.size(),
- device_connection_status.size(), device_disconnection_status.size(),
- device_metric_id.size(), streaming_offset_nanos.size(), streaming_duration_nanos.size(),
- streaming_context_type.size());
- }
-}
-
-void LogLeAudioBroadcastSessionReported(int64_t duration_nanos) {
- int ret = stats_write(LE_AUDIO_BROADCAST_SESSION_REPORTED, duration_nanos);
- if (ret < 0) {
- log::warn("failed for duration={}", duration_nanos);
- }
-}
-
-} // namespace common
-} // namespace bluetooth
diff --git a/system/common/metrics.h b/system/common/metrics.h
deleted file mode 100644
index 4d5a234ce5..0000000000
--- a/system/common/metrics.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/******************************************************************************
- *
- * Copyright 2016 Google, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************/
-
-#pragma once
-
-#include <cstdint>
-#include <vector>
-
-#include "types/raw_address.h"
-
-namespace bluetooth {
-namespace common {
-
-/**
- * Unknown connection handle for metrics purpose
- */
-static const uint32_t kUnknownConnectionHandle = 0xFFFF;
-
-/**
- * Logs when we receive Bluetooth Read Remote Version Information Complete
- * Event from the remote device, as documented by the Bluetooth Core HCI
- * specification
- *
- * Reference: 5.0 Core Specification, Vol 2, Part E, Page 1118
- *
- * @param handle handle of associated ACL connection
- * @param status HCI command status of this event
- * @param version version code from read remote version complete event
- * @param manufacturer_name manufacturer code from read remote version complete
- * event
- * @param subversion subversion code from read remote version complete event
- */
-void LogRemoteVersionInfo(uint16_t handle, uint8_t status, uint8_t version,
- uint16_t manufacturer_name, uint16_t subversion);
-
-void LogLeAudioConnectionSessionReported(
- int32_t group_size, int32_t group_metric_id, int64_t connection_duration_nanos,
- const std::vector<int64_t>& device_connecting_offset_nanos,
- const std::vector<int64_t>& device_connected_offset_nanos,
- const std::vector<int64_t>& device_connection_duration_nanos,
- const std::vector<int32_t>& device_connection_status,
- const std::vector<int32_t>& device_disconnection_status,
- const std::vector<RawAddress>& device_address,
- const std::vector<int64_t>& streaming_offset_nanos,
- const std::vector<int64_t>& streaming_duration_nanos,
- const std::vector<int32_t>& streaming_context_type);
-
-void LogLeAudioBroadcastSessionReported(int64_t duration_nanos);
-
-} // namespace common
-} // namespace bluetooth
diff --git a/system/common/metrics_linux.cc b/system/common/metrics_linux.cc
deleted file mode 100644
index e886c05bf3..0000000000
--- a/system/common/metrics_linux.cc
+++ /dev/null
@@ -1,47 +0,0 @@
-/******************************************************************************
- *
- * Copyright 2018 Google, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************/
-
-#include <cstdint>
-#include <vector>
-
-#include "common/metrics.h"
-#include "types/raw_address.h"
-
-namespace bluetooth {
-namespace common {
-
-void LogRemoteVersionInfo(uint16_t /* handle */, uint8_t /* status */, uint8_t /* version */,
- uint16_t /* manufacturer_name */, uint16_t /* subversion */) {}
-
-void LogLeAudioConnectionSessionReported(
- int32_t /* group_size */, int32_t /* group_metric_id */,
- int64_t /* connection_duration_nanos */,
- const std::vector<int64_t>& /* device_connecting_offset_nanos */,
- const std::vector<int64_t>& /* device_connected_offset_nanos */,
- const std::vector<int64_t>& /* device_connection_duration_nanos */,
- const std::vector<int32_t>& /* device_connection_status */,
- const std::vector<int32_t>& /* device_disconnection_status */,
- const std::vector<RawAddress>& /* device_address */,
- const std::vector<int64_t>& /* streaming_offset_nanos */,
- const std::vector<int64_t>& /* streaming_duration_nanos */,
- const std::vector<int32_t>& /* streaming_context_type */) {}
-
-void LogLeAudioBroadcastSessionReported(int64_t /* duration_nanos */) {}
-
-} // namespace common
-} // namespace bluetooth
diff --git a/system/gd/Android.bp b/system/gd/Android.bp
index 9a6bd02551..45555f130a 100644
--- a/system/gd/Android.bp
+++ b/system/gd/Android.bp
@@ -194,7 +194,7 @@ cc_library_static {
"packages/modules/Bluetooth/system",
],
apex_available: ["com.android.bt"],
- min_sdk_version: "31",
+ min_sdk_version: "33",
static_libs: [
"bluetooth_flags_c_lib",
"libchrome",
diff --git a/system/gd/common/audit_log.cc b/system/gd/common/audit_log.cc
index e83c2894f8..2e112a0c34 100644
--- a/system/gd/common/audit_log.cc
+++ b/system/gd/common/audit_log.cc
@@ -16,6 +16,8 @@
#include "common/audit_log.h"
+#include <format>
+
#ifdef __ANDROID__
#include <log/log_event_list.h>
#endif // __ANDROID__
@@ -43,8 +45,8 @@ void LogConnectionAdminAuditEvent([[maybe_unused]] const char* action,
android_log_event_list(SEC_TAG_BLUETOOTH_CONNECTION)
<< address.ToRedactedStringForLogging()
- << /* success */ int32_t(status == hci::ErrorCode::SUCCESS) << action << ": "
- << ErrorCodeText(status) << LOG_ID_SECURITY;
+ << /* success */ int32_t(status == hci::ErrorCode::SUCCESS)
+ << std::format("{}: {}", action, ErrorCodeText(status)) << LOG_ID_SECURITY;
#endif /* defined(__ANDROID__) && !defined (FUZZ_TARGET) */
}
diff --git a/system/gd/hal/BUILD.gn b/system/gd/hal/BUILD.gn
index ebf15255af..57007d2571 100644
--- a/system/gd/hal/BUILD.gn
+++ b/system/gd/hal/BUILD.gn
@@ -42,7 +42,10 @@ source_set("BluetoothHalSources_hci_host") {
}
configs += [ "//bt/system/gd:gd_defaults" ]
- deps = [ "//bt/system/gd:gd_default_deps" ]
+ deps = [
+ "//bt/flags:bluetooth_flags_c_lib",
+ "//bt/system/gd:gd_default_deps",
+ ]
}
source_set("BluetoothHalSources_ranging_host") {
diff --git a/system/gd/hal/snoop_logger.cc b/system/gd/hal/snoop_logger.cc
index 538d13ec3e..2462834b53 100644
--- a/system/gd/hal/snoop_logger.cc
+++ b/system/gd/hal/snoop_logger.cc
@@ -55,7 +55,7 @@ static std::string GetBtSnoopMode() {
// Default mode is FILTERED on userdebug/eng build, DISABLED on user build.
// In userdebug/eng build, it can also be overwritten by modifying the global setting
std::string btsnoop_mode = SnoopLogger::kBtSnoopLogModeDisabled;
- if (os::GetSystemPropertyBool(SnoopLogger::kIsDebuggableProperty, false)) {
+ if (os::GetSystemProperty(SnoopLogger::kRoBuildType) != "user") {
btsnoop_mode = os::GetSystemProperty(SnoopLogger::kBtSnoopDefaultLogModeProperty)
.value_or(SnoopLogger::kBtSnoopLogModeFiltered);
}
@@ -471,7 +471,7 @@ size_t get_btsnooz_packet_length_to_write(const HciPacket& packet, SnoopLogger::
// system properties
const std::string SnoopLogger::kBtSnoopMaxPacketsPerFileProperty = "persist.bluetooth.btsnoopsize";
-const std::string SnoopLogger::kIsDebuggableProperty = "ro.debuggable";
+const std::string SnoopLogger::kRoBuildType = "ro.build.type";
const std::string SnoopLogger::kBtSnoopLogModeProperty = "persist.bluetooth.btsnooplogmode";
const std::string SnoopLogger::kBtSnoopDefaultLogModeProperty =
"persist.bluetooth.btsnoopdefaultmode";
@@ -1333,7 +1333,7 @@ void SnoopLogger::Start() {
EnableFilters();
}
- if (os::GetSystemPropertyBool(kIsDebuggableProperty, false)) {
+ if (os::GetSystemProperty(kRoBuildType) != "user") {
// Cf b/375056207: The implementation must pass a security review
// in order to enable the snoop logger socket in user builds.
auto snoop_logger_socket = std::make_unique<SnoopLoggerSocket>(&syscall_if);
@@ -1404,9 +1404,9 @@ size_t SnoopLogger::GetMaxPacketsPerFile() {
size_t SnoopLogger::GetMaxPacketsPerBuffer() {
// We want to use at most 256 KB memory for btsnooz log for release builds
// and 512 KB memory for userdebug/eng builds
- auto is_debuggable = os::GetSystemPropertyBool(kIsDebuggableProperty, false);
+ auto is_debug_build = (os::GetSystemProperty(kRoBuildType) != "user");
- size_t btsnooz_max_memory_usage_bytes = (is_debuggable ? 1024 : 256) * 1024;
+ size_t btsnooz_max_memory_usage_bytes = (is_debug_build ? 1024 : 256) * 1024;
// Calculate max number of packets based on max memory usage and max packet size
return btsnooz_max_memory_usage_bytes / kDefaultBtSnoozMaxBytesPerPacket;
}
@@ -1419,8 +1419,8 @@ void SnoopLogger::RegisterSocket(SnoopLoggerSocketInterface* socket) {
}
bool SnoopLogger::IsBtSnoopLogPersisted() {
- auto is_debuggable = os::GetSystemPropertyBool(kIsDebuggableProperty, false);
- return is_debuggable && os::GetSystemPropertyBool(kBtSnoopLogPersists, false);
+ auto is_debug_build = (os::GetSystemProperty(kRoBuildType) != "user");
+ return is_debug_build && os::GetSystemPropertyBool(kBtSnoopLogPersists, false);
}
bool SnoopLogger::IsQualcommDebugLogEnabled() {
diff --git a/system/gd/hal/snoop_logger.h b/system/gd/hal/snoop_logger.h
index b009add89c..5f45e8a0b2 100644
--- a/system/gd/hal/snoop_logger.h
+++ b/system/gd/hal/snoop_logger.h
@@ -17,6 +17,7 @@
#pragma once
#include <bluetooth/log.h>
+#include <com_android_bluetooth_flags.h>
#include <fstream>
#include <string>
@@ -145,7 +146,7 @@ public:
static const ModuleFactory Factory;
static const std::string kBtSnoopMaxPacketsPerFileProperty;
- static const std::string kIsDebuggableProperty;
+ static const std::string kRoBuildType;
static const std::string kBtSnoopLogModeProperty;
static const std::string kBtSnoopLogPersists;
static const std::string kBtSnoopDefaultLogModeProperty;
@@ -195,6 +196,13 @@ public:
};
SnoopLogger(os::Handler* handler);
+ ~SnoopLogger() {
+ if (!com::android::bluetooth::flags::same_handler_for_all_modules()) {
+ GetHandler()->Clear();
+ GetHandler()->WaitUntilStopped(std::chrono::milliseconds(2000));
+ delete GetHandler();
+ }
+ }
// Returns the maximum number of packets per file
// Changes to this value is only effective after restarting Bluetooth
diff --git a/system/gd/hci/acl_manager.cc b/system/gd/hci/acl_manager.cc
index 26b0ce70eb..280cc237b4 100644
--- a/system/gd/hci/acl_manager.cc
+++ b/system/gd/hci/acl_manager.cc
@@ -260,16 +260,6 @@ void AclManager::CreateLeConnection(AddressWithType address_with_type, bool is_d
CallOn(pimpl_->le_impl_, &le_impl::create_le_connection, address_with_type, true, is_direct);
}
-void AclManager::SetLeSuggestedDefaultDataParameters(uint16_t octets, uint16_t time) {
- CallOn(pimpl_->le_impl_, &le_impl::set_le_suggested_default_data_parameters, octets, time);
-}
-
-void AclManager::LeSetDefaultSubrate(uint16_t subrate_min, uint16_t subrate_max,
- uint16_t max_latency, uint16_t cont_num, uint16_t sup_tout) {
- CallOn(pimpl_->le_impl_, &le_impl::LeSetDefaultSubrate, subrate_min, subrate_max, max_latency,
- cont_num, sup_tout);
-}
-
void AclManager::SetPrivacyPolicyForInitiatorAddress(
LeAddressManager::AddressPolicy address_policy, AddressWithType fixed_address,
std::chrono::milliseconds minimum_rotation_time,
diff --git a/system/gd/hci/acl_manager.h b/system/gd/hci/acl_manager.h
index 2b3d523b1f..f38f1ff689 100644
--- a/system/gd/hci/acl_manager.h
+++ b/system/gd/hci/acl_manager.h
@@ -86,12 +86,6 @@ public:
// Generates OnLeConnectSuccess if connected, or OnLeConnectFail otherwise
virtual void CreateLeConnection(AddressWithType address_with_type, bool is_direct);
- // Ask the controller for specific data parameters
- virtual void SetLeSuggestedDefaultDataParameters(uint16_t octets, uint16_t time);
-
- virtual void LeSetDefaultSubrate(uint16_t subrate_min, uint16_t subrate_max, uint16_t max_latency,
- uint16_t cont_num, uint16_t sup_tout);
-
virtual void SetPrivacyPolicyForInitiatorAddress(LeAddressManager::AddressPolicy address_policy,
AddressWithType fixed_address,
std::chrono::milliseconds minimum_rotation_time,
diff --git a/system/gd/hci/acl_manager/le_impl.h b/system/gd/hci/acl_manager/le_impl.h
index ce93f46e7e..122f76525e 100644
--- a/system/gd/hci/acl_manager/le_impl.h
+++ b/system/gd/hci/acl_manager/le_impl.h
@@ -1063,15 +1063,12 @@ public:
add_device_to_accept_list(address_with_type);
}
- if (com::android::bluetooth::flags::
- improve_create_connection_for_already_connecting_device()) {
- bool in_accept_list_due_to_direct_connect =
- direct_connections_.find(address_with_type) != direct_connections_.end();
-
- if (already_in_accept_list && (in_accept_list_due_to_direct_connect || !is_direct)) {
- log::info("Device {} already in accept list. Stop here.", address_with_type);
- return;
- }
+ bool in_accept_list_due_to_direct_connect =
+ direct_connections_.find(address_with_type) != direct_connections_.end();
+
+ if (already_in_accept_list && (in_accept_list_due_to_direct_connect || !is_direct)) {
+ log::info("Device {} already in accept list. Stop here.", address_with_type);
+ return;
}
if (is_direct) {
@@ -1149,25 +1146,6 @@ public:
remove_device_from_accept_list(address_with_type);
}
- void set_le_suggested_default_data_parameters(uint16_t length, uint16_t time) {
- auto packet = LeWriteSuggestedDefaultDataLengthBuilder::Create(length, time);
- le_acl_connection_interface_->EnqueueCommand(
- std::move(packet), handler_->BindOnce([](CommandCompleteView /* complete */) {}));
- }
-
- void LeSetDefaultSubrate(uint16_t subrate_min, uint16_t subrate_max, uint16_t max_latency,
- uint16_t cont_num, uint16_t sup_tout) {
- le_acl_connection_interface_->EnqueueCommand(
- LeSetDefaultSubrateBuilder::Create(subrate_min, subrate_max, max_latency, cont_num,
- sup_tout),
- handler_->BindOnce([](CommandCompleteView complete) {
- auto complete_view = LeSetDefaultSubrateCompleteView::Create(complete);
- log::assert_that(complete_view.IsValid(), "assert failed: complete_view.IsValid()");
- ErrorCode status = complete_view.GetStatus();
- log::assert_that(status == ErrorCode::SUCCESS, "Status = {}", ErrorCodeText(status));
- }));
- }
-
void clear_resolving_list() { le_address_manager_->ClearResolvingList(); }
void set_privacy_policy_for_initiator_address(LeAddressManager::AddressPolicy address_policy,
diff --git a/system/gd/hci/acl_manager/le_impl_test.cc b/system/gd/hci/acl_manager/le_impl_test.cc
index 66bc16bbd8..f54d316d30 100644
--- a/system/gd/hci/acl_manager/le_impl_test.cc
+++ b/system/gd/hci/acl_manager/le_impl_test.cc
@@ -284,164 +284,6 @@ protected:
hci_layer_->IncomingEvent(LeSetRandomAddressCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
}
- void test_direct_connection_after_background_connection() {
- set_random_device_address_policy();
-
- hci::AddressWithType address({0x21, 0x22, 0x23, 0x24, 0x25, 0x26},
- AddressType::PUBLIC_DEVICE_ADDRESS);
-
- // arrange: Create background connection. Remember that acl_manager adds device background list
- le_impl_->add_device_to_background_connection_list(address);
- le_impl_->create_le_connection(address, true, /* is_direct */ false);
- hci_layer_->GetCommand(OpCode::LE_ADD_DEVICE_TO_FILTER_ACCEPT_LIST);
- hci_layer_->IncomingEvent(
- LeAddDeviceToFilterAcceptListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
- auto raw_bg_create_connection = hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION);
- hci_layer_->IncomingEvent(LeCreateConnectionStatusBuilder::Create(ErrorCode::SUCCESS, 0x01));
- sync_handler();
-
- // act: Create direct connection
- le_impl_->create_le_connection(address, true, /* is_direct */ true);
- auto cancel_connection = hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION_CANCEL);
- if (cancel_connection.IsValid()) {
- hci_layer_->IncomingEvent(
- LeCreateConnectionCancelCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
- hci_layer_->IncomingLeMetaEvent(LeConnectionCompleteBuilder::Create(
- ErrorCode::UNKNOWN_CONNECTION, kHciHandle, Role::CENTRAL,
- AddressType::PUBLIC_DEVICE_ADDRESS, Address::kEmpty, 0x0000, 0x0000, 0x0000,
- ClockAccuracy::PPM_30));
- }
- auto raw_direct_create_connection = hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION);
-
- // assert
- auto bg_create_connection =
- LeCreateConnectionView::Create(LeConnectionManagementCommandView::Create(
- AclCommandView::Create(raw_bg_create_connection)));
- EXPECT_TRUE(bg_create_connection.IsValid());
- auto direct_create_connection =
- LeCreateConnectionView::Create(LeConnectionManagementCommandView::Create(
- AclCommandView::Create(raw_direct_create_connection)));
- EXPECT_TRUE(direct_create_connection.IsValid());
- log::info("Scan Interval {}", direct_create_connection.GetLeScanInterval());
- ASSERT_NE(direct_create_connection.GetLeScanInterval(),
- bg_create_connection.GetLeScanInterval());
-
- hci_layer_->IncomingEvent(LeCreateConnectionStatusBuilder::Create(ErrorCode::SUCCESS, 0x01));
- sync_handler();
-
- // Check state is ARMED
- ASSERT_EQ(ConnectabilityState::ARMED, le_impl_->connectability_state_);
-
- // Simulate timeout on direct connect. Verify background connect is still in place
- EXPECT_CALL(mock_le_connection_callbacks_,
- OnLeConnectFail(_, ErrorCode::CONNECTION_ACCEPT_TIMEOUT))
- .Times(1);
- le_impl_->on_create_connection_timeout(address);
- sync_handler();
- cancel_connection = hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION_CANCEL);
- hci_layer_->IncomingEvent(
- LeCreateConnectionCancelCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
- hci_layer_->IncomingLeMetaEvent(LeConnectionCompleteBuilder::Create(
- ErrorCode::UNKNOWN_CONNECTION, kHciHandle, Role::CENTRAL,
- AddressType::PUBLIC_DEVICE_ADDRESS, Address::kEmpty, 0x0000, 0x0000, 0x0000,
- ClockAccuracy::PPM_30));
- EXPECT_TRUE(cancel_connection.IsValid());
- raw_bg_create_connection = hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION);
- bg_create_connection = LeCreateConnectionView::Create(LeConnectionManagementCommandView::Create(
- AclCommandView::Create(raw_bg_create_connection)));
- EXPECT_TRUE(bg_create_connection.IsValid());
- sync_handler();
- ASSERT_TRUE(le_impl_->create_connection_timeout_alarms_.empty());
-
- hci_layer_->IncomingEvent(LeCreateConnectionStatusBuilder::Create(ErrorCode::SUCCESS, 0x01));
- sync_handler();
-
- // Check state is ARMED
- ASSERT_EQ(ConnectabilityState::ARMED, le_impl_->connectability_state_);
- }
-
- void test_direct_connect_after_direct_connect() {
- set_random_device_address_policy();
-
- hci::AddressWithType address({0x21, 0x22, 0x23, 0x24, 0x25, 0x26},
- AddressType::PUBLIC_DEVICE_ADDRESS);
-
- // Create first direct connection
- le_impl_->create_le_connection(address, true, /* is_direct */ true);
- hci_layer_->GetCommand(OpCode::LE_ADD_DEVICE_TO_FILTER_ACCEPT_LIST);
- hci_layer_->IncomingEvent(
- LeAddDeviceToFilterAcceptListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
- auto raw_direct_1_create_connection = hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION);
- hci_layer_->IncomingEvent(LeCreateConnectionStatusBuilder::Create(ErrorCode::SUCCESS, 0x01));
- sync_handler();
-
- // Check state is ARMED
- ASSERT_EQ(ConnectabilityState::ARMED, le_impl_->connectability_state_);
-
- // assert
- auto direct_1_create_connection =
- LeCreateConnectionView::Create(LeConnectionManagementCommandView::Create(
- AclCommandView::Create(raw_direct_1_create_connection)));
- EXPECT_TRUE(direct_1_create_connection.IsValid());
-
- log::info("Second direct connect to the same device");
-
- // Create second direct connection
- le_impl_->create_le_connection(address, true, /* is_direct */ true);
- sync_handler();
-
- CommandView cancel_connection = CommandView::Create(
- PacketView<packet::kLittleEndian>(std::make_shared<std::vector<uint8_t>>()));
-
- if (!com::android::bluetooth::flags::
- improve_create_connection_for_already_connecting_device()) {
- cancel_connection = hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION_CANCEL);
- if (cancel_connection.IsValid()) {
- hci_layer_->IncomingEvent(
- LeCreateConnectionCancelCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
- hci_layer_->IncomingLeMetaEvent(LeConnectionCompleteBuilder::Create(
- ErrorCode::UNKNOWN_CONNECTION, kHciHandle, Role::CENTRAL,
- AddressType::PUBLIC_DEVICE_ADDRESS, Address::kEmpty, 0x0000, 0x0000, 0x0000,
- ClockAccuracy::PPM_30));
- }
-
- auto raw_direct_2_create_connection = hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION);
-
- auto direct_2_create_connection =
- LeCreateConnectionView::Create(LeConnectionManagementCommandView::Create(
- AclCommandView::Create(raw_direct_2_create_connection)));
- EXPECT_TRUE(direct_2_create_connection.IsValid());
- hci_layer_->IncomingEvent(LeCreateConnectionStatusBuilder::Create(ErrorCode::SUCCESS, 0x01));
- sync_handler();
- } else {
- hci_layer_->AssertNoQueuedCommand();
- }
-
- log::info("Simulate timeout");
-
- EXPECT_CALL(mock_le_connection_callbacks_,
- OnLeConnectFail(_, ErrorCode::CONNECTION_ACCEPT_TIMEOUT))
- .Times(1);
- le_impl_->on_create_connection_timeout(address);
- sync_handler();
- cancel_connection = hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION_CANCEL);
- EXPECT_TRUE(cancel_connection.IsValid());
- hci_layer_->IncomingEvent(
- LeCreateConnectionCancelCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
- hci_layer_->IncomingLeMetaEvent(LeConnectionCompleteBuilder::Create(
- ErrorCode::UNKNOWN_CONNECTION, kHciHandle, Role::CENTRAL,
- AddressType::PUBLIC_DEVICE_ADDRESS, Address::kEmpty, 0x0000, 0x0000, 0x0000,
- ClockAccuracy::PPM_30));
- sync_handler();
- ASSERT_TRUE(le_impl_->create_connection_timeout_alarms_.empty());
-
- hci_layer_->GetCommand(OpCode::LE_REMOVE_DEVICE_FROM_FILTER_ACCEPT_LIST);
- hci_layer_->IncomingEvent(
- LeRemoveDeviceFromFilterAcceptListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
- hci_layer_->AssertNoQueuedCommand();
- ASSERT_EQ(ConnectabilityState::DISARMED, le_impl_->connectability_state_);
- }
-
// Need to store the LeAclConnection so it is not immediately dropped => disconnected
std::unique_ptr<LeAclConnection> create_enhanced_connection(std::string remote_address_string,
int handle) {
@@ -1475,29 +1317,6 @@ TEST_F(LeImplTest, cancel_connect) {
ASSERT_TRUE(le_impl_->create_connection_timeout_alarms_.empty());
}
-TEST_F(LeImplTest, set_le_suggested_default_data_parameters) {
- le_impl_->set_le_suggested_default_data_parameters(kLength, kTime);
- sync_handler();
- auto view = CreateLeConnectionManagementCommandView<LeWriteSuggestedDefaultDataLengthView>(
- hci_layer_->GetCommand());
- ASSERT_TRUE(view.IsValid());
- ASSERT_EQ(kLength, view.GetTxOctets());
- ASSERT_EQ(kTime, view.GetTxTime());
-}
-
-TEST_F(LeImplTest, LeSetDefaultSubrate) {
- le_impl_->LeSetDefaultSubrate(kIntervalMin, kIntervalMax, kLatency, kContinuationNumber,
- kTimeout);
- sync_handler();
- auto view = CreateAclCommandView<LeSetDefaultSubrateView>(hci_layer_->GetCommand());
- ASSERT_TRUE(view.IsValid());
- ASSERT_EQ(kIntervalMin, view.GetSubrateMin());
- ASSERT_EQ(kIntervalMax, view.GetSubrateMax());
- ASSERT_EQ(kLatency, view.GetMaxLatency());
- ASSERT_EQ(kContinuationNumber, view.GetContinuationNumber());
- ASSERT_EQ(kTimeout, view.GetSupervisionTimeout());
-}
-
enum class ConnectionCompleteType { CONNECTION_COMPLETE, ENHANCED_CONNECTION_COMPLETE };
class LeImplTestParameterizedByConnectionCompleteEventType
@@ -1716,29 +1535,138 @@ TEST_F(LeImplTest, DisconnectionAcceptlistCallback) {
}
TEST_F(LeImplTest, direct_connection_after_background_connection) {
- // TODO b/356593752 - remove when test removing flag
- com::android::bluetooth::flags::provider_
- ->improve_create_connection_for_already_connecting_device(false);
- test_direct_connection_after_background_connection();
-}
+ set_random_device_address_policy();
+
+ hci::AddressWithType address({0x21, 0x22, 0x23, 0x24, 0x25, 0x26},
+ AddressType::PUBLIC_DEVICE_ADDRESS);
+
+ // arrange: Create background connection. Remember that acl_manager adds device background list
+ le_impl_->add_device_to_background_connection_list(address);
+ le_impl_->create_le_connection(address, true, /* is_direct */ false);
+ hci_layer_->GetCommand(OpCode::LE_ADD_DEVICE_TO_FILTER_ACCEPT_LIST);
+ hci_layer_->IncomingEvent(
+ LeAddDeviceToFilterAcceptListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
+ auto raw_bg_create_connection = hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION);
+ hci_layer_->IncomingEvent(LeCreateConnectionStatusBuilder::Create(ErrorCode::SUCCESS, 0x01));
+ sync_handler();
+
+ // act: Create direct connection
+ le_impl_->create_le_connection(address, true, /* is_direct */ true);
+ auto cancel_connection = hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION_CANCEL);
+ if (cancel_connection.IsValid()) {
+ hci_layer_->IncomingEvent(
+ LeCreateConnectionCancelCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
+ hci_layer_->IncomingLeMetaEvent(LeConnectionCompleteBuilder::Create(
+ ErrorCode::UNKNOWN_CONNECTION, kHciHandle, Role::CENTRAL,
+ AddressType::PUBLIC_DEVICE_ADDRESS, Address::kEmpty, 0x0000, 0x0000, 0x0000,
+ ClockAccuracy::PPM_30));
+ }
+ auto raw_direct_create_connection = hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION);
+
+ // assert
+ auto bg_create_connection =
+ LeCreateConnectionView::Create(LeConnectionManagementCommandView::Create(
+ AclCommandView::Create(raw_bg_create_connection)));
+ EXPECT_TRUE(bg_create_connection.IsValid());
+ auto direct_create_connection =
+ LeCreateConnectionView::Create(LeConnectionManagementCommandView::Create(
+ AclCommandView::Create(raw_direct_create_connection)));
+ EXPECT_TRUE(direct_create_connection.IsValid());
+ log::info("Scan Interval {}", direct_create_connection.GetLeScanInterval());
+ ASSERT_NE(direct_create_connection.GetLeScanInterval(), bg_create_connection.GetLeScanInterval());
-TEST_F(LeImplTest, direct_connection_after_background_connection_with_improvement) {
- com::android::bluetooth::flags::provider_
- ->improve_create_connection_for_already_connecting_device(true);
- test_direct_connection_after_background_connection();
+ hci_layer_->IncomingEvent(LeCreateConnectionStatusBuilder::Create(ErrorCode::SUCCESS, 0x01));
+ sync_handler();
+
+ // Check state is ARMED
+ ASSERT_EQ(ConnectabilityState::ARMED, le_impl_->connectability_state_);
+
+ // Simulate timeout on direct connect. Verify background connect is still in place
+ EXPECT_CALL(mock_le_connection_callbacks_,
+ OnLeConnectFail(_, ErrorCode::CONNECTION_ACCEPT_TIMEOUT))
+ .Times(1);
+ le_impl_->on_create_connection_timeout(address);
+ sync_handler();
+ cancel_connection = hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION_CANCEL);
+ hci_layer_->IncomingEvent(
+ LeCreateConnectionCancelCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
+ hci_layer_->IncomingLeMetaEvent(LeConnectionCompleteBuilder::Create(
+ ErrorCode::UNKNOWN_CONNECTION, kHciHandle, Role::CENTRAL,
+ AddressType::PUBLIC_DEVICE_ADDRESS, Address::kEmpty, 0x0000, 0x0000, 0x0000,
+ ClockAccuracy::PPM_30));
+ EXPECT_TRUE(cancel_connection.IsValid());
+ raw_bg_create_connection = hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION);
+ bg_create_connection = LeCreateConnectionView::Create(LeConnectionManagementCommandView::Create(
+ AclCommandView::Create(raw_bg_create_connection)));
+ EXPECT_TRUE(bg_create_connection.IsValid());
+ sync_handler();
+ ASSERT_TRUE(le_impl_->create_connection_timeout_alarms_.empty());
+
+ hci_layer_->IncomingEvent(LeCreateConnectionStatusBuilder::Create(ErrorCode::SUCCESS, 0x01));
+ sync_handler();
+
+ // Check state is ARMED
+ ASSERT_EQ(ConnectabilityState::ARMED, le_impl_->connectability_state_);
}
TEST_F(LeImplTest, direct_connection_after_direct_connection) {
- // TODO b/356593752 - remove when test removing flag
- com::android::bluetooth::flags::provider_
- ->improve_create_connection_for_already_connecting_device(false);
- test_direct_connect_after_direct_connect();
-}
+ set_random_device_address_policy();
-TEST_F(LeImplTest, direct_connection_after_direct_connection_with_improvement) {
- com::android::bluetooth::flags::provider_
- ->improve_create_connection_for_already_connecting_device(true);
- test_direct_connect_after_direct_connect();
+ hci::AddressWithType address({0x21, 0x22, 0x23, 0x24, 0x25, 0x26},
+ AddressType::PUBLIC_DEVICE_ADDRESS);
+
+ // Create first direct connection
+ le_impl_->create_le_connection(address, true, /* is_direct */ true);
+ hci_layer_->GetCommand(OpCode::LE_ADD_DEVICE_TO_FILTER_ACCEPT_LIST);
+ hci_layer_->IncomingEvent(
+ LeAddDeviceToFilterAcceptListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
+ auto raw_direct_1_create_connection = hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION);
+ hci_layer_->IncomingEvent(LeCreateConnectionStatusBuilder::Create(ErrorCode::SUCCESS, 0x01));
+ sync_handler();
+
+ // Check state is ARMED
+ ASSERT_EQ(ConnectabilityState::ARMED, le_impl_->connectability_state_);
+
+ // assert
+ auto direct_1_create_connection =
+ LeCreateConnectionView::Create(LeConnectionManagementCommandView::Create(
+ AclCommandView::Create(raw_direct_1_create_connection)));
+ EXPECT_TRUE(direct_1_create_connection.IsValid());
+
+ log::info("Second direct connect to the same device");
+
+ // Create second direct connection
+ le_impl_->create_le_connection(address, true, /* is_direct */ true);
+ sync_handler();
+
+ CommandView cancel_connection = CommandView::Create(
+ PacketView<packet::kLittleEndian>(std::make_shared<std::vector<uint8_t>>()));
+
+ hci_layer_->AssertNoQueuedCommand();
+
+ log::info("Simulate timeout");
+
+ EXPECT_CALL(mock_le_connection_callbacks_,
+ OnLeConnectFail(_, ErrorCode::CONNECTION_ACCEPT_TIMEOUT))
+ .Times(1);
+ le_impl_->on_create_connection_timeout(address);
+ sync_handler();
+ cancel_connection = hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION_CANCEL);
+ EXPECT_TRUE(cancel_connection.IsValid());
+ hci_layer_->IncomingEvent(
+ LeCreateConnectionCancelCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
+ hci_layer_->IncomingLeMetaEvent(LeConnectionCompleteBuilder::Create(
+ ErrorCode::UNKNOWN_CONNECTION, kHciHandle, Role::CENTRAL,
+ AddressType::PUBLIC_DEVICE_ADDRESS, Address::kEmpty, 0x0000, 0x0000, 0x0000,
+ ClockAccuracy::PPM_30));
+ sync_handler();
+ ASSERT_TRUE(le_impl_->create_connection_timeout_alarms_.empty());
+
+ hci_layer_->GetCommand(OpCode::LE_REMOVE_DEVICE_FROM_FILTER_ACCEPT_LIST);
+ hci_layer_->IncomingEvent(
+ LeRemoveDeviceFromFilterAcceptListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
+ hci_layer_->AssertNoQueuedCommand();
+ ASSERT_EQ(ConnectabilityState::DISARMED, le_impl_->connectability_state_);
}
TEST_F(LeImplTest, direct_connection_cancel_but_connected) {
diff --git a/system/gd/metrics/BUILD.gn b/system/gd/metrics/BUILD.gn
index ff0d72e81e..6d235376c6 100644
--- a/system/gd/metrics/BUILD.gn
+++ b/system/gd/metrics/BUILD.gn
@@ -50,7 +50,10 @@ source_set("BluetoothMetricsSources") {
"//bt/system/gd:gd_defaults",
"//bt/system/log:log_defaults",
]
- deps = [ "//bt/system/gd:gd_default_deps" ]
+ deps = [
+ "//bt/flags:bluetooth_flags_c_lib",
+ "//bt/system/gd:gd_default_deps",
+ ]
if (target_os == "chromeos") {
deps += [ ":BluetoothMetricsSources_chromeos" ]
diff --git a/system/gd/metrics/chromeos/OWNERS b/system/gd/metrics/chromeos/OWNERS
deleted file mode 100644
index a823e6e1dd..0000000000
--- a/system/gd/metrics/chromeos/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_chromeos
diff --git a/system/gd/metrics/counter_metrics.h b/system/gd/metrics/counter_metrics.h
index 88c7711f92..2f25f03ed0 100644
--- a/system/gd/metrics/counter_metrics.h
+++ b/system/gd/metrics/counter_metrics.h
@@ -15,6 +15,8 @@
*/
#pragma once
+#include <com_android_bluetooth_flags.h>
+
#include <unordered_map>
#include "module.h"
@@ -26,6 +28,13 @@ namespace metrics {
class CounterMetrics : public bluetooth::Module {
public:
CounterMetrics(os::Handler* handler) : Module(handler) {}
+ ~CounterMetrics() {
+ if (!com::android::bluetooth::flags::same_handler_for_all_modules()) {
+ GetHandler()->Clear();
+ GetHandler()->WaitUntilStopped(std::chrono::milliseconds(2000));
+ delete GetHandler();
+ }
+ }
bool CacheCount(int32_t key, int64_t value);
virtual bool Count(int32_t key, int64_t count);
diff --git a/system/gd/metrics/linux/OWNERS b/system/gd/metrics/linux/OWNERS
deleted file mode 100644
index a823e6e1dd..0000000000
--- a/system/gd/metrics/linux/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_chromeos
diff --git a/system/gd/os/android/metrics.cc b/system/gd/os/android/metrics.cc
index 78b12c8d96..5f5b34ef2e 100644
--- a/system/gd/os/android/metrics.cc
+++ b/system/gd/os/android/metrics.cc
@@ -122,11 +122,9 @@ void LogMetricRemoteVersionInfo(uint16_t handle, uint8_t status, uint8_t version
manufacturer_name, subversion);
if (ret < 0) {
log::warn(
- "Failed for handle {}, status {}, version {}, manufacturer_name {}, subversion {}, "
- "error "
- "{}",
- handle, common::ToHexString(status), common::ToHexString(version),
- common::ToHexString(manufacturer_name), common::ToHexString(subversion), ret);
+ "failed for handle {}, status 0x{:x}, version 0x{:x}, "
+ "manufacturer_name 0x{:x}, subversion 0x{:x}, error {}",
+ handle, status, version, manufacturer_name, subversion, ret);
}
}
@@ -526,5 +524,53 @@ void LogMetricRfcommConnectionAtClose(const Address& address,
}
}
+void LogMetricLeAudioConnectionSessionReported(
+ int32_t group_size, int32_t group_metric_id, int64_t connection_duration_nanos,
+ const std::vector<int64_t>& device_connecting_offset_nanos,
+ const std::vector<int64_t>& device_connected_offset_nanos,
+ const std::vector<int64_t>& device_connection_duration_nanos,
+ const std::vector<int32_t>& device_connection_status,
+ const std::vector<int32_t>& device_disconnection_status,
+ const std::vector<RawAddress>& device_address,
+ const std::vector<int64_t>& streaming_offset_nanos,
+ const std::vector<int64_t>& streaming_duration_nanos,
+ const std::vector<int32_t>& streaming_context_type) {
+ std::vector<int32_t> device_metric_id(device_address.size());
+ for (uint64_t i = 0; i < device_address.size(); i++) {
+ if (!device_address[i].IsEmpty()) {
+ device_metric_id[i] =
+ MetricIdManager::GetInstance().AllocateId(ToGdAddress(device_address[i]));
+ } else {
+ device_metric_id[i] = 0;
+ }
+ }
+ int ret = stats_write(LE_AUDIO_CONNECTION_SESSION_REPORTED, group_size, group_metric_id,
+ connection_duration_nanos, device_connecting_offset_nanos,
+ device_connected_offset_nanos, device_connection_duration_nanos,
+ device_connection_status, device_disconnection_status, device_metric_id,
+ streaming_offset_nanos, streaming_duration_nanos, streaming_context_type);
+ if (ret < 0) {
+ log::warn(
+ "failed for group {}device_connecting_offset_nanos[{}], "
+ "device_connected_offset_nanos[{}], "
+ "device_connection_duration_nanos[{}], device_connection_status[{}], "
+ "device_disconnection_status[{}], device_metric_id[{}], "
+ "streaming_offset_nanos[{}], streaming_duration_nanos[{}], "
+ "streaming_context_type[{}]",
+ group_metric_id, device_connecting_offset_nanos.size(),
+ device_connected_offset_nanos.size(), device_connection_duration_nanos.size(),
+ device_connection_status.size(), device_disconnection_status.size(),
+ device_metric_id.size(), streaming_offset_nanos.size(), streaming_duration_nanos.size(),
+ streaming_context_type.size());
+ }
+}
+
+void LogMetricLeAudioBroadcastSessionReported(int64_t duration_nanos) {
+ int ret = stats_write(LE_AUDIO_BROADCAST_SESSION_REPORTED, duration_nanos);
+ if (ret < 0) {
+ log::warn("failed for duration={}", duration_nanos);
+ }
+}
+
} // namespace os
} // namespace bluetooth
diff --git a/system/gd/os/chromeos/metrics.cc b/system/gd/os/chromeos/metrics.cc
index b7921fe308..de36a98780 100644
--- a/system/gd/os/chromeos/metrics.cc
+++ b/system/gd/os/chromeos/metrics.cc
@@ -216,5 +216,19 @@ void LogMetricRfcommConnectionAtClose(
android::bluetooth::BtaStatus /* sdp_status */, bool /* is_server */,
bool /* sdp_initiated */, int32_t /* sdp_duration_ms */) {}
+void LogMetricLeAudioConnectionSessionReported(
+ int32_t /*group_size*/, int32_t /*group_metric_id*/, int64_t /*connection_duration_nanos*/,
+ const std::vector<int64_t>& /*device_connecting_offset_nanos*/,
+ const std::vector<int64_t>& /*device_connected_offset_nanos*/,
+ const std::vector<int64_t>& /*device_connection_duration_nanos*/,
+ const std::vector<int32_t>& /*device_connection_status*/,
+ const std::vector<int32_t>& /*device_disconnection_status*/,
+ const std::vector<RawAddress>& /*device_address*/,
+ const std::vector<int64_t>& /*streaming_offset_nanos*/,
+ const std::vector<int64_t>& /*streaming_duration_nanos*/,
+ const std::vector<int32_t>& /*streaming_context_type*/) {}
+
+void LogMetricLeAudioBroadcastSessionReported(int64_t /*duration_nanos*/) {}
+
} // namespace os
} // namespace bluetooth
diff --git a/system/gd/os/host/metrics.cc b/system/gd/os/host/metrics.cc
index a333113238..518a29ffee 100644
--- a/system/gd/os/host/metrics.cc
+++ b/system/gd/os/host/metrics.cc
@@ -135,5 +135,19 @@ void LogMetricRfcommConnectionAtClose(
android::bluetooth::BtaStatus /* sdp_status */, bool /* is_server */,
bool /* sdp_initiated */, int32_t /* sdp_duration_ms */) {}
+void LogMetricLeAudioConnectionSessionReported(
+ int32_t /*group_size*/, int32_t /*group_metric_id*/, int64_t /*connection_duration_nanos*/,
+ const std::vector<int64_t>& /*device_connecting_offset_nanos*/,
+ const std::vector<int64_t>& /*device_connected_offset_nanos*/,
+ const std::vector<int64_t>& /*device_connection_duration_nanos*/,
+ const std::vector<int32_t>& /*device_connection_status*/,
+ const std::vector<int32_t>& /*device_disconnection_status*/,
+ const std::vector<RawAddress>& /*device_address*/,
+ const std::vector<int64_t>& /*streaming_offset_nanos*/,
+ const std::vector<int64_t>& /*streaming_duration_nanos*/,
+ const std::vector<int32_t>& /*streaming_context_type*/) {}
+
+void LogMetricLeAudioBroadcastSessionReported(int64_t /*duration_nanos*/) {}
+
} // namespace os
} // namespace bluetooth
diff --git a/system/gd/os/linux/metrics.cc b/system/gd/os/linux/metrics.cc
index 7b727f38f2..f5d1555075 100644
--- a/system/gd/os/linux/metrics.cc
+++ b/system/gd/os/linux/metrics.cc
@@ -122,5 +122,20 @@ void LogMetricRfcommConnectionAtClose(const Address& raw_address,
void LogMetricBluetoothEvent(const Address& address, android::bluetooth::EventType event_type,
android::bluetooth::State state) {}
+
+void LogMetricLeAudioConnectionSessionReported(
+ int32_t /*group_size*/, int32_t /*group_metric_id*/, int64_t /*connection_duration_nanos*/,
+ const std::vector<int64_t>& /*device_connecting_offset_nanos*/,
+ const std::vector<int64_t>& /*device_connected_offset_nanos*/,
+ const std::vector<int64_t>& /*device_connection_duration_nanos*/,
+ const std::vector<int32_t>& /*device_connection_status*/,
+ const std::vector<int32_t>& /*device_disconnection_status*/,
+ const std::vector<RawAddress>& /*device_address*/,
+ const std::vector<int64_t>& /*streaming_offset_nanos*/,
+ const std::vector<int64_t>& /*streaming_duration_nanos*/,
+ const std::vector<int32_t>& /*streaming_context_type*/) {}
+
+void LogMetricLeAudioBroadcastSessionReported(int64_t /*duration_nanos*/) {}
+
} // namespace os
} // namespace bluetooth
diff --git a/system/gd/os/metrics.h b/system/gd/os/metrics.h
index aab82826e6..04b5c37e84 100644
--- a/system/gd/os/metrics.h
+++ b/system/gd/os/metrics.h
@@ -29,8 +29,8 @@
#include "types/raw_address.h"
namespace bluetooth {
-
namespace os {
+
/**
* Unknown connection handle for metrics purpose
*/
@@ -379,6 +379,19 @@ void LogMetricRfcommConnectionAtClose(const hci::Address& address,
android::bluetooth::BtaStatus sdp_status, bool is_server,
bool sdp_initiated, int32_t sdp_duration_ms);
+void LogMetricLeAudioConnectionSessionReported(
+ int32_t group_size, int32_t group_metric_id, int64_t connection_duration_nanos,
+ const std::vector<int64_t>& device_connecting_offset_nanos,
+ const std::vector<int64_t>& device_connected_offset_nanos,
+ const std::vector<int64_t>& device_connection_duration_nanos,
+ const std::vector<int32_t>& device_connection_status,
+ const std::vector<int32_t>& device_disconnection_status,
+ const std::vector<RawAddress>& device_address,
+ const std::vector<int64_t>& streaming_offset_nanos,
+ const std::vector<int64_t>& streaming_duration_nanos,
+ const std::vector<int32_t>& streaming_context_type);
+
+void LogMetricLeAudioBroadcastSessionReported(int64_t duration_nanos);
+
} // namespace os
- //
} // namespace bluetooth
diff --git a/system/gd/rust/linux/OWNERS b/system/gd/rust/linux/OWNERS
deleted file mode 100644
index a823e6e1dd..0000000000
--- a/system/gd/rust/linux/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_chromeos
diff --git a/system/gd/rust/topshim/OWNERS b/system/gd/rust/topshim/OWNERS
deleted file mode 100644
index a823e6e1dd..0000000000
--- a/system/gd/rust/topshim/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_chromeos
diff --git a/system/gd/storage/storage_module.cc b/system/gd/storage/storage_module.cc
index 5e3459e109..5a81a5cf94 100644
--- a/system/gd/storage/storage_module.cc
+++ b/system/gd/storage/storage_module.cc
@@ -90,6 +90,13 @@ StorageModule::StorageModule(os::Handler* handler, std::string config_file_path,
StorageModule::~StorageModule() {
std::lock_guard<std::recursive_mutex> lock(mutex_);
+
+ if (!com::android::bluetooth::flags::same_handler_for_all_modules()) {
+ GetHandler()->Clear();
+ GetHandler()->WaitUntilStopped(std::chrono::milliseconds(2000));
+ delete GetHandler();
+ }
+
pimpl_.reset();
}
diff --git a/system/log/OWNERS b/system/log/OWNERS
deleted file mode 100644
index d1c75de900..0000000000
--- a/system/log/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-henrichataing@google.com
diff --git a/system/main/shim/acl.cc b/system/main/shim/acl.cc
index b2f0e23975..b01bd1f92d 100644
--- a/system/main/shim/acl.cc
+++ b/system/main/shim/acl.cc
@@ -969,11 +969,6 @@ struct shim::Acl::impl {
maximum_latency, minimum_remote_timeout, minimum_local_timeout);
}
- void LeSetDefaultSubrate(uint16_t subrate_min, uint16_t subrate_max, uint16_t max_latency,
- uint16_t cont_num, uint16_t sup_tout) {
- GetAclManager()->LeSetDefaultSubrate(subrate_min, subrate_max, max_latency, cont_num, sup_tout);
- }
-
void LeSubrateRequest(HciHandle handle, uint16_t subrate_min, uint16_t subrate_max,
uint16_t max_latency, uint16_t cont_num, uint16_t sup_tout) {
if (IsLeAcl(handle)) {
@@ -1573,12 +1568,6 @@ void shim::Acl::UpdateConnectionParameters(uint16_t handle, uint16_t conn_int_mi
conn_int_max, conn_latency, conn_timeout, min_ce_len, max_ce_len);
}
-void shim::Acl::LeSetDefaultSubrate(uint16_t subrate_min, uint16_t subrate_max,
- uint16_t max_latency, uint16_t cont_num, uint16_t sup_tout) {
- handler_->CallOn(pimpl_.get(), &Acl::impl::LeSetDefaultSubrate, subrate_min, subrate_max,
- max_latency, cont_num, sup_tout);
-}
-
void shim::Acl::LeSubrateRequest(uint16_t hci_handle, uint16_t subrate_min, uint16_t subrate_max,
uint16_t max_latency, uint16_t cont_num, uint16_t sup_tout) {
handler_->CallOn(pimpl_.get(), &Acl::impl::LeSubrateRequest, hci_handle, subrate_min, subrate_max,
diff --git a/system/main/shim/acl.h b/system/main/shim/acl.h
index bbe15d0acf..8253faf013 100644
--- a/system/main/shim/acl.h
+++ b/system/main/shim/acl.h
@@ -80,8 +80,6 @@ public:
void RemoveFromAddressResolution(const hci::AddressWithType& address_with_type);
void ClearAddressResolution();
- void LeSetDefaultSubrate(uint16_t subrate_min, uint16_t subrate_max, uint16_t max_latency,
- uint16_t cont_num, uint16_t sup_tout);
void LeSubrateRequest(uint16_t hci_handle, uint16_t subrate_min, uint16_t subrate_max,
uint16_t max_latency, uint16_t cont_num, uint16_t sup_tout);
diff --git a/system/main/shim/acl_api.cc b/system/main/shim/acl_api.cc
index 56e63e1977..0868f40f2c 100644
--- a/system/main/shim/acl_api.cc
+++ b/system/main/shim/acl_api.cc
@@ -166,12 +166,6 @@ void bluetooth::shim::ACL_ClearAddressResolution() {
void bluetooth::shim::ACL_ClearFilterAcceptList() {
Stack::GetInstance()->GetAcl()->ClearFilterAcceptList();
}
-void bluetooth::shim::ACL_LeSetDefaultSubrate(uint16_t subrate_min, uint16_t subrate_max,
- uint16_t max_latency, uint16_t cont_num,
- uint16_t sup_tout) {
- Stack::GetInstance()->GetAcl()->LeSetDefaultSubrate(subrate_min, subrate_max, max_latency,
- cont_num, sup_tout);
-}
void bluetooth::shim::ACL_LeSubrateRequest(uint16_t hci_handle, uint16_t subrate_min,
uint16_t subrate_max, uint16_t max_latency,
diff --git a/system/main/shim/acl_api.h b/system/main/shim/acl_api.h
index 6b28988ca6..b0bac16e02 100644
--- a/system/main/shim/acl_api.h
+++ b/system/main/shim/acl_api.h
@@ -49,8 +49,6 @@ void ACL_AddToAddressResolution(const tBLE_BD_ADDR& legacy_address_with_type,
void ACL_RemoveFromAddressResolution(const tBLE_BD_ADDR& legacy_address_with_type);
void ACL_ClearAddressResolution();
void ACL_ClearFilterAcceptList();
-void ACL_LeSetDefaultSubrate(uint16_t subrate_min, uint16_t subrate_max, uint16_t max_latency,
- uint16_t cont_num, uint16_t sup_tout);
void ACL_SendConnectionParameterUpdateRequest(uint16_t handle, uint16_t conn_int_min,
uint16_t conn_int_max, uint16_t conn_latency,
uint16_t conn_timeout, uint16_t min_ce_len,
diff --git a/system/main/shim/stack.cc b/system/main/shim/stack.cc
index 4560a6180f..027361875d 100644
--- a/system/main/shim/stack.cc
+++ b/system/main/shim/stack.cc
@@ -67,9 +67,9 @@ namespace shim {
struct Stack::impl {
Acl* acl_ = nullptr;
- metrics::CounterMetrics* counter_metrics_ = nullptr;
- storage::StorageModule* storage_ = nullptr;
- hal::SnoopLogger* snoop_logger_ = nullptr;
+ std::shared_ptr<metrics::CounterMetrics> counter_metrics_ = nullptr;
+ std::shared_ptr<storage::StorageModule> storage_ = nullptr;
+ std::shared_ptr<hal::SnoopLogger> snoop_logger_ = nullptr;
};
Stack::Stack() { pimpl_ = std::make_shared<Stack::impl>(); }
@@ -89,9 +89,16 @@ void Stack::StartEverything() {
stack_thread_ = new os::Thread("gd_stack_thread", os::Thread::Priority::REAL_TIME);
stack_handler_ = new os::Handler(stack_thread_);
- pimpl_->counter_metrics_ = new metrics::CounterMetrics(new Handler(stack_thread_));
- pimpl_->storage_ = new storage::StorageModule(new Handler(stack_thread_));
- pimpl_->snoop_logger_ = new hal::SnoopLogger(new Handler(stack_thread_));
+ if (com::android::bluetooth::flags::same_handler_for_all_modules()) {
+ pimpl_->counter_metrics_ = std::make_shared<metrics::CounterMetrics>(stack_handler_);
+ pimpl_->storage_ = std::make_shared<storage::StorageModule>(stack_handler_);
+ pimpl_->snoop_logger_ = std::make_shared<hal::SnoopLogger>(stack_handler_);
+ } else {
+ pimpl_->counter_metrics_ =
+ std::make_shared<metrics::CounterMetrics>(new Handler(stack_thread_));
+ pimpl_->storage_ = std::make_shared<storage::StorageModule>(new Handler(stack_thread_));
+ pimpl_->snoop_logger_ = std::make_shared<hal::SnoopLogger>(new Handler(stack_thread_));
+ }
#if TARGET_FLOSS
modules.add<sysprops::SyspropsModule>();
@@ -119,6 +126,7 @@ void Stack::StartEverything() {
}
is_running_ = true;
+ log::info("GD stack is running");
std::promise<void> promise;
auto future = promise.get_future();
@@ -168,6 +176,7 @@ void Stack::Stop() {
log::assert_that(is_running_, "Gd stack not running");
is_running_ = false;
+ log::info("GD stack is not running");
stack_handler_->Clear();
if(com::android::bluetooth::flags::same_handler_for_all_modules()) {
@@ -220,19 +229,19 @@ Acl* Stack::GetAcl() const {
metrics::CounterMetrics* Stack::GetCounterMetrics() const {
std::lock_guard<std::recursive_mutex> lock(mutex_);
log::assert_that(is_running_, "assert failed: is_running_");
- return pimpl_->counter_metrics_;
+ return pimpl_->counter_metrics_.get();
}
storage::StorageModule* Stack::GetStorage() const {
std::lock_guard<std::recursive_mutex> lock(mutex_);
log::assert_that(is_running_, "assert failed: is_running_");
- return pimpl_->storage_;
+ return pimpl_->storage_.get();
}
hal::SnoopLogger* Stack::GetSnoopLogger() const {
std::lock_guard<std::recursive_mutex> lock(mutex_);
log::assert_that(is_running_, "assert failed: is_running_");
- return pimpl_->snoop_logger_;
+ return pimpl_->snoop_logger_.get();
}
os::Handler* Stack::GetHandler() {
@@ -268,9 +277,15 @@ void Stack::handle_start_up(ModuleList* modules, std::promise<void> promise) {
void Stack::handle_shut_down(std::promise<void> promise) {
registry_.StopAll();
+
pimpl_->snoop_logger_->Stop();
pimpl_->storage_->Stop();
pimpl_->counter_metrics_->Stop();
+
+ pimpl_->snoop_logger_.reset();
+ pimpl_->storage_.reset();
+ pimpl_->counter_metrics_.reset();
+
promise.set_value();
}
diff --git a/system/stack/acl/btm_acl.cc b/system/stack/acl/btm_acl.cc
index 69afab3bfa..1a4c292d55 100644
--- a/system/stack/acl/btm_acl.cc
+++ b/system/stack/acl/btm_acl.cc
@@ -41,7 +41,6 @@
#include "bta/gatt/bta_gattc_int.h"
#include "bta/include/bta_dm_acl.h"
#include "bta/sys/bta_sys.h"
-#include "common/metrics.h"
#include "device/include/device_iot_config.h"
#include "device/include/interop.h"
#include "hci/controller_interface.h"
@@ -51,6 +50,7 @@
#include "main/shim/dumpsys.h"
#include "main/shim/entry.h"
#include "main/shim/helpers.h"
+#include "os/metrics.h"
#include "os/parameter_provider.h"
#include "osi/include/allocator.h"
#include "osi/include/properties.h"
@@ -785,10 +785,10 @@ static void btm_process_remote_version_complete(uint8_t status, uint16_t handle,
p_acl_cb->remote_version_info.valid = true;
BTM_update_version_info(p_acl_cb->RemoteAddress(), p_acl_cb->remote_version_info);
- bluetooth::common::LogRemoteVersionInfo(handle, status, lmp_version, manufacturer,
- lmp_subversion);
+ bluetooth::os::LogMetricRemoteVersionInfo(handle, status, lmp_version, manufacturer,
+ lmp_subversion);
} else {
- bluetooth::common::LogRemoteVersionInfo(handle, status, 0, 0, 0);
+ bluetooth::os::LogMetricRemoteVersionInfo(handle, status, 0, 0, 0);
}
}
diff --git a/system/stack/btm/btm_ble_sec.cc b/system/stack/btm/btm_ble_sec.cc
index cef553c79e..679e937eef 100644
--- a/system/stack/btm/btm_ble_sec.cc
+++ b/system/stack/btm/btm_ble_sec.cc
@@ -1662,6 +1662,13 @@ static bool btm_ble_complete_evt_ignore(const tBTM_SEC_DEV_REC* p_dev_rec,
p_dev_rec->bd_addr);
l2cu_start_post_bond_timer(p_dev_rec->ble_hci_handle);
return true;
+ } else if (com::android::bluetooth::flags::le_peripheral_enc_failure() &&
+ !p_dev_rec->role_central) {
+ log::warn("Peripheral encryption request failed for the bonded device {} with reason {}",
+ p_dev_rec->bd_addr, smp_status_text(p_data->complt.reason));
+ btm_sec_disconnect(p_dev_rec->ble_hci_handle, HCI_ERR_AUTH_FAILURE,
+ smp_status_text(p_data->complt.reason));
+ return true;
}
}
@@ -1702,6 +1709,11 @@ static void btm_ble_complete_evt(const RawAddress& bd_addr, tBTM_SEC_DEV_REC* p_
}
BTM_BLE_SEC_CALLBACK(BTM_LE_COMPLT_EVT, bd_addr, p_data);
+ p_dev_rec = btm_find_dev(bd_addr); // BTM_LE_COMPLT_EVT event may have removed the device
+ if (p_dev_rec == nullptr) {
+ log::warn("Device record removed {}", bd_addr);
+ return;
+ }
log::verbose("before update sec_level=0x{:x} sec_flags=0x{:x}", p_data->complt.sec_level,
p_dev_rec->sec_rec.sec_flags);
diff --git a/system/stack/btm/btm_dev.cc b/system/stack/btm/btm_dev.cc
index 92dc80e1ab..992a59236c 100644
--- a/system/stack/btm/btm_dev.cc
+++ b/system/stack/btm/btm_dev.cc
@@ -326,6 +326,10 @@ static bool is_handle_equal(void* data, void* context) {
*
******************************************************************************/
tBTM_SEC_DEV_REC* btm_find_dev_by_handle(uint16_t handle) {
+ if (handle == HCI_INVALID_HANDLE) {
+ return nullptr;
+ }
+
if (btm_sec_cb.sec_dev_rec == nullptr) {
return nullptr;
}
@@ -335,7 +339,7 @@ tBTM_SEC_DEV_REC* btm_find_dev_by_handle(uint16_t handle) {
return static_cast<tBTM_SEC_DEV_REC*>(list_node(n));
}
- return NULL;
+ return nullptr;
}
static bool is_not_same_identity_or_pseudo_address(void* data, void* context) {
diff --git a/system/stack/btm/btm_sec.cc b/system/stack/btm/btm_sec.cc
index 439fa7bc0f..4595794cab 100644
--- a/system/stack/btm/btm_sec.cc
+++ b/system/stack/btm/btm_sec.cc
@@ -38,7 +38,6 @@
#include "bta/dm/bta_dm_act.h"
#include "bta/dm/bta_dm_sec_int.h"
#include "btif/include/btif_storage.h"
-#include "common/metrics.h"
#include "common/time_util.h"
#include "device/include/device_iot_config.h"
#include "device/include/interop.h"
@@ -49,6 +48,7 @@
#include "main/shim/helpers.h"
#include "main/shim/metrics_api.h"
#include "metrics/bluetooth_event.h"
+#include "os/metrics.h"
#include "osi/include/allocator.h"
#include "osi/include/properties.h"
#include "stack/btm/btm_ble_int.h"
@@ -1924,9 +1924,8 @@ void btm_create_conn_cancel_complete(uint8_t status, const RawAddress bd_addr) {
log::verbose("btm_create_conn_cancel_complete(): in State: {} status:{}",
tBTM_SEC_CB::btm_pair_state_descr(btm_sec_cb.pairing_state), status);
bluetooth::shim::LogMetricLinkLayerConnectionEvent(
- &bd_addr, bluetooth::common::kUnknownConnectionHandle,
- android::bluetooth::DIRECTION_OUTGOING, android::bluetooth::LINK_TYPE_ACL,
- android::bluetooth::hci::CMD_CREATE_CONNECTION_CANCEL,
+ &bd_addr, bluetooth::os::kUnknownConnectionHandle, android::bluetooth::DIRECTION_OUTGOING,
+ android::bluetooth::LINK_TYPE_ACL, android::bluetooth::hci::CMD_CREATE_CONNECTION_CANCEL,
android::bluetooth::hci::EVT_COMMAND_COMPLETE, android::bluetooth::hci::BLE_EVT_UNKNOWN,
status, android::bluetooth::hci::STATUS_UNKNOWN);
@@ -3130,12 +3129,12 @@ void btm_sec_auth_complete(uint16_t handle, tHCI_STATUS status) {
p_dev_rec->sec_rec.security_required &= ~BTM_SEC_OUT_AUTHENTICATE;
if (status != HCI_SUCCESS) {
- if ((status != HCI_ERR_PEER_USER) && (status != HCI_ERR_CONN_CAUSE_LOCAL_HOST)) {
+ if (status != HCI_ERR_PEER_USER && status != HCI_ERR_CONN_CAUSE_LOCAL_HOST) {
btm_sec_send_hci_disconnect(
p_dev_rec, HCI_ERR_PEER_USER, p_dev_rec->hci_handle,
"stack::btm::btm_sec::btm_sec_auth_retry Auth fail while bonding");
}
- } else {
+ } else if (!com::android::bluetooth::flags::immediate_encryption_after_pairing()) {
BTM_LogHistory(kBtmLogTag, p_dev_rec->bd_addr, "Bonding completed",
hci_error_code_text(status));
@@ -3160,6 +3159,11 @@ void btm_sec_auth_complete(uint16_t handle, tHCI_STATUS status) {
}
l2cu_start_post_bond_timer(p_dev_rec->hci_handle);
+ } else {
+ BTM_LogHistory(kBtmLogTag, p_dev_rec->bd_addr, "Bonding completed",
+ hci_error_code_text(status));
+ BTM_SetEncryption(p_dev_rec->bd_addr, BT_TRANSPORT_BR_EDR, NULL, NULL, BTM_BLE_SEC_NONE);
+ l2cu_start_post_bond_timer(p_dev_rec->hci_handle);
}
return;
diff --git a/system/stack/btm/security_event_parser.cc b/system/stack/btm/security_event_parser.cc
index deba84b67f..b107a69cb8 100644
--- a/system/stack/btm/security_event_parser.cc
+++ b/system/stack/btm/security_event_parser.cc
@@ -22,10 +22,10 @@
#include <string>
#include "btm_sec.h"
-#include "common/metrics.h"
#include "hci/hci_packets.h"
#include "main/shim/helpers.h"
#include "main/shim/metrics_api.h"
+#include "os/metrics.h"
#include "stack/include/btm_sec_api_types.h"
#include "stack/include/hci_error_code.h"
#include "stack/include/sec_hci_link_interface.h"
@@ -35,7 +35,6 @@ using namespace bluetooth;
using namespace bluetooth::hci;
using android::bluetooth::hci::CMD_UNKNOWN;
using android::bluetooth::hci::STATUS_UNKNOWN;
-using bluetooth::common::kUnknownConnectionHandle;
namespace bluetooth::stack::btm {
namespace {
@@ -44,7 +43,7 @@ static void log_address_and_status(const Address& bda, EventCode event_code,
uint32_t cmd = android::bluetooth::hci::CMD_UNKNOWN;
uint16_t status = static_cast<uint16_t>(event_status);
uint16_t reason = android::bluetooth::hci::STATUS_UNKNOWN;
- uint16_t handle = bluetooth::common::kUnknownConnectionHandle;
+ uint16_t handle = bluetooth::os::kUnknownConnectionHandle;
int64_t value = 0;
bluetooth::shim::LogMetricClassicPairingEvent(
ToRawAddress(bda), handle, cmd, static_cast<uint16_t>(event_code), status, reason, value);
@@ -53,7 +52,7 @@ static void log_address(const Address& bda, EventCode event_code) {
uint32_t cmd = android::bluetooth::hci::CMD_UNKNOWN;
uint16_t status = android::bluetooth::hci::STATUS_UNKNOWN;
uint16_t reason = android::bluetooth::hci::STATUS_UNKNOWN;
- uint16_t handle = bluetooth::common::kUnknownConnectionHandle;
+ uint16_t handle = bluetooth::os::kUnknownConnectionHandle;
int64_t value = 0;
bluetooth::shim::LogMetricClassicPairingEvent(
ToRawAddress(bda), handle, cmd, static_cast<uint16_t>(event_code), status, reason, value);
diff --git a/system/stack/btu/btu_hcif.cc b/system/stack/btu/btu_hcif.cc
index ee3c9757a5..367c8a89c8 100644
--- a/system/stack/btu/btu_hcif.cc
+++ b/system/stack/btu/btu_hcif.cc
@@ -37,10 +37,10 @@
#include <cstdint>
#include "btm_iso_api.h"
-#include "common/metrics.h"
#include "internal_include/bt_target.h"
#include "main/shim/hci_layer.h"
#include "main/shim/metrics_api.h"
+#include "os/metrics.h"
#include "osi/include/allocator.h"
#include "stack/include/acl_api.h"
#include "stack/include/acl_hci_link_interface.h"
@@ -110,7 +110,7 @@ static void btu_hcif_log_event_metrics(uint8_t evt_code, const uint8_t* p_event)
uint32_t cmd = android::bluetooth::hci::CMD_UNKNOWN;
uint16_t status = android::bluetooth::hci::STATUS_UNKNOWN;
uint16_t reason = android::bluetooth::hci::STATUS_UNKNOWN;
- uint16_t handle = bluetooth::common::kUnknownConnectionHandle;
+ uint16_t handle = bluetooth::os::kUnknownConnectionHandle;
int64_t value = 0;
RawAddress bda = RawAddress::kEmpty;
@@ -375,7 +375,7 @@ static void btu_hcif_log_command_metrics(uint16_t opcode, const uint8_t* p_cmd,
case HCI_CREATE_CONNECTION_CANCEL:
STREAM_TO_BDADDR(bd_addr, p_cmd);
bluetooth::shim::LogMetricLinkLayerConnectionEvent(
- &bd_addr, bluetooth::common::kUnknownConnectionHandle,
+ &bd_addr, bluetooth::os::kUnknownConnectionHandle,
android::bluetooth::DIRECTION_OUTGOING, android::bluetooth::LINK_TYPE_ACL, opcode,
hci_event, kUnknownBleEvt, cmd_status, android::bluetooth::hci::STATUS_UNKNOWN);
break;
@@ -400,7 +400,7 @@ static void btu_hcif_log_command_metrics(uint16_t opcode, const uint8_t* p_cmd,
case HCI_ENH_ACCEPT_ESCO_CONNECTION:
STREAM_TO_BDADDR(bd_addr, p_cmd);
bluetooth::shim::LogMetricLinkLayerConnectionEvent(
- &bd_addr, bluetooth::common::kUnknownConnectionHandle,
+ &bd_addr, bluetooth::os::kUnknownConnectionHandle,
android::bluetooth::DIRECTION_INCOMING, android::bluetooth::LINK_TYPE_UNKNOWN, opcode,
hci_event, kUnknownBleEvt, cmd_status, android::bluetooth::hci::STATUS_UNKNOWN);
break;
@@ -409,7 +409,7 @@ static void btu_hcif_log_command_metrics(uint16_t opcode, const uint8_t* p_cmd,
STREAM_TO_BDADDR(bd_addr, p_cmd);
STREAM_TO_UINT8(reason, p_cmd);
bluetooth::shim::LogMetricLinkLayerConnectionEvent(
- &bd_addr, bluetooth::common::kUnknownConnectionHandle,
+ &bd_addr, bluetooth::os::kUnknownConnectionHandle,
android::bluetooth::DIRECTION_INCOMING, android::bluetooth::LINK_TYPE_UNKNOWN, opcode,
hci_event, kUnknownBleEvt, cmd_status, reason);
break;
@@ -439,7 +439,7 @@ static void btu_hcif_log_command_metrics(uint16_t opcode, const uint8_t* p_cmd,
// - When doing non-acceptlist connection
// - When there is an error in command status
bluetooth::shim::LogMetricLinkLayerConnectionEvent(
- bd_addr_p, bluetooth::common::kUnknownConnectionHandle,
+ bd_addr_p, bluetooth::os::kUnknownConnectionHandle,
android::bluetooth::DIRECTION_OUTGOING, android::bluetooth::LINK_TYPE_ACL, opcode,
hci_event, kUnknownBleEvt, cmd_status, android::bluetooth::hci::STATUS_UNKNOWN);
}
@@ -464,7 +464,7 @@ static void btu_hcif_log_command_metrics(uint16_t opcode, const uint8_t* p_cmd,
// - When doing non-acceptlist connection
// - When there is an error in command status
bluetooth::shim::LogMetricLinkLayerConnectionEvent(
- bd_addr_p, bluetooth::common::kUnknownConnectionHandle,
+ bd_addr_p, bluetooth::os::kUnknownConnectionHandle,
android::bluetooth::DIRECTION_OUTGOING, android::bluetooth::LINK_TYPE_ACL, opcode,
hci_event, kUnknownBleEvt, cmd_status, android::bluetooth::hci::STATUS_UNKNOWN);
}
@@ -474,7 +474,7 @@ static void btu_hcif_log_command_metrics(uint16_t opcode, const uint8_t* p_cmd,
if (cmd_status != HCI_SUCCESS && !is_cmd_status) {
// Only log errors to prevent log spam due to acceptlist connections
bluetooth::shim::LogMetricLinkLayerConnectionEvent(
- nullptr, bluetooth::common::kUnknownConnectionHandle,
+ nullptr, bluetooth::os::kUnknownConnectionHandle,
android::bluetooth::DIRECTION_OUTGOING, android::bluetooth::LINK_TYPE_ACL, opcode,
hci_event, kUnknownBleEvt, cmd_status, android::bluetooth::hci::STATUS_UNKNOWN);
}
@@ -482,14 +482,14 @@ static void btu_hcif_log_command_metrics(uint16_t opcode, const uint8_t* p_cmd,
case HCI_READ_LOCAL_OOB_DATA:
case HCI_READ_LOCAL_OOB_EXTENDED_DATA:
bluetooth::shim::LogMetricClassicPairingEvent(
- RawAddress::kEmpty, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event,
+ RawAddress::kEmpty, bluetooth::os::kUnknownConnectionHandle, opcode, hci_event,
cmd_status, android::bluetooth::hci::STATUS_UNKNOWN, 0);
break;
case HCI_WRITE_SIMPLE_PAIRING_MODE: {
uint8_t simple_pairing_mode;
STREAM_TO_UINT8(simple_pairing_mode, p_cmd);
bluetooth::shim::LogMetricClassicPairingEvent(
- RawAddress::kEmpty, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event,
+ RawAddress::kEmpty, bluetooth::os::kUnknownConnectionHandle, opcode, hci_event,
cmd_status, android::bluetooth::hci::STATUS_UNKNOWN, simple_pairing_mode);
break;
}
@@ -497,7 +497,7 @@ static void btu_hcif_log_command_metrics(uint16_t opcode, const uint8_t* p_cmd,
uint8_t secure_conn_host_support;
STREAM_TO_UINT8(secure_conn_host_support, p_cmd);
bluetooth::shim::LogMetricClassicPairingEvent(
- RawAddress::kEmpty, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event,
+ RawAddress::kEmpty, bluetooth::os::kUnknownConnectionHandle, opcode, hci_event,
cmd_status, android::bluetooth::hci::STATUS_UNKNOWN, secure_conn_host_support);
break;
}
@@ -521,7 +521,7 @@ static void btu_hcif_log_command_metrics(uint16_t opcode, const uint8_t* p_cmd,
STREAM_TO_BDADDR(bd_addr, p_cmd);
STREAM_TO_UINT8(delete_all_flag, p_cmd);
bluetooth::shim::LogMetricClassicPairingEvent(
- bd_addr, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, cmd_status,
+ bd_addr, bluetooth::os::kUnknownConnectionHandle, opcode, hci_event, cmd_status,
android::bluetooth::hci::STATUS_UNKNOWN, delete_all_flag);
break;
}
@@ -538,15 +538,15 @@ static void btu_hcif_log_command_metrics(uint16_t opcode, const uint8_t* p_cmd,
case HCI_REM_OOB_DATA_REQ_NEG_REPLY:
STREAM_TO_BDADDR(bd_addr, p_cmd);
bluetooth::shim::LogMetricClassicPairingEvent(
- bd_addr, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, cmd_status,
+ bd_addr, bluetooth::os::kUnknownConnectionHandle, opcode, hci_event, cmd_status,
android::bluetooth::hci::STATUS_UNKNOWN, 0);
break;
case HCI_IO_CAP_REQ_NEG_REPLY:
STREAM_TO_BDADDR(bd_addr, p_cmd);
STREAM_TO_UINT8(reason, p_cmd);
bluetooth::shim::LogMetricClassicPairingEvent(bd_addr,
- bluetooth::common::kUnknownConnectionHandle,
- opcode, hci_event, cmd_status, reason, 0);
+ bluetooth::os::kUnknownConnectionHandle, opcode,
+ hci_event, cmd_status, reason, 0);
break;
}
}
@@ -611,8 +611,8 @@ static void btu_hcif_log_command_complete_metrics(uint16_t opcode, const uint8_t
case HCI_WRITE_SECURE_CONNS_SUPPORT:
STREAM_TO_UINT8(status, p_return_params);
bluetooth::shim::LogMetricClassicPairingEvent(RawAddress::kEmpty,
- bluetooth::common::kUnknownConnectionHandle,
- opcode, hci_event, status, reason, 0);
+ bluetooth::os::kUnknownConnectionHandle, opcode,
+ hci_event, status, reason, 0);
break;
case HCI_READ_ENCR_KEY_SIZE: {
uint16_t handle;
@@ -637,8 +637,8 @@ static void btu_hcif_log_command_complete_metrics(uint16_t opcode, const uint8_t
STREAM_TO_UINT8(status, p_return_params);
STREAM_TO_BDADDR(bd_addr, p_return_params);
bluetooth::shim::LogMetricClassicPairingEvent(bd_addr,
- bluetooth::common::kUnknownConnectionHandle,
- opcode, hci_event, status, reason, 0);
+ bluetooth::os::kUnknownConnectionHandle, opcode,
+ hci_event, status, reason, 0);
break;
}
}
diff --git a/system/stack/eatt/eatt_impl.h b/system/stack/eatt/eatt_impl.h
index 0d27726af4..b602636f0d 100644
--- a/system/stack/eatt/eatt_impl.h
+++ b/system/stack/eatt/eatt_impl.h
@@ -723,11 +723,7 @@ struct eatt_impl {
tGATT_TCB* p_tcb = gatt_find_tcb_by_addr(channel->bda_, BT_TRANSPORT_LE);
log::warn("disconnecting channel {:#x} for {}", channel->cid_, channel->bda_);
- if (com::android::bluetooth::flags::gatt_disconnect_fix()) {
- EattExtension::GetInstance()->Disconnect(channel->bda_, channel->cid_);
- } else {
- gatt_disconnect(p_tcb);
- }
+ EattExtension::GetInstance()->Disconnect(channel->bda_, channel->cid_);
}
void start_indication_confirm_timer(const RawAddress& bd_addr, uint16_t cid) {
diff --git a/system/stack/gatt/gatt_api.cc b/system/stack/gatt/gatt_api.cc
index 7b1a425f5e..bb5641d97d 100644
--- a/system/stack/gatt/gatt_api.cc
+++ b/system/stack/gatt/gatt_api.cc
@@ -75,8 +75,7 @@ static tGATT_HDL_LIST_ELEM& gatt_add_an_item_to_list(uint16_t s_handle) {
return *rit;
}
-static tGATT_IF GATT_Register_Dynamic(const Uuid& app_uuid128, const std::string& name,
- tGATT_CBACK* p_cb_info, bool eatt_support);
+static tGATT_IF GATT_FindNextFreeClRcbId();
/*****************************************************************************
*
@@ -1229,63 +1228,6 @@ void GATT_SetIdleTimeout(const RawAddress& bd_addr, uint16_t idle_tout, tBT_TRAN
******************************************************************************/
tGATT_IF GATT_Register(const Uuid& app_uuid128, const std::string& name, tGATT_CBACK* p_cb_info,
bool eatt_support) {
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- return GATT_Register_Dynamic(app_uuid128, name, p_cb_info, eatt_support);
- }
- tGATT_REG* p_reg;
- uint8_t i_gatt_if = 0;
- tGATT_IF gatt_if = 0;
-
- for (i_gatt_if = 0, p_reg = gatt_cb.cl_rcb; i_gatt_if < GATT_MAX_APPS; i_gatt_if++, p_reg++) {
- if (p_reg->in_use && p_reg->app_uuid128 == app_uuid128) {
- log::error("Application already registered, uuid={}", app_uuid128.ToString());
- return 0;
- }
- }
-
- if (stack_config_get_interface()->get_pts_use_eatt_for_all_services()) {
- log::info("PTS: Force to use EATT for servers");
- eatt_support = true;
- }
-
- for (i_gatt_if = 0, p_reg = gatt_cb.cl_rcb; i_gatt_if < GATT_MAX_APPS; i_gatt_if++, p_reg++) {
- if (!p_reg->in_use) {
- *p_reg = {};
- i_gatt_if++; /* one based number */
- p_reg->app_uuid128 = app_uuid128;
- gatt_if = p_reg->gatt_if = (tGATT_IF)i_gatt_if;
- p_reg->app_cb = *p_cb_info;
- p_reg->in_use = true;
- p_reg->eatt_support = eatt_support;
- p_reg->name = name;
- log::info("Allocated name:{} uuid:{} gatt_if:{} eatt_support:{}", name,
- app_uuid128.ToString(), gatt_if, eatt_support);
- return gatt_if;
- }
- }
-
- log::error("Unable to register GATT client, MAX client reached: {}", GATT_MAX_APPS);
- return 0;
-}
-
-static tGATT_IF GATT_FindNextFreeClRcbId() {
- tGATT_IF gatt_if = gatt_cb.last_gatt_if;
- for (int i = 0; i < GATT_IF_MAX; i++) {
- if (++gatt_if > GATT_IF_MAX) {
- gatt_if = static_cast<tGATT_IF>(1);
- }
- if (!gatt_cb.cl_rcb_map.contains(gatt_if)) {
- gatt_cb.last_gatt_if = gatt_if;
- return gatt_if;
- }
- }
- log::error("Unable to register GATT client, MAX client reached: {}", gatt_cb.cl_rcb_map.size());
-
- return GATT_IF_INVALID;
-}
-
-static tGATT_IF GATT_Register_Dynamic(const Uuid& app_uuid128, const std::string& name,
- tGATT_CBACK* p_cb_info, bool eatt_support) {
for (auto& [gatt_if, p_reg] : gatt_cb.cl_rcb_map) {
if (p_reg->app_uuid128 == app_uuid128) {
log::error("Application already registered, uuid={}", app_uuid128.ToString());
@@ -1322,6 +1264,22 @@ static tGATT_IF GATT_Register_Dynamic(const Uuid& app_uuid128, const std::string
return gatt_if;
}
+static tGATT_IF GATT_FindNextFreeClRcbId() {
+ tGATT_IF gatt_if = gatt_cb.last_gatt_if;
+ for (int i = 0; i < GATT_IF_MAX; i++) {
+ if (++gatt_if > GATT_IF_MAX) {
+ gatt_if = static_cast<tGATT_IF>(1);
+ }
+ if (!gatt_cb.cl_rcb_map.contains(gatt_if)) {
+ gatt_cb.last_gatt_if = gatt_if;
+ return gatt_if;
+ }
+ }
+ log::error("Unable to register GATT client, MAX client reached: {}", gatt_cb.cl_rcb_map.size());
+
+ return GATT_IF_INVALID;
+}
+
/*******************************************************************************
*
* Function GATT_Deregister
@@ -1385,11 +1343,7 @@ void GATT_Deregister(tGATT_IF gatt_if) {
connection_manager::on_app_deregistered(gatt_if);
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- gatt_cb.cl_rcb_map.erase(gatt_if);
- } else {
- *p_reg = {};
- }
+ gatt_cb.cl_rcb_map.erase(gatt_if);
}
/*******************************************************************************
diff --git a/system/stack/gatt/gatt_auth.cc b/system/stack/gatt/gatt_auth.cc
index 7c4b935389..34dcb4886b 100644
--- a/system/stack/gatt/gatt_auth.cc
+++ b/system/stack/gatt/gatt_auth.cc
@@ -23,7 +23,6 @@
******************************************************************************/
#include <bluetooth/log.h>
-#include <com_android_bluetooth_flags.h>
#include <string.h>
#include "gatt_api.h"
@@ -216,17 +215,9 @@ void gatt_notify_enc_cmpl(const RawAddress& bd_addr) {
return;
}
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- for (auto& [i, p_rcb] : gatt_cb.cl_rcb_map) {
- if (p_rcb->app_cb.p_enc_cmpl_cb) {
- (*p_rcb->app_cb.p_enc_cmpl_cb)(p_rcb->gatt_if, bd_addr);
- }
- }
- } else {
- for (uint8_t i = 0; i < GATT_MAX_APPS; i++) {
- if (gatt_cb.cl_rcb[i].in_use && gatt_cb.cl_rcb[i].app_cb.p_enc_cmpl_cb) {
- (*gatt_cb.cl_rcb[i].app_cb.p_enc_cmpl_cb)(gatt_cb.cl_rcb[i].gatt_if, bd_addr);
- }
+ for (auto& [i, p_rcb] : gatt_cb.cl_rcb_map) {
+ if (p_rcb->app_cb.p_enc_cmpl_cb) {
+ (*p_rcb->app_cb.p_enc_cmpl_cb)(p_rcb->gatt_if, bd_addr);
}
}
diff --git a/system/stack/gatt/gatt_cl.cc b/system/stack/gatt/gatt_cl.cc
index 9a241813ae..8496d425a1 100644
--- a/system/stack/gatt/gatt_cl.cc
+++ b/system/stack/gatt/gatt_cl.cc
@@ -25,7 +25,6 @@
#define LOG_TAG "bluetooth"
#include <bluetooth/log.h>
-#include <com_android_bluetooth_flags.h>
#include <string.h>
#include "gatt_int.h"
@@ -708,17 +707,9 @@ static void gatt_process_notification(tGATT_TCB& tcb, uint16_t cid, uint8_t op_c
// notification/indication
// Note: need to do the indication count and start timer first then do
// callback
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- for (auto& [i, p_reg] : gatt_cb.cl_rcb_map) {
- if (p_reg->in_use && p_reg->app_cb.p_cmpl_cb) {
- tcb.ind_count++;
- }
- }
- } else {
- for (i = 0, p_reg = gatt_cb.cl_rcb; i < GATT_MAX_APPS; i++, p_reg++) {
- if (p_reg->in_use && p_reg->app_cb.p_cmpl_cb) {
- tcb.ind_count++;
- }
+ for (auto& [i, p_reg] : gatt_cb.cl_rcb_map) {
+ if (p_reg->in_use && p_reg->app_cb.p_cmpl_cb) {
+ tcb.ind_count++;
}
}
@@ -738,19 +729,10 @@ static void gatt_process_notification(tGATT_TCB& tcb, uint16_t cid, uint8_t op_c
gatt_cl_complete.att_value = value;
gatt_cl_complete.cid = cid;
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- for (auto& [i, p_reg] : gatt_cb.cl_rcb_map) {
- if (p_reg->in_use && p_reg->app_cb.p_cmpl_cb) {
- conn_id = gatt_create_conn_id(tcb.tcb_idx, p_reg->gatt_if);
- (*p_reg->app_cb.p_cmpl_cb)(conn_id, event, encrypt_status, &gatt_cl_complete);
- }
- }
- } else {
- for (i = 0, p_reg = gatt_cb.cl_rcb; i < GATT_MAX_APPS; i++, p_reg++) {
- if (p_reg->in_use && p_reg->app_cb.p_cmpl_cb) {
- conn_id = gatt_create_conn_id(tcb.tcb_idx, p_reg->gatt_if);
- (*p_reg->app_cb.p_cmpl_cb)(conn_id, event, encrypt_status, &gatt_cl_complete);
- }
+ for (auto& [i, p_reg] : gatt_cb.cl_rcb_map) {
+ if (p_reg->in_use && p_reg->app_cb.p_cmpl_cb) {
+ conn_id = gatt_create_conn_id(tcb.tcb_idx, p_reg->gatt_if);
+ (*p_reg->app_cb.p_cmpl_cb)(conn_id, event, encrypt_status, &gatt_cl_complete);
}
}
@@ -788,19 +770,10 @@ static void gatt_process_notification(tGATT_TCB& tcb, uint16_t cid, uint8_t op_c
gatt_cl_complete.att_value = value;
gatt_cl_complete.cid = cid;
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- for (auto& [i, p_reg] : gatt_cb.cl_rcb_map) {
- if (p_reg->in_use && p_reg->app_cb.p_cmpl_cb) {
- conn_id = gatt_create_conn_id(tcb.tcb_idx, p_reg->gatt_if);
- (*p_reg->app_cb.p_cmpl_cb)(conn_id, event, encrypt_status, &gatt_cl_complete);
- }
- }
- } else {
- for (i = 0, p_reg = gatt_cb.cl_rcb; i < GATT_MAX_APPS; i++, p_reg++) {
- if (p_reg->in_use && p_reg->app_cb.p_cmpl_cb) {
- conn_id = gatt_create_conn_id(tcb.tcb_idx, p_reg->gatt_if);
- (*p_reg->app_cb.p_cmpl_cb)(conn_id, event, encrypt_status, &gatt_cl_complete);
- }
+ for (auto& [i, p_reg] : gatt_cb.cl_rcb_map) {
+ if (p_reg->in_use && p_reg->app_cb.p_cmpl_cb) {
+ conn_id = gatt_create_conn_id(tcb.tcb_idx, p_reg->gatt_if);
+ (*p_reg->app_cb.p_cmpl_cb)(conn_id, event, encrypt_status, &gatt_cl_complete);
}
}
}
diff --git a/system/stack/gatt/gatt_main.cc b/system/stack/gatt/gatt_main.cc
index 56d268422c..5228369a26 100644
--- a/system/stack/gatt/gatt_main.cc
+++ b/system/stack/gatt/gatt_main.cc
@@ -282,7 +282,7 @@ bool gatt_disconnect(tGATT_TCB* p_tcb) {
return true;
}
- if (com::android::bluetooth::flags::gatt_disconnect_fix() && p_tcb->eatt) {
+ if (p_tcb->eatt) {
/* ATT is fixed channel and it is expected to drop ACL.
* Make sure all EATT channels are disconnected before doing that.
*/
@@ -624,21 +624,10 @@ static void gatt_channel_congestion(tGATT_TCB* p_tcb, bool congested) {
gatt_cl_send_next_cmd_inq(*p_tcb);
}
/* notifying all applications for the connection up event */
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- for (auto& [i, p_reg] : gatt_cb.cl_rcb_map) {
- if (p_reg->in_use && p_reg->app_cb.p_congestion_cb) {
- conn_id = gatt_create_conn_id(p_tcb->tcb_idx, p_reg->gatt_if);
- (*p_reg->app_cb.p_congestion_cb)(conn_id, congested);
- }
- }
- } else {
- for (i = 0, p_reg = gatt_cb.cl_rcb; i < GATT_MAX_APPS; i++, p_reg++) {
- if (p_reg->in_use) {
- if (p_reg->app_cb.p_congestion_cb) {
- conn_id = gatt_create_conn_id(p_tcb->tcb_idx, p_reg->gatt_if);
- (*p_reg->app_cb.p_congestion_cb)(conn_id, congested);
- }
- }
+ for (auto& [i, p_reg] : gatt_cb.cl_rcb_map) {
+ if (p_reg->in_use && p_reg->app_cb.p_congestion_cb) {
+ conn_id = gatt_create_conn_id(p_tcb->tcb_idx, p_reg->gatt_if);
+ (*p_reg->app_cb.p_congestion_cb)(conn_id, congested);
}
}
}
@@ -658,20 +647,10 @@ void gatt_notify_phy_updated(tHCI_STATUS status, uint16_t handle, uint8_t tx_phy
// TODO: Clean up this status conversion.
tGATT_STATUS gatt_status = static_cast<tGATT_STATUS>(status);
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- for (auto& [i, p_reg] : gatt_cb.cl_rcb_map) {
- if (p_reg->in_use && p_reg->app_cb.p_phy_update_cb) {
- tCONN_ID conn_id = gatt_create_conn_id(p_tcb->tcb_idx, p_reg->gatt_if);
- (*p_reg->app_cb.p_phy_update_cb)(p_reg->gatt_if, conn_id, tx_phy, rx_phy, gatt_status);
- }
- }
- } else {
- for (int i = 0; i < GATT_MAX_APPS; i++) {
- tGATT_REG* p_reg = &gatt_cb.cl_rcb[i];
- if (p_reg->in_use && p_reg->app_cb.p_phy_update_cb) {
- tCONN_ID conn_id = gatt_create_conn_id(p_tcb->tcb_idx, p_reg->gatt_if);
- (*p_reg->app_cb.p_phy_update_cb)(p_reg->gatt_if, conn_id, tx_phy, rx_phy, gatt_status);
- }
+ for (auto& [i, p_reg] : gatt_cb.cl_rcb_map) {
+ if (p_reg->in_use && p_reg->app_cb.p_phy_update_cb) {
+ tCONN_ID conn_id = gatt_create_conn_id(p_tcb->tcb_idx, p_reg->gatt_if);
+ (*p_reg->app_cb.p_phy_update_cb)(p_reg->gatt_if, conn_id, tx_phy, rx_phy, gatt_status);
}
}
}
@@ -684,22 +663,11 @@ void gatt_notify_conn_update(const RawAddress& remote, uint16_t interval, uint16
return;
}
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- for (auto& [i, p_reg] : gatt_cb.cl_rcb_map) {
- if (p_reg->in_use && p_reg->app_cb.p_conn_update_cb) {
- tCONN_ID conn_id = gatt_create_conn_id(p_tcb->tcb_idx, p_reg->gatt_if);
- (*p_reg->app_cb.p_conn_update_cb)(p_reg->gatt_if, conn_id, interval, latency, timeout,
- static_cast<tGATT_STATUS>(status));
- }
- }
- } else {
- for (int i = 0; i < GATT_MAX_APPS; i++) {
- tGATT_REG* p_reg = &gatt_cb.cl_rcb[i];
- if (p_reg->in_use && p_reg->app_cb.p_conn_update_cb) {
- tCONN_ID conn_id = gatt_create_conn_id(p_tcb->tcb_idx, p_reg->gatt_if);
- (*p_reg->app_cb.p_conn_update_cb)(p_reg->gatt_if, conn_id, interval, latency, timeout,
- static_cast<tGATT_STATUS>(status));
- }
+ for (auto& [i, p_reg] : gatt_cb.cl_rcb_map) {
+ if (p_reg->in_use && p_reg->app_cb.p_conn_update_cb) {
+ tCONN_ID conn_id = gatt_create_conn_id(p_tcb->tcb_idx, p_reg->gatt_if);
+ (*p_reg->app_cb.p_conn_update_cb)(p_reg->gatt_if, conn_id, interval, latency, timeout,
+ static_cast<tGATT_STATUS>(status));
}
}
}
@@ -717,22 +685,11 @@ void gatt_notify_subrate_change(uint16_t handle, uint16_t subrate_factor, uint16
return;
}
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- for (auto& [i, p_reg] : gatt_cb.cl_rcb_map) {
- if (p_reg->in_use && p_reg->app_cb.p_subrate_chg_cb) {
- tCONN_ID conn_id = gatt_create_conn_id(p_tcb->tcb_idx, p_reg->gatt_if);
- (*p_reg->app_cb.p_subrate_chg_cb)(p_reg->gatt_if, conn_id, subrate_factor, latency,
- cont_num, timeout, static_cast<tGATT_STATUS>(status));
- }
- }
- } else {
- for (int i = 0; i < GATT_MAX_APPS; i++) {
- tGATT_REG* p_reg = &gatt_cb.cl_rcb[i];
- if (p_reg->in_use && p_reg->app_cb.p_subrate_chg_cb) {
- tCONN_ID conn_id = gatt_create_conn_id(p_tcb->tcb_idx, p_reg->gatt_if);
- (*p_reg->app_cb.p_subrate_chg_cb)(p_reg->gatt_if, conn_id, subrate_factor, latency,
- cont_num, timeout, static_cast<tGATT_STATUS>(status));
- }
+ for (auto& [i, p_reg] : gatt_cb.cl_rcb_map) {
+ if (p_reg->in_use && p_reg->app_cb.p_subrate_chg_cb) {
+ tCONN_ID conn_id = gatt_create_conn_id(p_tcb->tcb_idx, p_reg->gatt_if);
+ (*p_reg->app_cb.p_subrate_chg_cb)(p_reg->gatt_if, conn_id, subrate_factor, latency, cont_num,
+ timeout, static_cast<tGATT_STATUS>(status));
}
}
}
@@ -976,37 +933,19 @@ static void gatt_send_conn_cback(tGATT_TCB* p_tcb) {
/* notifying all applications for the connection up event */
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- for (auto& [i, p_reg] : gatt_cb.cl_rcb_map) {
- if (!p_reg->in_use) {
- continue;
- }
-
- if (apps.find(p_reg->gatt_if) != apps.end()) {
- gatt_update_app_use_link_flag(p_reg->gatt_if, p_tcb, true, true);
- }
-
- if (p_reg->app_cb.p_conn_cb) {
- conn_id = gatt_create_conn_id(p_tcb->tcb_idx, p_reg->gatt_if);
- (*p_reg->app_cb.p_conn_cb)(p_reg->gatt_if, p_tcb->peer_bda, conn_id, kGattConnected,
- GATT_CONN_OK, p_tcb->transport);
- }
+ for (auto& [i, p_reg] : gatt_cb.cl_rcb_map) {
+ if (!p_reg->in_use) {
+ continue;
}
- } else {
- for (i = 0, p_reg = gatt_cb.cl_rcb; i < GATT_MAX_APPS; i++, p_reg++) {
- if (!p_reg->in_use) {
- continue;
- }
- if (apps.find(p_reg->gatt_if) != apps.end()) {
- gatt_update_app_use_link_flag(p_reg->gatt_if, p_tcb, true, true);
- }
+ if (apps.find(p_reg->gatt_if) != apps.end()) {
+ gatt_update_app_use_link_flag(p_reg->gatt_if, p_tcb, true, true);
+ }
- if (p_reg->app_cb.p_conn_cb) {
- conn_id = gatt_create_conn_id(p_tcb->tcb_idx, p_reg->gatt_if);
- (*p_reg->app_cb.p_conn_cb)(p_reg->gatt_if, p_tcb->peer_bda, conn_id, kGattConnected,
- GATT_CONN_OK, p_tcb->transport);
- }
+ if (p_reg->app_cb.p_conn_cb) {
+ conn_id = gatt_create_conn_id(p_tcb->tcb_idx, p_reg->gatt_if);
+ (*p_reg->app_cb.p_conn_cb)(p_reg->gatt_if, p_tcb->peer_bda, conn_id, kGattConnected,
+ GATT_CONN_OK, p_tcb->transport);
}
}
diff --git a/system/stack/gatt/gatt_sr.cc b/system/stack/gatt/gatt_sr.cc
index 133080c1db..f23b8b5dc9 100644
--- a/system/stack/gatt/gatt_sr.cc
+++ b/system/stack/gatt/gatt_sr.cc
@@ -407,27 +407,14 @@ static void gatt_process_exec_write_req(tGATT_TCB& tcb, uint16_t cid, uint8_t op
trans_id = gatt_sr_enqueue_cmd(tcb, cid, op_code, 0);
gatt_sr_copy_prep_cnt_to_cback_cnt(tcb);
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- auto prep_cnt_it = tcb.prep_cnt_map.begin();
- while (prep_cnt_it != tcb.prep_cnt_map.end()) {
- gatt_if = prep_cnt_it->first;
- conn_id = gatt_create_conn_id(tcb.tcb_idx, gatt_if);
- tGATTS_DATA gatts_data;
- gatts_data.exec_write = flag;
- gatt_sr_send_req_callback(conn_id, trans_id, GATTS_REQ_TYPE_WRITE_EXEC, &gatts_data);
- prep_cnt_it = tcb.prep_cnt_map.erase(prep_cnt_it);
- }
- } else {
- for (uint8_t i = 0; i < GATT_MAX_APPS; i++) {
- if (tcb.prep_cnt[i]) {
- gatt_if = (tGATT_IF)(i + 1);
- conn_id = gatt_create_conn_id(tcb.tcb_idx, gatt_if);
- tGATTS_DATA gatts_data;
- gatts_data.exec_write = flag;
- gatt_sr_send_req_callback(conn_id, trans_id, GATTS_REQ_TYPE_WRITE_EXEC, &gatts_data);
- tcb.prep_cnt[i] = 0;
- }
- }
+ auto prep_cnt_it = tcb.prep_cnt_map.begin();
+ while (prep_cnt_it != tcb.prep_cnt_map.end()) {
+ gatt_if = prep_cnt_it->first;
+ conn_id = gatt_create_conn_id(tcb.tcb_idx, gatt_if);
+ tGATTS_DATA gatts_data;
+ gatts_data.exec_write = flag;
+ gatt_sr_send_req_callback(conn_id, trans_id, GATTS_REQ_TYPE_WRITE_EXEC, &gatts_data);
+ prep_cnt_it = tcb.prep_cnt_map.erase(prep_cnt_it);
}
} else { /* nothing needs to be executed , send response now */
log::warn("gatt_process_exec_write_req: no prepare write pending");
@@ -911,19 +898,10 @@ static void gatts_process_mtu_req(tGATT_TCB& tcb, uint16_t cid, uint16_t len, ui
gatts_data.mtu = tcb.payload_size;
/* Notify all registered application with new MTU size. Use a transaction ID */
/* of 0, as no response is allowed from applications */
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- for (auto& [i, p_reg] : gatt_cb.cl_rcb_map) {
- if (p_reg->in_use) {
- tCONN_ID conn_id = gatt_create_conn_id(tcb.tcb_idx, p_reg->gatt_if);
- gatt_sr_send_req_callback(conn_id, 0, GATTS_REQ_TYPE_MTU, &gatts_data);
- }
- }
- } else {
- for (int i = 0; i < GATT_MAX_APPS; i++) {
- if (gatt_cb.cl_rcb[i].in_use) {
- tCONN_ID conn_id = gatt_create_conn_id(tcb.tcb_idx, gatt_cb.cl_rcb[i].gatt_if);
- gatt_sr_send_req_callback(conn_id, 0, GATTS_REQ_TYPE_MTU, &gatts_data);
- }
+ for (auto& [i, p_reg] : gatt_cb.cl_rcb_map) {
+ if (p_reg->in_use) {
+ tCONN_ID conn_id = gatt_create_conn_id(tcb.tcb_idx, p_reg->gatt_if);
+ gatt_sr_send_req_callback(conn_id, 0, GATTS_REQ_TYPE_MTU, &gatts_data);
}
}
}
diff --git a/system/stack/gatt/gatt_utils.cc b/system/stack/gatt/gatt_utils.cc
index f401be9285..28590330c5 100644
--- a/system/stack/gatt/gatt_utils.cc
+++ b/system/stack/gatt/gatt_utils.cc
@@ -24,7 +24,6 @@
#define LOG_TAG "gatt_utils"
#include <bluetooth/log.h>
-#include <com_android_bluetooth_flags.h>
#include <cstdint>
#include <deque>
@@ -1043,21 +1042,12 @@ tGATT_REG* gatt_get_regcb(tGATT_IF gatt_if) {
uint8_t ii = (uint8_t)gatt_if;
tGATT_REG* p_reg = NULL;
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- auto it = gatt_cb.cl_rcb_map.find(gatt_if);
- if (it == gatt_cb.cl_rcb_map.end()) {
- log::warn("unknown gatt_if = {}", ii);
- return NULL;
- }
- p_reg = it->second.get();
- } else {
- // Index for cl_rcb is always 1 less than gatt_if.
- if (ii < 1 || ii > GATT_MAX_APPS) {
- log::warn("gatt_if out of range = {}", ii);
- return NULL;
- }
- p_reg = &gatt_cb.cl_rcb[ii - 1];
+ auto it = gatt_cb.cl_rcb_map.find(gatt_if);
+ if (it == gatt_cb.cl_rcb_map.end()) {
+ log::warn("unknown gatt_if = {}", ii);
+ return NULL;
}
+ p_reg = it->second.get();
if (!p_reg->in_use) {
log::warn("gatt_if found but not in use.");
@@ -1332,16 +1322,8 @@ tGATT_TCB* gatt_find_tcb_by_cid(uint16_t lcid) {
}
void gatt_sr_copy_prep_cnt_to_cback_cnt(tGATT_TCB& tcb) {
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- for (auto& [i, cnt] : tcb.prep_cnt_map) {
- tcb.sr_cmd.cback_cnt_map[i] = 1;
- }
- } else {
- for (uint8_t i = 0; i < GATT_MAX_APPS; i++) {
- if (tcb.prep_cnt[i]) {
- tcb.sr_cmd.cback_cnt[i] = 1;
- }
- }
+ for (auto& [i, cnt] : tcb.prep_cnt_map) {
+ tcb.sr_cmd.cback_cnt_map[i] = 1;
}
}
@@ -1385,17 +1367,7 @@ bool gatt_sr_is_cback_cnt_zero(tGATT_TCB& tcb, uint16_t cid) {
sr_cmd_p = &channel->server_outstanding_cmd_;
}
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- return sr_cmd_p->cback_cnt_map.empty();
- }
-
- for (uint8_t i = 0; i < GATT_MAX_APPS; i++) {
- if (sr_cmd_p->cback_cnt[i] != 0) {
- return false;
- }
- }
-
- return true;
+ return sr_cmd_p->cback_cnt_map.empty();
}
/*******************************************************************************
@@ -1407,18 +1379,7 @@ bool gatt_sr_is_cback_cnt_zero(tGATT_TCB& tcb, uint16_t cid) {
* Returns True no prepare write request
*
******************************************************************************/
-bool gatt_sr_is_prep_cnt_zero(tGATT_TCB& tcb) {
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- return tcb.prep_cnt_map.empty();
- } else {
- for (uint8_t i = 0; i < GATT_MAX_APPS; i++) {
- if (tcb.prep_cnt[i]) {
- return false;
- }
- }
- return true;
- }
-}
+bool gatt_sr_is_prep_cnt_zero(tGATT_TCB& tcb) { return tcb.prep_cnt_map.empty(); }
/*******************************************************************************
*
@@ -1430,31 +1391,15 @@ bool gatt_sr_is_prep_cnt_zero(tGATT_TCB& tcb) {
*
******************************************************************************/
void gatt_sr_reset_cback_cnt(tGATT_TCB& tcb, uint16_t cid) {
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- if (cid == tcb.att_lcid) {
- tcb.sr_cmd.cback_cnt_map.clear();
- } else {
- EattChannel* channel = EattExtension::GetInstance()->FindEattChannelByCid(tcb.peer_bda, cid);
- if (channel == nullptr) {
- log::warn("{}, cid 0x{:02x} already disconnected", tcb.peer_bda, cid);
- return;
- }
- channel->server_outstanding_cmd_.cback_cnt_map.clear();
- }
+ if (cid == tcb.att_lcid) {
+ tcb.sr_cmd.cback_cnt_map.clear();
} else {
- for (uint8_t i = 0; i < GATT_MAX_APPS; i++) {
- if (cid == tcb.att_lcid) {
- tcb.sr_cmd.cback_cnt[i] = 0;
- } else {
- EattChannel* channel =
- EattExtension::GetInstance()->FindEattChannelByCid(tcb.peer_bda, cid);
- if (channel == nullptr) {
- log::warn("{}, cid 0x{:02x} already disconnected", tcb.peer_bda, cid);
- return;
- }
- channel->server_outstanding_cmd_.cback_cnt[i] = 0;
- }
+ EattChannel* channel = EattExtension::GetInstance()->FindEattChannelByCid(tcb.peer_bda, cid);
+ if (channel == nullptr) {
+ log::warn("{}, cid 0x{:02x} already disconnected", tcb.peer_bda, cid);
+ return;
}
+ channel->server_outstanding_cmd_.cback_cnt_map.clear();
}
}
@@ -1540,25 +1485,13 @@ void gatt_sr_update_cback_cnt(tGATT_TCB& tcb, uint16_t cid, tGATT_IF gatt_if, bo
gatt_sr_reset_cback_cnt(tcb, cid);
}
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- if (is_inc) {
- sr_cmd_p->cback_cnt_map[gatt_if]++;
- } else {
- auto cback_cnt_it = sr_cmd_p->cback_cnt_map.find(gatt_if);
- if (cback_cnt_it != sr_cmd_p->cback_cnt_map.end()) {
- if ((--cback_cnt_it->second) <= 0) {
- sr_cmd_p->cback_cnt_map.erase(cback_cnt_it);
- }
- }
- }
+ if (is_inc) {
+ sr_cmd_p->cback_cnt_map[gatt_if]++;
} else {
- uint8_t idx = ((uint8_t)gatt_if) - 1;
-
- if (is_inc) {
- sr_cmd_p->cback_cnt[idx]++;
- } else {
- if (sr_cmd_p->cback_cnt[idx]) {
- sr_cmd_p->cback_cnt[idx]--;
+ auto cback_cnt_it = sr_cmd_p->cback_cnt_map.find(gatt_if);
+ if (cback_cnt_it != sr_cmd_p->cback_cnt_map.end()) {
+ if ((--cback_cnt_it->second) <= 0) {
+ sr_cmd_p->cback_cnt_map.erase(cback_cnt_it);
}
}
}
@@ -1582,23 +1515,13 @@ void gatt_sr_update_prep_cnt(tGATT_TCB& tcb, tGATT_IF gatt_if, bool is_inc, bool
if (is_reset_first) {
gatt_sr_reset_prep_cnt(tcb);
}
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- if (is_inc) {
- tcb.prep_cnt_map[gatt_if]++;
- } else {
- auto prep_cnt_i = tcb.prep_cnt_map.find(gatt_if);
- if (prep_cnt_i != tcb.prep_cnt_map.end()) {
- if (--prep_cnt_i->second <= 0) {
- tcb.prep_cnt_map.erase(prep_cnt_i);
- }
- }
- }
+ if (is_inc) {
+ tcb.prep_cnt_map[gatt_if]++;
} else {
- if (is_inc) {
- tcb.prep_cnt[idx]++;
- } else {
- if (tcb.prep_cnt[idx]) {
- tcb.prep_cnt[idx]--;
+ auto prep_cnt_i = tcb.prep_cnt_map.find(gatt_if);
+ if (prep_cnt_i != tcb.prep_cnt_map.end()) {
+ if (--prep_cnt_i->second <= 0) {
+ tcb.prep_cnt_map.erase(prep_cnt_i);
}
}
}
@@ -1806,24 +1729,12 @@ static void gatt_disconnect_complete_notify_user(const RawAddress& bda, tGATT_DI
tBT_TRANSPORT transport) {
tGATT_TCB* p_tcb = gatt_find_tcb_by_addr(bda, transport);
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- for (auto& [i, p_reg] : gatt_cb.cl_rcb_map) {
- if (p_reg->in_use && p_reg->app_cb.p_conn_cb) {
- tCONN_ID conn_id =
- p_tcb ? gatt_create_conn_id(p_tcb->tcb_idx, p_reg->gatt_if) : GATT_INVALID_CONN_ID;
- (*p_reg->app_cb.p_conn_cb)(p_reg->gatt_if, bda, conn_id, kGattDisconnected, reason,
- transport);
- }
- }
- } else {
- for (uint8_t i = 0; i < GATT_MAX_APPS; i++) {
- tGATT_REG* p_reg = &gatt_cb.cl_rcb[i];
- if (p_reg->in_use && p_reg->app_cb.p_conn_cb) {
- tCONN_ID conn_id =
- p_tcb ? gatt_create_conn_id(p_tcb->tcb_idx, p_reg->gatt_if) : GATT_INVALID_CONN_ID;
- (*p_reg->app_cb.p_conn_cb)(p_reg->gatt_if, bda, conn_id, kGattDisconnected, reason,
- transport);
- }
+ for (auto& [i, p_reg] : gatt_cb.cl_rcb_map) {
+ if (p_reg->in_use && p_reg->app_cb.p_conn_cb) {
+ tCONN_ID conn_id =
+ p_tcb ? gatt_create_conn_id(p_tcb->tcb_idx, p_reg->gatt_if) : GATT_INVALID_CONN_ID;
+ (*p_reg->app_cb.p_conn_cb)(p_reg->gatt_if, bda, conn_id, kGattDisconnected, reason,
+ transport);
}
}
}
@@ -1943,41 +1854,22 @@ uint16_t gatt_get_mtu_pref(const tGATT_REG* p_reg, const RawAddress& bda) {
uint16_t gatt_get_apps_preferred_mtu(const RawAddress& bda) {
uint16_t preferred_mtu = 0;
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- for (auto& [i, p_reg] : gatt_cb.cl_rcb_map) {
- if (!p_reg->in_use) {
- continue;
- }
-
- preferred_mtu = std::max(preferred_mtu, gatt_get_mtu_pref(p_reg.get(), bda));
+ for (auto& [i, p_reg] : gatt_cb.cl_rcb_map) {
+ if (!p_reg->in_use) {
+ continue;
}
- } else {
- for (auto& reg : gatt_cb.cl_rcb) {
- if (!reg.in_use) {
- continue;
- }
- preferred_mtu = std::max(preferred_mtu, gatt_get_mtu_pref(&reg, bda));
- }
+ preferred_mtu = std::max(preferred_mtu, gatt_get_mtu_pref(p_reg.get(), bda));
}
return preferred_mtu;
}
void gatt_remove_apps_mtu_prefs(const RawAddress& bda) {
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- for (auto& [i, p_reg] : gatt_cb.cl_rcb_map) {
- if (!p_reg->in_use) {
- continue;
- }
- p_reg.get()->mtu_prefs.erase(bda);
- }
- } else {
- for (auto& reg : gatt_cb.cl_rcb) {
- if (!reg.in_use) {
- continue;
- }
- reg.mtu_prefs.erase(bda);
+ for (auto& [i, p_reg] : gatt_cb.cl_rcb_map) {
+ if (!p_reg->in_use) {
+ continue;
}
+ p_reg.get()->mtu_prefs.erase(bda);
}
}
diff --git a/system/stack/include/l2cap_interface.h b/system/stack/include/l2cap_interface.h
index b1551d2a80..19f85d4d2e 100644
--- a/system/stack/include/l2cap_interface.h
+++ b/system/stack/include/l2cap_interface.h
@@ -871,21 +871,6 @@ public:
virtual void L2CA_SetEcosystemBaseInterval(uint32_t base_interval) = 0;
/*******************************************************************************
- *
- * Function L2CA_SetDefaultSubrate
- *
- * Description BLE Set Default Subrate.
- *
- * Parameters: Subrate parameters
- *
- * Return value: void
- *
- ******************************************************************************/
- virtual void L2CA_SetDefaultSubrate(uint16_t subrate_min, uint16_t subrate_max,
- uint16_t max_latency, uint16_t cont_num,
- uint16_t timeout) = 0;
-
- /*******************************************************************************
**
** Function L2CA_SetMediaStreamChannel
**
diff --git a/system/stack/l2cap/internal/l2c_api.h b/system/stack/l2cap/internal/l2c_api.h
index dd1dbf52e6..989eccf50e 100644
--- a/system/stack/l2cap/internal/l2c_api.h
+++ b/system/stack/l2cap/internal/l2c_api.h
@@ -719,20 +719,6 @@ void L2CA_SetEcosystemBaseInterval(uint32_t base_interval);
/*******************************************************************************
*
- * Function L2CA_SetDefaultSubrate
- *
- * Description BLE Set Default Subrate.
- *
- * Parameters: Subrate parameters
- *
- * Return value: void
- *
- ******************************************************************************/
-void L2CA_SetDefaultSubrate(uint16_t subrate_min, uint16_t subrate_max, uint16_t max_latency,
- uint16_t cont_num, uint16_t timeout);
-
-/*******************************************************************************
- *
* Function L2CA_SubrateRequest
*
* Description BLE Subrate request.
diff --git a/system/stack/l2cap/l2c_api.h b/system/stack/l2cap/l2c_api.h
index 1ff09ffaf5..f9eab67d55 100644
--- a/system/stack/l2cap/l2c_api.h
+++ b/system/stack/l2cap/l2c_api.h
@@ -73,8 +73,6 @@ public:
uint8_t* p_chnl_mask) override;
[[nodiscard]] bool L2CA_SetAclPriority(const RawAddress& bd_addr,
tL2CAP_PRIORITY priority) override;
- void L2CA_SetDefaultSubrate(uint16_t subrate_min, uint16_t subrate_max, uint16_t max_latency,
- uint16_t cont_num, uint16_t timeout) override;
void L2CA_AdjustConnectionIntervals(uint16_t* min_interval, uint16_t* max_interval,
uint16_t floor_interval) override;
void L2CA_SetEcosystemBaseInterval(uint32_t base_interval) override;
diff --git a/system/stack/l2cap/l2c_ble_conn_params.cc b/system/stack/l2cap/l2c_ble_conn_params.cc
index 49eeb06155..392b1f5a74 100644
--- a/system/stack/l2cap/l2c_ble_conn_params.cc
+++ b/system/stack/l2cap/l2c_ble_conn_params.cc
@@ -510,26 +510,6 @@ static void l2cble_start_subrate_change(tL2C_LCB* p_lcb) {
/*******************************************************************************
*
- * Function L2CA_SetDefaultSubrate
- *
- * Description BLE Set Default Subrate
- *
- * Parameters: Subrate parameters
- *
- * Return value: void
- *
- ******************************************************************************/
-void L2CA_SetDefaultSubrate(uint16_t subrate_min, uint16_t subrate_max, uint16_t max_latency,
- uint16_t cont_num, uint16_t timeout) {
- log::verbose("subrate_min={}, subrate_max={}, max_latency={}, cont_num={}, timeout={}",
- subrate_min, subrate_max, max_latency, cont_num, timeout);
-
- bluetooth::shim::ACL_LeSetDefaultSubrate(subrate_min, subrate_max, max_latency, cont_num,
- timeout);
-}
-
-/*******************************************************************************
- *
* Function L2CA_SubrateRequest
*
* Description BLE Subrate request.
diff --git a/system/stack/l2cap/l2cap_api.cc b/system/stack/l2cap/l2cap_api.cc
index 0752c995c0..e9ccaeaf2a 100644
--- a/system/stack/l2cap/l2cap_api.cc
+++ b/system/stack/l2cap/l2cap_api.cc
@@ -234,13 +234,6 @@ void bluetooth::stack::l2cap::Impl::L2CA_SetEcosystemBaseInterval(uint32_t base_
return ::L2CA_IsLinkEstablished(bd_addr, transport);
}
-void bluetooth::stack::l2cap::Impl::L2CA_SetDefaultSubrate(uint16_t subrate_min,
- uint16_t subrate_max,
- uint16_t max_latency, uint16_t cont_num,
- uint16_t timeout) {
- ::L2CA_SetDefaultSubrate(subrate_min, subrate_max, max_latency, cont_num, timeout);
-}
-
[[nodiscard]] bool bluetooth::stack::l2cap::Impl::L2CA_SubrateRequest(
const RawAddress& rem_bda, uint16_t subrate_min, uint16_t subrate_max, uint16_t max_latency,
uint16_t cont_num, uint16_t timeout) {
diff --git a/system/stack/mmc/OWNERS b/system/stack/mmc/OWNERS
deleted file mode 100644
index a823e6e1dd..0000000000
--- a/system/stack/mmc/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS_chromeos
diff --git a/system/stack/test/eatt/eatt_test.cc b/system/stack/test/eatt/eatt_test.cc
index 5d7a2eeea8..17f4908b3e 100644
--- a/system/stack/test/eatt/eatt_test.cc
+++ b/system/stack/test/eatt/eatt_test.cc
@@ -660,7 +660,6 @@ TEST_F(EattTest, ChannelUnavailableWhileReconfiguring) {
}
TEST_F(EattTest, DisconnectChannelOnIndicationConfirmationTimeout) {
- com::android::bluetooth::flags::provider_->gatt_disconnect_fix(true);
ConnectDeviceEattSupported(1);
eatt_instance_->StartIndicationConfirmationTimer(test_address, test_local_cids[0]);
diff --git a/system/stack/test/gatt/gatt_sr_test.cc b/system/stack/test/gatt/gatt_sr_test.cc
index 9c5eb868d0..4106579080 100644
--- a/system/stack/test/gatt/gatt_sr_test.cc
+++ b/system/stack/test/gatt/gatt_sr_test.cc
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-#include <com_android_bluetooth_flags.h>
#include <gtest/gtest.h>
#include <cstdint>
@@ -141,25 +140,16 @@ protected:
tcb_.att_lcid = L2CAP_ATT_CID;
el_.gatt_if = 1;
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- gatt_cb.cl_rcb_map.emplace(el_.gatt_if, std::make_unique<tGATT_REG>());
- tGATT_REG* p_reg = gatt_cb.cl_rcb_map[el_.gatt_if].get();
- p_reg->in_use = true;
- p_reg->gatt_if = el_.gatt_if;
- p_reg->app_cb.p_req_cb = ApplicationRequestCallback;
- } else {
- gatt_cb.cl_rcb[el_.gatt_if - 1].in_use = true;
- gatt_cb.cl_rcb[el_.gatt_if - 1].app_cb.p_req_cb = ApplicationRequestCallback;
- }
+ gatt_cb.cl_rcb_map.emplace(el_.gatt_if, std::make_unique<tGATT_REG>());
+ tGATT_REG* p_reg = gatt_cb.cl_rcb_map[el_.gatt_if].get();
+ p_reg->in_use = true;
+ p_reg->gatt_if = el_.gatt_if;
+ p_reg->app_cb.p_req_cb = ApplicationRequestCallback;
test_state_ = TestMutables();
}
- void TearDown() override {
- if (com::android::bluetooth::flags::gatt_client_dynamic_allocation()) {
- gatt_cb.cl_rcb_map.erase(el_.gatt_if);
- }
- }
+ void TearDown() override { gatt_cb.cl_rcb_map.erase(el_.gatt_if); }
tGATT_TCB tcb_;
tGATT_SRV_LIST_ELEM el_;
diff --git a/system/stack/test/sdp/stack_sdp_test.cc b/system/stack/test/sdp/stack_sdp_test.cc
index 314ea02334..c792a5fd0d 100644
--- a/system/stack/test/sdp/stack_sdp_test.cc
+++ b/system/stack/test/sdp/stack_sdp_test.cc
@@ -62,7 +62,6 @@ protected:
fake_osi_ = std::make_unique<test::fake::FakeOsi>();
bluetooth::testing::stack::l2cap::set_interface(&mock_stack_l2cap_interface_);
- tL2CAP_APPL_INFO l2cap_callbacks{};
EXPECT_CALL(mock_stack_l2cap_interface_, L2CA_RegisterWithSecurity(_, _, _, _, _, _, _))
.WillOnce(DoAll(SaveArg<1>(&l2cap_callbacks), ::testing::ReturnArg<0>()));
EXPECT_CALL(mock_stack_l2cap_interface_, L2CA_Deregister(_));
@@ -73,6 +72,7 @@ protected:
fake_osi_.reset();
}
+ tL2CAP_APPL_INFO l2cap_callbacks{};
bluetooth::testing::stack::l2cap::Mock mock_stack_l2cap_interface_;
std::unique_ptr<test::fake::FakeOsi> fake_osi_;
};
diff --git a/system/test/Android.bp b/system/test/Android.bp
index 106dedb7bd..9dab01352f 100644
--- a/system/test/Android.bp
+++ b/system/test/Android.bp
@@ -88,6 +88,13 @@ filegroup {
}
filegroup {
+ name: "TestMockBtaHearingAidAudioSource",
+ srcs: [
+ "mock/mock_bta_hearing_aid_audio_source.cc",
+ ],
+}
+
+filegroup {
name: "TestMockBtaHf",
srcs: [
"mock/mock_bta_hf*.cc",
@@ -184,6 +191,7 @@ filegroup {
":TestMockBtaHas",
":TestMockBtaHd",
":TestMockBtaHearingAid",
+ ":TestMockBtaHearingAidAudioSource",
":TestMockBtaHf",
":TestMockBtaHh",
":TestMockBtaJv",
@@ -457,6 +465,13 @@ filegroup {
}
filegroup {
+ name: "TestMockStackGapConnInterface",
+ srcs: [
+ "mock/mock_stack_gap_conn_interface.cc",
+ ],
+}
+
+filegroup {
name: "TestMockStackConnMgr",
srcs: [
"mock/mock_stack_connection_manager.cc",
diff --git a/system/test/mock/mock_bta_hearing_aid_audio_source.cc b/system/test/mock/mock_bta_hearing_aid_audio_source.cc
new file mode 100644
index 0000000000..c68fad3b8d
--- /dev/null
+++ b/system/test/mock/mock_bta_hearing_aid_audio_source.cc
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Generated mock file from original source file
+ * Functions generated:8
+ */
+
+#include <base/functional/callback.h>
+
+#include <cstdint>
+
+#include "bta/include/bta_gatt_queue.h"
+#include "bta/include/bta_hearing_aid_api.h"
+#include "test/common/mock_functions.h"
+#include "types/raw_address.h"
+
+void HearingAidAudioSource::Start(const CodecConfiguration& /*codecConfiguration*/,
+ HearingAidAudioReceiver* /*audioReceiver*/,
+ uint16_t /*remote_delay_ms*/) {
+ inc_func_call_count(__func__);
+}
+
+void HearingAidAudioSource::Stop() { inc_func_call_count(__func__); }
+
+void HearingAidAudioSource::Initialize() { inc_func_call_count(__func__); }
+
+void HearingAidAudioSource::CleanUp() { inc_func_call_count(__func__); }
+
+void HearingAidAudioSource::DebugDump(int /*fd*/) { inc_func_call_count(__func__); }
diff --git a/system/test/mock/mock_main_shim_acl.cc b/system/test/mock/mock_main_shim_acl.cc
index a98e809ad0..5f58860347 100644
--- a/system/test/mock/mock_main_shim_acl.cc
+++ b/system/test/mock/mock_main_shim_acl.cc
@@ -129,12 +129,6 @@ void shim::Acl::DisconnectLe(uint16_t /* handle */, tHCI_STATUS /* reason */,
inc_func_call_count(__func__);
}
-void shim::Acl::LeSetDefaultSubrate(uint16_t /* subrate_min */, uint16_t /* subrate_max */,
- uint16_t /* max_latency */, uint16_t /* cont_num */,
- uint16_t /* sup_tout */) {
- inc_func_call_count(__func__);
-}
-
void shim::Acl::LeSubrateRequest(uint16_t /* hci_handle */, uint16_t /* subrate_min */,
uint16_t /* subrate_max */, uint16_t /* max_latency */,
uint16_t /* cont_num */, uint16_t /* sup_tout */) {
diff --git a/system/test/mock/mock_main_shim_acl_api.cc b/system/test/mock/mock_main_shim_acl_api.cc
index 3d257f1a5a..e3a3c9d63b 100644
--- a/system/test/mock/mock_main_shim_acl_api.cc
+++ b/system/test/mock/mock_main_shim_acl_api.cc
@@ -73,12 +73,6 @@ void bluetooth::shim::ACL_RemoveFromAddressResolution(
inc_func_call_count(__func__);
}
void bluetooth::shim::ACL_ClearAddressResolution() { inc_func_call_count(__func__); }
-void bluetooth::shim::ACL_LeSetDefaultSubrate(uint16_t /* subrate_min */,
- uint16_t /* subrate_max */,
- uint16_t /* max_latency */, uint16_t /* cont_num */,
- uint16_t /* sup_tout */) {
- inc_func_call_count(__func__);
-}
void bluetooth::shim::ACL_LeSubrateRequest(uint16_t /* hci_handle */, uint16_t /* subrate_min */,
uint16_t /* subrate_max */, uint16_t /* max_latency */,
uint16_t /* cont_num */, uint16_t /* sup_tout */) {
diff --git a/system/test/mock/mock_main_shim_acl_api.h b/system/test/mock/mock_main_shim_acl_api.h
index ab891673e3..29e27dbad3 100644
--- a/system/test/mock/mock_main_shim_acl_api.h
+++ b/system/test/mock/mock_main_shim_acl_api.h
@@ -84,21 +84,6 @@ struct ACL_ClearFilterAcceptList {
};
extern struct ACL_ClearFilterAcceptList ACL_ClearFilterAcceptList;
-// Name: ACL_LeSetDefaultSubrate
-// Params:
-// Return: void
-struct ACL_LeSetDefaultSubrate {
- std::function<void(uint16_t subrate_min, uint16_t subrate_max, uint16_t max_latency,
- uint16_t cont_num, uint16_t sup_tout)>
- body{[](uint16_t subrate_min, uint16_t subrate_max, uint16_t max_latency,
- uint16_t cont_num, uint16_t sup_tout) {}};
- void operator()(uint16_t subrate_min, uint16_t subrate_max, uint16_t max_latency,
- uint16_t cont_num, uint16_t sup_tout) {
- body(subrate_min, subrate_max, max_latency, cont_num, sup_tout);
- }
-};
-extern struct ACL_LeSetDefaultSubrate ACL_LeSetDefaultSubrate;
-
// Name: ACL_LeSubrateRequest
// Params:
// Return: void
diff --git a/system/test/mock/mock_stack_gap_conn.cc b/system/test/mock/mock_stack_gap_conn_interface.cc
index 07193c9130..2ef1a3ef8f 100644
--- a/system/test/mock/mock_stack_gap_conn.cc
+++ b/system/test/mock/mock_stack_gap_conn_interface.cc
@@ -1,5 +1,5 @@
/*
- * Copyright 2021 The Android Open Source Project
+ * Copyright 2025 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,19 +14,39 @@
* limitations under the License.
*/
-/*
- * Generated mock file from original source file
- * Functions generated:13
- */
+#include "test/mock/mock_stack_gap_conn_interface.h"
-#include "gap_api.h"
-#include "stack/include/bt_hdr.h"
+#include "stack/include/gap_api.h"
#include "test/common/mock_functions.h"
-#include "types/raw_address.h"
-const RawAddress* GAP_ConnGetRemoteAddr(uint16_t /* gap_handle */) {
+namespace {
+bluetooth::testing::stack::gap_conn::Mock mock_gap_conn_interface;
+bluetooth::testing::stack::gap_conn::Interface* interface_ = &mock_gap_conn_interface;
+} // namespace
+
+void bluetooth::testing::stack::gap_conn::reset_interface() {
+ interface_ = &mock_gap_conn_interface;
+}
+
+void bluetooth::testing::stack::gap_conn::set_interface(
+ bluetooth::testing::stack::gap_conn::Interface* interface) {
+ interface_ = interface;
+}
+
+uint16_t GAP_ConnOpen(const char* p_serv_name, uint8_t service_id, bool is_server,
+ const RawAddress* p_rem_bda, uint16_t psm, uint16_t le_mps,
+ tL2CAP_CFG_INFO* p_cfg, tL2CAP_ERTM_INFO* ertm_info, uint16_t security,
+ tGAP_CONN_CALLBACK* p_cb, tBT_TRANSPORT transport) {
inc_func_call_count(__func__);
- return nullptr;
+
+ return interface_->GAP_ConnOpen(p_serv_name, service_id, is_server, p_rem_bda, psm, le_mps, p_cfg,
+ ertm_info, security, p_cb, transport);
+}
+
+const RawAddress* GAP_ConnGetRemoteAddr(uint16_t gap_handle) {
+ inc_func_call_count(__func__);
+
+ return interface_->GAP_ConnGetRemoteAddr(gap_handle);
}
int GAP_GetRxQueueCnt(uint16_t /* handle */, uint32_t* /* p_rx_queue_count */) {
inc_func_call_count(__func__);
@@ -44,14 +64,6 @@ uint16_t GAP_ConnGetRemMtuSize(uint16_t /* gap_handle */) {
inc_func_call_count(__func__);
return 0;
}
-uint16_t GAP_ConnOpen(const char* /* p_serv_name */, uint8_t /* service_id */, bool /* is_server */,
- const RawAddress* /* p_rem_bda */, uint16_t /* psm */, uint16_t /* le_mps */,
- tL2CAP_CFG_INFO* /* p_cfg */, tL2CAP_ERTM_INFO* /* ertm_info */,
- uint16_t /* security */, tGAP_CONN_CALLBACK* /* p_cb */,
- tBT_TRANSPORT /* transport */) {
- inc_func_call_count(__func__);
- return 0;
-}
uint16_t GAP_ConnReadData(uint16_t /* gap_handle */, uint8_t* /* p_data */, uint16_t /* max_len */,
uint16_t* /* p_len */) {
inc_func_call_count(__func__);
@@ -74,3 +86,8 @@ bool GAP_IsTransportLe(uint16_t /* gap_handle */) {
return false;
}
void GAP_Init(void) { inc_func_call_count(__func__); }
+
+bluetooth::testing::stack::gap_conn::Interface&
+bluetooth::testing::stack::gap_conn::get_interface() {
+ return *interface_;
+}
diff --git a/system/test/mock/mock_stack_gap_conn_interface.h b/system/test/mock/mock_stack_gap_conn_interface.h
new file mode 100644
index 0000000000..c1ed7caea3
--- /dev/null
+++ b/system/test/mock/mock_stack_gap_conn_interface.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <gmock/gmock.h>
+
+#include <vector>
+
+#include "stack/include/gap_api.h"
+
+namespace bluetooth {
+namespace testing {
+namespace stack {
+namespace gap_conn {
+
+class Interface {
+public:
+ virtual ~Interface() = default;
+
+ virtual uint16_t GAP_ConnOpen(const char* p_serv_name, uint8_t service_id, bool is_server,
+ const RawAddress* p_rem_bda, uint16_t psm, uint16_t le_mps,
+ tL2CAP_CFG_INFO* p_cfg, tL2CAP_ERTM_INFO* ertm_info,
+ uint16_t security, tGAP_CONN_CALLBACK* p_cb,
+ tBT_TRANSPORT transport) = 0;
+
+ virtual const RawAddress* GAP_ConnGetRemoteAddr(uint16_t gap_handle) = 0;
+};
+
+class Mock : public Interface {
+public:
+ ~Mock() = default;
+
+ MOCK_METHOD(uint16_t, GAP_ConnOpen,
+ (const char* p_serv_name, uint8_t service_id, bool is_server,
+ const RawAddress* p_rem_bda, uint16_t psm, uint16_t le_mps, tL2CAP_CFG_INFO* p_cfg,
+ tL2CAP_ERTM_INFO* ertm_info, uint16_t security, tGAP_CONN_CALLBACK* p_cb,
+ tBT_TRANSPORT transport));
+
+ MOCK_METHOD(const RawAddress*, GAP_ConnGetRemoteAddr, (uint16_t gap_handle));
+};
+
+void reset_interface();
+void set_interface(Interface* interface_);
+Interface& get_interface();
+
+} // namespace gap_conn
+} // namespace stack
+} // namespace testing
+} // namespace bluetooth
diff --git a/system/test/mock/mock_stack_l2cap_interface.h b/system/test/mock/mock_stack_l2cap_interface.h
index a5cd536777..b2fc3e0ae9 100644
--- a/system/test/mock/mock_stack_l2cap_interface.h
+++ b/system/test/mock/mock_stack_l2cap_interface.h
@@ -64,9 +64,6 @@ public:
MOCK_METHOD(bool, L2CA_GetPeerFeatures,
(const RawAddress& bd_addr, uint32_t* p_ext_feat, uint8_t* p_chnl_mask));
MOCK_METHOD(bool, L2CA_SetAclPriority, (const RawAddress& bd_addr, tL2CAP_PRIORITY priority));
- MOCK_METHOD(void, L2CA_SetDefaultSubrate,
- (uint16_t subrate_min, uint16_t subrate_max, uint16_t max_latency, uint16_t cont_num,
- uint16_t timeout));
MOCK_METHOD(void, L2CA_AdjustConnectionIntervals,
(uint16_t* min_interval, uint16_t* max_interval, uint16_t floor_interval));
MOCK_METHOD(void, L2CA_SetEcosystemBaseInterval, (uint32_t base_interval));
diff --git a/system/test/suite/adapter/adapter_unittest.cc b/system/test/suite/adapter/adapter_unittest.cc
index 8e2769ea10..e295cb473d 100644
--- a/system/test/suite/adapter/adapter_unittest.cc
+++ b/system/test/suite/adapter/adapter_unittest.cc
@@ -16,8 +16,11 @@
*
******************************************************************************/
+#include <bluetooth/log.h>
+
#include "adapter/bluetooth_test.h"
-#include "btcore/include/property.h"
+#include "osi/include/allocator.h"
+#include "osi/include/compat.h"
#include "types/bt_transport.h"
#include "types/raw_address.h"
@@ -58,6 +61,52 @@ TEST_F(BluetoothTest, AdapterRepeatedEnableDisable) {
}
}
+static bt_property_t* property_new_name(const char* name) {
+ bluetooth::log::assert_that(name != NULL, "assert failed: name != NULL");
+ bt_property_t* property = static_cast<bt_property_t*>(osi_calloc(sizeof(bt_property_t)));
+
+ property->val = osi_calloc(sizeof(bt_bdname_t) + 1);
+ osi_strlcpy((char*)property->val, name, sizeof(bt_bdname_t));
+
+ property->type = BT_PROPERTY_BDNAME;
+ property->len = sizeof(bt_bdname_t);
+
+ return property;
+}
+
+static void property_free(bt_property_t* property) {
+ if (property == NULL) {
+ return;
+ }
+
+ osi_free(property->val);
+ osi_free(property);
+}
+
+static const bt_bdname_t* property_as_name(const bt_property_t* property) {
+ bluetooth::log::assert_that(property->type == BT_PROPERTY_BDNAME,
+ "assert failed: property_is_name(property)");
+ return (const bt_bdname_t*)property->val;
+}
+
+static bool property_equals(const bt_property_t* p1, const bt_property_t* p2) {
+ if (!p1 || !p2 || p1->type != p2->type) {
+ return false;
+ }
+
+ if (p1->type == BT_PROPERTY_BDNAME && p1->len != p2->len) {
+ const bt_property_t *shorter = p1, *longer = p2;
+ if (p1->len > p2->len) {
+ shorter = p2;
+ longer = p1;
+ }
+ return strlen((const char*)longer->val) == (size_t)shorter->len &&
+ !memcmp(longer->val, shorter->val, shorter->len);
+ }
+
+ return p1->len == p2->len && !memcmp(p1->val, p2->val, p1->len);
+}
+
TEST_F(BluetoothTest, AdapterSetGetName) {
bt_property_t* new_name = property_new_name("BluetoothTestName1");
diff --git a/system/test/suite/adapter/bluetooth_test.cc b/system/test/suite/adapter/bluetooth_test.cc
index 4855b7a72d..490675a9f6 100644
--- a/system/test/suite/adapter/bluetooth_test.cc
+++ b/system/test/suite/adapter/bluetooth_test.cc
@@ -19,10 +19,11 @@
#include "adapter/bluetooth_test.h"
#include <binder/ProcessState.h>
+#include <bluetooth/log.h>
#include <mutex>
-#include "btcore/include/property.h"
+#include "osi/include/allocator.h"
#include "types/raw_address.h"
extern bt_interface_t bluetoothInterface;
@@ -35,6 +36,31 @@ namespace bttest {
static BluetoothTest* instance = nullptr;
+static void property_free_array(bt_property_t* properties, size_t count) {
+ if (properties == NULL) {
+ return;
+ }
+
+ for (size_t i = 0; i < count; ++i) {
+ osi_free(properties[i].val);
+ }
+
+ osi_free(properties);
+}
+
+static bt_property_t* property_copy_array(const bt_property_t* properties, size_t count) {
+ bluetooth::log::assert_that(properties != NULL, "assert failed: properties != NULL");
+ bt_property_t* clone = static_cast<bt_property_t*>(osi_calloc(sizeof(bt_property_t) * count));
+
+ memcpy(&clone[0], &properties[0], sizeof(bt_property_t) * count);
+ for (size_t i = 0; i < count; ++i) {
+ clone[i].val = osi_calloc(clone[i].len);
+ memcpy(clone[i].val, properties[i].val, clone[i].len);
+ }
+
+ return clone;
+}
+
void AdapterStateChangedCallback(bt_state_t new_state) {
instance->state_ = new_state;
semaphore_post(instance->adapter_state_changed_callback_sem_);
diff --git a/tools/OWNERS b/tools/OWNERS
deleted file mode 100644
index b2869ce1bc..0000000000
--- a/tools/OWNERS
+++ /dev/null
@@ -1,5 +0,0 @@
-# Reviewers for /tools
-
-jpawlowski@google.com
-siyuanh@google.com
-wescande@google.com
diff --git a/tools/lint/OWNERS b/tools/lint/OWNERS
deleted file mode 100644
index 9dd2d58fe3..0000000000
--- a/tools/lint/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-# Additional OWNERS for Bluetooth AndroidLint
-salsavage@google.com
diff --git a/tools/rootcanal/OWNERS b/tools/rootcanal/OWNERS
deleted file mode 100644
index 22b124fd96..0000000000
--- a/tools/rootcanal/OWNERS
+++ /dev/null
@@ -1,3 +0,0 @@
-# Reviewers for /tools/rootcanal
-
-henrichataing@google.com