BT: Multi HF support in Settings App.

1. The connected sinks are not disconnected from
HeadsetProfile when new sink is connecting.
2. Also return correct connection status for
specific HS.
3. Sets priority for specific HS while disconnecting.

Change-Id: I876f9810be82482cb360451343e4eb2a9f3ed668
Bluetooth: Avoid window leak when screen orientation changes

Enable screen orientation change support in Bluetooth Settings app
during any Bluetooth Setting Activity. Otherwise, window leak may
observe while screen orientation changes.

CRs-Fixed: 556653
Change-Id: I8868f4c6e96277fd17484f810de6a700198a5287
Conflicts:
	AndroidManifest.xml

Bluetooth: Set Scan Mode to Connectable after user switch

Set the scan mode to connectable after user is switched if
end discoverable time is zero. Otherwise, if BT turned ON
after switch BT will be discoverable and timeout will be improper
if previous user set timeout to never timeout.

CRs-Fixed: 691014
Change-Id: I9765f314faa41d6cba1367a493ddf7b64b0d27eb
Conflicts:
	src/com/android/settings/bluetooth/BluetoothEnabler.java

Bluetooth: Not allow Blank BT device name.

Add empty string check for BT device name
and not enable ok button until entered
device name is not empty.

CRs-fixed: 471158
Change-Id: Ib7c460bee5c8d86d13acd66d228279dd1a240c25
Bluetooth: Check device address.

If connect is initiated for same device,
Ignore it instead of disconnecting and
reconnecting it.

Change-Id: Ie167bf3a28581ac8687d892204edacf1da257e6c
CRs-Fixed: 664310
CRs-Fixed: 667989
Bluetooth: DUN: Add DUN profile support in Settings APP

This patch registers service listener for DUN profile with the
BT adapter, and it will track the profile status with the service
listener state chnages. It also has support for DUN profile
connection status updation and DUN Disconnection from server.

Change-Id: I6bd0069b3619b3487433c2e05f1e27ce9375a7e7
CRs-Fixed: 557180
Bluetooth: Fix resource leak in OPP (2/3).

This patch handles onPause in DevicePickerFragment class, which
would be called when user presses back button and does not select
any device. This will send intent to class that called
DevicePickerFragment that no device is selected.

Change-Id: Ib3965d7dea8d59b244abdc6ffe61ef21109346fb
CRs-Fixed: 662147
Bluetooth: Handle pairing Cancel intent.

Receive Pairing cancel intent and clear pairing request
from notification window.

CRs-fixed: 463362

Change-Id: I63c9299edca4356485f26cbc6332e3be9bdfbf17
Bluetooth: Remove out of range devices after ScanComplete

Change to remove device from UI when Bluetooth of remote
device is off or not discoverable anymore. Without this
change a device that discovered previously is available
in available devices list always, though the remote device
is not discoverable anymore. The current change updates
available devices list on scan complete removing the
devices that are available in cached devices and are not
discoverable anymore.

CRs-Fixed: 523374
Change-Id: Ia250d52e6fb7a69af242c961d33027f1e724ab25
Bluetooth: SAP: Add SAP profile support in Settings APP.

- Handles 16 digit Authentication
- Added Handles SAP profile connection status changes
- Added SAP Disconnect from server related changes

Change-Id: I655a8c8bcdcc275c5d95c8ddd3d7bac2691fa818
Increase allowed duration to connect to HOGP profile

This patch increases the duration allowed between the first device
connection attempt (immidiately after bonding) and profile connection
after service discovery from 5 seconds to 30 seconds to allow
HOGP connections for slow connection conditions.

Change-Id: Ia8a33a6ef8951d6e08b4a22837fcfdb70910112c
Fixes error message during pairing of HOGP devices

When incorrect pin key is entered by user in
the pairing pop up while pairing with a HOGP
device, no error message regarding the failure
is displayed to the user.

CRs-fixed: 618905
Change-Id: I1a5a8baf9ef6c71bf285a28b3e1839fe5ddbca95
Bluetooth: Add A2DP Sink interface in Settings app

- add interface for A2DP Sink in settings app

Change-Id: If26f9ddd6a91085ec0e485dfa5f03a8ee600fdef
Bluetooth: HID: Use proper values of connection status

This patch fixes issue in retrieving correct connection status when
more than one hid device was connected to DUT. In such situation
current implementation was sending STATE_DISCONNECTED as connection
state because of wrong check of matching device as 1st device in
connected device list. Instead of this now actual connection state
device is retrieved from HidService.

Change-Id: I2c766e9fc6eb9e97c3745016e38fa5c374c16539
CRs-Fixed: 662147
Bluetooth: DEVICE_NOT_SELECTED intent is broadcast in onDestroy

DEVICE_NOT_SELECTED intent is broadcast in onDestroy instead of
onPause to avoid broadcast while device went suspend/display OFF.
onDistroy will be called when focus is out of the activity.

CRs-Fixed: 706665
Change-Id: I3dcf2811b300e44c0f3cb713c1397b5d334e8284
Bluetooth: Acquire wakelock to turn on lcd during Connection.

This patch acquires wakelock to turn on LCD display of DUT if screen
is off during connection access request for PBAP/MAP. Without this
patch it was observed that if screen was off, lcd remained off for
incoming connection access request from remote device and user only
was hearing notification sound without lcd being lit up.

CRs-Fixed: 650261

Conflicts:
src/com/android/settings/bluetooth/BluetoothPermissionRequest.java
Change-Id: I87c296fce4cd8e0c133f74169d991eee263fed08
Bluetooth: Set alias name only through Rename option.

Set the alias name only when user is trying to change the
name using the Rename option of paired device.

Conflicts:
	src/com/android/settings/bluetooth/CachedBluetoothDevice.java

CRs-Fixed: 539420
Change-Id: I415b6a962d8e7884b67d37b94c04df19e2c23012
Bluetooth: Destroy BT Dialog on BT power off.

Check for Bluetooth off Broadcast to destroy disconnect
dialog when Bluetooth is turned off from power widget.

CRs-Fixed: 579028
Conflicts:
	src/com/android/settings/bluetooth/DeviceProfilesSettings.java

Change-Id: Ie556a17c7d574f77da5181c08705648ebf5733cc
Bluetooth:GAP: Handle exception while unregistering the Receiver

Handle the IllegalArgumentException while unregistering the
Receiver.

Usually when user presses both cancel and okay for the disconnect
dialog, OnClickListener will be called twice for both options,
and for the second time it is expected that receiver would have
already unregistered.

Change-Id: I36e30d551df76b7cfd1754305a1087578fd4a275
CRs-Fixed: 595648
Bluetooth: Pan fixes Squashed commit of the following:

commit e4a4007eeb640c72c052f87874a369563dce8668
Author: Nitin Shivpure <nshivpur@codeaurora.org>
Date:   Wed Oct 23 17:54:14 2013 +0530

    Bluetooth: Fix to show internet access as marked when pan is connected

    isPrefered is always true for PAN. So internet access menu checkbox
    is always marked on. Marking internet access menu checkbox based on
    pan connection status should solve this issue.

    Change-Id: I4343cc6f1b46377caa54aa3d39c08489ff14adac
    CRs-Fixed: 550731

commit 4e5a8decfdbb119b4fa4806f68e098dd9844e700
Author: Nitin Shivpure <nshivpur@codeaurora.org>
Date:   Fri Sep 27 16:03:01 2013 +0530

    Bluetooth: Fix to connect PANU from the internet access menu

    isPrefered is always true for PAN. So PANU connect fails,
    Once user clicks on the internet access menu in Profiles
    Setting. As PAN is not auto connect profile, So PANU should
    connect from the internet access menu in Profiles Setting.

    Change-Id: I6007c848e7c2703dc97f7f2113356a7aaeed0a0e
    CRs-Fixed: 545350

commit 3164ad62c3ee18f626417aa4bddf450de657a86b
Author: Pradeep Panigrahi <pradeepp@codeaurora.org>
Date:   Mon Apr 8 13:32:51 2013 +0530

    Bluetooth: Set isPreferred to true for PanProfile Connections.

    isPreferred is always true for PAN profile so that DUT can
    initiate connection with remote device. Curretnly we are
    returning true only when pan profile is in connected, so
    it will return false when pan profile is not connected and
    will never initiate connection on click.

    Change-Id: I7c789add73ca944d074b0ecd8af223f6d61b547a
    CRs-fixed: 463887
    (cherry picked from commit ca3988a7394eb189835647a5aaa04707fe5c2517)
    (cherry picked from commit ea5ce47bf7b918affc66467adf4e38b1c870e86f)
    (cherry picked from commit 2a3bfb2ed0102de6aa6e659ee7714ce8fcec25cd)

Conflicts:
	src/com/android/settings/bluetooth/DeviceProfilesSettings.java

Change-Id: I1c5eac11115d2e77262aa78f93fbbd349f5e001a
Bluetooth:apps: Fix to avoid taking space as name upon orientation

This fix is to avoid taking space character as a name in the
BluetoothNameDialogFragment upon orientation change from
PORTRAIT mode to LANDSCAPE mode and vice versa.

Change-Id: Ia66f27bb9b06739e42d73b15745c12a42512a1fc
CRs-Fixed: 650910
Bluetooth: Ignore the second button if one already pressed

Ignore the second buton if already one button is pressed,
this case comes when user is trying to press the both
cancel and ok for the pairing dialog.

Change-Id: I77516ec59a972b4451bb8cff69645f7b9089497f
CRs-Fixed: 624285