Merge changes from topic 'wifi_hidl'

* changes:
  hal_wifi: Allow wifi hal to access LOWI server
  marlin/sailfish: Remove redundant sepolicy for wpa_supplicant
  marlin/sailfish: Move wpa_supplicant to vendor partition
  Don't define superfluous wpa_supplicant service
  marlin/sailfish: Change ownership of wifi firmware reload sysfs paths
  marlin/sailfish: Add wifi HAL service to device.mk
diff --git a/device-common.mk b/device-common.mk
index e4b802b..755a8ff 100644
--- a/device-common.mk
+++ b/device-common.mk
@@ -146,6 +146,7 @@
 
 # Wi-Fi
 PRODUCT_PACKAGES += \
+    android.hardware.wifi@1.0-service \
     libwpa_client \
     hostapd \
     wificond \
diff --git a/init.common.rc b/init.common.rc
index 97fd351..2b93899 100755
--- a/init.common.rc
+++ b/init.common.rc
@@ -416,6 +416,9 @@
     setprop ro.qualcomm.bluetooth.map true
     setprop ro.bluetooth.hfp.ver 1.6
 
+    # Wifi firmware reload path
+    chown wifi wifi /sys/module/wlan/parameters/fwpath
+
 on property:wc_transport.start_hci=true
     start start_hci_filter
 
@@ -599,7 +602,7 @@
     user radio
     group radio diag usb
 
-service p2p_supplicant /system/bin/wpa_supplicant \
+service wpa_supplicant /vendor/bin/hw/wpa_supplicant \
     -ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf \
     -I/system/etc/wifi/p2p_supplicant_overlay.conf -N \
     -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
@@ -615,20 +618,6 @@
     disabled
     oneshot
 
-service wpa_supplicant /system/bin/wpa_supplicant \
-    -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
-    -I/system/etc/wifi/wpa_supplicant_overlay.conf \
-    -O/data/misc/wifi/sockets -dd \
-    -e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0
-    #   we will start as root and wpa_supplicant will switch to user wifi
-    #   after setting up the capabilities required for WEXT
-    #   user wifi
-    #   group wifi inet keystore
-    class main
-    socket wpa_wlan0 dgram 660 wifi wifi
-    disabled
-    oneshot
-
 service cnss_diag /system/bin/cnss_diag -q
     class late_start
     user root
diff --git a/sepolicy/hal_wifi.te b/sepolicy/hal_wifi.te
new file mode 100644
index 0000000..3a2fa5e
--- /dev/null
+++ b/sepolicy/hal_wifi.te
@@ -0,0 +1,7 @@
+# Allow wifi hal access to LOWI
+allow hal_wifi location:unix_stream_socket connectto;
+allow hal_wifi location_data_file:sock_file write;
+
+# write to files owned by location daemon
+allow hal_wifi location_data_file:dir create_dir_perms;
+allow hal_wifi location_data_file:{ file fifo_file } create_file_perms;
diff --git a/sepolicy/location.te b/sepolicy/location.te
index 60c7d5d..f2cf8ee 100644
--- a/sepolicy/location.te
+++ b/sepolicy/location.te
@@ -13,7 +13,7 @@
 
 binder_use(location)
 binder_call(location, system_server)
-allow location system_server:unix_stream_socket { read write };
+allow location hal_wifi:unix_stream_socket { read write };
 
 # Grant access to Qualcomm MSM Interface (QMI) radio sockets
 qmux_socket(location)
diff --git a/sepolicy/system_server.te b/sepolicy/system_server.te
index 505e64d..b66efc7 100644
--- a/sepolicy/system_server.te
+++ b/sepolicy/system_server.te
@@ -16,9 +16,6 @@
 allow system_server perfd_data_file:sock_file write;
 allow system_server perfd:unix_stream_socket connectto;
 
-allow system_server location:unix_stream_socket connectto;
-allow system_server location_data_file:sock_file write;
-
 allow system_server netmgrd_socket:dir search;
 unix_socket_connect(system_server, netmgrd, netmgrd)
 
@@ -29,10 +26,6 @@
 # files in /sys
 r_dir_file(system_server, sysfs_type)
 
-# write to files owned by location daemon
-allow system_server location_data_file:dir create_dir_perms;
-allow system_server location_data_file:{ file fifo_file } create_file_perms;
-
 ## Rules needed for sensors HAL when it is running in passthrough mode.
 
 # Access to the nanohub device
diff --git a/sepolicy/wpa.te b/sepolicy/wpa.te
deleted file mode 100644
index ff432ea..0000000
--- a/sepolicy/wpa.te
+++ /dev/null
@@ -1,6 +0,0 @@
-# in addition to ioctl commands granted to domain allow wpa to use:
-allowxperm wpa self:udp_socket ioctl priv_sock_ioctls;
-allowxperm wpa self:packet_socket ioctl { SIOCGIFINDEX SIOCGIFHWADDR };
-
-# read files in /sys
-r_dir_file(wpa, sysfs_type)