Commit Graph

30 Commits

Author SHA1 Message Date
Yiyi Shen
efe2738735 Avoid unintended pref removal after CSIP main/member switch
Test: atest
Bug: 394765052
Flag: EXEMPT small fix
Change-Id: I5b4646ff9ee092b851d3f8d5cc3ac2030f189430
2025-03-13 17:32:38 +08:00
Yiyi Shen
07a346fcf5 Fix dup preference key on Connected devices page
Use different key (prefix + CacheBluetooothDevice hash) for
each BluetoothDevicePreference to avoid Java crash due to "Two different
ViewHolders have the same change ID".

Test: atest
Fix: 325831741
Flag: EXEMPT safe fix only change preference key string
Change-Id: Ic993f3cab206b794045c2f46e6b4b376bfa3adea
2024-07-01 15:32:34 +08:00
jasonwshsu
c1fb0ae240 [Pair hearing devices] Add "Saved devices" to show bonded but not connected hearing devices
* BaseHearingDevicePreferenceController will also be used in "Hearing devices", so extract to parent class first.

Bug: 237625815
Test: make RunSettingsRoboTests ROBOTEST_FILTER="(SavedHearingDeviceUpdaterTest|BaseBluetoothDevicePreferenceControllerTest|BluetoothDeviceUpdaterTest|AvailableMediaBluetoothDeviceUpdaterTest|ConnectedBluetoothDeviceUpdaterTest|SavedBluetoothDeviceUpdaterTest)"
Change-Id: I8a492866f48e3a664b9ff78bce5a4f082c0dc465
2023-02-09 10:17:25 +08:00
Hugh Chen
db53d1c6f8 Fix borken test on Bluetooth and connected package
Bug: 187239965
Test: make RunSettingsRoboTests -j56
Change-Id: Ic0d60a6cd46b1211efb2021f079c0b0a6534b383
2021-05-05 14:31:01 +08:00
Hugh Chen
bbbae9af8a Fix battery level of earbuds bt devices is inconsistent
Before this CL, bluetooth settings update the battery level of earbuds
when receiving first pair status callback. But sometimes the callback
will not send immediately cause the battery level is inconsistent.

This CL will update the earbuds battery level when onResum() to refresh
battery level immediately.

Bug: 174929347
Bug: 159544311
Test: make -j42 RunSettingsRoboTests
Change-Id: I8505f8fed4ec821b9fa2d88bc437bddd7a30f0e2
2021-03-08 16:38:31 +08:00
Jason Chiu
130629b1db Show paired devices on Bluetooth device slice card
- support tapping to activate for all available media devices including
  Hearing aid and Headset
- support tapping to connect for previously connected devices

Bug: 149667096
Test: robotest
Change-Id: I25f74b1b20fbb1876200a561775aa675ff60ac37
2020-03-09 17:43:29 +08:00
Jason Chiu
2d609759cd Add preference click metric logs for some special cases
Bug: 137559984
Test: visual, robotest
Change-Id: If8624b49abcd0000487065160ce4a7ba861f234c
2020-01-02 17:45:23 +08:00
hughchen
14e0fe2707 Put newly discovered devices to the bottom of the list
Add two type SortType.TYPE_DEFAULT and SortType.TYPE_FIFO in BluetoothDevicePreference.
It needs to decide the sort type when you create the BluetoothDevicePreference.
TYPE_DEFAULT - According to the CacheBluetoothDevice state to sort
TYPE_FIFO - According to the timestamp to sort

Bug: 112546918
Test: make -j42 RunSettingsRoboTests
Change-Id: Icd25d9b76a44d5a105f8daf64e5bc1f9ead8cd92
2019-07-24 15:27:17 +08:00
hughchen
d39fbe0f23 Remove all device from preference when BT is disabled
The issue is happened when BT is disabled then navigate to
"Connected devices". BluetoothDeviceUpdater didn't update
UI when BT is disabled. Remove all device from preference when
BT is disabled.

Bug: 80090956
Test: make -j42 RunSettingsRoboTests
Change-Id: Ia1fd8cfbcf95d712a1a702fdf101ff98186b76cd
2019-04-19 09:50:03 +08:00
jackqdyulei
a2208c008b Fix broken bluetooth robo tests
Bug: 129159331
Test: RunSettingsRoboTests
Change-Id: I3e64659e59fd9b2ac58bf697116e1ee34928a3cd
2019-03-25 13:15:30 -07:00
James Lemieux
f1dade40d2 Use binary resource support in robolectric
The resources available to tests are now exactly the merged resources
located in the APK under test.

Bug: 74359828
Test: make -j56 RunSettingsRoboTests
Change-Id: I050db81a92decefea23314b5ec7a62f77ff4bb2b
2018-12-12 19:53:49 -08:00
jackqdyulei
0edde89f83 Add ACL state listener for bt devices
Bug: 79947085
Test: RunSettingsRoboTests
Change-Id: Ic8bee34fa940f95265ed838f7c7f038ba3cf8143
2018-10-30 15:54:41 -07:00
timhypeng
c95056d7b5 Make HearingAid code more generic
-handle UI updating when sub device connection state changes
-add test case

Bug: 112735753
Test: make -j42 RunSettingsRoboTests
Change-Id: Ie2643657c47a0956aac3f8cac4bfdbdea0399ce8
2018-10-25 04:06:40 +00:00
jackqdyulei
8800b9e1ff Use isConnected in CachedBluetoothDevice
This method check whether it has connected profile, not physical
connection between devices.

It make more sense to use it in settings:
1. We only care about whether it has active profile(i.e. A2dp, hfp..)
2. Sometime when profile is disconnected, BluetoothDevice.isConnected()
still return true. This may make UI flaky.

Bug: 79947085
Test: RunSettingsRoboTests
Change-Id: I44039704508a742c7a8aef0a035afcf169b08939
2018-10-02 15:55:21 -07: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
8ee474a369 Clear connected Bluetooth device from preference when Bluetooth state is off
1. Clear connected Bluetooth device from preference when Bluetooth state
   is off.
2. Do not force to update the list of Bluetooth device when Bluetooth is
   disable.
3. Add test to verify following situations:
   1. Do not force to update the list of Bluetooth device when Bluetooth
      is disable.
   2. Force to update the list of Bluetooth device when Bluetooth is
      enable.
   3. Force to update the list of Bluetooth device when Bluetooth state
      is on.
   4. Clear the connected Bluetooth device from preference when
      Bluetooth state is off.

Bug: 110178164
Test: make -j42 RunSettingsRoboTests
Change-Id: I8b17c5d761e010e4eab620355c8b9185543e85ed
2018-08-10 15:37:09 +08:00
timhypeng
8833bb61d2 remove unnecessary mock in BluetoothDeviceUpdaterTest
Bug: 111848213
Test: make -j50 RunSettingsRoboTests
Change-Id: If1c46614ec6e40c66eb121cc48caa1fbc9c39871
2018-08-07 08:21:51 +00:00
hughchen
34066fa21a Add error handle for device that not support Bluetooth
- Add LocalBluetoothManager null check for device that
  not support Bluetooth
- Add test to verify when LocalBluetoothManager is null
  will not crash

Bug: 110712414
Test: make -j42 RunSettingsRoboTests
Change-Id: Ib506a0206cfcfdfec60bdfcf9a1944338a7ab729
2018-06-28 11:57:36 +08:00
Fan Zhang
c7162cd24d Reorder and clean up imports.
Test: rebuild
Change-Id: I178485c84ae7146f991fd77b6d7504b029942a68
2018-06-18 15:45:09 -07:00
Aurimas Liutikas
e0069d332d Migrate Settings to androidx.
Test: make Settings
Bug: 76692459
Change-Id: I941dea40562170649bf056e675cc32e5163c0e39
2018-04-20 12:52:29 -07:00
TreeHugger Robot
5a2f73151e Merge "Implement audio switch UI" into pi-dev 2018-04-16 18:34:37 +00:00
hughchen
bd3e5de207 Implement audio switch UI
* Implement available media devices group
* Add AvailableMediaDeviceGroupController to realize UI, the user can see the all device that can be activated in this group.
* ConnectedDeviceGroupController change to show the device that cannot be activated but is connected.
* Refactoring the below class, implement the controller in connected_devices.xml.
  ConnectedDeviceGroupController.java
  SavedDeviceGroupController.java
  ConnectedDeviceDashboardFragment.java
  connected_devices.xml
* Add AvailableMediaBluetoothDeviceUpdaterTest to verify the add/remove preference behavior when connectedStateChanged or profileAudioStateChanged
* Add test that used to verify device is connected or not in BluetoothDeviceUpdaterTest.
* Add test that used to verify the add/remove preference behavior when connectedStateChanged or profileAudioStateChanged in ConnectedBluetoothDeviceUpdaterTest.
* Add AvailableMediaDeviceGroupControllerTest to verify bluetooth feature is supported or not and test register callback.
* Add test that used to verify bluetooth feature is supported or not and test register callback in ConnectedDeviceGroupControllerTest.
* Add test that used to verify bluetooth feature is supported or not and test register callback in SavedDeviceGroupControllerTest

Bug: 74134939
Test: make -j40 RunSettingsRoboTests
Change-Id: I54d03c2ddadc6a4be7519dd74cdbcb5055d44083
2018-04-15 04:22:25 +00:00
Isha Bobra
35e217f91f Show only 1 entry for hearing aid devices without killing the activity.
This CL tries to detect Bluetooth hearing aid devices and tries to
combine the entry of the hearing aids with the same HiSyncIds and
show only 1 entry for each pair in the connected devices list.

This CL also shows 2 battery status in the device details page.

This change shows the combined entry after a user returns to the
settings activity after pressing the back button or somehow
without killing it. It also combines the entries just after pairing.

Test: RunSettingsRoboTests
Bug: 74204427

Change-Id: I47fb0bdd96b1cc972d88a4aef85d0113985d63bb
2018-04-13 22:51:58 +00:00
James Lemieux
22a39c2b93 Use external/robolectric-shadows/run_robotests.mk
This allows Settings to test against the latest framework changes.

Also replaced TestConfig with traditional robolectric.properties.

Bug: 73173204
Bug: 73892008
Test: make -j56 RunSettingsRoboTests
Change-Id: I3135b4fa5f095ba79b282a76f45dd9baa2584bc7
2018-03-04 03:50:08 -08:00
Fan Zhang
7cf99f5f12 Migrate more settings to use SubSettingsLauncher
Bug: 73250851
Test: robotests
Change-Id: I08f6f380489646231d6d8ceb1488e2efb036bf69
2018-02-18 21:10:03 -08:00
jackqdyulei
f2ef447e8e Tweak bluetooth text alignment
1. Remove the placeholder summary so it won't show blank summary
2. Update settings_entity_header to make text center_vertical,
so it could align with the icon.

Bug: 71742145
Test: Screenshot
Change-Id: I185114a4e0c8d996f218075a8633e802fabf3c66
2018-01-17 12:26:21 -08:00
jackqdyulei
6c94769e56 Add summary placeholder for bt preference
Then UI won't be janky(as everything slide down a little bit)

Bug: 63910184
Test: RunSettingsRoboTests
Change-Id: Ie4074694f54af92da52f09d2caaab5490fa73647
2017-12-22 10:25:04 -08:00
jeffreyhuang
cbfb099a40 Rename SDK_VERSION_O to SDK_VERSION
Test: make RunSettingsRoboTests -j40
Change-Id: I6715062d8addadda441e32809db1af55f15e3a90
2017-12-05 16:43:54 -08:00
jackqdyulei
aec5543841 Add preference group for saved devcies.
Currently it only contains bluetooth devices.

Bug: 3240835
Test: RunSettingsRoboTests
Change-Id: Ief102e7174a4c4610dbda6b728419b303ff928f9
2017-11-27 12:56:44 -08:00
jackqdyulei
88579e2558 Add infrastructure for connected device group.
The core thing is to find out a way to update group when devices
(bt device and usb device)are updated.

The infrastructure contains three parts:
1. ConnectedDeviceController
Normal PreferenceController. Get info from sub controller and update
the preferenceGroup.

2. BluetoothDeviceUpdater
Listen to bluetooth callback, decide whether to add/remove devices

3. DevicePreferenceCallback
Interface to add/remove preference. This interface will be used in
ConntectedDeviceController and future SavedDeviceController

Bug: 69333961
Test: RunsettingsRoboTests
Change-Id: I85a9ef216a801d5f0dd1cf0130d53850a68be4bd
2017-11-21 12:46:30 -08:00