Merge ab/7061308 into stage.

Bug: 180401296
Merged-In: Ieed5fdc1061f59d1172eaa97e1dfbaefe71574db
Change-Id: I555991480ef397ff1ad2f58f27c73009e585276b
diff --git a/component-overrides.xml b/component-overrides.xml
index bb3419d..c682a7b 100644
--- a/component-overrides.xml
+++ b/component-overrides.xml
@@ -17,4 +17,7 @@
     <component-override package="com.android.bluetooth" >
         <component class=".sap.SapService" enabled="true" />
     </component-override>
-</config>
\ No newline at end of file
+    <component-override package="com.google.android.apps.tips" >
+        <component class=".TipsMain" enabled="true" />
+    </component-override>
+</config>
diff --git a/default-permissions.xml b/default-permissions.xml
index 6dd1992..c226feb 100644
--- a/default-permissions.xml
+++ b/default-permissions.xml
@@ -103,7 +103,7 @@
     </exception>
 
     <exception package="com.google.android.apps.scone">
-        <!-- NLP Location access to determine proximity to country border -->
+        <!-- Location access to determine proximity to a CBRS network coverage area -->
         <permission name="android.permission.ACCESS_COARSE_LOCATION" fixed="false"/>
         <permission name="android.permission.ACCESS_BACKGROUND_LOCATION" fixed="false"/>
         <!-- Used to call ActivityTransition API for Smart OOS & Smart PNO -->
diff --git a/device.mk b/device.mk
index c7e9bce..54b0caa 100644
--- a/device.mk
+++ b/device.mk
@@ -33,7 +33,6 @@
     vendor/google/darwinn \
     vendor/qcom/sm8150 \
     vendor/qcom/sm8150/proprietary/commonsys/telephony-apps/DataStatusNotification \
-    vendor/qcom/sm8150/proprietary/data/permissions \
     vendor/qcom/sm8150/proprietary/gps \
     vendor/qcom/sm8150/codeaurora/location \
     vendor/google/interfaces
@@ -55,7 +54,8 @@
       vendor/qcom/sm7250/proprietary/commonsys/telephony-apps/QtiTelephonyService \
       vendor/qcom/sm7250/proprietary/commonsys/telephony-apps/xdivert \
       vendor/qcom/sm7250/proprietary/qcril-data-hal \
-      vendor/qcom/sm7250/proprietary/qcril-hal
+      vendor/qcom/sm7250/proprietary/qcril-hal \
+      vendor/qcom/sm7250/proprietary/data
 else
   $(warning DEVICE_USES_SM7250_QCRIL_TELEPHONY is disabled)
 
diff --git a/device_framework_matrix_product.xml b/device_framework_matrix_product.xml
index 86328fc..0a8db85 100644
--- a/device_framework_matrix_product.xml
+++ b/device_framework_matrix_product.xml
@@ -74,7 +74,7 @@
     </hal>
     <hal format="hidl" optional="true">
         <name>vendor.google.google_battery</name>
-        <version>1.0</version>
+        <version>1.1</version>
         <interface>
             <name>IGoogleBattery</name>
             <instance>default</instance>
diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp
index 77c633f..e4a51d1 100755
--- a/dumpstate/DumpstateDevice.cpp
+++ b/dumpstate/DumpstateDevice.cpp
@@ -531,6 +531,9 @@
     DumpFileToFd(fd, "maxfg", "/d/logbuffer/maxfg");
     DumpFileToFd(fd, "WLC logs", "/d/logbuffer/wireless");
     DumpFileToFd(fd, "ipc-local-ports", "/d/msm_ipc_router/dump_local_ports");
+    RunCommandToFd(fd, "TRICKLE-DEFEND Config", {"/vendor/bin/sh", "-c", " cd /sys/devices/platform/soc/soc:google,battery/power_supply/battery/; echo \"bd_trickle_enable: `cat bd_trickle_enable`\"; echo \"bd_trickle_cnt: `cat bd_trickle_cnt`\";  echo \"bd_trickle_recharge_soc: `cat bd_trickle_recharge_soc`\";  echo \"bd_trickle_dry_run: `cat bd_trickle_dry_run`\"; echo \"bd_trickle_reset_sec: `cat bd_trickle_reset_sec`\""});
+    RunCommandToFd(fd, "DWELL-DEFEND Config", {"/vendor/bin/sh", "-c", " cd /sys/devices/platform/soc/soc:google,charger/; for f in `ls charge_s*` ; do echo \"$f: `cat $f`\" ; done"});
+    RunCommandToFd(fd, "TEMP-DEFEND Config", {"/vendor/bin/sh", "-c", " cd /sys/devices/platform/soc/soc:google,charger/; for f in `ls bd_*` ; do echo \"$f: `cat $f`\" ; done"});
     RunCommandToFd(fd, "USB Device Descriptors", {"/vendor/bin/sh", "-c", "cd /sys/bus/usb/devices/1-1 && cat product && cat bcdDevice; cat descriptors | od -t x1 -w16 -N96"});
     RunCommandToFd(fd, "Power supply properties", {"/vendor/bin/sh", "-c", "for f in `ls /sys/class/power_supply/*/uevent` ; do echo \"------ $f\\n`cat $f`\\n\" ; done"});
     RunCommandToFd(fd, "PMIC Votables", {"/vendor/bin/sh", "-c", "cat /sys/kernel/debug/pmic-votable/*/status"});
diff --git a/health/Health.cpp b/health/Health.cpp
index b36c94a..1de8f98 100644
--- a/health/Health.cpp
+++ b/health/Health.cpp
@@ -127,7 +127,6 @@
 void private_healthd_board_init(struct healthd_config *hc) {
   hc->ignorePowerSupplyNames.push_back(android::String8(kTCPMPSYName));
   ccBackupRestore.Restore();
-  battDefender.update();
 
   needs_wlc_updates = FileExists(kWlcCapacity);
 }
@@ -138,7 +137,7 @@
   battMetricsLogger.logBatteryProperties(props);
   shutdownMetrics.logShutdownVoltage(props);
   ccBackupRestore.Backup(props->batteryLevel);
-  battDefender.update();
+  battDefender.update(props);
 
   if (needs_wlc_updates &&
       !android::base::WriteStringToFile(std::to_string(props->batteryLevel),
diff --git a/init.hardware.rc b/init.hardware.rc
index 0a7813d..4ce8dc2 100644
--- a/init.hardware.rc
+++ b/init.hardware.rc
@@ -161,10 +161,30 @@
     # Battery Defender
     chown system system /sys/devices/platform/soc/soc:google,charger/charge_stop_level
     chown system system /sys/devices/platform/soc/soc:google,charger/charge_start_level
+    chown system system /sys/devices/platform/soc/soc:google,charger/bd_drainto_soc
+    chown system system /sys/devices/platform/soc/soc:google,charger/bd_recharge_soc
+    chown system system /sys/devices/platform/soc/soc:google,charger/bd_recharge_voltage
+    chown system system /sys/devices/platform/soc/soc:google,charger/bd_resume_abs_temp
+    chown system system /sys/devices/platform/soc/soc:google,charger/bd_resume_soc
+    chown system system /sys/devices/platform/soc/soc:google,charger/bd_resume_temp
+    chown system system /sys/devices/platform/soc/soc:google,charger/bd_resume_time
+    chown system system /sys/devices/platform/soc/soc:google,charger/bd_trigger_temp
+    chown system system /sys/devices/platform/soc/soc:google,charger/bd_trigger_time
+    chown system system /sys/devices/platform/soc/soc:google,charger/bd_trigger_voltage
+    chown system system /sys/devices/platform/soc/soc:google,charger/bd_temp_enable
+    chown system system /sys/devices/platform/soc/soc:google,charger/bd_temp_dry_run
+    chown system system /sys/devices/platform/soc/soc:google,battery/power_supply/battery/bd_trickle_enable
+    chown system system /sys/devices/platform/soc/soc:google,battery/power_supply/battery/bd_trickle_recharge_soc
+    chown system system /sys/devices/platform/soc/soc:google,battery/power_supply/battery/bd_trickle_cnt
+    chown system system /sys/devices/platform/soc/soc:google,battery/power_supply/battery/bd_trickle_dry_run
+    chown system system /sys/devices/platform/soc/soc:google,battery/power_supply/battery/bd_trickle_reset_sec
 
     # Charge stats (write 0)
     chown system system /sys/class/power_supply/battery/charge_stats
 
+    # NFC streset tool name
+    setprop persist.vendor.nfc.streset libstreset
+
 # b/134578585
 on charger
     trigger fs
diff --git a/manifest.xml b/manifest.xml
index c813c40..9458877 100644
--- a/manifest.xml
+++ b/manifest.xml
@@ -168,7 +168,7 @@
     <hal format="hidl">
       <name>vendor.google.google_battery</name>
       <transport>hwbinder</transport>
-      <version>1.0</version>
+      <version>1.1</version>
       <interface>
         <name>IGoogleBattery</name>
         <instance>default</instance>
diff --git a/powerhint.json b/powerhint.json
index 14d3e4e..ff2aca3 100644
--- a/powerhint.json
+++ b/powerhint.json
@@ -5,7 +5,12 @@
       "Path": "/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq",
       "Values": [
         "9999999",
-        "1113600"
+        "1113600",
+        "844800",
+        "1036800",
+        "1209600",
+        "1382400",
+        "1555200"
       ],
       "DefaultIndex": 0,
       "ResetOnInit": true
@@ -15,9 +20,10 @@
       "Path": "/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq",
       "Values": [
         "9999999",
-        "1113600",
-        "576000"
+        "576000",
+        "1113600"
       ],
+      "DefaultIndex": 1,
       "ResetOnInit": true
     },
     {
@@ -43,9 +49,10 @@
         "9999999",
         "1497600",
         "1401600",
-        "1286400",
-        "0"
+        "0",
+        "1286400"
       ],
+      "DefaultIndex": 3,
       "ResetOnInit": true
     },
     {
@@ -70,9 +77,10 @@
         "9999999",
         "1497600",
         "1401600",
-        "1286400",
-        "0"
+        "0",
+        "1286400"
       ],
+      "DefaultIndex": 3,
       "ResetOnInit": true
     },
     {
@@ -918,6 +926,48 @@
       "Value": "1"
     },
     {
+      "PowerHint": "LOW_POWER_LITTLE_CLUSTER_50",
+      "Node": "CPULittleClusterMaxFreq",
+      "Duration": 3600000,
+      "Value": "844800"
+    },
+    {
+      "PowerHint": "LOW_POWER_LITTLE_CLUSTER_50",
+      "Node": "CPULittleClusterMinFreq",
+      "Duration": 3600000,
+      "Value": "576000"
+    },
+    {
+      "PowerHint": "LOW_POWER_LITTLE_CLUSTER_60",
+      "Node": "CPULittleClusterMaxFreq",
+      "Duration": 3600000,
+      "Value": "1036800"
+    },
+    {
+      "PowerHint": "LOW_POWER_LITTLE_CLUSTER_60",
+      "Node": "CPULittleClusterMinFreq",
+      "Duration": 3600000,
+      "Value": "576000"
+    },
+    {
+      "PowerHint": "LOW_POWER_LITTLE_CLUSTER_70",
+      "Node": "CPULittleClusterMaxFreq",
+      "Duration": 3600000,
+      "Value": "1209600"
+    },
+    {
+      "PowerHint": "LOW_POWER_LITTLE_CLUSTER_80",
+      "Node": "CPULittleClusterMaxFreq",
+      "Duration": 3600000,
+      "Value": "1382400"
+    },
+    {
+      "PowerHint": "LOW_POWER_LITTLE_CLUSTER_90",
+      "Node": "CPULittleClusterMaxFreq",
+      "Duration": 3600000,
+      "Value": "1555200"
+    },
+    {
       "PowerHint": "LOW_POWER_CPU_50",
       "Node": "CPUBigClusterMaxFreq",
       "Duration": 3600000,
@@ -925,11 +975,23 @@
     },
     {
       "PowerHint": "LOW_POWER_CPU_50",
+      "Node": "CPUBigClusterMinFreq",
+      "Duration": 3600000,
+      "Value": "0"
+    },
+    {
+      "PowerHint": "LOW_POWER_CPU_50",
       "Node": "CPUBigPlusClusterMaxFreq",
       "Duration": 3600000,
       "Value": "1401600"
     },
     {
+      "PowerHint": "LOW_POWER_CPU_50",
+      "Node": "CPUBigPlusClusterMinFreq",
+      "Duration": 3600000,
+      "Value": "0"
+    },
+    {
       "PowerHint": "LOW_POWER_CPU_60",
       "Node": "CPUBigClusterMaxFreq",
       "Duration": 3600000,
@@ -937,11 +999,23 @@
     },
     {
       "PowerHint": "LOW_POWER_CPU_60",
+      "Node": "CPUBigClusterMinFreq",
+      "Duration": 3600000,
+      "Value": "0"
+    },
+    {
+      "PowerHint": "LOW_POWER_CPU_60",
       "Node": "CPUBigPlusClusterMaxFreq",
       "Duration": 3600000,
       "Value": "1708800"
     },
     {
+      "PowerHint": "LOW_POWER_CPU_60",
+      "Node": "CPUBigPlusClusterMinFreq",
+      "Duration": 3600000,
+      "Value": "0"
+    },
+    {
       "PowerHint": "LOW_POWER_CPU_70",
       "Node": "CPUBigClusterMaxFreq",
       "Duration": 3600000,
diff --git a/ueventd.rc b/ueventd.rc
index f02571f..504cdf5 100644
--- a/ueventd.rc
+++ b/ueventd.rc
@@ -43,6 +43,7 @@
 /dev/media*               0660   system     camera
 /dev/v4l-subdev*          0660   system     camera
 
+/dev/qce                  0660   system     drmrpc
 /dev/qseecom              0660   system     drmrpc
 /dev/qsee_ipc_irq_spss    0660   system     drmrpc
 /dev/seemplog             0660   system     system