Wifi: Enable Ad-Hoc (IBSS) network configuration

This adds two public but hidden variables to WifiConfiguration: isIBSS and
frequency. These are used for configuring IBSS mode.

WifiConfigStore is exended to get and set these variables to wpa_supplicant
(via WifiNative).

Change-Id: Iab02c3d738c05c2de036350ea77b78789213e357
p2p:Fix for discovery failure until STA is connected to AP.

The station when connecting to AP (wifi state is either
connecting or obtaining ip address) shall stop the already
issued p2p_find on the DHCP start and start the same after
the DHCP handshake. p2p service manager shall return a failure
for any p2p_find operation during these period resulting in a
discover failure.
Address this by deferring the p2p_find issued during this period
(set mDiscoveryPostponed to true) rather than returning a failure.

Change-Id: I40b2017bf126fd0d543ada8853223402cda63e9d
CRs-Fixed: 532138
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
Fix: FATAL exception during Autonomus group creation failure

Failure in forming an autonomus group causes FATAL IllegalArgumentException
exception as deviceAddress will be empty in mPeersLostDuringConnection.

Added check to verify if it is autonomus group before trying to remove
any peer or clear device list.

Change-Id: I486463782e85c7f0031b6f62ec5aaf8afb11b652
CRs-fixed:554767
(cherry picked from commit 55bb4f6dd9fc3e5c8aa7c8bc8ece01f0603e0a83)
(cherry picked from commit 3dbbf14276a403841e1d69cd2624dfad74d6f540)
(cherry picked from commit 8642fcd59686e54c1ea215016bfa7562d17b27c0)
p2p: Flush the p2p scan result on group remove event

Flush out p2p scan results on receiving group removal event.
p2p scan window will be updated on next p2p scan.

Change-Id: I3bcfed355574478bda2cac688b7df956c2701683
CRs-Fixed: 504022
(cherry picked from commit eaeecac20b125ffff8fea7a12b514999fff6bf5f)
(cherry picked from commit 3541e2cb0768865ecc312ead33f48c673e177ac3)
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
wlan: Do not disable the network on Assoc Reject/Authentication Failure.

A failed network, if disabled, would result in no further connection
attempts for the same.Thus, do not disable the network rather enable
all the disabled networks, as supplicant shall disable the networks
temporarily on subsequent failures and would give fair chance to
select the prioritized networks.

Change-Id: I27bfdfed420e935c1bc21fb968d6a5ba75ca92aa
CRs-fixed: 582883
SystemUI: Fix crash on Recent Apps list

Issue: SystemUI crash is observed when Context MenuItem "App info"
       is selected on the recent apps activity
       1. Open the rencet apps list
       2. Long press on any one/more recent app(s)
       3. Lock the screen using power key
       4. Unlock the screen using power key
       5. select menu item "App info"
       6. SystemUI process will get crashed.

Fix: Changed the code to make sure that only one context
     menu is active at a time and also dismissed the
     context menu on pause of the RecentsActivity

Change-Id: Ia50bed7bfad6fde7beeaec37fa6402177eee1d40
Wifi: wifi not connecting, once the APN gets disabled state

APNs are disabled on select network and they are enabled on
receiving connected event. But forgetting an APN before the
connected event is received,will result all the remaining APN
to be in disabled state and they never connect.
So, Enabling all the disabled APN on forget network will help
to connect automatically to a saved APN.

Change-Id: I0aec08f118c3f33fceea60f5a6b44622717d93ed
CRs-fixed: 567655
WIFI: FIX wifi not auto-connect issue.

If the active network type is wifi, wifi connection type is auto,
auto connect to wifi.

This allows Wifi to auto-connect while wifi disconnected
for unexpected reason.

CRs-Fixed: 633648

Change-Id: I9f7f125cd7ffba18cbf5052e683cb31c6f71c573
framework/base : Fix for Wi-Fi grayed out issue

During the initialization WiFiMonitor shall try to open the
control / monitor socket interface with the supplicant.On a
failed attempt to open the control interface WiFiMonitor
thread shall trigger an event SUP_DISCONNECTION_EVENT to
WiFiStateMachine with the expectation that the connection
attempt is restarted.In addition , it shall also remove the
interface from the mIfaceMap. During the restart , WiFiMonitor
shall not proceed to open the control interface with the
supplicant if the mIfaceMap does not point to the interface.
  Thus , do not remove the interface from mIfaceMap on a failed
attempt to create a control interface with the supplicant to
provision a reinitialization attempt.

Change-Id: Ia571a386c22e860b3e31f5153ae33f622b5d5973
CRs-Fixed: 642586
P2P : Wait for the terminate events on all the open interfaces

On a stop supplicant request from the framework , supplicant
shall issue TERMINATE event for per interface created and
thus WiFiMonotor shall kill the supplicant on the TERMINATE
event obtained on wlan0 interface.This would end up in not
deleting the other interfaces and thus they would be seen
as an active interfaces. Thus wait for the number of
TERMINATE events obtained corresponding to the number
of WiFiMonitor instances registered before killing
the supplicant.

Change-Id: I2d36d85d00073cf9a200dc92f94beefa4efe6087
CRs-Fixed: 601759
WIFI: Fix wifi auto-connect to other saved APs during WPS PIN scanning.

During WPS PIN scanning and AP side not enter the PIN, continuously
turn off/on screen will sometimes cause the phone auto-connect to
other saved APs.

WifiStateMachine accepts screenOn event, and sometimes will enable
all networks.

This change will NOT enable all networks in screenOn event While wps
is running.

Change-Id: I539ee6020a8e2b2fa6892c88569c302f89e8f5ed
CRs-Fixed: 646433
Removed android.debug.JNITest from preloaded-classes

android.debug.JNITest class no longer exists in this
project. This patch updates preloaded-classes accordingly
to avoid spurious warning during boot.

Change-Id: Ia4a5a1858f6c87fbc594a623adb95454334361ea
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>