diff options
415 files changed, 1453 insertions, 3403 deletions
@@ -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/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/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/ActiveDeviceManager.java b/android/app/src/com/android/bluetooth/btservice/ActiveDeviceManager.java index 61429c8d90..3482dea3a4 100644 --- a/android/app/src/com/android/bluetooth/btservice/ActiveDeviceManager.java +++ b/android/app/src/com/android/bluetooth/btservice/ActiveDeviceManager.java @@ -417,7 +417,7 @@ public class ActiveDeviceManager implements AdapterService.BluetoothStateCallbac final LeAudioService leAudioService = mFactory.getLeAudioService(); setA2dpActiveDevice(null, true); setHfpActiveDevice(null); - if (Flags.admVerifyActiveFallbackDevice() && leAudioService != null) { + if (leAudioService != null) { setLeAudioActiveDevice( null, !leAudioService.getActiveDevices().contains(device)); } else { @@ -575,9 +575,6 @@ public class ActiveDeviceManager implements AdapterService.BluetoothStateCallbac boolean hasFallbackDevice = false; if (Objects.equals(mLeAudioActiveDevice, device)) { hasFallbackDevice = setFallbackDeviceActiveLocked(device); - if (!hasFallbackDevice && !Flags.admFixDisconnectOfSetMember()) { - leAudioService.removeActiveDevice(false); - } } leAudioService.deviceDisconnected(device, hasFallbackDevice); } @@ -1102,12 +1099,6 @@ public class ActiveDeviceManager implements AdapterService.BluetoothStateCallbac @GuardedBy("mLock") private boolean areSameGroupMembers(BluetoothDevice firstDevice, BluetoothDevice secondDevice) { - - if (!Flags.admFixDisconnectOfSetMember()) { - /* This function shall return false without the fix flag. */ - return false; - } - if (firstDevice == null || secondDevice == null) { return false; } @@ -1162,13 +1153,11 @@ public class ActiveDeviceManager implements AdapterService.BluetoothStateCallbac * recently removed device, it means it just switched profile it is using and is * not new one. */ - boolean hasFallbackDevice = true; - if (Flags.admVerifyActiveFallbackDevice()) { - hasFallbackDevice = - !(recentlyRemovedDevice != null - && device.equals(recentlyRemovedDevice) - && connectedHearingAidDevices.size() == 1); - } + boolean hasFallbackDevice = + !(recentlyRemovedDevice != null + && device.equals(recentlyRemovedDevice) + && connectedHearingAidDevices.size() == 1); + if (mHearingAidConnectedDevices.contains(device)) { Log.d(TAG, "Found a hearing aid fallback device: " + device); setHearingAidActiveDevice(device); diff --git a/android/app/src/com/android/bluetooth/btservice/AdapterService.java b/android/app/src/com/android/bluetooth/btservice/AdapterService.java index e9202c4f6c..182e75cceb 100644 --- a/android/app/src/com/android/bluetooth/btservice/AdapterService.java +++ b/android/app/src/com/android/bluetooth/btservice/AdapterService.java @@ -3106,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/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 bc5aeb3367..10190b09ef 100644 --- a/android/app/src/com/android/bluetooth/gatt/GattService.java +++ b/android/app/src/com/android/bluetooth/gatt/GattService.java @@ -2319,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/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/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/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/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/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/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/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 2af03df4ae..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 @@ -50,7 +50,6 @@ import android.content.Context; import android.media.AudioDeviceInfo; import android.media.AudioManager; import android.platform.test.annotations.DisableFlags; -import android.platform.test.annotations.EnableFlags; import android.platform.test.flag.junit.SetFlagsRule; import android.util.ArrayMap; import android.util.SparseIntArray; @@ -84,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 { @@ -925,7 +925,6 @@ public class ActiveDeviceManagerTest { /** One LE Audio is connected and disconnected later. Should then set active device to null. */ @Test - @EnableFlags(Flags.FLAG_ADM_FIX_DISCONNECT_OF_SET_MEMBER) public void lastLeAudioDisconnected_clearLeAudioActive() { when(mLeAudioService.getGroupId(mLeAudioDevice)).thenReturn(1); when(mLeAudioService.getLeadDevice(mLeAudioDevice)).thenReturn(mLeAudioDevice); @@ -940,22 +939,6 @@ public class ActiveDeviceManagerTest { verify(mLeAudioService).deviceDisconnected(mLeAudioDevice, false); } - /** One LE Audio is connected and disconnected later. Should then set active device to null. */ - @Test - @DisableFlags(Flags.FLAG_ADM_FIX_DISCONNECT_OF_SET_MEMBER) - public void lastLeAudioDisconnected_clearLeAudioActive_NoFixDisconnectFlag() { - when(mLeAudioService.getGroupId(mLeAudioDevice)).thenReturn(1); - when(mLeAudioService.getLeadDevice(mLeAudioDevice)).thenReturn(mLeAudioDevice); - - leAudioConnected(mLeAudioDevice); - mTestLooper.dispatchAll(); - verify(mLeAudioService).setActiveDevice(mLeAudioDevice); - - leAudioDisconnected(mLeAudioDevice); - mTestLooper.dispatchAll(); - verify(mLeAudioService).removeActiveDevice(false); - } - /** Two LE Audio are connected and active device is explicitly set. */ @Test public void leAudioActiveDeviceSelected_setActive() { @@ -1005,7 +988,6 @@ public class ActiveDeviceManagerTest { * fallback device should not be set to true active device to fallback device. */ @Test - @EnableFlags(Flags.FLAG_ADM_FIX_DISCONNECT_OF_SET_MEMBER) public void leAudioSecondDeviceDisconnected_noFallbackDeviceActive_ModeNormal() { when(mAudioManager.getMode()).thenReturn(AudioManager.MODE_NORMAL); @@ -1036,7 +1018,6 @@ public class ActiveDeviceManagerTest { * fallback device should not be set to true active device to fallback device. */ @Test - @EnableFlags(Flags.FLAG_ADM_FIX_DISCONNECT_OF_SET_MEMBER) public void leAudioSecondDeviceDisconnected_noFallbackDeviceActive_ModeInCall() { when(mAudioManager.getMode()).thenReturn(AudioManager.MODE_IN_CALL); @@ -1067,7 +1048,6 @@ public class ActiveDeviceManagerTest { * fallback device should not be set to true active device to fallback device. */ @Test - @EnableFlags(Flags.FLAG_ADM_FIX_DISCONNECT_OF_SET_MEMBER) public void twoLeAudioSets_OneSetDisconnected_FallbackToAnotherOne_ModeNormal() { when(mAudioManager.getMode()).thenReturn(AudioManager.MODE_NORMAL); @@ -1114,7 +1094,6 @@ public class ActiveDeviceManagerTest { * fallback device should not be set to true active device to fallback device. */ @Test - @EnableFlags(Flags.FLAG_ADM_FIX_DISCONNECT_OF_SET_MEMBER) public void twoLeAudioSets_OneSetDisconnected_FallbackToAnotherOne_ModeInCall() { when(mAudioManager.getMode()).thenReturn(AudioManager.MODE_IN_CALL); @@ -1295,7 +1274,6 @@ public class ActiveDeviceManagerTest { } @Test - @EnableFlags(Flags.FLAG_ADM_FIX_DISCONNECT_OF_SET_MEMBER) public void leAudioSetConnectedGroupThenDisconnected_noFallback() { when(mAudioManager.getMode()).thenReturn(AudioManager.MODE_NORMAL); @@ -1326,38 +1304,6 @@ public class ActiveDeviceManagerTest { order.verify(mLeAudioService).deviceDisconnected(mLeAudioDevice, false); } - @Test - @DisableFlags(Flags.FLAG_ADM_FIX_DISCONNECT_OF_SET_MEMBER) - public void leAudioSetConnectedGroupThenDisconnected_noFallback_NoFixDisconnectFlag() { - when(mAudioManager.getMode()).thenReturn(AudioManager.MODE_NORMAL); - - when(mLeAudioService.getGroupId(mLeAudioDevice)).thenReturn(1); - when(mLeAudioService.getGroupId(mLeAudioDevice2)).thenReturn(1); - when(mLeAudioService.getLeadDevice(mLeAudioDevice2)).thenReturn(mLeAudioDevice); - when(mLeAudioService.getLeadDevice(mLeAudioDevice)).thenReturn(mLeAudioDevice); - - InOrder order = inOrder(mLeAudioService); - - leAudioConnected(mLeAudioDevice); - mTestLooper.dispatchAll(); - order.verify(mLeAudioService).setActiveDevice(mLeAudioDevice); - - leAudioConnected(mLeAudioDevice2); - mTestLooper.dispatchAll(); - order.verify(mLeAudioService, never()).setActiveDevice(any()); - - leAudioDisconnected(mLeAudioDevice2); - mTestLooper.dispatchAll(); - order.verify(mLeAudioService, never()).setActiveDevice(any()); - order.verify(mLeAudioService, never()).removeActiveDevice(anyBoolean()); - order.verify(mLeAudioService).deviceDisconnected(mLeAudioDevice2, false); - - leAudioDisconnected(mLeAudioDevice); - mTestLooper.dispatchAll(); - order.verify(mLeAudioService).removeActiveDevice(false); - order.verify(mLeAudioService).deviceDisconnected(mLeAudioDevice, false); - } - /** * An A2DP connected. An LE Audio connected. The LE Audio disconnected. Then the A2DP should be * the active one. @@ -1387,7 +1333,6 @@ public class ActiveDeviceManagerTest { * and selected as active. First LE Audio device disconnects with fallback to new one. */ @Test - @EnableFlags(Flags.FLAG_ADM_VERIFY_ACTIVE_FALLBACK_DEVICE) public void sameDeviceAsAshaAndLeAudio_noFallbackOnSwitch() { /* Dual mode ASHA/LeAudio device from group 1 */ when(mLeAudioService.getGroupId(mHearingAidDevice)).thenReturn(1); @@ -1425,7 +1370,6 @@ public class ActiveDeviceManagerTest { * and selected as active. First ASHA device disconnects with fallback to new one. */ @Test - @EnableFlags(Flags.FLAG_ADM_VERIFY_ACTIVE_FALLBACK_DEVICE) public void sameDeviceAsLeAudioAndAsha_noFallbackOnSwitch() { // Turn on the dual mode audio flag so the A2DP won't disconnect LE Audio when(mAudioManager.getMode()).thenReturn(AudioManager.MODE_NORMAL); 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/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/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 3ab02065e3..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 { 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 b594ac70b4..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(); 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 @@ -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/active_device_manager.aconfig b/flags/active_device_manager.aconfig index b2438be452..bd55d35e16 100644 --- a/flags/active_device_manager.aconfig +++ b/flags/active_device_manager.aconfig @@ -2,26 +2,6 @@ package: "com.android.bluetooth.flags" container: "com.android.bt" flag { - name: "adm_verify_active_fallback_device" - namespace: "bluetooth" - description: "Verify if device selected for fallback is different then last one" - bug: "369799111" - metadata { - purpose: PURPOSE_BUGFIX - } -} - -flag { - name: "adm_fix_disconnect_of_set_member" - namespace: "bluetooth" - description: "Fix disconnecting of the set member device. Make sure the other set member is not considered as fallback device." - bug: "374320313" - metadata { - purpose: PURPOSE_BUGFIX - } -} - -flag { name: "adm_remove_handling_wired" namespace: "bluetooth" description: "ActiveDeviceManager doesn't need to handle adding and removing wired devices." 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/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/gap.aconfig b/flags/gap.aconfig index b86837d0c1..1124679d42 100644 --- a/flags/gap.aconfig +++ b/flags/gap.aconfig @@ -70,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" @@ -273,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/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 2798c2a3b3..6e6337279e 100644 --- a/framework/tests/bumble/src/android/bluetooth/GattClientTest.java +++ b/framework/tests/bumble/src/android/bluetooth/GattClientTest.java @@ -434,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(); 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/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/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_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/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/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/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/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_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/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 b0783442b3..5f45e8a0b2 100644 --- a/system/gd/hal/snoop_logger.h +++ b/system/gd/hal/snoop_logger.h @@ -146,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; diff --git a/system/gd/hci/acl_manager/le_impl.h b/system/gd/hci/acl_manager/le_impl.h index ef5bfb0d7d..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) { diff --git a/system/gd/hci/acl_manager/le_impl_test.cc b/system/gd/hci/acl_manager/le_impl_test.cc index 274b6827c9..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) { @@ -1693,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(); -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(); + // 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_); } 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/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/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/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/stack.cc b/system/main/shim/stack.cc index b7b93d3690..027361875d 100644 --- a/system/main/shim/stack.cc +++ b/system/main/shim/stack.cc @@ -126,6 +126,7 @@ void Stack::StartEverything() { } is_running_ = true; + log::info("GD stack is running"); std::promise<void> promise; auto future = promise.get_future(); @@ -175,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()) { 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/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_main.cc b/system/stack/gatt/gatt_main.cc index 19fd83990a..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. */ 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/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/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 |