omni: make emulator work on Q

Change-Id: I4fe6e0ed2604acdec56bc1851f5053e2373bbfc5
diff --git a/AndroidProducts.mk b/AndroidProducts.mk
index 2f6e4fe..2665f06 100644
--- a/AndroidProducts.mk
+++ b/AndroidProducts.mk
@@ -16,3 +16,5 @@
 
 PRODUCT_MAKEFILES := \
     $(LOCAL_DIR)/utils/emulator/omni_emulator.mk
+
+COMMON_LUNCH_CHOICES := omni_emulator-userdebug
diff --git a/utils/emulator/advancedFeatures.ini b/utils/emulator/advancedFeatures.ini
index 7f0bfe9..8554ebb 100644
--- a/utils/emulator/advancedFeatures.ini
+++ b/utils/emulator/advancedFeatures.ini
@@ -1,9 +1,16 @@
 GrallocSync = on
-GLDMA = on
 LogcatPipe = on
 GLAsyncSwap = on
 GLESDynamicVersion = on
+GLDMA = on
 EncryptUserData = on
 IntelPerformanceMonitoringUnit = on
-SystemAsRoot = on
 Wifi = on
+HostComposition = on
+RefCountPipe = on
+#VirtioInput = on
+DynamicPartition = on
+MultiDisplay = on
+VulkanNullOptionalStrings = on
+YUV420888toNV21 = on
+YUVCache = on
diff --git a/utils/emulator/common.mk b/utils/emulator/common.mk
index be92bcb..8d7663c 100644
--- a/utils/emulator/common.mk
+++ b/utils/emulator/common.mk
@@ -39,9 +39,10 @@
 PRODUCT_COPY_FILES += \
     vendor/omni/prebuilt/etc/init.local.rc:root/init.omni.rc
 
-# Enable SIP and VoIP on all targets
+# permissions
 PRODUCT_COPY_FILES += \
-    frameworks/native/data/etc/android.software.sip.voip.xml:system/etc/permissions/android.software.sip.voip.xml
+    frameworks/native/data/etc/android.software.sip.voip.xml:system/etc/permissions/android.software.sip.voip.xml \
+    vendor/omni/prebuilt/etc/permissions/privapp-permissions-omni.xml:system/etc/permissions/privapp-permissions-omni.xml
 
 # custom omni sounds
 PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
diff --git a/utils/emulator/create_emulator_image.sh b/utils/emulator/create_emulator_image.sh
index 1d7630a..ae27d8b 100755
--- a/utils/emulator/create_emulator_image.sh
+++ b/utils/emulator/create_emulator_image.sh
@@ -15,12 +15,16 @@
     exit 1
 fi
 
+
 # creates image zip in /tmp/
+cd $ANDROID_PRODUCT_OUT/..
+DIGEST=`grep "# " generic_x86/VerifiedBootParams.textproto| sed -e 's/# //'`
+
 cd $ANDROID_BUILD_TOP
 cp -r vendor/omni/utils/emulator/skins $ANDROID_PRODUCT_OUT
-cp -r vendor/omni/utils/emulator/start_emulator_image.sh $ANDROID_PRODUCT_OUT
+cat vendor/omni/utils/emulator/start_emulator_image.sh | sed -e "s/vbmeta/$DIGEST/" > $ANDROID_PRODUCT_OUT/start_emulator_image.sh
 cp -r vendor/omni/utils/emulator/advancedFeatures.ini $ANDROID_PRODUCT_OUT
 
 cd $ANDROID_PRODUCT_OUT/..
 rm /tmp/omni_emulator.zip
-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.img generic_x86/start_emulator_image.sh generic_x86/advancedFeatures.ini generic_x86/encryptionkey.img generic_x86/kernel-ranchu-64 generic_x86/ramdisk.img
+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.img generic_x86/start_emulator_image.sh generic_x86/advancedFeatures.ini generic_x86/encryptionkey.img generic_x86/kernel-ranchu-64 generic_x86/ramdisk.img generic_x86/vendor-qemu.img
diff --git a/utils/emulator/overlay/frameworks/base/core/res/res/values/config.xml b/utils/emulator/overlay/frameworks/base/core/res/res/values/config.xml
index 968a81e..c20a462 100644
--- a/utils/emulator/overlay/frameworks/base/core/res/res/values/config.xml
+++ b/utils/emulator/overlay/frameworks/base/core/res/res/values/config.xml
@@ -18,23 +18,5 @@
 -->
 
 <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <!-- The list absolute paths of jar/apk files containing the device specific handlers,
-    delimited by File.pathSeparator, which defaults to ":" on Android -->
-    <string name="config_deviceKeyHandlerLib" translatable="false">/system/app/GoldfishParts/GoldfishParts.apk</string>
-    <!-- Full qualified name of the class that implements
-    com.android.internal.os.DeviceKeyHandler interface. -->
-    <string name="config_deviceKeyHandlerClass" translatable="false">org.omnirom.device.KeyHandler</string>
-    <!-- make sure you enable this only if your device supports deep slepp
-    with active proximity sensor event listener -->
-    <bool name="config_proxiSensorWakupCheck">true</bool>
-    <bool name="config_haveHigherAspectRatioScreen">true</bool>
-    <string name="config_mainBuiltInDisplayCutout">M 0,0 L -183, 0 A 24.0, 24.0, 0, 0, 1, -159.0, 22.0 A 64.0, 64.0, 0, 0, 0, -95.0, 80.0 L 95.0, 80.0 A 64.0, 64.0, 0, 0, 0, 159.0, 22.0 A 24.0, 24.0, 0, 0, 1, 183.0, 0 Z</string>
-    
-    <!-- Whether the display cutout region of the main built-in display should be forced to
-    black in software (to avoid aliasing or emulate a cutout that is not physically existent).
-    -->
-    <bool name="config_fillMainBuiltInDisplayCutout">true</bool>
-    <bool name="config_intrusiveNotificationLed">false</bool>
-    <bool name="config_intrusiveBatteryLed">false</bool>
 
 </resources>
diff --git a/utils/emulator/packages.mk b/utils/emulator/packages.mk
index 2bf5b15..b692c28 100644
--- a/utils/emulator/packages.mk
+++ b/utils/emulator/packages.mk
@@ -1,5 +1,5 @@
 # Additional apps
-PRODUCT_PACKAGES += \
+#PRODUCT_PACKAGES += \
     MonthCalendarWidget \
     OmniSwitch \
     Chromium \
@@ -33,12 +33,12 @@
     mount.ntfs \
     fsck.ntfs
 
-PRODUCT_PACKAGES += \
+#PRODUCT_PACKAGES += \
     NotificationsDark \
     NotificationsLight \
     NotificationsPrimary
 
-PRODUCT_PACKAGES += \
+#PRODUCT_PACKAGES += \
     AccentSluttyPink \
     AccentPixel \
     AccentGoldenShower \
@@ -53,7 +53,7 @@
     AccentRottenOrange \
     AccentDeepPurple
 
-PRODUCT_PACKAGES += \
+#PRODUCT_PACKAGES += \
     PrimaryAlmostBlack \
     PrimaryBlack \
     PrimaryOmni \
@@ -62,13 +62,13 @@
     PrimaryWarmWhite \
     PrimaryDarkBlue
 
-PRODUCT_PACKAGES += \
+#PRODUCT_PACKAGES += \
     DocumentsUITheme
 
 # Telephony extension
-PRODUCT_PACKAGES += telephony-ext
-PRODUCT_BOOT_JARS += telephony-ext
+#PRODUCT_PACKAGES += telephony-ext
+#PRODUCT_BOOT_JARS += telephony-ext
 
 # for fun
-PRODUCT_PACKAGES += \
+#PRODUCT_PACKAGES += \
     EggGame
diff --git a/utils/emulator/start_emulator_image.sh b/utils/emulator/start_emulator_image.sh
index f1105b8..ef8d04c 100755
--- a/utils/emulator/start_emulator_image.sh
+++ b/utils/emulator/start_emulator_image.sh
@@ -3,5 +3,4 @@
 export ANDROID_BUILD_TOP=`pwd`
 export ANDROID_PRODUCT_OUT=`pwd`
 
-cp $HOME/Android/Sdk/system-images/android-28/google_apis/x86/vendor.img .
-$HOME/Android/Sdk/emulator/emulator  -verbose -skindir $ANDROID_BUILD_TOP/skins/ -skin pixel_2_xl -gpu host -writable-system -qemu -cpu qemu64
+$HOME/Android/Sdk/emulator/emulator  -verbose -skindir $ANDROID_BUILD_TOP/skins/ -skin pixel_2_xl -gpu host -writable-system -qemu -cpu qemu64 -append "vbmeta"
diff --git a/utils/emulator/start_emulator_local.sh b/utils/emulator/start_emulator_local.sh
deleted file mode 100755
index 34a838b..0000000
--- a/utils/emulator/start_emulator_local.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-# assumes the image zip has been extracted in /tmp
-
-emulator  -verbose -skindir $ANDROID_BUILD_TOP/vendor/omni/utils/emulator/skins/ -skin pixel_xl -writable-system
diff --git a/vendorsetup.sh b/vendorsetup.sh
deleted file mode 100755
index a9c91e1..0000000
--- a/vendorsetup.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Copyright 2015 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-add_lunch_combo omni_emulator-userdebug