Wi-Fi: Set BTCOEXMODE_DISABLED irrespective of BT's connection state

BTCOEXMODE_DISABLE has to be triggered during the DHCP phase even
on an active BT connection to ensure that Wi-Fi is given
preference over the BT.
This commit ensures the same

Change-Id: Id5c2bc264cd4d21be7473f003fc5fbdbf9be943e
CRs-Fixed: 695307
Wifi: Handle P2P-REMOVE-AND-REFORM-GROUP event

Remove P2P group on receipt of P2P-REMOVE-AND-REFORM-GROUP event from
wpa supplicant and then reform new P2P group if autonomous group is
set to true.

Change-Id: Id6fbf2c2ebbebc06afc70cf56a7b434eb8ab2eea
CRs-fixed: 696838
Diable libwifi-hal-qcom: temporarily disable make of libwifi-hal-qcom.

For now, when building HAL, disable the make of libwifi-hal-qcom to avoid
compilation errors. This should be reverted once QC HAL src code is merged.

Conflicts:
service/Android.mk
Change-Id: I4dcc233e2d6868e3ca41cf7d37a3b4f421e22994
Wifi: Handle P2P-REMOVE-AND-REFORM-GROUP event in GroupNegotiationState

Framework does not handle P2P-REMOVE-AND-REFORM-GROUP event
if it is in GroupNegotiationState and p2p-GO will continue to operate
in unsafe channel till it gets next P2P-REMOVE-AND-REFORM-GROUP event.

This commit adds handling of above event in GroupNegotiationState.

Change-Id: I956bbcd0200ddc3acde8b989a6e0950bdeca269e
CRs-fixed: 714368
Wifi: provide runtime logging option in WifiP2pService

Runtime logging option for WifiP2pService.

Change-Id: I3e4550037654c8713fb8d9c6aa6b4351d3973033
CRs-fixed: 716835
Include libdl to the list of shared libraries

libwifi-hal-qcom uses APIs as part of libdl, hence consider them
accorrdingly

Change-Id: Iffe4516026ef2435511364a94753b2ce2b7ba2d1
CRs-Fixed: 710984
Reenabling libwifi-hal-qcom

Reverting the earlier commit of disabling libwifi-hal-qcom as
we have integrated the wifihal changes.

Change-Id: Ide3a46b0f0989098344615ec542111fa8c7d032e
CRs-Fixed: 710984
wifi: Fix for connection between GO and p2p device

When GO sends an invitation request to the p2p device without
persistent profile, GO gets an invitation result=8 which means
unknown group, when GO receives invitation result 8, its tries
to remove persistent profile of the client but it will not be able
find the profile so it does continue with sending the invitation
so the connection fails. To address this, ignore if there are no
persistent profiles found for the client and continue with sending
the Invitation request to the client to make connection succesful
connection. As GO has single profile saved unlike client which
saves multiple profiles of GO.

CRs-Fixed: 511282
Change-Id: I78f54d4bb2f0d603bc2170ec2c3ef55a91050236
P2P: Fix to add addInterfaceToLocalNetwork on DHCP renew

Route for p2p0 interface is added to netd daemon during P2P
connection as part of CMD_POST_DHCP_ACTION. If route is already
added it will throw excpetion. This exception can be ignore as the
route is already added.
During renew case it is failing here as route is added during DHCP
request, hence changing the exception type

Change-Id: If6ebb72a19c63c7eadc92b8009a510e6a6bf6725
CRs-Fixed: 716655
Wifi: Add Connectivity Engine WQE support.

Receive state change intent and update the score
accordingly.

Conflicts:
	service/java/com/android/server/wifi/WifiStateMachine.java

Change-Id: I59f8a242b60a9f4cb221920db2b000a5e9340767
Check for scan results before accessing the same.

Introduce a null check for the scan results to avoid any possible
fatal exception.

CRs-Fixed: 731804
Change-Id: I3cffa2cb22d757a739bb982c83b85b1f84111278
p2p: Display P2P peer MAC address if device name is empty.

Display MAC address of a P2P peer in an invitation prompt
message on receiving invitation request from the P2P peer
with empty device name.

Change-Id: Icabeb91d666437746eb5a733ec582849eb7295a5
CRs-Fixed: 506109
Wifi: Fix for connection failure between third client and GC.

When third device sends a connection request to the group client, the
existing connection is terminating and also the ongoing connection not
successful.Currently as there is  no use case where third device is
connecting to GC,and the existing onnection getting terminated.This
is addressed by ignoring the new connection request from third client
to GC and the existing connection is intact.

CRs-Fixed: 467049
Change-Id: I784c38b9a4ca0c60b188b9697e3b4af4d09053cc
P2P: p2p flush on a group remove event.

On a group removal, the devise shall not be able to detect
the peer with which the group was formed earlier, as the
supplicant shall not give the P2P_DEV_FOUND indication for
an already reported one. Hence,do a p2p_flush to have a
better user experience in finding the p2p devices.
This will  get the device list entries in the framework in
sync with the suplicant peer device list.

CRs-Fixed: 732399
Change-Id: Ic3bc19b3591001a5237538dddb42851638e2b358
Update the WIFI score.

Set wifi score to minimum when the network is bad and set it to
a high value when the network is good.

Change-Id: I103eea7080b91f5b9757a3932d6f6839b2909e01
Include libdl to the list of shared libraries

The default test application halutil uses libwifi-hal-qcom.a which
uses few of the APIs from libdl library. It expects the shared
library to be included explicitly

Change-Id: I88afba7ce353b665fd1dba6462666b27d7c9eec8
CRs-Fixed: 728747
Sink device not displaying PIN when connect from source using WPS_KEYPAD option

Sink device is not displaying PIN when trying to connect from source using
WPS_KEYPAD connection option .The code for displaying PIN was missing in
Process message for the event P2P_PROV_DISC_SHOW_PIN_EVENT in WifiServiceImpl
file.Added code for the same.

CRs-Fixed: 713468

Change-Id: I8f341d0d35ce304cf15e18f31f86f20bccea0e48
framework/base: Do not kill the supplicant on a request to stop it

Supplicant is killed on obtaining the first TERMINATE event when
requested to stop from the framework. This shall result in improper
shutdown of the supplicant without proper cleanup of the resources
allocated for all the interfaces.
Moreover, there is no point in killing the supplicant when the
request itself is to to stop the same. Thus, do not kill the
supplicant on the TERMINATE event.

CRs-Fixed: 601759
Change-Id: I6b96fa8665a1bfe8d8af81ce92b06f8c2457b779
P2P: Disable 5GHz channels in 2.4 GHz only mode

When P2P device is configured in 2.4GHz only mode supplicant
should not advertize 5GHz channels in its go negotiation frames.
  Hence disable 5GHz band channels when 2.4 GHz band only mode
selected in Wi-Fi advanced settings.

Change-Id: Ice8c9de34b19587c7e8432842a79551cc0e2333a
CRs-Fixed: 682823
P2P:initiate provisioning on persistant group removed.

The initiator, on a response from the peer with unknown group during
the persistent reinvocation has to transit to the provisioning state
to handle all the config methods (PIN and PBC).
This commit ensures the same.

CRs-fixed: 653078
Change-Id: I154ea647316ed0f61f1903876198d7d39cab1104