Commit Graph

35 Commits

Author SHA1 Message Date
Etienne Ruffieux
39225c5789 Refactor Bluetooth scan mode APIs
Removed setScanMode(int, long), setScanMode(int mode) is
now a SystemApi. Made getDiscoverableTimeout a public API.
setDiscoverableTimeout is now SystemApi. Discoverable
timeout is now in seconds everywhere.

Tag: #feature
Bug: 195150096
Test: Manual
Change-Id: Iee0a80b382f601a81f14afd7224637b88fbdf7ce
2021-10-26 15:20:05 +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
e94b02206e Use BluetoothAdapter instead of LocalBluetoothAdapter
LocalBluetoothAdapter only has a few APIs that is not supported
by BluetoothAdapter, and lots of LocalBluetoothAdapter function
pass parameter to BluetoothAdapter directly.
Do the refactor in Settings, use BluetoothAdapter instead of
LocalBluetoothAdapter.

Bug: 111769754
Test: make -j42 RunSettingsRoboTests
Change-Id: I88e5a8377b5d1106c7679e6a8c3fd1ca1a80ea6f
2018-07-31 11:35: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
Jason Monk
39b467482d Depend on support lib preferences
Bug: 24576551
Change-Id: Ic6190bacd3f7582c9bbc8de972da4612bd92421e
2015-10-13 10:12:20 -04:00
Jason Monk
f2982a9ba1 Move isolatable bluetooth code to SettingsLib
Move the non-ui bluetooth control/tracking code to SettingsLib so
that it can be shared with others.

Mostly just move classes to frameworks/base/packages/SettingsLib,
however a few things had to move around.
 - Dock handling had to move back to code still in settings
 - Local preference related code had to be moved back to settings
 - Added an error flow from SettingsLib to Settings

Depends on I69fd888362c6dbb325f6113b32c4b15cc6a23a41
Bug: 19180466
Change-Id: Ie57fe26a27bbb0adc2ef69e042a05c7290c6a52a
2015-02-05 10:43:57 -05:00
Wei Wang
17d2124c1c Revert "BLE peripheral mode (4/4): Settings change for advertising preference."
This reverts commit eb56b9ccb8.

Conflicts:
	src/com/android/settings/bluetooth/BluetoothDiscoverableEnabler.java
	src/com/android/settings/bluetooth/BluetoothSettings.java
	src/com/android/settings/bluetooth/LocalDeviceProfilesSettings.java

Change-Id: I2ce6b9eb0e335ba1b9aa4e1cb61a041f00d9aa87
2014-03-03 11:18:21 -08:00
Fabrice Di Meglio
ce930c15ae Crash in Settings observed while changing the device orientation after renamed tablet
There was a fundamental flow in the BT code. Basically BluetoothSettings is using
a singleton BluetoothDiscoverableEnabler.

BluetoothDiscoverableEnabler is keeping (thru its constructor) a reference on a Context
for registering/unregistering some broadcast receiver. BUMMER! When you change orientation
(or more generally the device Configuration), your Context is no more the same!

Hence the crash as we were  trying to unregister a Receiver on a Context that is no more valid.

Fix that issue by passing an updated Context to the BluetoothDiscoverableEnabler.resume() API.

Bug #12991455
Change-Id: I77db15d2b59b6dd973907e26f9e6bb022202a8b5
2014-02-14 23:53:44 +00:00
Wei Wang
eb56b9ccb8 BLE peripheral mode (4/4): Settings change for advertising preference.
Change-Id: I5721f136267fe25e55f764bb4a6c53acd45b318b
2014-01-13 17:41:02 -08:00
Kim Schulz
54313d7d66 BLuetooth Discoverable timer not correctly cleared
Changing the discoverable timer from 2min to infinity before the 2min timer
has passed will not clear the 2min timer.
This fix handles this case.

Bug: 12220031
Change-Id: I8794eda353c74e46b09e15ee9a7a491658e7b5cd
2013-12-19 13:45:11 -08:00
Matthew Xie
b5f144af8e Clean up codes, fix long lines, improve readability, etc
Update copyright date, remove unused variable, import

Change-Id: I731c48c8e5b16cbee5230f1d02109f249b8bab5d
2012-07-16 15:38:38 -07:00
Srikanth Uppala
4bb010a67f add discoverability timoeut when set by 3rd party app
Change-Id: Ibfd358121f8f9fbbf3b9bc06c5be7b9300e0ba53
2012-07-16 15:38:37 -07:00
Srikanth Uppala
59a97f7a73 Fix discoverability timeout issues. (a) implement timeout logic (b) persist 'never timeout' after reboot (c) code cleanup
Change-Id: Ia7a8611d7212b9201994034d17da1d18e106107b
2012-07-16 15:38:37 -07:00
jhtop.kim
1ecee6c100 Bluetooth : fix for unexpected discovery summary string changing
- While Visibility timeout setting is never,
  the summary string "Visible to all nearby Bluetooth devices" is shown.
  but if rotating screen or unpairing, pairing actions make the summary
  be changed "Not visible to other Bluetooth devices" or
  "Only visible to paired devices"
- call handleModeChanged() to refresh summary state.

Change-Id: I4b324f2a9530e5e4ca4571f3dd47e8992bdae0cb
Signed-off-by: jhtop.kim <jhtop.kim@samsung.com>
2011-08-08 15:46:44 -07:00
Jake Hamby
49cfe8a3c8 Fix some Bluetooth settings bugs.
- Remove BluetoothFindNearby.java (no longer used)
- Show message when Bluetooth is turning off
- Fix case where device name sometimes didn't show when turning BT on
- Disable "Rename device" and "Visibility timeout" menus when BT is off
- Remove "Got onDeviceAdded, but cachedDevice already exists" log message
- Never show "Rename device" in action menu (bug 5064378)
- Show discovery time remaining as "m:ss", not "mm:ss" (bug 5064104)

Bug: 5064378
Bug: 5064104
Change-Id: I79609dfdad61993a28cff64c9e082870ff74d180
2011-07-25 14:57:07 -07:00
Jake Hamby
ca9812a852 Upgrade Bluetooth pairing dialogs for ICS.
* Change Bluetooth pairing dialogs to match ICS wireframes.
* Default to numeric soft keyboard for PIN entry, and add checkbox
  to allow user to switch to alphanumeric keyboard if necessary.
* Move all Bluetooth advanced settings into action bar menu.
* Toggle visibility by touching "My device" entry in devices list.

Change-Id: Ic2377eb4364f41d215181cb1e3933997c9db9106
2011-07-15 15:39:53 -07:00
Jake Hamby
436b29e68e Refactor Bluetooth settings for readability and performance.
Major refactoring of Bluetooth settings classes.
- Moved all functionality from LocalBluetoothManager into new
  LocalBluetoothAdapter and LocalBluetoothPreferences, and into
  existing classes.
- Refactored functionality from BluetoothEventRedirector into new
  BluetoothEventManager class, deleting the original version. New
  version uses a HashMap from action Strings to implementers of the
  BluetoothEventManager.Handler interface.
- Created new BluetoothDiscoveryReceiver to update shared preferences
  timestamp for Bluetooth discovery start/finish. This is the only event
  handling we need to do when the settings app is not visible, so it has
  its own receiver entry in AndroidManifest.xml. Edits are written using
  QueuedWork.singleThreadExecutor(), which BroadcastReceiver knows about
  and will wait for completion, eliminating the need for PendingResult.
- Miscellaneous cleanups to code style and logic for readability.
- Pulled some large switch statement code blocks into new methods.
- Changed all Bluetooth state references to the new BluetoothProfile
  constants.
- Changed use of deprecated Notification constructor in
  BluetoothPairingRequest to use Notification.Builder.
- Moved Utf8ByteLengthFilter helper function from BluetoothNamePreference
  into its own class, and moved test cases into the same package.
- Moved all LocalBluetoothProfileManager functionality related to
  specific profiles into new top-level classes (A2dpProfile, etc.), all
  implementing the LocalBluetoothProfile interface.
- Moved all UI-related methods from CachedBluetoothDevice into the class
  that uses the method, or into the static Utils class for shared methods.

Change-Id: I6d49b7f4ae0c7d7dcf62551ee40b51ecb5fe4f47
2011-03-01 18:44:36 -08:00
Jaikumar Ganesh
d955af8461 Changes for public API of Bluetooth Discoverability.
1. Apps can ask for any time between 0 and 3600 secs
2. O implies always discoverable
3. Any invalid values will default to the defaul - 120 secs.

Change-Id: Ife1bc803587ba975bb103a5ba7629d4a382cd705
2011-02-01 19:58:29 -08:00
Chris Wren
1b0489cb3e Allow users to change the length of Bluetooth discoverability to
be two minues, five minutes, an hour, or forever discoverable.

This addresses the internal bug 2413429:
	http://b/issue?id=2413429
and external issue 6348:
	http://code.google.com/p/android/issues/detail?id=6348

Original Author: Chris Wren <crwen@google.com>
Modifications done by: Jaikumar Ganesh<jaikumar@google.com>

Change-Id: Ie12e56ac41aa01a161d263c7525b6e021d4eeb1f
2011-02-01 16:25:44 -08:00
Brad Fitzpatrick
c5c8dad0af Use new apply() instead of commit().
apply() starts an async disk write and doesn't have a return
value but is otherwise identical in observable effects.

Change-Id: I0f528607319d7eb5136bb11fce0b24d8741ccdf9
2010-09-14 09:26:51 -07:00
Michael Chan
e1089ad338 b/2142065 Added Bluetooth API to allow developer to request the user's permission to enable discovery mode.
Change-Id: I6da1598661ad05b4cfd2b7cc81e05d3053df5777
2009-09-28 17:16:23 -07:00
Nick Pelly
16cc86315d Update application for Bluetooth API changes.
Change-Id: I8351611f0f0c5eda3e423dbe7e7b53e52d75ac36
2009-09-10 18:44:25 -07:00
Nick Pelly
f4779354b3 Update application for Bluetooth API change: deprecation of BluetoothError. 2009-09-08 17:49:57 -07:00
Nick Pelly
ca564d6bda Update application for Bluetooth API change. 2009-09-08 16:24:03 -07:00
Nick Pelly
d63c011225 Bluetooth: Update Settings.apk to match BT API change.
Split BluetoothDevice into BluetoothDevice and BluetoothAdapter.

BluetoothAdapter: Represents the local BT adapter. Operations on the local
                  adapter (start a scan, etc).
BluetoothDevice: Represents a remote BT device. Operations on remote devices
                 (pair, connect, etc).
2009-08-17 17:09:44 -07:00
Jaikumar Ganesh
91b33f1462 Settings app changes for Bluez4. 2009-06-08 17:28:06 -07:00
Michael Chan
f25063aee3 Fixed the Bluetooth On/Off Checkbox in settings so it is enabled/disable properly.
In the BroadcastReceiver, pickup the new bluetooth status from the intent instead
of calling back to LocalBluetoothManager.  There could be race condition since
LocalBluetoothManager itself gets the same info via the BroadcastReceiver mechanism.
Also cleaned up logs.
2009-04-29 14:17:06 -07:00
The Android Open Source Project
e6dd1fa185 auto import from //branches/cupcake_rel/...@140373 2009-03-18 17:39:48 -07:00
The Android Open Source Project
648bf5fd9e auto import from //branches/cupcake/...@137197 2009-03-09 11:52:14 -07:00
The Android Open Source Project
afc4ab2ffb auto import from //depot/cupcake/@135843 2009-03-03 19:32:34 -08:00
The Android Open Source Project
4e14e5ccbf auto import from //depot/cupcake/@135843 2009-03-03 18:28:52 -08:00
The Android Open Source Project
1feaa85791 auto import from //branches/cupcake/...@130745 2009-02-10 15:44:05 -08:00
The Android Open Source Project
5962e18d0e auto import from //branches/cupcake/...@125939 2009-01-09 17:51:25 -08:00
The Android Open Source Project
abc48f80d8 Code drop from //branches/cupcake/...@124589 2008-12-17 18:06:01 -08:00