Support Passpoint frame filters in Android

The conf->hs20 flag is not used in Android, but HS 2.0
configuration is still required when setting up the frame filters
in the WPA driver. Split the is_hs20_network() to two functions,
and moved the conf->hs20() check to a new is_hs20_config function.
Added ANDROID compilation flag in hs20_configure_frame_filters()
to skip the configuration check.
Additionally, trigger a call to hs20_configure_frame_filters()
upon succesful connection when state equals to WPA_COMPLETED.

Bug: 168681498
Test: Verify wpa driver is called with the appropriate frame filter
flags when connecting to Passpoint networks.
Test: Verify wpa driver is not called to filter frames for other
Enterprise networks.

Change-Id: I3afea6018d5ddd2211974ca10a30180c6cc204e7
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 1fd6506..224fb10 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -1016,6 +1016,9 @@
 		if (ssid && (ssid->key_mgmt & WPA_KEY_MGMT_OWE))
 			wpas_update_owe_connect_params(wpa_s);
 #endif /* CONFIG_OWE */
+#ifdef CONFIG_HS20
+		hs20_configure_frame_filters(wpa_s);
+#endif
 	} else if (state == WPA_DISCONNECTED || state == WPA_ASSOCIATING ||
 		   state == WPA_ASSOCIATED) {
 		wpa_s->new_connection = 1;
@@ -3033,7 +3036,7 @@
 	}
 
 #ifdef CONFIG_HS20
-	if (is_hs20_network(wpa_s, ssid, bss)) {
+	if (is_hs20_config(wpa_s) && is_hs20_network(wpa_s, ssid, bss)) {
 		struct wpabuf *hs20;
 
 		hs20 = wpabuf_alloc(20 + MAX_ROAMING_CONS_OI_LEN);
@@ -3051,10 +3054,9 @@
 				wpa_ie_len += wpabuf_len(hs20);
 			}
 			wpabuf_free(hs20);
-
-			hs20_configure_frame_filters(wpa_s);
 		}
 	}
+	hs20_configure_frame_filters(wpa_s);
 #endif /* CONFIG_HS20 */
 
 	if (wpa_s->vendor_elem[VENDOR_ELEM_ASSOC_REQ]) {