Commit Graph

37 Commits

Author SHA1 Message Date
changbetty
1096417464 [LE Audio] Add LE Audio Devices in Sound Settings
- When connected to the LE Audio Device, it will display "Play XXX on
    LEAduioDeviceName" in Sound Settings.

  - When connected to the LE Audio Device, it will display the LE Audio
    device name in the "Take call on" list for you having a active call(Hands Free).

  - Remove the @Ignore annotation for all the tests and make test
    cases pass.

Bug: 240911615
Bug: 243494881
Test: manual test
Test: make RunSettingsRoboTests ROBOTEST_FILTER=AudioOutputSwitchPreferenceControllerTest
Test: make RunSettingsRoboTests ROBOTEST_FILTER=HandsFreeProfileOutputPreferenceControllerTest
Test: make RunSettingsRoboTests ROBOTEST_FILTER=MediaOutputPreferenceControllerTest
Change-Id: I10db59b33623495a9e9933556c78e20d81e405ea
2022-10-14 06:10:52 +00:00
Tim Peng
7b0f887000 Update "Play media to" display rule in SoundSetting
- show under Casting mode
- hide under no connected Bluetooth devices
- update test case

Bug: 131143025
Test: make -j42 RunSettingsRoboTests
Change-Id: I0eac856970043ecd9a1975fbe382241078ece924
2019-04-24 04:23:44 +00:00
timhypeng
abdf739071 Sound + Output Switcher on Sound Setting
1. Show "play media to" item when Previously Connected device is available
2. Click "Play media to" to launch output slice
3. Update test case

Bug: 126475101
Test: make -j50 RunSettingsRoboTests
Change-Id: Id8afd1a2407acb78c11e81d2420ae8c16130a321
2019-03-12 03:07:36 +00:00
Fan Zhang
23f8d59d02 Sort imports
Having consistent import order will reduce chance of merge
conflict between internal and external master

Test: rebuild
Change-Id: I0b1a170967ddcce7f388603fd521f6ed1eeba30b
2018-08-28 22:13:15 +00:00
hughchen
de6d3202e1 Remove the function that not used in BluetoothCallback
Bug: 111811266
Test: Build pass
Change-Id: Ib33ec31607931f5e67d5119cf9b0cb6b894794a0
2018-08-06 17:53:08 +08:00
hughchen
244c7586f9 Use corresponding profile to get active bluetooth device
- Do not use streamType to decide which active device should return.
  Base on b/80453878 comment#6, the steamType intent will only be sent
  if an action is made on stream volume or a media route is changed:
  For instance when a call to setStreamVolume() or getDeviceForStream() is made.
  It is not broadcast on actual routing changes.
  It should not be used as an indicator that the route changed during a call.
  There is no callback API and the only option is polling with getDeviceForStream().
- Use corresponding profile to get active bluetooth device
  instead of streamType
- Add test to verify the result of findActiveDevice()
  eg:
  1. A2dp device active, hearing aid device not active : return a2dp device
  2. A2dp device not active, hearing aid device not active : return null
  3. hfp device active, hearing aid device not active : return hfp device
  4. hfp device not active, hearing aid device not active : return null

Bug: 80453878
Test: make -j42 RunSettingsRoboTests
Change-Id: I5bd94899a5d508e60ce911da9689b727ad1fc20c
2018-07-13 09:11:04 +00:00
TreeHugger Robot
db6d667ea4 Merge "Fix memory leaks in Settings" 2018-06-08 21:07:30 +00:00
Fan Zhang
838f6c7812 Fix memory leaks in Settings
Bug: 80507279
Test: inspected hprof before and after fix
Change-Id: I6ea2925695deb6261263649e858484e1667ec522
2018-06-08 11:56:42 -07:00
ryanywlin
884a945334 2nd attempt handle BT is not supported on emulator am: 59287d40d1
am: de3d9a0a73

Change-Id: I27c16d76f25480a36b5b73cdcb3042cee7754a5f
2018-06-08 11:33:53 -07:00
ryanywlin
59287d40d1 2nd attempt handle BT is not supported on emulator
Error handle before using LocalBluetoothManager in the onStart
and onStop

Bug: 80491267
Test: make RunSettingsRoboTests ROBOTEST_FILTER="AudioOutputSwitchPreferenceControllerTest" -j42
Change-Id: I47f7d3b7cddc2fbbafb8fb5cf0fb6adb2d0d2d55
2018-06-08 15:05:22 +08:00
Fan Zhang
d9f7fba943 Fix context leak in AudioSwitchPreferenceController.
In this controller the context is stored into a global singleton but was
not cleared, thus leaking context and associated views.

Change-Id: I4247f8ff753bc0a331c6c81a0e4b5b4bc41588de
Bug: 80507279
Test: robotests
Test: inspected hprof before/after change
2018-06-07 22:46:19 +00:00
Fan Zhang
ee96c3a259 Fix context leak in AudioSwitchPreferenceController.
In this controller the context is stored into a global singleton but was
not cleared, thus leaking context and associated views.

Change-Id: I4247f8ff753bc0a331c6c81a0e4b5b4bc41588de
Fixes: 80507279
Test: robotests
Test: inspected hprof before/after change
2018-06-07 18:53:59 +00:00
Ryan Lin
1e7e455495 Merge "Handle Bluetooth is not supported on emulator" into pi-dev am: 942b07da93
am: 15eb7fe8c4

Change-Id: I515f9679afa7962fda4f2d04392007d201468070
2018-05-31 22:41:53 -07:00
ryanywlin
d67314e771 Handle Bluetooth is not supported on emulator
- Disable audio swicher while Bluetooth feature is not supported
- Error handle before using LocalBluetoothManager in the constructor

Bug: 80491267
Test: make RunSettingsRoboTests ROBOTEST_FILTER="AudioOutputSwitchPreferenceControllerTest" -j42

Change-Id: I971f31cd08dd0a2778548f6d1d675f279d92ef8e
2018-05-31 12:48:13 +08:00
ryanywlin
1bc4284443 Move getLocalBtManager into FutureTask am: 988dc9fbe6
am: 7afd2e57a7

Change-Id: I7860a19b42b65844ec2a0fc8cf6c8b82d05fd4c6
2018-05-21 03:09:29 -07:00
ryanywlin
988dc9fbe6 Move getLocalBtManager into FutureTask
Utils.getLocalBtManager in constructor violate StrictMode
ThreadPolicy, move it into FutureTask.

Bug: 79985175
Test: make RunSettingsRoboTests ROBOTEST_FILTER="MediaOutputPreferenceControllerTest" -j28
Test: make RunSettingsRoboTests ROBOTEST_FILTER="HandsFreeProfileOutputPreferenceControllerTest" -j28
Test: make RunSettingsRoboTests ROBOTEST_FILTER="AudioOutputSwitchPreferenceControllerTest" -j28
Change-Id: I0a14be18e4766245e7d165239d47ab54fa5e4acb
2018-05-21 07:30:40 +00:00
hughchen
a2a26442eb Merge "Update UI when BT device is rename" into pi-dev am: 77d218ab72
am: 3053922340

Change-Id: I86bd3be4f017f5bd80a2308a5b1e99366027a476
2018-05-18 12:27:08 -07:00
TreeHugger Robot
77d218ab72 Merge "Update UI when BT device is rename" into pi-dev 2018-05-18 18:06:17 +00:00
hughchen
b6ac12eed4 Update DialogFragment UI when BT device is add/remove/rename
* Add AudioSwitchCallback() in AudioSwitchPreferenceController.
  This callback is used to notify SoudSettings to update the dialogFragment UI.
* Add UpdatableListPreferenceDialogFragment that updates the available
  options when dialog is shown
* Add test to verify the adapter count when
  onListPreferenceUpdated() is called.

Bug: 77783217
Test: make -j50 RunSettingsRoboTests
Change-Id: I8cac1b30ec50df026f4b7722dd1cd2f69e77a4cb
Merged-In: I8cac1b30ec50df026f4b7722dd1cd2f69e77a4cb
2018-05-17 07:40:52 +00:00
hughchen
615becb392 Update UI when BT device is rename
* Using getAliasName() instead of getName()
* Add BluetoothDevice isConnected check, when BluetoothDevice is
  disconnected. Do not add to the show list.

Bug: 77783217
Test: make -j50 RunSettingsRoboTests
Change-Id: I183fc693eaefd690568ba2f1ec740258b2bb62c8
2018-05-17 11:29:54 +08:00
hughchen
acb6e89c52 Update DialogFragment UI when BT device is add/remove/rename
* For fix the "Automatic merge failed" in pi-dev, cherry pick the ag/3937781 in
  master. Change android.support.* to androidx.*
* Add AudioSwitchCallback() in AudioSwitchPreferenceController.
  This callback is used to notify SoudSettings to update the dialogFragment UI.
* Add UpdatableListPreferenceDialogFragment that updates the available
  options when dialog is shown
* Add test to verify the adapter count when
  onListPreferenceUpdated() is called.

Bug: 77783217
Test: make -j50 RunSettingsRoboTests
Change-Id: I8cac1b30ec50df026f4b7722dd1cd2f69e77a4cb
2018-05-16 22:13:24 +08:00
Ryan Lin
b5f9ba4e9b Merge "Use another callback to notify the updater that UI should be updated" into pi-dev am: dee5035764
am: 5d7faa9696

Change-Id: I7db97d62afbdb6deacc9f0b34393697acd44b0f2
2018-05-11 15:24:30 -07:00
ryanywlin
5365eaa6db Use another callback to notify the updater that UI should be updated
Replace onConnectionStateChanged callback
with onProfileConnectionStateChanged. While
updater is notified, isFilterMatched(cachedDevice)
will decide whether to add/remove from UI based
on audio profiles and audio mode.

Bug: 76447449
Test: make RunSettingsRoboTests -j28
Change-Id: Icfba1ce2297e4638679158f9f99bae276940d885
2018-05-11 05:44:43 +00:00
ryanywlin
f95ed0925b Merge changes from topic "add-hearing-aid-device-in-audio-switch" into pi-dev am: 7e31e22f57
am: 82db752ef0

Change-Id: I7e9a40b08afebedb7b44a6345cda8b2564db315d
2018-05-09 20:46:27 -07:00
ryanywlin
8276d966e9 Add hearing aid device in audio switch
- Add connected hearing aid device to MediaOutputPreferenceController
and HandsFreeProfileOutputPreferenceController

- Set active device to different profile depend on HisyncId

Bug: 78142719
Test: make RunSettingsRoboTests ROBOTEST_FILTER="MediaOutputPreferenceControllerTest" -j28
Test: make RunSettingsRoboTests ROBOTEST_FILTER="HandsFreeProfileOutputPreferenceControllerTest" -j28
Test: make RunSettingsRoboTests ROBOTEST_FILTER="AudioOutputSwitchPreferenceControllerTest" -j28
Change-Id: Ib8fe4f06f8564572dffdce6fcc3f29578bf91bd9
2018-05-10 10:28:20 +08:00
ryanywlin
9f407aba36 Find active device for add hearing aids device into audio switcher.
- Find active device accroding to different stream type and
output device.

- update isStreamFromOutputDevice() to identify general case like
DEVICE_OUT_BLUETOOTH_A2DP is subset of DEVICE_OUT_ALL_A2DP.

- add test case for these methods.

Bug: 78142719
Test: make RunSettingsRoboTests ROBOTEST_FILTER="AudioOutputSwitchPreferenceControllerTest" -j28
Change-Id: I381135c120dbf051679bff7626d47e41f8d589da
2018-05-10 10:20:30 +08:00
ryanywlin
eb5019d05a Three methods for adding hearing aids device into audio switcher.
- Add three methods for subclass to get connected device list
denpending on different profiles.

- Test case for these methods.

Bug: 78142719
Test: make RunSettingsRoboTests ROBOTEST_FILTER="AudioOutputSwitchPreferenceControllerTest" -j28
Change-Id: Ia1367a53ab6a3432878a514490722871ed878954
2018-05-10 10:08:14 +08:00
android-build-team Robot
02ec86a17b Merge "Establish permanently unavailable settings" 2018-05-09 18:14:32 +00:00
Matthew Fritze
bd376296cd Establish permanently unavailable settings
Distinguish between settings which are permanently unavailable on
the device, and temporarily unavailable. This enables us to restrict
which setting slices are exposed in onSliceGetDescendants.

The primary changes in this CL are renaming:
"DISABLED_UNSUPPORTED" -> "UNSUPPORTED_ON_DEVICE"
to be more clear the the setting will cannot be accessed on the device, and,
adding a new enum to encapsulate settings which are currently unavailable, but
could be enabled in the future.

Also remove UNAVAILABLE_UNKNOWN. Devs should never need this enum.

Bug: 78910582
Fixes: 79245656
Test: robotests
Change-Id: I42c2cedab66be2d76999795f46470a079cc1ec71
Merged-In: I58821a6cfd6134b3b351657b6edf5f74ead00643
2018-05-09 10:03:40 -07:00
Matthew Fritze
f87a1f3f41 Establish permanently unavailable settings
Distinguish between settings which are permanently unavailable on
the device, and temporarily unavailable. This enables us to restrict
which setting slices are exposed in onSliceGetDescendants.

The primary changes in this CL are renaming:
"DISABLED_UNSUPPORTED" -> "UNSUPPORTED_ON_DEVICE"
to be more clear the the setting will cannot be accessed on the device, and,
adding a new enum to encapsulate settings which are currently unavailable, but
could be enabled in the future.

Also remove UNAVAILABLE_UNKNOWN. Devs should never need this enum.

Bug: 78910582
Bug: 79245656
Test: robotests
Change-Id: I58821a6cfd6134b3b351657b6edf5f74ead00643
2018-05-09 08:36:59 -07:00
hughchen
50d5c0a544 Change the title when in call/media state
* Change the title when in call/media state.
  Example: call state show "Available call devices"
           media state show "Available media devices"
* Use isAudioModeOngoingCall() utility function for checking if it is in call status
* Add register test to verify when in onStart() and onStop()
  the BluetoothCallback can be register and unregister.
* Add title string test to verify when in call or media state,
  the title can be changed to corresponding string

Bug: 78150641
Test: make -j40 RunSettingsRoboTests
Change-Id: I6be72cf0cae75525084ac3c5be8524c709f51f7d
Merged-In: I6be72cf0cae75525084ac3c5be8524c709f51f7d
2018-05-09 02:03:38 +00:00
hughchen
f431088f9d Change the title when in call/media state
* For fix the "Automatic merge failed" in pi-dev, cherry pick the ag/3909960 in
  master. Change android.support.* to androidx.*
* Change the title when in call/media state.
  Example: call state show "Available call devices"
           media state show "Available media devices"
* Use isAudioModeOngoingCall() utility function for checking if it is in call status
* Add register test to verify when in onStart() and onStop()
  the BluetoothCallback can be register and unregister.
* Add title string test to verify when in call or media state,
  the title can be changed to corresponding string

Bug: 78150641
Test: make -j40 RunSettingsRoboTests
Change-Id: I6be72cf0cae75525084ac3c5be8524c709f51f7d
2018-05-08 17:14:59 +08:00
caxtonchan
8118c8d7d0 Merge "Hide the audio switcher if it is not relevant" into pi-dev am: 3f5444b9e4
am: 67d44d9d61

Change-Id: I36b249159ef8d0a6d099ba776c5d682ea596e5e3
2018-04-24 21:04:45 -07:00
caxtonchan
458fb2319f Hide the audio switcher if it is not relevant
Bug: 78317337
Test: make RunSettingsRoboTests
ROBOTEST_FILTER="AudioOutputSwitchPreferenceControllerTest" -j28
ROBOTEST_FILTER="MediaOutputPreferenceControllerTest" -j28
ROBOTEST_FILTER="HandsFreeProfileOutputPreferenceControllerTest" -j28

Change-Id: I9824941cf410b26ad166aa163d7cccd3bfc31a06
2018-04-25 01:34:42 +00:00
Aurimas Liutikas
e0069d332d Migrate Settings to androidx.
Test: make Settings
Bug: 76692459
Change-Id: I941dea40562170649bf056e675cc32e5163c0e39
2018-04-20 12:52:29 -07:00
ryanywlin
dca308e56d Replace deprecated APIs in audio switcher.
- Remove isWiredHeadsetOn() and isBluetoothA2dpOn()
in MediaOutputPreferenceController.

- Remove isWiredHeadsetOn() and isBluetoothScoOn()
in HandsFreeProfileOutputPreferenceController.

- Replace with AudioManager.getDevicesForStream().

- Update test cases.

Bug: 78141441
Test: make RunSettingsRoboTests ROBOTEST_FILTER="MediaOutputPreferenceControllerTest" -j40
Test: make RunSettingsRoboTests ROBOTEST_FILTER="HandsFreeProfileOutputPreferenceControllerTest" -j40
Test: make RunSettingsRoboTests ROBOTEST_FILTER="AudioOutputSwitchPreferenceControllerTest" -j40
Change-Id: Ic57c40badf0fd5633f1b7412d63a0b5417d0f47a
2018-04-18 05:57:27 +08:00
ryanywlin
63bdfa8998 Add audio switch UI in sound settings
- Build two controller to control list preferences.

- MediaOutputPreferenceController which allows switching
the media output between current device and connected
BT device supporting A2DP. It also controls disabling
media output switching during a call or cast mode.

- HandsFreeProfilePreferenceController which allows
switching between HFP-connected BT devices while in
on-call state.

- Add test cases for controllers.

Bug: 74130772
Test: make RunSettingsRoboTests ROBOTEST_FILTER="MediaOutputPreferenceControllerTest" -j56
Test: make RunSettingsRoboTests ROBOTEST_FILTER="HandsFreeProfileOutputPreferenceControllerTest" -j56
Test: make RunSettingsRoboTests ROBOTEST_FILTER="AudioOutputSwitchPreferenceControllerTest" -j56

Change-Id: I37f5418442ce77e72cdff07f071ea519ab1047f3
2018-04-16 11:52:44 +08:00