Enable pkvm based on the relevant sysprop rather than /dev/kvm am: 4ff69cacdf am: 34a69be411

Original change: https://android-review.googlesource.com/c/device/google/gs101/+/3128013

Change-Id: Ic587fc28c22bbe105ba3f6118f0b45a128f3335c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/BoardConfig-common.mk b/BoardConfig-common.mk
index 2fdbc7f..a5e752d 100644
--- a/BoardConfig-common.mk
+++ b/BoardConfig-common.mk
@@ -49,6 +49,11 @@
 BOARD_KERNEL_CMDLINE += swiotlb=noforce
 BOARD_BOOTCONFIG += androidboot.boot_devices=14700000.ufs
 
+# Enable KUnit for userdebug and eng builds
+ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
+  BOARD_KERNEL_CMDLINE += kunit.enable=1
+endif
+
 TARGET_NO_BOOTLOADER := true
 TARGET_NO_RADIOIMAGE := true
 BOARD_PREBUILT_BOOTIMAGE := $(wildcard $(TARGET_KERNEL_DIR)/boot.img)
@@ -185,8 +190,8 @@
     vendor \
     vendor_dlkm
 
-# Set error limit to BOARD_SUPER_PARTITON_SIZE - 500MB
-BOARD_SUPER_PARTITION_ERROR_LIMIT := 8006926336
+# Set error limit to BOARD_SUPER_PARTITON_SIZE - 400MB
+BOARD_SUPER_PARTITION_ERROR_LIMIT := 8111783936
 
 # Testing related defines
 BOARD_PERFSETUP_SCRIPT := platform_testing/scripts/perf-setup/r4o6-setup.sh
@@ -357,9 +362,8 @@
 BOARD_DO_NOT_STRIP_VENDOR_MODULES := true
 
 # Prebuilt kernel modules that are *not* listed in vendor_boot.modules.load
-BOARD_PREBUILT_VENDOR_RAMDISK_KERNEL_MODULES = fips140/fips140.ko
+BOARD_PREBUILT_VENDOR_RAMDISK_KERNEL_MODULES = fips140.ko
 BOARD_VENDOR_RAMDISK_KERNEL_MODULES_LOAD_EXTRA = $(foreach k,$(BOARD_PREBUILT_VENDOR_RAMDISK_KERNEL_MODULES),$(if $(wildcard $(KERNEL_MODULE_DIR)/$(k)), $(k)))
-KERNEL_MODULES += $(addprefix $(KERNEL_MODULE_DIR)/, $(BOARD_VENDOR_RAMDISK_KERNEL_MODULES_LOAD_EXTRA))
 
 # Kernel modules that are listed in vendor_boot.modules.load
 BOARD_VENDOR_RAMDISK_KERNEL_MODULES_LOAD_FILE := $(strip $(shell cat $(KERNEL_MODULE_DIR)/vendor_boot.modules.load))
diff --git a/conf/init.gs101.rc b/conf/init.gs101.rc
index d0aaabe..7185b2e 100644
--- a/conf/init.gs101.rc
+++ b/conf/init.gs101.rc
@@ -829,10 +829,12 @@
     write /sys/module/debug_kinfo/parameters/build_info ${ro.build.fingerprint}
 
 # Bluetooth
-on post-fs-data
+on early-boot
     chown bluetooth system /sys/devices/platform/175b0000.serial/serial0/serial0-0/bluetooth/hci0/rfkill0/state
     chown bluetooth system /sys/devices/platform/odm/odm:btbcm/rfkill/rfkill0/state
     chown bluetooth system /sys/devices/platform/odm/odm:btbcm/rfkill/rfkill2/state
+
+on post-fs-data
     chown bluetooth system /proc/bluetooth/sleep/btwake
     chown bluetooth system /proc/bluetooth/sleep/lpm
     chown bluetooth system /proc/bluetooth/sleep/btwrite
diff --git a/default-permissions.xml b/default-permissions.xml
index fb5ed94..3ba6011 100644
--- a/default-permissions.xml
+++ b/default-permissions.xml
@@ -55,7 +55,6 @@
         <!-- Camera -->
         <permission name="android.permission.CAMERA" fixed="false"/>
         <!-- Camera Connectivity -->
-        <permission name="android.permission.ACCESS_FINE_LOCATION" fixed="false"/>
         <permission name="android.permission.POST_NOTIFICATIONS" fixed="false"/>
         <permission name="android.permission.BLUETOOTH_CONNECT" fixed="false"/>
         <permission name="android.permission.BLUETOOTH_SCAN" fixed="false"/>
@@ -73,6 +72,8 @@
         <permission name="android.permission.ACTIVITY_RECOGNITION" fixed="false"/>
         <!-- Notifications -->
         <permission name="android.permission.POST_NOTIFICATIONS" fixed="false"/>
+        <!-- Used by Bluetooth Module to collect bluetooth info -->
+        <permission name="android.permission.BLUETOOTH_CONNECT" fixed="false"/>
     </exception>
 
     <exception
diff --git a/device.mk b/device.mk
index f271502..8df5b3f 100644
--- a/device.mk
+++ b/device.mk
@@ -16,7 +16,7 @@
 
 include device/google/gs-common/device.mk
 include device/google/gs-common/gs_watchdogd/watchdog.mk
-include device/google/gs-common/ramdump/ramdump.mk
+include device/google/gs-common/ramdump_and_coredump/ramdump_and_coredump.mk
 include device/google/gs-common/soc/soc.mk
 include device/google/gs-common/soc/freq.mk
 include device/google/gs-common/modem/modem.mk
@@ -36,9 +36,11 @@
 include device/google/gs-common/misc_writer/misc_writer.mk
 include device/google/gs-common/gyotaku_app/gyotaku.mk
 include device/google/gs-common/bootctrl/bootctrl_aidl.mk
+include device/google/gs-common/betterbug/betterbug.mk
 ifneq ($(filter oriole raven bluejay, $(TARGET_PRODUCT)),)
   include device/google/gs-common/bcmbt/dump/dumplog.mk
 endif
+include device/google/gs-common/fingerprint/fingerprint.mk
 
 TARGET_BOARD_PLATFORM := gs101
 DEVICE_IS_64BIT_ONLY ?= $(if $(filter %_64,$(TARGET_PRODUCT)),true,false)
@@ -179,6 +181,11 @@
 	telephony.active_modems.max_count=2
 
 USE_LASSEN_OEMHOOK := true
+# The "power-anomaly-sitril" is added into PRODUCT_SOONG_NAMESPACES when
+# $(USE_LASSEN_OEMHOOK) is true and $(BOARD_WITHOUT_RADIO) is not true.
+ifneq ($(BOARD_WITHOUT_RADIO),true)
+    PRODUCT_SOONG_NAMESPACES += vendor/google/tools/power-anomaly-sitril
+endif
 
 # Use for GRIL
 USES_LASSEN_MODEM := true
@@ -239,9 +246,8 @@
 	frameworks/native/data/etc/android.hardware.vulkan.version-1_3.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.version.xml \
 	frameworks/native/data/etc/android.hardware.vulkan.level-1.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.level.xml \
 	frameworks/native/data/etc/android.hardware.vulkan.compute-0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.compute.xml \
-	frameworks/native/data/etc/android.software.contextualsearch.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.contextualsearch.xml \
-	frameworks/native/data/etc/android.software.vulkan.deqp.level-2023-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.vulkan.deqp.level.xml \
-	frameworks/native/data/etc/android.software.opengles.deqp.level-2023-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.opengles.deqp.level.xml
+	frameworks/native/data/etc/android.software.vulkan.deqp.level-2024-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.vulkan.deqp.level.xml \
+	frameworks/native/data/etc/android.software.opengles.deqp.level-2024-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.opengles.deqp.level.xml
 
 ifeq ($(USE_SWIFTSHADER),true)
 PRODUCT_VENDOR_PROPERTIES += \
@@ -510,10 +516,6 @@
 
 # for now include gralloc here. should come from hardware/google_devices/exynos5
 PRODUCT_PACKAGES += \
-	android.hardware.graphics.mapper@4.0-impl \
-	android.hardware.graphics.allocator-V1-service
-
-PRODUCT_PACKAGES += \
 	android.hardware.memtrack-service.pixel \
 	libion_exynos \
 	libion
@@ -744,6 +746,8 @@
 PRODUCT_PROPERTY_OVERRIDES += \
 	debug.stagefright.c2inputsurface=-1 \
 
+PRODUCT_PROPERTY_OVERRIDES += media.c2.hal.selection=aidl
+
 # 2. OpenMAX IL
 PRODUCT_COPY_FILES += \
 	device/google/gs101/media_codecs.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs.xml \
@@ -795,7 +799,9 @@
 include device/google/gs-common/trusty/trusty.mk
 
 # Trusty unit test tool
-PRODUCT_PACKAGES_DEBUG += trusty-ut-ctrl
+PRODUCT_PACKAGES_DEBUG += \
+    trusty-ut-ctrl \
+    tipc-test
 
 include device/google/gs101/confirmationui/confirmationui.mk
 
@@ -820,6 +826,10 @@
 	persist.bluetooth.bqr.min_interval_ms=500
 endif
 
+# Enable Bluetooth AutoOn feature
+PRODUCT_PRODUCT_PROPERTIES += \
+    bluetooth.server.automatic_turn_on=true
+
 #VNDK
 PRODUCT_PACKAGES += \
 	vndk-libs
@@ -1026,7 +1036,9 @@
 	vendor/google_devices/gs101/proprietary/gchips/tpu/darwinn_logging_service \
 	vendor/google_devices/gs101/proprietary/gchips/tpu/nnapi_stable_aidl \
 	vendor/google_devices/gs101/proprietary/gchips/tpu/aidl \
-	vendor/google_devices/gs101/proprietary/gchips/tpu/hal
+	vendor/google_devices/gs101/proprietary/gchips/tpu/hal \
+	vendor/google_devices/gs101/proprietary/gchips/tpu/tachyon/api \
+	vendor/google_devices/gs101/proprietary/gchips/tpu/tachyon/service
 # TPU firmware
 PRODUCT_PACKAGES += edgetpu-abrolhos.fw
 
@@ -1119,3 +1131,10 @@
 
 # Touch service
 include device/google/gs-common/touch/twoshay/aidl_gs101.mk
+include device/google/gs-common/touch/twoshay/twoshay.mk
+
+# Allow longer timeout for incident report generation in bugreport
+# Overriding in /product partition instead of /vendor intentionally,
+# since it can't be overridden from /vendor.
+PRODUCT_PRODUCT_PROPERTIES += \
+	dumpstate.strict_run=false
diff --git a/device_framework_matrix_product.xml b/device_framework_matrix_product.xml
index e365bbb..95c2113 100644
--- a/device_framework_matrix_product.xml
+++ b/device_framework_matrix_product.xml
@@ -78,7 +78,7 @@
     </hal>
     <hal format="aidl" optional="true">
       <name>com.google.hardware.pixel.display</name>
-        <version>10</version>
+        <version>12</version>
         <interface>
             <name>IDisplay</name>
             <instance>default</instance>
diff --git a/manifest_media.xml b/manifest_media.xml
index 38e56ba..5254429 100644
--- a/manifest_media.xml
+++ b/manifest_media.xml
@@ -1,20 +1,12 @@
 <manifest version="1.0" type="device">
-    <hal format="hidl">
+    <hal format="aidl">
         <name>android.hardware.media.c2</name>
-        <transport>hwbinder</transport>
-        <version>1.0</version>
-        <interface>
-            <name>IComponentStore</name>
-            <instance>default1</instance>
-        </interface>
+        <version>1</version>
+        <fqname>IComponentStore/default1</fqname>
     </hal>
-    <hal format="hidl">
+    <hal format="aidl">
         <name>android.hardware.media.c2</name>
-        <transport>hwbinder</transport>
-        <version>1.2</version>
-        <interface>
-            <name>IComponentStore</name>
-            <instance>default</instance>
-        </interface>
+        <version>1</version>
+        <fqname>IComponentStore/default</fqname>
     </hal>
 </manifest>
diff --git a/manifest_media_aosp.xml b/manifest_media_aosp.xml
index 9a1a3db..d92e4a2 100644
--- a/manifest_media_aosp.xml
+++ b/manifest_media_aosp.xml
@@ -8,4 +8,9 @@
             <instance>default</instance>
         </interface>
     </hal>
+    <hal format="aidl">
+        <name>android.hardware.media.c2</name>
+        <version>1</version>
+        <fqname>IComponentStore/default</fqname>
+    </hal>
 </manifest>
diff --git a/media_codecs_aosp_c2.xml b/media_codecs_aosp_c2.xml
index cddd617..534c5f4 100644
--- a/media_codecs_aosp_c2.xml
+++ b/media_codecs_aosp_c2.xml
@@ -100,7 +100,7 @@
         </MediaCodec>
         <MediaCodec name="c2.exynos.vp8.decoder" type="video/x-vnd.on2.vp8" >
             <Limit name="size" min="32x32" max="3840x2160" />
-            <Limit name="alignment" value="2x2" />
+            <Limit name="alignment" value="1x1" />
             <Limit name="block-size" value="16x16" />
             <Limit name="block-count" range="1-32400" />
             <Limit name="blocks-per-second" min="1" max="3888000" />
@@ -113,7 +113,7 @@
         </MediaCodec>
         <MediaCodec name="c2.exynos.vp9.decoder" type="video/x-vnd.on2.vp9" >
             <Limit name="size" min="64x64" max="3840x2176" />
-            <Limit name="alignment" value="2x2" />
+            <Limit name="alignment" value="1x1" />
             <Limit name="block-size" value="64x64" />
             <Limit name="block-count" range="1-2040" />
             <Limit name="blocks-per-second" min="1" max="3888000" />
@@ -126,7 +126,7 @@
         </MediaCodec>
         <MediaCodec name="c2.exynos.vp9.decoder.secure" type="video/x-vnd.on2.vp9" >
             <Limit name="size" min="64x64" max="3840x2176" />
-            <Limit name="alignment" value="2x2" />
+            <Limit name="alignment" value="1x1" />
             <Limit name="block-size" value="64x64" />
             <Limit name="block-count" range="1-2040" />
             <Limit name="blocks-per-second" min="1" max="3888000" />
@@ -203,7 +203,7 @@
         </MediaCodec>
         <MediaCodec name="c2.exynos.vp8.encoder" type="video/x-vnd.on2.vp8" >
             <Limit name="size" min="32x32" max="3840x2160" />
-            <Limit name="alignment" value="2x2" />
+            <Limit name="alignment" value="1x1" />
             <Limit name="block-size" value="16x16" />
             <Limit name="block-count" range="1-32400" />
             <Limit name="blocks-per-second" min="1" max="3888000" />
@@ -218,7 +218,7 @@
         </MediaCodec>
         <MediaCodec name="c2.exynos.vp9.encoder" type="video/x-vnd.on2.vp9" >
             <Limit name="size" min="64x64" max="3840x2176" />
-            <Limit name="alignment" value="2x2" />
+            <Limit name="alignment" value="1x1" />
             <Limit name="block-size" value="64x64" />
             <Limit name="block-count" range="1-2040" />
             <Limit name="blocks-per-second" min="1" max="243000" />
diff --git a/media_codecs_bo_c2.xml b/media_codecs_bo_c2.xml
index 40c81ff..7dd1043 100644
--- a/media_codecs_bo_c2.xml
+++ b/media_codecs_bo_c2.xml
@@ -19,7 +19,7 @@
     <Decoders>
         <MediaCodec name="c2.google.av1.decoder" type="video/av01">
           <Limit name="size" min="96x96" max="3840x2160" />
-          <Limit name="alignment" value="2x2" />
+          <Limit name="alignment" value="1x1" />
           <Limit name="block-size" value="16x16" />
           <Limit name="block-count" range="36-32400" />
           <Limit name="blocks-per-second" min="24" max="1944000" />
@@ -34,7 +34,7 @@
         </MediaCodec>
         <MediaCodec name="c2.google.av1.decoder.secure" type="video/av01">
           <Limit name="size" min="96x96" max="3840x2160" />
-          <Limit name="alignment" value="2x2" />
+          <Limit name="alignment" value="1x1" />
           <Limit name="block-size" value="16x16" />
           <Limit name="block-count" range="36-32400" />
           <Limit name="blocks-per-second" min="24" max="1944000" />
diff --git a/media_codecs_performance_c2.xml b/media_codecs_performance_c2.xml
index 49f131f..04daa35 100644
--- a/media_codecs_performance_c2.xml
+++ b/media_codecs_performance_c2.xml
@@ -115,20 +115,20 @@
         </MediaCodec>
         <MediaCodec name="c2.android.avc.decoder" type="video/avc" update="true">
             <!-- measured 90%:342-360 med:343 N=2 -->
-            <Limit name="measured-frame-rate-320x240" range="342-351" /> <!-- v90%=1.0 -->
+            <Limit name="measured-frame-rate-320x240" range="542-971" /> <!-- v90%=1.0 -->
             <!-- measured 90%:142-147 med:143 N=2 -->
-            <Limit name="measured-frame-rate-720x480" range="142-145" /> <!-- v90%=1.0 -->
+            <Limit name="measured-frame-rate-720x480" range="162-301" /> <!-- v90%=1.0 -->
             <!-- measured 90%:54-56 med:55 N=2 -->
-            <Limit name="measured-frame-rate-1280x720" range="54-55" /> <!-- v90%=1.0 -->
+            <Limit name="measured-frame-rate-1280x720" range="54-77" /> <!-- v90%=1.0 -->
             <!-- measured 90%:25-26 med:26 N=2 -->
-            <Limit name="measured-frame-rate-1920x1080" range="25-26" /> <!-- v90%=1.0 -->
+            <Limit name="measured-frame-rate-1920x1080" range="25-34" /> <!-- v90%=1.0 -->
         </MediaCodec>
         <MediaCodec name="c2.android.hevc.decoder" type="video/hevc" update="true">
-            <Limit name="measured-frame-rate-352x288" range="583-674" /> <!-- N=20 v90%=1.0 -->
-            <Limit name="measured-frame-rate-640x360" range="337-352" /> <!-- v90%=1.0 -->
-            <Limit name="measured-frame-rate-720x480" range="312-324" /> <!-- v90%=1.0 -->
-            <Limit name="measured-frame-rate-1280x720" range="104-108" /> <!-- v90%=1.0 -->
-            <Limit name="measured-frame-rate-1920x1080" range="54-56" /> <!-- v90%=1.0 -->
+            <Limit name="measured-frame-rate-352x288" range="583-972" /> <!-- N=20 v90%=1.0 -->
+            <Limit name="measured-frame-rate-640x360" range="337-537" /> <!-- v90%=1.0 -->
+            <Limit name="measured-frame-rate-720x480" range="312-470" /> <!-- v90%=1.0 -->
+            <Limit name="measured-frame-rate-1280x720" range="104-165" /> <!-- v90%=1.0 -->
+            <Limit name="measured-frame-rate-1920x1080" range="54-68" /> <!-- v90%=1.0 -->
         </MediaCodec>
         <MediaCodec name="c2.android.mpeg4.decoder" type="video/mp4v-es" update="true">
             <Limit name="measured-frame-rate-176x144" range="1215-1823" />
diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml
index a32fd94..964ebf6 100644
--- a/overlay/frameworks/base/core/res/res/values/config.xml
+++ b/overlay/frameworks/base/core/res/res/values/config.xml
@@ -237,8 +237,8 @@
     <!-- Should the pinner service pin the Camera application? -->
     <bool name="config_pinnerCameraApp">true</bool>
 
-    <!-- Should the pinner service pin the Home application? -->
-    <bool name="config_pinnerHomeApp">true</bool>
+    <!-- Bytes that the PinnerService will pin for Home app -->
+    <integer name="config_pinnerHomePinBytes">6291456</integer>
 
      <!-- Bytes that the PinnerService will pin for WebView -->
     <integer name="config_pinnerWebviewPinBytes">20971520</integer>
diff --git a/pixelstats/service.cpp b/pixelstats/service.cpp
index d4b803a..d846146 100644
--- a/pixelstats/service.cpp
+++ b/pixelstats/service.cpp
@@ -73,18 +73,21 @@
             "/sys/class/power_supply/maxfg/gmsr",
             "/sys/class/power_supply/maxfg_base/gmsr",
         },
+        .FGModelLoadingPath = {
+            "/sys/class/power_supply/maxfg/m5_model_state"
+        },
+	.FGLogBufferPath = {
+            "/dev/logbuffer_maxfg_monitor",
+            "/dev/logbuffer_max77779fg_monitor",
+            "/dev/logbuffer_maxfg_base_monitor",
+            "/dev/logbuffer_maxfg_secondary_monitor"
+        }
 };
 
 const struct UeventListener::UeventPaths ueventPaths = {
         .AudioUevent = "/devices/virtual/amcs/amcs",
         .TypeCPartnerUevent = "PRODUCT_TYPE=",
-        .FGLearningPath = {
-            "/sys/class/power_supply/maxfg/fg_learning_events"
-        },
-        .FwUpdatePath = "",
-        .FGModelLoadingPath = {
-            "/sys/class/power_supply/maxfg/m5_model_state"
-        }
+        .FwUpdatePath = ""
 };
 
 int main() {
diff --git a/rro_overlays/WifiOverlay/res/values/config.xml b/rro_overlays/WifiOverlay/res/values/config.xml
index 454d7f8..bba7b86 100644
--- a/rro_overlays/WifiOverlay/res/values/config.xml
+++ b/rro_overlays/WifiOverlay/res/values/config.xml
@@ -167,4 +167,10 @@
          If equals to 0, it means there's no limit on the max number of channels to include per network.-->
     <integer translatable="false" name="config_wifiInitialPartialScanMaxNewChannelsPerNetwork">3</integer>
 
+    <!-- Boolean indicating whether to disable firmware roaming when the device goes into idle mode.
+         true: firmware roaming will be disabled when the device goes into idle mode, and then
+               re-activated when the device exits idle mode.
+         false: firmware roaming will not be affected. -->
+    <bool translatable="false" name ="config_wifiDisableFirmwareRoamingInIdleMode">true</bool>
+
 </resources>
diff --git a/telephony/pktrouter.mk b/telephony/pktrouter.mk
index dd923b5..7af3422 100644
--- a/telephony/pktrouter.mk
+++ b/telephony/pktrouter.mk
@@ -1,3 +1,5 @@
 PRODUCT_PACKAGES += wfc-pkt-router
 PRODUCT_PROPERTY_OVERRIDES += vendor.pktrouter=1
 BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs101-sepolicy/telephony/pktrouter
+PRODUCT_ARTIFACT_PATH_REQUIREMENT_ALLOWED_LIST += \
+    $(TARGET_COPY_OUT_SYSTEM)/bin/oem-iptables-init.sh
diff --git a/usb/usb/Android.bp b/usb/usb/Android.bp
index 5afdcc6..fa7a07f 100644
--- a/usb/usb/Android.bp
+++ b/usb/usb/Android.bp
@@ -52,6 +52,7 @@
         "libbinder_ndk",
         "libprotobuf-cpp-lite",
         "server_configurable_flags",
+        "libaconfig_storage_read_api_cc",
     ],
     static_libs: [
         "libpixelusb",