fstab: allow userdata encryption (use metadata1), fix init*.rc

* gpsd was not started correctly:
 - too early which prevented encryption.
 - its /data/gps directory was created before on-fs-data.
* Moved services that depend on /data to after late_start where they
belonged in the 1st place as /data is not available before late_start.

Bug: 14472973
Change-Id: I8c14b93c2ce39e8f35ee541f2e46ab1b75b93780
diff --git a/init.flounder.rc b/init.flounder.rc
index cec965b..929021c 100644
--- a/init.flounder.rc
+++ b/init.flounder.rc
@@ -25,6 +25,9 @@
     mkdir /data/nfc 0770 nfc nfc
     mkdir /data/nfc/param 0770 nfc nfc
 
+    # for GPS files
+    mkdir /data/gps 0770 gps system
+
     setprop vold.post_fs_data_done 1
 
 on boot
@@ -62,11 +65,6 @@
     mount_all /fstab.flounder
     setprop ro.crypto.fuse_sdcard true
 
-    # for GPS files
-    mkdir /data/gps 0770 gps system
-    chown gps system /data/gps
-    chmod 0770 /data/gps
-
     # HACK: prevent suspend, pending fixes
     write /sys/power/wake_lock VolantisHackPreventSuspend
 
@@ -92,14 +90,16 @@
 # for loading correct gps hal share libraries
 on property:ro.boot.baseband=N/A
     setprop ro.hardware.gps bcm47521
+    enable gpsd
 
 on property:ro.baseband=unknown
     setprop ro.hardware.gps bcm47521
+    enable gpsd
 
 # bugreport is triggered by holding down volume down, volume up and power
 service bugreport /system/bin/dumpstate -d -p -B \
         -o /data/data/com.android.shell/files/bugreports/bugreport
-    class main
+    class late_start
     disabled
     oneshot
     keycodes 114 115 116
@@ -110,26 +110,23 @@
     -puse_p2p_group_interface=1p2p_device=1 \
     -m/data/misc/wifi/p2p_supplicant.conf \
     -e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0
-    class main
+    class late_start
     socket wpa_wlan0 dgram 660 wifi wifi
     disabled
     oneshot
 
-service gpsd /system/bin/glgps -c /system/etc/gpsconfig.xml
-    class main
+service gpsd /system/bin/logwrapper /system/bin/glgps -c /system/etc/gpsconfig.xml
+    class late_start
     disabled
     user gps
     socket gps seqpacket 0660 gps system
     group system inet sdcard_rw sdcard_r
 
-on property:ro.hardware.gps=bcm47521
-    start gpsd
-
 service wpa_supplicant /system/bin/wpa_supplicant \
     -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
     -I/system/etc/wifi/wpa_supplicant_overlay.conf \
     -e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0
-    class main
+    class late_start
     socket wpa_wlan0 dgram 660 wifi wifi
     disabled
     oneshot