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)
Bluetooth: Handle pairing Cancel intent.

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

CRs-fixed: 463362

Change-Id: I63c9299edca4356485f26cbc6332e3be9bdfbf17
(cherry picked from commit fc82c5a6a3e74aeba6139e0ccf48f634fd970e62)
(cherry picked from commit dc299471edd42a5b30c0f54ef8d33730e33d03a3)
(cherry picked from commit 32f973cbe79d2474d0815d7dd90c6960af120b3c)
Bluetooth: Security: Add Null check during pairing cancel intent.

Added null check, so before posing event we can restrict events,
if cached device list is empty

Change-Id: I458d181abe5eec2497b80b1713ddbc3502b79786
CRs-Fixed: 546364
(cherry picked from commit 7d7222c3e5c1054b4e2f3e59cc40cb182a72b040)
(cherry picked from commit 8ce523155dd030d82c32cf502d317023b017645b)
(cherry picked from commit 938686e749bca911e5f63150223116d1c381da8e)
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
(cherry picked from commit fee7b100ff7ac4eb7117ec1bc5c592d0c7adbbf8)
(cherry picked from commit 38d07978c7fb4f40af96b9fb96af09a64ce5bfff)
(cherry picked from commit 28a27af31eac45f4b3fe5932240dc437a37dda5c)
Bluetooth: Handle BT search while rotate screen

Enable screen orientation in Settings app manifest.

CRs-Fixed: 519022
Change-Id: I74b70dafa1d8d12bf6770cb44a808cdf51555940
(cherry picked from commit 5e6cb7b4c30b4b7a01240b37395cd6c2edc9372b)
(cherry picked from commit 9d2319fda3df37730770c1fa55c9293a02198383)
(cherry picked from commit b77d906701dad6fd659b53008b422675afda3e31)
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
(cherry picked from commit d17f03934b2582637f9d059fccccaabbc4203994)
(cherry picked from commit 26fd639eaeacb7dc5d82c9ef9cf5b5eb5fc70b4f)
(cherry picked from commit c63c73ebf900091b67a951e004573c03ea53e01a)
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
(cherry picked from commit 43d4fc0bd35ee5573a8f25c980b812e32cd48172)
(cherry picked from commit 06f74dafa10ce9c1a61719e277ac72ea33e6deab)
(cherry picked from commit 547dcac07806559c5c884acc1f32b4e199447cb8)
Bluetooth: DUN: Add DUN profile support in Settings APP

It 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.

CRs-Fixed: 557180
Change-Id: I83d4919821cb095429ff7e73a8974d92c4df086c
(cherry picked from commit 59ec7bc7e1f29edc74512b7c180dc9559202a063)
(cherry picked from commit a1df3d0f11a974c9caa199fc7be1c47cfd809cf3)
p2p: Fix for GC unable to scan GO after tear down.

A start of the search is not done on a group removed
broadcast event for mLastGroupFormed being set, which
would result in the Group Client not able to find the
GO , though a p2p_find is issued before a disconnect.
This is due to the fact that supplicant shall notify
the p2p device info only once per p2p_find.

To avoid this remove the conditions that is blocking
the search to happen and issue another p2p_find.

Change-Id: I4abad5c472808f9aa03e644eb1c6a26bfab8a4e6
CRs-Fixed: 504022
(cherry picked from commit b5da1dfa773904f1d7d4aaff407d3830098a9206)
(cherry picked from commit 86f8e54ec3cdac6b9474d462cfafbc894223a433)
P2P: Updates the P2P peer list when there is P2P State Change Action

In the current implementation the P2P window gets updated with the
Peers list only when there is WIFI_P2P_PEERS_CHANGED_ACTION Intent.
Thus the P2P status remains unchanged when there is
WIFI_P2P_STATE_CHANGED_ACTION intent. When there is back and forth
navigation to P2P window, WIFI_P2P_STATE_CHANGED_ACTION intent invokes
the onPeersAvaliable function asynchronously and updates the P2P status
and peers list.

CRs-fixed: 512821
Change-Id: I69b26ef72bf30f547bf8fb5580d440c5119df054
(cherry picked from commit 17edb35f25b01560a2fd8c159432a794c46765f0)
(cherry picked from commit f4a4708e50657c14412a9f370f023fd89cba8e6b)
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
WifiSettings: Handle DISABLED_ASSOCIATION_REJECT.

Upon receiving multiple association rejects for a network,
framework disables corresponding network providing reason
code as DISABLE_ASSOCIATION_REJECT. this is handled
in order to provide appropriate user experience.

CRs-fixed: 484247
Change-Id: I3d344068a58d2dfd82c9bc8b23f43fdf980cc4d9
Packages: Fix for SAP turn ON/OFF fails issue.

Turnig ON/OFF SAP repeatedly when WIFI is ON results
in command CMD_SET_AP being received in WifiStaEnabledState
of the state machine, which will not be handled and because
of this SoftAP is not turned ON and we receive no events
thus the check box remains greyed out/disabled.

To resolve this wait for WIFI_STATE_CHANGED intent before
re-enabling the SAP.

Change-Id: I1a37ac6406ea5e342d6dcb80654c2728fa447e57
CRs-Fixed: 525872