hikey960: Move to real vendor partition am: 168e6d6dbb
am: d848c78097

Change-Id: I0760fe73609cd617635bc70976a4246c613649c3
diff --git a/init.common.rc b/init.common.rc
index 10fe234..0085215 100644
--- a/init.common.rc
+++ b/init.common.rc
@@ -71,6 +71,11 @@
     # Set SELinux security contexts for files used by lava.
     restorecon_recursive /data/local/tmp/lava
 
+on zygote-start
+    mkdir /data/vendor/wifi 0770 wifi wifi
+    mkdir /data/vendor/wifi/wpa 0770 wifi wifi
+    mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi
+
 on property:sys.boot_completed=1
     # update cpuset now that processors are up
     # Foreground should contain most cores (7 is reserved for top-app)
@@ -102,8 +107,9 @@
     oneshot
 
 service wpa_supplicant /system/vendor/bin/hw/wpa_supplicant \
-     -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
      -g@android:wpa_wlan0
+     interface android.hardware.wifi.supplicant@1.0::ISupplicant default
+     interface android.hardware.wifi.supplicant@1.1::ISupplicant default
      socket wpa_wlan0 dgram 660 wifi wifi
      class main
      disabled
diff --git a/init.common.usb.rc b/init.common.usb.rc
index 5d6986b..f198a8b 100644
--- a/init.common.usb.rc
+++ b/init.common.usb.rc
@@ -13,6 +13,7 @@
     mkdir /config/usb_gadget/g1/functions/midi.gs5
     mkdir /config/usb_gadget/g1/functions/ffs.adb
     mkdir /config/usb_gadget/g1/functions/ffs.mtp
+    mkdir /config/usb_gadget/g1/functions/ffs.ptp
     mkdir /config/usb_gadget/g1/configs/b.1 0770 shell shell
     mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell
     write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1
@@ -22,7 +23,9 @@
     mkdir /dev/usb-ffs/adb 0770 shell shell
     mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
     mkdir /dev/usb-ffs/mtp 0770 mtp mtp
+    mkdir /dev/usb-ffs/ptp 0770 mtp mtp
     mount functionfs mtp /dev/usb-ffs/mtp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1
+    mount functionfs ptp /dev/usb-ffs/ptp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1
     setprop sys.usb.mtp.device_type 3
     setprop sys.usb.configfs 1
     setprop sys.usb.ffs.aio_compat 1
@@ -31,12 +34,12 @@
 on property:sys.usb.config=none && property:sys.usb.configfs=1
     write /config/usb_gadget/g1/os_desc/use 0
 
-on property:sys.usb.ffs.mtp.ready=1 && property:sys.usb.config=mtp && property:sys.usb.configfs=1
+on property:sys.usb.config=mtp && property:sys.usb.configfs=1
     write /config/usb_gadget/g1/idProduct 0x4ee1
     write /config/usb_gadget/g1/os_desc/use 1
     symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
 
-on property:sys.usb.ffs.ready=1 && property:sys.usb.ffs.mtp.ready=1 && property:sys.usb.config=mtp,adb && property:sys.usb.configfs=1
+on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,adb && property:sys.usb.configfs=1
     write /config/usb_gadget/g1/idProduct 0x4ee2
     write /config/usb_gadget/g1/os_desc/use 1
     symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
@@ -47,15 +50,15 @@
 on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,adb && property:sys.usb.configfs=1
     write /config/usb_gadget/g1/idProduct 0x4ee4
 
-on property:sys.usb.ffs.mtp.ready=1 && property:sys.usb.config=ptp && property:sys.usb.configfs=1
+on property:sys.usb.config=ptp && property:sys.usb.configfs=1
     write /config/usb_gadget/g1/idProduct 0x4ee5
     write /config/usb_gadget/g1/os_desc/use 1
-    symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
+    symlink /config/usb_gadget/g1/functions/ffs.ptp /config/usb_gadget/g1/configs/b.1/f1
 
-on property:sys.usb.ffs.ready=1 && property:sys.usb.ffs.mtp.ready=1 && property:sys.usb.config=ptp,adb && property:sys.usb.configfs=1
+on property:sys.usb.ffs.ready=1 && property:sys.usb.config=ptp,adb && property:sys.usb.configfs=1
     write /config/usb_gadget/g1/idProduct 0x4ee6
     write /config/usb_gadget/g1/os_desc/use 1
-    symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
+    symlink /config/usb_gadget/g1/functions/ffs.ptp /config/usb_gadget/g1/configs/b.1/f1
 
 on property:sys.usb.config=adb && property:sys.usb.configfs=1
     write /config/usb_gadget/g1/idProduct 0x4ee7
diff --git a/manifest.xml b/manifest.xml
index 7f353ef..b558f74 100644
--- a/manifest.xml
+++ b/manifest.xml
@@ -148,10 +148,19 @@
         </interface>
     </hal>
     <hal format="hidl">
-        <name>android.hardware.wifi.supplicant</name>
+        <name>android.hardware.wifi.hostapd</name>
         <transport>hwbinder</transport>
         <version>1.0</version>
         <interface>
+            <name>IHostapd</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
+    <hal format="hidl">
+        <name>android.hardware.wifi.supplicant</name>
+        <transport>hwbinder</transport>
+        <version>1.1</version>
+        <interface>
             <name>ISupplicant</name>
             <instance>default</instance>
         </interface>
diff --git a/sepolicy/hal_wifi_supplicant_default.te b/sepolicy/hal_wifi_supplicant_default.te
index 3646bac..c657db5 100644
--- a/sepolicy/hal_wifi_supplicant_default.te
+++ b/sepolicy/hal_wifi_supplicant_default.te
@@ -4,7 +4,3 @@
 
 allow hal_wifi_supplicant_default wifi_data_file:dir create_dir_perms;
 allow hal_wifi_supplicant_default wifi_data_file:file create_file_perms;
-
-# Create a socket for receiving info from wpa
-allow hal_wifi_supplicant_default wpa_socket:dir create_dir_perms;
-allow hal_wifi_supplicant_default wpa_socket:sock_file create_file_perms;
diff --git a/sepolicy/hostapd.te b/sepolicy/hostapd.te
deleted file mode 100644
index 86b985a..0000000
--- a/sepolicy/hostapd.te
+++ /dev/null
@@ -1,11 +0,0 @@
-# TODO(b/36657258): Remove data_between_core_and_vendor_violators once
-# hostapd no longer directly accesses /data outside /data/vendor.
-typeattribute hostapd data_between_core_and_vendor_violators;
-# hostapd can read and write WiFi related data and configuration.
-allow hostapd wifi_data_file:file rw_file_perms;
-r_dir_file(hostapd, wifi_data_file)
-
-# hostapd wants to create the directory holding its control socket.
-allow hostapd hostapd_socket:dir create_dir_perms;
-# hostapd needs to create, bind to, read, and write its control socket.
-allow hostapd hostapd_socket:sock_file create_file_perms;