omni: fix emulator builds for pie

Change-Id: Ie4545f8150c7a8f86d0a108be8fbe80a435394e4
diff --git a/config/packages.mk b/config/packages.mk
index 7f7ba3e..3731b3a 100644
--- a/config/packages.mk
+++ b/config/packages.mk
@@ -1,19 +1,21 @@
 # Additional apps
 PRODUCT_PACKAGES += \
     MonthCalendarWidget \
-    OpenDelta \
     OmniSwitch \
     Chromium \
     OmniJaws \
     OmniStyle \
     OmniClockOSS \
     MusicFX \
+    Phonograph \
+    MatLog \
+    OmniChange
+
+#PRODUCT_PACKAGES += \
+    OpenDelta \
     audio_effects.conf \
     libcyanogen-dsp \
-    Phonograph \
     Turbo \
-    MatLog \
-    OmniChange \
     OmniBrain
 
 # Additional tools
@@ -50,15 +52,15 @@
     OmniSubs
 
 # Themes
-PRODUCT_PACKAGES += \
+#PRODUCT_PACKAGES += \
     GboardOmniTheme
 
-PRODUCT_PACKAGES += \
+#PRODUCT_PACKAGES += \
     NotificationsDark \
     NotificationsLight \
     NotificationsPrimary
 
-PRODUCT_PACKAGES += \
+#PRODUCT_PACKAGES += \
     AccentSluttyPink \
     AccentPixel \
     AccentGoldenShower \
@@ -73,7 +75,7 @@
     AccentRottenOrange \
     AccentDeepPurple
 
-PRODUCT_PACKAGES += \
+#PRODUCT_PACKAGES += \
     PrimaryAlmostBlack \
     PrimaryBlack \
     PrimaryOmni \
@@ -83,7 +85,7 @@
     PrimaryDarkBlue
 
 # Textclassifiers
-PRODUCT_PACKAGES += \
+#PRODUCT_PACKAGES += \
     textclassifier.langid.model \
     textclassifier.smartselection.bundle1 \
     textclassifier.smartselection.ar.model \
@@ -96,12 +98,12 @@
     textclassifier.smartselection.zh.model \
     textclassifier.smartselection.zh-Hant.model
 
-PRODUCT_PACKAGES += \
+#PRODUCT_PACKAGES += \
     Launcher3Dark
 
 # for fun
 PRODUCT_PACKAGES += \
     EggGame
 
-PRODUCT_PACKAGES += \
+#PRODUCT_PACKAGES += \
     ExtraFonts
diff --git a/google/Android.mk b/google/Android.mk
index 20bfbaf..389e8be 100644
--- a/google/Android.mk
+++ b/google/Android.mk
@@ -25,4 +25,4 @@
 # if some modules are built directly from this directory (not subdirectories),
 # their rules should be written here.
 
-include $(call all-makefiles-under,$(LOCAL_PATH))
+#include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/utils/emulator/GoldfishParts/Android.mk b/utils/emulator/GoldfishParts/Android.mk
index 34d1c0f..aa35221 100644
--- a/utils/emulator/GoldfishParts/Android.mk
+++ b/utils/emulator/GoldfishParts/Android.mk
@@ -3,7 +3,7 @@
 
 LOCAL_MODULE_TAGS := optional
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_PACKAGE_NAME := GoldfishParts
+LOCAL_PACKAGE_NAME := GoldfishParts.save
 LOCAL_CERTIFICATE := platform
 LOCAL_AAPT_FLAGS := --auto-add-overlay
 LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
@@ -18,6 +18,7 @@
 
 LOCAL_PROGUARD_ENABLED := disabled
 LOCAL_DEX_PREOPT := false
+LOCAL_SDK_VERSION := system_current
 
 include $(BUILD_PACKAGE)
 
diff --git a/utils/emulator/advancedFeatures.ini b/utils/emulator/advancedFeatures.ini
index 8bc0cf5..7f0bfe9 100644
--- a/utils/emulator/advancedFeatures.ini
+++ b/utils/emulator/advancedFeatures.ini
@@ -3,5 +3,7 @@
 LogcatPipe = on
 GLAsyncSwap = on
 GLESDynamicVersion = on
-EncryptUserData = off
+EncryptUserData = on
 IntelPerformanceMonitoringUnit = on
+SystemAsRoot = on
+Wifi = on
diff --git a/utils/emulator/common.mk b/utils/emulator/common.mk
index 11c725c..f853476 100644
--- a/utils/emulator/common.mk
+++ b/utils/emulator/common.mk
@@ -71,5 +71,3 @@
 
 # Add our overlays
 DEVICE_PACKAGE_OVERLAYS += vendor/omni/overlay/common
-
-WITH_DEXPREOPT := false
diff --git a/utils/emulator/create_emulator_image.sh b/utils/emulator/create_emulator_image.sh
index b92ec69..34ba548 100755
--- a/utils/emulator/create_emulator_image.sh
+++ b/utils/emulator/create_emulator_image.sh
@@ -22,4 +22,4 @@
 cp -r vendor/omni/utils/emulator/advancedFeatures.ini $ANDROID_PRODUCT_OUT
 
 cd $ANDROID_PRODUCT_OUT/..
-zip -r /tmp/omni_emulator.zip generic_x86/skins generic_x86/system.img generic_x86/system/build.prop generic_x86/cache.img generic_x86/userdata.img generic_x86/start_emulator_image.sh generic_x86/advancedFeatures.ini
+zip -r /tmp/omni_emulator.zip generic_x86/skins generic_x86/system-qemu.img generic_x86/system/build.prop generic_x86/cache.img generic_x86/userdata-qemu.img generic_x86/start_emulator_image.sh generic_x86/advancedFeatures.ini generic_x86/vendor-qemu.img generic_x86/encryptionkey.img generic_x86/kernel-ranchu-64 generic_x86/ramdisk.img
diff --git a/utils/emulator/fstab.ranchu b/utils/emulator/fstab.ranchu
index 31958e9..0c83d59 100644
--- a/utils/emulator/fstab.ranchu
+++ b/utils/emulator/fstab.ranchu
@@ -2,7 +2,5 @@
 #<src>                                                  <mnt_point>         <type>    <mnt_flags and options>                              <fs_mgr_flags>
 # The filesystem that contains the filesystem checker binary (typically /system) cannot
 # specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
-/dev/block/vda                                          /system             ext4      ro                                                   wait
-/dev/block/vdb                                          /cache              ext4      noatime,nosuid,nodev,nomblk_io_submit,errors=panic   wait
-/dev/block/vdc                                          /data               ext4      noatime,nosuid,nodev,nomblk_io_submit,errors=panic   wait,check,quota
-/devices/*/block/vdd                                    auto                auto      defaults                                             voldmanaged=sdcard:auto,encryptable=userdata
+/dev/block/vdc                                          /data               ext4      noatime,nosuid,nodev,nomblk_io_submit,errors=panic   wait,check,quota,forceencrypt=/dev/block/vdd
+/devices/*/block/vdf                                    auto                auto      defaults                                             voldmanaged=sdcard:auto,encryptable=userdata
diff --git a/utils/emulator/omni_emulator.mk b/utils/emulator/omni_emulator.mk
index c86e252..22cd885 100644
--- a/utils/emulator/omni_emulator.mk
+++ b/utils/emulator/omni_emulator.mk
@@ -1,5 +1,5 @@
 PRODUCT_COPY_FILES += \
-    vendor/omni/utils/emulator/fstab.ranchu:root/fstab.ranchu
+    vendor/omni/utils/emulator/fstab.ranchu:vendor/etc/fstab.ranchu
 
 $(call inherit-product, build/target/product/sdk_x86.mk)
 
@@ -11,3 +11,5 @@
 PRODUCT_NAME := omni_emulator
 
 DEVICE_PACKAGE_OVERLAYS += vendor/omni/utils/emulator/overlay
+
+ALLOW_MISSING_DEPENDENCIES := true 
diff --git a/utils/emulator/packages.mk b/utils/emulator/packages.mk
index 653884f..26ae899 100644
--- a/utils/emulator/packages.mk
+++ b/utils/emulator/packages.mk
@@ -1,23 +1,22 @@
 # Additional apps
 PRODUCT_PACKAGES += \
     MonthCalendarWidget \
-    OpenDelta \
     OmniSwitch \
     Chromium \
     OmniJaws \
     OmniStyle \
-    QuickSearchBox \
     OmniClockOSS \
     MusicFX \
-    audio_effects.conf \
-    libcyanogen-dsp \
     Phonograph \
-    Turbo \
     MatLog \
-    GoldfishParts
+    OmniChange
+
+#PRODUCT_PACKAGES += \
+    GoldfishParts \
+    OpenDelta
 
 # Themes
-PRODUCT_PACKAGES += \
+#PRODUCT_PACKAGES += \
     PixelTheme \
     Stock
 
diff --git a/utils/emulator/start_emulator_image.sh b/utils/emulator/start_emulator_image.sh
index c93ed81..96e1c48 100755
--- a/utils/emulator/start_emulator_image.sh
+++ b/utils/emulator/start_emulator_image.sh
@@ -1,7 +1,6 @@
 #!/bin/sh
 
-# assumes the image zip has been extracted in /tmp
-export ANDROID_BUILD_TOP=/tmp/generic_x86
-export ANDROID_PRODUCT_OUT=/tmp/generic_x86
+export ANDROID_BUILD_TOP=`pwd`
+export ANDROID_PRODUCT_OUT=`pwd`
 
-~/Android/Sdk/tools/emulator  -verbose -skindir /tmp/generic_x86/skins/ -skin pixel_xl -kernel ~/Android/Sdk/system-images/android-26/google_apis/x86/kernel-ranchu -gpu host -ramdisk ~/Android/Sdk/system-images/android-26/google_apis/x86/ramdisk.img -writable-system
+/home/maxl/Android/Sdk/emulator/emulator  -verbose -skindir $ANDROID_BUILD_TOP/skins/ -skin pixel_xl -gpu host -writable-system -qemu -cpu qemu64
diff --git a/utils/emulator/start_emulator_local.sh b/utils/emulator/start_emulator_local.sh
index 16ad274..34a838b 100755
--- a/utils/emulator/start_emulator_local.sh
+++ b/utils/emulator/start_emulator_local.sh
@@ -2,4 +2,4 @@
 
 # assumes the image zip has been extracted in /tmp
 
-emulator  -verbose -skindir $ANDROID_BUILD_TOP/vendor/omni/utils/emulator/skins/ -skin pixel_xl -ramdisk ~/Android/Sdk/system-images/android-26/google_apis/x86/ramdisk.img  -kernel ~/Android/Sdk/system-images/android-26/google_apis/x86/kernel-ranchu -gpu host -writable-system
+emulator  -verbose -skindir $ANDROID_BUILD_TOP/vendor/omni/utils/emulator/skins/ -skin pixel_xl -writable-system