Commit Graph

21 Commits

Author SHA1 Message Date
Ze Li
7c11a45735 [Connected devices page] Move the refresh logic to main thread.
As the caller of adding or removing devices may not be performing on background thread, sync problem could occur. So here we make sure all updates to UI happens on the main thread.

Test: atest: com.android.settings.connecteddevice.PreviouslyConnectedDevicePreferenceControllerTest
Bug: 365044575
Flag: EXEMPT bugfix
Change-Id: I5b697acb7cf7469fe3bbff33b820b4e9f4c5104f
2024-12-03 13:54:57 +08:00
Ze Li
e3db9b8941 [Connected devices page] Clear up old functions and add logs
Test: atest: com.android.settings.connecteddevice.PreviouslyConnectedDevicePreferenceControllerTest
Bug: 365044575
Change-Id: Id648be40a4735688bbe1b4779d5812ea93baee2a
Flag: EXEMPT refactor
2024-11-07 05:37:18 +00:00
Ze Li
9d696fe4d8 [ConnectedDevicePage] Clean up flag enable_saved_devices_order_by_recency
Test: atest PreviouslyConnectedDevicePreferenceControllerTest SavedDeviceGroupControllerTest
Bug: 340145121
Change-Id: I2fd6d506b343332edceb0235c1e36345d74cbf55
2024-05-14 11:34:43 +08:00
Ze Li
41b12fe8eb [Connected devices page] Reorder devices by most recently used.
Order the saved bluetooth devices by most recently connected in connected devices settings page.

Test: atest: com.android.settings.connecteddevice.SavedDeviceGroupControllerTest, com.android.settings.connecteddevice.PreviouslyConnectedDevicePreferenceControllerTest
Bug: 306160434
Change-Id: Id5ad8555a026d775d96ada37f989b4346336af93
2024-01-23 08:14:29 +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
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
Michael Groover
911f7e7aa9 Add unaudited exported flag to exposed runtime receivers
Android T allows apps to declare a runtime receiver as not exported
by invoking registerReceiver with a new RECEIVER_NOT_EXPORTED flag;
receivers registered with this flag will only receive broadcasts from
the platform and the app itself. However to ensure developers can
properly protect their receivers, all apps targeting T or later
registering a receiver for non-system broadcasts must specify either
the exported or not exported flag when invoking #registerReceiver;
if one of these flags is not provided, the platform will throw a
SecurityException. This commit updates all the exposed receivers
with a new RECEIVER_EXPORTED_UNAUDITED flag to maintain the existing
behavior of exporting the receiver while also flagging the receiver
for audit before the T release.

Bug: 161145287
Test: Build
Change-Id: Ie97372efebd8258d9a4c503771d55109a85e6ae9
2021-12-09 20:34:02 -08:00
Hugh Chen
51b6605aef Fix connected devices settings jank issue
Completed the UI in displayPreference() to fix jank issue.

Bug: 188752628
Test: make RunSettingsRoboTests
Change-Id: Ib97b76e1b8622424ad481597f63d3540fb0bfc5b
2021-05-26 17:37:13 +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
8f29850cca Fix crash on connected devices settings
If disconnected bluetooth devices didn't exist in
recent devices, the index will return -1. Our condition
didn't check this situation, the IndexOutOfBoundsException
will throw when this case happens.

This CL adds the condition to check whether index is over
than or equal 0 to fix IndexOutOfBoundsException.

Bug: 173059077
Test: make -j42 RunSettingsRoboTests
Change-Id: Id93f4cb6bded83540045c5e8c21c6f6122a39fed
2020-11-24 17:54:48 +08: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
Hugh Chen
386df49bbc Show just disconnected device on previously connected
- This CL before, previously connected devices will show most
  recently connected devices and the maximum is 3.
  In this time, if next most recently connected device is disconnected.
  It's will not show on "previously connected devices", user needs go to
  "see all" page to found that device.
  This CL add rule to compare the priority of most recently connected
  device. If priority of next disconnected device is higher than
  currnect devices that on "previously connected devices".
  Let next disconnected device show on "previously connected devices".
- Update test case.

Bug: 157653997
Test: make -j42 RunSettingsRoboTests
Change-Id: I684501a20a67755b2196ba9d4b5565add01a5d01
2020-08-26 18:56:30 +08:00
Hugh Chen
bde100849e Display "see all" option when bluetooth is off
- This CL before, Bluetooth settings will hide the "see all"
  option when bluetooth is off. For the UX improvement, this
  CL will show the "see all" button when bluetooth is off. And
  turn on the BT when user press "see all" button to let user to
  quick pair their disconnected devices.
- Update and add test case

Bug: 147150367
Test: make -j42 RunSettingsRoboTests
Change-Id: I7a1451a36a31253b6be2203341bea4e59fed7c2b
2020-08-12 17:07:33 +08:00
hughchen
ef2c1a1526 Fix crash when no Bluetooth feature in Settings
- Move PreferenceGroup init method out of isAvailable() condition,
  then PreferenceGroup will not be null.
- Update getAvailabilityStatus(), since the controller now may have usb
  and dock.

Bug: 110712414
Test: make -j42 RunSettingsRoboTests
Change-Id: I4d85a42c26fb20d319e7321177b271933be3fdb0
2019-04-19 14:09:40 +08:00
Fan Zhang
7db118e367 Mass clean up: don't cast class when not needed.
Bug: none
Test: rebuild
Change-Id: Ie3f58a3d5ae99ade28a33dcac80c18de90d4d5b2
2019-02-14 12:26:09 -08:00
jackqdyulei
b152e6dd1b Update "Previous connected device" preference
1. Show up to 3 devices in main page
2. Add "See all" preference to go ot detail page

Bug: 116350449
Test: Screenshot && RunSettingsRoboTests
Change-Id: Iee0de8a2b7f2543e946a117ba2d9ca9dde6c8678
2018-09-26 11:08:58 -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
Ivan Chiang
06036361e5 Fix crash of Connected Devices page
Doesn't set the preference context for savedDockUpdater.
We will throw IllegalStateException now.

Change-Id: I684cd2a917ce94e033be578349c3cc1d8650ccea
Fix: 110609074
Test: m -j SettingsRoboTests RunSettingsRoboTests
2018-06-22 13:01:07 +08:00
Fan Zhang
c7162cd24d Reorder and clean up imports.
Test: rebuild
Change-Id: I178485c84ae7146f991fd77b6d7504b029942a68
2018-06-18 15:45:09 -07:00
Ivan Chiang
c6d7191cb9 Fix gray out previously connected device preference issue
Count the dock devices in previously connected device controller.

Change-Id: I08d82ec715698ecf894a4a7cd0631c5f1de0f591
Fix: 80227045
Test: m -j SettingsRoboTests RunSettingsRoboTests
2018-05-30 02:45:47 +00:00
hughchen
0404968d8b Grey the previously connected device preference
* For fix the TreeHugger error in pi-dev, cherry pick the ag/3935357 in
  master and fix TreeHugger error.
* Add PreviouslyConnectedDevicePreferenceController to handle the preference should be
  enable or disable.
  Example: If there are no previously connected devices disable the preference otherwise
  enable it.
* Add PreviouslyConnectedDevicePreferenceControllerTest
  1. Verify the callback can be registered and unregistered
  2. Verify the preference is enable when there
     have more than 1 previously connected device
  3. Verify the preference is disable when there
     have no previously connected device

Bug: 78250052
Test: make -j50 RunSettingsRoboTests
Change-Id: I31b5d416aaf907c3bbf1cb61de6e7401463e3df7
2018-05-17 16:55:31 +08:00