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
Clear the scan list when an empty list is received

When the framework receives an empty scan list from supplicant, it does
not clear the local list. So the UI will continue to show the previous
scan list even when there are no APs around. So clear the local list,
when an empty list is received.

CRs-Fixed: 552212
Change-Id: I8715bc31ce0df7bd54c96fcf7d7b73592429f12a
Tighten condition for calling checkMobileProvisioning.

Add the condition that the connected network needs to be TYPE_MOBILE.
This eliminates checking on connecting to secondary networks like
FOTA, MMS, SUPL ...

This reduces unnecessary attempts to bring up multiple connections at
the same time. Especially in the light of the trouble we're having with HFA
on Sprint, where we don't want to connect to any other network until HFA
has completed.

Bug: 10758001
Change-Id: Id294536b70304a51de4752bc1a4ffac734f10f1a
Fix captive portal detection on IPv6 networks.

Currently the captive portal check URL is generated by
concatenating scheme, "://", IP address, and port. This breaks
for IPv6 because IPv6 addresses in URLs must be enclosed in
square brackets (e.g., http://2001:db8::1/generate_204 is
invalid; should he http://[2001:db8::1]/generate_204 instead).
The resulting MalformedURLException causes isMobileOk to report
that there is no captive portal, even if there is one.

Fortunately the three-arg URL constructor already knows how to
construct URLs with IPv6 addresses. Use that instead of
generating the URL ourselves.

Bug: 10801896
Change-Id: I02605ef62f493a34f25bb405ef02b111543a76fd