Merge "TEST_MAPPING += hidl_implementation_test"
diff --git a/README.md b/README.md
index 232cc77..531f840 100644
--- a/README.md
+++ b/README.md
@@ -1,21 +1,33 @@
 # So you want to try cuttlefish?
 
-1. Go to http://ci.android.com/
-2. Enter a branch name. Start with `aosp-master` if you don't know what you're
+1. Download, build, and install the host debian package:
+
+```bash
+git clone https://github.com/google/android-cuttlefish
+cd android-cuttlefish
+debuild -i -us -uc -b
+sudo dpkg -i ../cuttlefish-common_*_amd64.deb
+sudo apt-get install -f
+```
+
+2. Go to http://ci.android.com/
+3. Enter a branch name. Start with `aosp-master` if you don't know what you're
    looking for
-3. Navigate to `aosp_cf_x86_phone` and click on `userdebug` for the latest build
-4. Click on `Artifacts`
-5. Scroll down to the OTA images. These packages look like
+4. Navigate to `aosp_cf_x86_phone` and click on `userdebug` for the latest build
+5. Click on `Artifacts`
+6. Scroll down to the OTA images. These packages look like
    `aosp_cf_x86_phone-img-xxxxxx.zip` -- it will always have `img` in the name.
    Download this file
-6. Scroll down to `cvd-host_package.tar.gz`. You should always download a host
+7. Scroll down to `cvd-host_package.tar.gz`. You should always download a host
    package from the same build as your images.
-7. On your local system, combine the packages:
+8. On your local system, combine the packages:
 
-   `$ mkdir cf`
-   `$ cd cf`
-   `$ tar xvf /path/to/cvd-host_package.tar.gz`
-   `$ unzip /path/to/aosp_cf_x86_phone-img-xxxxxx.zip`
+```bash
+mkdir cf
+cd cf
+tar xvf /path/to/cvd-host_package.tar.gz
+unzip /path/to/aosp_cf_x86_phone-img-xxxxxx.zip
+```
 
 8. Launch cuttlefish with:
 
diff --git a/dtb.img b/dtb.img
new file mode 100644
index 0000000..9d6cec7
--- /dev/null
+++ b/dtb.img
@@ -0,0 +1 @@
+workaround
diff --git a/host_package.mk b/host_package.mk
index 815af3b..cd47c1e 100644
--- a/host_package.mk
+++ b/host_package.mk
@@ -86,6 +86,7 @@
     libcuttlefish_device_config.so \
     cdisk_spec.so \
     libprotobuf-cpp-full.so \
+    libziparchive.so \
 
 
 cvd_host_package_files := \
diff --git a/shared/BoardConfig.mk b/shared/BoardConfig.mk
index 97a073f..fa96982 100644
--- a/shared/BoardConfig.mk
+++ b/shared/BoardConfig.mk
@@ -140,7 +140,7 @@
 
 TARGET_RECOVERY_FSTAB ?= device/google/cuttlefish/shared/config/fstab
 
-BOARD_SUPER_PARTITION_SIZE := 6174015488
+BOARD_SUPER_PARTITION_SIZE := 12348030976
 BOARD_SUPER_PARTITION_GROUPS := google_dynamic_partitions
 BOARD_GOOGLE_DYNAMIC_PARTITIONS_PARTITION_LIST := system vendor product system_ext
 BOARD_GOOGLE_DYNAMIC_PARTITIONS_SIZE := 6174015488
@@ -151,3 +151,10 @@
 # To see full logs from init, disable ratelimiting.
 # The default is 5 messages per second amortized, with a burst of up to 10.
 BOARD_KERNEL_CMDLINE += printk.devkmsg=on
+
+BOARD_INCLUDE_DTB_IN_BOOTIMG := true
+BOARD_BOOT_HEADER_VERSION := 3
+BOARD_USES_RECOVERY_AS_BOOT := true
+BOARD_MKBOOTIMG_ARGS += --header_version $(BOARD_BOOT_HEADER_VERSION)
+PRODUCT_COPY_FILES += device/google/cuttlefish/dtb.img:dtb.img
+BOARD_BUILD_SYSTEM_ROOT_IMAGE := false
diff --git a/shared/config/fstab b/shared/config/fstab
index 05d62f9..d6b40a6 100644
--- a/shared/config/fstab
+++ b/shared/config/fstab
@@ -1,12 +1,13 @@
 boot /boot emmc defaults recoveryonly
-system /system ext4 noatime,ro,errors=panic wait,logical,first_stage_mount
+system /system ext4 noatime,ro,errors=panic wait,logical,first_stage_mount,slotselect
 # Add all non-dynamic partitions except system, after this comment
 /dev/block/by-name/userdata /data ext4 nodev,noatime,nosuid,errors=panic wait,fileencryption=aes-256-xts:aes-256-cts
 /dev/block/by-name/metadata /metadata ext4 nodev,noatime,nosuid,errors=panic wait,formattable
 /dev/block/by-name/cache /cache ext4 nodev,noatime,nosuid,errors=panic wait
+/dev/block/by-name/misc /misc emmc defaults defaults
 # Add all dynamic partitions except system, after this comment
-vendor /vendor ext4 noatime,ro,errors=panic wait,logical,first_stage_mount
-product /product ext4 noatime,ro,errors=panic wait,logical,first_stage_mount
-system_ext /system_ext ext4 noatime,ro,errors=panic wait,logical,first_stage_mount
+vendor /vendor ext4 noatime,ro,errors=panic wait,logical,first_stage_mount,slotselect
+product /product ext4 noatime,ro,errors=panic wait,logical,first_stage_mount,slotselect
+system_ext /system_ext ext4 noatime,ro,errors=panic wait,logical,first_stage_mount,slotselect
 /dev/block/zram0 none swap defaults zramsize=75%
 /tmp /sdcard none defaults,bind recoveryonly
diff --git a/shared/config/fstab.composite b/shared/config/fstab.composite
index ed5b7e3..3fed495 100644
--- a/shared/config/fstab.composite
+++ b/shared/config/fstab.composite
@@ -1,12 +1,13 @@
 boot /boot emmc defaults recoveryonly
-system /system ext4 noatime,ro,errors=panic wait,logical,first_stage_mount
+system /system ext4 noatime,ro,errors=panic wait,logical,first_stage_mount,slotselect
 # Add all non-dynamic partitions except system, after this comment
 /dev/block/by-name/userdata /data ext4 nodev,noatime,nosuid,errors=panic wait,fileencryption=aes-256-xts:aes-256-cts
 /dev/block/by-name/cache /cache ext4 nodev,noatime,nosuid,errors=panic wait
 /dev/block/by-name/metadata /metadata ext4 nodev,noatime,nosuid,errors=panic wait,formattable
+/dev/block/by-name/misc /misc emmc defaults defaults
 # Add all dynamic partitions except system, after this comment
-vendor /vendor ext4 noatime,ro,errors=panic wait,logical,first_stage_mount
-product /product ext4 noatime,ro,errors=panic wait,logical,first_stage_mount
-system_ext /system_ext ext4 noatime,ro,errors=panic wait,logical,first_stage_mount
+vendor /vendor ext4 noatime,ro,errors=panic wait,logical,first_stage_mount,slotselect
+product /product ext4 noatime,ro,errors=panic wait,logical,first_stage_mount,slotselect
+system_ext /system_ext ext4 noatime,ro,errors=panic wait,logical,first_stage_mount,slotselect
 /dev/block/zram0 none swap defaults zramsize=75%
 /tmp /sdcard none defaults,bind recoveryonly
diff --git a/shared/config/manifest.xml b/shared/config/manifest.xml
index 6cd7bd6..91ba972 100644
--- a/shared/config/manifest.xml
+++ b/shared/config/manifest.xml
@@ -84,17 +84,6 @@
             <instance>default</instance>
         </interface>
     </hal>
-    <!-- TODO (b/130078382):
-    <hal format="hidl">
-        <name>android.hardware.boot</name>
-        <transport>hwbinder</transport>
-        <version>1.0</version>
-        <interface>
-            <name>IBootControl</name>
-            <instance>default</instance>
-        </interface>
-    </hal>
-    -->
     <!-- TODO (b/130078384): -->
     <hal format="hidl">
         <name>android.hardware.camera.provider</name>
diff --git a/shared/config/spn-conf.xml b/shared/config/spn-conf.xml
index d692856..f1639df 100644
--- a/shared/config/spn-conf.xml
+++ b/shared/config/spn-conf.xml
@@ -17,5 +17,5 @@
 */
 -->
 <spnOverrides>
-    <spnOverride numeric="310260" spn="Android"/>
+    <spnOverride numeric="311740" spn="Android"/>
 </spnOverrides>
diff --git a/shared/device.mk b/shared/device.mk
index e626c86..c1de74f 100644
--- a/shared/device.mk
+++ b/shared/device.mk
@@ -22,6 +22,16 @@
 PRODUCT_USE_DYNAMIC_PARTITIONS := true
 DISABLE_RILD_OEM_HOOK := true
 
+AB_OTA_UPDATER := true
+AB_OTA_PARTITIONS += \
+    product \
+    system \
+    system_ext \
+    vendor
+
+# Enable Virtual A/B
+$(call inherit-product, $(SRC_TARGET_DIR)/product/virtual_ab_ota.mk)
+
 # Properties that are not vendor-specific. These will go in the product
 # partition, instead of the vendor partition, and do not need vendor
 # sepolicy
@@ -152,8 +162,12 @@
     device/google/cuttlefish/shared/config/fstab:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.cutf_ivsh \
     device/google/cuttlefish/shared/config/fstab:$(TARGET_COPY_OUT_RAMDISK)/fstab.cutf_cvm \
     device/google/cuttlefish/shared/config/fstab:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.cutf_cvm \
+    device/google/cuttlefish/shared/config/fstab:$(TARGET_COPY_OUT_RECOVERY)/root/first_stage_ramdisk/fstab.cutf_ivsh \
+    device/google/cuttlefish/shared/config/fstab:$(TARGET_COPY_OUT_RECOVERY)/root/first_stage_ramdisk/fstab.cutf_cvm \
     device/google/cuttlefish/shared/config/fstab.composite:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.composite.cutf_ivsh \
     device/google/cuttlefish/shared/config/fstab.composite:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.composite.cutf_cvm \
+    device/google/cuttlefish/shared/config/fstab.composite:$(TARGET_COPY_OUT_RECOVERY)/root/first_stage_ramdisk/fstab.composite.cutf_ivsh \
+    device/google/cuttlefish/shared/config/fstab.composite:$(TARGET_COPY_OUT_RECOVERY)/root/first_stage_ramdisk/fstab.composite.cutf_cvm \
 
 #
 # USB Specific
@@ -307,11 +321,11 @@
 # NeuralNetworks HAL
 #
 PRODUCT_PACKAGES += \
-    android.hardware.neuralnetworks@1.2-service-sample-all \
-    android.hardware.neuralnetworks@1.2-service-sample-float-fast \
-    android.hardware.neuralnetworks@1.2-service-sample-float-slow \
-    android.hardware.neuralnetworks@1.2-service-sample-minimal \
-    android.hardware.neuralnetworks@1.2-service-sample-quant
+    android.hardware.neuralnetworks@1.3-service-sample-all \
+    android.hardware.neuralnetworks@1.3-service-sample-float-fast \
+    android.hardware.neuralnetworks@1.3-service-sample-float-slow \
+    android.hardware.neuralnetworks@1.3-service-sample-minimal \
+    android.hardware.neuralnetworks@1.3-service-sample-quant
 
 #
 # USB
@@ -320,10 +334,13 @@
 
 # Vibrator HAL
 PRODUCT_PACKAGES += \
-    android.hardware.vibrator@1.3-service.example
+    android.hardware.vibrator@1.x-service.example
 
+# BootControl HAL
 PRODUCT_PACKAGES += \
-    cuttlefish_dtb
+    android.hardware.boot@1.1-impl \
+    android.hardware.boot@1.1-impl.recovery \
+    android.hardware.boot@1.1-service
 
 # WLAN driver configuration files
 PRODUCT_COPY_FILES += \
diff --git a/shared/sepolicy/vendor/bug_map b/shared/sepolicy/vendor/bug_map
index 77b48f0..372547e 100644
--- a/shared/sepolicy/vendor/bug_map
+++ b/shared/sepolicy/vendor/bug_map
@@ -2,6 +2,7 @@
 init system_lib_file file b/133444385
 kernel kernel system b/130424539
 logpersist logpersist capability b/132911257
+logpersist device file b/143108875
 platform_app radio_prop property_service b/140284352
 priv_app proc_net file b/124422390
 shell adbd vsock_socket b/131904985
diff --git a/shared/sepolicy/vendor/file_contexts b/shared/sepolicy/vendor/file_contexts
index 69c5ad8..4a592ce 100644
--- a/shared/sepolicy/vendor/file_contexts
+++ b/shared/sepolicy/vendor/file_contexts
@@ -60,8 +60,8 @@
 /vendor/bin/hw/android\.hardware\.gatekeeper@1\.0-service\.software  u:object_r:hal_gatekeeper_default_exec:s0
 /vendor/bin/hw/android\.hardware\.health@2\.0-service\.cuttlefish  u:object_r:hal_health_default_exec:s0
 /vendor/bin/hw/android\.hardware\.health\.storage@1\.0-service\.cuttlefish u:object_r:hal_health_storage_default_exec:s0
-/vendor/bin/hw/android\.hardware\.neuralnetworks@1\.2-service-sample-.*   u:object_r:hal_neuralnetworks_sample_exec:s0
-/vendor/bin/hw/android\.hardware\.vibrator@1\.3-service\.example u:object_r:hal_vibrator_default_exec:s0
+/vendor/bin/hw/android\.hardware\.neuralnetworks@1\.3-service-sample-.*   u:object_r:hal_neuralnetworks_sample_exec:s0
+/vendor/bin/hw/android\.hardware\.vibrator@1\.x-service\.example u:object_r:hal_vibrator_default_exec:s0
 /vendor/bin/hw/android\.hardware\.tv\.cec@1\.0-service\.mock u:object_r:hal_tv_cec_mock_exec:s0
 /vendor/bin/ip_link_add  u:object_r:ip_link_add_exec:s0
 /vendor/bin/setup_wifi  u:object_r:setup_wifi_exec:s0
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
index 90e50c7..b272ba5 100644
--- 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
@@ -35,7 +35,7 @@
     <item>"wlan0"</item>
   </string-array>
   <string-array name="config_tether_apndata" translatable="false">
-    <item>Android,android,,,,,,,,310,260,,default,dun,ims</item>
+    <item>Android,android,,,,,,,,311,740,,default,dun,ims</item>
   </string-array>
   <bool name="config_wifi_dual_band_support" translatable="false">true</bool>
   <bool name="config_bluetooth_address_validation" translatable="false">true</bool>
diff --git a/vsoc_x86/BoardConfig.mk b/vsoc_x86/BoardConfig.mk
index d4b1772..55f400b 100644
--- a/vsoc_x86/BoardConfig.mk
+++ b/vsoc_x86/BoardConfig.mk
@@ -19,6 +19,7 @@
 #
 
 -include device/google/cuttlefish/shared/BoardConfig.mk
+-include $(wildcard device/*/cuttlestone_x86_phone/BoardConfig.mk)
 
 TARGET_BOARD_PLATFORM := vsoc_x86
 TARGET_ARCH := x86
diff --git a/vsoc_x86/phone/overlay/frameworks/base/core/res/res/values/config.xml b/vsoc_x86/phone/overlay/frameworks/base/core/res/res/values/config.xml
index 90e50c7..b272ba5 100644
--- a/vsoc_x86/phone/overlay/frameworks/base/core/res/res/values/config.xml
+++ b/vsoc_x86/phone/overlay/frameworks/base/core/res/res/values/config.xml
@@ -35,7 +35,7 @@
     <item>"wlan0"</item>
   </string-array>
   <string-array name="config_tether_apndata" translatable="false">
-    <item>Android,android,,,,,,,,310,260,,default,dun,ims</item>
+    <item>Android,android,,,,,,,,311,740,,default,dun,ims</item>
   </string-array>
   <bool name="config_wifi_dual_band_support" translatable="false">true</bool>
   <bool name="config_bluetooth_address_validation" translatable="false">true</bool>