Commit Graph

43 Commits

Author SHA1 Message Date
Yiyi Shen
cb32a15f1b [Audiosharing] Fix hysteresis mode
1. Move start broadcast logic from onPlaybackStarted to
   onBroadcastMetadataChanged
2. Move add source logic from onReceiveStateChanged(BIS>0) to
   onSourceAdded

Test: atest
Bug: 355222285
Bug: 377658982
Flag: com.android.settingslib.flags.audio_sharing_hysteresis_mode_fix
Change-Id: Ie0a2345e16caa2804fede930d174a67f2ec60259
2024-11-12 17:48:26 +08:00
Yiyi Shen
2fc788c35a [Audiosharing] Enable audio sharing UI when preview option on.
Test: atest
Bug: 368401233
Flag: com.android.settingslib.flags.audio_sharing_developer_option
Change-Id: Idbc84e2c43f7361c58c440d1a7d7c78edd3c0521
2024-11-04 14:27:42 +08:00
Yiyi Shen
d2e97b455e Merge "[Audiosharing] Show dialogs when lifecycle isAtLeast STARTED" into main 2024-09-26 02:49:43 +00:00
Yiyi Shen
57355a0743 [Audiosharing] Show dialogs when lifecycle isAtLeast STARTED
Test: atest
Flag: com.android.settingslib.flags.enable_le_audio_sharing
Bug: 305620450
Change-Id: I34f4f46b9377f1e3ec1a4cd27687c14d674f6da4
2024-09-25 17:13:19 +08:00
Yiyi Shen
5ea28f5f0a [Audiosharing] Apply new string resid
Test: atest
Flag: com.android.settingslib.flags.enable_le_audio_sharing
Bug: 362858921
Bug: 362858894
Change-Id: I4c80d834515e43bade5f2207dc013dc30c6ab7be
2024-09-23 18:56:04 +08:00
Yiyi Shen
51fc7a8239 Rename AudioSharingRetryDialogFragment
Test: atest
Flag: com.android.settingslib.flags.enable_le_audio_sharing
Bug: 362858894
Change-Id: I157b036541e9a7b21205ee45437bfd4562c49118
2024-09-23 16:20:48 +08:00
Yiyi Shen
322e153350 Rename AudioSharingLoadingStateDialogFragment and layout
Test: atest
Flag: com.android.settingslib.flags.enable_le_audio_sharing
Bug: 362858894
Change-Id: I05e29b248541511daca355f1bbe4a13b17b4d20d
2024-09-23 15:46:27 +08:00
Yiyi Shen
302b26ff74 [Audiosharing] Show retry dialog when error occurs in start sharing
Errors including:
1. onBroadcastStartFailed
2. onSourceAddFailed

Test: atest
Flag: com.android.settingslib.flags.enable_le_audio_sharing
Bug: 362858894
Change-Id: I0fe13bd675672c57219d0f6f3e735515a7ed7a06
2024-09-23 11:07:20 +08:00
Yiyi Shen
800f81c832 [Audiosharing] Refine share then pair flow
Currently when there is one active LEA headset and users toggle on the audio sharing, a dialog will pop up to ask users to pair new headset and share audio with it. After user click pair new device button on the dialog:

1. Route users to pair new device page.
2. If users pair an LEA headset, finish the pair new device page and
   auto add source to the headset with loading indicators on audio
   sharing page.
3. If users pair a classic headset, wait for timeout, pop up dialog
   saying the paired headset is not compatible for audio sharing and
   finish the pair new device page.

Test: atest
Flag: com.android.settingslib.flags.enable_le_audio_sharing
Bug: 331892035
Change-Id: Ifb9579db0ef57d3a379cb5d17c66a604d1396bb4
2024-09-19 14:03:48 +08:00
Yiyi Shen
a6d9fa163e [Audiosharing] Show loading state on audio sharing page
1. Show "Sharing audio stream..." once starting audio sharing
2. Show "Sharing with <devicename>..." once adding source to the device

Test: atest
Flag: com.android.settingslib.flags.enable_le_audio_sharing
Bug: 362858894
Change-Id: I6c19d999baaa91d6a5365f24e88efe79c2b38072
2024-09-12 18:21:03 +08:00
Yiyi Shen
439873d08e [Audiosharing] Change main toggle enable conditions.
Enable the toggle when:
1. In audio sharing
2. No connected LEA device. We will show dialog to guide users to
   connect a compatible device.
3. Has active device, which means it is a healthy state after broadcast
   -> unicast switch.

Flag: com.android.settingslib.flags.enable_le_audio_sharing
Test: atest
Bug: 305620450
Change-Id: I2c8067f7882df6943beb3704f63a3e1113ce55d2
2024-09-09 14:07:17 +08:00
Yiyi Shen
b819fa9020 [Audiosharing] Disable main toggle till device gets active.
Broadcast <-> unicast costs some time, so we grey out the audio
sharing toggle until the device get active on unicast when users toggle
off the sharing.

Flag: com.android.settingslib.flags.enable_le_audio_sharing
Test: atest
Bug: 359755881
Change-Id: I868a470430f6fb54c142f17552d70fa5fa8a2476
2024-09-02 06:54:41 +00:00
Yiyi Shen
bece2128d2 [Audiosharing] Avoid dialog when onPlaybackStarted after call ends
Test: atest
Flag: com.android.settingslib.flags.enable_le_audio_sharing
Bug: 362714470
Bug: 355222285
Change-Id: I9f6e1138f0877b607fb75ffef2ff249ef1114e6d
2024-08-30 14:50:05 +08:00
Yiyi Shen
d7d72f70d5 [Audiosharing] Handle auto start intent from QS
When intent extra EXTRA_START_LE_AUDIO_SHARING is true, audio sharing
page needs auto toggle on the main switch and start audio sharing.

And if there are one active sink and one connected sink, auto add source
to them without popping up dialog.

Test: atest
Flag: com.android.settingslib.flags.enable_le_audio_sharing
Bug: 331892035
Change-Id: I0c677ea33c9e0e3eeb8495c8618bff685b13a8ed
2024-08-27 11:45:30 +00:00
Yiyi Shen
0f94d4c718 [Audiosharing] Toast message when sharing on/off
Test: manual
Bug: 358249608
Flag: com.android.settingslib.flags.enable_le_audio_sharing
Change-Id: I0f9620d4844b3133f0f213adda24350884fe2d5f
2024-08-16 17:37:21 +08:00
Yiyi Shen
7edad1c84a [Audiosharing] Returns BluetoothDevice when fetchConnectedDevicesByGroupId
CachedBluetoothDevice can change its member variable mDevice, so we can
not rely on the CachedBluetoothDevice#getDevice when we add source to
it. This change will return BluetoothDevice instead of
CachedBluetoothDevice when fetchConnectedDevicesByGroupId, so that we
won't add source to unintended BluetoothDevice via
CachedBluetoothDevice#getDevice.

Fix: 350877510
Test: atest
Flag: com.android.settingslib.flags.enable_le_audio_sharing
Change-Id: I4ee41b8f1449e7176f0a05a7dd4e59034c161824
2024-08-02 05:20:31 +00:00
Yiyi Shen
124a9e1ebd [Audiosharing] Not announce enable/disable when toggle main switch
Fix: 356318679
Test: atest
Flag: com.android.settingslib.flags.enable_le_audio_sharing
Change-Id: I3331f9ded48352f442712287a6b536da883fe73d
2024-07-31 18:56:33 +08:00
Yiyi Shen
7b2435a01c [Audiosharing] Clean up dup codes
Bug: 305620450
Flag: com.android.settingslib.flags.enable_le_audio_sharing
Test: atest
Change-Id: Ife2bf26d78e522dc51891be633d6635883923de3
2024-07-30 15:34:09 +08:00
Yiyi Shen
52cbe21569 [Audiosharing] Add audio sharing loggings (P4)
Bug: 331515891
Test: atest
Change-Id: I05e1c138f9cc32c4e873852f93bac65d3d0dc3ca
2024-06-17 18:46:11 +08:00
Yiyi Shen
2c6b9bb364 [Audiosharing] Increase audio sharing test coverage
Bug: 345686602
Test: atest
Change-Id: Iec196fc884c3b7ddd580eb8dd13b445d59e3b1b7
2024-06-14 14:30:14 +08:00
Yiyi Shen
fec890eabd [Audiosharing] Log action in audio sharing dialogs
P3 for add audio sharing loggings

Bug: 331515891
Test: atest
Change-Id: Iea29e74e00c239e8cb8cddee6eae71ba902add01
2024-06-07 11:32:19 +08:00
Yiyi Shen
bfdcc82dc7 [Audiosharing] Add flag to start broadcast with no lea headset connected
Allow audio sharing with no connected le audio headset when settings_need_connected_ble_device_for_broadcast is false

Bug: 343277847
Test: atest
Change-Id: I560338d53ddf290550faf8198cd7173bb734d150
2024-05-29 15:46:37 +08:00
Yiyi Shen
e5bd60a0cf [Audiosharing] Migrate feature from overlay to Settings
Bug: 340379827
Test: atest
Change-Id: I3a88ac1d2f575f3be1f26f617479bbfd25cf6a8e
2024-05-16 05:05:41 +00:00
Yiyi Shen
dd7626f55b [Audiosharing] Clean up audio sharing from Settings
Bug: 324023639
Test: atest
Change-Id: Ie73790442f39af60b125bbd48182a700bb0b290a
2024-02-26 17:24:53 +08:00
Yiyi Shen
a4cf715181 [Audiosharing] Set/get compatibility config by toggle.
Also use startPrivateBroadcast() to start the broadcast with
compatibility config stored in SettingsProvider.

Test: manual
Bug: 305620450
Bug: 292538935
Change-Id: Iff067833fb0668531aa32957b414585751f2bcee
2024-01-22 14:09:48 +08:00
Yiyi Shen
9f60c22fad [Audiosharing] Skip active device switch
For framework investigation on the handover issue.

Test: manual
Bug: 305620450
Change-Id: I84f87feac4b72f54eaa1f59ff5524b887bfd00f1
2024-01-10 19:22:11 +08:00
Yiyi Shen
ca6b0f7506 [Audiosharing] Use new API to start private broadcast.
Test: Manual
Bug: 305620450
Change-Id: I7607acdbc647c7c06969fda588ba159a8fb47ed0
2023-12-14 09:12:18 +00:00
Yiyi Shen
87e6d6e32c [Audiosharing] Fix main sharing flow.
Fetch the active device before starting the sharing. Because once the
sharing is started, all devices connected will switch to inactive.

Flagged with enable_le_audio_sharing

Bug: 305620450
Test: manual
Change-Id: Ie287d1094fe40dbcb42c121ea79409fc48e0eec7
2023-12-04 18:37:32 +08:00
Yiyi Shen
bc3a1fa31f [Audiosharing] Add feature gates as utils.
Flagged with enable_le_audio_sharing

Bug: 305620450
Test: manual
Change-Id: I022174b5b40300b46b7b8dd78c7cddf541ed2aec
2023-11-29 17:55:28 +08:00
Yiyi Shen
bdc870a4c1 [Audiosharing] Show/hide audio sharing settings based on BT state.
Flagged with enable_le_audio_sharing

Bug: 305620450
Test: atest
Change-Id: I1af8ae268194cfca8e03cc49151b68a25717e89a
2023-11-28 19:17:40 +08:00
Yiyi Shen
ae728039ac [Audiosharing] Enable/disable the main switch base on BT state.
Flagged with enable_le_audio_sharing

Bug: 305620450
Test: Manual
Change-Id: I48bf0c6fb40ff629610e6e1a48e209fea44ebdde
2023-11-24 15:41:43 +08:00
Yiyi Shen
b82f290fce [Audiosharing] Set earlist connected device active in sharing.
Flagged with enable_le_audio_sharing

Bug: 305620450
Test: Manual
Change-Id: I8e0132f3d982fe2723581cd2aafd3cb9a9ed409c
2023-11-23 15:40:50 +08:00
Yiyi Shen
ddebe7293b [Audiosharing] Reimpl audio sharing main switch
New flow: Automatically add sharing source to connected active device eligible for
audio sharing. And then pop up the dialog for users to choose an additinal eligible device
to share audio.

Old flow: Pop up the dialog first and add sharing source after user
interact to the dialog.

Flagged with enable_le_audio_sharing

Bug: 305620450
Test: Manual
Change-Id: If0d1609b2677ca9ecae926c198f305fd1f4e34d3
2023-11-22 11:38:01 +08:00
Yiyi Shen
83798bfbc5 [Audiosharing] Add a util class for audio sharing.
Flagged with enable_le_audio_sharing

Bug: 305620450
Test: Manual
Change-Id: Iea5d4faa83eeef2d7104b9c31679e9226b75f4a6
2023-11-15 11:22:41 +00:00
Yiyi Shen
21ed1b0358 [Audiosharing] Impl a base controller for audio sharing page.
The preference controllers attached to audio sharing page will extends
this base controller so that their visibility will be updated together
depending on the main switch state.

Flagged with enable_le_audio_sharing

Bug: 305620450
Test: Manual
Change-Id: I3d37c87a128098a1b1a38cb8621be9a4d4e8c15e
2023-11-14 20:00:28 +08:00
Chaohui Wang
08a1c9876e Revert^2 "Migrate to CompoundButton.OnCheckedChangeListener"
8979681a8d

Change-Id: I60edd3aabf49afbe4aa016af780baa68d928bddf
2023-11-07 14:17:15 +00:00
Sebastian Pickl
8979681a8d Revert "Migrate to CompoundButton.OnCheckedChangeListener"
Revert submission 25147565-onSwitchChanged-CompoundButton

Reason for revert: breaking builds 

Bug:309601476

Reverted changes: /q/submissionid:25147565-onSwitchChanged-CompoundButton

Change-Id: Ie746db87d9c642599593aa3d5e5baf6b7ba89c0e
2023-11-07 13:26:36 +00:00
Chaohui Wang
71d1f021af Migrate to CompoundButton.OnCheckedChangeListener
Switch and SwitchCompat are both CompoundButton.

Using CompoundButton in Java will helps migration in the future.

Bug: 306658427
Test: manual - check Settings pages
Change-Id: If2e08a9a9557ec66a3b31ef18cd2e15943098a59
2023-11-07 20:22:27 +08:00
Yiyi Shen
87372de071 [Audiosharing] Impl audio sharing main switch.
Start/stop broadcast when >=1 eligible buds connected.

Flagged with enable_le_audio_sharing

Bug: 305620450
Test: Manual
Change-Id: Ic982571f49ab79c39d0503929df4bb8be64b720e
2023-11-07 15:41:34 +08:00
Yiyi Shen
cded970a4b [Audiosharing] Impl audio sharing main switch.
Start/stop broadcast when no eligible  buds connected.

Flagged with enable_le_audio_sharing

Bug: 305620450
Test: Manual
Change-Id: I04359c0954e336ceb1a89a7836199b5be0b5e0c5
2023-11-03 16:20:35 +08:00
Yiyi Shen
738962fb28 [Audiosharing] Add audio sharing dialog.
Open the dialog when audio sharing main switch on.

Flagged with enable_le_audio_sharing

Bug: 305620450
Test: Manual
Change-Id: I5b7cf655782a1da8b4fbd42eca11b473bac339b0
2023-10-31 17:04:52 +08:00
Chaohui Wang
12ea5afdf1 Not call MainSwitchBar.getSwitch()
This is private implement details, will be removed in future.

Should call MainSwitchBar's isChecked() and setChecked() to ensure
main switch bar's style is set correctly.

Bug: 306658427
Test: manual - on wifi tether
Test: manual - on developer options
Test: m RunSettingsRoboTests
Change-Id: I292ffbcf73da0721fc206e3dac7610a0aeb20047
2023-10-25 13:52:43 +08:00
Yiyi Shen
4410df7f42 [Audiosharing] Add audio sharing settings with the main switch.
Flagged with enable_le_audio_sharing

Bug: 305620450
Test: Manual
Change-Id: I9ca520014d3f6f7147bb9b8e7648797e79b46f53
2023-10-24 16:12:13 +08:00