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
Move tracking of which networks are available/saved and their state
over to SettingsLib to share it with Quick Settings.
Bug: 19180466
Change-Id: Iaeef06b26da8cb38e1ba09a7d105d04d499dc181
+ This patch moves the switch listeners from setup/teardown of the SwitchBar
to pause/resume of Bluetooth Settings. This prevents Bluetooth from
receiving connect messages while Airplane mode is turning off Bluetooth
(which is what caused Bluetooth to re-enable.)
Bug: 17465951
Change-Id: I4d32fcf5bb3a2241ed03e2295c86390e15743954
- change the way the SwitchBar is shown and hidden
- save its state
- remove the delay transition code
Change-Id: I07260430e6709b42517ca011f6d3c3446a626731
- follow up CL to 4193776698
Related to bug #14898161 On/Off switches must move down from Action Bar
Change-Id: Ic04de39599c91388cba8510bfd46d96e7bc30260
- add a new boolean parameter to ask for Index rebuilding:
passing "true" will delete first all the data corresponding to the
"className" and then apply the update.
Change-Id: Ifc42fc560a14f5470b466cf6982915d9207fa3c7
- change the Index SQL model. Add a new "enabled" column.
- use that column for issuing a more restrictive search query
- change the SearchIndexProvider API to pass the "enable" state
- apply it to Bluetooth settings
- refactor the list of indexable resources (SearchIndexableResources)
Change-Id: Ic900fb27cb12a285a80d953aa1aa88f0070cd986
The root cause is normally when change the airplane mode, the bluetooth setting UI
will not be foreground. No listener is setup for bluetooth setting UI when it is
in background. So the onCheckedChanged won't be called and mLocalAdapter.setBluetoothEnabled
won't be called. But for manta, airplane mode setting and bluetooth setting UI both
will show on the foreground due to bigger screen size. When we turn ariplane mode on,
bluetooth manager service will disable bluetooth without changing the persist bluetooth setting.
But bluetooth setting UI will listen to the bluetooth state change intent, it will receive
bluetooth state turn-off intent then it will call mSwitch.setChecked(false) in handleStateChanged,
which cause checked status changed from true to false to trigger the listener (onCheckedChanged)
being called. The listener will call mAdapter.disable() which will call mManagerService.disable(true)
to change bluetooth persist state to OFF. So when we turn back airplane more to OFF,
due to the bluetooth persist state is OFF, we won't turn back bluetooth to ON.
Don't need to consider thread synchronization, because everything is running on the main thread.
bug 7366814
Change-Id: I138d1904df6cb17c7828295caa51a7d80abf99f2
The root cause is normally when change the airplane mode, the bluetooth setting UI
will not be foreground. No listener is setup for bluetooth setting UI when it is
in background. So the onCheckedChanged won't be called and mLocalAdapter.setBluetoothEnabled
won't be called. But for manta, airplane mode setting and bluetooth setting UI both
will show on the foreground due to bigger screen size. When we turn ariplane mode on,
bluetooth manager service will disable bluetooth without changing the persist bluetooth setting.
But bluetooth setting UI will listen to the bluetooth state change intent, it will receive
bluetooth state turn-off intent then it will call mSwitch.setChecked(false) in handleStateChanged,
which cause checked status changed from true to false to trigger the listener (onCheckedChanged)
being called. The listener will call mAdapter.disable() which will call mManagerService.disable(true)
to change bluetooth persist state to OFF. So when we turn back airplane more to OFF,
due to the bluetooth persist state is OFF, we won't turn back bluetooth to ON.
bug 7366814
Change-Id: I07d4a2dfe03fc6775cfeabb28cd3a0cc1fded44e
Fix NPE when entering Settings app in the SDK (and for devices without
Bluetooth). Also remove the "Bluetooth settings" item in addition to
the Bluetooth toggle item from Wireless settings when BT is missing.
Bug: 4149307
Change-Id: Iecc5960a193cf88664d3217b4d7bdbc2276dabc0
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
- Enable support for reverse tethering in BT settings.
- Add string resource for "Auto connect" preference.
- Remove unused imports and other minor cleanups.
- Add isConnectable() and isAutoConnectable() methods to Profile
enum type and remove isConnectableProfile() method.
Change-Id: Ie606db04028a8278e98231f0671a388671f2f067
- Removed context menu logic for long press (no longer used).
- Converted device picker to run in its own Activity, using a dialog
theme on large screen devices and full-screen on phones.
- Removed unused resources.
- Add device to "Paired devices" list when pairing is initiated by the
remote device.
- Return to Bluetooth settings pane after successfully pairing a new
device from the "Find nearby device" pane.
- Add support for renaming devices (TODO: persist the custom name and
update the "bread crumb" in the action bar to the new device name).
- Add support for incoming file transfer and auto connect checkboxes
in DeviceProfilesSettings.
- Show available and connected device profiles as icons instead of
summary text. Available but disconnected profiles are drawn in gray.
- Fixed bluetooth_notif_message to include the device name as a parameter
instead of appending the name to the end of the localized string.
- Changed some fields from private to package scope for more efficient
access from inner classes.
Bug: 3137982
Change-Id: Ic2d6ee5be60c9c5b3f3a8a58846d58efedfa5c93
This mainly changes the way both enablers react to the airplane mode. Now
enablers show a toast message instead of disabling the check box directly. This
avoids the inconsistent state introduced by WirelessSettings which controls the
check box using layout dependency.
Related bug: 2053751
Settings.System.AIRPLANE_MODE_TOGGLEABLE_RADIOS is a list of
radios that can be toggled while in airplane mode. This CL
changes BluetoothEnabler to respect this.
It parallels the logic in WifiEnabler, which enables OEMs
to allow Wifi changes when in airplane mode.
Most existing devices don't include "bluetooth" in the
toggleable list, which means bluetooth will continue to be
disabled when in airplane mode for those devices.
Fixes http://b/2297314
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).
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.