Merge remote-tracking branch 'aosp/master-cuttlefish-testing' into master

Bug: 129429729
Test: TH
Change-Id: I33e1f953e25c50666463ef975cc705110c03b4f3
diff --git a/Android.bp b/Android.bp
index e70a45f..cb7d5ea 100644
--- a/Android.bp
+++ b/Android.bp
@@ -44,3 +44,19 @@
         },
     },
 }
+
+cc_defaults {
+    name: "cuttlefish_libicuuc",
+    shared_libs: [
+        "libicuuc",
+        "libandroidicu",
+    ],
+}
+
+cc_defaults {
+    name: "cuttlefish_health_storage",
+    defaults: ["enabled_on_q_and_later"],
+    vintf_fragments: [
+        "manifest_android.hardware.health.storage@1.0.cuttlefish.xml",
+    ],
+}
diff --git a/Android.mk b/Android.mk
index b0234eb..afddf54 100644
--- a/Android.mk
+++ b/Android.mk
@@ -14,7 +14,7 @@
 # limitations under the License.
 #
 
-ifneq ($(filter $(TARGET_DEVICE), vsoc_x86 vsoc_x86_64),)
+ifneq ($(filter $(TARGET_DEVICE), vsoc_arm vsoc_arm64 vsoc_x86 vsoc_x86_64),)
 LOCAL_PATH:= $(call my-dir)
 
 include $(CLEAR_VARS)
diff --git a/AndroidProducts.mk b/AndroidProducts.mk
index aed0d8b..2a6e400 100644
--- a/AndroidProducts.mk
+++ b/AndroidProducts.mk
@@ -15,6 +15,8 @@
 #
 
 PRODUCT_MAKEFILES := \
+	aosp_cf_arm_phone:$(LOCAL_DIR)/vsoc_arm/phone/device.mk \
+	aosp_cf_arm64_phone:$(LOCAL_DIR)/vsoc_arm64/phone/device.mk \
 	aosp_cf_x86_64_auto:$(LOCAL_DIR)/vsoc_x86_64/auto/device.mk \
 	aosp_cf_x86_64_pasan:$(LOCAL_DIR)/vsoc_x86_64/pasan/device.mk \
 	aosp_cf_x86_64_phone:$(LOCAL_DIR)/vsoc_x86_64/phone/device.mk \
@@ -37,6 +39,8 @@
 	aosp_cf_x86_wear:$(LOCAL_DIR)/vsoc_x86/wear/device.mk \
 
 COMMON_LUNCH_CHOICES := \
+	aosp_cf_arm_phone-userdebug \
+	aosp_cf_arm64_phone-userdebug \
 	aosp_cf_x86_auto-userdebug \
 	aosp_cf_x86_phone-userdebug \
 	aosp_cf_x86_tablet-userdebug \
diff --git a/OWNERS b/OWNERS
index 62ded25..3f32871 100644
--- a/OWNERS
+++ b/OWNERS
@@ -1,6 +1,7 @@
 astrachan@google.com
 ghartman@google.com
 jemoreira@google.com
-haining@google.com
 malchev@google.com
 schuffelen@google.com
+muntsinger@google.com
+rammuthiah@google.com
\ No newline at end of file
diff --git a/host_package.mk b/host_package.mk
index a4c561c..b404816 100644
--- a/host_package.mk
+++ b/host_package.mk
@@ -6,7 +6,7 @@
 hosttar: $(cvd_host_package_tar)
 
 .PHONY: cf_local_image
-cf_local_image: bootimage cacheimage hosttar systemimage userdataimage vendorimage
+cf_local_image: bootimage cacheimage hosttar systemimage productimage userdataimage vendorimage
 
 $(cvd_host_package_tar): PRIVATE_TAR_FORMAT :=
 ifeq ($(HOST_OS),linux)
@@ -29,14 +29,19 @@
     host_region_e2e_test \
     launch_cvd \
     socket_forward_proxy \
+    socket_vsock_proxy \
     adb_connector \
     stop_cvd \
+    stream_audio \
     vnc_server \
     record_audio \
     cf_qemu.sh \
     ivserver \
     virtual_usb_manager \
     kernel_log_monitor \
+    extract-vmlinux \
+    crosvm \
+    logcat_receiver \
 
 cvd_host_tests := \
     auto_free_buffer_test \
@@ -49,34 +54,40 @@
     cuttlefish_net_tests \
 
 cvd_host_shared_libraries := \
-    libbase \
-    vsoc_lib \
-    libcuttlefish_fs \
-    cuttlefish_auto_resources \
-    libcuttlefish_strings \
-    libcuttlefish_utils \
-    cuttlefish_tcp_socket \
-    cuttlefish_net \
-    liblog \
-    libnl \
-    libc++ \
-    libicuuc-host \
-    libicui18n-host \
-    libandroidicu-host \
-    libvirglrenderer_cuttlefish \
-    libEGL_swiftshader \
-    libGLESv1_CM_swiftshader \
-    libGLESv2_swiftshader \
+    libbase.so \
+    vsoc_lib.so \
+    libcuttlefish_fs.so \
+    cuttlefish_auto_resources.so \
+    libcuttlefish_strings.so \
+    libcuttlefish_utils.so \
+    cuttlefish_tcp_socket.so \
+    cuttlefish_net.so \
+    liblog.so \
+    libnl.so \
+    libc++.so \
+    libicuuc-host.so \
+    libicui18n-host.so \
+    libandroidicu-host.so \
+    libopus.so \
+    libvirglrenderer_cuttlefish.so \
+    libEGL_swiftshader.so \
+    libGLESv1_CM_swiftshader.so \
+    libGLESv2_swiftshader.so \
+    crosvm/libepoxy.so.0 \
+    crosvm/libgbm.so.1 \
+    crosvm/libminijail.so \
+    crosvm/libvirglrenderer.so.0 \
 
 
 cvd_host_configs := \
     system-root.dtb \
-    initrd-root.dtb
+    initrd-root.dtb \
+    gsi.fstab \
 
 cvd_host_package_files := \
      $(addprefix config/,$(cvd_host_configs)) \
      $(addprefix $(bin_path)/,$(cvd_host_executables)) \
-     $(addprefix $(lib_path)/,$(addsuffix .so,$(cvd_host_shared_libraries))) \
+     $(addprefix $(lib_path)/,$(cvd_host_shared_libraries)) \
      $(foreach test,$(cvd_host_tests), ${tests_path}/$(test)/$(test)) \
 
 $(cvd_host_package_tar): PRIVATE_FILES := $(cvd_host_package_files)
diff --git a/shared/BoardConfig.mk b/shared/BoardConfig.mk
index 646c115..948989a 100644
--- a/shared/BoardConfig.mk
+++ b/shared/BoardConfig.mk
@@ -18,14 +18,23 @@
 # Common BoardConfig for all supported architectures.
 #
 
+TARGET_BOOTLOADER_BOARD_NAME := cutf
+
 # Build a separate vendor.img partition
 BOARD_USES_VENDORIMAGE := true
 BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
-BOARD_VENDORIMAGE_PARTITION_SIZE := 268435456 # 256 MB
+BOARD_VENDORIMAGE_PARTITION_SIZE := 100663296 # 96MB
 TARGET_COPY_OUT_VENDOR := vendor
 
-TARGET_NO_RECOVERY := true
-ifneq (,$(CUTTLEFISH_SYSTEM_AS_ROOT))
+BOARD_USES_METADATA_PARTITION := true
+
+# Build a separate product.img partition
+BOARD_USES_PRODUCTIMAGE := true
+BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE := ext4
+BOARD_PRODUCTIMAGE_PARTITION_SIZE := 1342177280 # 1.25GB
+TARGET_COPY_OUT_PRODUCT := product
+
+ifeq ($(TARGET_BUILD_SYSTEM_ROOT_IMAGE),true)
 BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
 endif
 BOARD_USES_GENERIC_AUDIO := false
@@ -40,8 +49,8 @@
 # The compiler will occasionally generate movaps, etc.
 BOARD_MALLOC_ALIGNMENT := 16
 
-# System partition size: 3.0G
-BOARD_SYSTEMIMAGE_PARTITION_SIZE := 3221225472
+# System partition size: 1.75G
+BOARD_SYSTEMIMAGE_PARTITION_SIZE := 1879048192
 # Make the userdata partition 4G to accomodate ASAN and CTS
 BOARD_USERDATAIMAGE_PARTITION_SIZE := 4294967296
 
@@ -98,6 +107,9 @@
 VSOC_LIBCXX_STATIC := libc++_static
 VSOC_PROTOBUF_SHARED_LIB := libprotobuf-cpp-full
 
+CUTTLEFISH_LIBRIL_NAME := libril-cuttlefish-fork
+ENABLE_CUTTLEFISH_RILD := true
+
 # TODO(ender): Remove all these once we stop depending on GCE code.
 GCE_VERSION_CFLAGS := -DGCE_PLATFORM_SDK_VERSION=${PLATFORM_SDK_VERSION}
 GCE_STLPORT_INCLUDES := $(VSOC_STLPORT_INCLUDES)
@@ -128,3 +140,11 @@
 
 # TODO(b/73078796): remove
 BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true
+
+TARGET_NO_RECOVERY ?= true
+TARGET_RECOVERY_PIXEL_FORMAT := ABGR_8888
+ifeq ($(TARGET_BUILD_SYSTEM_ROOT_IMAGE),true)
+TARGET_RECOVERY_FSTAB := device/google/cuttlefish/shared/config/fstab.dtb
+else
+TARGET_RECOVERY_FSTAB := device/google/cuttlefish/shared/config/fstab.initrd
+endif
diff --git a/shared/auto/device.mk b/shared/auto/device.mk
index 15325b1..b2ef588 100644
--- a/shared/auto/device.mk
+++ b/shared/auto/device.mk
@@ -53,14 +53,9 @@
 
 PRODUCT_PROPERTY_OVERRIDES += \
     keyguard.no_require_sim=true \
-    rild.libpath=libvsoc-ril.so \
     ro.cdma.home.operator.alpha=Android \
     ro.cdma.home.operator.numeric=302780 \
-    ro.gsm.home.operator.alpha=Android \
-    ro.gsm.home.operator.numeric=302780 \
-    gsm.sim.operator.numeric=302780 \
-    gsm.sim.operator.alpha=Android \
-    gsm.sim.operator.iso-country=us
+    vendor.rild.libpath=libcuttlefish-ril.so \
 
 # vehicle HAL
 PRODUCT_PACKAGES += android.hardware.automotive.vehicle@2.0-service
@@ -85,7 +80,7 @@
     PhoneService \
     Telecom \
     TeleService \
-    libvsoc-ril \
+    libcuttlefish-ril \
     rild \
 
 # DRM Properities
diff --git a/shared/config/Android.bp b/shared/config/Android.bp
new file mode 100644
index 0000000..85017af
--- /dev/null
+++ b/shared/config/Android.bp
@@ -0,0 +1,21 @@
+//
+// Copyright (C) 2019 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.
+
+cc_library_headers {
+    name: "cuttlefish_shared_config",
+    vendor: true,
+    export_include_dirs: ["."],
+    host_supported: true,
+}
diff --git a/shared/config/Android.mk b/shared/config/Android.mk
index 9a75f3f..744be8f 100644
--- a/shared/config/Android.mk
+++ b/shared/config/Android.mk
@@ -38,6 +38,10 @@
 
 include $(CLEAR_VARS)
 
+# This file is deprecated and is kept round for host tools compatibility with
+# older target filesystem images. It is not necessary to pass a .dtb blob
+# through to QEMU any more.
+
 LOCAL_MODULE := initrd_root_dtb
 LOCAL_MODULE_CLASS := ETC
 LOCAL_MODULE_PATH := $(HOST_OUT)/config
@@ -55,3 +59,13 @@
 LOCAL_SRC_FILES := system-root.dtb
 
 include $(BUILD_PREBUILT)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gsi_fstab
+LOCAL_MODULE_CLASS := ETC
+LOCAL_MODULE_PATH := $(HOST_OUT)/config
+LOCAL_MODULE_STEM := gsi.fstab
+LOCAL_SRC_FILES := gsi.fstab
+
+include $(BUILD_PREBUILT)
diff --git a/shared/config/audio_policy.conf b/shared/config/audio_policy.conf
new file mode 100644
index 0000000..2cbf118
--- /dev/null
+++ b/shared/config/audio_policy.conf
@@ -0,0 +1,64 @@
+#
+# Audio policy configuration for generic device builds (cuttlefish audio HAL)
+#
+
+# Global configuration section: lists input and output devices always present on the device
+# as well as the output device selected by default.
+# Devices are designated by a string that corresponds to the enum in audio.h
+
+global_configuration {
+  attached_output_devices AUDIO_DEVICE_OUT_SPEAKER
+  default_output_device AUDIO_DEVICE_OUT_SPEAKER
+  attached_input_devices AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_REMOTE_SUBMIX
+}
+
+# audio hardware module section: contains descriptors for all audio hw modules present on the
+# device. Each hw module node is named after the corresponding hw module library base name.
+# For instance, "primary" corresponds to audio.primary.<device>.so.
+# The "primary" module is mandatory and must include at least one output with
+# AUDIO_OUTPUT_FLAG_PRIMARY flag.
+# Each module descriptor contains one or more output profile descriptors and zero or more
+# input profile descriptors. Each profile lists all the parameters supported by a given output
+# or input stream category.
+# The "channel_masks", "formats", "devices" and "flags" are specified using strings corresponding
+# to enums in audio.h and audio_policy.h. They are concatenated by use of "|" without space or "\n".
+
+audio_hw_modules {
+  primary {
+    outputs {
+      primary {
+        sampling_rates 8000|11025|16000|22050|24000|44100|48000
+        channel_masks AUDIO_CHANNEL_OUT_MONO|AUDIO_CHANNEL_OUT_STEREO
+        formats AUDIO_FORMAT_PCM_16_BIT
+        devices AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_WIRED_HEADPHONE|AUDIO_DEVICE_OUT_WIRED_HEADSET
+        flags AUDIO_OUTPUT_FLAG_PRIMARY
+      }
+    }
+    inputs {
+      primary {
+        sampling_rates 8000|11025|16000|22050|44100|48000
+        channel_masks AUDIO_CHANNEL_IN_MONO|AUDIO_CHANNEL_IN_STEREO
+        formats AUDIO_FORMAT_PCM_16_BIT
+        devices AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_WIRED_HEADSET
+      }
+    }
+  }
+  r_submix {
+    outputs {
+      submix {
+        sampling_rates 48000
+        channel_masks AUDIO_CHANNEL_OUT_STEREO
+        formats AUDIO_FORMAT_PCM_16_BIT
+        devices AUDIO_DEVICE_OUT_REMOTE_SUBMIX
+      }
+    }
+    inputs {
+      submix {
+        sampling_rates 48000
+        channel_masks AUDIO_CHANNEL_IN_STEREO
+        formats AUDIO_FORMAT_PCM_16_BIT
+        devices AUDIO_DEVICE_IN_REMOTE_SUBMIX
+      }
+    }
+  }
+}
diff --git a/shared/config/audio_policy_configuration.xml b/shared/config/audio_policy_configuration.xml
deleted file mode 100644
index dcc7466..0000000
--- a/shared/config/audio_policy_configuration.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<!--
-/*
-** Copyright 2017, 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.
-*/
--->
-
-<audioPolicyConfiguration version="1.0" xmlns:xi="http://www.w3.org/2001/XInclude">
-    <!-- version section contains a “version” tag in the form “major.minor” e.g version=”1.0” -->
-
-    <!-- Global configuration Decalaration -->
-    <globalConfiguration speaker_drc_enabled="false"/>
-
-    <modules>
-        <!-- Primary Audio HAL -->
-        <module name="primary" halVersion="2.0">
-            <attachedDevices>
-                <item>Speaker</item>
-                <item>Built-In Mic</item>
-            </attachedDevices>
-            <defaultOutputDevice>Speaker</defaultOutputDevice>
-            <mixPorts>
-                <mixPort name="primary output" role="source" flags="AUDIO_OUTPUT_FLAG_PRIMARY">
-                    <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
-                             samplingRates="44100,48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
-                </mixPort>
-                <mixPort name="primary input" role="sink">
-                    <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
-                             samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
-                             channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO"/>
-                </mixPort>
-           </mixPorts>
-           <devicePorts>
-                <devicePort tagName="Speaker" type="AUDIO_DEVICE_OUT_SPEAKER" role="sink">
-                </devicePort>
-
-                <devicePort tagName="Built-In Mic" type="AUDIO_DEVICE_IN_BUILTIN_MIC" role="source">
-                </devicePort>
-            </devicePorts>
-            <routes>
-                <route type="mix" sink="Speaker"
-                       sources="primary output"/>
-                <route type="mix" sink="primary input"
-                       sources="Built-In Mic"/>
-            </routes>
-        </module>
-
-        <!-- Remote Submix Audio HAL -->
-        <xi:include href="r_submix_audio_policy_configuration.xml"/>
-
-    </modules>
-    <!-- End of Modules section -->
-
-    <!-- Volume section -->
-
-    <xi:include href="audio_policy_volumes.xml"/>
-    <xi:include href="default_volume_tables.xml"/>
-
-    <!-- End of Volume section -->
-
-</audioPolicyConfiguration>
diff --git a/shared/config/fstab.dtb b/shared/config/fstab.dtb
new file mode 100644
index 0000000..a601807
--- /dev/null
+++ b/shared/config/fstab.dtb
@@ -0,0 +1,5 @@
+/dev/block/vdb /data ext4 nodev,noatime,nosuid,errors=panic wait,fileencryption=aes-256-xts:aes-256-cts
+/dev/block/vdc /cache ext4 nodev,noatime,nosuid,errors=panic wait
+/dev/block/vde /metadata ext4 nodev,noatime,nosuid,errors=panic wait,formattable
+/dev/block/zram0 none swap defaults zramsize=75%
+/tmp /sdcard none defaults,bind recoveryonly
diff --git a/shared/config/fstab.initrd b/shared/config/fstab.initrd
new file mode 100644
index 0000000..08798dd
--- /dev/null
+++ b/shared/config/fstab.initrd
@@ -0,0 +1,8 @@
+/dev/block/vda /system ext4 noatime,ro,errors=panic wait
+/dev/block/vdb /data ext4 nodev,noatime,nosuid,errors=panic wait,fileencryption=aes-256-xts:aes-256-cts
+/dev/block/vdc /cache ext4 nodev,noatime,nosuid,errors=panic wait
+/dev/block/vdd /vendor ext4 noatime,ro,errors=panic wait
+/dev/block/vde /metadata ext4 nodev,noatime,nosuid,errors=panic wait,formattable
+/dev/block/vdf /product ext4 noatime,ro,errors=panic wait
+/dev/block/zram0 none swap defaults zramsize=75%
+/tmp /sdcard none defaults,bind recoveryonly
diff --git a/shared/config/fstab.vsoc b/shared/config/fstab.vsoc
deleted file mode 100644
index e399082..0000000
--- a/shared/config/fstab.vsoc
+++ /dev/null
@@ -1,3 +0,0 @@
-/dev/block/vdb /data ext4 nodev,noatime,nosuid,errors=panic wait
-/dev/block/vdc /cache ext4 nodev,noatime,nosuid,errors=panic wait
-/dev/block/zram0 none swap defaults zramsize=75%
diff --git a/shared/config/gsi.fstab b/shared/config/gsi.fstab
new file mode 100644
index 0000000..4e3f31a
--- /dev/null
+++ b/shared/config/gsi.fstab
@@ -0,0 +1,2 @@
+/dev/block/vdd /vendor ext4 noatime,ro,errors=panic wait
+/dev/block/vdf /product ext4 noatime,ro,errors=panic wait
diff --git a/shared/config/init.vsoc.rc b/shared/config/init.common.rc
similarity index 67%
rename from shared/config/init.vsoc.rc
rename to shared/config/init.common.rc
index d8b1769..423cd05 100644
--- a/shared/config/init.vsoc.rc
+++ b/shared/config/init.common.rc
@@ -9,27 +9,11 @@
 
     mount debugfs debugfs /sys/kernel/debug
     chmod 0755 /sys/kernel/debug
-    setprop service.adb.tcp.port 5555
     setprop ro.sf.lcd_density ${ro.boot.lcd_density}
     setprop ro.setupwizard.mode ${ro.boot.setupwizard_mode}
 
-    # Disable the rootcanal test console, as it violates selinux policy
-    setprop bt.rootcanal_test_console off
 
 on init
-    chown system root /dev/input_events
-    chmod 0660 /dev/input_events
-    restorecon /dev/input_events
-    chown radio root /dev/ril
-    chmod 0660 /dev/ril
-    restorecon /dev/ril
-    chown audioserver root /dev/audio_data
-    chmod 0660 /dev/audio_data
-    restorecon /dev/audio_data
-    chown system root /dev/screen
-    chmod 0660 /dev/screen
-    restorecon /dev/screen
-
     # ZRAM setup
     write /sys/block/zram0/comp_algorithm lz4
 
@@ -56,17 +40,16 @@
     chmod 0664 /sys/kernel/debug/ieee80211/phy0/hwsim/ps
     chmod 0664 /sys/kernel/debug/ieee80211/phy1/rc/fixed_rate_idx
 
-    chmod 0755 /system/bin/dhcpcd_wlan0
-
+on post-fs
+    # Set netd memlock rlimit to 8MB b/119279144
+    setrlimit 8 8388608 8388608
 
 on post-fs-data
-    start vsoc_guest_region_e2e_test
-    start gce_fs_monitor
     start vport_trigger
 
 
-on early-boot
-    start vsoc_input_service
+on late-fs
+    write /dev/kmsg "GUEST_BUILD_FINGERPRINT: ${ro.build.fingerprint}"
 
 
 on boot
@@ -74,7 +57,7 @@
     mkdir /data/vendor/wifi 0770 wifi wifi
     mkdir /data/vendor/wifi/wpa 0770 wifi wifi
     mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi
-    start socket_forward_proxy
+    start socket_vsock_proxy
 
 
 service setup_wifi /vendor/bin/setup_wifi
@@ -97,18 +80,7 @@
     swapon_all /vendor/etc/fstab.${ro.hardware}
 
 
-service vsoc_guest_region_e2e_test /vendor/bin/vsoc_guest_region_e2e_test
-    user root
-    group shell
-    oneshot
-
-
-service vsoc_input_service /vendor/bin/vsoc_input_service
-    group root uhid
-    oneshot
-
-
-service socket_forward_proxy /vendor/bin/socket_forward_proxy
+service socket_vsock_proxy /vendor/bin/socket_vsock_proxy -tcp_port=5555 -vsock_port=6520
 
 
 service vport_trigger /vendor/bin/vport_trigger
@@ -120,17 +92,22 @@
     enable seriallogging
 
 
-on property:vendor.ser.cf-gadget-usb-v1=*
-    symlink ${vendor.ser.cf-gadget-usb-v1} /dev/cf-gadget-usb-v1
-    enable usbforward
-
-
 service seriallogging /system/bin/logcat -b all -v threadtime -f /dev/cf-logcat *:V
     class main
     user root
     disabled
 
 
+on property:ro.boot.vsock_logcat_port=*
+   enable vsock_logcat
+
+
+service vsock_logcat /vendor/bin/vsock_logcat
+    class main
+    user root
+    disabled
+
+
 service wpa_supplicant /vendor/bin/hw/wpa_supplicant -g@android:wpa_wlan0
     interface android.hardware.wifi.supplicant@1.0::ISupplicant default
     interface android.hardware.wifi.supplicant@1.1::ISupplicant default
@@ -140,18 +117,6 @@
     oneshot
 
 
-service gce_fs_monitor /vendor/bin/gce_fs_monitor
-    class late_start
-    disabled
-    oneshot
-
-
-service usbforward /vendor/bin/usbforward /dev/cf-gadget-usb-v1
-    class late_start
-    user root
-    disabled
-
-
 service bugreport /system/bin/dumpstate -d -p -B -z -o /sdcard/bugreport
     class main
     disabled
diff --git a/shared/config/init.cutf_cvm.rc b/shared/config/init.cutf_cvm.rc
new file mode 100644
index 0000000..3596d0a
--- /dev/null
+++ b/shared/config/init.cutf_cvm.rc
@@ -0,0 +1,7 @@
+# This file should contain entries specific to crosvm only, for common entries
+# use common file instead.
+import /vendor/etc/init/hw/init.common.rc
+
+# TODO add crosvm specific stuff here
+# logcat and kernel logs on vsockets instead of serial port would be good
+# examples
\ No newline at end of file
diff --git a/shared/config/init.cutf_ivsh.rc b/shared/config/init.cutf_ivsh.rc
new file mode 100644
index 0000000..1ad69b6
--- /dev/null
+++ b/shared/config/init.cutf_ivsh.rc
@@ -0,0 +1,54 @@
+# This file should contain entries specific to the vsoc hardware only, for
+# common entries use common file instead.
+import /vendor/etc/init/hw/init.common.rc
+
+on init
+    chown system root /dev/input_events
+    chmod 0660 /dev/input_events
+    restorecon /dev/input_events
+    chown radio root /dev/ril
+    chmod 0660 /dev/ril
+    restorecon /dev/ril
+    chown audioserver root /dev/audio_data
+    chmod 0660 /dev/audio_data
+    restorecon /dev/audio_data
+    chown system root /dev/screen
+    chmod 0660 /dev/screen
+    restorecon /dev/screen
+
+
+on early-boot
+    start vsoc_input_service
+
+
+on boot
+    start socket_forward_proxy
+
+
+on boot && property:ro.boot.vsoc_e2e_test=1
+    mkdir /data/vendor/cf-tmp
+    start vsoc_guest_region_e2e_test
+
+
+service vsoc_guest_region_e2e_test /vendor/bin/vsoc_guest_region_e2e_test /data/vendor/cf-tmp
+    user root
+    oneshot
+
+
+service vsoc_input_service /vendor/bin/vsoc_input_service
+    group root uhid
+    oneshot
+
+
+service socket_forward_proxy /vendor/bin/socket_forward_proxy
+
+
+on property:vendor.ser.cf-gadget-usb-v1=*
+    symlink ${vendor.ser.cf-gadget-usb-v1} /dev/cf-gadget-usb-v1
+    enable usbforward
+
+
+service usbforward /vendor/bin/usbforward /dev/cf-gadget-usb-v1
+    class late_start
+    user root
+    disabled
diff --git a/shared/config/init.recovery.common.rc b/shared/config/init.recovery.common.rc
new file mode 100644
index 0000000..1a0280d
--- /dev/null
+++ b/shared/config/init.recovery.common.rc
@@ -0,0 +1,17 @@
+service socket_vsock_proxy /vendor/bin/socket_vsock_proxy -tcp_port=5555 -vsock_port=6520
+    seclabel u:r:socket_vsock_proxy:s0
+
+service console /system/bin/sh
+    class core
+    console
+    disabled
+    user root
+    group shell log readproc
+    seclabel u:r:shell:s0
+    setenv HOSTNAME console
+
+on boot
+    start socket_vsock_proxy
+
+on property:ro.debuggable=1
+    start console
diff --git a/shared/config/init.recovery.cutf_cvm.rc b/shared/config/init.recovery.cutf_cvm.rc
new file mode 100644
index 0000000..0da79f0
--- /dev/null
+++ b/shared/config/init.recovery.cutf_cvm.rc
@@ -0,0 +1,3 @@
+# This file should contain entries specific to crosvm only, for common entries
+# use common file instead.
+import /init.recovery.common.rc
diff --git a/shared/config/init.recovery.cutf_ivsh.rc b/shared/config/init.recovery.cutf_ivsh.rc
new file mode 100644
index 0000000..de48973
--- /dev/null
+++ b/shared/config/init.recovery.cutf_ivsh.rc
@@ -0,0 +1,3 @@
+# This file should contain entries specific to the vsoc hardware only, for
+# common entries use common file instead.
+import /init.recovery.common.rc
diff --git a/shared/config/initrd-root.dtb b/shared/config/initrd-root.dtb
index 1c75cd6..7962e1b 100644
--- a/shared/config/initrd-root.dtb
+++ b/shared/config/initrd-root.dtb
Binary files differ
diff --git a/shared/config/initrd-root.dts b/shared/config/initrd-root.dts
index 70a34fc..cb9e5ec 100644
--- a/shared/config/initrd-root.dts
+++ b/shared/config/initrd-root.dts
@@ -37,6 +37,14 @@
 					mnt_flags = "noatime,ro,errors=panic";
 					fsmgr_flags = "wait";
 				};
+
+				product {
+					compatible = "android,product";
+					dev = "/dev/block/vdf";
+					type = "ext4";
+					mnt_flags = "noatime,ro,errors=panic";
+					fsmgr_flags = "wait";
+				};
 			};
 		};
 	};
diff --git a/shared/config/media_codecs.xml b/shared/config/media_codecs.xml
index dbca92f..b6088e8 100644
--- a/shared/config/media_codecs.xml
+++ b/shared/config/media_codecs.xml
@@ -81,6 +81,10 @@
 -->
 
 <MediaCodecs>
+    <Settings>
+        <Setting name="max-video-encoder-input-buffers" value="12" />
+    </Settings>
+
     <Include href="media_codecs_google_audio.xml" />
     <Include href="media_codecs_google_telephony.xml" />
     <Include href="media_codecs_google_video.xml" />
diff --git a/shared/config/media_codecs_google_video.xml b/shared/config/media_codecs_google_video.xml
new file mode 100644
index 0000000..1dbd13d
--- /dev/null
+++ b/shared/config/media_codecs_google_video.xml
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!-- Copyright (C) 2014 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.
+-->
+
+<Included>
+    <Decoders>
+        <MediaCodec name="OMX.google.mpeg4.decoder" type="video/mp4v-es">
+            <!-- profiles and levels:  ProfileSimple : Level3 -->
+            <Limit name="size" min="2x2" max="352x288" />
+            <Limit name="alignment" value="2x2" />
+            <Limit name="block-size" value="16x16" />
+            <Limit name="blocks-per-second" range="12-11880" />
+            <Limit name="bitrate" range="1-384000" />
+            <Feature name="adaptive-playback" />
+        </MediaCodec>
+        <MediaCodec name="OMX.google.h263.decoder" type="video/3gpp">
+            <!-- profiles and levels:  ProfileBaseline : Level30, ProfileBaseline : Level45
+                    ProfileISWV2 : Level30, ProfileISWV2 : Level45 -->
+            <Limit name="size" min="2x2" max="352x288" />
+            <Limit name="alignment" value="2x2" />
+            <Limit name="bitrate" range="1-384000" />
+            <Feature name="adaptive-playback" />
+        </MediaCodec>
+        <MediaCodec name="OMX.google.h264.decoder" type="video/avc">
+            <!-- profiles and levels:  ProfileHigh : Level41 -->
+            <Limit name="size" min="16x16" max="1920x1088" />
+            <Limit name="alignment" value="2x2" />
+            <Limit name="block-size" value="16x16" />
+            <Limit name="blocks-per-second" range="1-244800" />
+            <Limit name="bitrate" range="1-12000000" />
+            <Feature name="adaptive-playback" />
+        </MediaCodec>
+        <MediaCodec name="OMX.google.hevc.decoder" type="video/hevc">
+            <!-- profiles and levels:  ProfileMain : MainTierLevel51 -->
+            <Limit name="size" min="2x2" max="2048x2048" />
+            <Limit name="alignment" value="2x2" />
+            <Limit name="block-size" value="8x8" />
+            <Limit name="block-count" range="1-139264" />
+            <Limit name="blocks-per-second" range="1-2000000" />
+            <Limit name="bitrate" range="1-10000000" />
+            <Feature name="adaptive-playback" />
+        </MediaCodec>
+        <MediaCodec name="OMX.google.vp8.decoder" type="video/x-vnd.on2.vp8">
+            <Limit name="size" min="2x2" max="2048x2048" />
+            <Limit name="alignment" value="2x2" />
+            <Limit name="block-size" value="16x16" />
+            <Limit name="blocks-per-second" range="1-1000000" />
+            <Limit name="bitrate" range="1-40000000" />
+            <Feature name="adaptive-playback" />
+        </MediaCodec>
+        <MediaCodec name="OMX.google.vp9.decoder" type="video/x-vnd.on2.vp9">
+            <Limit name="size" min="2x2" max="2048x2048" />
+            <Limit name="alignment" value="2x2" />
+            <Limit name="block-size" value="16x16" />
+            <Limit name="blocks-per-second" range="1-500000" />
+            <Limit name="bitrate" range="1-40000000" />
+            <Feature name="adaptive-playback" />
+        </MediaCodec>
+    </Decoders>
+
+    <Encoders>
+        <MediaCodec name="OMX.google.h263.encoder" type="video/3gpp">
+            <!-- profiles and levels:  ProfileBaseline : Level45 -->
+            <Limit name="size" min="176x144" max="176x144" />
+            <Limit name="alignment" value="16x16" />
+            <Limit name="bitrate" range="1-128000" />
+        </MediaCodec>
+        <MediaCodec name="OMX.google.h264.encoder" type="video/avc">
+            <!-- profiles and levels:  ProfileBaseline : Level41 -->
+            <Limit name="size" min="16x16" max="1920x1088" />
+            <Limit name="alignment" value="2x2" />
+            <Limit name="block-size" value="16x16" />
+            <Limit name="blocks-per-second" range="1-244800" />
+            <!-- Changed range from 12000000 to 20000000 for b/31648354 -->
+            <Limit name="bitrate" range="1-20000000" />
+            <Feature name="intra-refresh" />
+        </MediaCodec>
+        <MediaCodec name="OMX.google.mpeg4.encoder" type="video/mp4v-es">
+            <!-- profiles and levels:  ProfileCore : Level2 -->
+            <Limit name="size" min="16x16" max="176x144" />
+            <Limit name="alignment" value="16x16" />
+            <Limit name="block-size" value="16x16" />
+            <Limit name="blocks-per-second" range="12-1485" />
+            <Limit name="bitrate" range="1-64000" />
+        </MediaCodec>
+        <MediaCodec name="OMX.google.vp8.encoder" type="video/x-vnd.on2.vp8">
+            <!-- profiles and levels:  ProfileMain : Level_Version0-3 -->
+            <Limit name="size" min="2x2" max="2048x2048" />
+            <Limit name="alignment" value="2x2" />
+            <Limit name="bitrate" range="1-40000000" />
+            <Feature name="bitrate-modes" value="VBR,CBR" />
+        </MediaCodec>
+    </Encoders>
+</Included>
diff --git a/shared/config/media_codecs_performance.xml b/shared/config/media_codecs_performance.xml
index 10cac83..0880224 100644
--- a/shared/config/media_codecs_performance.xml
+++ b/shared/config/media_codecs_performance.xml
@@ -45,45 +45,85 @@
 
 <MediaCodecs>
     <Encoders>
-        <MediaCodec name="OMX.google.h264.encoder" type="video/avc" update="true">
-            <Limit name="measured-frame-rate-320x240" range="694-2414" />
-        </MediaCodec>
         <MediaCodec name="OMX.google.h263.encoder" type="video/3gpp" update="true">
-            <Limit name="measured-frame-rate-176x144" range="1140-3967" />
+            <!-- 3 runs, min 849 max 1008 gmean 943 -->
+            <Limit name="measured-frame-rate-176x144" range="849-1008" />
+        </MediaCodec>
+        <MediaCodec name="OMX.google.h264.encoder" type="video/avc" update="true">
+            <!-- 3 runs, min 496 max 629 gmean 565 -->
+            <Limit name="measured-frame-rate-320x240" range="496-629" />
+            <!-- 2 runs, min 197 max 203 gmean 201 -->
+            <Limit name="measured-frame-rate-720x480" range="197-203" />
+            <!-- 2 runs, min 93 max 97 gmean 95 -->
+            <Limit name="measured-frame-rate-1280x720" range="93-97" />
+            <!-- 2 runs, min 45 max 47 gmean 46 -->
+            <Limit name="measured-frame-rate-1920x1080" range="45-47" />
         </MediaCodec>
         <MediaCodec name="OMX.google.mpeg4.encoder" type="video/mp4v-es" update="true">
-            <Limit name="measured-frame-rate-176x144" range="1493-5192" />
+            <!-- 3 runs, min 881 max 1142 gmean 994 -->
+            <Limit name="measured-frame-rate-176x144" range="881-1142" />
         </MediaCodec>
         <MediaCodec name="OMX.google.vp8.encoder" type="video/x-vnd.on2.vp8" update="true">
-            <Limit name="measured-frame-rate-1280x720" range="105-364" />
-            <Limit name="measured-frame-rate-1920x1080" range="49-172" />
+            <!-- 3 runs, min 249 max 285 gmean 264 -->
+            <Limit name="measured-frame-rate-320x180" range="249-285" />
+            <!-- 3 runs, min 104 max 115 gmean 109 -->
+            <Limit name="measured-frame-rate-640x360" range="104-115" />
+            <!-- 3 runs, min 34 max 35 gmean 34 -->
+            <Limit name="measured-frame-rate-1280x720" range="34-35" />
+            <!-- 3 runs, min 26 max 29 gmean 27 -->
+            <Limit name="measured-frame-rate-1920x1080" range="26-29" />
         </MediaCodec>
     </Encoders>
     <Decoders>
-        <MediaCodec name="OMX.google.h264.decoder" type="video/avc" update="true">
-            <Limit name="measured-frame-rate-320x240" range="4353-15114" />
-        </MediaCodec>
         <MediaCodec name="OMX.google.h263.decoder" type="video/3gpp" update="true">
-            <Limit name="measured-frame-rate-176x144" range="4061-14126" />
+            <!-- 3 runs, min 1246 max 1390 gmean 1342 -->
+            <Limit name="measured-frame-rate-176x144" range="1246-1390" />
+        </MediaCodec>
+        <MediaCodec name="OMX.google.h264.decoder" type="video/avc" update="true">
+            <!-- 5 runs, min 299 max 629 gmean 567 -->
+            <Limit name="measured-frame-rate-320x240" range="299-629" />
+            <!-- 4 runs, min 215 max 250 gmean 232 -->
+            <Limit name="measured-frame-rate-720x480" range="215-250" />
+            <!-- 4 runs, min 75 max 85 gmean 78 -->
+            <Limit name="measured-frame-rate-1280x720" range="75-85" />
+            <!-- 4 runs, min 31 max 34 gmean 33 -->
+            <Limit name="measured-frame-rate-1920x1080" range="31-34" />
         </MediaCodec>
         <MediaCodec name="OMX.google.hevc.decoder" type="video/hevc" update="true">
-          <Limit name="measured-frame-rate-352x288" range="1000-4000" />
-          <Limit name="measured-frame-rate-720x480" range="500-2000" />
-          <Limit name="measured-frame-rate-1280x720" range="100-1000" />
-          <Limit name="measured-frame-rate-1920x1080" range="50-700" />
+            <!-- 4 runs, min 754 max 817 gmean 775 -->
+            <Limit name="measured-frame-rate-352x288" range="754-817" />
+            <!-- 4 runs, min 323 max 394 gmean 373 -->
+            <Limit name="measured-frame-rate-640x360" range="323-394" />
+            <!-- 4 runs, min 349 max 372 gmean 358 -->
+            <Limit name="measured-frame-rate-720x480" range="349-372" />
+            <!-- 4 runs, min 144 max 157 gmean 151 -->
+            <Limit name="measured-frame-rate-1280x720" range="144-157" />
+            <!-- 4 runs, min 74 max 85 gmean 80 -->
+            <Limit name="measured-frame-rate-1920x1080" range="74-85" />
         </MediaCodec>
         <MediaCodec name="OMX.google.mpeg4.decoder" type="video/mp4v-es" update="true">
-            <Limit name="measured-frame-rate-176x144" range="3729-12970" />
+            <!-- 4 runs, min 1439 max 1625 gmean 1523 -->
+            <Limit name="measured-frame-rate-176x144" range="1439-1625" />
         </MediaCodec>
         <MediaCodec name="OMX.google.vp8.decoder" type="video/x-vnd.on2.vp8" update="true">
-            <Limit name="measured-frame-rate-1280x720" range="645-2245" />
-            <Limit name="measured-frame-rate-1920x1080" range="263-915" />
+            <!-- 3 runs, min 1129 max 1261 gmean 1190 -->
+            <Limit name="measured-frame-rate-320x180" range="1129-1261" />
+            <!-- 3 runs, min 471 max 525 gmean 504 -->
+            <Limit name="measured-frame-rate-640x360" range="471-525" />
+            <!-- 3 runs, min 126 max 145 gmean 132 -->
+            <Limit name="measured-frame-rate-1280x720" range="126-145" />
+            <!-- 3 runs, min 48 max 51 gmean 49 -->
+            <Limit name="measured-frame-rate-1920x1080" range="48-51" />
         </MediaCodec>
         <MediaCodec name="OMX.google.vp9.decoder" type="video/x-vnd.on2.vp9" update="true">
-            <Limit name="measured-frame-rate-320x240" range="645-2245" />
-            <Limit name="measured-frame-rate-640x360" range="500-3000" />
-            <Limit name="measured-frame-rate-1280x720" range="350-1500" />
-            <Limit name="measured-frame-rate-1920x1080" range="150-1000" />
+            <!-- 2 runs, min 968 max 1101 gmean 1044 -->
+            <Limit name="measured-frame-rate-320x180" range="968-1101" />
+            <!-- 3 runs, min 291 max 338 gmean 319 -->
+            <Limit name="measured-frame-rate-640x360" range="291-338" />
+            <!-- Those values are from buildbots -->
+            <Limit name="measured-frame-rate-1280x720" range="280-400" />
+            <!-- Buildbot gets ~180 if it is in the first run, ~230 if it is the second run -->
+            <Limit name="measured-frame-rate-1920x1080" range="178-240" />
         </MediaCodec>
     </Decoders>
 </MediaCodecs>
diff --git a/shared/config/media_profiles.xml b/shared/config/media_profiles.xml
index 289cb98..3b23818 100644
--- a/shared/config/media_profiles.xml
+++ b/shared/config/media_profiles.xml
@@ -81,13 +81,24 @@
 <MediaSettings>
     <!-- Each camcorder profile defines a set of predefined configuration parameters -->
     <CamcorderProfiles cameraId="0">
-
         <EncoderProfile quality="qvga" fileFormat="mp4" duration="60">
-            <Video codec="m4v"
+            <Video codec="h264"
                    bitRate="128000"
                    width="320"
                    height="240"
-                   frameRate="15" />
+                   frameRate="30" />
+            <Audio codec="amrnb"
+                   bitRate="12200"
+                   sampleRate="8000"
+                   channels="1" />
+        </EncoderProfile>
+
+        <EncoderProfile quality="720p " fileFormat="mp4" duration="60">
+            <Video codec="h264"
+                   bitRate="12000000"
+                   width="1280"
+                   height="720"
+                   frameRate="30" />
             <Audio codec="amrnb"
                    bitRate="12200"
                    sampleRate="8000"
@@ -117,11 +128,23 @@
     <CamcorderProfiles cameraId="1">
 
         <EncoderProfile quality="qvga" fileFormat="mp4" duration="60">
-            <Video codec="m4v"
+            <Video codec="h264"
                    bitRate="128000"
                    width="320"
                    height="240"
-                   frameRate="15" />
+                   frameRate="30" />
+            <Audio codec="amrnb"
+                   bitRate="12200"
+                   sampleRate="8000"
+                   channels="1" />
+        </EncoderProfile>
+
+        <EncoderProfile quality="720p" fileFormat="mp4" duration="60">
+            <Video codec="h264"
+                   bitRate="12000000"
+                   width="1280"
+                   height="720"
+                   frameRate="30" />
             <Audio codec="amrnb"
                    bitRate="12200"
                    sampleRate="8000"
@@ -327,21 +350,21 @@
          or query the capabilities of the codec at all if it is disabled
     -->
     <VideoEncoderCap name="h264" enabled="true"
-        minBitRate="64000" maxBitRate="192000"
-        minFrameWidth="176" maxFrameWidth="320"
-        minFrameHeight="144" maxFrameHeight="240"
+        minBitRate="64000" maxBitRate="12000000"
+        minFrameWidth="176" maxFrameWidth="1280"
+        minFrameHeight="144" maxFrameHeight="720"
         minFrameRate="15" maxFrameRate="30" />
 
     <VideoEncoderCap name="h263" enabled="true"
-        minBitRate="64000" maxBitRate="192000"
-        minFrameWidth="176" maxFrameWidth="320"
-        minFrameHeight="144" maxFrameHeight="240"
+        minBitRate="64000" maxBitRate="12000000"
+        minFrameWidth="176" maxFrameWidth="1280"
+        minFrameHeight="144" maxFrameHeight="720"
         minFrameRate="15" maxFrameRate="30" />
 
     <VideoEncoderCap name="m4v" enabled="true"
-        minBitRate="64000" maxBitRate="192000"
-        minFrameWidth="176" maxFrameWidth="320"
-        minFrameHeight="144" maxFrameHeight="240"
+        minBitRate="64000" maxBitRate="12000000"
+        minFrameWidth="176" maxFrameWidth="1280"
+        minFrameHeight="144" maxFrameHeight="720"
         minFrameRate="15" maxFrameRate="30" />
 
     <AudioEncoderCap name="aac" enabled="true"
diff --git a/shared/config/platform_version.h b/shared/config/platform_version.h
new file mode 100644
index 0000000..52fd218
--- /dev/null
+++ b/shared/config/platform_version.h
@@ -0,0 +1,18 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+#pragma once
+
+#define VSOC_PLATFORM_SDK_VERSION 29
diff --git a/shared/config/system-root.dtb b/shared/config/system-root.dtb
index bdffbc7..bae54d8 100644
--- a/shared/config/system-root.dtb
+++ b/shared/config/system-root.dtb
Binary files differ
diff --git a/shared/config/system-root.dts b/shared/config/system-root.dts
index d0dedbe..327a38c 100644
--- a/shared/config/system-root.dts
+++ b/shared/config/system-root.dts
@@ -29,6 +29,14 @@
 					mnt_flags = "noatime,ro,errors=panic";
 					fsmgr_flags = "wait";
 				};
+
+				product {
+					compatible = "android,product";
+					dev = "/dev/block/vdf";
+					type = "ext4";
+					mnt_flags = "noatime,ro,errors=panic";
+					fsmgr_flags = "wait";
+				};
 			};
 		};
 	};
diff --git a/shared/config/ueventd.rc b/shared/config/ueventd.rc
new file mode 100644
index 0000000..88f213e
--- /dev/null
+++ b/shared/config/ueventd.rc
@@ -0,0 +1,7 @@
+# android.permission.cts.FileSystemPermissionTest#testDevHwRandomLockedDown
+/dev/hw_random 0600 root root
+
+# virtio-gpu
+/dev/dri/card0 0660 system graphics
+/dev/dri/controlD64 0660 system graphics
+/dev/dri/renderD128 0666 system graphics
diff --git a/shared/config/ueventd.vsoc.rc b/shared/config/ueventd.vsoc.rc
deleted file mode 100644
index 4948706..0000000
--- a/shared/config/ueventd.vsoc.rc
+++ /dev/null
@@ -1,3 +0,0 @@
-/dev/dri/card0 0660 system graphics
-/dev/dri/controlD64 0660 system graphics
-/dev/dri/renderD128 0666 system graphics
diff --git a/shared/device.mk b/shared/device.mk
index e393f96..1a1c9db 100644
--- a/shared/device.mk
+++ b/shared/device.mk
@@ -14,48 +14,46 @@
 # limitations under the License.
 #
 
-PRODUCT_COPY_FILES += device/google/cuttlefish_kernel/4.4-x86_64/kernel:kernel
+PRODUCT_COPY_FILES += device/google/cuttlefish_kernel/4.14-x86_64/kernel:kernel
 
-PRODUCT_SHIPPING_API_LEVEL := 26
+PRODUCT_SHIPPING_API_LEVEL := 29
+PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS := false
 
 DISABLE_RILD_OEM_HOOK := true
 
+# Properties that are not vendor-specific. These will go in the product
+# partition, instead of the vendor partition, and do not need vendor
+# sepolicy
+PRODUCT_PRODUCT_PROPERTIES := \
+    persist.adb.tcp.port=5555 \
+    persist.traced.enable=1 \
+    persist.heapprofd.enable=1 \
+    ro.com.google.locationfeatures=1 \
+ 
 # Explanation of specific properties:
 #   debug.hwui.swap_with_damage avoids boot failure on M http://b/25152138
-#   ro.opengles.version OpenGLES 2.0
+#   ro.opengles.version OpenGLES 3.0
 PRODUCT_PROPERTY_OVERRIDES += \
     tombstoned.max_tombstone_count=500 \
+    bt.rootcanal_test_console=off \
     debug.hwui.swap_with_damage=0 \
-    ro.adb.qemud=0 \
     ro.carrier=unknown \
     ro.com.android.dataroaming=false \
-    ro.com.google.locationfeatures=1 \
     ro.hardware.virtual_device=1 \
     ro.logd.size=1M \
-    ro.opengles.version=131072 \
-    ro.ril.gprsclass=10 \
-    ro.ril.hsxpa=1 \
+    ro.opengles.version=196608 \
     wifi.interface=wlan0 \
 
 # Below is a list of properties we probably should get rid of.
 PRODUCT_PROPERTY_OVERRIDES += \
     wlan.driver.status=ok
 
-
-# Default OMX service to non-Treble
-PRODUCT_PROPERTY_OVERRIDES += \
-    persist.media.treble_omx=false
-
-# Enable Perfetto traced and heapprofd
-PRODUCT_PROPERTY_OVERRIDES += \
-    persist.traced.enable=1 \
-    persist.heapprofd.enable=1
-
 #
 # Packages for various cuttlefish-specific tests
 #
 PRODUCT_PACKAGES += \
     vsoc_guest_region_e2e_test \
+    vsoc_managed_region_e2e_test \
     vsoc_driver_test
 
 #
@@ -66,6 +64,7 @@
     dhcpcd_wlan0 \
     gce_fs_monitor \
     socket_forward_proxy \
+    socket_vsock_proxy \
     usbforward \
     VSoCService \
     wpa_supplicant.vsoc.conf \
@@ -74,6 +73,7 @@
     rename_netiface \
     ip_link_add \
     setup_wifi \
+    vsock_logcat \
 
 #
 # Packages for AOSP-available stuff we use from the framework
@@ -109,21 +109,24 @@
 # General files
 #
 PRODUCT_COPY_FILES += \
-    device/google/cuttlefish/shared/config/audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy_configuration.xml \
+    device/google/cuttlefish/shared/config/audio_policy.conf:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy.conf \
     device/google/cuttlefish/shared/config/camera_v3.json:$(TARGET_COPY_OUT_VENDOR)/etc/config/camera.json \
-    device/google/cuttlefish/shared/config/init.vsoc.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.vsoc.rc \
-    device/google/cuttlefish/shared/config/ueventd.vsoc.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/ueventd.vsoc.rc \
+    device/google/cuttlefish/shared/config/init.common.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.common.rc \
+    device/google/cuttlefish/shared/config/init.cutf_ivsh.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.cutf_ivsh.rc \
+    device/google/cuttlefish/shared/config/init.cutf_cvm.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.cutf_cvm.rc \
+    device/google/cuttlefish/shared/config/ueventd.rc:$(TARGET_COPY_OUT_VENDOR)/ueventd.rc \
     device/google/cuttlefish/shared/config/media_codecs.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs.xml \
+    device/google/cuttlefish/shared/config/media_codecs_google_video.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_video.xml \
     device/google/cuttlefish/shared/config/media_codecs_performance.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_performance.xml \
     device/google/cuttlefish/shared/config/media_profiles.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_profiles_V1_0.xml \
-    device/google/cuttlefish/shared/config/fstab.vsoc:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.vsoc \
     frameworks/av/media/libeffects/data/audio_effects.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_effects.xml \
     frameworks/av/media/libstagefright/data/media_codecs_google_audio.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_audio.xml \
     frameworks/av/media/libstagefright/data/media_codecs_google_telephony.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_telephony.xml \
-    frameworks/av/media/libstagefright/data/media_codecs_google_video.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_video.xml \
+    frameworks/av/services/audiopolicy/config/audio_policy_configuration_generic.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy_configuration.xml \
+    frameworks/av/services/audiopolicy/config/primary_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/primary_audio_policy_configuration.xml \
+    frameworks/av/services/audiopolicy/config/r_submix_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/r_submix_audio_policy_configuration.xml \
     frameworks/av/services/audiopolicy/config/audio_policy_volumes.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy_volumes.xml \
     frameworks/av/services/audiopolicy/config/default_volume_tables.xml:$(TARGET_COPY_OUT_VENDOR)/etc/default_volume_tables.xml \
-    frameworks/av/services/audiopolicy/config/r_submix_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/r_submix_audio_policy_configuration.xml \
     frameworks/native/data/etc/android.hardware.audio.low_latency.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.low_latency.xml \
     frameworks/native/data/etc/android.hardware.bluetooth_le.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth_le.xml \
     frameworks/native/data/etc/android.hardware.bluetooth.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth.xml \
@@ -136,6 +139,7 @@
     frameworks/native/data/etc/android.hardware.sensor.accelerometer.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.accelerometer.xml \
     frameworks/native/data/etc/android.hardware.sensor.barometer.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.barometer.xml \
     frameworks/native/data/etc/android.hardware.sensor.compass.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.compass.xml \
+    frameworks/native/data/etc/android.hardware.sensor.gyroscope.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.gyroscope.xml \
     frameworks/native/data/etc/android.hardware.sensor.light.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.light.xml \
     frameworks/native/data/etc/android.hardware.sensor.proximity.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.proximity.xml \
     frameworks/native/data/etc/android.hardware.touchscreen.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.touchscreen.xml \
@@ -146,10 +150,33 @@
 
 
 #
+# The fstab requires special handling. For system-as-root builds, we *must*
+# retrieve the vendor partition mount options from DTB, as system must be
+# "pristine" to support GSI. For builds with an initrd, we prefer not to
+# rely on DTB, and *must* retrieve the partition mount options from an fstab
+# in the initrd instead. (In either case, the fstab *must also* be installed to
+# /vendor/etc)
+#
+ifeq ($(TARGET_BUILD_SYSTEM_ROOT_IMAGE),true)
+PRODUCT_COPY_FILES += \
+    device/google/cuttlefish/shared/config/fstab.dtb:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.cutf_ivsh \
+    device/google/cuttlefish/shared/config/fstab.dtb:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.cutf_cvm \
+
+else
+PRODUCT_COPY_FILES += \
+    device/google/cuttlefish/shared/config/fstab.initrd:$(TARGET_COPY_OUT_RAMDISK)/fstab.cutf_ivsh \
+    device/google/cuttlefish/shared/config/fstab.initrd:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.cutf_ivsh \
+    device/google/cuttlefish/shared/config/fstab.initrd:$(TARGET_COPY_OUT_RAMDISK)/fstab.cutf_cvm \
+    device/google/cuttlefish/shared/config/fstab.initrd:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.cutf_cvm \
+
+endif
+
+
+#
 # USB Specific
 #
 PRODUCT_COPY_FILES += \
-    device/google/cuttlefish/shared/config/init.hardware.usb.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.vsoc.usb.rc
+    device/google/cuttlefish/shared/config/init.hardware.usb.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.cutf_ivsh.usb.rc
 
 # Packages for HAL implementations
 
@@ -158,7 +185,8 @@
 #
 PRODUCT_PACKAGES += \
     hwcomposer.drm_minigbm \
-    hwcomposer.vsoc \
+    hwcomposer.cutf_ivsh \
+    hwcomposer.cutf_cvm \
     hwcomposer-stats \
     android.hardware.graphics.composer@2.1-impl \
     android.hardware.graphics.composer@2.1-service
@@ -168,7 +196,7 @@
 #
 PRODUCT_PACKAGES += \
     gralloc.minigbm \
-    gralloc.vsoc \
+    gralloc.cutf \
     android.hardware.graphics.mapper@2.0-impl \
     android.hardware.graphics.allocator@2.0-impl \
     android.hardware.graphics.allocator@2.0-service
@@ -184,10 +212,12 @@
 # Audio HAL
 #
 PRODUCT_PACKAGES += \
-    audio.primary.vsoc \
-    android.hardware.audio@4.0-impl \
-    android.hardware.audio.effect@4.0-impl \
-    android.hardware.audio@2.0-service
+    audio.primary.cutf \
+    audio.r_submix.default \
+    android.hardware.audio@4.0-impl:32 \
+    android.hardware.audio.effect@4.0-impl:32 \
+    android.hardware.audio@2.0-service \
+    android.hardware.soundtrigger@2.0-impl \
 
 #
 # Drm HAL
@@ -206,8 +236,8 @@
 # Camera
 #
 PRODUCT_PACKAGES += \
-    camera.vsoc \
-    camera.vsoc.jpeg \
+    camera.cutf \
+    camera.cutf.jpeg \
     camera.device@3.2-impl \
     android.hardware.camera.provider@2.4-impl \
     android.hardware.camera.provider@2.4-service
@@ -216,7 +246,7 @@
 # Gatekeeper
 #
 PRODUCT_PACKAGES += \
-    gatekeeper.vsoc \
+    gatekeeper.cutf \
     android.hardware.gatekeeper@1.0-impl \
     android.hardware.gatekeeper@1.0-service
 
@@ -224,7 +254,7 @@
 # GPS
 #
 PRODUCT_PACKAGES += \
-    gps.vsoc \
+    gps.cutf \
     android.hardware.gnss@1.0-impl \
     android.hardware.gnss@1.0-service
 
@@ -240,7 +270,7 @@
 # Sensors
 #
 PRODUCT_PACKAGES += \
-    sensors.vsoc \
+    sensors.cutf \
     android.hardware.sensors@1.0-impl \
     android.hardware.sensors@1.0-service
 
@@ -248,7 +278,7 @@
 # Lights
 #
 PRODUCT_PACKAGES += \
-    lights.vsoc \
+    lights.cutf \
     android.hardware.light@2.0-impl \
     android.hardware.light@2.0-service
 
@@ -263,7 +293,7 @@
 # Power HAL
 #
 PRODUCT_PACKAGES += \
-    power.vsoc \
+    power.cutf \
     android.hardware.power@1.0-impl \
     android.hardware.power@1.0-service
 
@@ -299,5 +329,15 @@
 PRODUCT_COPY_FILES += \
     $(LOCAL_PATH)/wpa_supplicant_overlay.conf:$(TARGET_COPY_OUT_VENDOR)/etc/wifi/wpa_supplicant_overlay.conf
 
+# Recovery mode
+ifneq ($(TARGET_NO_RECOVERY),true)
+
+PRODUCT_COPY_FILES += \
+    device/google/cuttlefish/shared/config/init.recovery.common.rc:recovery/root/init.recovery.common.rc \
+    device/google/cuttlefish/shared/config/init.recovery.cutf_ivsh.rc:recovery/root/init.recovery.cutf_ivsh.rc \
+    device/google/cuttlefish/shared/config/init.recovery.cutf_cvm.rc:recovery/root/init.recovery.cutf_cvm.rc \
+
+endif
+
 # Host packages to install
-PRODUCT_HOST_PACKAGES += socket_forward_proxy
+PRODUCT_HOST_PACKAGES += socket_forward_proxy socket_vsock_proxy
diff --git a/shared/gsi/device.mk b/shared/gsi/device.mk
index cc0e9a4..6dfdd8e 100644
--- a/shared/gsi/device.mk
+++ b/shared/gsi/device.mk
@@ -23,20 +23,15 @@
 include device/google/cuttlefish/shared/device.mk
 PRODUCT_SHIPPING_API_LEVEL := 28
 
-CUTTLEFISH_SYSTEM_AS_ROOT := true
+TARGET_BUILD_SYSTEM_ROOT_IMAGE ?= true
 
 PRODUCT_CHARACTERISTICS := nosdcard
 
 PRODUCT_PROPERTY_OVERRIDES += \
     keyguard.no_require_sim=true \
-    vendor.rild.libpath=libvsoc-ril.so \
     ro.cdma.home.operator.alpha=Android \
     ro.cdma.home.operator.numeric=302780 \
-    ro.gsm.home.operator.alpha=Android \
-    ro.gsm.home.operator.numeric=302780 \
-    gsm.sim.operator.numeric=302780 \
-    gsm.sim.operator.alpha=Android \
-    gsm.sim.operator.iso-country=us
+    vendor.rild.libpath=libcuttlefish-ril.so \
 
 PRODUCT_PACKAGES += \
     MmsService \
@@ -44,7 +39,7 @@
     PhoneService \
     Telecom \
     TeleService \
-    libvsoc-ril \
+    libcuttlefish-ril \
     rild \
 
 PRODUCT_COPY_FILES += \
diff --git a/shared/phone/device.mk b/shared/phone/device.mk
index 1ff85c4..bffe8f2 100644
--- a/shared/phone/device.mk
+++ b/shared/phone/device.mk
@@ -20,20 +20,15 @@
 $(call inherit-product, frameworks/native/build/phone-xhdpi-2048-dalvik-heap.mk)
 $(call inherit-product, device/google/cuttlefish/shared/device.mk)
 
-CUTTLEFISH_SYSTEM_AS_ROOT := true
+TARGET_BUILD_SYSTEM_ROOT_IMAGE ?= true
 
 PRODUCT_CHARACTERISTICS := nosdcard
 
 PRODUCT_PROPERTY_OVERRIDES += \
     keyguard.no_require_sim=true \
-    rild.libpath=libvsoc-ril.so \
     ro.cdma.home.operator.alpha=Android \
     ro.cdma.home.operator.numeric=302780 \
-    ro.gsm.home.operator.alpha=Android \
-    ro.gsm.home.operator.numeric=302780 \
-    gsm.sim.operator.numeric=302780 \
-    gsm.sim.operator.alpha=Android \
-    gsm.sim.operator.iso-country=us
+    vendor.rild.libpath=libcuttlefish-ril.so \
 
 PRODUCT_PACKAGES += \
     MmsService \
@@ -41,15 +36,8 @@
     PhoneService \
     Telecom \
     TeleService \
-    libvsoc-ril \
-
-ifeq ($(PLATFORM_VERSION), $(word 1, $(sort Q $(PLATFORM_VERSION))))
-    PRODUCT_PACKAGES += \
-        libvsoc-rild
-else
-    PRODUCT_PACKAGES += \
-        rild
-endif
+    libcuttlefish-ril \
+    libcuttlefish-rild
 
 PRODUCT_COPY_FILES += \
     frameworks/native/data/etc/android.hardware.telephony.gsm.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.telephony.gsm.xml
diff --git a/shared/sepolicy/device.te b/shared/sepolicy/device.te
index 93609eb..38f0a2f 100644
--- a/shared/sepolicy/device.te
+++ b/shared/sepolicy/device.te
@@ -1,6 +1,6 @@
 # Device types
 type input_events_device, dev_type;
-type libvsoc_rild_device, dev_type;
+type libcuttlefish_rild_device, dev_type;
 type region_e2e_test_device, dev_type;
 type region_screen_device, dev_type;
 type socket_forward_device, dev_type;
diff --git a/shared/sepolicy/file_contexts b/shared/sepolicy/file_contexts
index 1290de4..fe53fd2 100644
--- a/shared/sepolicy/file_contexts
+++ b/shared/sepolicy/file_contexts
@@ -5,13 +5,14 @@
 /dev/block/vdb  u:object_r:userdata_block_device:s0
 /dev/block/vdc  u:object_r:cache_block_device:s0
 /dev/block/vdd  u:object_r:system_block_device:s0
+/dev/block/vde  u:object_r:metadata_block_device:s0
 /dev/block/zram0  u:object_r:swap_block_device:s0
 /dev/e2e_managed  u:object_r:region_e2e_test_device:s0
 /dev/e2e_manager  u:object_r:region_e2e_test_device:s0
 /dev/e2e_primary  u:object_r:region_e2e_test_device:s0
 /dev/e2e_secondary  u:object_r:region_e2e_test_device:s0
 /dev/input_events  u:object_r:input_events_device:s0
-/dev/ril  u:object_r:libvsoc_rild_device:s0
+/dev/ril  u:object_r:libcuttlefish_rild_device:s0
 /dev/screen  u:object_r:region_screen_device:s0
 /dev/socket_forward  u:object_r:socket_forward_device:s0
 /dev/vport[0-9]p[0-9]*  u:object_r:virtual_serial_device:s0
@@ -28,14 +29,15 @@
 #############################
 # Vendor files
 #
-/vendor/bin/gce_fs_monitor  u:object_r:gce_fs_monitor_exec:s0
 /vendor/bin/usbforward  u:object_r:usbforward_exec:s0
 /vendor/bin/socket_forward_proxy  u:object_r:socket_forward_proxy_exec:s0
+/vendor/bin/socket_vsock_proxy  u:object_r:socket_vsock_proxy_exec:s0
+/vendor/bin/vsock_logcat  u:object_r:vsock_logcat_exec:s0
 /vendor/bin/vsoc_input_service  u:object_r:vsoc_input_service_exec:s0
 /vendor/bin/vsoc_guest_region_e2e_test  u:object_r:vsoc_guest_region_e2e_test_exec:s0
 /vendor/bin/vport_trigger  u:object_r:vport_trigger_exec:s0
 /vendor/bin/rename_netiface  u:object_r:rename_netiface_exec:s0
-/vendor/bin/hw/libvsoc-rild  u:object_r:libvsoc_rild_exec:s0
+/vendor/bin/hw/libcuttlefish-rild  u:object_r:libcuttlefish_rild_exec:s0
 /vendor/bin/hw/android\.hardware\.power\.stats@1\.0-service\.mock  u:object_r:hal_power_stats_default_exec:s0
 /vendor/bin/hw/android\.hardware\.bluetooth@1\.0-service\.sim  u:object_r:hal_bluetooth_sim_exec:s0
 /vendor/bin/hw/android\.hardware\.dumpstate@1\.0-service\.cuttlefish  u:object_r:hal_dumpstate_impl_exec:s0
diff --git a/shared/sepolicy/gce_fs_monitor.te b/shared/sepolicy/gce_fs_monitor.te
deleted file mode 100644
index 7be3736..0000000
--- a/shared/sepolicy/gce_fs_monitor.te
+++ /dev/null
@@ -1,7 +0,0 @@
-type gce_fs_monitor, domain;
-type gce_fs_monitor_exec, exec_type, vendor_file_type, file_type;
-
-init_daemon_domain(gce_fs_monitor)
-
-# Write to kernel log (/dev/kmsg)
-allow gce_fs_monitor kmsg_device:chr_file w_file_perms;
diff --git a/shared/sepolicy/hal_bluetooth_sim.te b/shared/sepolicy/hal_bluetooth_sim.te
index fefeed1..82bab59 100644
--- a/shared/sepolicy/hal_bluetooth_sim.te
+++ b/shared/sepolicy/hal_bluetooth_sim.te
@@ -1,6 +1,9 @@
 type hal_bluetooth_sim, domain;
 type hal_bluetooth_sim_exec, exec_type, vendor_file_type, file_type;
+type hal_bluetooth_sim_prop, property_type;
 
 hal_server_domain(hal_bluetooth_sim, hal_bluetooth)
 
 init_daemon_domain(hal_bluetooth_sim)
+
+get_prop(hal_bluetooth_sim, hal_bluetooth_sim_prop)
diff --git a/shared/sepolicy/hal_graphics_composer.te b/shared/sepolicy/hal_graphics_composer.te
index 089e59d..05ea544 100644
--- a/shared/sepolicy/hal_graphics_composer.te
+++ b/shared/sepolicy/hal_graphics_composer.te
@@ -1,2 +1,7 @@
+type vsock_frames_port_prop, property_type;
+
 allow hal_graphics_composer_server hal_graphics_allocator_default_tmpfs:file read;
 allow hal_graphics_composer_server region_screen_device:chr_file rw_file_perms;
+allow hal_graphics_composer_server self:{ socket vsock_socket } create_socket_perms_no_ioctl;
+
+get_prop(hal_graphics_composer_server, vsock_frames_port_prop)
diff --git a/shared/sepolicy/libcuttlefish_rild.te b/shared/sepolicy/libcuttlefish_rild.te
new file mode 100644
index 0000000..627dd3f
--- /dev/null
+++ b/shared/sepolicy/libcuttlefish_rild.te
@@ -0,0 +1,14 @@
+type cuttlefish_ril_prop, property_type;
+type libcuttlefish_rild, domain;
+type libcuttlefish_rild_exec, exec_type, vendor_file_type, file_type;
+
+init_daemon_domain(libcuttlefish_rild)
+
+hal_server_domain(libcuttlefish_rild, hal_telephony)
+
+allow libcuttlefish_rild libcuttlefish_rild_device:chr_file rw_file_perms;
+
+# Failing to create these sockets appears to be non-fatal
+net_domain(libcuttlefish_rild)
+
+get_prop(libcuttlefish_rild, cuttlefish_ril_prop)
diff --git a/shared/sepolicy/libvsoc_rild.te b/shared/sepolicy/libvsoc_rild.te
deleted file mode 100644
index 891f4c5..0000000
--- a/shared/sepolicy/libvsoc_rild.te
+++ /dev/null
@@ -1,11 +0,0 @@
-type libvsoc_rild, domain;
-type libvsoc_rild_exec, exec_type, vendor_file_type, file_type;
-
-init_daemon_domain(libvsoc_rild)
-
-hal_server_domain(libvsoc_rild, hal_telephony)
-
-allow libvsoc_rild libvsoc_rild_device:chr_file rw_file_perms;
-
-# Failing to create these sockets appears to be non-fatal
-net_domain(libvsoc_rild)
diff --git a/shared/sepolicy/logpersist.te b/shared/sepolicy/logpersist.te
index 2a7eb4d..f7fe151 100644
--- a/shared/sepolicy/logpersist.te
+++ b/shared/sepolicy/logpersist.te
@@ -1,3 +1,5 @@
 # Output to virtual serial console. Needed because seriallogging daemon
-# runs logcat and directs its output to /dev/vport0p1.
-allow logpersist virtual_serial_device:chr_file { open getattr append };
+# runs logcat and directs its output to vportXpY or cf_logcat_pipe under
+# the /dev filesystem.
+allow logpersist device:fifo_file ra_file_perms;
+allow logpersist virtual_serial_device:chr_file ra_file_perms;
diff --git a/shared/sepolicy/property_contexts b/shared/sepolicy/property_contexts
index a0a25cf..e678330 100644
--- a/shared/sepolicy/property_contexts
+++ b/shared/sepolicy/property_contexts
@@ -1,2 +1,11 @@
+bt.rootcanal_test_console  u:object_r:hal_bluetooth_sim_prop:s0
 sys.cf.ser.  u:object_r:sys_cf_ser_prop:s0
 vendor.ser.  u:object_r:vendor_ser_prop:s0
+ro.boot.cuttlefish_ril  u:object_r:cuttlefish_ril_prop:s0
+ro.boot.vsock_frames_port  u:object_r:vsock_frames_port_prop:s0
+ro.boot.vsock_logcat_port  u:object_r:vsock_logcat_port_prop:s0
+ro.cdma.home.operator.alpha  u:object_r:vendor_init_radio_prop:s0
+ro.cdma.home.operator.numeric  u:object_r:vendor_init_radio_prop:s0
+vendor.vsock_logcat_status  u:object_r:vsock_logcat_status_prop:s0
+ro.boot.setupwizard_mode  u:object_r:cf_setupwizard_mode_prop:s0
+ro.setupwizard.mode  u:object_r:vendor_init_setupwizard_prop:s0
diff --git a/shared/sepolicy/recovery.te b/shared/sepolicy/recovery.te
new file mode 100644
index 0000000..e4677fe
--- /dev/null
+++ b/shared/sepolicy/recovery.te
@@ -0,0 +1 @@
+allow recovery gpu_device:chr_file rw_file_perms;
diff --git a/shared/sepolicy/socket_vsock_proxy.te b/shared/sepolicy/socket_vsock_proxy.te
new file mode 100644
index 0000000..eaca909
--- /dev/null
+++ b/shared/sepolicy/socket_vsock_proxy.te
@@ -0,0 +1,11 @@
+type socket_vsock_proxy, domain, netdomain;
+type socket_vsock_proxy_exec, exec_type, vendor_file_type, file_type;
+
+init_daemon_domain(socket_vsock_proxy)
+
+allow socket_vsock_proxy self:global_capability_class_set { net_admin net_raw };
+allow socket_vsock_proxy self:{ socket vsock_socket } { create read write listen accept bind };
+
+# TODO: socket returned by accept() has unlabeled context on it. Give it a
+# specific label.
+allow socket_vsock_proxy unlabeled:{ socket vsock_socket } { getopt read write shutdown };
diff --git a/shared/sepolicy/vendor_init.te b/shared/sepolicy/vendor_init.te
index 40244c2..5b29377 100644
--- a/shared/sepolicy/vendor_init.te
+++ b/shared/sepolicy/vendor_init.te
@@ -1,6 +1,20 @@
+type vendor_init_radio_prop, property_type;
+type cf_setupwizard_mode_prop, property_type;
+type vendor_init_setupwizard_prop, property_type;
+
 allow vendor_init {
   audio_device
   input_events_device
-  libvsoc_rild_device
+  libcuttlefish_rild_device
   region_screen_device
 }:chr_file { getattr };
+
+set_prop(vendor_init, hal_bluetooth_sim_prop)
+
+set_prop(vendor_init, vendor_init_radio_prop)
+
+get_prop(vendor_init, vendor_ser_prop)
+
+get_prop(vendor_init, cf_setupwizard_mode_prop)
+
+set_prop(vendor_init, vendor_init_setupwizard_prop)
diff --git a/shared/sepolicy/vsoc_guest_region_e2e_test.te b/shared/sepolicy/vsoc_guest_region_e2e_test.te
index 4cad1ae..d4ab68f 100644
--- a/shared/sepolicy/vsoc_guest_region_e2e_test.te
+++ b/shared/sepolicy/vsoc_guest_region_e2e_test.te
@@ -5,3 +5,5 @@
 
 # Access region test devices
 allow vsoc_guest_region_e2e_test region_e2e_test_device:chr_file rw_file_perms;
+allow vsoc_guest_region_e2e_test vendor_data_file:file { create_file_perms };
+allow vsoc_guest_region_e2e_test vendor_data_file:dir { create_file_perms create_dir_perms };
diff --git a/shared/sepolicy/vsock_logcat.te b/shared/sepolicy/vsock_logcat.te
new file mode 100644
index 0000000..405a362
--- /dev/null
+++ b/shared/sepolicy/vsock_logcat.te
@@ -0,0 +1,17 @@
+type vsock_logcat, domain;
+type vsock_logcat_exec, exec_type, vendor_file_type, file_type;
+type vsock_logcat_port_prop, property_type;
+type vsock_logcat_status_prop, property_type;
+
+init_daemon_domain(vsock_logcat)
+
+get_prop(vsock_logcat, vsock_logcat_port_prop)
+
+set_prop(vsock_logcat, vendor_ser_prop)
+set_prop(vsock_logcat, vsock_logcat_status_prop)
+
+allow vsock_logcat device:dir w_dir_perms;
+allow vsock_logcat device:fifo_file create_file_perms;
+allow vsock_logcat kmsg_device:chr_file write;
+allow vsock_logcat self:capability net_admin;
+allow vsock_logcat self:{ socket vsock_socket } create_socket_perms_no_ioctl;
diff --git a/shared/tablet_3g/device.mk b/shared/tablet_3g/device.mk
index b60dc0a..bb2ab68 100644
--- a/shared/tablet_3g/device.mk
+++ b/shared/tablet_3g/device.mk
@@ -24,14 +24,9 @@
 
 PRODUCT_PROPERTY_OVERRIDES += \
     keyguard.no_require_sim=true \
-    rild.libpath=libvsoc-ril.so \
     ro.cdma.home.operator.alpha=Android \
     ro.cdma.home.operator.numeric=302780 \
-    ro.gsm.home.operator.alpha=Android \
-    ro.gsm.home.operator.numeric=302780 \
-    gsm.sim.operator.numeric=302780 \
-    gsm.sim.operator.alpha=Android \
-    gsm.sim.operator.iso-country=us \
+    vendor.rild.libpath=libcuttlefish-ril.so \
 
 PRODUCT_PACKAGES += \
     MmsService \
@@ -39,7 +34,7 @@
     PhoneService \
     Telecom \
     TeleService \
-    libvsoc-ril \
+    libcuttlefish-ril \
     rild \
 
 PRODUCT_COPY_FILES += \
diff --git a/shared/tv/device.mk b/shared/tv/device.mk
index bc30379..4145a23 100644
--- a/shared/tv/device.mk
+++ b/shared/tv/device.mk
@@ -16,6 +16,6 @@
 
 DEVICE_MANIFEST_FILE += device/google/cuttlefish/shared/config/manifest.xml
 
-$(call inherit-product, $(SRC_TARGET_DIR)/product/generic_no_telephony.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/core_minimal.mk)
 $(call inherit-product, device/google/cuttlefish/shared/device.mk)
 
diff --git a/vsoc_arm/BoardConfig.mk b/vsoc_arm/BoardConfig.mk
new file mode 100644
index 0000000..e203bf5
--- /dev/null
+++ b/vsoc_arm/BoardConfig.mk
@@ -0,0 +1,29 @@
+#
+# Copyright 2017 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.
+#
+
+#
+# x86 target for Cuttlefish
+#
+
+-include device/google/cuttlefish/shared/BoardConfig.mk
+
+TARGET_BOARD_PLATFORM := vsoc_arm
+TARGET_ARCH := arm
+TARGET_ARCH_VARIANT := armv8-a
+TARGET_CPU_ABI := armeabi-v7a
+TARGET_CPU_VARIANT := cortex-a53
+
+BUILD_BROKEN_DUP_RULES := true
diff --git a/vsoc_arm/phone/device.mk b/vsoc_arm/phone/device.mk
new file mode 100644
index 0000000..6701e57
--- /dev/null
+++ b/vsoc_arm/phone/device.mk
@@ -0,0 +1,22 @@
+#
+# Copyright (C) 2017 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.
+#
+
+$(call inherit-product, device/google/cuttlefish/shared/phone/device.mk)
+
+PRODUCT_NAME := aosp_cf_arm_phone
+PRODUCT_DEVICE := vsoc_arm
+PRODUCT_MODEL := Cuttlefish arm phone
+PRODUCT_PACKAGE_OVERLAYS := device/google/cuttlefish/vsoc_arm/phone/overlay
diff --git a/vsoc_arm/phone/overlay/frameworks/base/core/res/res/values/config.xml b/vsoc_arm/phone/overlay/frameworks/base/core/res/res/values/config.xml
new file mode 100644
index 0000000..2b7dfbe
--- /dev/null
+++ b/vsoc_arm/phone/overlay/frameworks/base/core/res/res/values/config.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2017, 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.
+*/
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="networkAttributes" translatable="false">
+    <item>"mobile,0,0,0,-1,true"</item>
+    <item>"wifi,1,1,1,-1,true"</item>
+    <item>"mobile_mms,2,0,2,60000,true"</item>
+    <item>"mobile_hipri,5,0,3,60000,true"</item>
+    <item>"bluetooth,7,7,2,-1,true"</item>
+  </string-array>
+  <string-array name="radioAttributes" translatable="false">
+    <item>"0,1"</item>
+    <item>"1,1"</item>
+    <item>"4,1"</item>
+    <item>"7,1"</item>
+    <item>"11,1"</item>
+  </string-array>
+  <string-array name="config_tether_wifi_regexs" translatable="false">
+    <item>"wlan0"</item>
+  </string-array>
+  <string-array name="config_tether_apndata" translatable="false">
+    <item>Android,android,,,,,,,,310,260,,default,dun,ims</item>
+  </string-array>
+  <bool name="config_wifi_dual_band_support" translatable="false">true</bool>
+  <bool name="config_bluetooth_address_validation">true</bool>
+  <bool name="config_sms_capable">true</bool>
+  <string name="default_sms_application" translatable="false">com.android.mms</string>
+  <bool name="config_showNavigationBar">true</bool>
+  <dimen name="config_viewConfigurationTouchSlop">12dp</dimen>
+  <integer name="config_mobile_mtu">1460</integer>
+  <!-- cuttlefish uses mac80211-hwsim, which does not support Preferred
+  Network Offload feature. We disable the use of this feature here. -->
+  <bool translatable="false" name="config_wifi_background_scan_support">false</bool>
+  <!--  Maximum number of supported users -->
+  <integer name="config_multiuserMaximumUsers">4</integer>
+</resources>
diff --git a/vsoc_arm64/BoardConfig.mk b/vsoc_arm64/BoardConfig.mk
new file mode 100644
index 0000000..7bb3c5d
--- /dev/null
+++ b/vsoc_arm64/BoardConfig.mk
@@ -0,0 +1,35 @@
+#
+# Copyright 2017 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.
+#
+
+#
+# x86 target for Cuttlefish
+#
+
+-include device/google/cuttlefish/shared/BoardConfig.mk
+
+TARGET_BOARD_PLATFORM := vsoc_arm64
+TARGET_ARCH := arm64
+TARGET_ARCH_VARIANT := armv8-a
+TARGET_CPU_ABI := arm64-v8a
+TARGET_CPU_VARIANT := cortex-a53
+TARGET_2ND_ARCH := arm
+TARGET_2ND_ARCH_VARIANT := armv8-a
+TARGET_2ND_CPU_ABI := armeabi-v7a
+TARGET_2ND_CPU_ABI2 := armeabi
+TARGET_2ND_CPU_VARIANT := cortex-a53
+TARGET_TRANSLATE_2ND_ARCH := false
+
+BUILD_BROKEN_DUP_RULES := true
diff --git a/vsoc_arm64/phone/device.mk b/vsoc_arm64/phone/device.mk
new file mode 100644
index 0000000..c05d456
--- /dev/null
+++ b/vsoc_arm64/phone/device.mk
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2017 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.
+#
+
+$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
+$(call inherit-product, device/google/cuttlefish/shared/phone/device.mk)
+
+PRODUCT_NAME := aosp_cf_arm64_phone
+PRODUCT_DEVICE := vsoc_arm64
+PRODUCT_MODEL := Cuttlefish arm64 phone
+PRODUCT_PACKAGE_OVERLAYS := device/google/cuttlefish/vsoc_arm64/phone/overlay
diff --git a/vsoc_arm64/phone/overlay/frameworks/base/core/res/res/values/config.xml b/vsoc_arm64/phone/overlay/frameworks/base/core/res/res/values/config.xml
new file mode 100644
index 0000000..2b7dfbe
--- /dev/null
+++ b/vsoc_arm64/phone/overlay/frameworks/base/core/res/res/values/config.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2017, 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.
+*/
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="networkAttributes" translatable="false">
+    <item>"mobile,0,0,0,-1,true"</item>
+    <item>"wifi,1,1,1,-1,true"</item>
+    <item>"mobile_mms,2,0,2,60000,true"</item>
+    <item>"mobile_hipri,5,0,3,60000,true"</item>
+    <item>"bluetooth,7,7,2,-1,true"</item>
+  </string-array>
+  <string-array name="radioAttributes" translatable="false">
+    <item>"0,1"</item>
+    <item>"1,1"</item>
+    <item>"4,1"</item>
+    <item>"7,1"</item>
+    <item>"11,1"</item>
+  </string-array>
+  <string-array name="config_tether_wifi_regexs" translatable="false">
+    <item>"wlan0"</item>
+  </string-array>
+  <string-array name="config_tether_apndata" translatable="false">
+    <item>Android,android,,,,,,,,310,260,,default,dun,ims</item>
+  </string-array>
+  <bool name="config_wifi_dual_band_support" translatable="false">true</bool>
+  <bool name="config_bluetooth_address_validation">true</bool>
+  <bool name="config_sms_capable">true</bool>
+  <string name="default_sms_application" translatable="false">com.android.mms</string>
+  <bool name="config_showNavigationBar">true</bool>
+  <dimen name="config_viewConfigurationTouchSlop">12dp</dimen>
+  <integer name="config_mobile_mtu">1460</integer>
+  <!-- cuttlefish uses mac80211-hwsim, which does not support Preferred
+  Network Offload feature. We disable the use of this feature here. -->
+  <bool translatable="false" name="config_wifi_background_scan_support">false</bool>
+  <!--  Maximum number of supported users -->
+  <integer name="config_multiuserMaximumUsers">4</integer>
+</resources>
diff --git a/vsoc_x86/BoardConfig.mk b/vsoc_x86/BoardConfig.mk
index 245229b..68b1e63 100644
--- a/vsoc_x86/BoardConfig.mk
+++ b/vsoc_x86/BoardConfig.mk
@@ -20,7 +20,6 @@
 
 -include device/google/cuttlefish/shared/BoardConfig.mk
 
-TARGET_BOOTLOADER_BOARD_NAME := vsoc_x86
 TARGET_BOARD_PLATFORM := vsoc_x86
 TARGET_ARCH := x86
 TARGET_ARCH_VARIANT := x86
diff --git a/vsoc_x86_64/BoardConfig.mk b/vsoc_x86_64/BoardConfig.mk
index 5ff3c32..8c2fa675 100644
--- a/vsoc_x86_64/BoardConfig.mk
+++ b/vsoc_x86_64/BoardConfig.mk
@@ -20,7 +20,6 @@
 
 -include device/google/cuttlefish/shared/BoardConfig.mk
 
-TARGET_BOOTLOADER_BOARD_NAME := vsoc_x86_64
 TARGET_BOARD_PLATFORM := vsoc_x86_64
 TARGET_ARCH := x86_64
 TARGET_ARCH_VARIANT := silvermont