Commit Graph

87 Commits

Author SHA1 Message Date
jasonwshsu
15c6533ef9 Connected devices page did not show correct summary when member device connect
Root Cause: CsipDeviceManager only refreshes UI when switching member device content.

Solution:
* CsipDeviceManager needs to call refresh() on main device when it's new
  member device added.
* UI widget Settings/BluetoothDevice also need to monitor it's member device status to refresh UI.

Bug: 344947362
Test: atest BluetoothDevicePreferenceTest
Flag: EXEMPT bugfix
Change-Id: I58f9e2fc209d4e87631784d0538b1647228f4c1a
2024-08-09 09:49:35 +08:00
Angela Wang
3e9f1ff659 New hearing device pairing page (1/2)
Rewrite a new hearing device pairing page with update UI for "See more
devices".

Bug: 307473972
Test: atest HearingDevicePairingFragmentTest
Test: flip the flag com.android.settings.flags.new_hearing_device_pairing_page && atest HearingAidPairingDialogFragmentTest AddDevicePreferenceControllerTest
Change-Id: Ic60601905e3d0d7d7c5b1ef9733652118a211f1d
2024-01-16 03:49:34 +00:00
SongFerngWang
d140634164 To Add try-catch for MetadataChangedListener to handle the Exception
Since the BT is not enabled, the BluetoothAdapter can't register
the device into Metadata List. Then, the BluetoothAdapter throws the
execption while the UI did the unregister.

Bug: 291207069
Test: build pass
Change-Id: I86e0a3369d7371747a249b34f949d59929afb1c7
2023-08-31 07:10:12 +00:00
Chaohui Wang
8e2ae547d6 Clean up FeatureFactory.getFeature()
Bug: 286764889
Test: m Settings
Change-Id: I7e472e6b0ca6b7a735c1b92742ddf06c545176fc
2023-08-08 08:41:48 +00:00
Chaohui Wang
2541381259 Fix references to resources for Settings
Bug: 293810334
Test: m Settings
Change-Id: Ie140278f492ef7e1c062ec1ecae2866c521a86aa
2023-08-08 01:56:05 +00:00
Chaohui Wang
bb47f32011 Fix bluetooth settings pairing page stuck
There is heavy work to do when add device to list in the
DeviceListPreferenceFragment, off load these work from main thread
to solve the issue.

Make devicePreferenceMap a ConcurrentHashMap to avoid potential race
condition.

Also no longer use getCachedPreference(key) since we not put anything
into the cache, the fallback flow is always used.

Also in BluetoothDevicePreference.onPreferenceAttributesChanged(), move
more heavy work to background thread.

Using System.currentTimeMillis() to sort devices could cause flaky
because System.currentTimeMillis() could be same for different device,
use AtomicInteger instead.

Fix: 286628533
Test: Following the step in bug
Change-Id: Ia9750adb6b4c1424d084381e9d7c2ca8e7912391
2023-06-15 08:43:17 +00:00
SongFerngWang
1872151b4f The BluetoothDevicePreference register the MetadataChanged
The bluetooth device preference needs to refresh UI after MetadataChanged
Fix: 282877247
Test: make RunSettingsRoboTests ROBOTEST_FILTER=BluetoothDevicePreferenceTest

Change-Id: I02cb07a6b255242e4877089ce2f3b7559ce02362
2023-05-24 04:49:41 +00:00
changbetty
3caa8ad8f0 To check the bond state when get the connection state
Bug: 251973679
Test: manual test
Change-Id: I1e637bf5accbc5706f9d8a6f557a4fe038dae66b
2022-12-21 09:17:39 +00:00
timhypeng
830cb48593 AID_SYSTEM_USER - Main thread blocked at getConnectionSummary()
-move getConnectionSummary() to background thread.

Bug: 239394377
Test: atest BluetoothDevicePreferenceTest
Change-Id: I6911f53860ff48ef6a9fa5fe3007c004e6e4a331
2022-07-25 01:28:46 +00:00
Hugh Chen
3cf4c3f3a5 Use new api to get bluetooth device icon
This CL use CachedBluetoothDevice#getDrawableWithDescription()
to get bluetooth device icon.

Bug: 178255374
Test: make RunSettingsRoboTests -j56

Change-Id: I45c273e2dd782029da7a3a2724cbca3762cc2d9c
2021-04-20 19:13:34 +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
Hugh Chen
60ce7bebcf Fix anr issue on connected devices settings
Before this CL, connected devices settings will use ContentResolver
to get advanced device bitmaps on the UI thread. It will have a little
chance to cause ANR.

This CL uses background thread to get a bitmap to fix ANR issue.

Bug: 173283590
Test: Test: make -j42 RunSettingsRoboTests
Change-Id: I987759a775d507003fd4ef54f5376bd24e660b3b
2020-11-18 17:37:56 +08:00
Hugh Chen
cafeab2813 Fix the device on "Media devices" wouldn't update
- This CL use new CachedBluetoothDevice callback instance
  in construct to avoid unregister wrong callback.
- This CL use flag to make sure preference will register
  callback on onAttached() when preference remove callback
  on onPrepareForRemoval() or onDetached().
- Update test case

Bug: 168682778
Bug: 157653997
Test: make -j42 RunSettingsRoboTests
Change-Id: I7a0d9f5332153ee80634e191847b84cd7c380b7d
2020-09-17 08:45:12 +00:00
Hugh Chen
a6aae425bc Fix settings crash
- This CL before, "Previously connected device" didn't
  handle dock device. If user have disconnected dock
  device will cause Settings crash.

  This CL add condition to handle dock device to avoid crash.
- Update test case.

Bug: 167054620
Test: make -j42 RunSettingsRoboTests
Change-Id: I769cee3f589e14a993b00a0ae6ec3ddfba8ef281
2020-09-02 17:14:30 +08:00
hughchen
043e43f059 Listed order on "previously connected" depend on recently connected devices
This CL use Bluetooth api "getMostRecentlyConnectedDevices()" to get
recently connected devices list. Let "previously connected" will list
most recently connected device on the top.

Bug: 130984590
Test: make -j42 RunSettingsRoboTests
Change-Id: I8d425b6da6cb9fe9fd1417937b4cb9a052cd1660
2020-02-03 14:08:12 +08:00
hughchen
0ab3283ccf Update api name
Use CachedBluetoothDevice.connect() instead of
CachedBluetoothDevice.connect(boolean) to connect
Bluetooth device.

Fixes: 141582844
Test: manually
Change-Id: I8c50678bdfd6de89fb8d56122bfa38bdd5ac5c9d
2020-01-14 16:10:06 +08:00
hughchen
41eab2c203 Fix flaky test error
Before this CL, we didn't consider the case of two
preferences timestamp are the same.

If 2 preferences timestamp are the same, the second preference
will first out. it will cause test case will fail some times.

In this CL, if two BluetoothDevicePreference's timestamp are the same,
The first BluetoothDevicePreference is first out.

Bug: 138547532
Test: make -j42 RunSettingsRoboTests
Change-Id: I7366275e8edf615c582481a570ea0c25b8d37a66
2019-08-16 01:26:42 +00: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
timpeng
0dde3a3b34 [Fix] prevent Talkback from reading out Bluetooth ImageView ContentDescription
- set View.IMPORTANT_FOR_ACCESSIBILITY_NO to ImageView

Bug: 128396030
Test: RunSettingsRoboTests
Change-Id: I267921057ede734a3c9be7087f34c96631e04859
2019-05-02 02:05:00 +00:00
TreeHugger Robot
2107255f52 Merge "Remove unnecessary notify in BT preference" 2019-04-02 19:36:30 +00:00
jackqdyulei
36948cefe9 Remove unnecessary notify in BT preference
notifyHierarchyChanged() is used before when we have
connected/disconnect deivce in same list. So only use it in
DevicePickerFragment.java, not other normal fragments.

Also that call will rebuild whole preference list, which is heavy.

Bug: 119479725
Test: Manual
Change-Id: I06cf221588001b38634fec9f02dee8bc1e561ea8
2019-04-01 12:39:24 -07:00
hughchen
9d4b634535 Remove method that used to get rainbow bt icon
Move get rainbow bt icon method to settingsLib

Bug: 128570540
Test: RunSettingsRoboTests
Change-Id: Iee022bd1471f1da057b1852bb648e9c7ce334727
2019-03-28 10:58:55 +08:00
jackqdyulei
36ce63dcb5 Add fp icon with background shape
Fixes: 126425211
Test: RunSettingsRoboTests

Change-Id: I779f76f597b80d73b6dd6eb9e43a96abc9fee0bb
2019-03-22 12:06:36 -07:00
jackqdyulei
7fb5e75752 Make BT icon colorful
Add new method to get rainbow bt icon and also refactor
AdaptiveHomepageIcon:
1. Rename
2. Add ConstantState

Bug: 126425211
Test: RunSettingsRoboTests

Change-Id: Idb8aaf253d0d9e2ab33d8852f093e6689ebadde4
2019-03-19 12:22:38 -07:00
Fan Zhang
31b210017b Migrate all MetricsProto enums to SettingsEnums
Bug: 122855168
Test: rebuild
Change-Id: I962d9a71179f86b7cae9dc5e9a00e0aa1557dc76
2019-01-17 14:55:42 -08: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
tmfang
41ab6b4bf8 Migrate all AlertDialogs to AndroidX version
This CL only changed AlertDialog imports.
So, reviewer can review it easily.

Change-Id: I097bc44394195b14287f4f920c570ac8653f356a
Fixes: 111413092
Test: This CL can't pass Robo test.
2018-07-20 11:32:13 +08:00
Fan Zhang
c7162cd24d Reorder and clean up imports.
Test: rebuild
Change-Id: I178485c84ae7146f991fd77b6d7504b029942a68
2018-06-18 15:45:09 -07:00
Kunhung Li
38438a975a Rename the Utils class in settingslib.bluetooth
Make it more unique to speficy related bluetooth, so change class name from Utils to BluetoothUtils.

Bug: 78676509
Test: atest RunSettingsRoboTests
Change-Id: Ic3627ce44627be39fbc010ad5ef630ad3c429836
2018-05-17 10:32:26 +08:00
hughchen
7ef4fd8085 Remove the gear icon and change tapping event
* For fix the conflicts in pi-dev, cherry pick the ag/3944480 in
  master and merge the conflict.
* Remove the gear icon in "currently connected" section.
* Change the tapping event in "currently connected" section.
  When tapping device in this section, take user to device detail page.
* Add test to verify when ConnectedBluetoothDeviceUpdater add preference
  the shouldHideSecondTarget() is return true.

Bug: 78490845
Test: make -j40 RunSettingsRoboTests
Change-Id: I25f8455def3c38e24dea9af9e9e29ba37c250f67
2018-04-27 16:35:09 +08:00
Aurimas Liutikas
e0069d332d Migrate Settings to androidx.
Test: make Settings
Bug: 76692459
Change-Id: I941dea40562170649bf056e675cc32e5163c0e39
2018-04-20 12:52:29 -07:00
Leif Hendrik Wilden
28dee1f086 Migrate to use instrumentation classes from settingslib.
Test: Compiles. Manually tested.
Change-Id: I70a6e76cc8440547746ecc008c32bd06a7de8161
2018-01-24 12:30:39 -08:00
Leif Wilden
cab0ee611d Revert "Migrate to use instrumentation classes from settingslib."
This reverts commit 1546cca529.

Reason for revert: Broke fingerprint setup flow. b/72267201

Change-Id: I8321265ae64732c526325882ddea51080decddf5
2018-01-22 20:57:36 +00:00
Leif Hendrik Wilden
1546cca529 Migrate to use instrumentation classes from settingslib.
Test: Compiles. Manually tested.
Change-Id: Ie5515bb0fe3e621fc7723a9b04ba23e4bfa9c401
2018-01-18 11:13:24 -08:00
jackqdyulei
cf1ce05ce5 Decouple BluetoothDevicePreference and DeviceListPreferenceFragment
The BluetoothDevicePreference need to know whether to display with an
invalid name. However pass in the whole fragment is over-killing.

This cl decouple it for several reasons:
1. In P, BluetoothDevicePreference will be used in other fragment.
2. In preference lifecycle from end user side, this flag is constant.

Bug: 69333961
Test: RunSettingsRoboTests
Change-Id: I3dbcd2a4aafa3ead74371534250e5e7c3ee221f7
2017-11-20 10:11:20 -08:00
jackqdyulei
88a4b0b0e5 Move the bluetooth icon logic to settingslib
This cl contains the moving about:
1. Several methods in Bluetooth/Utils.java
2. Bluetooth icon drawables
3. Bluetooth strings
4. Tests

Bug: 65488978
Test: RunSettingslibRoboTests

Change-Id: I682daa3eeb5022beb90a95763c70d19d32d54915
2017-10-25 12:49:59 -07:00
Jack He
5b017f7b05 Bluetooth: add metrics for pairing with devices without names
* Also caches context in onClick() method

Bug: 34685932
Test: make, unit test
Change-Id: I99beab2c85b8e48c4bc41f69146759d4b7c62428
2017-09-07 12:09:00 -07:00
Jack He
19ba320263 Bluetooth: Only show devices when their names are resolved
* Add a developer menu option to allow name-less devices to be shown
  when a Bluetooth developer needs it, but hide it for non-developer
  users.
* Set BluetoothDevicePreference to invisible when CachedBluetoothDevice
  does not have a name besides MAC address and the above developer option
  is false.
* This affects BluetoothPairingDetail and DevicePickerFragment, but does
  not affect BluetoothSettings. BluetoothSettings will show all paired
  devices regardless whether an user friendly name exists.

Bug: 34685932
Test: pair Bluetooth device, send file over Bluetooth, unit tests
Change-Id: Idd7ad4b1671dfdcf3204efb50eddb6dae1065aa5
2017-08-25 16:27:30 -07:00
jackqdyulei
7661137981 Add battery indicator to bluetooth icon
This cl change util method in bluetooth package to return
drawable instead of resId.

If the bt device has battery level, then method return customized
layerDrawable, otherwise return a simple drawable created from
resId.

Bug: 63393322
Test: RunSettingsRoboTests

Change-Id: Ib21822eafda0e8570212ce5cb070478e4f4876a2
Merged-In: Ib21822eafda0e8570212ce5cb070478e4f4876a2
2017-08-24 16:53:01 -07:00
Jack He
04f5967c95 Bluetooth: Use string in remote device summary
* Use String in connected device summary instead of resource id
* This allows dynamic strings to be built by CachedBluetoothDevice
  such as ones involve battery level percentages

Bug: 35874078
Test: make, unit test, test with Bluetooth devices
Change-Id: I583eac73280ca17387b215a4e7095e27de399998
2017-07-06 01:22:35 +00:00
Antony Sargent
04a3b2199e Add a new Bluetooth device details page
Bug: 35877479
Test: make RunSettingsRoboTests

The existing behavior is to bring up a dialog with Bluetooth device
details with checkboxes for each supported profile. This adds a new page
that serves the same purpose with a switch for each profile and a footer
containing the MAC address.

Whether to use the new page or old dialog is controlled by a flag
accessible via BluetoothFeatureProvider.

Change-Id: I026c363d4cd33932a84017a67cbef51c258bad10
2017-06-05 11:17:06 -07:00
Fan Zhang
00d8ff5d6e Revert "Revert "Convert BT preference to use TwoTargetPreference""
This reverts commit 457c3cbec2.

Revert with fix/test.
The fix is that we removed DevicePickerFragment#initDevicePreference(),
which incorrectly set a useless widget on preference, and removes the
gear icon from preference, preventing bind() call to go through

Change-Id: Ia70cdb51d13cca6035a4e7fe8008d195f7f00c6e
Fix: 36511169
Test: runtest --path tests/app/src/com/android/settings/bluetooth/DevicePickerActivityTest.java
2017-04-11 09:45:27 -07:00
Doris Ling
457c3cbec2 Revert "Convert BT preference to use TwoTargetPreference"
This reverts commit 09c7f15b12.

Change-Id: I29aa67f026c0b54da08b19657f9916275e5a3459
2017-03-28 20:03:10 +00:00
Fan Zhang
09c7f15b12 Convert BT preference to use TwoTargetPreference
Change-Id: I0b49af4afb4b782a6057060b2666f6528bc003b2
Fix: 36511169
Test: make RunSettingsRoboTests
2017-03-22 16:03:45 -07:00
Matthew Fritze
5c83cfa278 Remove Index.java from old Search and its dependents
Test: make RunSettingsRoboTests
Bug: 35763944, 36192909
Change-Id:  If216e1eeb4c29e7372720c6228fa4e99ea2a9904
2017-03-17 14:26:05 -07:00
Doris Ling
133b096288 Add logging to Bluetooth settings.
- Add logging when users selects the listed devices to connect or
disconnect, and when connection error is shown
- Update the event for the top level bluetooth master switch toggle to
have its own event.

Change-Id: I58f21256fdd07fad9d733ff987ff38df1148f4f8
Fix: 35065258
Test: make RunSettingsRoboTests
2017-03-09 18:14:30 -08:00
Marie Janssen
42c61c10cc Merge "Make headset icons consistent before / after pairing" am: 690bdb22c9 am: a2e068a2b4 am: 60eb5503e8
am: a78e718b26

Change-Id: I20b0fe30ab6b882e4f517147e9ffabe786d73988
2017-01-25 16:16:12 +00:00
Xiaodong Xu
262f7fba9a Make headset icons consistent before / after pairing
Previously A2DP would be shown before pairing with a HFP device.

bug: 30677445
Change-Id: I0e9ab17197e6ee099d890d5368def36a14ca8344
2017-01-23 17:25:27 +00:00
Fan Zhang
ec407ff78c Left align preferences and graphs to leave space for icon.
Bug: 33559277
Test: Visual inspection
Change-Id: Iacf9556826174a03b1cbf8a6f179b63d8686c5f5
2016-12-19 13:41:37 -08:00
pkanwar
8fa3d44596 The "device type" icons in "Bluetooth device list" screen are
not accessible to TalkBack users.

b/28199679 Changed method to for setting the talk-back
attribute on "device type".

Change-Id: I63820d861ea1075195b98c82004ba95470448a53
2016-05-05 11:25:46 -07:00