Snap for 9239618 from c9f2e5134e1d818a6bf471607cc123db4fea2956 to tm-platform-release

Change-Id: Ibc6b476b1efe6bf2ea8005f9394196ef45b06413
diff --git a/guest/hals/audio/effects/manifest.xml b/guest/hals/audio/effects/manifest.xml
new file mode 100644
index 0000000..6b4e832
--- /dev/null
+++ b/guest/hals/audio/effects/manifest.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2022, 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.
+** limitations under the License.
+*/
+-->
+
+<manifest version="1.0" type="device">
+    <hal format="hidl">
+        <name>android.hardware.audio.effect</name>
+        <transport>hwbinder</transport>
+        <version>7.0</version>
+        <interface>
+            <name>IEffectsFactory</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
+</manifest>
diff --git a/guest/hals/keymint/remote/remote_keymint_operation.cpp b/guest/hals/keymint/remote/remote_keymint_operation.cpp
index b88715a..aa05035 100644
--- a/guest/hals/keymint/remote/remote_keymint_operation.cpp
+++ b/guest/hals/keymint/remote/remote_keymint_operation.cpp
@@ -50,13 +50,17 @@
 }
 
 ScopedAStatus RemoteKeyMintOperation::updateAad(
-    const vector<uint8_t>& input,
-    const optional<HardwareAuthToken>& /* authToken */,
+    const vector<uint8_t>& input, const optional<HardwareAuthToken>& authToken,
     const optional<TimeStampToken>& /* timestampToken */) {
   UpdateOperationRequest request(impl_.message_version());
   request.op_handle = opHandle_;
   request.additional_params.push_back(TAG_ASSOCIATED_DATA, input.data(),
                                       input.size());
+  if (authToken) {
+    auto tokenAsVec(authToken2AidlVec(*authToken));
+    request.additional_params.push_back(keymaster::TAG_AUTH_TOKEN,
+                                        tokenAsVec.data(), tokenAsVec.size());
+  }
 
   UpdateOperationResponse response(impl_.message_version());
   impl_.UpdateOperation(request, &response);
@@ -65,8 +69,7 @@
 }
 
 ScopedAStatus RemoteKeyMintOperation::update(
-    const vector<uint8_t>& input,
-    const optional<HardwareAuthToken>& /* authToken */,
+    const vector<uint8_t>& input, const optional<HardwareAuthToken>& authToken,
     const optional<TimeStampToken>&
     /* timestampToken */,
     vector<uint8_t>* output) {
@@ -75,6 +78,11 @@
   UpdateOperationRequest request(impl_.message_version());
   request.op_handle = opHandle_;
   request.input.Reinitialize(input.data(), input.size());
+  if (authToken) {
+    auto tokenAsVec(authToken2AidlVec(*authToken));
+    request.additional_params.push_back(keymaster::TAG_AUTH_TOKEN,
+                                        tokenAsVec.data(), tokenAsVec.size());
+  }
 
   UpdateOperationResponse response(impl_.message_version());
   impl_.UpdateOperation(request, &response);
@@ -92,7 +100,7 @@
 ScopedAStatus RemoteKeyMintOperation::finish(
     const optional<vector<uint8_t>>& input,      //
     const optional<vector<uint8_t>>& signature,  //
-    const optional<HardwareAuthToken>& /* authToken */,
+    const optional<HardwareAuthToken>& authToken,
     const optional<TimeStampToken>& /* timestampToken */,
     const optional<vector<uint8_t>>& /* confirmationToken */,
     vector<uint8_t>* output) {
@@ -104,8 +112,14 @@
   FinishOperationRequest request(impl_.message_version());
   request.op_handle = opHandle_;
   if (input) request.input.Reinitialize(input->data(), input->size());
-  if (signature)
+  if (signature) {
     request.signature.Reinitialize(signature->data(), signature->size());
+  }
+  if (authToken) {
+    auto tokenAsVec(authToken2AidlVec(*authToken));
+    request.additional_params.push_back(keymaster::TAG_AUTH_TOKEN,
+                                        tokenAsVec.data(), tokenAsVec.size());
+  }
 
   FinishOperationResponse response(impl_.message_version());
   impl_.FinishOperation(request, &response);
diff --git a/host/commands/assemble_cvd/flags.cc b/host/commands/assemble_cvd/flags.cc
index 08c2b68..5d01c80 100644
--- a/host/commands/assemble_cvd/flags.cc
+++ b/host/commands/assemble_cvd/flags.cc
@@ -597,15 +597,6 @@
       }
   }
 
-  // The device needs to avoid having both hwcomposer2.4 and hwcomposer3
-  // services running at the same time so warn the user to manually build
-  // in drm_hwcomposer when needed.
-  if (tmp_config_obj.hwcomposer() == kHwComposerAuto) {
-    LOG(WARNING) << "In order to run with --hwcomposer=drm. Please make sure "
-                    "Cuttlefish was built with "
-                    "TARGET_ENABLE_DRMHWCOMPOSER=true.";
-  }
-
   tmp_config_obj.set_enable_gpu_udmabuf(FLAGS_enable_gpu_udmabuf);
   tmp_config_obj.set_enable_gpu_angle(FLAGS_enable_gpu_angle);
 
diff --git a/host/libs/vm_manager/crosvm_manager.cpp b/host/libs/vm_manager/crosvm_manager.cpp
index bf95250..8c6c585 100644
--- a/host/libs/vm_manager/crosvm_manager.cpp
+++ b/host/libs/vm_manager/crosvm_manager.cpp
@@ -77,9 +77,11 @@
     return {
       "androidboot.cpuvulkan.version=0",
       "androidboot.hardware.gralloc=minigbm",
-      "androidboot.hardware.hwcomposer=drm",
+      "androidboot.hardware.hwcomposer=ranchu",
+      "androidboot.hardware.hwcomposer.mode=client",
       "androidboot.hardware.egl=mesa",
-    };
+      // No "hardware" Vulkan support, yet
+      "androidboot.opengles.version=196608"};  // OpenGL ES 3.0
   }
   if (config.gpu_mode() == kGpuModeGfxStream) {
     std::string gles_impl = config.enable_gpu_angle() ? "angle" : "emulation";
diff --git a/host/libs/vm_manager/qemu_manager.cpp b/host/libs/vm_manager/qemu_manager.cpp
index adedf04..4efb053 100644
--- a/host/libs/vm_manager/qemu_manager.cpp
+++ b/host/libs/vm_manager/qemu_manager.cpp
@@ -131,21 +131,23 @@
     // with properities lead to non-deterministic behavior while loading the
     // HALs.
     return {
-        "androidboot.cpuvulkan.version=" + std::to_string(VK_API_VERSION_1_1),
+        "androidboot.cpuvulkan.version=" + std::to_string(VK_API_VERSION_1_2),
         "androidboot.hardware.gralloc=minigbm",
         "androidboot.hardware.hwcomposer=" + config.hwcomposer(),
         "androidboot.hardware.egl=angle",
         "androidboot.hardware.vulkan=pastel",
-    };
+        "androidboot.opengles.version=196609"};  // OpenGL ES 3.1
   }
 
   if (config.gpu_mode() == kGpuModeDrmVirgl) {
     return {
       "androidboot.cpuvulkan.version=0",
       "androidboot.hardware.gralloc=minigbm",
-      "androidboot.hardware.hwcomposer=drm",
+      "androidboot.hardware.hwcomposer=ranchu",
+      "androidboot.hardware.hwcomposer.mode=client",
       "androidboot.hardware.egl=mesa",
-    };
+      // No "hardware" Vulkan support, yet
+      "androidboot.opengles.version=196608"};  // OpenGL ES 3.0
   }
 
   return {};
diff --git a/shared/auto/device_vendor.mk b/shared/auto/device_vendor.mk
index 277eaa3..a03044e 100644
--- a/shared/auto/device_vendor.mk
+++ b/shared/auto/device_vendor.mk
@@ -115,6 +115,7 @@
 ENABLE_MOCK_EVSHAL ?= true
 ENABLE_CAREVSSERVICE_SAMPLE ?= true
 ENABLE_SAMPLE_EVS_APP ?= true
+ENABLE_CARTELEMETRY_SERVICE ?= true
 
 ifeq ($(ENABLE_MOCK_EVSHAL), true)
 CUSTOMIZE_EVS_SERVICE_PARAMETER := true
@@ -130,6 +131,9 @@
 PRODUCT_COPY_FILES += \
     device/google/cuttlefish/shared/auto/evs/evs_app_config.json:$(TARGET_COPY_OUT_SYSTEM)/etc/automotive/evs/config_override.json
 BOARD_SEPOLICY_DIRS += packages/services/Car/cpp/evs/apps/sepolicy/private
+ifeq ($(ENABLE_CARTELEMETRY_SERVICE), true)
+BOARD_SEPOLICY_DIRS += packages/services/Car/cpp/evs/apps/sepolicy/cartelemetry
+endif
 endif
 
 BOARD_IS_AUTOMOTIVE := true
diff --git a/shared/auto/preinstalled-packages-product-car-cuttlefish.xml b/shared/auto/preinstalled-packages-product-car-cuttlefish.xml
index 9f22200..0aca16b 100644
--- a/shared/auto/preinstalled-packages-product-car-cuttlefish.xml
+++ b/shared/auto/preinstalled-packages-product-car-cuttlefish.xml
@@ -94,10 +94,6 @@
     <install-in-user-type package="com.android.cameraextensions">
         <install-in user-type="SYSTEM" />
         <install-in user-type="FULL" />
-   </install-in-user-type>
-   <install-in-user-type package="com.android.car.messenger">
-	<install-in user-type="FULL" />
-        <install-in user-type="SYSTEM" />
     </install-in-user-type>
     <install-in-user-type package="com.android.apps.tag">
         <install-in user-type="FULL" />
@@ -124,9 +120,6 @@
     <install-in-user-type package="com.android.car.datacenter">
         <install-in user-type="FULL" />
     </install-in-user-type>
-    <install-in-user-type package="com.android.car.dialer">
-        <install-in user-type="FULL" />
-    </install-in-user-type>
     <install-in-user-type package="com.android.car.goldilocks">
         <install-in user-type="FULL" />
     </install-in-user-type>
diff --git a/shared/config/init.vendor.rc b/shared/config/init.vendor.rc
index 8861ca3..cb702a0 100644
--- a/shared/config/init.vendor.rc
+++ b/shared/config/init.vendor.rc
@@ -6,6 +6,7 @@
     setprop debug.sf.vsync_reactor_ignore_present_fences true
     setprop ro.hardware.gralloc ${ro.boot.hardware.gralloc}
     setprop ro.hardware.hwcomposer ${ro.boot.hardware.hwcomposer}
+    setprop ro.vendor.hwcomposer.display_finder_mode ${ro.boot.hardware.hwcomposer.display_finder_mode}
     setprop ro.vendor.hwcomposer.mode ${ro.boot.hardware.hwcomposer.mode}
     setprop ro.hardware.vulkan ${ro.boot.hardware.vulkan}
     setprop ro.cpuvulkan.version ${ro.boot.cpuvulkan.version}
diff --git a/shared/config/manifest.xml b/shared/config/manifest.xml
index 126557f..893dbfa 100644
--- a/shared/config/manifest.xml
+++ b/shared/config/manifest.xml
@@ -18,15 +18,6 @@
 -->
 <manifest version="1.0" type="device" target-level="7">
     <hal format="hidl">
-        <name>android.hardware.audio.effect</name>
-        <transport>hwbinder</transport>
-        <version>7.0</version>
-        <interface>
-            <name>IEffectsFactory</name>
-            <instance>default</instance>
-        </interface>
-    </hal>
-    <hal format="hidl">
         <name>android.hardware.authsecret</name>
         <transport>hwbinder</transport>
         <version>1.0</version>
diff --git a/shared/device.mk b/shared/device.mk
index 04dedbd..8344163 100644
--- a/shared/device.mk
+++ b/shared/device.mk
@@ -66,7 +66,6 @@
 AB_OTA_UPDATER := true
 AB_OTA_PARTITIONS += \
     boot \
-    init_boot \
     odm \
     odm_dlkm \
     product \
@@ -79,6 +78,11 @@
     vendor_boot \
     vendor_dlkm \
 
+TARGET_USES_INITBOOT ?= true
+ifeq ($(TARGET_USES_INITBOOT),true)
+AB_OTA_PARTITIONS += init_boot
+endif
+
 # Enable Virtual A/B
 $(call inherit-product, $(SRC_TARGET_DIR)/product/virtual_ab_ota/android_t_baseline.mk)
 PRODUCT_VIRTUAL_AB_COMPRESSION_METHOD := gz
@@ -403,7 +407,6 @@
 ifeq ($(TARGET_ENABLE_DRMHWCOMPOSER),true)
 DEVICE_MANIFEST_FILE += \
     device/google/cuttlefish/shared/config/manifest_android.hardware.graphics.composer@2.4-service.xml
-
 PRODUCT_PACKAGES += \
     android.hardware.graphics.composer@2.4-service \
     hwcomposer.drm
@@ -468,6 +471,8 @@
     android.hardware.audio.service \
     android.hardware.audio@7.1-impl.ranchu \
     android.hardware.audio.effect@7.0-impl
+DEVICE_MANIFEST_FILE += \
+    device/google/cuttlefish/guest/hals/audio/effects/manifest.xml
 endif
 
 ifndef LOCAL_AUDIO_PRODUCT_COPY_FILES
@@ -827,18 +832,6 @@
 PRODUCT_VENDOR_PROPERTIES += \
     ro.surface_flinger.supports_background_blur 1
 
-# Set support one-handed mode
-PRODUCT_PRODUCT_PROPERTIES += \
-    ro.support_one_handed_mode=true
-
-# Set one_handed_mode screen translate offset percentage
-PRODUCT_PRODUCT_PROPERTIES += \
-    persist.debug.one_handed_offset_percentage=50
-
-# Set one_handed_mode translate animation duration milliseconds
-PRODUCT_PRODUCT_PROPERTIES += \
-    persist.debug.one_handed_translate_animation_duration=300
-
 # Vendor Dlkm Locader
 PRODUCT_PACKAGES += \
    dlkm_loader
diff --git a/shared/foldable/overlay/frameworks/base/core/res/res/values/config.xml b/shared/foldable/overlay/frameworks/base/core/res/res/values/config.xml
index b0b42ab..c93ab5a 100644
--- a/shared/foldable/overlay/frameworks/base/core/res/res/values/config.xml
+++ b/shared/foldable/overlay/frameworks/base/core/res/res/values/config.xml
@@ -41,4 +41,13 @@
   <bool name="config_supportsSplitScreenMultiWindow">true</bool>
   <!-- Radius of the software rounded corners. -->
   <dimen name="rounded_corner_radius">34px</dimen>
+
+  <!-- List of the labels of requestable device state config values -->
+  <string-array name="config_deviceStatesAvailableForAppRequests">
+    <item>config_deviceStateRearDisplay</item>
+  </string-array>
+
+  <!-- Device state that corresponds to rear display mode, feature provided
+         through Jetpack WindowManager -->
+  <integer name="config_deviceStateRearDisplay">0</integer>
 </resources>
diff --git a/shared/permissions/cuttlefish_excluded_hardware.xml b/shared/permissions/cuttlefish_excluded_hardware.xml
index c3d03d5..3fba9f6 100644
--- a/shared/permissions/cuttlefish_excluded_hardware.xml
+++ b/shared/permissions/cuttlefish_excluded_hardware.xml
@@ -15,5 +15,4 @@
 -->
 <permissions>
     <unavailable-feature name="android.software.print" />
-    <unavailable-feature name="android.software.voice_recognizers" />
 </permissions>
diff --git a/shared/sepolicy/vendor/genfs_contexts b/shared/sepolicy/vendor/genfs_contexts
index 542db04..cbbd88f 100644
--- a/shared/sepolicy/vendor/genfs_contexts
+++ b/shared/sepolicy/vendor/genfs_contexts
@@ -65,7 +65,7 @@
 
 # qemu (arm64)
 cf_pci_block_device(/devices/platform/4010000000.pcie/pci0000:00, 0xa, 9)
-cf_pci_gpu_device(/devices/platform/4010000000.pcie/pci0000:00, 0x2)
+cf_pci_gpu_device(/devices/platform/4010000000.pcie/pci0000:00, 0x1)
 ## find /sys/devices/platform/* -type d -name 'rtc[0-9]' | sed 's,/rtc[0-9],,'
 genfscon sysfs /devices/platform/9010000.pl031/rtc u:object_r:sysfs_rtc:s0
 ## find /sys/devices/platform/* -type d -name 'wakeup[0-9]'
@@ -73,7 +73,7 @@
 
 # qemu (arm)
 cf_pci_block_device(/devices/platform/3f000000.pcie/pci0000:00, 0xa, 9)
-cf_pci_gpu_device(/devices/platform/3f000000.pcie/pci0000:00, 0x2)
+cf_pci_gpu_device(/devices/platform/3f000000.pcie/pci0000:00, 0x1)
 genfscon sysfs /devices/platform/rtc-test.1/wakeup/wakeup2 u:object_r:sysfs_wakeup:s0
 genfscon sysfs /devices/platform/rtc-test.2/wakeup/wakeup3 u:object_r:sysfs_wakeup:s0
 
diff --git a/shared/sepolicy/vendor/property_contexts b/shared/sepolicy/vendor/property_contexts
index 9b98ed1..235b35a 100644
--- a/shared/sepolicy/vendor/property_contexts
+++ b/shared/sepolicy/vendor/property_contexts
@@ -14,6 +14,7 @@
 ro.vendor.boot_security_patch u:object_r:vendor_boot_security_patch_level_prop:s0
 vendor.bt.rootcanal_mac_address  u:object_r:vendor_bt_rootcanal_prop:s0
 vendor.bt.rootcanal_test_console  u:object_r:vendor_bt_rootcanal_prop:s0
+ro.vendor.hwcomposer.display_finder_mode  u:object_r:vendor_hwcomposer_prop:s0 exact string
 ro.vendor.hwcomposer.mode  u:object_r:vendor_hwcomposer_prop:s0 exact string
 ro.vendor.hwcomposer.pmem  u:object_r:vendor_hwcomposer_prop:s0 exact string
 vendor.wlan.firmware.version   u:object_r:vendor_wlan_versions_prop:s0 exact string