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
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: I6ac5e9856d6ec0b72c089b159206abd2de98e6a3
CRs-fixed: 496165
Revert "p2p: Fix for discovery failure until AP is connected in WFD client"

This reverts commit 738434a7df1cf7d0aada02e7905bdb4a51b5d3d6.

Change-Id: I4c1f061aa26077134029527dfc3e55112fed5038
CRs-Fixed: 532138
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
frameworks/base: Free BufferedReader class object

Free the BufferedReader class object explicitly.

Change-Id: I6a9f19e0334e1985652852447c545fa2227a04b5
CRs-Fixed: 564739
Tighten test for warm sim and add more debug.

- Require a non-204 response multiple times before declaring a
redirected error and hence a warm sim.

- If there is no connection or dns don't declare its a warm-sim.

- Add printing of the http headers to try to get more information
if we still get a false positive result.

Bug: 9972012
Change-Id: Ic115685cdbbe39c2b4de88b128eaf8d2ea96b45c
checkMobileProvisioning should not block.

In checkMobileProvisioning the call to mdst.isProvisioningNetwork() is
a blocking call and during monkey testing without SIM this is causing
ANR's. Move the initial test for provisioning into isMobileOk so
checkMobileProvisioning doesn't block.

If mobile is not supported return CMP_RESULT_NO_CONNECTION.

Cleaned up some debug.

Bug: 10674404
Change-Id: I10a0e922cd6ea9790f66e2083f37e68cb0a8861f
Use networkType to display  wifi and mobile notification separately.

There are two bugs one is I was clearing the notification in
CaptivePortalTracker when entering the ActivateState. (double check
according to bug 5021626 we should be calling enter)

Second is we could have the need to display both icons but can't
because we only allow one.

The solution I'm proposing here is to allow two notifications and
have then controlled separately.

Bug: 10886908
Change-Id: I30e7130bc542535492d175640a4990c592f32806
Merge remote-tracking branch 'cm/cm-10.2' into cm-10.2