Merge changes from topic "CameraScheduler" into rvc-d1-dev

* changes:
  camera: Set cpu set for CAMERA_STREAMING_LOW/HIGH/ULTRA
  redbull: create a new group for camera dedicated threads
diff --git a/BoardConfig-common.mk b/BoardConfig-common.mk
index 98e4914..379e714 100644
--- a/BoardConfig-common.mk
+++ b/BoardConfig-common.mk
@@ -466,7 +466,8 @@
 
 # List of modules that should not load automatically
 PRODUCT_COPY_FILES += \
-    device/google/redbull/modules.blocklist:$(TARGET_COPY_OUT_VENDOR)/lib/modules/modules.blocklist
+    device/google/redbull/modules.blocklist:$(TARGET_COPY_OUT_VENDOR)/lib/modules/modules.blocklist \
+    device/google/redbull/init.insmod.charger.cfg:$(TARGET_COPY_OUT_VENDOR)/etc/init.insmod.charger.cfg \
 
 # TARGET_BOOLOADER_BOARD_NAME sensitive common boilerplate
 
@@ -498,8 +499,6 @@
     KERNEL_MODULE_DIR := $(TARGET_KERNEL_DIR)/debug_hang
 else ifeq (,$(filter-out $(TARGET_BOOTLOADER_BOARD_NAME)_kernel_debug_api, $(TARGET_PRODUCT)))
     KERNEL_MODULE_DIR := $(TARGET_KERNEL_DIR)/debug_api
-else ifeq (,$(filter-out $(TARGET_BOOTLOADER_BOARD_NAME)_gki, $(TARGET_PRODUCT)))
-    KERNEL_MODULE_DIR := $(TARGET_KERNEL_DIR)/gki
 else
     ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
         KERNEL_MODULE_DIR := $(TARGET_KERNEL_DIR)
@@ -579,3 +578,6 @@
             $(filter $(RECOVERY_KERNEL_MODULES_FILTER),$(KERNEL_MODULES_LOAD)))
     endif
 endif
+
+# Testing related defines
+BOARD_PERFSETUP_SCRIPT := platform_testing/scripts/perf-setup/b5r3-setup.sh
diff --git a/WCNSS_qcom_cfg.ini b/WCNSS_qcom_cfg.ini
index b895f0b..a4761dc 100644
--- a/WCNSS_qcom_cfg.ini
+++ b/WCNSS_qcom_cfg.ini
@@ -494,6 +494,19 @@
 #This ini is used to enable/disable ESE feature
 EseEnabled=1
 
+# Configure max number of ndi host supports
+ndi_max_support=2
+
+# Use wake lock during user scan
+wake_lock_in_user_scan=1
+
+# To address an interop issue with a particular AP
+# Used to specify action OUIs to reconnect when assoc timeout
+gActionOUIReconnAssocTimeout=00E04C 00 01
+
+# Limit to send request to the firmware at most once in a second
+nb_commands_interval=1
+
 END
 
 # Note: Configuration parser would not read anything past the END marker
diff --git a/default-permissions.xml b/default-permissions.xml
index f19de8c..a004b7c 100644
--- a/default-permissions.xml
+++ b/default-permissions.xml
@@ -102,7 +102,7 @@
         <permission name="android.permission.ACCESS_BACKGROUND_LOCATION" fixed="false"/>
     </exception>
 
-    <exception package="com.google.android.cbrsnetworkmonitor">
+    <exception package="com.google.android.apps.cbrsnetworkmonitor">
         <!-- Location access to create CBRS geofences-->
         <permission name="android.permission.ACCESS_FINE_LOCATION" fixed="true"/>
         <permission name="android.permission.ACCESS_BACKGROUND_LOCATION" fixed="true"/>
diff --git a/device-common.mk b/device-common.mk
index b81ea48..d559bf0 100644
--- a/device-common.mk
+++ b/device-common.mk
@@ -289,13 +289,11 @@
     ro.opengles.version=196610
 
 PRODUCT_PROPERTY_OVERRIDES += \
-    ro.vendor.display.foss=1 \
     ro.vendor.display.paneltype=2 \
-    ro.vendor.display.sensortype=2 \
-    vendor.display.foss.config=1 \
-    vendor.display.foss.config_path=/vendor/etc/FOSSConfig.xml \
+    ro.vendor.display.sensortype=1 \
     vendor.display.enable_async_powermode=0 \
-    vendor.display.qdcm.mode_combine=1
+    vendor.display.qdcm.mode_combine=1 \
+    vendor.display.lbe.supported=1
 
 # vndservicemanager has been removed from API30 devices (aosp/1235751)
 # but we still need it for display services.
@@ -310,6 +308,10 @@
 PRODUCT_PROPERTY_OVERRIDES += \
     persist.camera.managebuffer.enable=1
 
+# camera enable RT thread
+PRODUCT_PROPERTY_OVERRIDES += \
+    persist.camera.realtimethread=1
+
 # Lets the vendor library that Google Camera HWL is enabled
 PRODUCT_PROPERTY_OVERRIDES += \
     persist.camera.google_hwl.enabled=true \
@@ -364,8 +366,7 @@
 
 # Light HAL
 PRODUCT_PACKAGES += \
-    lights.lito \
-    hardware.google.light@1.1-service
+    lights.lito
 
 # Memtrack HAL
 PRODUCT_PACKAGES += \
@@ -404,8 +405,6 @@
 
 # DRM HAL
 PRODUCT_PACKAGES += \
-    android.hardware.drm@1.0-impl \
-    android.hardware.drm@1.0-service \
     android.hardware.drm@1.3-service.clearkey \
     android.hardware.drm@1.3-service.widevine
 
@@ -635,7 +634,7 @@
     $(LOCAL_PATH)/seccomp_policy/mediacodec.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/mediacodec.policy
 
 PRODUCT_PROPERTY_OVERRIDES += \
-    audio.snd_card.open.retries=50
+    vendor.audio.snd_card.open.retries=50
 
 
 ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
@@ -962,6 +961,10 @@
     persist.sys.disable_rescue=true
 endif
 
+# Enable Incremental on the device via kernel module
+PRODUCT_PROPERTY_OVERRIDES += \
+        ro.incremental.enable=module:/vendor/lib/modules/incrementalfs.ko
+
 $(call inherit-product, $(SRC_TARGET_DIR)/product/virtual_ab_ota.mk)
 
 #################################################################################
diff --git a/device_framework_matrix.xml b/device_framework_matrix.xml
index b21f4d5..a5a36c9 100644
--- a/device_framework_matrix.xml
+++ b/device_framework_matrix.xml
@@ -257,14 +257,6 @@
         </interface>
     </hal>
     <hal format="hidl" optional="true">
-        <name>hardware.google.light</name>
-        <version>1.1</version>
-        <interface>
-            <name>ILight</name>
-            <instance>default</instance>
-        </interface>
-    </hal>
-    <hal format="hidl" optional="true">
         <name>vendor.qti.hardware.bluetooth_sar</name>
         <version>1.1</version>
         <interface>
@@ -361,4 +353,11 @@
             <instance>default</instance>
         </interface>
     </hal>
+    <hal format="aidl" optional="false">
+         <name>com.google.hardware.pixel.display</name>
+         <interface>
+             <name>IDisplay</name>
+             <instance>default</instance>
+         </interface>
+    </hal>
 </compatibility-matrix>
diff --git a/init.hardware.rc b/init.hardware.rc
index 553e3fe..5b5c5da 100644
--- a/init.hardware.rc
+++ b/init.hardware.rc
@@ -45,6 +45,8 @@
 # Skip init trigger for charger mode
 on early-init && property:ro.boot.mode=charger
     setprop vendor.skip.init 1
+    # Loading kernel modules in background
+    start charger_insmod_sh
 
 on init && property:vendor.skip.init=0
     # Boot time fs tuning
@@ -231,7 +233,6 @@
     start bootanim
     start vendor.qti.hardware.display.composer
     start vendor.qti.hardware.display.allocator
-    start vendor.light-1-1
 
     # Wait for keymaster HALs (TEE and StrongBox)
     exec_start wait_for_strongbox
@@ -420,6 +421,8 @@
     # Permission for battery eeprom
     chown system system /sys/devices/platform/soc/98c000.i2c/i2c-1/1-0050/1-00500/nvmem
     chmod 0640 /sys/devices/platform/soc/98c000.i2c/i2c-1/1-0050/1-00500/nvmem
+    chown system system /dev/battery_history
+    chmod 0644 /dev/battery_history
 
     # Permission for Pixelstats
     chown system system /sys/class/misc/msm_cirrus_playback/resistance_left_right
@@ -728,6 +731,13 @@
     disabled
     oneshot
 
+service charger_insmod_sh /vendor/bin/init.insmod.sh /vendor/etc/init.insmod.charger.cfg
+    class main
+    user root
+    group root system
+    disabled
+    oneshot
+
 service vendor.msm_irqbalance /vendor/bin/msm_irqbalance -f /vendor/etc/msm_irqbalance.conf
     socket msm_irqbalance seqpacket 660 root system
     class core
diff --git a/init.hardware.usb.rc b/init.hardware.usb.rc
index c9b5a7b..12a48a7 100644
--- a/init.hardware.usb.rc
+++ b/init.hardware.usb.rc
@@ -67,6 +67,7 @@
 
 on boot
     setprop sys.usb.configfs 2
+    write /sys/module/qpnp_pdphy/drivers/platform:qpnp-pdphy/c440000.qcom,spmi:qcom,pm7250b@2:qcom,usb-pdphy@1700/usbpd0/pdo "5V3A"
 
 on property:sys.usb.config=none && property:sys.usb.configfs=1
     rm /config/usb_gadget/g1/configs/b.1/f1
@@ -108,6 +109,3 @@
     symlink /config/usb_gadget/g1/functions/midi.gs5 /config/usb_gadget/g1/configs/b.1/f1
     write /config/usb_gadget/g1/UDC ${sys.usb.controller}
     setprop sys.usb.state ${sys.usb.config}
-
-on property:persist.vendor.usb.pdo=5V3A
-    write /sys/module/qpnp_pdphy/drivers/platform:qpnp-pdphy/c440000.qcom,spmi:qcom,pm7250b@2:qcom,usb-pdphy@1700/usbpd0/pdo "5V3A"
diff --git a/init.insmod.charger.cfg b/init.insmod.charger.cfg
new file mode 100644
index 0000000..2940d28
--- /dev/null
+++ b/init.insmod.charger.cfg
@@ -0,0 +1,8 @@
+#############################################
+#           init.insmod.cfg                 #
+# This file contains kernel modules to load #
+# at init time by init.insmod.sh script     #
+#############################################
+
+# Load kernel modules
+modprobe|-b *
diff --git a/manifest.xml b/manifest.xml
index 9114c4c..4141d4f 100644
--- a/manifest.xml
+++ b/manifest.xml
@@ -25,7 +25,7 @@
 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 -->
-<manifest version="1.0" type="device" target-level="4">
+<manifest version="1.0" type="device" target-level="5">
     <kernel target-level="5"/>
     <hal format="hidl">
         <name>android.hardware.audio</name>
@@ -140,6 +140,7 @@
         <name>android.hardware.secure_element</name>
         <transport>hwbinder</transport>
         <fqname>@1.0::ISecureElement/SIM1</fqname>
+        <fqname>@1.0::ISecureElement/SIM2</fqname>
         <fqname>@1.2::ISecureElement/eSE1</fqname>
     </hal>
     <!-- gatekeeper -->
@@ -341,24 +342,6 @@
         </interface>
     </hal>
     <hal format="hidl">
-        <name>android.hardware.drm</name>
-        <transport>hwbinder</transport>
-        <impl level="generic"></impl>
-        <version>1.0</version>
-        <interface>
-            <name>ICryptoFactory</name>
-            <instance>widevine</instance>
-            <instance>default</instance>
-        </interface>
-        <interface>
-            <name>IDrmFactory</name>
-            <instance>widevine</instance>
-            <instance>default</instance>
-        </interface>
-        <fqname>@1.2::ICryptoFactory/clearkey</fqname>
-        <fqname>@1.2::IDrmFactory/clearkey</fqname>
-    </hal>
-    <hal format="hidl">
         <name>android.hardware.radio</name>
         <transport>hwbinder</transport>
         <fqname>@1.5::IRadio/slot1</fqname>
@@ -408,25 +391,6 @@
             <instance>default</instance>
         </interface>
     </hal>
-    <!-- light HAL -->
-    <hal format="hidl">
-        <name>android.hardware.light</name>
-        <transport>hwbinder</transport>
-        <version>2.0</version>
-        <interface>
-            <name>ILight</name>
-            <instance>default</instance>
-        </interface>
-    </hal>
-    <hal format="hidl">
-        <name>hardware.google.light</name>
-        <transport>hwbinder</transport>
-        <version>1.1</version>
-        <interface>
-            <name>ILight</name>
-            <instance>default</instance>
-        </interface>
-    </hal>
     <hal format="hidl">
         <name>android.hardware.weaver</name>
         <transport>hwbinder</transport>
diff --git a/media_codecs_c2.xml b/media_codecs_c2.xml
index b179154..f94d1a1 100644
--- a/media_codecs_c2.xml
+++ b/media_codecs_c2.xml
@@ -151,7 +151,7 @@
             <Limit name="performance-point-1920x1080" value="120" />
             <Limit name="performance-point-1280x720" value="240" />
             <Feature name="adaptive-playback" />
-            <Limit name="concurrent-instances" max="6" />
+            <Limit name="concurrent-instances" max="7" />
         </MediaCodec>
         <MediaCodec name="c2.qti.vp9.decoder.secure" type="video/x-vnd.on2.vp9" >
             <Limit name="size" min="96x96" max="4096x2160" />
diff --git a/media_profiles_V1_0.xml b/media_profiles_V1_0.xml
index 7e3fef2..94dfd78 100644
--- a/media_profiles_V1_0.xml
+++ b/media_profiles_V1_0.xml
@@ -225,12 +225,12 @@
                    channels="1" />
         </EncoderProfile>
 
-        <!-- highspeed_low: 1920 x 1080 240fps 63.0 Mbps -->
+        <!-- highspeed_low: 1280 x 720 240fps 42.0 Mbps -->
         <EncoderProfile quality="highspeedlow" fileFormat="mp4" duration="30">
             <Video codec="h264"
-                   bitRate="63000000"
-                   width="1920"
-                   height="1080"
+                   bitRate="42000000"
+                   width="1280"
+                   height="720"
                    frameRate="240" />
             <!-- audio setting is ignored -->
             <Audio codec="aac"
@@ -239,12 +239,26 @@
                    channels="1" />
         </EncoderProfile>
 
-        <!-- highspeed_high: 1920 x 1080 240fps 63.0 Mbps -->
+        <!-- highspeed_high: 1920 x 1080 120fps 42.0 Mbps -->
         <EncoderProfile quality="highspeedhigh" fileFormat="mp4" duration="30">
             <Video codec="h264"
-                   bitRate="63000000"
+                   bitRate="42000000"
                    width="1920"
                    height="1080"
+                   frameRate="120" />
+            <!-- audio setting is ignored -->
+            <Audio codec="aac"
+                   bitRate="96000"
+                   sampleRate="48000"
+                   channels="1" />
+        </EncoderProfile>
+
+        <!-- highspeed720p: 1280 x 720 240fps 42.0 Mbps -->
+        <EncoderProfile quality="highspeed720p" fileFormat="mp4" duration="30">
+            <Video codec="h264"
+                   bitRate="42000000"
+                   width="1280"
+                   height="720"
                    frameRate="240" />
             <!-- audio setting is ignored -->
             <Audio codec="aac"
@@ -253,13 +267,13 @@
                    channels="1" />
         </EncoderProfile>
 
-        <!-- highspeed_1080p: 1920 x 1080 240fps 63.0 Mbps -->
+        <!-- highspeed_1080p: 1920 x 1080 120fps 42.0 Mbps -->
         <EncoderProfile quality="highspeed1080p" fileFormat="mp4" duration="30">
             <Video codec="h264"
-                   bitRate="63000000"
+                   bitRate="42000000"
                    width="1920"
                    height="1080"
-                   frameRate="240" />
+                   frameRate="120" />
             <!-- audio setting is ignored -->
             <Audio codec="aac"
                    bitRate="96000"
diff --git a/powerhint.json b/powerhint.json
index e738950..6c179f1 100644
--- a/powerhint.json
+++ b/powerhint.json
@@ -6,7 +6,12 @@
       "Values": [
         "9999999",
         "1651200",
-        "1075200"
+        "1075200",
+        "864000",
+        "1075201",
+        "1363200",
+        "1516800",
+        "1651201"
       ],
       "DefaultIndex": 0,
       "ResetOnInit": true
@@ -16,6 +21,7 @@
       "Path": "/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq",
       "Values": [
         "9999999",
+        "575999",
         "1075200",
         "576000"
       ],
@@ -28,7 +34,14 @@
         "9999999",
         "1900800",
         "1728000",
-        "1478400"
+        "1478400",
+        "9999998",
+        "940800",
+        "1152000",
+        "1478401",
+        "1728001",
+        "1900801"
+
       ],
       "DefaultIndex": 0,
       "ResetOnInit": true
@@ -52,7 +65,14 @@
         "9999999",
         "1996800",
         "1766400",
-        "1401600"
+        "9999998",
+        "1401600",
+        "1094400",
+        "1401601",
+        "1766401",
+        "1996801",
+        "2188800"
+
       ],
       "DefaultIndex": 0,
       "ResetOnInit": true
@@ -64,6 +84,7 @@
         "9999999",
         "1996800",
         "1766400",
+        "806399",
         "1401600",
         "806400"
       ],
@@ -982,21 +1003,21 @@
       "Value": "61"
     },
     {
-      "PowerHint": "AUDIO_STREAMING",
-      "Node": "CPUBigClusterMinFreq",
-      "Duration": 2000,
-      "Value": "1478400"
-    },
-    {
-      "PowerHint": "AUDIO_STREAMING",
-      "Node": "CPUBigPlusClusterMinFreq",
-      "Duration": 2000,
-      "Value": "1766400"
-    },
-    {
-      "PowerHint": "AUDIO_STREAMING",
+      "PowerHint": "AUDIO_LAUNCH",
       "Node": "PMQoSCpuDmaLatency",
-      "Duration": 2000,
+      "Duration": 0,
+      "Value": "61"
+    },
+    {
+      "PowerHint": "AUDIO_STREAMING_LOW_LATENCY",
+      "Node": "PowerHALAudioState",
+      "Duration": 0,
+      "Value": "AUDIO_STREAMING_LOW_LATENCY"
+    },
+    {
+      "PowerHint": "AUDIO_STREAMING_LOW_LATENCY",
+      "Node": "PMQoSCpuDmaLatency",
+      "Duration": 0,
       "Value": "61"
     },
     {
@@ -1094,6 +1115,120 @@
       "Node": "CPUBigClusterMaxFreq",
       "Duration": 0,
       "Value": "1728000"
+    },
+    {
+      "PowerHint": "LOW_POWER_LITTLE_CLUSTER_50",
+      "Node": "CPULittleClusterMaxFreq",
+      "Duration": 3600000,
+      "Value": "864000"
+    },
+    {
+      "PowerHint": "LOW_POWER_LITTLE_CLUSTER_50",
+      "Node": "CPULittleClusterMinFreq",
+      "Duration": 3600000,
+      "Value": "575999"
+    },
+    {
+      "PowerHint": "LOW_POWER_LITTLE_CLUSTER_60",
+      "Node": "CPULittleClusterMaxFreq",
+      "Duration": 3600000,
+      "Value": "1075201"
+    },
+    {
+      "PowerHint": "LOW_POWER_LITTLE_CLUSTER_60",
+      "Node": "CPULittleClusterMinFreq",
+      "Duration": 3600000,
+      "Value": "575999"
+    },
+    {
+      "PowerHint": "LOW_POWER_LITTLE_CLUSTER_70",
+      "Node": "CPULittleClusterMaxFreq",
+      "Duration": 3600000,
+      "Value": "1363200"
+    },
+    {
+      "PowerHint": "LOW_POWER_LITTLE_CLUSTER_80",
+      "Node": "CPULittleClusterMaxFreq",
+      "Duration": 3600000,
+      "Value": "1516800"
+    },
+    {
+      "PowerHint": "LOW_POWER_LITTLE_CLUSTER_90",
+      "Node": "CPULittleClusterMaxFreq",
+      "Duration": 3600000,
+      "Value": "1651201"
+    },
+    {
+      "PowerHint": "LOW_POWER_CPU_50",
+      "Node": "CPUBigClusterMaxFreq",
+      "Duration": 3600000,
+      "Value": "940800"
+    },
+    {
+      "PowerHint": "LOW_POWER_CPU_50",
+      "Node": "CPUBigPlusClusterMaxFreq",
+      "Duration": 3600000,
+      "Value": "1094400"
+    },
+    {
+      "PowerHint": "LOW_POWER_CPU_50",
+      "Node": "CPUBigPlusClusterMinFreq",
+      "Duration": 3600000,
+      "Value": "806399"
+    },
+    {
+      "PowerHint": "LOW_POWER_CPU_60",
+      "Node": "CPUBigClusterMaxFreq",
+      "Duration": 3600000,
+      "Value": "1152000"
+    },
+    {
+      "PowerHint": "LOW_POWER_CPU_60",
+      "Node": "CPUBigPlusClusterMaxFreq",
+      "Duration": 3600000,
+      "Value": "1401601"
+    },
+    {
+      "PowerHint": "LOW_POWER_CPU_60",
+      "Node": "CPUBigPlusClusterMinFreq",
+      "Duration": 3600000,
+      "Value": "806399"
+    },
+    {
+      "PowerHint": "LOW_POWER_CPU_70",
+      "Node": "CPUBigClusterMaxFreq",
+      "Duration": 3600000,
+      "Value": "1478401"
+    },
+    {
+      "PowerHint": "LOW_POWER_CPU_70",
+      "Node": "CPUBigPlusClusterMaxFreq",
+      "Duration": 3600000,
+      "Value": "1766401"
+    },
+    {
+      "PowerHint": "LOW_POWER_CPU_80",
+      "Node": "CPUBigClusterMaxFreq",
+      "Duration": 3600000,
+      "Value": "1728001"
+    },
+    {
+      "PowerHint": "LOW_POWER_CPU_80",
+      "Node": "CPUBigPlusClusterMaxFreq",
+      "Duration": 3600000,
+      "Value": "1996801"
+    },
+    {
+      "PowerHint": "LOW_POWER_CPU_90",
+      "Node": "CPUBigClusterMaxFreq",
+      "Duration": 3600000,
+      "Value": "1900801"
+    },
+    {
+      "PowerHint": "LOW_POWER_CPU_90",
+      "Node": "CPUBigPlusClusterMaxFreq",
+      "Duration": 3600000,
+      "Value": "2188800"
     }
   ]
 }
diff --git a/product.prop b/product.prop
index 2c5052d..ebee6fe 100644
--- a/product.prop
+++ b/product.prop
@@ -95,3 +95,6 @@
 # BQR minimum report interval configuration
 persist.bluetooth.bqr.min_interval_ms=500
 
+# System props to enable aac vbr feature
+persist.bluetooth.a2dp_aac.vbr_supported=true
+
diff --git a/ueventd.rc b/ueventd.rc
index f6a0020..3188769 100644
--- a/ueventd.rc
+++ b/ueventd.rc
@@ -145,3 +145,12 @@
 /sys/devices/platform/soc/soc:fp_fpc*        irq               0600  system system
 /sys/devices/platform/soc/soc:fp_fpc*        wakeup_enable     0200  system system
 /sys/devices/platform/soc/soc:fp_fpc*        hw_reset          0600  system system
+
+# logbuffer
+/dev/logbuffer_usbpd      0640   system system
+/dev/logbuffer_pps        0640   system system
+/dev/logbuffer_ssoc       0640   system system
+/dev/logbuffer_smblib     0640   system system
+/dev/logbuffer_ttf        0640   system system
+/dev/logbuffer_wireless   0640   system system
+/dev/logbuffer_rtx        0640   system system