[automerger skipped] Merge "DO NOT MERGE - Merge PPRL.190305.001 into master" am: 474e925d43 -s ours am: 8672790f80 -s ours
am: 548c5edbb7 -s ours
am skip reason: subject contains skip directive

Change-Id: Ia83459c9de1b548bd94e74d8859ea44400a12e49
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..c028497
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,5 @@
+soong_namespace {
+    imports: [
+        "hardware/google/pixel",
+    ],
+}
diff --git a/BoardConfig.mk b/BoardConfig.mk
index 3da8976..3b6dc3f 100644
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -56,6 +56,7 @@
 TARGET_NO_RECOVERY := true
 BOARD_USES_RECOVERY_AS_BOOT := true
 BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
+BOARD_USES_METADATA_PARTITION := true
 
 # Partitions (listed in the file) to be wiped under recovery.
 TARGET_RECOVERY_WIPE := device/google/wahoo/recovery.wipe
@@ -85,7 +86,7 @@
 # Install odex files into the other system image
 BOARD_USES_SYSTEM_OTHER_ODEX := true
 
-BOARD_ROOT_EXTRA_FOLDERS := persist firmware
+BOARD_ROOT_EXTRA_FOLDERS := persist firmware metadata
 
 BOARD_SEPOLICY_DIRS += device/google/wahoo/sepolicy/vendor
 BOARD_PLAT_PUBLIC_SEPOLICY_DIR := device/google/wahoo/sepolicy/public
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 0819c55..3d36290 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -176,13 +176,13 @@
 # Remove android.hardware.audio*@2.0 implementation
 $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib/hw/android.hardware.audio*@2.0-impl.so)
 
-# Remove Clearkey HAL 1.0
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.drm@1.0-service.clearkey.rc)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.drm@1.0-service.clearkey)
+# Remove Clearkey HAL 1.1
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.drm@1.1-service.clearkey.rc)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.drm@1.1-service.clearkey)
 
-# Remove Widevine HAL 1.0
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.drm@1.0-service.widevine.rc)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.drm@1.0-service.widevine)
+# Remove Widevine HAL 1.1
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.drm@1.1-service.widevine.rc)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.drm@1.1-service.widevine)
 
 # Remove healthd
 $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/bin/healthd)
@@ -194,3 +194,7 @@
 
 # Move libnfc-nci.conf to /vendor
 $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/etc/libnfc-nci.conf)
+
+# Remove android.hardware.graphics.mapper@2.0-impl
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib/hw/android.hardware.graphics.mapper@2.0-impl.so)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib64/hw/android.hardware.graphics.mapper@2.0-impl.so)
diff --git a/device.mk b/device.mk
index 4ab9973..67d2dc4 100755
--- a/device.mk
+++ b/device.mk
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2016 The Android Open-Source Project
+# Copyright (C) 2018 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.
@@ -29,6 +29,11 @@
 PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
     ro.adb.secure=1
 
+PRODUCT_SOONG_NAMESPACES += \
+    device/google/wahoo \
+    vendor/google/camera \
+    hardware/google/pixel
+
 # Telephony IWLAN operation mode
 PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
     ro.telephony.iwlan_operation_mode=0
@@ -40,7 +45,7 @@
 
 # Set the SVN for the targeted MR release
 PRODUCT_PROPERTY_OVERRIDES += \
-    ro.vendor.build.svn=26
+    ro.vendor.build.svn=29
 
 # Enforce privapp-permissions whitelist
 PRODUCT_PROPERTY_OVERRIDES += \
@@ -55,7 +60,7 @@
 SRC_DISPLAY_HAL_DIR := hardware/qcom/display/msm8998
 SRC_CAMERA_HAL_DIR := hardware/qcom/camera/msm8998
 
-TARGET_SYSTEM_PROP := $(LOCAL_PATH)/system.prop
+TARGET_SYSTEM_PROP := $(TARGET_SYSTEM_PROP) $(LOCAL_PATH)/system.prop
 
 # Get kernel-headers
 $(call inherit-product, hardware/qcom/msm8998/msm8998.mk)
@@ -88,7 +93,7 @@
     $(LOCAL_PATH)/init.qcom.ipastart.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qcom.ipastart.sh \
     $(LOCAL_PATH)/init.qcom.wlan.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qcom.wlan.sh \
     $(LOCAL_PATH)/init.insmod.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.insmod.sh \
-    $(LOCAL_PATH)/init.ramoops.sh:$(TARGET_COPY_OUT_SYSTEM)/bin/init.ramoops.sh \
+    $(LOCAL_PATH)/init.ramoops.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.ramoops.sh \
     frameworks/native/services/vr/virtual_touchpad/idc/vr-virtual-touchpad-0.idc:$(TARGET_COPY_OUT_VENDOR)/usr/idc/vr-virtual-touchpad-0.idc \
     frameworks/native/services/vr/virtual_touchpad/idc/vr-virtual-touchpad-1.idc:$(TARGET_COPY_OUT_VENDOR)/usr/idc/vr-virtual-touchpad-1.idc
 
@@ -193,6 +198,10 @@
 PRODUCT_PACKAGES += \
     android.hardware.power@1.2-service.wahoo-libperfmgr
 
+# power.stats HAL
+PRODUCT_PACKAGES += \
+    android.hardware.power.stats@1.0-service.pixel
+
 PRODUCT_COPY_FILES += \
     $(LOCAL_PATH)/powerhint.json:$(TARGET_COPY_OUT_VENDOR)/etc/powerhint.json
 
@@ -326,7 +335,7 @@
     gralloc.msm8998 \
     android.hardware.graphics.allocator@2.0-impl:64 \
     android.hardware.graphics.allocator@2.0-service \
-    android.hardware.graphics.mapper@2.0-impl \
+    android.hardware.graphics.mapper@2.0-impl-2.1 \
     libbt-vendor
 
 # RenderScript HAL
@@ -372,8 +381,8 @@
 PRODUCT_PACKAGES += \
     android.hardware.drm@1.0-impl:32 \
     android.hardware.drm@1.0-service \
-    android.hardware.drm@1.1-service.widevine \
-    android.hardware.drm@1.1-service.clearkey \
+    android.hardware.drm@1.2-service.clearkey \
+    android.hardware.drm@1.2-service.widevine \
     move_widevine_data.sh
 
 # NFC packages
@@ -405,6 +414,8 @@
     android.hardware.camera.provider@2.4-service \
     camera.device@3.2-impl \
     camera.msm8998 \
+    libgooglecamerahal \
+    libgoogle_camera_hal_tests \
     libqomx_core \
     libmmjpeg_interface \
     libmmcamera_interface
@@ -439,9 +450,9 @@
 PRODUCT_PACKAGES += \
     android.hardware.vibrator@1.2-service.wahoo
 
-# Thermal packages
+# Thermal HAL
 PRODUCT_PACKAGES += \
-    android.hardware.thermal@1.1-impl-wahoo
+    android.hardware.thermal@2.0-service.pixel
 
 #GNSS HAL
 PRODUCT_PACKAGES += \
@@ -452,10 +463,6 @@
     android.hardware.gnss@1.0-impl-qti \
     android.hardware.gnss@1.0-service-qti
 
-# VR HAL
-PRODUCT_PACKAGES += \
-    android.hardware.vr@1.0-service.wahoo \
-
 PRODUCT_COPY_FILES += \
     $(LOCAL_PATH)/sec_config:$(TARGET_COPY_OUT_VENDOR)/etc/sec_config
 
@@ -469,11 +476,14 @@
 WPA += wpa_supplicant
 PRODUCT_PACKAGES += $(WPA)
 
+ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
+PRODUCT_PACKAGES += wpa_cli
+endif
+
 # Wifi
 PRODUCT_PACKAGES += \
     android.hardware.wifi@1.0-service \
     wificond \
-    wifilogd \
     libwpa_client
 
 LIB_NL := libnl_2
@@ -497,9 +507,9 @@
     audio.bluetooth.default
 
 PRODUCT_PACKAGES += \
-    android.hardware.audio@4.0-impl:32 \
-    android.hardware.audio.effect@4.0-impl:32 \
-    android.hardware.soundtrigger@2.1-impl:32 \
+    android.hardware.audio@5.0-impl:32 \
+    android.hardware.audio.effect@5.0-impl:32 \
+    android.hardware.soundtrigger@2.2-impl:32 \
     android.hardware.bluetooth.audio@2.0-impl \
     android.hardware.audio@2.0-service
 
@@ -566,6 +576,8 @@
 # Fingerprint HIDL implementation
 PRODUCT_PACKAGES += \
     android.hardware.biometrics.fingerprint@2.1-service.fpc
+PRODUCT_COPY_FILES += \
+    $(LOCAL_PATH)/init.fingerprint.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.fingerprint.sh \
 
 PRODUCT_COPY_FILES += \
     frameworks/native/data/etc/android.hardware.fingerprint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.fingerprint.xml
@@ -682,3 +694,13 @@
   PRODUCT_PROPERTY_OVERRIDES += \
       persist.vendor.usb.usbradio.config=diag
 endif
+
+# default atrace HAL
+PRODUCT_PACKAGES += \
+    android.hardware.atrace@1.0-service
+
+PRODUCT_DEFAULT_PROPERTY_OVERRIDES += ro.surface_flinger.use_color_management=true
+
+# Must align with HAL types Dataspace
+# The data space of wide color gamut composition preference is Dataspace::DISPLAY_P3
+PRODUCT_DEFAULT_PROPERTY_OVERRIDES += ro.surface_flinger.wcg_composition_dataspace=143261696
diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp
index 929e434..4c1c21e 100755
--- a/dumpstate/DumpstateDevice.cpp
+++ b/dumpstate/DumpstateDevice.cpp
@@ -21,6 +21,8 @@
 #include <android-base/properties.h>
 #include <android-base/unique_fd.h>
 #include <cutils/properties.h>
+#include <hidl/HidlBinderSupport.h>
+
 #include <log/log.h>
 #include <string.h>
 
@@ -227,6 +229,11 @@
 
 // Methods from ::android::hardware::dumpstate::V1_0::IDumpstateDevice follow.
 Return<void> DumpstateDevice::dumpstateBoard(const hidl_handle& handle) {
+    // Exit when dump is completed since this is a lazy HAL.
+    addPostCommandTask([]() {
+        exit(0);
+    });
+
     if (handle == nullptr || handle->numFds < 1) {
         ALOGE("no FDs\n");
         return Void();
@@ -272,8 +279,15 @@
     DumpFileToFd(fd, "PD Engine", "/d/pd_engine/usbpd0");
     DumpFileToFd(fd, "smblib-usb logs", "/d/ipc_logging/smblib/log");
     DumpFileToFd(fd, "ipc-local-ports", "/d/msm_ipc_router/dump_local_ports");
+    DumpFileToFd(fd, "ipc-servers", "/d/msm_ipc_router/dump_servers");
+    RunCommandToFd(fd, "ipc-logs",
+                   {"/vendor/bin/sh", "-c",
+                    "for f in `ls /d/ipc_logging/*_IPCRTR/log` ; do echo \"------ $f\\n`cat "
+                    "$f`\\n\" ; done"});
     DumpTouch(fd);
     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"});
+    DumpFileToFd(fd, "Pixel trace", "/d/tracing/instances/pixel-trace/trace");
+
     // Timeout after 3s
     RunCommandToFd(fd, "QSEE logs", {"/vendor/bin/sh", "-c", "/vendor/bin/timeout 3 cat /d/tzdbg/qsee_log"});
     RunCommandToFd(fd, "Power supply properties", {"/vendor/bin/sh", "-c", "for f in /sys/class/power_supply/*/uevent ; do echo \"\n------ $f\" ; cat $f ; done"});
diff --git a/dumpstate/android.hardware.dumpstate@1.0-service.wahoo.rc b/dumpstate/android.hardware.dumpstate@1.0-service.wahoo.rc
index 4c024a0..950da39 100644
--- a/dumpstate/android.hardware.dumpstate@1.0-service.wahoo.rc
+++ b/dumpstate/android.hardware.dumpstate@1.0-service.wahoo.rc
@@ -3,6 +3,8 @@
     user system
     group system
     interface android.hardware.dumpstate@1.0::IDumpstateDevice default
+    oneshot
+    disabled
 
 on boot
     chmod 0444 /sys/kernel/debug/tzdbg/qsee_log
diff --git a/fstab.hardware b/fstab.hardware
index d2fc516..7c6e57f 100644
--- a/fstab.hardware
+++ b/fstab.hardware
@@ -2,8 +2,9 @@
 
 #<src>                                                     <mnt_point>        <type>      <mnt_flags and options>                               <fs_mgr_flags>
 /dev/block/platform/soc/1da4000.ufshc/by-name/system       /                  ext4        ro,barrier=1                                          wait,slotselect,avb
-/dev/block/platform/soc/1da4000.ufshc/by-name/userdata     /data              ext4        errors=panic,noatime,nosuid,nodev,barrier=1,noauto_da_alloc        latemount,wait,check,formattable,fileencryption=ice:aes-256-heh,eraseblk=16777216,logicalblk=4096,quota,reservedsize=128M
+/dev/block/platform/soc/1da4000.ufshc/by-name/metadata     /metadata          ext4        noatime,nosuid,nodev,discard                          wait,formattable
+/dev/block/platform/soc/1da4000.ufshc/by-name/userdata     /data              ext4        errors=panic,noatime,nosuid,nodev,barrier=1,noauto_da_alloc        latemount,wait,check,formattable,fileencryption=ice:aes-256-heh,eraseblk=16777216,logicalblk=4096,quota,reservedsize=128M,checkpoint=block
 /dev/block/platform/soc/1da4000.ufshc/by-name/misc         /misc              emmc        defaults                                              defaults
 /dev/block/platform/soc/1da4000.ufshc/by-name/modem        /firmware          vfat        ro,shortname=lower,uid=1000,gid=1000,dmask=227,fmask=337,context=u:object_r:firmware_file:s0   wait,slotselect
 /devices/soc/a800000.ssusb/a800000.dwc3*                   auto               vfat        defaults                                              voldmanaged=usb:auto
-/dev/block/zram0                                           none               swap        defaults                                              zramsize=536870912,max_comp_streams=8
+/dev/block/zram0                                           none               swap        defaults                                              zramsize=2147483648,max_comp_streams=8
diff --git a/health/LearnedCapacityBackupRestore.cpp b/health/LearnedCapacityBackupRestore.cpp
index 48fe461..cf8de8d 100644
--- a/health/LearnedCapacityBackupRestore.cpp
+++ b/health/LearnedCapacityBackupRestore.cpp
@@ -25,17 +25,28 @@
 static constexpr char kSysCFPersistFile[] = "/persist/battery/qcom_charge_full";
 static constexpr int kBuffSize = 256;
 
-LearnedCapacityBackupRestore::LearnedCapacityBackupRestore() {}
+LearnedCapacityBackupRestore::LearnedCapacityBackupRestore() : sw_cap_(0), hw_cap_(0) {}
 
 void LearnedCapacityBackupRestore::Restore() {
     ReadFromStorage();
     ReadFromSRAM();
-    UpdateAndSave();
+    if (sw_cap_ == 0) {
+        // First backup
+        sw_cap_ = hw_cap_;
+        SaveToStorage();
+    } else {
+        // Always restore backup value
+        SaveToSRAM();
+    }
 }
 
 void LearnedCapacityBackupRestore::Backup() {
     ReadFromSRAM();
-    UpdateAndSave();
+    if (sw_cap_ != hw_cap_) {
+        // Always backup the new FG computed learned capacity
+        sw_cap_ = hw_cap_;
+        SaveToStorage();
+    }
 }
 
 void LearnedCapacityBackupRestore::ReadFromStorage() {
@@ -90,24 +101,6 @@
         LOG(ERROR) << "Write data error: " << strerror(errno);
 }
 
-void LearnedCapacityBackupRestore::UpdateAndSave() {
-    bool backup = false;
-    bool restore = false;
-    if (hw_cap_) {
-        if ((hw_cap_ < sw_cap_) || (sw_cap_ == 0)) {
-            sw_cap_ = hw_cap_;
-            backup = true;
-        } else if (hw_cap_ > sw_cap_) {
-            hw_cap_ = sw_cap_;
-            restore = true;
-        }
-    }
-    if (restore)
-        SaveToSRAM();
-    if (backup)
-        SaveToStorage();
-}
-
 }  // namespace health
 }  // namespace wahoo
 }  // namespace google
diff --git a/health/LearnedCapacityBackupRestore.h b/health/LearnedCapacityBackupRestore.h
index 13d38e2..da9e564 100644
--- a/health/LearnedCapacityBackupRestore.h
+++ b/health/LearnedCapacityBackupRestore.h
@@ -41,7 +41,6 @@
     void SaveToStorage();
     void ReadFromSRAM();
     void SaveToSRAM();
-    void UpdateAndSave();
 };
 
 }  // namespace health
diff --git a/init.fingerprint.sh b/init.fingerprint.sh
new file mode 100755
index 0000000..413fd9e
--- /dev/null
+++ b/init.fingerprint.sh
@@ -0,0 +1,48 @@
+#!/vendor/bin/sh
+# /vendor/bin/init.fingerprint.sh [max_init_retry_times]
+
+# fps_hal service prop
+fps_svc_prop='init.svc.vendor.fps_hal'
+# fps_hal service name
+fps_svc_name='vendor.fps_hal'
+# fps_hal service init retry count
+init_retry_count_prop='vendor.fps.init_retry.count'
+# fps_hal service init succeed
+init_succeed_prop='vendor.fps.init.succeed'
+# Define maximum init retry times as default 10
+max_times=10
+
+# Deal with the input parameter
+if [ "$#" -ge 1 ]; then
+  # Check is it positive number or not
+  # If so, then set maximum times as $1
+  # If not, $max_times keeps in default value
+  if [ "$1" -eq "$1" ] && [ "$1" -gt 0 ]; then
+    max_times=$1
+    echo $max_times
+  fi
+fi
+
+# fps_hal service init retry count
+init_retry_count=0
+
+while [ "$init_retry_count" -le "$max_times" ]
+do
+  # debouncing time for init processing
+  sleep 5
+  # Get fps_hal service state and count init retry times
+  fps_svc_state=$(getprop $fps_svc_prop)
+  if [ "$fps_svc_state" == "stopped" ]; then
+    if [ "$init_retry_count" -lt "$max_times" ]; then
+      init_retry_count=$((init_retry_count+1))
+      setprop $init_retry_count_prop $init_retry_count
+      setprop $init_succeed_prop false
+      start $fps_svc_name
+    else
+      break;
+    fi
+  elif [ "$fps_svc_state" == "running" ]; then
+    setprop $init_succeed_prop true
+    break
+  fi
+done
diff --git a/init.hardware.rc b/init.hardware.rc
index 31f5bb5..62cebb6 100644
--- a/init.hardware.rc
+++ b/init.hardware.rc
@@ -159,6 +159,9 @@
     write /sys/block/zram0/comp_algorithm lz4
     write /proc/sys/vm/page-cluster 0
 
+on init
+    setprop vendor.thermal.config thermal_info_config.json
+
 on fs
     mount_all /vendor/etc/fstab.${ro.hardware} --early
 
@@ -188,6 +191,9 @@
     chmod 0770 /persist/rfs/apq/gnss
     chmod 0770 /persist/hlos_rfs
 
+    # b/78019660 Remove unlabeled persist_rfs_file
+    rm /persist/rfs/msm/mpss/server_check.txt
+
     # for android.hardware.health@2.0-service.marlin cycle count backup
     mkdir /persist/battery 0700 system system
 
@@ -227,20 +233,6 @@
     # Wait qseecomd started
     wait_for_prop sys.listeners.registered true
 
-on property:sys.user.0.ce_available=true
-    mkdir /data/misc_ce/0/ramoops
-    start vendor.ramoops_sh
-
-on property:sys.ramoops.decrypted=true
-    mount pstore pstore /sys/fs/pstore
-    chown system log /sys/fs/pstore
-    chown system log /sys/fs/pstore/console-ramoops
-    chmod 0440 /sys/fs/pstore/console-ramoops
-    chown system log /sys/fs/pstore/console-ramoops-0
-    chmod 0440 /sys/fs/pstore/console-ramoops-0
-    chown system log /sys/fs/pstore/pmsg-ramoops-0
-    chmod 0440 /sys/fs/pstore/pmsg-ramoops-0
-
 on property:sys.listeners.registered=true
     # load IPA FWs
     start vendor.ipastart_sh
@@ -255,6 +247,9 @@
     # b/38496103 Setup debug folders for display
     mkdir /data/vendor/display 0770 system graphics
 
+    # b/65834073 Create rfs folder for tftp_server
+    mkdir /data/vendor/tombstones/rfs 0770 root system
+
     # keep that at the end of on post-fs-data
     # Set indication (checked by vold) that we have finished this action
     setprop vold.post_fs_data_done 1
@@ -335,7 +330,7 @@
     mkdir /data/misc/dash 0770 media audio
 
     # Create directory for radio
-    mkdir /data/vendor/radio 0771 system radio
+    mkdir /data/vendor/radio 0773 system radio
 
     # Create directory used by display clients
     mkdir /data/misc/display 0770 system graphics
@@ -480,19 +475,15 @@
     # default country code
     setprop ro.boot.wificountrycode 00
 
-    # Encrypted ramoops
-    umount /sys/fs/pstore
-    chmod 770 /dev/access-ramoops
-    chown system system /dev/access-ramoops
-    chmod 770 /dev/access-metadata
-    chown system system /dev/access-metadata
-
     # Make the ftm4 command node writeable from dumpstate
     chown system system /sys/devices/virtual/input/ftm4_touch/cmd
 
     # ftm4 VR mode
     chown system system /sys/devices/virtual/input/ftm4_touch/vrmode
 
+    # WLAN debug access
+    chown system system /d/icnss/stats
+
 service vendor.init-elabel-sh /system/bin/init.elabel.sh
     class late_start
     user system
@@ -508,7 +499,7 @@
 service vendor.folio_daemon /system/bin/folio_daemon
     class late_start
     user system
-    group system
+    group system uhid
     disabled
 
 on property:init.svc.zygote=running
@@ -517,7 +508,7 @@
 on property:init.svc.zygote=stopped
     stop vendor.folio_daemon
 
-service vendor.thermal-engine /vendor/bin/thermal-engine -c ${sys.qcom.thermalcfg:-/vendor/etc/thermal-engine.conf}
+service vendor.thermal-engine /vendor/bin/thermal-engine -c ${vendor.qcom.thermalcfg:-/vendor/etc/thermal-engine.conf}
    class hal
    user root
    group root system diag
@@ -563,6 +554,8 @@
     chown system system /sys/devices/soc/soc:qcom,cpubw/devfreq/soc:qcom,cpubw/bw_hwmon/hyst_trigger_count
     chown system system /sys/devices/soc/soc:qcom,cpubw/devfreq/soc:qcom,cpubw/bw_hwmon/hist_memory
     chown system system /sys/devices/soc/soc:qcom,cpubw/devfreq/soc:qcom,cpubw/bw_hwmon/hyst_length
+    # Enable PowerHAL hint processing
+    setprop vendor.powerhal.init 1
 
 on property:sys.boot_completed=1
     # Enable power setting and set sys.post_boot.parsed to 1
@@ -618,6 +611,7 @@
 # we don't want to run swapon_all at that time.
 on sys-boot-completed-set && property:persist.sys.zram_enabled=1
     swapon_all /vendor/etc/fstab.${ro.hardware}
+    write /proc/sys/vm/swappiness 100
 
 on property:init.svc.vendor.per_mgr=running
     start vendor.per_proxy
@@ -841,13 +835,6 @@
     disabled
     oneshot
 
-service vendor.ramoops_sh /system/bin/init.ramoops.sh
-    class main
-    user root
-    group root system
-    disabled
-    oneshot
-
 # b/70518189 vDSO experiments
 on property:sys.vdso=*
    write /sys/module/vdso/parameters/enable_32 1
@@ -873,3 +860,45 @@
     setprop persist.vendor.charge.stop.level 35
     setprop persist.vendor.charge.start.level 30
 
+on property:sys.boot_completed=1
+    # Create pixel-trace.
+    # At this moment, only mm_event is available. If others want to put more,
+    # it should get hard review from pixel-perf-team.
+
+    mkdir /sys/kernel/debug/tracing/instances/pixel-trace 755 system system
+    chown system system /sys/kernel/debug/tracing/instances/pixel-trace/trace
+    chmod 0660 /sys/kernel/debug/tracing/instances/pixel-trace/trace
+    chown system system /sys/kernel/debug/tracing/instances/pixel-trace/tracing_on
+    chmod 0660 /sys/kernel/debug/tracing/instances/pixel-trace/tracing_on
+    write /sys/kernel/debug/tracing/instances/pixel-trace/buffer_size_kb 64
+    write /sys/kernel/debug/tracing/instances/pixel-trace/events/mm_event/enable 1
+
+# turns off tracing right before bugreporting to keep more traces
+on property:init.svc.dumpstatez=running
+    write /d/tracing/instances/pixel-trace/tracing_on 0
+
+on property:init.svc.dumpstatez=stopped
+    write /d/tracing/instances/pixel-trace/tracing_on 1
+
+on property:init.svc.bugreport=running
+    write /d/tracing/instances/pixel-trace/tracing_on 0
+
+on property:init.svc.bugreport=stopped
+    write /d/tracing/instances/pixel-trace/tracing_on 1
+
+# init-fingerprint-sh is for stopping fps_hal after init retry fail serval times
+# It keeps running until max init retry or fps_hal running successfully
+# vendor.fps_hal restarts until max init retry times
+#
+# /vendor/bin/init.fingerprint.sh [max_init_retry_times]
+service init-fingerprint-sh /vendor/bin/init.fingerprint.sh 10
+    group root
+    user root
+    disabled
+    oneshot
+
+on property:sys.boot_completed=1
+    start init-fingerprint-sh
+
+on property:vendor.fps.init.succeed=true && property:init.svc.vendor.fps_hal=stopped
+    start init-fingerprint-sh
diff --git a/init.hardware.usb.rc b/init.hardware.usb.rc
index 09ae4d5..a73170f 100644
--- a/init.hardware.usb.rc
+++ b/init.hardware.usb.rc
@@ -43,7 +43,7 @@
     write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100"
     mkdir /dev/usb-ffs 0775 shell shell
     mkdir /dev/usb-ffs/adb 0770 shell shell
-    mount functionfs adb /dev/usb-ffs/adb rmode=0770,fmode=0660,uid=2000,gid=2000
+    mount functionfs adb /dev/usb-ffs/adb rmode=0770,fmode=0660,uid=2000,gid=2000,no_disconnect=1
     mkdir /dev/usb-ffs/mtp 0770 mtp mtp
     mkdir /dev/usb-ffs/ptp 0770 mtp mtp
     mount functionfs mtp /dev/usb-ffs/mtp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1
diff --git a/init.ramoops.sh b/init.ramoops.sh
index 4c57a1a..37b69e5 100644
--- a/init.ramoops.sh
+++ b/init.ramoops.sh
@@ -1,4 +1,4 @@
-#!/system/bin/sh
+#!/vendor/bin/sh
 
 # Decrypt the keys and write them to the kernel
 ramoops -D
@@ -7,11 +7,11 @@
     # Pivot (and decrypt)
     echo 1 > /sys/devices/virtual/ramoops/pstore/use_alt
 else
-    setprop sys.ramoops.decryption.error $?
+    setprop vendor.ramoops.decryption.error $?
 fi
 
 # Trigger remount of pstore regardless of decryption state
-setprop sys.ramoops.decrypted true
+setprop vendor.ramoops.decrypted true
 
 # Generate keys (if none exist), and load the keys to carveout
 if [[ $(getprop ro.hardware) == "walleye" ]]; then
diff --git a/manifest.xml b/manifest.xml
index 25800a7..d77757a 100644
--- a/manifest.xml
+++ b/manifest.xml
@@ -2,7 +2,7 @@
     <hal format="hidl">
         <name>android.hardware.audio</name>
         <transport>hwbinder</transport>
-        <version>4.0</version>
+        <version>5.0</version>
         <interface>
             <name>IDevicesFactory</name>
             <instance>default</instance>
@@ -11,7 +11,7 @@
     <hal format="hidl">
         <name>android.hardware.audio.effect</name>
         <transport>hwbinder</transport>
-        <version>4.0</version>
+        <version>5.0</version>
         <interface>
             <name>IEffectsFactory</name>
             <instance>default</instance>
@@ -92,10 +92,10 @@
             <name>IDrmFactory</name>
             <instance>default</instance>
         </interface>
-        <fqname>@1.1::ICryptoFactory/clearkey</fqname>
-        <fqname>@1.1::IDrmFactory/clearkey</fqname>
-        <fqname>@1.1::ICryptoFactory/widevine</fqname>
-        <fqname>@1.1::IDrmFactory/widevine</fqname>
+        <fqname>@1.2::ICryptoFactory/clearkey</fqname>
+        <fqname>@1.2::IDrmFactory/clearkey</fqname>
+        <fqname>@1.2::ICryptoFactory/widevine</fqname>
+        <fqname>@1.2::IDrmFactory/widevine</fqname>
     </hal>
     <hal format="hidl">
         <name>android.hardware.dumpstate</name>
@@ -145,7 +145,7 @@
     <hal format="hidl">
         <name>android.hardware.graphics.mapper</name>
         <transport arch="32+64">passthrough</transport>
-        <version>2.0</version>
+        <version>2.1</version>
         <interface>
             <name>IMapper</name>
             <instance>default</instance>
@@ -228,6 +228,15 @@
         </interface>
     </hal>
     <hal format="hidl">
+        <name>android.hardware.power.stats</name>
+        <transport>hwbinder</transport>
+        <version>1.0</version>
+        <interface>
+            <name>IPowerStats</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
+    <hal format="hidl">
         <name>android.hardware.radio.deprecated</name>
         <transport>hwbinder</transport>
         <version>1.0</version>
@@ -270,7 +279,7 @@
     <hal format="hidl">
         <name>android.hardware.soundtrigger</name>
         <transport>hwbinder</transport>
-        <version>2.1</version>
+        <version>2.2</version>
         <interface>
             <name>ISoundTriggerHw</name>
             <instance>default</instance>
@@ -295,15 +304,6 @@
         </interface>
     </hal>
     <hal format="hidl">
-        <name>android.hardware.thermal</name>
-        <transport>hwbinder</transport>
-        <version>1.1</version>
-        <interface>
-            <name>IThermal</name>
-            <instance>default</instance>
-        </interface>
-    </hal>
-    <hal format="hidl">
         <name>android.hardware.usb</name>
         <transport>hwbinder</transport>
         <version>1.1</version>
@@ -331,15 +331,6 @@
         </interface>
     </hal>
     <hal format="hidl">
-        <name>android.hardware.vr</name>
-        <transport>hwbinder</transport>
-        <version>1.0</version>
-        <interface>
-            <name>IVr</name>
-            <instance>default</instance>
-        </interface>
-    </hal>
-    <hal format="hidl">
         <name>android.hardware.weaver</name>
         <transport>hwbinder</transport>
         <version>1.0</version>
@@ -351,7 +342,7 @@
     <hal format="hidl">
         <name>android.hardware.wifi</name>
         <transport>hwbinder</transport>
-        <version>1.2</version>
+        <version>1.3</version>
         <interface>
             <name>IWifi</name>
             <instance>default</instance>
@@ -360,7 +351,7 @@
     <hal format="hidl">
         <name>android.hardware.wifi.hostapd</name>
         <transport>hwbinder</transport>
-        <version>1.0</version>
+        <version>1.1</version>
         <interface>
             <name>IHostapd</name>
             <instance>default</instance>
@@ -369,7 +360,7 @@
     <hal format="hidl">
         <name>android.hardware.wifi.supplicant</name>
         <transport>hwbinder</transport>
-        <version>1.1</version>
+        <version>1.2</version>
         <interface>
             <name>ISupplicant</name>
             <instance>default</instance>
diff --git a/media_codecs.xml b/media_codecs.xml
index 1e314e2..82580bc 100644
--- a/media_codecs.xml
+++ b/media_codecs.xml
@@ -128,6 +128,11 @@
             <Limit name="bitrate" range="1-100000000" />
             <Limit name="frame-rate" range="1-240" />
             <Limit name="concurrent-instances" max="16" />
+            <Limit name="performance-point-3840x2160" value="30" />
+            <Limit name="performance-point-1920x1080" value="120" />
+            <Limit name="performance-point-1280x720" value="240" />
+            <Feature name="bitrate-modes" value="VBR,CBR" />
+            <Feature name="intra-refresh" />
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.encoder.mpeg4" type="video/mp4v-es" >
             <Quirk name="requires-allocate-on-input-ports" />
@@ -140,6 +145,9 @@
             <Limit name="bitrate" range="1-60000000" />
             <Limit name="frame-rate" range="1-240" />
             <Limit name="concurrent-instances" max="16" />
+            <Limit name="performance-point-1920x1080" value="60" />
+            <Limit name="performance-point-1280x720" value="120" />
+            <Feature name="bitrate-modes" value="VBR,CBR" />
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.encoder.h263" type="video/3gpp" >
             <Quirk name="requires-allocate-on-input-ports" />
@@ -152,6 +160,9 @@
             <Limit name="bitrate" range="1-2000000" />
             <Limit name="frame-rate" range="1-240" />
             <Limit name="concurrent-instances" max="16" />
+            <Limit name="performance-point-864x480" value="30" />
+            <Limit name="performance-point-720x480" value="30" />
+            <Feature name="bitrate-modes" value="VBR,CBR" />
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.encoder.vp8" type="video/x-vnd.on2.vp8" >
             <Quirk name="requires-allocate-on-input-ports" />
@@ -165,6 +176,11 @@
             <Limit name="bitrate" range="1-20000000" />
             <Limit name="frame-rate" range="1-240" />
             <Limit name="concurrent-instances" max="16" />
+            <Limit name="performance-point-3840x2160" value="30" />
+            <Limit name="performance-point-1920x1080" value="120" />
+            <Limit name="performance-point-1280x720" value="240" />
+            <Feature name="bitrate-modes" value="VBR,CBR" />
+            <Feature name="intra-refresh" />
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.encoder.hevc" type="video/hevc" >
             <Quirk name="requires-allocate-on-input-ports" />
@@ -178,6 +194,11 @@
             <Limit name="bitrate" range="1-100000000" />
             <Limit name="frame-rate" range="1-240" />
             <Limit name="concurrent-instances" max="16" />
+            <Limit name="performance-point-3840x2160" value="30" />
+            <Limit name="performance-point-1920x1080" value="120" />
+            <Limit name="performance-point-1280x720" value="240" />
+            <Feature name="bitrate-modes" value="VBR,CBR" />
+            <Feature name="intra-refresh" />
         </MediaCodec>
     </Encoders>
     <Decoders>
@@ -193,6 +214,9 @@
             <Limit name="bitrate" range="1-100000000" />
             <Feature name="adaptive-playback" />
             <Limit name="concurrent-instances" max="16" />
+            <Limit name="performance-point-4096x2160" value="56" />
+            <Limit name="performance-point-3840x2160" value="60" />
+            <Limit name="performance-point-1920x1080" value="240" />
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.decoder.avc.secure" type="video/avc" >
             <Quirk name="requires-allocate-on-input-ports" />
@@ -207,10 +231,13 @@
             <Feature name="adaptive-playback" />
             <Feature name="secure-playback" required="true" />
             <Limit name="concurrent-instances" max="6" />
+            <Limit name="performance-point-4096x2160" value="56" />
+            <Limit name="performance-point-3840x2160" value="60" />
+            <Limit name="performance-point-1920x1080" value="240" />
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.decoder.mpeg4" type="video/mp4v-es" >
             <Quirk name="requires-allocate-on-input-ports" />
-            <Quirk name="requires-allocate-on-output-ports"/>
+            <Quirk name="requires-allocate-on-output-ports" />
             <Limit name="size" min="64x64" max="1920x1088" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
@@ -219,6 +246,8 @@
             <Limit name="frame-rate" range="1-240" />
             <Feature name="adaptive-playback" />
             <Limit name="concurrent-instances" max="16" />
+            <Limit name="performance-point-1920x1080" value="60" />
+            <Limit name="performance-point-1280x720" value="120" />
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.decoder.h263" type="video/3gpp" >
             <Quirk name="requires-allocate-on-input-ports" />
@@ -230,6 +259,8 @@
             <Limit name="bitrate" range="1-2000000" />
             <Feature name="adaptive-playback" />
             <Limit name="concurrent-instances" max="16" />
+            <Limit name="performance-point-864x480" value="30" />
+            <Limit name="performance-point-720x480" value="30" />
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.decoder.vp8" type="video/x-vnd.on2.vp8" >
             <Quirk name="requires-allocate-on-input-ports" />
@@ -243,6 +274,9 @@
             <Limit name="frame-rate" range="1-240" />
             <Feature name="adaptive-playback" />
             <Limit name="concurrent-instances" max="16" />
+            <Limit name="performance-point-3840x2160" value="30" />
+            <Limit name="performance-point-1920x1080" value="120" />
+            <Limit name="performance-point-1280x720" value="240" />
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.decoder.vp9" type="video/x-vnd.on2.vp9" >
             <Quirk name="requires-allocate-on-input-ports" />
@@ -256,6 +290,9 @@
             <Limit name="frame-rate" range="1-240" />
             <Feature name="adaptive-playback" />
             <Limit name="concurrent-instances" max="16" />
+            <Limit name="performance-point-3840x2160" value="30" />
+            <Limit name="performance-point-1920x1080" value="120" />
+            <Limit name="performance-point-1280x720" value="240" />
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.decoder.vp9.secure" type="video/x-vnd.on2.vp9" >
             <Quirk name="requires-allocate-on-input-ports" />
@@ -270,6 +307,9 @@
             <Feature name="adaptive-playback" />
             <Feature name="secure-playback" required="true" />
             <Limit name="concurrent-instances" max="6" />
+            <Limit name="performance-point-3840x2160" value="30" />
+            <Limit name="performance-point-1920x1080" value="120" />
+            <Limit name="performance-point-1280x720" value="240" />
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.decoder.hevc" type="video/hevc" >
             <Quirk name="requires-allocate-on-input-ports" />
@@ -283,6 +323,9 @@
             <Limit name="frame-rate" range="1-240" />
             <Feature name="adaptive-playback" />
             <Limit name="concurrent-instances" max="16" />
+            <Limit name="performance-point-4096x2160" value="56" />
+            <Limit name="performance-point-3840x2160" value="60" />
+            <Limit name="performance-point-1920x1080" value="240" />
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.decoder.hevc.secure" type="video/hevc" >
             <Quirk name="requires-allocate-on-input-ports" />
@@ -297,6 +340,9 @@
             <Feature name="adaptive-playback" />
             <Feature name="secure-playback" required="true" />
             <Limit name="concurrent-instances" max="6" />
+            <Limit name="performance-point-4096x2160" value="56" />
+            <Limit name="performance-point-3840x2160" value="60" />
+            <Limit name="performance-point-1920x1080" value="240" />
         </MediaCodec>
         <!-- Audio Software  -->
     </Decoders>
diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml
index 8856a01..e760bb3 100755
--- a/overlay/frameworks/base/core/res/res/values/config.xml
+++ b/overlay/frameworks/base/core/res/res/values/config.xml
@@ -217,6 +217,11 @@
         <item>8</item>
     </integer-array>
 
+    <!-- Enables or disables haptic effect when the text insertion/selection handle is moved
+          manually by the user. Off by default, since the expected haptic feedback may not be
+          available on some devices. -->
+     <bool name="config_enableHapticTextHandle">true</bool>
+
     <!-- Make things go fast -->
     <bool name="config_ui_enableFadingMarquee">false</bool>
 
@@ -232,7 +237,7 @@
 
    <!-- Enable doze mode
          ComponentName of a dream to show whenever the system would otherwise have gone to sleep. -->
-    <string name="config_dozeComponent">com.android.systemui/com.android.systemui.doze.DozeService</string>
+    <string translatable="false" name="config_dozeComponent">com.android.systemui/com.android.systemui.doze.DozeService</string>
 
     <!-- If true, the doze component is not started until after the screen has been turned off
          and the screen off animation has been performed. -->
@@ -255,7 +260,7 @@
     <bool name="config_displayBrightnessBucketsInDoze">true</bool>
 
     <!-- ImsService package name to bind to by default, if config_dynamic_bind_ims is true -->
-    <string name="config_ims_package">org.codeaurora.ims</string>
+    <string name="config_ims_package" translatable="false">org.codeaurora.ims</string>
 
     <!-- Flag specifying whether or not IMS will use the ImsResolver dynamically -->
     <bool name="config_dynamic_bind_ims">true</bool>
@@ -350,12 +355,15 @@
     <!-- True if Unprocessed audio source supports the required frequency range and level -->
     <bool name="config_supportAudioSourceUnprocessed">true</bool>
 
-    <!-- Colon separated list of package names that should be granted DND access -->
-    <string name="config_defaultDndAccessPackages" translatable="false">com.google.android.gms:com.google.android.GoogleCamera:com.google.intelligence.sense:com.google.android.settings.intelligence</string>
-
     <!-- Specify model in case of attestation failure due to misprovisioned device. -->
     <string name="config_misprovisionedDeviceModel" translatable="false">Pixel 2</string>
 
     <!-- Brand value for attestation of misprovisioned device. -->
     <string name="config_misprovisionedBrandValue" translatable="false">htc</string>
+
+    <!-- True if the firmware supports connected MAC randomization -->
+    <bool name="config_wifi_connected_mac_randomization_supported">true</bool>
+
+    <!-- True if the firmware supports Wi-Fi link probing -->
+    <bool name="config_wifi_link_probing_supported">true</bool>
 </resources>
diff --git a/overlay/packages/apps/Bluetooth/res/values/config.xml b/overlay/packages/apps/Bluetooth/res/values/config.xml
index 6db14c0..e403105 100644
--- a/overlay/packages/apps/Bluetooth/res/values/config.xml
+++ b/overlay/packages/apps/Bluetooth/res/values/config.xml
@@ -29,4 +29,5 @@
 -->
 <resources>
     <bool name="profile_supported_sap">true</bool>
+    <bool name="profile_supported_hearing_aid">true</bool>
 </resources>
diff --git a/power-libperfmgr/Android.bp b/power-libperfmgr/Android.bp
index 8deca67..abdb5d7 100644
--- a/power-libperfmgr/Android.bp
+++ b/power-libperfmgr/Android.bp
@@ -16,7 +16,7 @@
     name: "android.hardware.power@1.2-service.wahoo-libperfmgr",
     relative_install_path: "hw",
     init_rc: ["android.hardware.power@1.2-service.wahoo-libperfmgr.rc"],
-    srcs: ["service.cpp", "Power.cpp", "InteractionHandler.cpp", "power-helper.c"],
+    srcs: ["service.cpp", "Power.cpp", "InteractionHandler.cpp"],
     cflags: [
         "-Wall",
         "-Werror",
diff --git a/power-libperfmgr/Power.cpp b/power-libperfmgr/Power.cpp
index 8a009c3..4bd533d 100644
--- a/power-libperfmgr/Power.cpp
+++ b/power-libperfmgr/Power.cpp
@@ -29,10 +29,6 @@
 #include <utils/Trace.h>
 
 #include "Power.h"
-#include "power-helper.h"
-
-/* RPM runs at 19.2Mhz. Divide by 19200 for msec */
-#define RPM_CLK 19200
 
 extern struct stat_pair rpm_stat_map[];
 
@@ -43,49 +39,60 @@
 namespace implementation {
 
 using ::android::hardware::power::V1_0::Feature;
-using ::android::hardware::power::V1_0::PowerStatePlatformSleepState;
 using ::android::hardware::power::V1_0::Status;
-using ::android::hardware::power::V1_1::PowerStateSubsystem;
-using ::android::hardware::power::V1_1::PowerStateSubsystemSleepState;
 using ::android::hardware::hidl_vec;
 using ::android::hardware::Return;
 using ::android::hardware::Void;
 
 Power::Power() :
-        mHintManager(HintManager::GetFromJSON("/vendor/etc/powerhint.json")),
-        mInteractionHandler(mHintManager),
+        mHintManager(nullptr),
+        mInteractionHandler(nullptr),
         mVRModeOn(false),
         mSustainedPerfModeOn(false),
-        mEncoderModeOn(false) {
-    mInteractionHandler.Init();
+        mEncoderModeOn(false),
+        mReady(false) {
+            mInitThread =
+            std::thread([this](){
+                            android::base::WaitForProperty(kPowerHalInitProp, "1");
+                            mHintManager = HintManager::GetFromJSON(kPowerHalConfigPath);
+                            if (!mHintManager) {
+                                LOG(FATAL) << "Invalid config: " << kPowerHalConfigPath;
+                            }
+                            mInteractionHandler = std::make_unique<InteractionHandler>(mHintManager);
+                            mInteractionHandler->Init();
 
-    std::string state = android::base::GetProperty(kPowerHalStateProp, "");
-    if (state == "VIDEO_ENCODE") {
-        ALOGI("Initialize with VIDEO_ENCODE on");
-        mHintManager->DoHint("VIDEO_ENCODE");
-        mEncoderModeOn = true;
-    } else if (state ==  "SUSTAINED_PERFORMANCE") {
-        ALOGI("Initialize with SUSTAINED_PERFORMANCE on");
-        mHintManager->DoHint("SUSTAINED_PERFORMANCE");
-        mSustainedPerfModeOn = true;
-    } else if (state == "VR_MODE") {
-        ALOGI("Initialize with VR_MODE on");
-        mHintManager->DoHint("VR_MODE");
-        mVRModeOn = true;
-    } else if (state == "VR_SUSTAINED_PERFORMANCE") {
-        ALOGI("Initialize with SUSTAINED_PERFORMANCE and VR_MODE on");
-        mHintManager->DoHint("VR_SUSTAINED_PERFORMANCE");
-        mSustainedPerfModeOn = true;
-        mVRModeOn = true;
-    } else {
-        ALOGI("Initialize PowerHAL");
-    }
+                            std::string state = android::base::GetProperty(kPowerHalStateProp, "");
+                            if (state == "VIDEO_ENCODE") {
+                                ALOGI("Initialize with VIDEO_ENCODE on");
+                                mHintManager->DoHint("VIDEO_ENCODE");
+                                mEncoderModeOn = true;
+                            } else if (state ==  "SUSTAINED_PERFORMANCE") {
+                                ALOGI("Initialize with SUSTAINED_PERFORMANCE on");
+                                mHintManager->DoHint("SUSTAINED_PERFORMANCE");
+                                mSustainedPerfModeOn = true;
+                            } else if (state == "VR_MODE") {
+                                ALOGI("Initialize with VR_MODE on");
+                                mHintManager->DoHint("VR_MODE");
+                                mVRModeOn = true;
+                            } else if (state == "VR_SUSTAINED_PERFORMANCE") {
+                                ALOGI("Initialize with SUSTAINED_PERFORMANCE and VR_MODE on");
+                                mHintManager->DoHint("VR_SUSTAINED_PERFORMANCE");
+                                mSustainedPerfModeOn = true;
+                                mVRModeOn = true;
+                            } else {
+                                ALOGI("Initialize PowerHAL");
+                            }
 
-    state = android::base::GetProperty(kPowerHalAudioProp, "");
-    if (state == "LOW_LATENCY") {
-        ALOGI("Initialize with AUDIO_LOW_LATENCY on");
-        mHintManager->DoHint("AUDIO_LOW_LATENCY");
-    }
+                            state = android::base::GetProperty(kPowerHalAudioProp, "");
+                            if (state == "AUDIO_LOW_LATENCY") {
+                                ALOGI("Initialize with AUDIO_LOW_LATENCY on");
+                                mHintManager->DoHint("AUDIO_LOW_LATENCY");
+                            }
+
+                            // Now start to take powerhint
+                            mReady.store(true);
+                        });
+            mInitThread.detach();
 }
 
 // Methods from ::android::hardware::power::V1_0::IPower follow.
@@ -94,7 +101,7 @@
 }
 
 Return<void> Power::powerHint(PowerHint_1_0 hint, int32_t data) {
-    if (!isSupportedGovernor()) {
+    if (!isSupportedGovernor() || !mReady) {
         return Void();
     }
 
@@ -103,7 +110,7 @@
             if (mVRModeOn || mSustainedPerfModeOn) {
                 ALOGV("%s: ignoring due to other active perf hints", __func__);
             } else {
-                mInteractionHandler.Acquire(data);
+                mInteractionHandler->Acquire(data);
             }
             break;
         case PowerHint_1_0::VIDEO_ENCODE:
@@ -120,17 +127,11 @@
                     ATRACE_INT("video_encode_lock", 1);
                     mHintManager->DoHint("VIDEO_ENCODE");
                     ALOGD("VIDEO_ENCODE ON");
-                    if (!android::base::SetProperty(kPowerHalStateProp, "VIDEO_ENCODE")) {
-                        ALOGE("%s: could not set powerHAL state property to VIDEO_ENCODE", __func__);
-                    }
                     mEncoderModeOn = true;
                 } else {
                     ATRACE_INT("video_encode_lock", 0);
                     mHintManager->EndHint("VIDEO_ENCODE");
                     ALOGD("VIDEO_ENCODE OFF");
-                    if (!android::base::SetProperty(kPowerHalStateProp, "")) {
-                        ALOGE("%s: could not clear powerHAL state property", __func__);
-                    }
                     mEncoderModeOn = false;
                 }
             }
@@ -141,15 +142,9 @@
                 ALOGD("SUSTAINED_PERFORMANCE ON");
                 if (!mVRModeOn) { // Sustained mode only.
                     mHintManager->DoHint("SUSTAINED_PERFORMANCE");
-                    if (!android::base::SetProperty(kPowerHalStateProp, "SUSTAINED_PERFORMANCE")) {
-                        ALOGE("%s: could not set powerHAL state property to SUSTAINED_PERFORMANCE", __func__);
-                    }
                 } else { // Sustained + VR mode.
                     mHintManager->EndHint("VR_MODE");
                     mHintManager->DoHint("VR_SUSTAINED_PERFORMANCE");
-                    if (!android::base::SetProperty(kPowerHalStateProp, "VR_SUSTAINED_PERFORMANCE")) {
-                        ALOGE("%s: could not set powerHAL state property to VR_SUSTAINED_PERFORMANCE", __func__);
-                    }
                 }
                 mSustainedPerfModeOn = true;
             } else if (!data && mSustainedPerfModeOn) {
@@ -158,13 +153,6 @@
                 mHintManager->EndHint("SUSTAINED_PERFORMANCE");
                 if (mVRModeOn) { // Switch back to VR Mode.
                     mHintManager->DoHint("VR_MODE");
-                    if (!android::base::SetProperty(kPowerHalStateProp, "VR_MODE")) {
-                        ALOGE("%s: could not set powerHAL state property to VR_MODE", __func__);
-                    }
-                } else {
-                    if (!android::base::SetProperty(kPowerHalStateProp, "")) {
-                        ALOGE("%s: could not clear powerHAL state property", __func__);
-                    }
                 }
                 mSustainedPerfModeOn = false;
             }
@@ -174,15 +162,9 @@
                 ALOGD("VR_MODE ON");
                 if (!mSustainedPerfModeOn) { // VR mode only.
                     mHintManager->DoHint("VR_MODE");
-                    if (!android::base::SetProperty(kPowerHalStateProp, "VR_MODE")) {
-                        ALOGE("%s: could not set powerHAL state property to VR_MODE", __func__);
-                    }
                 } else { // Sustained + VR mode.
                     mHintManager->EndHint("SUSTAINED_PERFORMANCE");
                     mHintManager->DoHint("VR_SUSTAINED_PERFORMANCE");
-                    if (!android::base::SetProperty(kPowerHalStateProp, "VR_SUSTAINED_PERFORMANCE")) {
-                        ALOGE("%s: could not set powerHAL state property to VR_SUSTAINED_PERFORMANCE", __func__);
-                    }
                 }
                 mVRModeOn = true;
             } else if (!data && mVRModeOn) {
@@ -191,13 +173,6 @@
                 mHintManager->EndHint("VR_MODE");
                 if (mSustainedPerfModeOn) { // Switch back to sustained Mode.
                     mHintManager->DoHint("SUSTAINED_PERFORMANCE");
-                    if (!android::base::SetProperty(kPowerHalStateProp, "SUSTAINED_PERFORMANCE")) {
-                        ALOGE("%s: could not set powerHAL state property to SUSTAINED_PERFORMANCE", __func__);
-                    }
-                } else {
-                    if (!android::base::SetProperty(kPowerHalStateProp, "")) {
-                        ALOGE("%s: could not clear powerHAL state property", __func__);
-                    }
                 }
                 mVRModeOn = false;
             }
@@ -233,166 +208,15 @@
 }
 
 Return<void> Power::getPlatformLowPowerStats(getPlatformLowPowerStats_cb _hidl_cb) {
-
-    hidl_vec<PowerStatePlatformSleepState> states;
-    uint64_t stats[MAX_PLATFORM_STATS * MAX_RPM_PARAMS] = {0};
-    uint64_t *values;
-    struct PowerStatePlatformSleepState *state;
-    int ret;
-
-    states.resize(PLATFORM_SLEEP_MODES_COUNT);
-
-    ret = extract_platform_stats(stats);
-    if (ret != 0) {
-        states.resize(0);
-        goto done;
-    }
-
-    /* Update statistics for XO_shutdown */
-    state = &states[RPM_MODE_XO];
-    state->name = "XO_shutdown";
-    values = stats + (RPM_MODE_XO * MAX_RPM_PARAMS);
-
-    state->residencyInMsecSinceBoot = values[1];
-    state->totalTransitions = values[0];
-    state->supportedOnlyInSuspend = false;
-    state->voters.resize(XO_VOTERS);
-    for(size_t i = 0; i < XO_VOTERS; i++) {
-        int voter = static_cast<int>(i + XO_VOTERS_START);
-        state->voters[i].name = rpm_stat_map[voter].label;
-        values = stats + (voter * MAX_RPM_PARAMS);
-        state->voters[i].totalTimeInMsecVotedForSinceBoot = values[0] / RPM_CLK;
-        state->voters[i].totalNumberOfTimesVotedSinceBoot = values[1];
-    }
-
-    /* Update statistics for VMIN state */
-    state = &states[RPM_MODE_VMIN];
-    state->name = "VMIN";
-    values = stats + (RPM_MODE_VMIN * MAX_RPM_PARAMS);
-
-    state->residencyInMsecSinceBoot = values[1];
-    state->totalTransitions = values[0];
-    state->supportedOnlyInSuspend = false;
-    state->voters.resize(VMIN_VOTERS);
-    //Note: No filling of state voters since VMIN_VOTERS = 0
-
-done:
-    _hidl_cb(states, Status::SUCCESS);
+    LOG(ERROR) << "getPlatformLowPowerStats not supported. Use IPowerStats HAL.";
+    _hidl_cb({}, Status::SUCCESS);
     return Void();
 }
 
-static int get_wlan_low_power_stats(struct PowerStateSubsystem *subsystem) {
-    uint64_t stats[WLAN_POWER_PARAMS_COUNT] = {0};
-    struct PowerStateSubsystemSleepState *state;
-
-    subsystem->name = "wlan";
-
-    if (extract_wlan_stats(stats) != 0) {
-        subsystem->states.resize(0);
-        return -1;
-    }
-
-    subsystem->states.resize(WLAN_STATES_COUNT);
-
-    /* Update statistics for Active State */
-    state = &subsystem->states[WLAN_STATE_ACTIVE];
-    state->name = "Active";
-    state->residencyInMsecSinceBoot = stats[CUMULATIVE_TOTAL_ON_TIME_MS];
-    state->totalTransitions = stats[DEEP_SLEEP_ENTER_COUNTER];
-    state->lastEntryTimestampMs = 0; //FIXME need a new value from Qcom
-    state->supportedOnlyInSuspend = false;
-
-    /* Update statistics for Deep-Sleep state */
-    state = &subsystem->states[WLAN_STATE_DEEP_SLEEP];
-    state->name = "Deep-Sleep";
-    state->residencyInMsecSinceBoot = stats[CUMULATIVE_SLEEP_TIME_MS];
-    state->totalTransitions = stats[DEEP_SLEEP_ENTER_COUNTER];
-    state->lastEntryTimestampMs = stats[LAST_DEEP_SLEEP_ENTER_TSTAMP_MS];
-    state->supportedOnlyInSuspend = false;
-
-    return 0;
-}
-
-enum easel_state {
-    EASEL_OFF = 0,
-    EASEL_ON,
-    EASEL_SUSPENDED,
-    NUM_EASEL_STATES
-};
-
-// Get low power stats for easel subsystem
-static int get_easel_low_power_stats(struct PowerStateSubsystem *subsystem) {
-    // This implementation is a workaround to provide minimal visibility into
-    // Easel state behavior until canonical low power stats are supported.
-    // It takes an "external observer" snapshot of the current Easel state every
-    // time it is called, and synthesizes an artificial sleep state that will
-    // behave similarly to real stats if Easel gets "wedged" in the "on" state.
-    static std::mutex statsLock;
-    static uint64_t totalOnSnapshotCount = 0;
-    static uint64_t totalNotOnSnapshotCount = 0;
-    unsigned long currentState;
-    struct PowerStateSubsystemSleepState *state;
-
-    subsystem->name = "Easel";
-
-    if (get_easel_state(&currentState) != 0) {
-        subsystem->states.resize(0);
-        return -1;
-    }
-
-    if (currentState >= NUM_EASEL_STATES) {
-        ALOGE("%s: unrecognized Easel state(%lu)", __func__, currentState);
-        return -1;
-    }
-
-    subsystem->states.resize(1);
-
-    // Since we are storing stats locally but can have multiple parallel
-    // callers, locking is required to ensure stats are not corrupted.
-    std::lock_guard<std::mutex> lk(statsLock);
-
-    // Update statistics for synthetic sleep state.  We combine OFF and
-    // SUSPENDED to act as a composite "not on" state so the numbers will behave
-    // like a real sleep state.
-    if ((currentState == EASEL_OFF) || (currentState == EASEL_SUSPENDED)) {
-        totalNotOnSnapshotCount++;
-    } else {
-        totalOnSnapshotCount++;
-    }
-
-    // Update statistics for synthetic sleep state, where
-    // totalTransitions = cumulative count of Easel state0 (as seen by PowerHAL)
-    // residencyInMsecsSinceBoot = cumulative count of Easel state1 (as seen by
-    //   PowerHAL)
-    // lastEntryTimestampMs = cumulative count of Easel state2 (as seen by
-    //   PowerHAL)
-    state = &subsystem->states[0];
-    state->name = "SyntheticSleep";
-    state->totalTransitions = totalOnSnapshotCount;
-    state->residencyInMsecSinceBoot = totalNotOnSnapshotCount;
-    state->lastEntryTimestampMs = 0;  // No added value for the workaround
-    state->supportedOnlyInSuspend = false;
-
-    return 0;
-}
-
 // Methods from ::android::hardware::power::V1_1::IPower follow.
 Return<void> Power::getSubsystemLowPowerStats(getSubsystemLowPowerStats_cb _hidl_cb) {
-    hidl_vec<PowerStateSubsystem> subsystems;
-
-    subsystems.resize(SUBSYSTEM_COUNT);
-
-    // Get WLAN subsystem low power stats.
-    if (get_wlan_low_power_stats(&subsystems[SUBSYSTEM_WLAN]) != 0) {
-        ALOGE("%s: failed to process wlan stats", __func__);
-    }
-
-    // Get Easel subsystem low power stats.
-    if (get_easel_low_power_stats(&subsystems[SUBSYSTEM_EASEL]) != 0) {
-        ALOGE("%s: failed to process Easel stats", __func__);
-    }
-
-    _hidl_cb(subsystems, Status::SUCCESS);
+    LOG(ERROR) << "getSubsystemLowPowerStats not supported. Use IPowerStats HAL.";
+    _hidl_cb({}, Status::SUCCESS);
     return Void();
 }
 
@@ -417,7 +241,7 @@
 
 // Methods from ::android::hardware::power::V1_2::IPower follow.
 Return<void> Power::powerHintAsync_1_2(PowerHint_1_2 hint, int32_t data) {
-    if (!isSupportedGovernor()) {
+    if (!isSupportedGovernor() || !mReady) {
         return Void();
     }
 
@@ -429,16 +253,10 @@
                 ATRACE_INT("audio_low_latency_lock", 1);
                 mHintManager->DoHint("AUDIO_LOW_LATENCY");
                 ALOGD("AUDIO LOW LATENCY ON");
-                if (!android::base::SetProperty(kPowerHalAudioProp, "LOW_LATENCY")) {
-                    ALOGE("%s: could not set powerHAL audio state property to LOW_LATENCY", __func__);
-                }
             } else {
                 ATRACE_INT("audio_low_latency_lock", 0);
                 mHintManager->EndHint("AUDIO_LOW_LATENCY");
                 ALOGD("AUDIO LOW LATENCY OFF");
-                if (!android::base::SetProperty(kPowerHalAudioProp, "")) {
-                    ALOGE("%s: could not clear powerHAL audio state property", __func__);
-                }
             }
             ATRACE_END();
             break;
@@ -518,7 +336,7 @@
 }
 
 Return<void> Power::debug(const hidl_handle& handle, const hidl_vec<hidl_string>&) {
-    if (handle != nullptr && handle->numFds >= 1) {
+    if (handle != nullptr && handle->numFds >= 1 && mReady) {
         int fd = handle->data[0];
 
         std::string buf(android::base::StringPrintf("HintManager Running: %s\n"
diff --git a/power-libperfmgr/Power.h b/power-libperfmgr/Power.h
index a39323f..265d5c4 100644
--- a/power-libperfmgr/Power.h
+++ b/power-libperfmgr/Power.h
@@ -18,6 +18,7 @@
 #define ANDROID_HARDWARE_POWER_V1_2_POWER_H
 
 #include <atomic>
+#include <thread>
 
 #include <android/hardware/power/1.2/IPower.h>
 #include <hidl/MQDescriptor.h>
@@ -43,6 +44,8 @@
 
 constexpr char kPowerHalStateProp[] = "vendor.powerhal.state";
 constexpr char kPowerHalAudioProp[] = "vendor.powerhal.audio";
+constexpr char kPowerHalInitProp[] = "vendor.powerhal.init";
+constexpr char kPowerHalConfigPath[] = "/vendor/etc/powerhint.json";
 
 struct Power : public IPower {
     // Methods from ::android::hardware::power::V1_0::IPower follow.
@@ -68,10 +71,12 @@
     static bool isSupportedGovernor();
 
     std::shared_ptr<HintManager> mHintManager;
-    InteractionHandler mInteractionHandler;
+    std::unique_ptr<InteractionHandler> mInteractionHandler;
     std::atomic<bool> mVRModeOn;
     std::atomic<bool> mSustainedPerfModeOn;
     std::atomic<bool> mEncoderModeOn;
+    std::atomic<bool> mReady;
+    std::thread mInitThread;
 };
 
 }  // namespace implementation
diff --git a/power-libperfmgr/android.hardware.power@1.2-service.wahoo-libperfmgr.rc b/power-libperfmgr/android.hardware.power@1.2-service.wahoo-libperfmgr.rc
index d77b8f0..1ab6f63 100644
--- a/power-libperfmgr/android.hardware.power@1.2-service.wahoo-libperfmgr.rc
+++ b/power-libperfmgr/android.hardware.power@1.2-service.wahoo-libperfmgr.rc
@@ -12,10 +12,23 @@
 # restart powerHAL when cameraHAL died
 on property:init.svc.vendor.camera-provider-2-4=restarting && property:vendor.powerhal.state=VIDEO_ENCODE
    setprop vendor.powerhal.state ""
-   setprop vendor.powerhal.audio ""
    restart vendor.power-hal-1-2
 
 # restart powerHAL when audioHAL died
-on property:init.svc.vendor.audio-hal-2-0=restarting && property:vendor.powerhal.audio=LOW_LATENCY
+on property:init.svc.vendor.audio-hal-2-0=restarting && property:vendor.powerhal.audio=AUDIO_LOW_LATENCY
    setprop vendor.powerhal.audio ""
    restart vendor.power-hal-1-2
+
+# reset touch and thermal-engine config when framework died and thermal-engine is in VR mode
+on property:init.svc.zygote=restarting && property:vendor.qcom.thermalcfg=/vendor/etc/thermal-engine-vr.conf
+   write /sys/devices/virtual/input/ftm4_touch/vrmode 0
+   setprop vendor.qcom.thermalcfg "/vendor/etc/thermal-engine.conf"
+
+on property:vendor.qcom.thermalcfg=*
+   restart vendor.thermal-engine
+
+on property:ro.hardware=taimen && property:vendor.qcom.thermalcfg=/vendor/etc/thermal-engine-vr.conf
+   write /sys/devices/virtual/input/ftm4_touch/vrmode 1
+
+on property:ro.hardware=taimen && property:vendor.qcom.thermalcfg=/vendor/etc/thermal-engine.conf
+   write /sys/devices/virtual/input/ftm4_touch/vrmode 0
diff --git a/power-libperfmgr/power-helper.c b/power-libperfmgr/power-helper.c
deleted file mode 100644
index 059e358..0000000
--- a/power-libperfmgr/power-helper.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * *    * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- *       copyright notice, this list of conditions and the following
- *       disclaimer in the documentation and/or other materials provided
- *       with the distribution.
- *     * Neither the name of The Linux Foundation nor the names of its
- *       contributors may be used to endorse or promote products derived
- *       from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define LOG_NIDEBUG 0
-#define LOG_TAG "android.hardware.power@1.2-service.wahoo-libperfmgr"
-
-#include <errno.h>
-#include <inttypes.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <dlfcn.h>
-#include <stdlib.h>
-
-#include <log/log.h>
-
-#include "power-helper.h"
-
-#ifndef RPM_SYSTEM_STAT
-#define RPM_SYSTEM_STAT "/d/system_stats"
-#endif
-
-#ifndef WLAN_POWER_STAT
-#define WLAN_POWER_STAT "/d/wlan0/power_stats"
-#endif
-
-#ifndef EASEL_STATE_FILE
-#define EASEL_STATE_FILE "/sys/devices/virtual/misc/mnh_sm/state"
-#endif
-
-#define ARRAY_SIZE(x) (sizeof((x))/sizeof((x)[0]))
-#define LINE_SIZE 128
-
-const char *rpm_stat_params[MAX_RPM_PARAMS] = {
-    "count",
-    "actual last sleep(msec)",
-};
-
-const char *master_stat_params[MAX_RPM_PARAMS] = {
-    "Accumulated XO duration",
-    "XO Count",
-};
-
-struct stat_pair rpm_stat_map[] = {
-    { RPM_MODE_XO,   "RPM Mode:vlow", rpm_stat_params, ARRAY_SIZE(rpm_stat_params) },
-    { RPM_MODE_VMIN, "RPM Mode:vmin", rpm_stat_params, ARRAY_SIZE(rpm_stat_params) },
-    { VOTER_APSS,    "APSS",    master_stat_params, ARRAY_SIZE(master_stat_params) },
-    { VOTER_MPSS,    "MPSS",    master_stat_params, ARRAY_SIZE(master_stat_params) },
-    { VOTER_ADSP,    "ADSP",    master_stat_params, ARRAY_SIZE(master_stat_params) },
-    { VOTER_SLPI,    "SLPI",    master_stat_params, ARRAY_SIZE(master_stat_params) },
-};
-
-
-const char *wlan_power_stat_params[] = {
-    "cumulative_sleep_time_ms",
-    "cumulative_total_on_time_ms",
-    "deep_sleep_enter_counter",
-    "last_deep_sleep_enter_tstamp_ms"
-};
-
-struct stat_pair wlan_stat_map[] = {
-    { WLAN_POWER_DEBUG_STATS, "POWER DEBUG STATS", wlan_power_stat_params, ARRAY_SIZE(wlan_power_stat_params) },
-};
-
-static int parse_stats(const char **params, size_t params_size,
-                       uint64_t *list, FILE *fp) {
-    ssize_t nread;
-    size_t len = LINE_SIZE;
-    char *line;
-    size_t params_read = 0;
-    size_t i;
-
-    line = malloc(len);
-    if (!line) {
-        ALOGE("%s: no memory to hold line", __func__);
-        return -ENOMEM;
-    }
-
-    while ((params_read < params_size) &&
-        (nread = getline(&line, &len, fp) > 0)) {
-        char *key = line + strspn(line, " \t");
-        char *value = strchr(key, ':');
-        if (!value || (value > (line + len)))
-            continue;
-        *value++ = '\0';
-
-        for (i = 0; i < params_size; i++) {
-            if (!strcmp(key, params[i])) {
-                list[i] = strtoull(value, NULL, 0);
-                params_read++;
-                break;
-            }
-        }
-    }
-    free(line);
-
-    return 0;
-}
-
-
-static int extract_stats(uint64_t *list, char *file,
-                         struct stat_pair *map, size_t map_size) {
-    FILE *fp;
-    ssize_t read;
-    size_t len = LINE_SIZE;
-    char *line;
-    size_t i, stats_read = 0;
-    int ret = 0;
-
-    fp = fopen(file, "re");
-    if (fp == NULL) {
-        ALOGE("%s: failed to open: %s Error = %s", __func__, file, strerror(errno));
-        return -errno;
-    }
-
-    line = malloc(len);
-    if (!line) {
-        ALOGE("%s: no memory to hold line", __func__);
-        fclose(fp);
-        return -ENOMEM;
-    }
-
-    while ((stats_read < map_size) && (read = getline(&line, &len, fp) != -1)) {
-        size_t begin = strspn(line, " \t");
-
-        for (i = 0; i < map_size; i++) {
-            if (!strncmp(line + begin, map[i].label, strlen(map[i].label))) {
-                stats_read++;
-                break;
-            }
-        }
-
-        if (i == map_size)
-            continue;
-
-        ret = parse_stats(map[i].parameters, map[i].num_parameters,
-                          &list[map[i].stat * MAX_RPM_PARAMS], fp);
-        if (ret < 0)
-            break;
-    }
-    free(line);
-    fclose(fp);
-
-    return ret;
-}
-
-int extract_platform_stats(uint64_t *list) {
-    return extract_stats(list, RPM_SYSTEM_STAT, rpm_stat_map, ARRAY_SIZE(rpm_stat_map));
-}
-
-int extract_wlan_stats(uint64_t *list) {
-    return extract_stats(list, WLAN_POWER_STAT, wlan_stat_map, ARRAY_SIZE(wlan_stat_map));
-}
-
-int get_easel_state(unsigned long *current_state) {
-    FILE *fp = NULL;
-    static const size_t EASEL_STATE_LINE_SIZE = 16;
-    char buffer[EASEL_STATE_LINE_SIZE];
-    char *parse_end = buffer;
-    unsigned long state;
-
-    if (current_state == NULL) {
-        ALOGD("%s: null current_state pointer from caller", __func__);
-        return -1;
-    }
-
-    fp = fopen(EASEL_STATE_FILE, "re");
-    if (fp == NULL) {
-        ALOGE("%s: failed to open: %s Error = %s", __func__, EASEL_STATE_FILE,
-                strerror(errno));
-        return -errno;
-    }
-
-    if (fgets(buffer, EASEL_STATE_LINE_SIZE, fp) == NULL) {
-        fclose(fp);
-        ALOGE("%s: failed to read: %s", __func__, EASEL_STATE_FILE);
-        return -1;
-    }
-
-    fclose(fp);
-
-    parse_end = buffer;
-    state = strtoul(buffer, &parse_end, 10);
-    if ((parse_end == buffer) || (state > 2)) {
-        ALOGE("%s: unrecognized format: %s '%s'", __func__, EASEL_STATE_FILE,
-                buffer);
-        return -1;
-    }
-
-    *current_state = state;
-
-    return 0;
-}
-
diff --git a/power-libperfmgr/power-helper.h b/power-libperfmgr/power-helper.h
deleted file mode 100644
index 0e12396..0000000
--- a/power-libperfmgr/power-helper.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2018, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * *    * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- *       copyright notice, this list of conditions and the following
- *       disclaimer in the documentation and/or other materials provided
- *       with the distribution.
- *     * Neither the name of The Linux Foundation nor the names of its
- *       contributors may be used to endorse or promote products derived
- *       from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __POWER_HELPER_H__
-#define __POWER_HELPER_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum stats_type {
-    //Platform Stats
-    RPM_MODE_XO = 0,
-    RPM_MODE_VMIN,
-    RPM_MODE_MAX,
-    XO_VOTERS_START = RPM_MODE_MAX,
-    VOTER_APSS = XO_VOTERS_START,
-    VOTER_MPSS,
-    VOTER_ADSP,
-    VOTER_SLPI,
-    MAX_PLATFORM_STATS,
-
-    //WLAN Stats
-    WLAN_POWER_DEBUG_STATS = 0,
-    MAX_WLAN_STATS,
-};
-
-enum subsystem_type {
-    SUBSYSTEM_WLAN = 0,
-    SUBSYSTEM_EASEL,
-
-    //Don't add any lines after this line
-    SUBSYSTEM_COUNT
-};
-
-enum wlan_sleep_states {
-    WLAN_STATE_ACTIVE = 0,
-    WLAN_STATE_DEEP_SLEEP,
-
-    //Don't add any lines after this line
-    WLAN_STATES_COUNT
-};
-
-enum wlan_power_params {
-    CUMULATIVE_SLEEP_TIME_MS = 0,
-    CUMULATIVE_TOTAL_ON_TIME_MS,
-    DEEP_SLEEP_ENTER_COUNTER,
-    LAST_DEEP_SLEEP_ENTER_TSTAMP_MS,
-
-    //Don't add any lines after this line
-    WLAN_POWER_PARAMS_COUNT
-};
-
-
-#define PLATFORM_SLEEP_MODES_COUNT RPM_MODE_MAX
-
-#define MAX_RPM_PARAMS 2
-#define XO_VOTERS (MAX_PLATFORM_STATS - XO_VOTERS_START)
-#define VMIN_VOTERS 0
-
-struct stat_pair {
-    enum stats_type stat;
-    const char *label;
-    const char **parameters;
-    size_t num_parameters;
-};
-
-int extract_platform_stats(uint64_t *list);
-int extract_wlan_stats(uint64_t *list);
-int get_easel_state(unsigned long *current_state);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //__POWER_HELPER_H__
diff --git a/powerhint.json b/powerhint.json
index f078974..216df91 100644
--- a/powerhint.json
+++ b/powerhint.json
@@ -134,17 +134,59 @@
         "100"
       ],
       "HoldFd": true
+    },
+    {
+      "Name": "PowerHALMainState",
+      "Path": "vendor.powerhal.state",
+      "Values": [
+        "VIDEO_ENCODE",
+        "VR_SUSTAINED_PERFORMANCE",
+        "SUSTAINED_PERFORMANCE",
+        "VR_MODE",
+        ""
+      ],
+      "Type": "Property"
+    },
+    {
+      "Name": "PowerHALAudioState",
+      "Path": "vendor.powerhal.audio",
+      "Values": [
+        "AUDIO_LOW_LATENCY",
+        ""
+      ],
+      "Type": "Property"
+    },
+    {
+      "Name": "ThermalConfig",
+      "Path": "vendor.qcom.thermalcfg",
+      "Values": [
+        "/vendor/etc/thermal-engine-vr.conf",
+        "/vendor/etc/thermal-engine.conf"
+      ],
+      "Type": "Property"
     }
   ],
   "Actions": [
     {
       "PowerHint": "VIDEO_ENCODE",
+      "Node": "PowerHALMainState",
+      "Duration": 0,
+      "Value": "VIDEO_ENCODE"
+    },
+    {
+      "PowerHint": "VIDEO_ENCODE",
       "Node": "CPUBigClusterMaxFreq",
       "Duration": 0,
       "Value": "1958400"
     },
     {
       "PowerHint": "SUSTAINED_PERFORMANCE",
+      "Node": "PowerHALMainState",
+      "Duration": 0,
+      "Value": "SUSTAINED_PERFORMANCE"
+    },
+    {
+      "PowerHint": "SUSTAINED_PERFORMANCE",
       "Node": "CPUBigClusterMaxFreq",
       "Duration": 0,
       "Value": "1267200"
@@ -163,6 +205,18 @@
     },
     {
       "PowerHint": "VR_MODE",
+      "Node": "PowerHALMainState",
+      "Duration": 0,
+      "Value": "VR_MODE"
+    },
+    {
+      "PowerHint": "VR_MODE",
+      "Node": "ThermalConfig",
+      "Duration": 0,
+      "Value": "/vendor/etc/thermal-engine-vr.conf"
+    },
+    {
+      "PowerHint": "VR_MODE",
       "Node": "CPUBigClusterMaxFreq",
       "Duration": 0,
       "Value": "1574400"
@@ -205,6 +259,18 @@
     },
     {
       "PowerHint": "VR_SUSTAINED_PERFORMANCE",
+      "Node": "PowerHALMainState",
+      "Duration": 0,
+      "Value": "VR_MODE"
+    },
+    {
+      "PowerHint": "VR_SUSTAINED_PERFORMANCE",
+      "Node": "ThermalConfig",
+      "Duration": 0,
+      "Value": "/vendor/etc/thermal-engine-vr.conf"
+    },
+    {
+      "PowerHint": "VR_SUSTAINED_PERFORMANCE",
       "Node": "CPUBigClusterMaxFreq",
       "Duration": 0,
       "Value": "1344000"
@@ -445,9 +511,15 @@
     },
     {
       "PowerHint": "AUDIO_LOW_LATENCY",
+      "Node": "PowerHALAudioState",
+      "Duration": 0,
+      "Value": "AUDIO_LOW_LATENCY"
+    },
+    {
+      "PowerHint": "AUDIO_LOW_LATENCY",
       "Node": "PMQoSCpuDmaLatency",
       "Duration": 0,
       "Value": "44"
     }
   ]
-}
\ No newline at end of file
+}
diff --git a/powerhint.xml b/powerhint.xml
deleted file mode 100755
index 01d6e42..0000000
--- a/powerhint.xml
+++ /dev/null
@@ -1,102 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-
-<!--
-/* Copyright (c) 2016, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- *       copyright notice, this list of conditions and the following
- *       disclaimer in the documentation and/or other materials provided
- *       with the distribution.
- *     * Neither the name of The Linux Foundation nor the names of its
- *       contributors may be used to endorse or promote products derived
- *       from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
--->
-
-<Powerhint>
-    <Hint type="0x0A00"> <!--video encode 30 fps-->
-        <Resource opcode="0x40804000" value="0x7A6"/>   <!-- B CPU - Cluster max freq ~1.958 Ghz -->
-    </Hint>
-    <Hint type="0x0F00"> <!--sustained performance-->
-        <Resource opcode="0x40800000" value="0x0"/>     <!-- B CPU - Cluster min freq uncapped -->
-        <Resource opcode="0x40800100" value="0x0"/>     <!-- L CPU - Cluster min freq uncapped -->
-        <Resource opcode="0x40804000" value="0x4E0"/>   <!-- B CPU - Cluster max freq ~1.2 GHz -->
-        <Resource opcode="0x40804100" value="0x4E0"/>   <!-- L CPU - Cluster max freq ~1.2 Ghz -->
-        <Resource opcode="0x42810000" value="0x156"/>   <!-- GPU - max freq 342 Mhz -->
-        <Resource opcode="0x42814000" value="0x0"/>     <!-- GPUBW freq uncapped -->
-    </Hint>
-    <Hint type="0x1000"> <!--vr mode-->
-        <Resource opcode="0x40800000" value="0x626"/>   <!-- B CPU - Cluster min freq ~1.4 Ghz -->
-        <Resource opcode="0x40800100" value="0x613"/>   <!-- L CPU - Cluster min freq ~1.4 Ghz -->
-        <Resource opcode="0x40804000" value="0x626"/>   <!-- B CPU - Cluster max freq ~1.4 Ghz -->
-        <Resource opcode="0x40804100" value="0x613"/>   <!-- L CPU - Cluster max freq ~1.4 Ghz -->
-        <Resource opcode="0x4280C000" value="0x203"/>   <!-- GPU - min freq 515 Mhz -->
-        <Resource opcode="0x42810000" value="0x203"/>   <!-- GPU - max freq 515 Mhz -->
-        <Resource opcode="0x42814000" value="0x2E57"/>  <!-- GPUBW freq 1555 Mhz-->
-    </Hint>
-    <Hint type="0x1001"> <!--vr mode sustained performance-->
-        <Resource opcode="0x40800000" value="0x540"/>   <!-- B CPU - Cluster min freq ~1.5 Ghz -->
-        <Resource opcode="0x40800100" value="0x5c6"/>   <!-- L CPU - Cluster min freq ~1.3 Ghz -->
-        <Resource opcode="0x40804000" value="0x540"/>   <!-- B CPU - Cluster max freq ~1.5 Ghz -->
-        <Resource opcode="0x40804100" value="0x5c6"/>   <!-- L CPU - Cluster max freq ~1.3 Ghz -->
-        <Resource opcode="0x4280C000" value="0x19E"/>   <!-- GPU - min freq 414 Mhz -->
-        <Resource opcode="0x42810000" value="0x19E"/>   <!-- GPU - max freq 414 Mhz -->
-        <Resource opcode="0x42814000" value="0x1E4F"/>  <!-- GPUBW freq 1017 Mhz -->
-    </Hint>
-    <Hint type="0x1A00"> <!--interaction-->
-        <Resource opcode="0x40800000" value="0x44C"/>     <!-- B CPU - Cluster min freq ~1.1 Ghz -->
-        <Resource opcode="0x40800100" value="0x44C"/>     <!-- L CPU - Cluster min freq ~1.1 Ghz -->
-        <Resource opcode="0x42C18000" value="0x32"/>      <!-- Top App schedtune boost to 50 -->
-        <Resource opcode="0x4180C000" value="0x0"/>       <!-- CPUBW disable hysteresis -->
-        <Resource opcode="0x41800000" value="0x33"/>      <!-- CPUBW min freq 681 MHz -->
-    </Hint>
-    <Hint type="0x1B00"> <!--boost-->
-        <Resource opcode="0x40800000" value="0xFFF"/>     <!-- B CPU - Cluster min freq ~ max -->
-        <Resource opcode="0x40800100" value="0xFFF"/>     <!-- L CPU - Cluster min freq ~ max -->
-        <Resource opcode="0x4180C000" value="0x0"/>       <!-- CPUBW disable hysteresis -->
-        <Resource opcode="0x40400000" value="0x1"/>       <!-- POWER_COLLAPSE -->
-        <Resource opcode="0x41800000" value="0x8C"/>      <!-- CPUBW min freq 1804 MHz -->
-    </Hint>
-    <Hint type="0x0B0A"> <!--CAMERA LAUNCH-->
-        <Resource opcode="0x40800000" value="0xFFF"/>     <!-- B CPU - Cluster min freq ~ max -->
-        <Resource opcode="0x40800100" value="0xFFF"/>     <!-- L CPU - Cluster min freq ~ max -->
-        <Resource opcode="0x40400000" value="0x1"/>       <!-- POWER_COLLAPSE -->
-    </Hint>
-    <Hint type="0x0C0A"> <!--CAMERA STREAMING-->
-        <Resource opcode="0x40800000" value="0xFFF"/>     <!-- B CPU - Cluster min freq ~ max -->
-        <Resource opcode="0x40800100" value="0xFFF"/>     <!-- L CPU - Cluster min freq ~ max -->
-        <Resource opcode="0x40400000" value="0x1"/>       <!-- POWER_COLLAPSE -->
-    </Hint>
-    <Hint type="0x0D0A"> <!--CAMERA SHOT-->
-        <Resource opcode="0x40800000" value="0xFFF"/>     <!-- B CPU - Cluster min freq ~ max -->
-        <Resource opcode="0x40800100" value="0xFFF"/>     <!-- L CPU - Cluster min freq ~ max -->
-        <Resource opcode="0x40400000" value="0x1"/>       <!-- POWER_COLLAPSE -->
-        <Resource opcode="0x4180C000" value="0x0"/>       <!-- CPUBW disable hysteresis -->
-        <Resource opcode="0x41800000" value="0x8C"/>      <!-- CPUBW min freq 1804 MHz -->
-    </Hint>
-    <Hint type="0x0E0A"> <!--AUDIO STREAMING-->
-        <Resource opcode="0x40400000" value="0x1"/>       <!-- POWER_COLLAPSE -->
-        <Resource opcode="0x40800000" value="0x579"/>     <!-- B CPU - Cluster min freq ~1.4 Ghz -->
-    </Hint>
-    <Hint type="0x0F0A"> <!--AUDIO_LOW_LATENCY-->
-        <Resource opcode="0x40400000" value="0x1"/>       <!-- POWER_COLLAPSE -->
-    </Hint>
-
-</Powerhint>
diff --git a/powerstats/Android.bp b/powerstats/Android.bp
new file mode 100644
index 0000000..491498d
--- /dev/null
+++ b/powerstats/Android.bp
@@ -0,0 +1,40 @@
+//
+// Copyright (C) 2018 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.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+cc_binary {
+    name: "android.hardware.power.stats@1.0-service.pixel",
+    relative_install_path: "hw",
+    init_rc: ["android.hardware.power.stats@1.0-service.pixel.rc"],
+    srcs: ["service.cpp", "EaselStateResidencyDataProvider.cpp"],
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
+    static_libs: [
+        "libpixelpowerstats",
+    ],
+    shared_libs: [
+        "libbase",
+        "libcutils",
+        "libhidlbase",
+        "libhidltransport",
+        "libfmq",
+        "liblog",
+        "libutils",
+        "android.hardware.power.stats@1.0",
+        "pixelpowerstats_provider_aidl_interface-cpp",
+        "libbinder",
+    ],
+    vendor: true,
+}
diff --git a/powerstats/EaselStateResidencyDataProvider.cpp b/powerstats/EaselStateResidencyDataProvider.cpp
new file mode 100644
index 0000000..6b5bdae
--- /dev/null
+++ b/powerstats/EaselStateResidencyDataProvider.cpp
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2018 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.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "easelstateresidency"
+
+#include <android-base/logging.h>
+#include <fstream>
+#include "EaselStateResidencyDataProvider.h"
+
+namespace android {
+namespace device {
+namespace google {
+namespace wahoo {
+namespace powerstats {
+
+const uint32_t EASEL_SYNTHETIC_SLEEP_ID = 0;
+
+EaselStateResidencyDataProvider::EaselStateResidencyDataProvider(uint32_t id) :
+    mPowerEntityId(id), mTotalOnSnapshotCount(0), mTotalNotOnSnapshotCount(0) {}
+
+bool EaselStateResidencyDataProvider::getResults(
+    std::unordered_map<uint32_t, PowerEntityStateResidencyResult> &results) {
+    const std::string path = "/sys/devices/virtual/misc/mnh_sm/state";
+
+    enum easel_state {
+        EASEL_OFF = 0,
+        EASEL_ON,
+        EASEL_SUSPENDED,
+        NUM_EASEL_STATES
+    };
+
+    // Since we are storing stats locally but can have multiple parallel
+    // callers, locking is required to ensure stats are not corrupted.
+    std::lock_guard<std::mutex> lock(mLock);
+
+    std::ifstream inFile(path, std::ifstream::in);
+    if (!inFile.is_open()) {
+        PLOG(ERROR) << __func__ << ":Failed to open file " << path;
+        return false;
+    }
+
+    unsigned long currentState;
+    if(!(inFile >> currentState) || currentState >= NUM_EASEL_STATES) {
+        PLOG(ERROR) << __func__ << ":Failed to parse " << path;
+        return false;
+    }
+
+    // Update statistics for synthetic sleep state.  We combine OFF and
+    // SUSPENDED to act as a composite "not on" state so the numbers will behave
+    // like a real sleep state.
+    if ((currentState == EASEL_OFF) || (currentState == EASEL_SUSPENDED)) {
+        mTotalNotOnSnapshotCount++;
+    } else {
+        mTotalOnSnapshotCount++;
+    }
+
+    // Update statistics for synthetic sleep state, where
+    // totalStateEntryCount = cumulative count of Easel state0 and state2 
+    // (as seen by power.stats HAL)
+    // totalTimeInStateMs = cumulative count of Easel state1 (as seen by
+    //   power.stats HAL)
+    PowerEntityStateResidencyResult result = {
+        .powerEntityId = mPowerEntityId,
+        .stateResidencyData = {{.powerEntityStateId = EASEL_SYNTHETIC_SLEEP_ID,
+                                .totalStateEntryCount = mTotalOnSnapshotCount,
+                                .totalTimeInStateMs = mTotalNotOnSnapshotCount,
+                                .lastEntryTimestampMs = 0}}
+    };
+
+    results.emplace(std::make_pair(mPowerEntityId, result));
+    return true;
+}
+
+
+std::vector<PowerEntityStateSpace> EaselStateResidencyDataProvider::getStateSpaces() {
+    return {
+        {.powerEntityId = mPowerEntityId,
+            .states = {
+                {
+                 .powerEntityStateId = EASEL_SYNTHETIC_SLEEP_ID,
+                 .powerEntityStateName = "SyntheticSleep"
+                }
+            }
+        }
+    };
+}
+
+}  // namespace powerstats
+}  // namespace wahoo
+}  // namespace google
+}  // namespace device
+}  // namespace android
\ No newline at end of file
diff --git a/powerstats/EaselStateResidencyDataProvider.h b/powerstats/EaselStateResidencyDataProvider.h
new file mode 100644
index 0000000..2381078
--- /dev/null
+++ b/powerstats/EaselStateResidencyDataProvider.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2018 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.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef DEVICE_GOOGLE_WAHOO_POWERSTATS_EASELSTATERESIDENCYDATAPROVIDER_H
+#define DEVICE_GOOGLE_WAHOO_POWERSTATS_EASELSTATERESIDENCYDATAPROVIDER_H
+
+#include <pixelpowerstats/PowerStats.h>
+
+using android::hardware::power::stats::V1_0::PowerEntityStateResidencyResult;
+using android::hardware::power::stats::V1_0::PowerEntityStateSpace;
+using android::hardware::google::pixel::powerstats::IStateResidencyDataProvider;
+
+namespace android {
+namespace device {
+namespace google {
+namespace wahoo {
+namespace powerstats {
+
+class EaselStateResidencyDataProvider : public IStateResidencyDataProvider {
+  public:
+    EaselStateResidencyDataProvider(uint32_t id);
+    ~EaselStateResidencyDataProvider() = default;
+    bool getResults(std::unordered_map<uint32_t, PowerEntityStateResidencyResult>
+            &results) override;
+    std::vector<PowerEntityStateSpace> getStateSpaces() override;
+
+  private:
+    std::mutex mLock;
+    const uint32_t mPowerEntityId;
+    uint64_t mTotalOnSnapshotCount;
+    uint64_t mTotalNotOnSnapshotCount;
+};
+
+}  // namespace powerstats
+}  // namespace wahoo
+}  // namespace google
+}  // namespace device
+}  // namespace android
+
+#endif  // DEVICE_GOOGLE_WAHOO_POWERSTATS_EASELSTATERESIDENCYDATAPROVIDER_H
diff --git a/powerstats/android.hardware.power.stats@1.0-service.pixel.rc b/powerstats/android.hardware.power.stats@1.0-service.pixel.rc
new file mode 100644
index 0000000..6ba83c2
--- /dev/null
+++ b/powerstats/android.hardware.power.stats@1.0-service.pixel.rc
@@ -0,0 +1,4 @@
+service vendor.power.stats-hal-1-0 /vendor/bin/hw/android.hardware.power.stats@1.0-service.pixel
+    class hal
+    user system
+    group system
diff --git a/powerstats/service.cpp b/powerstats/service.cpp
new file mode 100644
index 0000000..b2d3fd0
--- /dev/null
+++ b/powerstats/service.cpp
@@ -0,0 +1,160 @@
+/*
+ * Copyright (C) 2018 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.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "android.hardware.power.stats@1.0-service.pixel"
+
+#include <android/log.h>
+#include <binder/IPCThreadState.h>
+#include <binder/IServiceManager.h>
+#include <binder/ProcessState.h>
+#include <hidl/HidlTransportSupport.h>
+
+#include <pixelpowerstats/AidlStateResidencyDataProvider.h>
+#include <pixelpowerstats/GenericStateResidencyDataProvider.h>
+#include <pixelpowerstats/PowerStats.h>
+#include <pixelpowerstats/WlanStateResidencyDataProvider.h>
+#include "EaselStateResidencyDataProvider.h"
+
+using android::OK;
+using android::sp;
+using android::status_t;
+
+// libhwbinder:
+using android::hardware::configureRpcThreadpool;
+using android::hardware::joinRpcThreadpool;
+
+// Generated HIDL files
+using android::hardware::power::stats::V1_0::IPowerStats;
+using android::hardware::power::stats::V1_0::PowerEntityInfo;
+using android::hardware::power::stats::V1_0::PowerEntityStateSpace;
+using android::hardware::power::stats::V1_0::PowerEntityType;
+using android::hardware::power::stats::V1_0::implementation::PowerStats;
+
+// Pixel specific
+using android::hardware::google::pixel::powerstats::AidlStateResidencyDataProvider;
+using android::hardware::google::pixel::powerstats::GenericStateResidencyDataProvider;
+using android::hardware::google::pixel::powerstats::PowerEntityConfig;
+using android::hardware::google::pixel::powerstats::StateResidencyConfig;
+using android::hardware::google::pixel::powerstats::WlanStateResidencyDataProvider;
+
+// Wahoo specific
+using android::device::google::wahoo::powerstats::EaselStateResidencyDataProvider;
+
+int main(int /* argc */, char ** /* argv */) {
+    ALOGI("power.stats service 1.0 is starting.");
+
+    PowerStats *service = new PowerStats();
+
+    // Add power entities related to rpmh
+    const uint64_t RPM_CLK = 19200;  // RPM runs at 19.2Mhz. Divide by 19200 for msec
+    std::function<uint64_t(uint64_t)> rpmConvertToMs = [](uint64_t a) { return a / RPM_CLK; };
+    std::vector<StateResidencyConfig> rpmStateResidencyConfigs = {
+        {.name = "XO_shutdown",
+         .entryCountSupported = true,
+         .entryCountPrefix = "XO Count:",
+         .totalTimeSupported = true,
+         .totalTimePrefix = "Accumulated XO duration:",
+         .totalTimeTransform = rpmConvertToMs,
+         .lastEntrySupported = false}};
+
+    sp<GenericStateResidencyDataProvider> rpmSdp =
+            new GenericStateResidencyDataProvider("/d/system_stats");
+
+    uint32_t apssId = service->addPowerEntity("APSS", PowerEntityType::SUBSYSTEM);
+    rpmSdp->addEntity(apssId, PowerEntityConfig("APSS", rpmStateResidencyConfigs));
+
+    uint32_t mpssId = service->addPowerEntity("MPSS", PowerEntityType::SUBSYSTEM);
+    rpmSdp->addEntity(mpssId, PowerEntityConfig("MPSS", rpmStateResidencyConfigs));
+
+    uint32_t adspId = service->addPowerEntity("ADSP", PowerEntityType::SUBSYSTEM);
+    rpmSdp->addEntity(adspId, PowerEntityConfig("ADSP", rpmStateResidencyConfigs));
+
+    uint32_t slpiId = service->addPowerEntity("SLPI", PowerEntityType::SUBSYSTEM);
+    rpmSdp->addEntity(slpiId, PowerEntityConfig("SLPI", rpmStateResidencyConfigs));
+
+    service->addStateResidencyDataProvider(rpmSdp);
+
+    // Add SoC power entity
+    std::vector<StateResidencyConfig> socStateResidencyConfigs = {
+        {.name = "XO_shutdown",
+         .header = "RPM Mode:vlow",
+         .entryCountSupported = true,
+         .entryCountPrefix = "count:",
+         .totalTimeSupported = true,
+         .totalTimePrefix = "actual last sleep(msec):",
+         .lastEntrySupported = false},
+        {.name = "VMIN",
+         .header = "RPM Mode:vmin",
+         .entryCountSupported = true,
+         .entryCountPrefix = "count:",
+         .totalTimeSupported = true,
+         .totalTimePrefix = "actual last sleep(msec):",
+         .lastEntrySupported = false}};
+
+     sp<GenericStateResidencyDataProvider> socSdp =
+            new GenericStateResidencyDataProvider("/d/system_stats");
+
+    uint32_t socId = service->addPowerEntity("SoC", PowerEntityType::POWER_DOMAIN);
+    socSdp->addEntity(socId, PowerEntityConfig(socStateResidencyConfigs));
+
+    service->addStateResidencyDataProvider(socSdp);
+
+    // Add WLAN power entity
+    uint32_t wlanId = service->addPowerEntity("WLAN", PowerEntityType::SUBSYSTEM);
+    sp<WlanStateResidencyDataProvider> wlanSdp =
+            new WlanStateResidencyDataProvider(wlanId, "/d/wlan0/power_stats");
+    service->addStateResidencyDataProvider(wlanSdp);
+
+    // Add Easel power entity
+    uint32_t easelId = service->addPowerEntity("Easel", PowerEntityType::SUBSYSTEM);
+    sp<EaselStateResidencyDataProvider> easelSdp = new EaselStateResidencyDataProvider(easelId);
+    service->addStateResidencyDataProvider(easelSdp);
+
+    // Add Power Entities that require the Aidl data provider
+    sp<AidlStateResidencyDataProvider> aidlSdp = new AidlStateResidencyDataProvider();
+    // TODO(117585786): Add real power entities here
+    // uint32_t mock1Id = service->addPowerEntity("Mock1", PowerEntityType::SUBSYSTEM);
+    // aidlSdp->addEntity(mock1Id, "Mock1", {"state_a", "state_b"});
+    // uint32_t mock2Id = service->addPowerEntity("Mock2", PowerEntityType::SUBSYSTEM);
+    // aidlSdp->addEntity(mock2Id, "Mock2", {"state_c", "state_d"});
+
+    auto serviceStatus = android::defaultServiceManager()->addService(
+            android::String16("power.stats-vendor"), aidlSdp);
+    if (serviceStatus != android::OK) {
+        ALOGE("Unable to register power.stats-vendor service %d", serviceStatus);
+        return 1;
+    }
+    sp<android::ProcessState> ps{android::ProcessState::self()};  // Create non-HW binder threadpool
+    ps->startThreadPool();
+
+    service->addStateResidencyDataProvider(aidlSdp);
+
+    // Configure the threadpool
+    configureRpcThreadpool(1, true /*callerWillJoin*/);
+
+    status_t status = service->registerAsService();
+    if (status != OK) {
+        ALOGE("Could not register service for power.stats HAL Iface (%d), exiting.", status);
+        return 1;
+    }
+
+    ALOGI("power.stats service is ready");
+    joinRpcThreadpool();
+
+    // In normal operation, we don't expect the thread pool to exit
+    ALOGE("power.stats service is shutting down");
+    return 1;
+}
diff --git a/sepolicy/public/init.te b/sepolicy/public/init.te
new file mode 100644
index 0000000..e93b2e8
--- /dev/null
+++ b/sepolicy/public/init.te
@@ -0,0 +1 @@
+allow init vold_data_file:dir { relabelfrom };
diff --git a/sepolicy/public/ueventd.te b/sepolicy/public/ueventd.te
new file mode 100644
index 0000000..985c8ec
--- /dev/null
+++ b/sepolicy/public/ueventd.te
@@ -0,0 +1 @@
+allow ueventd metadata_file:dir search;
diff --git a/sepolicy/vendor/cameraserver.te b/sepolicy/vendor/cameraserver.te
index 594f22a..b9adc4c 100644
--- a/sepolicy/vendor/cameraserver.te
+++ b/sepolicy/vendor/cameraserver.te
@@ -8,5 +8,4 @@
 
 allow cameraserver system_server:unix_stream_socket { read write };
 
-# TODO (b/37688918) Verify that this is actually needed and not a violation of treble
 binder_call(cameraserver, mediacodec)
diff --git a/sepolicy/vendor/con_monitor.te b/sepolicy/vendor/con_monitor.te
index 8730e56..e1ba346 100644
--- a/sepolicy/vendor/con_monitor.te
+++ b/sepolicy/vendor/con_monitor.te
@@ -9,4 +9,4 @@
 allow con_monitor_app radio_vendor_data_file:file create_file_perms;
 allow con_monitor_app radio_service:service_manager find;
 allow con_monitor_app audioserver_service:service_manager find;
-hal_client_domain(con_monitor_app, hal_power);
\ No newline at end of file
+hal_client_domain(con_monitor_app, hal_power_stats);
\ No newline at end of file
diff --git a/sepolicy/vendor/file.te b/sepolicy/vendor/file.te
index 6f85904..8e8e364 100644
--- a/sepolicy/vendor/file.te
+++ b/sepolicy/vendor/file.te
@@ -37,6 +37,7 @@
 
 # /proc
 type proc_wifi_dbg, fs_type, proc_type;
+type proc_swappiness, fs_type, proc_type;
 
 type qmuxd_socket, file_type;
 type netmgrd_socket, file_type;
diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts
index 345527e..fabdc16 100644
--- a/sepolicy/vendor/file_contexts
+++ b/sepolicy/vendor/file_contexts
@@ -181,21 +181,27 @@
 /vendor/bin/init\.radio\.sh     u:object_r:init_radio_exec:s0
 /vendor/bin/ramoops             u:object_r:ramoops_exec:s0
 /vendor/bin/init\.ramoops\.sh   u:object_r:ramoops_exec:s0
+/vendor/bin/init\.fingerprint\.sh                                    u:object_r:init-fingerprint_exec:s0
 
 /vendor/bin/hw/android\.hardware\.bluetooth@1\.0-service-qti          u:object_r:hal_bluetooth_default_exec:s0
-/vendor/bin/hw/android\.hardware\.drm@1\.1-service\.widevine          u:object_r:hal_drm_widevine_exec:s0
-/vendor/bin/hw/android\.hardware\.drm@1\.1-service\.clearkey          u:object_r:hal_drm_clearkey_exec:s0
+/vendor/bin/hw/android\.hardware\.drm@1\.2-service\.clearkey          u:object_r:hal_drm_clearkey_exec:s0
+/vendor/bin/hw/android\.hardware\.drm@1\.2-service-lazy\.clearkey     u:object_r:hal_drm_clearkey_exec:s0
+/vendor/bin/hw/android\.hardware\.drm@1\.2-service\.widevine          u:object_r:hal_drm_widevine_exec:s0
+/vendor/bin/hw/android\.hardware\.drm@1\.2-service-lazy\.widevine     u:object_r:hal_drm_widevine_exec:s0
 /vendor/bin/hw/android\.hardware\.vibrator@1\.2-service\.wahoo        u:object_r:hal_vibrator_default_exec:s0
 /vendor/bin/hw/android\.hardware\.health@2\.0-service\.wahoo          u:object_r:hal_health_default_exec:s0
 /vendor/bin/hw/android\.hardware\.keymaster@3\.0-service-qti         u:object_r:hal_keymaster_qti_exec:s0
 /vendor/bin/hw/android\.hardware\.gatekeeper@1\.0-service-qti        u:object_r:hal_gatekeeper_qti_exec:s0
 /vendor/bin/hw/android\.hardware\.gnss@1\.0-service-qti              u:object_r:hal_gnss_qti_exec:s0
+/vendor/bin/hw/android\.hardware\.thermal@2\.0-service\.pixel         u:object_r:hal_thermal_default_exec:s0
 
 ###############################################
 # same-process HAL files and their dependencies
 #
+/vendor/lib(64)?/hw/android\.hardware\.graphics\.mapper@2\.0-impl-2\.1\.so u:object_r:same_process_hal_file:s0
 /vendor/lib(64)?/hw/gralloc\.msm8998\.so   u:object_r:same_process_hal_file:s0
 /vendor/lib(64)?/libqdMetaData\.so         u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/lib_aion_buffer\.so       u:object_r:same_process_hal_file:s0
 /vendor/lib(64)?/libqservice\.so           u:object_r:same_process_hal_file:s0
 /vendor/lib(64)?/libqdutils\.so            u:object_r:same_process_hal_file:s0
 /vendor/lib(64)?/libadreno_utils\.so       u:object_r:same_process_hal_file:s0
diff --git a/sepolicy/vendor/genfs_contexts b/sepolicy/vendor/genfs_contexts
index 0ed1262..eeec72b 100644
--- a/sepolicy/vendor/genfs_contexts
+++ b/sepolicy/vendor/genfs_contexts
@@ -3,6 +3,7 @@
 genfscon proc /debugdriver/driverdump                 u:object_r:proc_wifi_dbg:s0
 genfscon proc /ath_pktlog/cld                         u:object_r:proc_wifi_dbg:s0
 genfscon proc /irq                                    u:object_r:proc_irq:s0
+genfscon proc /sys/vm/swappiness                      u:object_r:proc_swappiness:s0
 
 genfscon sysfs /devices/soc/soc:qcom,cpubw            u:object_r:sysfs_msm_subsys:s0
 genfscon sysfs /devices/soc/soc:qcom,mincpubw         u:object_r:sysfs_msm_subsys:s0
diff --git a/sepolicy/vendor/hal_drm_clearkey.te b/sepolicy/vendor/hal_drm_clearkey.te
index 976b9fa..1a3b4af 100644
--- a/sepolicy/vendor/hal_drm_clearkey.te
+++ b/sepolicy/vendor/hal_drm_clearkey.te
@@ -1,4 +1,4 @@
-# policy for /vendor/bin/hw/android.hardware.drm@1.1-service.clearkey
+# policy for /vendor/bin/hw/android.hardware.drm clearkey service
 type hal_drm_clearkey, domain;
 type hal_drm_clearkey_exec, exec_type, vendor_file_type, file_type;
 
diff --git a/sepolicy/vendor/hal_drm_widevine.te b/sepolicy/vendor/hal_drm_widevine.te
index f272502..b6c8818 100644
--- a/sepolicy/vendor/hal_drm_widevine.te
+++ b/sepolicy/vendor/hal_drm_widevine.te
@@ -1,4 +1,3 @@
-# policy for /vendor/bin/hw/android.hardware.drm@1.1-service.widevine
 type hal_drm_widevine, domain;
 type hal_drm_widevine_exec, exec_type, vendor_file_type, file_type;
 
diff --git a/sepolicy/vendor/hal_dumpstate_impl.te b/sepolicy/vendor/hal_dumpstate_impl.te
index 60c781b..a2f8ffc 100644
--- a/sepolicy/vendor/hal_dumpstate_impl.te
+++ b/sepolicy/vendor/hal_dumpstate_impl.te
@@ -8,6 +8,10 @@
 allow hal_dumpstate_impl vendor_shell_exec:file rx_file_perms;
 allow hal_dumpstate_impl vendor_toolbox_exec:file rx_file_perms;
 
+# Allow to read pixel-trace trace file
+allow hal_dumpstate_impl debugfs_tracing_instances:dir search;
+allow hal_dumpstate_impl debugfs_tracing_instances:file r_file_perms;
+
 userdebug_or_eng(`
   # smlog_dump
   domain_auto_trans(hal_dumpstate_impl, smlog_dump_exec, smlog_dump)
diff --git a/sepolicy/vendor/hal_graphics_composer_default.te b/sepolicy/vendor/hal_graphics_composer_default.te
index 42aa393..c5e3668 100644
--- a/sepolicy/vendor/hal_graphics_composer_default.te
+++ b/sepolicy/vendor/hal_graphics_composer_default.te
@@ -16,7 +16,6 @@
 
 r_dir_file(hal_graphics_composer_default, sysfs_leds)
 
-# TODO(b/37666508): Remove the following line upon resolution of the bug
 allow hal_graphics_composer_default video_device:chr_file rw_file_perms;
 
 # HWC_UeventThread
diff --git a/sepolicy/vendor/hal_power_default.te b/sepolicy/vendor/hal_power_default.te
index dce10ed..b547f40 100644
--- a/sepolicy/vendor/hal_power_default.te
+++ b/sepolicy/vendor/hal_power_default.te
@@ -1,15 +1,6 @@
 allow hal_power_default sysfs_graphics:dir search;
 allow hal_power_default sysfs_graphics:file r_file_perms;
 
-allow hal_power_default debugfs_rpm:file r_file_perms;
-
-allow hal_power_default debugfs_wlan:dir r_dir_perms;
-allow hal_power_default debugfs_wlan:file r_file_perms;
-
-allow hal_power_default sysfs_easel:dir search;
-allow hal_power_default sysfs_easel:file r_file_perms;
-
-
 # To do powerhint on nodes defined in powerhint.json
 allow hal_power_default sysfs_msm_subsys:dir search;
 allow hal_power_default sysfs_msm_subsys:file rw_file_perms;
@@ -20,3 +11,6 @@
 
 # To get/set powerhal state property
 set_prop(hal_power_default, power_prop)
+
+# interact with thermal_config
+set_prop(hal_power_default, thermal_prop)
diff --git a/sepolicy/vendor/hal_thermal_default.te b/sepolicy/vendor/hal_thermal_default.te
new file mode 100644
index 0000000..13c129f
--- /dev/null
+++ b/sepolicy/vendor/hal_thermal_default.te
@@ -0,0 +1,7 @@
+allow hal_thermal_default sysfs_thermal:dir r_dir_perms;
+allow hal_thermal_default sysfs_thermal:file r_file_perms;
+allow hal_thermal_default sysfs_thermal:lnk_file read;
+allow hal_thermal_default proc_stat:file r_file_perms;
+
+# read thermal_config
+get_prop(hal_thermal_default, thermal_prop)
diff --git a/sepolicy/vendor/hal_vr.te b/sepolicy/vendor/hal_vr.te
deleted file mode 100644
index a88dcb8..0000000
--- a/sepolicy/vendor/hal_vr.te
+++ /dev/null
@@ -1,6 +0,0 @@
-# interact with thermal_config
-set_prop(hal_vr, thermal_prop)
-
-# Access to touch vrmode node
-allow hal_vr sysfs_touch:dir r_dir_perms;
-allow hal_vr sysfs_touch:file rw_file_perms;
diff --git a/sepolicy/vendor/init-fingerprint.te b/sepolicy/vendor/init-fingerprint.te
new file mode 100644
index 0000000..7053f0d
--- /dev/null
+++ b/sepolicy/vendor/init-fingerprint.te
@@ -0,0 +1,10 @@
+type init-fingerprint, domain;
+type init-fingerprint_exec, exec_type, vendor_file_type, file_type;
+
+init_daemon_domain(init-fingerprint)
+
+allow init-fingerprint vendor_shell_exec:file rx_file_perms;
+allow init-fingerprint vendor_toolbox_exec:file rx_file_perms;
+
+set_prop(init-fingerprint, vendor_fingerprint_prop)
+set_prop(init-fingerprint, ctl_start_prop)
diff --git a/sepolicy/vendor/location.te b/sepolicy/vendor/location.te
index 67471df..02f8d4a 100644
--- a/sepolicy/vendor/location.te
+++ b/sepolicy/vendor/location.te
@@ -35,7 +35,7 @@
 
 dontaudit location kernel:system module_request;
 
-allow location proc_net:file r_file_perms;
+allow location proc_net_type:file r_file_perms;
 
 # execute /vendor/bin/lowi-server
 allow location location_exec:file rx_file_perms;
@@ -46,4 +46,4 @@
 
 userdebug_or_eng(`
   allow location diag_device:chr_file rw_file_perms;
-')
\ No newline at end of file
+')
diff --git a/sepolicy/vendor/netmgrd.te b/sepolicy/vendor/netmgrd.te
index ebe12bb..da334ad 100644
--- a/sepolicy/vendor/netmgrd.te
+++ b/sepolicy/vendor/netmgrd.te
@@ -46,7 +46,7 @@
 #Ignore if device loading for private IOCTL failed
 dontaudit netmgrd kernel:system { module_request };
 
-allow netmgrd proc_net:file rw_file_perms;
+allow netmgrd proc_net_type:file rw_file_perms;
 allow netmgrd netmgr_data_file:dir rw_dir_perms;
 allow netmgrd netmgr_data_file:file create_file_perms;
 
diff --git a/sepolicy/vendor/property.te b/sepolicy/vendor/property.te
index f22f109..9a978b1 100644
--- a/sepolicy/vendor/property.te
+++ b/sepolicy/vendor/property.te
@@ -25,3 +25,6 @@
 type vendor_charge_prop, property_type;
 type persist_nfc_prop, property_type;
 type vendor_ramoops_prop, property_type;
+
+# fingerprint
+type vendor_fingerprint_prop, property_type;
diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts
index 52052ae..1e3533a 100644
--- a/sepolicy/vendor/property_contexts
+++ b/sepolicy/vendor/property_contexts
@@ -16,8 +16,8 @@
 persist.sys.cnss.          u:object_r:cnss_diag_prop:s0
 sys.listeners.registered   u:object_r:tee_listener_prop:s0
 wc_transport.              u:object_r:wc_prop:s0
-sys.qcom.thermalcfg        u:object_r:thermal_prop:s0
-ctl.vendor.thermal-engine  u:object_r:thermal_prop:s0
+vendor.qcom.thermalcfg     u:object_r:thermal_prop:s0
+vendor.thermal.config      u:object_r:thermal_prop:s0
 persist.sys.modem.diag.    u:object_r:modem_diag_prop:s0
 sys.modem.diag.            u:object_r:modem_diag_prop:s0
 sys.time.set               u:object_r:sys_time_prop:s0
@@ -25,6 +25,7 @@
 sys.logger.bluetooth       u:object_r:bluetooth_log_prop:s0
 vendor.powerhal.state      u:object_r:power_prop:s0
 vendor.powerhal.audio      u:object_r:power_prop:s0
+vendor.powerhal.init       u:object_r:power_prop:s0
 vendor.wlan.driver.version    u:object_r:vendor_wifi_version:s0
 vendor.wlan.firmware.version  u:object_r:vendor_wifi_version:s0
 persist.vendor.usb.config  u:object_r:vendor_usb_config_prop:s0
@@ -51,6 +52,9 @@
 vendor.debug.prerotation.disable  u:object_r:public_vendor_default_prop:s0
 vendor.debug.rs.           u:object_r:public_vendor_default_prop:s0
 vendor.debug.egl.swapinterval      u:object_r:public_vendor_default_prop:s0
+vendor.gralloc.disable_ubwc u:object_r:public_vendor_default_prop:s0
+vendor.debug.egl.profiler   u:object_r:public_vendor_default_prop:s0
+vendor.gralloc.enable_ahardware_buffer  u:object_r:public_vendor_default_prop:s0
 
 # public_vendor_system_prop
 # They are public_vendor_system_props for vendor-specific extension.
@@ -212,3 +216,7 @@
 
 # ramoops
 vendor.ramoops.                    u:object_r:vendor_ramoops_prop:s0
+
+# fingerprint
+vendor.fps.init.succeed               u:object_r:vendor_fingerprint_prop:s0
+vendor.fps.init_retry.count           u:object_r:vendor_fingerprint_prop:s0
diff --git a/sepolicy/vendor/seapp_contexts b/sepolicy/vendor/seapp_contexts
index a4f429b..2530739 100644
--- a/sepolicy/vendor/seapp_contexts
+++ b/sepolicy/vendor/seapp_contexts
@@ -29,4 +29,4 @@
 user=_app seinfo=easel name=com.google.android.imaging.easel.service domain=easelservice_app type=app_data_file levelFrom=user
 
 #Domain for connectivity monitor
-user=radio seinfo=platform name=com.google.android.connectivitymonitor domain=con_monitor_app type=app_data_file levelFrom=all
+user=_app isPrivApp=true seinfo=platform name=com.google.android.connectivitymonitor domain=con_monitor_app type=app_data_file levelFrom=all
diff --git a/sepolicy/vendor/system_server.te b/sepolicy/vendor/system_server.te
index 31c7ff7..d7b8461 100644
--- a/sepolicy/vendor/system_server.te
+++ b/sepolicy/vendor/system_server.te
@@ -23,5 +23,3 @@
 set_prop(system_server, public_vendor_system_prop)
 
 dontaudit system_server self:capability sys_module;
-
-allow system_server thermal_service:service_manager find;
diff --git a/sepolicy/vendor/thermal-engine.te b/sepolicy/vendor/thermal-engine.te
index bc1ab54..2bd2bd9 100644
--- a/sepolicy/vendor/thermal-engine.te
+++ b/sepolicy/vendor/thermal-engine.te
@@ -19,8 +19,6 @@
 allow thermal-engine sysfs_rmtfs:file r_file_perms;
 # to read /proc/stat
 allow thermal-engine proc_stat:file { getattr open read };
-# IThermal Thermal HAL
-hal_server_domain(thermal-engine, hal_thermal)
 
 allow thermal-engine thermal_device:chr_file rw_file_perms;
 
diff --git a/sepolicy/vendor/thermalserviced.te b/sepolicy/vendor/thermalserviced.te
deleted file mode 100644
index aa6a085..0000000
--- a/sepolicy/vendor/thermalserviced.te
+++ /dev/null
@@ -1 +0,0 @@
-binder_call(thermalserviced, system_server)
diff --git a/sepolicy/vendor/vendor_init.te b/sepolicy/vendor/vendor_init.te
index b74bba4..0953dcb 100644
--- a/sepolicy/vendor/vendor_init.te
+++ b/sepolicy/vendor/vendor_init.te
@@ -11,6 +11,7 @@
 
 allow vendor_init debugfs_clk:file w_file_perms;
 allow vendor_init proc_uid_cpupower:file write;
+allow vendor_init proc_swappiness:file w_file_perms;
 dontaudit vendor_init kernel:system module_request;
 
 # Allow vendor_init to write to /proc/sysrq-trigger on userdebug and eng builds
@@ -29,3 +30,9 @@
 
 dontaudit vendor_init unlabeled:dir getattr;
 dontaudit vendor_init unlabeled:file getattr;
+
+allow vendor_init debugfs_tracing_instances:dir create_dir_perms;
+allow vendor_init debugfs_tracing_instances:file w_file_perms;
+
+# Write to touch vrmode node
+allow vendor_init sysfs_touch:file w_file_perms;
diff --git a/sepolicy/vendor/wcnss_service.te b/sepolicy/vendor/wcnss_service.te
index a6f143c..a612332 100644
--- a/sepolicy/vendor/wcnss_service.te
+++ b/sepolicy/vendor/wcnss_service.te
@@ -12,7 +12,7 @@
 allow wcnss_service vendor_shell_exec:file rx_file_perms;
 allow wcnss_service vendor_toolbox_exec:file rx_file_perms;
 
-allow wcnss_service proc_net:file w_file_perms;
+allow wcnss_service proc_net_type:file { getattr w_file_perms };
 
 allow wcnss_service self:socket create_socket_perms;
 allowxperm wcnss_service self:socket ioctl msm_sock_ipc_ioctls;
@@ -23,8 +23,6 @@
 allow wcnss_service cnss_vendor_data_file:dir create_dir_perms;
 allow wcnss_service cnss_vendor_data_file:file create_file_perms;
 
-allow wcnss_service proc_net:file getattr;
-
 r_dir_file(wcnss_service, sysfs_msm_subsys)
 # pkt logging for cnss_diag
 userdebug_or_eng(`
diff --git a/sound_trigger_platform_info.xml b/sound_trigger_platform_info.xml
index 0ce2d6a..a863bbb 100644
--- a/sound_trigger_platform_info.xml
+++ b/sound_trigger_platform_info.xml
@@ -52,6 +52,7 @@
             <param uid="0x1" />
             <param load_sound_model_ids="0x18000001, 0x1, 0x18000100" />
             <param start_engine_ids="0x18000001, 0x1, 0x18000101" />
+            <param request_detection_ids="0x18000001, 0x4, 0x18000106" />
             <param detection_event_ids="0x18000001, 0x1, 0x00012C29" />
             <param read_cmd_ids="0x00020013, 0x1, 0x00020015" />
             <param read_rsp_ids="0x00020013, 0x1, 0x00020016" />
@@ -71,6 +72,7 @@
             <param uid="0x2" />
             <param load_sound_model_ids="0x18000001, 0x1, 0x18000102" />
             <param start_engine_ids="0x18000001, 0x1, 0x18000103" />
+            <param request_detection_ids="0x18000001, 0x4, 0x18000107" />
             <param custom_config_ids="0x18000001, 0x1, 0x18000106" />
             <param detection_event_ids="0x18000001, 0x1, 0x00012C29" />
             <param read_cmd_ids="0x00020013, 0x2, 0x00020015" />
diff --git a/thermal/Android.bp b/thermal/Android.bp
deleted file mode 100644
index 43c003e..0000000
--- a/thermal/Android.bp
+++ /dev/null
@@ -1,21 +0,0 @@
-cc_library {
-    name: "android.hardware.thermal@1.1-wahoo",
-    defaults: ["hidl_defaults"],
-    owner: "qcom",
-    vendor: true,
-    relative_install_path: "hw",
-    srcs: [
-	"sensors.cpp",
-        "Thermal.cpp",
-        "thermal-helper.cpp",
-    ],
-    export_include_dirs: ["."],
-    shared_libs: [
-        "libbase",
-        "libhidlbase",
-        "libhidltransport",
-        "libutils",
-        "android.hardware.thermal@1.0",
-        "android.hardware.thermal@1.1",
-    ],
-}
diff --git a/thermal/Thermal.cpp b/thermal/Thermal.cpp
deleted file mode 100644
index b47a54d..0000000
--- a/thermal/Thermal.cpp
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <cerrno>
-#include <vector>
-
-#include <android-base/file.h>
-#include <android-base/logging.h>
-
-#include "Thermal.h"
-#include "thermal-helper.h"
-
-namespace android {
-namespace hardware {
-namespace thermal {
-namespace V1_1 {
-namespace implementation {
-
-Thermal::Thermal() : enabled(initThermal()) {}
-
-namespace {
-
-// Saves the IThermalCallback client object registered from the
-// framework for sending thermal events to the framework thermal event bus.
-sp<IThermalCallback> gThermalCallback;
-
-struct ThermalDeathRecipient : hidl_death_recipient {
-    virtual void serviceDied(
-        uint64_t cookie __unused, const wp<IBase>& who __unused) {
-        gThermalCallback = nullptr;
-        LOG(ERROR) << "IThermalCallback HIDL service died";
-    }
-};
-
-sp<ThermalDeathRecipient> gThermalCallbackDied = nullptr;
-
-} // anonymous namespace
-
-// Methods from ::android::hardware::thermal::V1_0::IThermal follow.
-Return<void> Thermal::getTemperatures(getTemperatures_cb _hidl_cb) {
-    ThermalStatus status;
-    status.code = ThermalStatusCode::SUCCESS;
-    hidl_vec<Temperature> temperatures;
-    temperatures.resize(kTemperatureNum);
-
-    if (!enabled) {
-        status.code = ThermalStatusCode::FAILURE;
-        status.debugMessage = "Unsupported hardware";
-        _hidl_cb(status, temperatures);
-        LOG(ERROR) << "ThermalHAL not initialized properly.";
-        return Void();
-    }
-
-    if (fillTemperatures(&temperatures) != kTemperatureNum) {
-        status.code = ThermalStatusCode::FAILURE;
-        status.debugMessage = "Error reading thermal sensors.";
-    }
-    _hidl_cb(status, temperatures);
-
-    for (auto& t : temperatures) {
-        LOG(DEBUG) << "getTemperatures "
-                   << " Type: " << static_cast<int>(t.type)
-                   << " Name: " << t.name
-                   << " CurrentValue: " << t.currentValue
-                   << " ThrottlingThreshold: " << t.throttlingThreshold
-                   << " ShutdownThreshold: " << t.shutdownThreshold
-                   << " VrThrottlingThreshold: " << t.vrThrottlingThreshold;
-    }
-
-    return Void();
-}
-
-Return<void> Thermal::getCpuUsages(getCpuUsages_cb _hidl_cb) {
-    ThermalStatus status;
-    status.code = ThermalStatusCode::SUCCESS;
-    hidl_vec<CpuUsage> cpuUsages;
-    cpuUsages.resize(kCpuNum);
-
-    if (!enabled) {
-        status.code = ThermalStatusCode::FAILURE;
-        status.debugMessage = "Unsupported hardware";
-        _hidl_cb(status, cpuUsages);
-        LOG(ERROR) << "ThermalHAL not initialized properly.";
-        return Void();
-    }
-
-    ssize_t ret = fillCpuUsages(&cpuUsages);
-    if (ret < 0) {
-        status.code = ThermalStatusCode::FAILURE;
-        status.debugMessage = strerror(-ret);
-    }
-
-    for (auto& u : cpuUsages) {
-        LOG(DEBUG) << "getCpuUsages "
-                   << " Name: " << u.name
-                   << " Active: " << u.active
-                   << " Total: " << u.total
-                   << " IsOnline: " << u.isOnline;
-    }
-
-    _hidl_cb(status, cpuUsages);
-    return Void();
-}
-
-Return<void> Thermal::getCoolingDevices(getCoolingDevices_cb _hidl_cb) {
-    ThermalStatus status;
-    status.code = ThermalStatusCode::SUCCESS;
-    hidl_vec<CoolingDevice> coolingDevices;
-
-    if (!enabled) {
-        status.code = ThermalStatusCode::FAILURE;
-        status.debugMessage = "Unsupported hardware";
-        _hidl_cb(status, coolingDevices);
-        LOG(ERROR) << "ThermalHAL not initialized properly.";
-        return Void();
-    }
-
-    LOG(DEBUG) << "No Cooling Device";
-    _hidl_cb(status, coolingDevices);
-    return Void();
-}
-
-// Methods from ::android::hardware::thermal::V1_1::IThermal follow.
-
-Return<void> Thermal::registerThermalCallback(
-    const sp<IThermalCallback>& callback) {
-    gThermalCallback = callback;
-
-    if (gThermalCallback != nullptr) {
-        if (gThermalCallbackDied == nullptr)
-            gThermalCallbackDied = new ThermalDeathRecipient();
-
-        if (gThermalCallbackDied != nullptr)
-            gThermalCallback->linkToDeath(
-                gThermalCallbackDied, 0x451F /* cookie, unused */);
-        LOG(INFO) << "ThermalCallback registered";
-    } else {
-        LOG(INFO) << "ThermalCallback unregistered";
-    }
-    return Void();
-}
-
-// Local functions used internally by thermal-engine follow.
-
-std::string Thermal::getSkinSensorType() {
-    return getTargetSkinSensorType();
-}
-
-void Thermal::notifyThrottling(
-    bool isThrottling, const Temperature& temperature) {
-    if (gThermalCallback != nullptr) {
-        Return<void> ret =
-            gThermalCallback->notifyThrottling(isThrottling, temperature);
-        if (!ret.isOk()) {
-          if (ret.isDeadObject()) {
-              gThermalCallback = nullptr;
-              LOG(WARNING) << "Dropped throttling event, ThermalCallback died";
-          } else {
-              LOG(WARNING) <<
-                  "Failed to send throttling event to ThermalCallback";
-          }
-        }
-    } else {
-        LOG(WARNING) <<
-            "Dropped throttling event, no ThermalCallback registered";
-    }
-}
-
-Return<void> Thermal::debug(const hidl_handle& handle, const hidl_vec<hidl_string>&) {
-    if (handle != nullptr && handle->numFds >= 1) {
-        int fd = handle->data[0];
-        std::ostringstream dump_buf;
-
-        if (!enabled) {
-            dump_buf << "ThermalHAL not initialized properly." << std::endl;
-        } else {
-            hidl_vec<Temperature> temperatures;
-            hidl_vec<CpuUsage> cpu_usages;
-            cpu_usages.resize(kCpuNum);
-            temperatures.resize(kTemperatureNum);
-
-            dump_buf << "getTemperatures:" << std::endl;
-            if (fillTemperatures(&temperatures) != kTemperatureNum) {
-                dump_buf << "Failed to read thermal sensors." << std::endl;
-            } else {
-                for (const auto& t : temperatures) {
-                    dump_buf << "Name: " << t.name
-                             << " Type: " << android::hardware::thermal::V1_0::toString(t.type)
-                             << " CurrentValue: " << t.currentValue
-                             << " ThrottlingThreshold: " << t.throttlingThreshold
-                             << " ShutdownThreshold: " << t.shutdownThreshold
-                             << " VrThrottlingThreshold: " << t.vrThrottlingThreshold
-                             << std::endl;
-                }
-            }
-
-            dump_buf << "getCpuUsages:" << std::endl;
-            ssize_t ret = fillCpuUsages(&cpu_usages);
-            if (ret < 0) {
-                dump_buf << "Failed to get CPU usages." << std::endl;
-            } else {
-                for (const auto& usage : cpu_usages) {
-                    dump_buf << "Name: " << usage.name
-                             << " Active: " << usage.active
-                             << " Total: " << usage.total
-                             << " IsOnline: " << usage.isOnline
-                             << std::endl;
-                }
-            }
-
-        }
-        std::string buf = dump_buf.str();
-        if (!android::base::WriteStringToFd(buf, fd)) {
-            PLOG(ERROR) << "Failed to dump state to fd";
-        }
-        fsync(fd);
-    }
-    return Void();
-}
-
-}  // namespace implementation
-}  // namespace V1_1
-}  // namespace thermal
-}  // namespace hardware
-}  // namespace android
diff --git a/thermal/Thermal.h b/thermal/Thermal.h
deleted file mode 100644
index 270f066..0000000
--- a/thermal/Thermal.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef ANDROID_HARDWARE_THERMAL_V1_1_WAHOO_THERMAL_H
-#define ANDROID_HARDWARE_THERMAL_V1_1_WAHOO_THERMAL_H
-
-#include <android/hardware/thermal/1.1/IThermal.h>
-#include <android/hardware/thermal/1.1/IThermalCallback.h>
-#include <hidl/Status.h>
-#include <hidl/MQDescriptor.h>
-
-namespace android {
-namespace hardware {
-namespace thermal {
-namespace V1_1 {
-namespace implementation {
-
-using ::android::hardware::thermal::V1_0::CoolingDevice;
-using ::android::hardware::thermal::V1_0::CpuUsage;
-using ::android::hardware::thermal::V1_0::Temperature;
-using ::android::hardware::thermal::V1_0::ThermalStatus;
-using ::android::hardware::thermal::V1_0::ThermalStatusCode;
-using ::android::hardware::thermal::V1_1::IThermal;
-using ::android::hardware::thermal::V1_1::IThermalCallback;
-using ::android::hardware::Return;
-using ::android::hardware::Void;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::hidl_string;
-using ::android::hardware::hidl_death_recipient;
-using ::android::hidl::base::V1_0::IBase;
-using ::android::sp;
-
-struct Thermal : public IThermal {
-    // Local functions used internally by thermal-engine follow.
-    std::string getSkinSensorType();
-    void notifyThrottling(bool isThrottling, const Temperature& temperature);
-    Thermal();
-    // Methods from ::android::hardware::thermal::V1_0::IThermal follow.
-    Return<void> getTemperatures(getTemperatures_cb _hidl_cb)  override;
-    Return<void> getCpuUsages(getCpuUsages_cb _hidl_cb)  override;
-    Return<void> getCoolingDevices(getCoolingDevices_cb _hidl_cb)  override;
-    // Methods from ::android::hardware::thermal::V1_1::IThermal follow.
-    Return<void> registerThermalCallback(
-        const sp<IThermalCallback>& callback) override;
-    // Methods from ::android::hidl::base::V1_0::IBase follow.
-    Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& args) override;
-  private:
-    bool enabled;
-};
-
-}  // namespace implementation
-}  // namespace V1_1
-}  // namespace thermal
-}  // namespace hardware
-}  // namespace android
-
-#endif  // ANDROID_HARDWARE_THERMAL_V1_1_WAHOO_THERMAL_H
diff --git a/thermal/sensors.cpp b/thermal/sensors.cpp
deleted file mode 100644
index 7df880b..0000000
--- a/thermal/sensors.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <algorithm>
-
-#include <android-base/file.h>
-#include <android-base/logging.h>
-#include <android-base/strings.h>
-#include <android-base/stringprintf.h>
-#include "sensors.h"
-
-namespace android {
-namespace hardware {
-namespace thermal {
-namespace V1_1 {
-namespace implementation {
-
-std::string Sensors::getSensorPath(const std::string& sensor_name) {
-    if (sensor_name_to_data_map_.find(sensor_name) !=
-            sensor_name_to_data_map_.end()) {
-        return std::get<0>(sensor_name_to_data_map_.at(sensor_name));
-    }
-    return "";
-}
-
-bool Sensors::addSensor(
-        const std::string& sensor_name, const std::string& path,
-        const float throttling_threshold, const float shutdown_threshold,
-        const float vr_threshold, const TemperatureType& type) {
-    return sensor_name_to_data_map_.emplace(
-        sensor_name, std::make_tuple(
-            path, throttling_threshold, shutdown_threshold,
-            vr_threshold, type)).second;
-}
-
-bool Sensors::readSensorFile(
-        const std::string& sensor_name, std::string* data,
-        std::string* file_path) const {
-    std::string sensor_reading;
-    if (sensor_name_to_data_map_.find(sensor_name) ==
-            sensor_name_to_data_map_.end()) {
-        *data = "";
-        *file_path = "";
-        return false;
-    }
-
-    android::base::ReadFileToString(
-        std::get<0>(sensor_name_to_data_map_.at(sensor_name)), &sensor_reading);
-    // Strip the newline.
-    *data = ::android::base::Trim(sensor_reading);
-    *file_path = std::get<0>(sensor_name_to_data_map_.at(sensor_name));
-    return true;
-}
-
-bool Sensors::readTemperature(
-        const std::string& sensor_name, const float mult,
-        Temperature* out) const {
-    if (sensor_name_to_data_map_.find(sensor_name) ==
-            sensor_name_to_data_map_.end()) {
-        return false;
-    }
-
-    std::string sensor_reading;
-    std::string path;
-    readSensorFile(sensor_name, &sensor_reading, &path);
-
-    auto sensor = sensor_name_to_data_map_.at(sensor_name);
-    out->name = sensor_name;
-    out->currentValue = std::stoi(sensor_reading) * mult;
-    out->throttlingThreshold = std::get<1>(sensor);
-    out->shutdownThreshold = std::get<2>(sensor);
-    out->vrThrottlingThreshold = std::get<3>(sensor);
-    out->type = std::get<4>(sensor);
-
-    LOG(DEBUG) << android::base::StringPrintf(
-        "readTemperature: %s, %d, %s, %g, %g, %g, %g",
-        path.c_str(), out->type, out->name.c_str(), out->currentValue,
-        out->throttlingThreshold, out->shutdownThreshold,
-        out->vrThrottlingThreshold);
-    return true;
-}
-
-}  // namespace implementation
-}  // namespace V1_1
-}  // namespace thermal
-}  // namespace hardware
-}  // namespace android
diff --git a/thermal/sensors.h b/thermal/sensors.h
deleted file mode 100644
index 4924ac2..0000000
--- a/thermal/sensors.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __SENSORS_H__
-#define __SENSORS_H__
-
-#include <string>
-#include <tuple>
-#include <unordered_map>
-
-#include <android/hardware/thermal/1.1/IThermal.h>
-
-namespace android {
-namespace hardware {
-namespace thermal {
-namespace V1_1 {
-namespace implementation {
-
-using ::android::hardware::thermal::V1_0::Temperature;
-using ::android::hardware::thermal::V1_0::TemperatureType;
-
-class Sensors {
-    public:
-     Sensors() = default;
-     ~Sensors() = default;
-     Sensors(const Sensors&) = delete;
-     void operator=(const Sensors&) = delete;
-
-     std::string getSensorPath(const std::string& sensor_name);
-     // Returns true if add was successful, false otherwise.
-     bool addSensor(
-         const std::string& sensor_name, const std::string& path,
-         const float throttling_threshold, const float shutdown_threshold,
-         const float vr_threshold, const TemperatureType& type);
-     // If sensor is not found in the sensor names to path map, this will set
-     // data and file path to empty and return false.  If the sensor is found,
-     // this function will fill in data and file_path accordingly then return
-     // true.
-     bool readSensorFile(
-         const std::string& sensor_name, std::string* data,
-         std::string* file_path) const;
-     bool readTemperature(
-         const std::string& sensor_name, const float mult,
-         Temperature* out) const;
-     size_t getNumSensors() const { return sensor_name_to_data_map_.size(); }
-
-    private:
-     // A map containing sensor names along with its thermal zone number, its
-     // thresholds, and its type. The tuple is formatted as such:
-     // <path, throttling threshold, shutdown threshold, vr threshold, type>
-     std::unordered_map<std::string, std::tuple<
-         std::string, float, float, float, TemperatureType>>
-         sensor_name_to_data_map_;
-};
-
-}  // namespace implementation
-}  // namespace V1_1
-}  // namespace thermal
-}  // namespace hardware
-}  // namespace android
-
-#endif  // __SENSORS_H__
-
diff --git a/thermal/thermal-helper.cpp b/thermal/thermal-helper.cpp
deleted file mode 100644
index 6e9cf17..0000000
--- a/thermal/thermal-helper.cpp
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <cctype>
-#include <cerrno>
-#include <cinttypes>
-#include <cmath>
-#include <cstdlib>
-#include <cstring>
-#include <tuple>
-#include <unordered_map>
-#include <vector>
-
-#include <android-base/file.h>
-#include <android-base/logging.h>
-#include <android-base/properties.h>
-#include <android-base/strings.h>
-#include <android-base/stringprintf.h>
-
-#include "sensors.h"
-#include "thermal-helper.h"
-
-namespace android {
-namespace hardware {
-namespace thermal {
-namespace V1_1 {
-namespace implementation {
-
-constexpr const char kThermalSensorsRoot[] = "/sys/class/thermal";
-constexpr char kThermalZoneDirSuffix[] = "thermal_zone";
-constexpr char kSensorTypeFileSuffix[] = "type";
-constexpr char kTemperatureFileSuffix[] = "temp";
-// This is a golden set of thermal sensor names, their types, and their
-// multiplier. Used when we read in sensor values. The tuple value stored is
-// formatted as such:
-// <temperature type, multiplier value for reading temp>
-const std::unordered_map<std::string, std::tuple<TemperatureType, float>>
-kValidThermalSensorsMap = {
-    {"tsens_tz_sensor1", {TemperatureType::CPU, 0.1}},   // CPU0
-    {"tsens_tz_sensor2", {TemperatureType::CPU, 0.1}},   // CPU1
-    {"tsens_tz_sensor4", {TemperatureType::CPU, 0.1}},   // CPU2
-    {"tsens_tz_sensor3", {TemperatureType::CPU, 0.1}},   // CPU3
-    {"tsens_tz_sensor7", {TemperatureType::CPU, 0.1}},   // CPU4
-    {"tsens_tz_sensor8", {TemperatureType::CPU, 0.1}},   // CPU5
-    {"tsens_tz_sensor9", {TemperatureType::CPU, 0.1}},   // CPU6
-    {"tsens_tz_sensor10", {TemperatureType::CPU, 0.1}},  // CPU7
-    // GPU thermal sensor.
-    {"tsens_tz_sensor13", {TemperatureType::GPU, 0.1}},
-    // Battery thermal sensor.
-    {"battery", {TemperatureType::BATTERY, 0.001}},
-    // Skin thermal sensors. We use back_therm for walleye. For taimen we use
-    // bd_therm and bd_therm2.
-    {"back_therm", {TemperatureType::SKIN, 1.}},
-    {"bd_therm", {TemperatureType::SKIN, 1.}},
-    {"bd_therm2", {TemperatureType::SKIN, 1.}},
-    // USBC thermal sensor.
-    {"usb_port_temp", {TemperatureType::UNKNOWN, 0.1}},
-};
-
-namespace {
-
-using ::android::hardware::thermal::V1_0::TemperatureType;
-
-static std::string gSkinSensorType;
-static unsigned int gSkinThrottlingThreshold;
-static unsigned int gSkinShutdownThreshold;
-static unsigned int gVrThrottledBelowMin;
-Sensors gSensors;
-
-// A map containing hardcoded thresholds per sensor type.  Its not const
-// because initThermal() will modify the skin sensor thresholds depending on the
-// hardware type. The tuple is formatted as follows:
-// <throttling threshold, shutdown threshold, vr threshold>
-std::unordered_map<TemperatureType, std::tuple<float, float, float>>
-gSensorTypeToThresholdsMap = {
-    {TemperatureType::CPU, {kCpuThrottlingThreshold, kCpuShutdownThreshold,
-                             kCpuThrottlingThreshold}},
-    {TemperatureType::GPU, {NAN, NAN, NAN}},
-    {TemperatureType::BATTERY, {NAN, kBatteryShutdownThreshold, NAN}},
-    {TemperatureType::SKIN, {NAN, NAN, NAN}},
-    {TemperatureType::UNKNOWN, {NAN, NAN, NAN}}
-};
-
-bool initializeSensors() {
-    auto thermal_zone_dir = std::unique_ptr<DIR, int (*)(DIR*)>(
-        opendir(kThermalSensorsRoot), closedir);
-    struct dirent* dp;
-    size_t num_thermal_zones = 0;
-    while ((dp = readdir(thermal_zone_dir.get())) != nullptr) {
-        std::string dir_name(dp->d_name);
-        if (dir_name.find(kThermalZoneDirSuffix) != std::string::npos) {
-            ++num_thermal_zones;
-        }
-    }
-
-    for (size_t sensor_zone_num = 0; sensor_zone_num < num_thermal_zones;
-            ++sensor_zone_num) {
-        std::string path = android::base::StringPrintf("%s/%s%zu",
-                                                       kThermalSensorsRoot,
-                                                       kThermalZoneDirSuffix,
-                                                       sensor_zone_num);
-        std::string sensor_name;
-        if (android::base::ReadFileToString(
-                path + "/" + kSensorTypeFileSuffix, &sensor_name)) {
-            sensor_name = android::base::Trim(sensor_name);
-            if (kValidThermalSensorsMap.find(sensor_name) !=
-                kValidThermalSensorsMap.end()) {
-                  TemperatureType type = std::get<0>(
-                      kValidThermalSensorsMap.at(sensor_name));
-                  auto thresholds = gSensorTypeToThresholdsMap.at(type);
-                  if (!gSensors.addSensor(
-                          sensor_name, path + "/" + kTemperatureFileSuffix,
-                          std::get<0>(thresholds), std::get<1>(thresholds),
-                          std::get<2>(thresholds), type)) {
-                        LOG(ERROR) << "Could not add " << sensor_name
-                                   << "to sensors map";
-                  }
-            }
-        }
-    }
-    return (gSensors.getNumSensors() == kTemperatureNum);
-}
-
-}  // namespace
-
-/**
- * Initialization constants based on platform
- *
- * @return true on success or false on error.
- */
-bool initThermal() {
-    std::string hardware = android::base::GetProperty("ro.hardware", "");
-    if (hardware == "walleye") {
-        LOG(ERROR) << "Initialization on Walleye";
-        gSkinThrottlingThreshold = kWalleyeSkinThrottlingThreshold;
-        gSkinShutdownThreshold = kWalleyeSkinShutdownThreshold;
-        gVrThrottledBelowMin = kWalleyeVrThrottledBelowMin;
-    } else if (hardware == "taimen") {
-        std::string rev = android::base::GetProperty("ro.revision", "");
-        if (rev == "rev_a" || rev == "rev_b") {
-            LOG(ERROR) << "Initialization on Taimen pre revision C";
-            gSkinThrottlingThreshold = kTaimenRabSkinThrottlingThreshold;
-            gSkinShutdownThreshold = kTaimenRabSkinShutdownThreshold;
-            gVrThrottledBelowMin = kTaimenRabVrThrottledBelowMin;
-        } else {
-            LOG(ERROR) << "Initialization on Taimen revision C and later";
-            gSkinThrottlingThreshold = kTaimenRcSkinThrottlingThreshold;
-            gSkinShutdownThreshold = kTaimenRcSkinShutdownThreshold;
-            gVrThrottledBelowMin = kTaimenRcVrThrottledBelowMin;
-        }
-    } else {
-        LOG(ERROR) << "Unsupported hardware: " << hardware;
-        return false;
-    }
-    gSensorTypeToThresholdsMap[TemperatureType::SKIN] =
-        std::make_tuple(gSkinThrottlingThreshold, gSkinShutdownThreshold,
-                        gVrThrottledBelowMin);
-    return initializeSensors();
-}
-
-ssize_t fillTemperatures(hidl_vec<Temperature>* temperatures) {
-    temperatures->resize(gSensors.getNumSensors());
-    ssize_t current_index = 0;
-    for (const auto& name_type_mult_pair : kValidThermalSensorsMap) {
-        Temperature temp;
-        if (gSensors.readTemperature(name_type_mult_pair.first,
-                                     std::get<1>(name_type_mult_pair.second),
-                                     &temp)) {
-            (*temperatures)[current_index] = temp;
-            ++current_index;
-        }
-    }
-    return current_index;
-}
-
-ssize_t fillCpuUsages(hidl_vec<CpuUsage> *cpuUsages) {
-    int vals, cpu_num, online;
-    ssize_t read;
-    uint64_t user, nice, system, idle, active, total;
-    char *line = NULL;
-    size_t len = 0;
-    size_t size = 0;
-    char file_name[PATH_MAX];
-    FILE *file;
-    FILE *cpu_file;
-
-    if (cpuUsages == NULL || cpuUsages->size() < kCpuNum ) {
-        LOG(ERROR) << "fillCpuUsages: incorrect buffer";
-        return -EINVAL;
-    }
-
-    file = fopen(kCpuUsageFile, "r");
-    if (file == NULL) {
-        PLOG(ERROR) << "fillCpuUsages: failed to open file (" << kCpuUsageFile << ")";
-        return -errno;
-    }
-
-    while ((read = getline(&line, &len, file)) != -1) {
-        // Skip non "cpu[0-9]" lines.
-        if (strnlen(line, read) < 4 || strncmp(line, "cpu", 3) != 0 || !isdigit(line[3])) {
-            free(line);
-            line = NULL;
-            len = 0;
-            continue;
-        }
-
-        vals = sscanf(line, "cpu%d %" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64, &cpu_num, &user,
-                &nice, &system, &idle);
-
-        free(line);
-        line = NULL;
-        len = 0;
-
-        if (vals != 5 || size == kCpuNum) {
-            if (vals != 5) {
-                PLOG(ERROR) << "fillCpuUsages: failed to read CPU information from file ("
-                            << kCpuUsageFile << ")";
-            } else {
-                PLOG(ERROR) << "fillCpuUsages: file has incorrect format ("
-                            << kCpuUsageFile << ")";
-            }
-            fclose(file);
-            return errno ? -errno : -EIO;
-        }
-
-        active = user + nice + system;
-        total = active + idle;
-
-        // Read online CPU information.
-        snprintf(file_name, PATH_MAX, kCpuOnlineFileFormat, cpu_num);
-        cpu_file = fopen(file_name, "r");
-        online = 0;
-        if (cpu_file == NULL) {
-            PLOG(ERROR) << "fillCpuUsages: failed to open file (" << file_name << ")";
-            fclose(file);
-            return -errno;
-        }
-        if (1 != fscanf(cpu_file, "%d", &online)) {
-            PLOG(ERROR) << "fillCpuUsages: failed to read CPU online information from file ("
-                        << file_name << ")";
-            fclose(file);
-            fclose(cpu_file);
-            return errno ? -errno : -EIO;
-        }
-        fclose(cpu_file);
-
-        (*cpuUsages)[size].name = kCpuLabel[size];
-        (*cpuUsages)[size].active = active;
-        (*cpuUsages)[size].total = total;
-        (*cpuUsages)[size].isOnline = static_cast<bool>(online);
-
-        LOG(DEBUG) << "fillCpuUsages: "<< kCpuLabel[size] << ": "
-                   << active << " " << total << " " <<  online;
-        size++;
-    }
-    fclose(file);
-
-    if (size != kCpuNum) {
-        PLOG(ERROR) << "fillCpuUsages: file has incorrect format (" << kCpuUsageFile << ")";
-        return -EIO;
-    }
-    return kCpuNum;
-}
-
-std::string getTargetSkinSensorType() {
-    return gSkinSensorType;
-}
-
-}  // namespace implementation
-}  // namespace V1_1
-}  // namespace thermal
-}  // namespace hardware
-}  // namespace android
diff --git a/thermal/thermal-helper.h b/thermal/thermal-helper.h
deleted file mode 100644
index ef0b61f..0000000
--- a/thermal/thermal-helper.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2017, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * *    * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- *       copyright notice, this list of conditions and the following
- *       disclaimer in the documentation and/or other materials provided
- *       with the distribution.
- *     * Neither the name of The Linux Foundation nor the names of its
- *       contributors may be used to endorse or promote products derived
- *       from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __THERMAL_HELPER_H__
-#define __THERMAL_HELPER_H__
-
-#include <android/hardware/thermal/1.1/IThermal.h>
-
-namespace android {
-namespace hardware {
-namespace thermal {
-namespace V1_1 {
-namespace implementation {
-
-using ::android::hardware::thermal::V1_0::CpuUsage;
-using ::android::hardware::thermal::V1_0::Temperature;
-using ::android::hardware::thermal::V1_0::TemperatureType;
-
-constexpr const char *kCpuUsageFile = "/proc/stat";
-constexpr const char *kTemperatureFileFormat = "/sys/class/thermal/thermal_zone%d/temp";
-constexpr const char *kCpuOnlineFileFormat = "/sys/devices/system/cpu/cpu%d/online";
-
-// thermal-engine.conf
-constexpr unsigned int kWalleyeSkinThrottlingThreshold = 40;
-constexpr unsigned int kWalleyeSkinShutdownThreshold = 56;
-constexpr unsigned int kWalleyeVrThrottledBelowMin = 52;
-
-constexpr unsigned int kTaimenRabSkinThrottlingThreshold = 49;
-constexpr unsigned int kTaimenRabSkinShutdownThreshold = 66;
-constexpr unsigned int kTaimenRabVrThrottledBelowMin = 62;
-
-constexpr unsigned int kTaimenRcSkinThrottlingThreshold = 38;
-constexpr unsigned int kTaimenRcSkinShutdownThreshold = 54;
-constexpr unsigned int kTaimenRcVrThrottledBelowMin = 50;
-
-constexpr unsigned int kCpuNum = 8;
-
-constexpr const char *kCpuLabel[kCpuNum] = {
-  "CPU0", "CPU1", "CPU2", "CPU3", "CPU4", "CPU5", "CPU6", "CPU7"};
-
-// Sum of kCpuNum + 4 for GPU, BATTERY, SKIN, and USB-C.
-constexpr unsigned int kTemperatureNum = 4 + kCpuNum;
-
-// qcom, therm-reset-temp
-constexpr unsigned int kCpuShutdownThreshold = 115;
-// qcom,freq-mitigation-temp
-constexpr unsigned int kCpuThrottlingThreshold = 95;
-
-// config_shutdownBatteryTemperature in overlay/frameworks/base/core/res/res/values/config.xml
-constexpr unsigned int kBatteryShutdownThreshold = 60;
-
-
-bool initThermal();
-ssize_t fillTemperatures(hidl_vec<Temperature> *temperatures);
-ssize_t fillCpuUsages(hidl_vec<CpuUsage> *cpuUsages);
-std::string getTargetSkinSensorType();
-
-}  // namespace implementation
-}  // namespace V1_1
-}  // namespace thermal
-}  // namespace hardware
-}  // namespace android
-
-#endif //__THERMAL_HELPER_H__
diff --git a/vibrator/OWNERS b/vibrator/OWNERS
new file mode 100644
index 0000000..2c0d70d
--- /dev/null
+++ b/vibrator/OWNERS
@@ -0,0 +1,2 @@
+dtwlin@google.com
+michaelwr@google.com
diff --git a/vr/Android.bp b/vr/Android.bp
deleted file mode 100644
index 99aef7d..0000000
--- a/vr/Android.bp
+++ /dev/null
@@ -1,30 +0,0 @@
-//
-// Copyright (C) 2017 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.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-cc_binary {
-    name: "android.hardware.vr@1.0-service.wahoo",
-    relative_install_path: "hw",
-    init_rc: ["android.hardware.vr@1.0-service.wahoo.rc"],
-    srcs: ["service.cpp", "VrDevice.cpp"],
-    cflags: ["-Werror", "-Wall"],
-    shared_libs: [
-        "libbase",
-        "libhidlbase",
-        "libhidltransport",
-        "liblog",
-        "libutils",
-        "android.hardware.vr@1.0",
-    ],
-    proprietary: true,
-}
diff --git a/vr/NOTICE b/vr/NOTICE
deleted file mode 100644
index 667db97..0000000
--- a/vr/NOTICE
+++ /dev/null
@@ -1,10 +0,0 @@
-Copyright (C) 2017 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.
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
diff --git a/vr/VrDevice.cpp b/vr/VrDevice.cpp
deleted file mode 100644
index e5cd94d..0000000
--- a/vr/VrDevice.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#define LOG_TAG "VrDevice"
-
-#include <android-base/file.h>
-#include <android-base/logging.h>
-#include <android-base/properties.h>
-#include <android-base/stringprintf.h>
-
-#include "VrDevice.h"
-
-namespace android {
-namespace hardware {
-namespace vr {
-namespace V1_0 {
-namespace implementation {
-
-constexpr char kTouchVRModeSysfs[] = "/sys/devices/virtual/input/ftm4_touch/vrmode";
-
-VrDevice::VrDevice() : mVRmode(false) {
-    std::string hardware = android::base::GetProperty("ro.hardware", "");
-    if (hardware == "taimen") {
-        mFtm4Touch = true;
-    } else {
-        mFtm4Touch = false;
-    }
-}
-
-Return<void> VrDevice::init() {
-    // NOOP
-    return Void();
-}
-
-Return<void> VrDevice::setVrMode(bool enabled) {
-    mVRmode = enabled;
-    if (enabled) {
-        if (!android::base::SetProperty("sys.qcom.thermalcfg",
-                                        "/vendor/etc/thermal-engine-vr.conf")) {
-            LOG(ERROR) << "Couldn't set thermal_engine enable property";
-            return Void();
-        }
-    } else {
-        if (!android::base::SetProperty("sys.qcom.thermalcfg",
-                                        "/vendor/etc/thermal-engine.conf")) {
-            LOG(ERROR) << "Couldn't set thermal_engine disable property";
-            return Void();
-        }
-    }
-    if (!android::base::SetProperty("ctl.restart", "vendor.thermal-engine")) {
-        LOG(ERROR) << "Couldn't set thermal_engine restart property";
-    }
-
-    if (mFtm4Touch &&
-        !android::base::WriteStringToFile((enabled ? "1" : "0"), kTouchVRModeSysfs)) {
-        PLOG(ERROR) <<  "Failed to write to vrmode sysfs node with :" << enabled;
-    }
-
-    return Void();
-}
-
-Return<void> VrDevice::debug(const hidl_handle& handle, const hidl_vec<hidl_string>&) {
-    if (handle != nullptr && handle->numFds >= 1) {
-        int fd = handle->data[0];
-        std::string buf(android::base::StringPrintf("VRMode: %s\n",
-                                                    (mVRmode ? "true" : "false")));
-        if (!android::base::WriteStringToFd(buf, fd)) {
-            PLOG(ERROR) << "Failed to dump state to fd";
-        }
-        fsync(fd);
-    }
-    return Void();
-}
-
-}  // namespace implementation
-}  // namespace V1_0
-}  // namespace vr
-}  // namespace hardware
-}  // namespace android
diff --git a/vr/VrDevice.h b/vr/VrDevice.h
deleted file mode 100644
index 7bc3e14..0000000
--- a/vr/VrDevice.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef ANDROID_HARDWARE_VR_V1_0_VR_H
-#define ANDROID_HARDWARE_VR_V1_0_VR_H
-
-#include <android/hardware/vr/1.0/IVr.h>
-
-namespace android {
-namespace hardware {
-namespace vr {
-namespace V1_0 {
-namespace implementation {
-
-using ::android::hardware::vr::V1_0::IVr;
-using ::android::hardware::Return;
-
-struct VrDevice : public IVr {
-    VrDevice();
-
-    Return<void> init()  override;
-    Return<void> setVrMode(bool enabled)  override;
-    Return<void> debug(const hidl_handle& handle, const hidl_vec<hidl_string>&)  override;
-  private:
-    // Taimen display touch sensitivity for VR Mode (b/37515573)
-    bool mFtm4Touch;
-    bool mVRmode;
-};
-
-}  // namespace implementation
-}  // namespace V1_0
-}  // namespace vr
-}  // namespace hardware
-}  // namespace android
-
-#endif  // ANDROID_HARDWARE_VR_V1_0_VR_H
diff --git a/vr/android.hardware.vr@1.0-service.wahoo.rc b/vr/android.hardware.vr@1.0-service.wahoo.rc
deleted file mode 100644
index 10f3ac9..0000000
--- a/vr/android.hardware.vr@1.0-service.wahoo.rc
+++ /dev/null
@@ -1,10 +0,0 @@
-service vendor.vr-wahoo-1-0 /vendor/bin/hw/android.hardware.vr@1.0-service.wahoo
-    class hal
-    user system
-    group system
-
-# reset touch and thermal-engine when framework died and thermal-engine is in VR mode
-on property:init.svc.zygote=restarting && property:sys.qcom.thermalcfg=/vendor/etc/thermal-engine-vr.conf
-   write /sys/devices/virtual/input/ftm4_touch/vrmode 0
-   setprop sys.qcom.thermalcfg "/vendor/etc/thermal-engine.conf"
-   restart vendor.thermal-engine
diff --git a/vr/service.cpp b/vr/service.cpp
deleted file mode 100644
index a04991b..0000000
--- a/vr/service.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#define LOG_TAG "android.hardware.vr@1.0-service.wahoo"
-
-#include <android-base/logging.h>
-#include <hidl/HidlSupport.h>
-#include <hidl/HidlTransportSupport.h>
-#include <utils/StrongPointer.h>
-
-#include "VrDevice.h"
-
-using ::android::hardware::configureRpcThreadpool;
-using ::android::hardware::joinRpcThreadpool;
-using ::android::hardware::vr::V1_0::implementation::VrDevice;
-using ::android::hardware::vr::V1_0::IVr;
-using ::android::sp;
-
-int main(int /* argc */, char* /* argv */ []) {
-    sp<IVr> vr = new VrDevice;
-    configureRpcThreadpool(1, true);
-    CHECK_EQ(vr->registerAsService(), android::NO_ERROR)
-            << "Failed to register vr HAL";
-    joinRpcThreadpool();
-    return 0;
-}
diff --git a/wpa_supplicant_overlay.conf b/wpa_supplicant_overlay.conf
index bb1906c..16c2804 100644
--- a/wpa_supplicant_overlay.conf
+++ b/wpa_supplicant_overlay.conf
@@ -2,3 +2,7 @@
 p2p_disabled=1
 tdls_external_control=1
 bss_max_count=512
+interworking=1
+hs20=1
+auto_interworking=0
+bss_no_flush_when_down=1