[automerger skipped] Merge Android 24Q1 Release (ab/11220357) am: 099b593e11 -s ours

am skip reason: Merged-In Id61bda25845fd181ade10f12e3bc3554db4f6978 with SHA-1 302f0a318f is already in history

Original change: https://googleplex-android-review.googlesource.com/c/device/google/felix/+/25973104

Change-Id: Icf8dee4fd5a04957e84f96c15b3a0268da4ce317
Signed-off-by: Automerger Merge Worker <[email protected]>
diff --git a/audio/felix/config/audio_policy_configuration.xml b/audio/felix/config/audio_policy_configuration.xml
index 1b44390..94e9d3f 100644
--- a/audio/felix/config/audio_policy_configuration.xml
+++ b/audio/felix/config/audio_policy_configuration.xml
@@ -93,7 +93,7 @@
                              samplingRates="8000 11025 12000 16000 22050 24000 32000 44100 48000"
                              channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO"/>
                 </mixPort>
-                <mixPort name="incall capture" role="sink">
+                <mixPort name="incall capture" role="sink" maxActiveCount="2" maxOpenCount="2">
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
                              samplingRates="48000"
                              channelMasks="AUDIO_CHANNEL_IN_MONO"/>
diff --git a/audio/felix/config/audio_policy_configuration_a2dp_offload_disabled.xml b/audio/felix/config/audio_policy_configuration_a2dp_offload_disabled.xml
index eb8560c..da6c7a7 100644
--- a/audio/felix/config/audio_policy_configuration_a2dp_offload_disabled.xml
+++ b/audio/felix/config/audio_policy_configuration_a2dp_offload_disabled.xml
@@ -92,7 +92,7 @@
                              samplingRates="8000 11025 12000 16000 22050 24000 32000 44100 48000"
                              channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO"/>
                 </mixPort>
-                <mixPort name="incall capture" role="sink">
+                <mixPort name="incall capture" role="sink" maxActiveCount="2" maxOpenCount="2">
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
                              samplingRates="48000"
                              channelMasks="AUDIO_CHANNEL_IN_MONO"/>
diff --git a/audio/felix/config/audio_policy_configuration_bluetooth_legacy_hal.xml b/audio/felix/config/audio_policy_configuration_bluetooth_legacy_hal.xml
index 1863d5a..416d4ab 100644
--- a/audio/felix/config/audio_policy_configuration_bluetooth_legacy_hal.xml
+++ b/audio/felix/config/audio_policy_configuration_bluetooth_legacy_hal.xml
@@ -88,7 +88,7 @@
                              samplingRates="8000 11025 12000 16000 22050 24000 32000 44100 48000"
                              channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO"/>
                 </mixPort>
-                <mixPort name="incall capture" role="sink">
+                <mixPort name="incall capture" role="sink" maxActiveCount="2" maxOpenCount="2">
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
                              samplingRates="48000"
                              channelMasks="AUDIO_CHANNEL_IN_MONO"/>
diff --git a/audio/felix/config/audio_policy_configuration_le_offload_disabled.xml b/audio/felix/config/audio_policy_configuration_le_offload_disabled.xml
index bf54670..0745b2f 100644
--- a/audio/felix/config/audio_policy_configuration_le_offload_disabled.xml
+++ b/audio/felix/config/audio_policy_configuration_le_offload_disabled.xml
@@ -93,7 +93,7 @@
                              samplingRates="8000 11025 12000 16000 22050 24000 32000 44100 48000"
                              channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO"/>
                 </mixPort>
-                <mixPort name="incall capture" role="sink">
+                <mixPort name="incall capture" role="sink" maxActiveCount="2" maxOpenCount="2">
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
                              samplingRates="48000"
                              channelMasks="AUDIO_CHANNEL_IN_MONO"/>
diff --git a/conf/init.felix.rc b/conf/init.felix.rc
index ed12a3c..47475e3 100644
--- a/conf/init.felix.rc
+++ b/conf/init.felix.rc
@@ -18,6 +18,7 @@
     chown system system /sys/class/backlight/panel1-backlight/dimming_on
     chown system system /sys/class/backlight/panel1-backlight/hbm_mode
     chown system system /sys/class/backlight/panel1-backlight/local_hbm_mode
+    chown system system /sys/class/backlight/panel1-backlight/allow_wakeup_by_state_change
     chown system system /sys/devices/platform/exynos-drm/secondary-panel/gamma
     chown system system /sys/devices/platform/exynos-drm/secondary-panel/min_vrefresh
     chown system system /sys/devices/platform/exynos-drm/secondary-panel/idle_delay_ms
diff --git a/device-felix.mk b/device-felix.mk
index b1a0caa..e2489f4 100644
--- a/device-felix.mk
+++ b/device-felix.mk
@@ -21,6 +21,15 @@
 TARGET_BOARD_KERNEL_HEADERS := device/google/felix-kernel/kernel-headers
 TARGET_RECOVERY_DEFAULT_ROTATION := ROTATION_RIGHT
 
+ifdef RELEASE_GOOGLE_FELIX_KERNEL_VERSION
+TARGET_LINUX_KERNEL_VERSION := $(RELEASE_GOOGLE_FELIX_KERNEL_VERSION)
+endif
+
+ifdef RELEASE_GOOGLE_FELIX_KERNEL_DIR
+TARGET_KERNEL_DIR := $(RELEASE_GOOGLE_FELIX_KERNEL_DIR)
+TARGET_BOARD_KERNEL_HEADERS := $(RELEASE_GOOGLE_FELIX_KERNEL_DIR)/kernel-headers
+endif
+
 $(call inherit-product-if-exists, vendor/google_devices/felix/prebuilts/device-vendor-felix.mk)
 $(call inherit-product-if-exists, vendor/google_devices/gs201/prebuilts/device-vendor.mk)
 $(call inherit-product-if-exists, vendor/google_devices/gs201/proprietary/device-vendor.mk)
@@ -211,7 +220,7 @@
 
 # Increment the SVN for any official public releases
 PRODUCT_VENDOR_PROPERTIES += \
-    ro.vendor.build.svn=37
+    ro.vendor.build.svn=42
 
 # Vibrator HAL
 PRODUCT_VENDOR_PROPERTIES +=\
@@ -395,3 +404,12 @@
 PRODUCT_PRODUCT_PROPERTIES += \
     ro.quick_start.oem_id=00e0 \
     ro.quick_start.device_id=felix
+
+# Set support hide display cutout feature
+PRODUCT_PRODUCT_PROPERTIES += \
+    ro.support_hide_display_cutout=true
+
+PRODUCT_PACKAGES += \
+    NoCutoutOverlay \
+    AvoidAppsInCutoutOverlay
+
diff --git a/location/gps.xml.f10 b/location/gps.xml.f10
index e2cd884..a47afb2 100644
--- a/location/gps.xml.f10
+++ b/location/gps.xml.f10
@@ -60,7 +60,7 @@
        CpLppeUseAgnssLocForEmptyDbh="true"
        CpLppHighAccuracyShapeMode="1"
        ReAidingOnHotStart="false"
-       ReAidingIntervalSec="1200"
+       ReAidingIntervalSec="3600"
        RuntimeSwLteFilterEnable="true"
        PpsDevice="/sys/class/pps/pps0/assert_elapsed"
        SensorsMask="0x244"
@@ -93,6 +93,8 @@
        MinGpsWeekNumber="2216"
        OnChipAccMask="50"
        EnableB1C="false"
+
+       RTICacheTimeoutSec="3600"
   />
 
   <gll_features
diff --git a/location/gps_user.xml.f10 b/location/gps_user.xml.f10
index b0c3fdf..19842ca 100644
--- a/location/gps_user.xml.f10
+++ b/location/gps_user.xml.f10
@@ -59,7 +59,7 @@
        CpLppeUseAgnssLocForEmptyDbh="true"
        CpLppHighAccuracyShapeMode="1"
        ReAidingOnHotStart="false"
-       ReAidingIntervalSec="1200"
+       ReAidingIntervalSec="3600"
        RuntimeSwLteFilterEnable="true"
        PpsDevice="/sys/class/pps/pps0/assert_elapsed"
        SensorsMask="0x244"
@@ -92,6 +92,8 @@
        MinGpsWeekNumber="2216"
        OnChipAccMask="50"
        EnableB1C="false"
+
+       RTICacheTimeoutSec="3600"
   />
 
   <gll_features
diff --git a/powerhint.json b/powerhint.json
index fbcc819..20cd066 100644
--- a/powerhint.json
+++ b/powerhint.json
@@ -785,6 +785,17 @@
       "Value": "LAUNCH_EXTEND"
     },
     {
+      "PowerHint": "LAUNCH",
+      "Type": "DoHint",
+      "Value": "LAUNCH_PMU"
+    },
+    {
+      "PowerHint": "LAUNCH_PMU",
+      "Node": "PMU_POLL",
+      "Duration": 3000,
+      "Value": "0"
+    },
+    {
       "PowerHint": "LAUNCH_EXTEND",
       "Node": "CPUBigClusterMaxFreq",
       "Duration": 2000,
@@ -940,6 +951,12 @@
       "Value": "4-7"
     },
     {
+      "PowerHint": "CAMERA_LAUNCH",
+      "Node": "PMU_POLL",
+      "Duration": 1000,
+      "Value": "0"
+    },
+    {
       "PowerHint": "CAMERA_LAUNCH_EXTENDED",
       "Node": "CPUBigClusterMaxFreq",
       "Duration": 2000,
@@ -964,6 +981,12 @@
       "Value": "0"
     },
     {
+      "PowerHint": "CAMERA_LAUNCH_EXTENDED",
+      "Node": "PMU_POLL",
+      "Duration": 2000,
+      "Value": "0"
+    },
+    {
       "PowerHint": "CAMERA_THERMAL_CPU_THROTTLE",
       "Node": "CPUBigClusterMaxFreq",
       "Duration": 1000,
@@ -984,22 +1007,34 @@
     {
       "PowerHint": "CAMERA_CAPTURE_CPU_THROTTLE",
       "Node": "CPUBigClusterMaxFreq",
-      "Duration": 1000,
+      "Duration": 2500,
       "Value": "1826000"
     },
     {
       "PowerHint": "CAMERA_CAPTURE_CPU_THROTTLE",
       "Node": "CPUMidClusterMaxFreq",
-      "Duration": 1000,
+      "Duration": 2500,
       "Value": "1491000"
     },
     {
       "PowerHint": "CAMERA_CAPTURE_CPU_THROTTLE",
       "Node": "CPULittleClusterMaxFreq",
-      "Duration": 1000,
+      "Duration": 2500,
       "Value": "1401000"
     },
     {
+      "PowerHint": "CAMERA_CAPTURE_CPU_THROTTLE",
+      "Node": "PMU_POLL",
+      "Duration": 2500,
+      "Value": "0"
+    },
+    {
+      "PowerHint": "CAMERA_CAPTURE_CPU_THROTTLE",
+      "Node": "EM_Profile",
+      "Duration": 2500,
+      "Value": "default"
+    },
+    {
       "PowerHint": "CAMERA_SHOT",
       "Node": "MemFreq",
       "Duration": 300,
@@ -1469,12 +1504,6 @@
     },
     {
       "PowerHint": "CAMERA_STREAMING_STANDARD",
-      "Node": "CDPreferIdle",
-      "Duration": 0,
-      "Value": "0"
-    },
-    {
-      "PowerHint": "CAMERA_STREAMING_STANDARD",
       "Node": "PMU_POLL",
       "Duration": 0,
       "Value": "1"
diff --git a/powerstats/felix/service.cpp b/powerstats/felix/service.cpp
index 2de3797..dd10ef1 100644
--- a/powerstats/felix/service.cpp
+++ b/powerstats/felix/service.cpp
@@ -38,36 +38,50 @@
 
 void addDisplay(std::shared_ptr<PowerStats> p) {
     // Add display residency stats for inner display
-    std::vector<std::string> inner_states = {
-        "Off",
-        "LP: 1840x2208@1",
-        "LP: 1840x2208@30",
-        "On: 1840x2208@1",
-        "On: 1840x2208@10",
-        "On: 1840x2208@60",
-        "On: 1840x2208@120",
-        "HBM: 1840x2208@60",
-        "HBM: 1840x2208@120"};
+    struct stat primaryBuffer;
+    if (!stat("/sys/class/drm/card0/device/primary-panel/time_in_state", &primaryBuffer)) {
+        // time_in_state exists
+        addDisplayMrrByEntity(p, "Inner Display", "/sys/class/drm/card0/device/primary-panel/");
+    } else {
+        // time_in_state doesn't exist
+        std::vector<std::string> inner_states = {
+            "Off",
+            "LP: 1840x2208@1",
+            "LP: 1840x2208@30",
+            "On: 1840x2208@1",
+            "On: 1840x2208@10",
+            "On: 1840x2208@60",
+            "On: 1840x2208@120",
+            "HBM: 1840x2208@60",
+            "HBM: 1840x2208@120"};
 
-    p->addStateResidencyDataProvider(std::make_unique<DisplayStateResidencyDataProvider>(
-            "Inner Display",
-            "/sys/class/backlight/panel0-backlight/state",
-            inner_states));
+        p->addStateResidencyDataProvider(std::make_unique<DisplayStateResidencyDataProvider>(
+                "Inner Display",
+                "/sys/class/backlight/panel0-backlight/state",
+                inner_states));
+    }
 
     // Add display residency stats for outer display
-    std::vector<std::string> outer_states = {
-        "Off",
-        "LP: 1080x2092@30",
-        "On: 1080x2092@10",
-        "On: 1080x2092@60",
-        "On: 1080x2092@120",
-        "HBM: 1080x2092@60",
-        "HBM: 1080x2092@120"};
+    struct stat secondaryBuffer;
+    if (!stat("/sys/class/drm/card0/device/secondary-panel/time_in_state", &secondaryBuffer)) {
+        // time_in_state exists
+        addDisplayMrrByEntity(p, "Outer Display", "/sys/class/drm/card0/device/secondary-panel/");
+    } else {
+        // time_in_state doesn't exist
+        std::vector<std::string> outer_states = {
+            "Off",
+            "LP: 1080x2092@30",
+            "On: 1080x2092@10",
+            "On: 1080x2092@60",
+            "On: 1080x2092@120",
+            "HBM: 1080x2092@60",
+            "HBM: 1080x2092@120"};
 
-    p->addStateResidencyDataProvider(std::make_unique<DisplayStateResidencyDataProvider>(
-            "Outer Display",
-            "/sys/class/backlight/panel1-backlight/state",
-            outer_states));
+        p->addStateResidencyDataProvider(std::make_unique<DisplayStateResidencyDataProvider>(
+                "Outer Display",
+                "/sys/class/backlight/panel1-backlight/state",
+                outer_states));
+    }
 
     // Add display energy consumer
     p->addEnergyConsumer(PowerStatsEnergyConsumer::createMeterConsumer(
diff --git a/rro_overlays/WifiOverlay/res/values/config.xml b/rro_overlays/WifiOverlay/res/values/config.xml
index 94f377b..8079614 100644
--- a/rro_overlays/WifiOverlay/res/values/config.xml
+++ b/rro_overlays/WifiOverlay/res/values/config.xml
@@ -167,4 +167,12 @@
          regulatory approval (for example, FCC pre-approval is required according to "594280 D01
          Software Configuration Control v02r01").-->
     <bool translatable="false" name ="config_wifiUpdateCountryCodeFromScanResultGeneric">true</bool>
+
+    <!-- Boolean indicating performing a partial initial scan is enabled -->
+    <bool translatable="false" name="config_wifiEnablePartialInitialScan">true</bool>
+
+    <!-- Configure the max number of new channels to add into the initial partial scan list per network.
+         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>
+
 </resources>
diff --git a/self-extractors/extract-lists.txt b/self-extractors/extract-lists.txt
index 9fc0800..c783a92 100644
--- a/self-extractors/extract-lists.txt
+++ b/self-extractors/extract-lists.txt
@@ -11,7 +11,6 @@
             system_ext/lib64/libmediaadaptor.so \
             system_ext/priv-app/ShannonRcs/ShannonRcs.apk \
             system_ext/priv-app/ShannonIms/ShannonIms.apk \
-            system_ext/priv-app/PixelQualifiedNetworksService/PixelQualifiedNetworksService.apk \
             system_ext/priv-app/UwbVendorService/UwbVendorService.apk \
             "
     ;;
diff --git a/self-extractors/google_devices/staging/Android.mk.template b/self-extractors/google_devices/staging/Android.mk.template
index 01369bf..f1eb6b1 100644
--- a/self-extractors/google_devices/staging/Android.mk.template
+++ b/self-extractors/google_devices/staging/Android.mk.template
@@ -24,22 +24,6 @@
 ifneq ($(filter felix,$(TARGET_DEVICE)),)
 include $(CLEAR_VARS)
 LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
-LOCAL_MODULE := PixelQualifiedNetworksService
-LOCAL_MODULE_TAGS := optional
-LOCAL_BUILT_MODULE_STEM := package.apk
-LOCAL_SYSTEM_EXT_MODULE := true
-LOCAL_PRIVILEGED_MODULE := true
-LOCAL_MODULE_OWNER := samsung
-LOCAL_MODULE_CLASS := APPS
-LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
-LOCAL_CERTIFICATE := platform
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../COPYRIGHT $(LOCAL_PATH)/../LICENSE
-include $(BUILD_PREBUILT)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
 LOCAL_MODULE := ShannonIms
 LOCAL_MODULE_TAGS := optional
 LOCAL_BUILT_MODULE_STEM := package.apk
diff --git a/self-extractors/google_devices/staging/device-partial.mk b/self-extractors/google_devices/staging/device-partial.mk
index 9c4717f..42c43e7 100644
--- a/self-extractors/google_devices/staging/device-partial.mk
+++ b/self-extractors/google_devices/staging/device-partial.mk
@@ -17,7 +17,6 @@
 
 # AOSP packages required by the blobs
 PRODUCT_PACKAGES := \
-    PixelQualifiedNetworksService \
     ShannonIms \
     ShannonRcs \
     UwbVendorService \
diff --git a/vibrator/cs40l26/Hardware.h b/vibrator/cs40l26/Hardware.h
index 7ad4017..22667c9 100644
--- a/vibrator/cs40l26/Hardware.h
+++ b/vibrator/cs40l26/Hardware.h
@@ -110,7 +110,7 @@
         return true;
     }
     bool setFFEffect(int fd, struct ff_effect *effect, uint16_t timeoutMs) override {
-        if (((*effect).replay.length != timeoutMs) || (ioctl(fd, EVIOCSFF, effect) < 0)) {
+        if (ioctl(fd, EVIOCSFF, effect) < 0) {
             ALOGE("setFFEffect fail");
             return false;
         } else {
diff --git a/vibrator/cs40l26/Vibrator.cpp b/vibrator/cs40l26/Vibrator.cpp
index 7d5227e..bfb7cf1 100644
--- a/vibrator/cs40l26/Vibrator.cpp
+++ b/vibrator/cs40l26/Vibrator.cpp
@@ -363,7 +363,8 @@
             mFfEffects[effectIndex] = {
                     .type = FF_PERIODIC,
                     .id = -1,
-                    .replay.length = static_cast<uint16_t>(mEffectDurations[effectIndex]),
+                    // Length == 0 to allow firmware control of the duration
+                    .replay.length = 0,
                     .u.periodic.waveform = FF_CUSTOM,
                     .u.periodic.custom_data = new int16_t[2]{RAM_WVFRM_BANK, effectIndex},
                     .u.periodic.custom_len = FF_CUSTOM_DATA_LEN,
@@ -371,9 +372,11 @@
             // Bypass the waveform update due to different input name
             if ((strstr(inputEventName, "cs40l26") != nullptr) ||
                 (strstr(inputEventName, "cs40l26_dual_input") != nullptr)) {
+                // Let the firmware control the playback duration to avoid
+                // cutting any effect that is played short
                 if (!mHwApiDef->setFFEffect(
                             mInputFd, &mFfEffects[effectIndex],
-                            static_cast<uint16_t>(mFfEffects[effectIndex].replay.length))) {
+                            mEffectDurations[effectIndex])) {
                     ALOGE("Failed upload effect %d (%d): %s", effectIndex, errno, strerror(errno));
                 }
             }
@@ -403,7 +406,8 @@
                 mFfEffectsDual[effectIndex] = {
                         .type = FF_PERIODIC,
                         .id = -1,
-                        .replay.length = static_cast<uint16_t>(mEffectDurations[effectIndex]),
+                        // Length == 0 to allow firmware control of the duration
+                        .replay.length = 0,
                         .u.periodic.waveform = FF_CUSTOM,
                         .u.periodic.custom_data = new int16_t[2]{RAM_WVFRM_BANK, effectIndex},
                         .u.periodic.custom_len = FF_CUSTOM_DATA_LEN,
@@ -411,9 +415,11 @@
                 // Bypass the waveform update due to different input name
                 if ((strstr(inputEventName, "cs40l26") != nullptr) ||
                     (strstr(inputEventName, "cs40l26_dual_input") != nullptr)) {
+                    // Let the firmware control the playback duration to avoid
+                    // cutting any effect that is played short
                     if (!mHwApiDual->setFFEffect(
                                 mInputFdDual, &mFfEffectsDual[effectIndex],
-                                static_cast<uint16_t>(mFfEffectsDual[effectIndex].replay.length))) {
+                                mEffectDurations[effectIndex])) {
                         ALOGE("Failed upload flip's effect %d (%d): %s", effectIndex, errno,
                               strerror(errno));
                     }
@@ -795,9 +801,10 @@
     if (header_count == dspmem_chunk_bytes(ch)) {
         return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
     } else {
-        mFfEffects[WAVEFORM_COMPOSE].replay.length = totalDuration;
+        // Composition duration should be 0 to allow firmware to play the whole effect
+        mFfEffects[WAVEFORM_COMPOSE].replay.length = 0;
         if (mIsDual) {
-            mFfEffectsDual[WAVEFORM_COMPOSE].replay.length = totalDuration;
+            mFfEffectsDual[WAVEFORM_COMPOSE].replay.length = 0;
         }
         return performEffect(WAVEFORM_MAX_INDEX /*ignored*/, VOLTAGE_SCALE_MAX /*ignored*/, ch,
                              callback);
@@ -1501,9 +1508,10 @@
     }
 
     *outTimeMs = timeMs;
-    mFfEffects[WAVEFORM_COMPOSE].replay.length = static_cast<uint16_t>(timeMs);
+    // Compositions should have 0 duration
+    mFfEffects[WAVEFORM_COMPOSE].replay.length = 0;
     if (mIsDual) {
-        mFfEffectsDual[WAVEFORM_COMPOSE].replay.length = static_cast<uint16_t>(timeMs);
+        mFfEffectsDual[WAVEFORM_COMPOSE].replay.length = 0;
     }
 
     return ndk::ScopedAStatus::ok();