DO NOT MERGE - Merge Android 10 into master

Bug: 139893257
Change-Id: I5a9a6dd645a962020d9e0064fbe38652a28770c4
diff --git a/Android.bp b/Android.bp
index 53daff9..7aedf81 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,5 +1,6 @@
 soong_namespace {
     imports: [
+        "hardware/google/pixel",
         "hardware/qcom/bootctrl",
         "hardware/qcom/msm8998",
     ],
diff --git a/BoardConfig.mk b/BoardConfig.mk
index c5c66de..34a761d 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_VENDOR_SEPOLICY_DIRS += device/google/wahoo/sepolicy/vendor
 BOARD_PLAT_PUBLIC_SEPOLICY_DIR := device/google/wahoo/sepolicy/public
@@ -147,7 +148,7 @@
 SF_VSYNC_EVENT_PHASE_OFFSET_NS := 6000000
 
 # Display
-TARGET_HAS_WIDE_COLOR_DISPLAY := true
+TARGET_HAS_WIDE_COLOR_DISPLAY := false
 TARGET_HAS_HDR_DISPLAY := false
 TARGET_USES_COLOR_METADATA := true
 
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 991e456..7ef7ba0 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -178,13 +178,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)
@@ -197,5 +197,11 @@
 # 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)
+# Rename power HAL
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.power@1.2-service.wahoo-libperfmgr.rc)
+
 # Remove obsolete android.hardware.boot@1.0-impl-wrapper.recovery.so
 $(call add-clean-step, rm -rf $(PRODUCT_OUT)/recovery/root/system/lib64/hw/android.hardware.boot@1.0-impl-wrapper.recovery.so)
diff --git a/audio_policy_configuration.xml b/audio_policy_configuration.xml
index 4ad3f6d..38b267d 100644
--- a/audio_policy_configuration.xml
+++ b/audio_policy_configuration.xml
@@ -84,6 +84,11 @@
                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
                              channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_INDEX_MASK_3"/>
                 </mixPort>
+                <mixPort name="hotword input" role="sink" flags="AUDIO_INPUT_FLAG_HW_HOTWORD" maxActiveCount="0" >
+                    <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+                             samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
+                             channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO"/>
+                </mixPort>
                 <mixPort name="fast input" role="sink" flags="AUDIO_INPUT_FLAG_FAST">
                     <profile name="" format="AUDIO_FORMAT_PCM_8_24_BIT"
                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
@@ -159,6 +164,8 @@
                        sources="voice_tx,incall_music_uplink"/>
                 <route type="mix" sink="primary input"
                        sources="Built-In Mic,Built-In Back Mic,BT SCO Headset Mic,USB Device In,USB Headset In"/>
+                <route type="mix" sink="hotword input"
+                       sources="Built-In Mic,Built-In Back Mic,BT SCO Headset Mic,USB Device In,USB Headset In"/>
                 <route type="mix" sink="fast input"
                        sources="Built-In Mic,Built-In Back Mic,BT SCO Headset Mic,USB Device In,USB Headset In"/>
                 <route type="mix" sink="voice_rx"
diff --git a/audio_policy_configuration_bluetooth_legacy_hal.xml b/audio_policy_configuration_bluetooth_legacy_hal.xml
index 5dac292..26dbded 100644
--- a/audio_policy_configuration_bluetooth_legacy_hal.xml
+++ b/audio_policy_configuration_bluetooth_legacy_hal.xml
@@ -84,6 +84,11 @@
                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
                              channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_INDEX_MASK_3"/>
                 </mixPort>
+                <mixPort name="hotword input" role="sink" flags="AUDIO_INPUT_FLAG_HW_HOTWORD" maxActiveCount="0" >
+                    <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+                             samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
+                             channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO"/>
+                </mixPort>
                 <mixPort name="fast input" role="sink" flags="AUDIO_INPUT_FLAG_FAST">
                     <profile name="" format="AUDIO_FORMAT_PCM_8_24_BIT"
                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
@@ -159,6 +164,8 @@
                        sources="voice_tx,incall_music_uplink"/>
                 <route type="mix" sink="primary input"
                        sources="Built-In Mic,Built-In Back Mic,BT SCO Headset Mic,USB Device In,USB Headset In"/>
+                <route type="mix" sink="hotword input"
+                       sources="Built-In Mic,Built-In Back Mic,BT SCO Headset Mic,USB Device In,USB Headset In"/>
                 <route type="mix" sink="fast input"
                        sources="Built-In Mic,Built-In Back Mic,BT SCO Headset Mic,USB Device In,USB Headset In"/>
                 <route type="mix" sink="voice_rx"
diff --git a/default-permissions.xml b/default-permissions.xml
index 7c653b5..695da91 100644
--- a/default-permissions.xml
+++ b/default-permissions.xml
@@ -79,12 +79,6 @@
     </exception>
 
     <exception
-            package="com.google.intelligence.sense">
-        <!-- Record Audio -->
-        <permission name="android.permission.RECORD_AUDIO" fixed="false"/>
-    </exception>
-
-    <exception
             package="com.qualcomm.ltebc_vzw">
         <!-- Phone -->
         <permission name="android.permission.READ_PHONE_STATE" fixed="false"/>
@@ -124,6 +118,26 @@
         <permission name="android.permission.READ_CALENDAR" fixed="true"/>
         <!-- Location -->
         <permission name="android.permission.ACCESS_FINE_LOCATION" fixed="true"/>
+        <permission name="android.permission.ACCESS_BACKGROUND_LOCATION" fixed="true"/>
     </exception>
 
+    <exception
+            package="com.google.android.projection.gearhead"
+            sha256-cert-digest="FD:B0:0C:43:DB:DE:8B:51:CB:31:2A:A8:1D:3B:5F:A1:77:13:AD:B9:4B:28:F5:98:D7:7F:8E:B8:9D:AC:EE:DF">
+        <!-- Gearhead legacy -->
+        <permission name="android.permission.ACCESS_FINE_LOCATION" fixed="false"/>
+        <permission name="android.permission.CALL_PHONE" fixed="false"/>
+        <permission name="android.permission.READ_CALL_LOG" fixed="false"/>
+        <permission name="android.permission.READ_CONTACTS" fixed="false"/>
+        <permission name="android.permission.READ_PHONE_STATE" fixed="false"/>
+        <permission name="android.permission.RECEIVE_SMS" fixed="false"/>
+        <permission name="android.permission.RECORD_AUDIO" fixed="false"/>
+        <permission name="android.permission.SEND_SMS" fixed="false"/>
+        <!-- For Top Gear -->
+        <permission name="android.permission.PROCESS_OUTGOING_CALLS" fixed="false"/>
+        <permission name="android.permission.READ_SMS" fixed="false"/>
+        <permission name="android.permission.RECEIVE_MMS" fixed="false"/>
+        <permission name="android.permission.WRITE_CALL_LOG" fixed="false"/>
+        <permission name="android.permission.ACCESS_COARSE_LOCATION" fixed="false"/>
+    </exception>
 </exceptions>
diff --git a/device.mk b/device.mk
index 4585454..d6c1313 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.
@@ -14,6 +14,12 @@
 # limitations under the License.
 #
 
+# Installs gsi keys into ramdisk, to boot a GSI with verified boot.
+$(call inherit-product, $(SRC_TARGET_DIR)/product/gsi_keys.mk)
+
+# Enable updating of APEXes
+$(call inherit-product, $(SRC_TARGET_DIR)/product/updatable_apex.mk)
+
 ifneq (,$(filter 27, $(PRODUCT_EXTRA_VNDK_VERSIONS)))
     _vndk_test := true
 endif
@@ -31,6 +37,8 @@
 
 PRODUCT_SOONG_NAMESPACES += \
     device/google/wahoo \
+    vendor/google/camera \
+    hardware/google/pixel \
     hardware/qcom/msm8998
 
 PRODUCT_COPY_FILES += \
@@ -40,7 +48,7 @@
 
 # Set the SVN for the targeted MR release
 PRODUCT_PROPERTY_OVERRIDES += \
-    ro.vendor.build.svn=27
+    ro.vendor.build.svn=32
 
 # Enforce privapp-permissions whitelist
 PRODUCT_PROPERTY_OVERRIDES += \
@@ -55,7 +63,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)
@@ -86,9 +94,8 @@
     $(LOCAL_PATH)/uinput-fpc.idc:$(TARGET_COPY_OUT_VENDOR)/usr/idc/uinput-fpc.idc \
     $(LOCAL_PATH)/init.qcom.devstart.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qcom.devstart.sh \
     $(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
 
@@ -130,9 +137,14 @@
 
 # The following modules are included in debuggable builds only.
 PRODUCT_PACKAGES_DEBUG += \
+    a_sns_test \
     bootctl \
     update_engine_client
 
+# Write flags to the vendor space in /misc partition.
+PRODUCT_PACKAGES += \
+    misc_writer
+
 PRODUCT_COPY_FILES += \
     frameworks/native/data/etc/android.hardware.camera.flash-autofocus.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.flash-autofocus.xml \
     frameworks/native/data/etc/android.hardware.camera.front.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.front.xml \
@@ -178,10 +190,11 @@
 
 # power HAL
 PRODUCT_PACKAGES += \
-    android.hardware.power@1.2-service.wahoo-libperfmgr
+    android.hardware.power@1.3-service.pixel-libperfmgr
 
-PRODUCT_COPY_FILES += \
-    $(LOCAL_PATH)/powerhint.json:$(TARGET_COPY_OUT_VENDOR)/etc/powerhint.json
+# power.stats HAL
+PRODUCT_PACKAGES += \
+    android.hardware.power.stats@1.0-service.pixel
 
 # health HAL
 PRODUCT_PACKAGES += \
@@ -313,7 +326,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
@@ -359,8 +372,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
@@ -392,6 +405,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
@@ -427,9 +442,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 += \
@@ -440,10 +455,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
 
@@ -457,11 +468,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
@@ -485,9 +499,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
 
@@ -545,6 +559,15 @@
     frameworks/av/media/libstagefright/data/media_codecs_google_video.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_video.xml \
     $(LOCAL_PATH)/media_profiles_V1_0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_profiles_V1_0.xml \
 
+# Codec2 modules
+PRODUCT_PACKAGES += \
+    com.android.media.swcodec \
+    libsfplugin_ccodec \
+
+# Codec2 switch
+PRODUCT_PROPERTY_OVERRIDES += \
+    debug.media.codec2=2 \
+
 PRODUCT_PROPERTY_OVERRIDES += \
     audio.snd_card.open.retries=50
 
@@ -554,6 +577,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
@@ -670,3 +695,27 @@
   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
+PRODUCT_DEFAULT_PROPERTY_OVERRIDES += ro.surface_flinger.protected_contents=true
+
+# Early phase offset configuration for SurfaceFlinger
+PRODUCT_PROPERTY_OVERRIDES += \
+    debug.sf.early_phase_offset_ns=1500000
+PRODUCT_PROPERTY_OVERRIDES += \
+    debug.sf.early_app_phase_offset_ns=1500000
+PRODUCT_PROPERTY_OVERRIDES += \
+    debug.sf.early_gl_phase_offset_ns=3000000
+PRODUCT_PROPERTY_OVERRIDES += \
+    debug.sf.early_gl_app_phase_offset_ns=15000000
+
+# Use /product/etc/fstab.postinstall to mount system_other.
+PRODUCT_PRODUCT_PROPERTIES += \
+    ro.postinstall.fstab.prefix=/product
+
+PRODUCT_COPY_FILES += \
+    $(LOCAL_PATH)/fstab.postinstall:$(TARGET_COPY_OUT_PRODUCT)/etc/fstab.postinstall
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..e7059b2 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,sync                     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/fstab.postinstall b/fstab.postinstall
new file mode 100644
index 0000000..df8f77b
--- /dev/null
+++ b/fstab.postinstall
@@ -0,0 +1,17 @@
+#
+# Copyright (C) 2019 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.
+
+#<src>                    <mnt_point>  <type> <mnt_flags and options> <fs_mgr_flags>
+/dev/block/by-name/system /postinstall ext4   ro,nosuid,nodev,noexec  slotselect_other,avb_keys=/product/etc/security/avb/system_other.avbpubkey
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..48b91d5 100644
--- a/init.hardware.rc
+++ b/init.hardware.rc
@@ -17,6 +17,10 @@
 import /vendor/etc/init/hw/init.${ro.hardware}.usb.rc
 
 on charger
+    # Set runtime stune value
+    write /dev/stune/schedtune.prefer_idle 0
+    write /dev/stune/schedtune.boost 0
+    # Offline CPUs
     write /sys/devices/system/cpu/cpu2/online 0
     write /sys/devices/system/cpu/cpu3/online 0
     write /sys/devices/system/cpu/cpu4/online 0
@@ -80,6 +84,10 @@
     write /sys/devices/system/cpu/cpufreq/policy4/schedutil/up_rate_limit_us 500
     write /sys/devices/system/cpu/cpufreq/policy4/schedutil/down_rate_limit_us 20000
 
+    # Set boottime stune value
+    write /dev/stune/schedtune.prefer_idle 1
+    write /dev/stune/schedtune.boost 100
+
     # set default schedTune value for foreground/top-app
     write /dev/stune/foreground/schedtune.prefer_idle 1
     write /dev/stune/top-app/schedtune.boost 10
@@ -159,6 +167,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 +199,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 +241,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 +255,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 +338,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
@@ -386,14 +389,6 @@
     # b/62837579 elabel directory
     mkdir /data/misc/elabel 0700 system system
 
-    # Setup permission for powerHAL
-    chown system system /dev/stune/top-app/schedtune.boost
-    chown system system /dev/cpu_dma_latency
-    chown system system /sys/class/kgsl/kgsl-3d0/devfreq/min_freq
-    chown system system /sys/class/kgsl/kgsl-3d0/devfreq/max_freq
-    chown system system /sys/class/devfreq/soc:qcom,gpubw/min_freq
-    chown system system /sys/devices/soc/soc:qcom,cpubw/devfreq/soc:qcom,cpubw/min_freq
-
 on early-boot
     # wait for devices
     wait_for_prop sys.qcom.devup 1
@@ -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,10 @@
 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}
+on property:vendor.qcom.thermalcfg=*
+    restart vendor.thermal-engine
+
+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
@@ -559,12 +553,14 @@
     disabled
 
 on property:sys.post_boot.parsed=1
-    # Setup permission for powerHAL
-    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
+    # Set runtime stune value
+    write /dev/stune/schedtune.prefer_idle 0
+    write /dev/stune/schedtune.boost 0
+
     # Enable power setting and set sys.post_boot.parsed to 1
     start vendor.power_sh
 
@@ -618,6 +614,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
@@ -691,6 +688,7 @@
     #   group wifi inet keystore
     interface android.hardware.wifi.supplicant@1.0::ISupplicant default
     interface android.hardware.wifi.supplicant@1.1::ISupplicant default
+    interface android.hardware.wifi.supplicant@1.2::ISupplicant default
     class main
     socket wpa_wlan0 dgram 660 wifi wifi
     disabled
@@ -820,13 +818,6 @@
     disabled
     oneshot
 
-service vendor.wlan_sh /vendor/bin/init.qcom.wlan.sh
-    class main
-    user root
-    group root
-    disabled
-    oneshot
-
 service vendor.ipastart_sh /vendor/bin/init.qcom.ipastart.sh
     class main
     user system
@@ -841,13 +832,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
@@ -863,13 +847,51 @@
 on property:sys.vdso=32
    write /sys/module/vdso/parameters/enable_64 0
 
-on property:wlan.driver.status=ok
-   # Get the wlan driver/fw version
-   start vendor.wlan_sh
-
 # charger driver exposes now finer grain control, map demo mode to those properties
 # demo mode can only be exit wipping data which will also reset the persist properties
 on property:sys.retaildemo.enabled=1
     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.qcom.wlan.sh b/init.qcom.wlan.sh
deleted file mode 100644
index 0d14fab..0000000
--- a/init.qcom.wlan.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#! /vendor/bin/sh
-
-wlan_driver_version=`cat /sys/kernel/wifi/wlan/driver_version`
-setprop vendor.wlan.driver.version "$wlan_driver_version"
-wlan_fw_version=`cat /sys/kernel/wifi/wlan/fw/0/version`
-setprop vendor.wlan.firmware.version "$wlan_fw_version"
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..d708a3c 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>
@@ -219,11 +219,11 @@
         </interface>
     </hal>
     <hal format="hidl">
-        <name>android.hardware.power</name>
+        <name>android.hardware.power.stats</name>
         <transport>hwbinder</transport>
-        <version>1.2</version>
+        <version>1.0</version>
         <interface>
-            <name>IPower</name>
+            <name>IPowerStats</name>
             <instance>default</instance>
         </interface>
     </hal>
@@ -270,7 +270,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 +295,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 +322,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 +333,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 +342,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 +351,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..03b6d1d 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,10 @@
             <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-720x576" value="25" />
+            <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 +177,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 +195,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 +215,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 +232,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 +247,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 +260,9 @@
             <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-720x576" value="25" />
+            <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 +276,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 +292,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 +309,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 +325,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 +342,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/media_codecs_performance.xml b/media_codecs_performance.xml
index d496f91..f08fd90 100644
--- a/media_codecs_performance.xml
+++ b/media_codecs_performance.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" ?>
-<!-- Copyright 2018 The Android Open Source Project
+<!-- Copyright 2019 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.
@@ -14,148 +14,129 @@
      limitations under the License.
 -->
 
-<!-- Generated file for wahoo using measurements between PPR1.180405.004 and PPR1.180514.002 -->
 <MediaCodecs>
     <Encoders>
         <MediaCodec name="OMX.qcom.video.encoder.h263" type="video/3gpp" update="true">
-            <!-- measured 98%:189-648 med:213/238 FLAKY(107 - 648 < mx=649.8) -->
-            <Limit name="measured-frame-rate-176x144" range="213-324" /> <!-- N=270 v98%=1.9 (PPR1.180405.002-) -->
-            <Limit name="measured-frame-rate-352x288" range="289-289" /> <!-- N=260 v98%=1.4 -->
+            <Limit name="measured-frame-rate-176x144" range="202-209" /> <!-- N=32 v93%=1.0 -->
+            <Limit name="measured-frame-rate-352x288" range="291-317" /> <!-- N=32 v93%=1.1 -->
+        </MediaCodec>
+        <MediaCodec name="c2.android.h263.encoder" type="video/3gpp" update="true">
+            <Limit name="measured-frame-rate-176x144" range="756-756" /> <!-- N=32 v93%=1.4 -->
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.encoder.avc" type="video/avc" update="true">
-            <Limit name="measured-frame-rate-320x240" range="280-280" /> <!-- N=264 v98%=1.3 -->
-            <Limit name="measured-frame-rate-720x480" range="93-109" /> <!-- N=258 v98%=1.6 -->
-            <Limit name="measured-frame-rate-1280x720" range="87-87" /> <!-- N=266 v98%=1.3 (PPR1.180405.002-) -->
-            <Limit name="measured-frame-rate-1920x1080" range="33-33" /> <!-- N=258 v98%=1.4 -->
+            <Limit name="measured-frame-rate-320x240" range="283-284" /> <!-- N=32 v93%=1.0 -->
+            <!-- measured 93%:82-110 med:86 SLOW -->
+            <Limit name="measured-frame-rate-720x480" range="86-95" /> <!-- N=32 v93%=1.1 -->
+            <Limit name="measured-frame-rate-1280x720" range="88-88" /> <!-- N=32 v93%=1.0 -->
+            <Limit name="measured-frame-rate-1920x1080" range="36-36" /> <!-- N=32 v93%=1.1 -->
+        </MediaCodec>
+        <MediaCodec name="c2.android.avc.encoder" type="video/avc" update="true">
+            <Limit name="measured-frame-rate-320x240" range="264-264" /> <!-- N=30 v93%=1.1 -->
+            <Limit name="measured-frame-rate-720x480" range="87-90" /> <!-- N=32 v93%=1.1 -->
+            <Limit name="measured-frame-rate-1280x720" range="61-62" /> <!-- N=32 v93%=1.1 -->
+            <Limit name="measured-frame-rate-1920x1080" range="34-34" /> <!-- N=32 v93%=1.1 -->
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.encoder.hevc" type="video/hevc" update="true">
-            <Limit name="measured-frame-rate-320x240" range="329-329" /> <!-- N=262 v98%=1.3 -->
-            <!-- measured 98%:81-197 med:96/96 FLAKY(48 - 198 < mx=201.0) -->
-            <Limit name="measured-frame-rate-720x480" range="96-99" /> <!-- N=262 v98%=1.6 -->
-            <Limit name="measured-frame-rate-1280x720" range="125-125" /> <!-- N=262 v98%=1.1 -->
-            <Limit name="measured-frame-rate-1920x1080" range="49-49" /> <!-- N=250 v98%=1.2 -->
-            <Limit name="measured-frame-rate-3840x2160" range="17-20" /> <!-- N=262 v98%=1.3 (PPR1.180405.002-) -->
+            <Limit name="measured-frame-rate-320x240" range="338-338" /> <!-- N=32 v93%=1.0 -->
+            <Limit name="measured-frame-rate-720x480" range="97-97" /> <!-- N=32 v93%=1.0 -->
+            <Limit name="measured-frame-rate-1280x720" range="131-131" /> <!-- N=32 v93%=1.0 -->
+            <Limit name="measured-frame-rate-1920x1080" range="54-54" /> <!-- N=32 v93%=1.1 -->
+            <Limit name="measured-frame-rate-3840x2160" range="22-22" /> <!-- N=32 v93%=1.0 -->
+        </MediaCodec>
+        <MediaCodec name="c2.android.hevc.encoder" type="video/hevc" update="true">
+            <Limit name="measured-frame-rate-320x240" range="35-36" /> <!-- N=32 v93%=1.0 -->
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.encoder.mpeg4" type="video/mp4v-es" update="true">
-            <!-- measured 98%:187-644 med:237/281 FLAKY(119 - 644 < mx=644.3) -->
-            <Limit name="measured-frame-rate-176x144" range="237-322" /> <!-- N=258 v98%=1.9 -->
-            <Limit name="measured-frame-rate-352x288" range="293-320" /> <!-- N=254 v98%=1.4 (PPR1.180405.002-) -->
-            <!-- measured 98%:78-257 med:225/225 FLAKY(mn=70.1 < 78 - 450) -->
-            <Limit name="measured-frame-rate-640x480" range="155-225" /> <!-- N=250 v98%=1.8 -->
+            <Limit name="measured-frame-rate-176x144" range="200-206" /> <!-- N=32 v93%=1.0 -->
+            <Limit name="measured-frame-rate-352x288" range="294-295" /> <!-- N=32 v93%=1.0 -->
+            <Limit name="measured-frame-rate-640x480" range="225-226" /> <!-- N=32 v93%=1.0 -->
+        </MediaCodec>
+        <MediaCodec name="c2.android.mpeg4.encoder" type="video/mp4v-es" update="true">
+            <Limit name="measured-frame-rate-176x144" range="854-854" /> <!-- N=32 v93%=1.1 -->
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.encoder.vp8" type="video/x-vnd.on2.vp8" update="true">
-            <!-- measured 93%:140-368 med:205/199 FLAKY(96 - 416 < mx=491.4) -->
-            <Limit name="measured-frame-rate-320x180" range="192-208" /> <!-- N=278 v93%=1.6 -->
-            <Limit name="measured-frame-rate-640x360" range="250-250" /> <!-- N=268 v98%=1.2 -->
-            <Limit name="measured-frame-rate-1280x720" range="87-87" /> <!-- N=254 v98%=1.1 -->
-            <Limit name="measured-frame-rate-1920x1080" range="34-34" /> <!-- N=254 v98%=1.3 (PPR1.180405.002-) -->
+            <Limit name="measured-frame-rate-320x180" range="162-169" /> <!-- N=32 v93%=1.2 -->
+            <Limit name="measured-frame-rate-640x360" range="269-270" /> <!-- N=32 v93%=1.0 -->
+            <Limit name="measured-frame-rate-1280x720" range="89-89" /> <!-- N=32 v93%=1.0 -->
+            <Limit name="measured-frame-rate-1920x1080" range="36-36" /> <!-- N=32 v93%=1.1 -->
         </MediaCodec>
-        <!-- Measurements between PPR1.180405.002 and PPR1.180514.002 -->
-        <MediaCodec name="OMX.google.h263.encoder" type="video/3gpp" update="true">
-            <!-- measured 98%:155-917 med:364/365 FLAKY(mn=132.7 < 150 - 956) variance:2.4 -->
-            <Limit name="measured-frame-rate-176x144" range="300-478" /> <!-- N=280 -->
-        </MediaCodec>
-        <MediaCodec name="OMX.google.h264.encoder" type="video/avc" update="true">
-            <!-- measured 98%:79-351 med:278/277 FLAKY(mn=73.9 < 78 - 554) variance:2.1 -->
-            <Limit name="measured-frame-rate-320x240" range="155-277" /> <!-- N=244 -->
-            <!-- measured 98%:47-118 med:95/94 FLAKY(mn=45.2 < 46 - 188) -->
-            <Limit name="measured-frame-rate-720x480" range="90-94" /> <!-- TWEAKED N=258 v98%=1.6 (PPR1.180405.002-) -->
-            <!-- measured 98%:12-72 med:54/54 FLAKY(mn=12.1 < 13 - 108) variance:2.4 -->
-            <Limit name="measured-frame-rate-1280x720" range="25-54" /> <!-- N=274 (PPR1.180405.002-) -->
-            <Limit name="measured-frame-rate-1920x1080" range="24-27" /> <!-- N=256 v98%=1.4 -->
-        </MediaCodec>
-        <!-- Measurements between PPR1.180405.002 and PPR1.180514.002 -->
-        <MediaCodec name="OMX.google.mpeg4.encoder" type="video/mp4v-es" update="true">
-            <!-- measured 98%:150-1017 med:412/406 FLAKY(mn=126.9 < 147 - 1062) variance:2.6 -->
-            <Limit name="measured-frame-rate-176x144" range="253-531" /> <!-- TWEAKED N=270 -->
-        </MediaCodec>
-        <MediaCodec name="OMX.google.vp8.encoder" type="video/x-vnd.on2.vp8" update="true">
-            <!-- measured 98%:38-97 med:75/75 FLAKY(mn=23.9 < 38 - 150) -->
-            <Limit name="measured-frame-rate-320x180" range="57-75" /> <!-- TWEAKED N=252 v98%=1.6 -->
-            <Limit name="measured-frame-rate-640x360" range="43-43" /> <!-- N=258 v98%=1.4 (PPR1.180405.002-) -->
-            <Limit name="measured-frame-rate-1280x720" range="17-17" /> <!-- N=300 v98%=1.3 -->
-            <Limit name="measured-frame-rate-1920x1080" range="12-12" /> <!-- N=254 v98%=1.2 (PPR1.180405.002-) -->
+        <MediaCodec name="c2.android.vp8.encoder" type="video/x-vnd.on2.vp8" update="true">
+            <Limit name="measured-frame-rate-320x180" range="321-321" /> <!-- N=32 v93%=1.0 -->
+            <Limit name="measured-frame-rate-640x360" range="111-111" /> <!-- N=32 v93%=1.1 -->
+            <Limit name="measured-frame-rate-1280x720" range="32-34" /> <!-- N=32 v93%=1.1 -->
+            <Limit name="measured-frame-rate-1920x1080" range="13-14" /> <!-- N=32 v93%=1.1 -->
         </MediaCodec>
     </Encoders>
     <Decoders>
         <MediaCodec name="OMX.qcom.video.decoder.h263" type="video/3gpp" update="true">
-            <!-- measured 90%:359-764 med:368/368 FLAKY(184 - 808 < mx=1036.3) -->
-            <Limit name="measured-frame-rate-176x144" range="368-404" /> <!-- N=242 v90%=1.5 -->
-            <Limit name="measured-frame-rate-352x288" range="362-608" /> <!-- N=236 v98%=1.7 -->
+            <Limit name="measured-frame-rate-176x144" range="392-405" /> <!-- N=32 v93%=1.0 -->
+            <Limit name="measured-frame-rate-352x288" range="376-379" /> <!-- N=32 v93%=1.0 -->
+        </MediaCodec>
+        <MediaCodec name="c2.android.h263.decoder" type="video/3gpp" update="true">
+            <Limit name="measured-frame-rate-176x144" range="547-547" /> <!-- N=32 v93%=1.1 -->
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.decoder.avc" type="video/avc" update="true">
-            <Limit name="measured-frame-rate-320x240" range="243-243" /> <!-- N=192 v98%=1.4 (PPR1.180405.002-) -->
-            <Limit name="measured-frame-rate-720x480" range="228-249" /> <!-- N=242 v98%=1.5 -->
-            <Limit name="measured-frame-rate-1280x720" range="212-213" /> <!-- N=236 v98%=1.3 -->
-            <Limit name="measured-frame-rate-1920x1080" range="142-142" /> <!-- N=192 v98%=1.1 (PPR1.180405.002-) -->
+            <Limit name="measured-frame-rate-320x240" range="249-251" /> <!-- N=32 v93%=1.0 -->
+            <Limit name="measured-frame-rate-720x480" range="236-236" /> <!-- N=32 v93%=1.0 -->
+            <Limit name="measured-frame-rate-1280x720" range="224-224" /> <!-- N=32 v93%=1.0 -->
+            <Limit name="measured-frame-rate-1920x1088" range="144-144" /> <!-- N=32 v93%=1.0 -->
+        </MediaCodec>
+        <MediaCodec name="c2.android.avc.decoder" type="video/avc" update="true">
+            <!-- measured 93%:102-197 med:125 SLOW -->
+            <Limit name="measured-frame-rate-320x240" range="125-142" /> <!-- N=32 v93%=1.4 -->
+            <Limit name="measured-frame-rate-768x480" range="54-54" /> <!-- N=32 v93%=1.1 -->
+            <Limit name="measured-frame-rate-1280x720" range="19-19" /> <!-- N=32 v93%=1.2 -->
+            <Limit name="measured-frame-rate-1920x1080" range="8-8" /> <!-- N=32 v93%=1.2 -->
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.decoder.hevc" type="video/hevc" update="true">
-            <!-- measured 98%:269-691 med:281/281 FLAKY(141 - 692 < mx=702.7) -->
-            <Limit name="measured-frame-rate-352x288" range="281-347" /> <!-- TWEAKED N=220 v98%=1.6 -->
-            <!-- measured 98%:251-506 med:262/262 FLAKY(131 - 524 < mx=526.0) -->
-            <Limit name="measured-frame-rate-640x360" range="262-264" /> <!-- TWEAKED N=192 v98%=1.4 (PPR1.180405.002-) -->
-            <Limit name="measured-frame-rate-720x480" range="251-251" /> <!-- N=192 v98%=1.4 (PPR1.180405.002-) -->
-            <Limit name="measured-frame-rate-1280x720" range="233-233" /> <!-- N=164 v98%=1.2 (PPR1.180405.002-) -->
-            <Limit name="measured-frame-rate-1920x1080" range="243-243" /> <!-- N=242 v98%=1.1 -->
-            <Limit name="measured-frame-rate-3840x2160" range="71-71" /> <!-- N=192 v98%=1.0 (PPR1.180405.002-) -->
+            <Limit name="measured-frame-rate-352x288" range="289-290" /> <!-- N=32 v93%=1.0 -->
+            <!-- measured 93%:262-506 med:271 SLOW -->
+            <Limit name="measured-frame-rate-640x360" range="270-364" /> <!-- N=32 v93%=1.4 -->
+            <Limit name="measured-frame-rate-720x480" range="259-259" /> <!-- N=32 v93%=1.0 -->
+            <Limit name="measured-frame-rate-1280x720" range="241-259" /> <!-- N=32 v93%=1.1 -->
+            <Limit name="measured-frame-rate-1920x1080" range="251-252" /> <!-- N=32 v93%=1.0 -->
+            <Limit name="measured-frame-rate-3840x2160" range="70-71" /> <!-- N=32 v93%=1.0 -->
+        </MediaCodec>
+        <MediaCodec name="c2.android.hevc.decoder" type="video/hevc" update="true">
+            <Limit name="measured-frame-rate-384x288" range="187-197" /> <!-- N=32 v93%=1.4 -->
+            <Limit name="measured-frame-rate-640x360" range="98-98" /> <!-- N=32 v93%=1.1 -->
+            <!-- measured 93%:84-124 med:91 SLOW -->
+            <Limit name="measured-frame-rate-768x480" range="91-102" /> <!-- N=32 v93%=1.2 -->
+            <Limit name="measured-frame-rate-1280x720" range="38-39" /> <!-- N=32 v93%=1.1 -->
+            <Limit name="measured-frame-rate-1920x1080" range="25-26" /> <!-- N=32 v93%=1.0 -->
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.decoder.mpeg4" type="video/mp4v-es" update="true">
-            <Limit name="measured-frame-rate-176x144" range="354-628" /> <!-- N=236 v98%=1.7 -->
-            <!-- measured 98%:331-944 med:338/338 FLAKY(169 - 944 < mx=952.4) -->
-            <Limit name="measured-frame-rate-480x360" range="338-472" /> <!-- N=242 v98%=1.7 -->
+            <Limit name="measured-frame-rate-176x144" range="365-394" /> <!-- N=32 v93%=1.1 -->
+            <Limit name="measured-frame-rate-480x360" range="349-352" /> <!-- N=32 v93%=1.0 -->
+        </MediaCodec>
+        <MediaCodec name="c2.android.mpeg4.decoder" type="video/mp4v-es" update="true">
+            <Limit name="measured-frame-rate-176x144" range="303-323" /> <!-- N=32 v93%=1.2 -->
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.decoder.vp8" type="video/x-vnd.on2.vp8" update="true">
-            <!-- measured 98%:319-910 med:328/327 FLAKY(164 - 910 < mx=910.7) -->
-            <Limit name="measured-frame-rate-320x180" range="327-456" /> <!-- TWEAKED N=219 v98%=1.7 -->
-            <!-- measured 98%:316-738 med:331/331 FLAKY(166 - 738 < mx=738.6) -->
-            <Limit name="measured-frame-rate-640x360" range="331-369" /> <!-- N=242 v98%=1.5 -->
-            <Limit name="measured-frame-rate-1280x720" range="286-286" /> <!-- N=236 v98%=1.1 -->
-            <Limit name="measured-frame-rate-1920x1080" range="143-143" /> <!-- N=192 v98%=1.0 (PPR1.180405.002-) -->
+            <!-- measured 93%:323-604 med:326 SLOW -->
+            <Limit name="measured-frame-rate-320x180" range="325-442" /> <!-- N=32 v93%=1.4 -->
+            <!-- measured 93%:328-602 med:334 SLOW -->
+            <Limit name="measured-frame-rate-640x360" range="333-444" /> <!-- N=32 v93%=1.4 -->
+            <Limit name="measured-frame-rate-1280x720" range="289-301" /> <!-- N=32 v93%=1.0 -->
+            <Limit name="measured-frame-rate-1920x1080" range="143-143" /> <!-- N=32 v93%=1.0 -->
+        </MediaCodec>
+        <MediaCodec name="c2.android.vp8.decoder" type="video/x-vnd.on2.vp8" update="true">
+            <Limit name="measured-frame-rate-320x180" range="459-459" /> <!-- N=32 v93%=1.0 -->
+            <Limit name="measured-frame-rate-640x360" range="173-173" /> <!-- N=32 v93%=1.0 -->
+            <Limit name="measured-frame-rate-1920x1080" range="22-23" /> <!-- N=32 v93%=1.1 -->
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.decoder.vp9" type="video/x-vnd.on2.vp9" update="true">
-            <Limit name="measured-frame-rate-320x180" range="249-446" /> <!-- N=236 v98%=1.7 -->
-            <Limit name="measured-frame-rate-640x360" range="248-390" /> <!-- N=236 v98%=1.6 -->
-            <Limit name="measured-frame-rate-1280x720" range="256-256" /> <!-- N=242 v98%=1.1 -->
-            <Limit name="measured-frame-rate-1920x1080" range="151-151" /> <!-- N=164 v98%=1.0 (PPR1.180405.002-) -->
-            <Limit name="measured-frame-rate-3840x2160" range="36-36" /> <!-- N=236 v98%=1.0 -->
+            <Limit name="measured-frame-rate-320x180" range="250-251" /> <!-- N=32 v93%=1.0 -->
+            <Limit name="measured-frame-rate-640x360" range="247-251" /> <!-- N=32 v93%=1.0 -->
+            <Limit name="measured-frame-rate-1280x720" range="252-255" /> <!-- N=32 v93%=1.0 -->
+            <Limit name="measured-frame-rate-1920x1080" range="151-151" /> <!-- N=32 v93%=1.0 -->
+            <Limit name="measured-frame-rate-3840x2160" range="36-36" /> <!-- N=32 v93%=1.0 -->
         </MediaCodec>
-        <!-- Measurements between PPR1.180405.002 and PPR1.180514.002 -->
-        <MediaCodec name="OMX.google.h263.decoder" type="video/3gpp" update="true">
-            <!-- measured 98%:141-1306 med:155/156 FLAKY(78 - 682 < mx=1328.0) RG.VARIANCE:2.1 -->
-            <Limit name="measured-frame-rate-176x144" range="155-341" /> <!-- N=192 v98%=3.0 -->
-        </MediaCodec>
-        <MediaCodec name="OMX.google.h264.decoder" type="video/avc" update="true">
-            <!-- measured 98%:92-723 med:353/336 FLAKY(77 - 672 < mx=744.6) variance:2.8 -->
-            <Limit name="measured-frame-rate-320x240" range="170-373" /> <!-- TWEAKED N=218 -->
-            <!-- measured 98%:38-153 med:51/50 FLAKY(25 - 154 < mx=167.4) -->
-            <Limit name="measured-frame-rate-720x480" range="50-77" /> <!-- N=168 v98%=2.0 (PPR1.180405.002-) -->
-            <Limit name="measured-frame-rate-1280x720" range="28-38" /> <!-- N=242 v98%=1.7 -->
-            <Limit name="measured-frame-rate-1920x1080" range="15-15" /> <!-- N=164 v98%=1.4 (PPR1.180405.002-) -->
-        </MediaCodec>
-        <MediaCodec name="OMX.google.hevc.decoder" type="video/hevc" update="true">
-            <Limit name="measured-frame-rate-352x288" range="625-626" /> <!-- N=177 v98%=1.1 (PPR1.180405.002-) -->
-            <Limit name="measured-frame-rate-640x360" range="289-289" /> <!-- N=188 v98%=1.3 (PPR1.180405.002-) -->
-            <Limit name="measured-frame-rate-720x480" range="227-227" /> <!-- N=221 v98%=1.3 -->
-            <Limit name="measured-frame-rate-1280x720" range="84-84" /> <!-- N=188 v98%=1.3 (PPR1.180405.002-) -->
-            <!-- measured 98%:40-59 med:46/46 FLAKY(mn=0.0 < 23 - 92) -->
-            <Limit name="measured-frame-rate-1920x1080" range="46-46" /> <!-- N=230 v98%=1.2 -->
-        </MediaCodec>
-        <!-- Measurements between PPR1.180405.002 and PPR1.180514.002 -->
-        <MediaCodec name="OMX.google.mpeg4.decoder" type="video/mp4v-es" update="true">
-            <!-- measured 98%:172-1548 med:187/187 FLAKY(94 - 822 < mx=1579.8) RG.VARIANCE:2.1 -->
-            <Limit name="measured-frame-rate-176x144" range="187-411" /> <!-- N=192 v98%=3.0 -->
-        </MediaCodec>
-        <MediaCodec name="OMX.google.vp8.decoder" type="video/x-vnd.on2.vp8" update="true">
-            <Limit name="measured-frame-rate-320x180" range="579-754" /> <!-- N=164 v98%=1.8 (PPR1.180405.002-) -->
-            <Limit name="measured-frame-rate-640x360" range="402-402" /> <!-- N=236 v98%=1.0 -->
-            <Limit name="measured-frame-rate-1920x1080" range="36-36" /> <!-- N=220 v98%=1.0 -->
-        </MediaCodec>
-        <MediaCodec name="OMX.google.vp9.decoder" type="video/x-vnd.on2.vp9" update="true">
-            <Limit name="measured-frame-rate-320x180" range="855-855" /> <!-- N=236 v98%=1.3 -->
-            <!-- measured 98%:219-421 med:334/333 FLAKY(mn=160.7 < 167 - 666) -->
-            <Limit name="measured-frame-rate-640x360" range="321-333" /> <!-- TWEAKED N=164 v98%=1.4 (PPR1.180405.002-) -->
-            <Limit name="measured-frame-rate-1280x720" range="121-121" /> <!-- N=219 v98%=1.1 -->
-            <Limit name="measured-frame-rate-1920x1080" range="67-67" /> <!-- N=236 v98%=1.1 -->
+        <MediaCodec name="c2.android.vp9.decoder" type="video/x-vnd.on2.vp9" update="true">
+            <Limit name="measured-frame-rate-320x180" range="445-445" /> <!-- N=32 v93%=1.0 -->
+            <Limit name="measured-frame-rate-640x360" range="120-120" /> <!-- N=32 v93%=1.2 -->
+            <Limit name="measured-frame-rate-1280x720" range="84-86" /> <!-- N=32 v93%=1.1 -->
+            <Limit name="measured-frame-rate-1920x1080" range="54-55" /> <!-- N=32 v93%=1.0 -->
         </MediaCodec>
     </Decoders>
 </MediaCodecs>
diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml
index fdc746c..b894b3b 100755
--- a/overlay/frameworks/base/core/res/res/values/config.xml
+++ b/overlay/frameworks/base/core/res/res/values/config.xml
@@ -73,6 +73,11 @@
         <item>2</item> <!-- COLOR_MODE_SATURATED -->
     </integer-array>
 
+    <!-- Color mode to use when accessibility transforms are enabled. This color mode must be
+     supported by the device, but not necessarily appear in config_availableColorModes. The
+     regularly selected color mode will be used if this value is negative. -->
+    <integer name="config_accessibilityColorMode">2</integer>
+
     <!-- Boolean indicating whether the HWC setColorTransform function can be performed efficiently
          in hardware. -->
     <bool name="config_setColorTransformAccelerated">true</bool>
@@ -217,6 +222,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 +242,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 +265,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 +360,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/InteractionHandler.cpp b/power-libperfmgr/InteractionHandler.cpp
deleted file mode 100644
index b8ce3ef..0000000
--- a/power-libperfmgr/InteractionHandler.cpp
+++ /dev/null
@@ -1,244 +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.
- */
-
-//#define LOG_NDEBUG 0
-
-#define LOG_TAG "android.hardware.power@1.2-service.wahoo-libperfmgr"
-#define ATRACE_TAG (ATRACE_TAG_POWER | ATRACE_TAG_HAL)
-
-#include <fcntl.h>
-#include <poll.h>
-#include <sys/eventfd.h>
-#include <time.h>
-#include <unistd.h>
-#include <utils/Log.h>
-#include <utils/Trace.h>
-
-#include "InteractionHandler.h"
-
-#define FB_IDLE_PATH "/sys/class/graphics/fb0/idle_state"
-#define MAX_LENGTH 64
-
-#define MSINSEC 1000L
-#define USINMS 1000000L
-
-InteractionHandler::InteractionHandler(std::shared_ptr<HintManager> const & hint_manager)
-    : mState(INTERACTION_STATE_UNINITIALIZED),
-      mWaitMs(100),
-      mMinDurationMs(1400),
-      mMaxDurationMs(5650),
-      mDurationMs(0),
-      mHintManager(hint_manager) {
-}
-
-InteractionHandler::~InteractionHandler() {
-    Exit();
-}
-
-bool InteractionHandler::Init() {
-    std::lock_guard<std::mutex> lk(mLock);
-
-    if (mState != INTERACTION_STATE_UNINITIALIZED)
-        return true;
-
-    mIdleFd = open(FB_IDLE_PATH, O_RDONLY);
-    if (mIdleFd < 0) {
-        ALOGE("Unable to open idle state path (%d)", errno);
-        return false;
-    }
-
-    mEventFd = eventfd(0, EFD_NONBLOCK);
-    if (mEventFd < 0) {
-        ALOGE("Unable to create event fd (%d)", errno);
-        close(mIdleFd);
-        return false;
-    }
-
-    mState = INTERACTION_STATE_IDLE;
-    mThread = std::unique_ptr<std::thread>(
-        new std::thread(&InteractionHandler::Routine, this));
-
-    return true;
-}
-
-void InteractionHandler::Exit() {
-    std::unique_lock<std::mutex> lk(mLock);
-    if (mState == INTERACTION_STATE_UNINITIALIZED)
-        return;
-
-    AbortWaitLocked();
-    mState = INTERACTION_STATE_UNINITIALIZED;
-    lk.unlock();
-
-    mCond.notify_all();
-    mThread->join();
-
-    close(mEventFd);
-    close(mIdleFd);
-}
-
-void InteractionHandler::PerfLock() {
-    ALOGV("%s: acquiring perf lock", __func__);
-    if (!mHintManager->DoHint("INTERACTION")) {
-        ALOGE("%s: do hint INTERACTION failed", __func__);
-    }
-    ATRACE_INT("interaction_lock", 1);
-}
-
-void InteractionHandler::PerfRel() {
-    ALOGV("%s: releasing perf lock", __func__);
-    if (!mHintManager->EndHint("INTERACTION")) {
-        ALOGE("%s: end hint INTERACTION failed", __func__);
-    }
-    ATRACE_INT("interaction_lock", 0);
-}
-
-long long InteractionHandler::CalcTimespecDiffMs(struct timespec start,
-                                               struct timespec end) {
-    long long diff_in_us = 0;
-    diff_in_us += (end.tv_sec - start.tv_sec) * MSINSEC;
-    diff_in_us += (end.tv_nsec - start.tv_nsec) / USINMS;
-    return diff_in_us;
-}
-
-void InteractionHandler::Acquire(int32_t duration) {
-    ATRACE_CALL();
-
-    std::lock_guard<std::mutex> lk(mLock);
-    if (mState == INTERACTION_STATE_UNINITIALIZED) {
-        ALOGW("%s: called while uninitialized", __func__);
-        return;
-    }
-
-    int inputDuration = duration + 650;
-    int finalDuration;
-    if (inputDuration > mMaxDurationMs)
-        finalDuration = mMaxDurationMs;
-    else if (inputDuration > mMinDurationMs)
-        finalDuration = inputDuration;
-    else
-        finalDuration = mMinDurationMs;
-
-    struct timespec cur_timespec;
-    clock_gettime(CLOCK_MONOTONIC, &cur_timespec);
-    if (mState != INTERACTION_STATE_IDLE && finalDuration <= mDurationMs) {
-        long long elapsed_time = CalcTimespecDiffMs(mLastTimespec, cur_timespec);
-        // don't hint if previous hint's duration covers this hint's duration
-        if (elapsed_time <= (mDurationMs - finalDuration)) {
-            ALOGV("%s: Previous duration (%d) cover this (%d) elapsed: %lld",
-                  __func__, mDurationMs, finalDuration, elapsed_time);
-            return;
-        }
-    }
-    mLastTimespec = cur_timespec;
-    mDurationMs = finalDuration;
-
-    ALOGV("%s: input: %d final duration: %d", __func__,
-          duration, finalDuration);
-
-    if (mState == INTERACTION_STATE_WAITING)
-        AbortWaitLocked();
-    else if (mState == INTERACTION_STATE_IDLE)
-        PerfLock();
-
-    mState = INTERACTION_STATE_INTERACTION;
-    mCond.notify_one();
-}
-
-void InteractionHandler::Release() {
-    std::lock_guard<std::mutex> lk(mLock);
-    if (mState == INTERACTION_STATE_WAITING) {
-        ATRACE_CALL();
-        PerfRel();
-        mState = INTERACTION_STATE_IDLE;
-    } else {
-        // clear any wait aborts pending in event fd
-        uint64_t val;
-        ssize_t ret = read(mEventFd, &val, sizeof(val));
-
-        ALOGW_IF(ret < 0, "%s: failed to clear eventfd (%zd, %d)",
-                 __func__, ret, errno);
-    }
-}
-
-// should be called while locked
-void InteractionHandler::AbortWaitLocked() {
-    uint64_t val = 1;
-    ssize_t ret = write(mEventFd, &val, sizeof(val));
-    if (ret != sizeof(val))
-        ALOGW("Unable to write to event fd (%zd)", ret);
-}
-
-void InteractionHandler::WaitForIdle(int32_t wait_ms, int32_t timeout_ms) {
-    char data[MAX_LENGTH];
-    ssize_t ret;
-    struct pollfd pfd[2];
-
-    ATRACE_CALL();
-
-    ALOGV("%s: wait:%d timeout:%d", __func__, wait_ms, timeout_ms);
-
-    pfd[0].fd = mEventFd;
-    pfd[0].events = POLLIN;
-    pfd[1].fd = mIdleFd;
-    pfd[1].events = POLLPRI | POLLERR;
-
-    ret = poll(pfd, 1, wait_ms);
-    if (ret > 0) {
-        ALOGV("%s: wait aborted", __func__);
-        return;
-    } else if (ret < 0) {
-        ALOGE("%s: error in poll while waiting", __func__);
-        return;
-    }
-
-    ret = pread(mIdleFd, data, sizeof(data), 0);
-    if (!ret) {
-        ALOGE("%s: Unexpected EOF!", __func__);
-        return;
-    }
-
-    if (!strncmp(data, "idle", 4)) {
-        ALOGV("%s: already idle", __func__);
-        return;
-    }
-
-    ret = poll(pfd, 2, timeout_ms);
-    if (ret < 0)
-        ALOGE("%s: Error on waiting for idle (%zd)", __func__, ret);
-    else if (ret == 0)
-        ALOGV("%s: timed out waiting for idle", __func__);
-    else if (pfd[0].revents)
-        ALOGV("%s: wait for idle aborted", __func__);
-    else if (pfd[1].revents)
-        ALOGV("%s: idle detected", __func__);
-}
-
-void InteractionHandler::Routine() {
-    std::unique_lock<std::mutex> lk(mLock, std::defer_lock);
-
-    while (true) {
-        lk.lock();
-        mCond.wait(lk, [&] { return mState != INTERACTION_STATE_IDLE; });
-        if (mState == INTERACTION_STATE_UNINITIALIZED)
-            return;
-        mState = INTERACTION_STATE_WAITING;
-        lk.unlock();
-
-        WaitForIdle(mWaitMs, mDurationMs);
-        Release();
-    }
-}
diff --git a/power-libperfmgr/InteractionHandler.h b/power-libperfmgr/InteractionHandler.h
deleted file mode 100644
index 893c72f..0000000
--- a/power-libperfmgr/InteractionHandler.h
+++ /dev/null
@@ -1,71 +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 INTERACTIONHANDLER_H
-#define INTERACTIONHANDLER_H
-
-#include <condition_variable>
-#include <mutex>
-#include <thread>
-
-#include <perfmgr/HintManager.h>
-
-using ::android::perfmgr::HintManager;
-
-enum interaction_state {
-    INTERACTION_STATE_UNINITIALIZED,
-    INTERACTION_STATE_IDLE,
-    INTERACTION_STATE_INTERACTION,
-    INTERACTION_STATE_WAITING,
-};
-
-struct InteractionHandler {
-    InteractionHandler(std::shared_ptr<HintManager> const & hint_manager);
-    ~InteractionHandler();
-    bool Init();
-    void Exit();
-    void Acquire(int32_t duration);
-
- private:
-    void Release();
-    void WaitForIdle(int32_t wait_ms, int32_t timeout_ms);
-    void AbortWaitLocked();
-    void Routine();
-
-    void PerfLock();
-    void PerfRel();
-
-    long long CalcTimespecDiffMs(struct timespec start, struct timespec end);
-
-    enum interaction_state mState;
-
-    int mIdleFd;
-    int mEventFd;
-
-    int32_t mWaitMs;
-    int32_t mMinDurationMs;
-    int32_t mMaxDurationMs;
-    int32_t mDurationMs;
-
-    struct timespec mLastTimespec;
-
-    std::unique_ptr<std::thread> mThread;
-    std::mutex mLock;
-    std::condition_variable mCond;
-    std::shared_ptr<HintManager> mHintManager;
-};
-
-#endif //INTERACTIONHANDLER_H
diff --git a/power-libperfmgr/Power.cpp b/power-libperfmgr/Power.cpp
deleted file mode 100644
index 8a009c3..0000000
--- a/power-libperfmgr/Power.cpp
+++ /dev/null
@@ -1,546 +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.
- */
-
-#define ATRACE_TAG (ATRACE_TAG_POWER | ATRACE_TAG_HAL)
-#define LOG_TAG "android.hardware.power@1.2-service.wahoo-libperfmgr"
-
-#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 <mutex>
-
-#include <utils/Log.h>
-#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[];
-
-namespace android {
-namespace hardware {
-namespace power {
-namespace V1_2 {
-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),
-        mVRModeOn(false),
-        mSustainedPerfModeOn(false),
-        mEncoderModeOn(false) {
-    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");
-    }
-
-    state = android::base::GetProperty(kPowerHalAudioProp, "");
-    if (state == "LOW_LATENCY") {
-        ALOGI("Initialize with AUDIO_LOW_LATENCY on");
-        mHintManager->DoHint("AUDIO_LOW_LATENCY");
-    }
-}
-
-// Methods from ::android::hardware::power::V1_0::IPower follow.
-Return<void> Power::setInteractive(bool /* interactive */)  {
-    return Void();
-}
-
-Return<void> Power::powerHint(PowerHint_1_0 hint, int32_t data) {
-    if (!isSupportedGovernor()) {
-        return Void();
-    }
-
-    switch(hint) {
-        case PowerHint_1_0::INTERACTION:
-            if (mVRModeOn || mSustainedPerfModeOn) {
-                ALOGV("%s: ignoring due to other active perf hints", __func__);
-            } else {
-                mInteractionHandler.Acquire(data);
-            }
-            break;
-        case PowerHint_1_0::VIDEO_ENCODE:
-            if (mVRModeOn || mSustainedPerfModeOn) {
-                ALOGV("%s: ignoring due to other active perf hints", __func__);
-                break;
-            }
-            ATRACE_BEGIN("video_encode");
-            if (mVRModeOn || mSustainedPerfModeOn) {
-                ALOGV("%s: ignoring due to other active perf hints", __func__);
-            } else {
-                if (data) {
-                    // Hint until canceled
-                    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;
-                }
-            }
-            ATRACE_END();
-            break;
-        case PowerHint_1_0::SUSTAINED_PERFORMANCE:
-            if (data && !mSustainedPerfModeOn) {
-                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) {
-                ALOGD("SUSTAINED_PERFORMANCE OFF");
-                mHintManager->EndHint("VR_SUSTAINED_PERFORMANCE");
-                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;
-            }
-            break;
-        case PowerHint_1_0::VR_MODE:
-            if (data && !mVRModeOn) {
-                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) {
-                ALOGD("VR_MODE OFF");
-                mHintManager->EndHint("VR_SUSTAINED_PERFORMANCE");
-                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;
-            }
-            break;
-        case PowerHint_1_0::LAUNCH:
-            ATRACE_BEGIN("launch");
-            if (mVRModeOn || mSustainedPerfModeOn) {
-                ALOGV("%s: ignoring due to other active perf hints", __func__);
-            } else {
-                if (data) {
-                    // Hint until canceled
-                    ATRACE_INT("launch_lock", 1);
-                    mHintManager->DoHint("LAUNCH");
-                    ALOGD("LAUNCH ON");
-                } else {
-                    ATRACE_INT("launch_lock", 0);
-                    mHintManager->EndHint("LAUNCH");
-                    ALOGD("LAUNCH OFF");
-                }
-            }
-            ATRACE_END();
-            break;
-        default:
-            break;
-
-    }
-    return Void();
-}
-
-Return<void> Power::setFeature(Feature /*feature*/, bool /*activate*/)  {
-    //Nothing to do
-    return Void();
-}
-
-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);
-    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);
-    return Void();
-}
-
-bool Power::isSupportedGovernor() {
-    std::string buf;
-    if (android::base::ReadFileToString("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor", &buf)) {
-        buf = android::base::Trim(buf);
-    }
-    // Only support EAS 1.2, legacy EAS
-    if (buf == "schedutil" || buf == "sched") {
-        return true;
-    } else {
-        LOG(ERROR) << "Governor not supported by powerHAL, skipping";
-        return false;
-    }
-}
-
-Return<void> Power::powerHintAsync(PowerHint_1_0 hint, int32_t data) {
-    // just call the normal power hint in this oneway function
-    return powerHint(hint, data);
-}
-
-// Methods from ::android::hardware::power::V1_2::IPower follow.
-Return<void> Power::powerHintAsync_1_2(PowerHint_1_2 hint, int32_t data) {
-    if (!isSupportedGovernor()) {
-        return Void();
-    }
-
-    switch(hint) {
-        case PowerHint_1_2::AUDIO_LOW_LATENCY:
-            ATRACE_BEGIN("audio_low_latency");
-            if (data) {
-                // Hint until canceled
-                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;
-        case PowerHint_1_2::AUDIO_STREAMING:
-            ATRACE_BEGIN("audio_streaming");
-            if (mVRModeOn || mSustainedPerfModeOn) {
-                ALOGV("%s: ignoring due to other active perf hints", __func__);
-            } else {
-                if (data) {
-                    // Hint until canceled
-                    ATRACE_INT("audio_streaming_lock", 1);
-                    mHintManager->DoHint("AUDIO_STREAMING");
-                    ALOGD("AUDIO STREAMING ON");
-                } else {
-                    ATRACE_INT("audio_streaming_lock", 0);
-                    mHintManager->EndHint("AUDIO_STREAMING");
-                    ALOGD("AUDIO STREAMING OFF");
-                }
-            }
-            ATRACE_END();
-            break;
-        case PowerHint_1_2::CAMERA_LAUNCH:
-            ATRACE_BEGIN("camera_launch");
-            if (data > 0) {
-                ATRACE_INT("camera_launch_lock", 1);
-                mHintManager->DoHint("CAMERA_LAUNCH", std::chrono::milliseconds(data));
-                ALOGD("CAMERA LAUNCH ON: %d MS, LAUNCH ON: 2500 MS", data);
-                // boosts 2.5s for launching
-                mHintManager->DoHint("LAUNCH", std::chrono::milliseconds(2500));
-            } else if (data == 0) {
-                ATRACE_INT("camera_launch_lock", 0);
-                mHintManager->EndHint("CAMERA_LAUNCH");
-                ALOGD("CAMERA LAUNCH OFF");
-            } else {
-                ALOGE("CAMERA LAUNCH INVALID DATA: %d", data);
-            }
-            ATRACE_END();
-            break;
-        case PowerHint_1_2::CAMERA_STREAMING:
-            ATRACE_BEGIN("camera_streaming");
-            if (data > 0) {
-                ATRACE_INT("camera_streaming_lock", 1);
-                mHintManager->DoHint("CAMERA_STREAMING", std::chrono::milliseconds(data));
-                ALOGD("CAMERA STREAMING ON: %d MS", data);
-            } else if (data == 0) {
-                ATRACE_INT("camera_streaming_lock", 0);
-                mHintManager->EndHint("CAMERA_STREAMING");
-                ALOGD("CAMERA STREAMING OFF");
-            } else {
-                ALOGE("CAMERA STREAMING INVALID DATA: %d", data);
-            }
-            ATRACE_END();
-            break;
-        case PowerHint_1_2::CAMERA_SHOT:
-            ATRACE_BEGIN("camera_shot");
-            if (data > 0) {
-                ATRACE_INT("camera_shot_lock", 1);
-                mHintManager->DoHint("CAMERA_SHOT", std::chrono::milliseconds(data));
-                ALOGD("CAMERA SHOT ON: %d MS", data);
-            } else if (data == 0) {
-                ATRACE_INT("camera_shot_lock", 0);
-                mHintManager->EndHint("CAMERA_SHOT");
-                ALOGD("CAMERA SHOT OFF");
-            } else {
-                ALOGE("CAMERA SHOT INVALID DATA: %d", data);
-            }
-            ATRACE_END();
-            break;
-        default:
-            return powerHint(static_cast<PowerHint_1_0>(hint), data);
-    }
-    return Void();
-}
-
-constexpr const char* boolToString(bool b) {
-    return b ? "true" : "false";
-}
-
-Return<void> Power::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("HintManager Running: %s\n"
-                                                    "VRMode: %s\n"
-                                                    "SustainedPerformanceMode: %s\n"
-                                                    "VideoEncodeMode: %s\n",
-                                                    boolToString(mHintManager->IsRunning()),
-                                                    boolToString(mVRModeOn),
-                                                    boolToString(mSustainedPerfModeOn),
-                                                    boolToString(mEncoderModeOn)));
-        // Dump nodes through libperfmgr
-        mHintManager->DumpToFd(fd);
-        if (!android::base::WriteStringToFd(buf, fd)) {
-            PLOG(ERROR) << "Failed to dump state to fd";
-        }
-        fsync(fd);
-    }
-    return Void();
-}
-
-}  // namespace implementation
-}  // namespace V1_2
-}  // namespace power
-}  // namespace hardware
-}  // namespace android
diff --git a/power-libperfmgr/Power.h b/power-libperfmgr/Power.h
deleted file mode 100644
index a39323f..0000000
--- a/power-libperfmgr/Power.h
+++ /dev/null
@@ -1,83 +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 ANDROID_HARDWARE_POWER_V1_2_POWER_H
-#define ANDROID_HARDWARE_POWER_V1_2_POWER_H
-
-#include <atomic>
-
-#include <android/hardware/power/1.2/IPower.h>
-#include <hidl/MQDescriptor.h>
-#include <hidl/Status.h>
-#include <perfmgr/HintManager.h>
-
-#include "InteractionHandler.h"
-
-namespace android {
-namespace hardware {
-namespace power {
-namespace V1_2 {
-namespace implementation {
-
-using ::android::hardware::power::V1_0::Feature;
-using ::android::hardware::power::V1_2::IPower;
-using ::android::hardware::Return;
-using ::android::hardware::Void;
-using ::InteractionHandler;
-using PowerHint_1_0 = ::android::hardware::power::V1_0::PowerHint;
-using PowerHint_1_2 = ::android::hardware::power::V1_2::PowerHint;
-using ::android::perfmgr::HintManager;
-
-constexpr char kPowerHalStateProp[] = "vendor.powerhal.state";
-constexpr char kPowerHalAudioProp[] = "vendor.powerhal.audio";
-
-struct Power : public IPower {
-    // Methods from ::android::hardware::power::V1_0::IPower follow.
-
-    Power();
-
-    Return<void> setInteractive(bool /* interactive */) override;
-    Return<void> powerHint(PowerHint_1_0 hint, int32_t data) override;
-    Return<void> setFeature(Feature feature, bool activate) override;
-    Return<void> getPlatformLowPowerStats(getPlatformLowPowerStats_cb _hidl_cb) override;
-
-    // Methods from ::android::hardware::power::V1_1::IPower follow.
-    Return<void> getSubsystemLowPowerStats(getSubsystemLowPowerStats_cb _hidl_cb) override;
-    Return<void> powerHintAsync(PowerHint_1_0 hint, int32_t data) override;
-
-    // Methods from ::android::hardware::power::V1_2::IPower follow.
-    Return<void> powerHintAsync_1_2(PowerHint_1_2 hint, int32_t data) 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:
-    static bool isSupportedGovernor();
-
-    std::shared_ptr<HintManager> mHintManager;
-    InteractionHandler mInteractionHandler;
-    std::atomic<bool> mVRModeOn;
-    std::atomic<bool> mSustainedPerfModeOn;
-    std::atomic<bool> mEncoderModeOn;
-};
-
-}  // namespace implementation
-}  // namespace V1_2
-}  // namespace power
-}  // namespace hardware
-}  // namespace android
-
-#endif  // ANDROID_HARDWARE_POWER_V1_2_POWER_H
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
deleted file mode 100644
index d77b8f0..0000000
--- a/power-libperfmgr/android.hardware.power@1.2-service.wahoo-libperfmgr.rc
+++ /dev/null
@@ -1,21 +0,0 @@
-service vendor.power-hal-1-2 /vendor/bin/hw/android.hardware.power@1.2-service.wahoo-libperfmgr
-    class hal
-    user system
-    group system
-
-# restart powerHAL when framework died
-on property:init.svc.zygote=restarting && property:vendor.powerhal.state=*
-   setprop vendor.powerhal.state ""
-   setprop vendor.powerhal.audio ""
-   restart vendor.power-hal-1-2
-
-# 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
-   setprop vendor.powerhal.audio ""
-   restart vendor.power-hal-1-2
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/power-libperfmgr/service.cpp b/power-libperfmgr/service.cpp
deleted file mode 100644
index c128f95..0000000
--- a/power-libperfmgr/service.cpp
+++ /dev/null
@@ -1,59 +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.
- */
-
-#define LOG_TAG "android.hardware.power@1.2-service.wahoo-libperfmgr"
-
-#include <android/log.h>
-#include <hidl/HidlTransportSupport.h>
-
-#include "Power.h"
-
-using android::sp;
-using android::status_t;
-using android::OK;
-
-// libhwbinder:
-using android::hardware::configureRpcThreadpool;
-using android::hardware::joinRpcThreadpool;
-
-// Generated HIDL files
-using android::hardware::power::V1_2::IPower;
-using android::hardware::power::V1_2::implementation::Power;
-
-int main(int /* argc */, char** /* argv */) {
-    ALOGI("Power HAL Service 1.2 for Wahoo is starting");
-
-    android::sp<IPower> service = new Power();
-    if (service == nullptr) {
-        ALOGE("Can not create an instance of Power HAL Iface, exiting.");
-        return 1;
-    }
-
-    configureRpcThreadpool(1, true /*callerWillJoin*/);
-
-    status_t status = service->registerAsService();
-    if (status != OK) {
-        ALOGE("Could not register service for Power HAL Iface (%d), exiting.", status);
-        return 1;
-    }
-
-    ALOGI("Power Service is ready");
-    joinRpcThreadpool();
-
-    // In normal operation, we don't expect the thread pool to exit
-    ALOGE("Power Service is shutting down");
-    return 1;
-}
diff --git a/powerhint.json b/powerhint.json
deleted file mode 100644
index f078974..0000000
--- a/powerhint.json
+++ /dev/null
@@ -1,453 +0,0 @@
-{
-  "Nodes": [
-    {
-      "Name": "CPULittleClusterMaxFreq",
-      "Path": "/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq",
-      "Values": [
-        "1900800",
-        "1555200",
-        "1478400",
-        "1248000"
-      ],
-      "DefaultIndex": 0,
-      "ResetOnInit": true
-    },
-    {
-      "Name": "CPULittleClusterMinFreq",
-      "Path": "/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq",
-      "Values": [
-        "1900800",
-        "1555200",
-        "1512000",
-        "1478400",
-        "1134000",
-        "0"
-      ],
-      "ResetOnInit": true
-    },
-    {
-      "Name": "CPUBigClusterMaxFreq",
-      "Path": "/sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq",
-      "Values": [
-        "2457600",
-        "1958400",
-        "1574400",
-        "1344000",
-        "1267200"
-      ],
-      "DefaultIndex": 0,
-      "ResetOnInit": true
-    },
-    {
-      "Name": "CPUBigClusterMinFreq",
-      "Path": "/sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq",
-      "Values": [
-        "2457600",
-        "1574400",
-        "1420800",
-        "1344000",
-        "1132800",
-        "0"
-      ],
-      "ResetOnInit": true
-    },
-    {
-      "Name": "GPUMaxFreq",
-      "Path": "/sys/class/kgsl/kgsl-3d0/devfreq/max_freq",
-      "Values": [
-        "342000000",
-        "414000000",
-        "515000000",
-        "710000000"
-      ],
-      "ResetOnInit": true
-    },
-    {
-      "Name": "GPUMinFreq",
-      "Path": "/sys/class/kgsl/kgsl-3d0/devfreq/min_freq",
-      "Values": [
-        "515000000",
-        "414000000",
-        "257000000"
-      ],
-      "ResetOnInit": true
-    },
-    {
-      "Name": "GPUBusMinFreq",
-      "Path": "/sys/class/devfreq/soc:qcom,gpubw/min_freq",
-      "Values": [
-        "11863",
-        "7759",
-        "0"
-      ],
-      "ResetOnInit": true
-    },
-    {
-      "Name": "TASchedtuneBoost",
-      "Path": "/dev/stune/top-app/schedtune.boost",
-      "Values": [
-        "50",
-        "10"
-      ],
-      "ResetOnInit": true
-    },
-    {
-      "Name": "CPUBWHystTriggerCount",
-      "Path": "/sys/devices/soc/soc:qcom,cpubw/devfreq/soc:qcom,cpubw/bw_hwmon/hyst_trigger_count",
-      "Values": [
-        "0",
-        "3"
-      ]
-    },
-    {
-      "Name": "CPUBWHistMemory",
-      "Path": "/sys/devices/soc/soc:qcom,cpubw/devfreq/soc:qcom,cpubw/bw_hwmon/hist_memory",
-      "Values": [
-        "0",
-        "20"
-      ]
-    },
-    {
-      "Name": "CPUBWHystLength",
-      "Path": "/sys/devices/soc/soc:qcom,cpubw/devfreq/soc:qcom,cpubw/bw_hwmon/hyst_length",
-      "Values": [
-        "0",
-        "10"
-      ]
-    },
-    {
-      "Name": "CPUBWMinFreq",
-      "Path": "/sys/devices/soc/soc:qcom,cpubw/devfreq/soc:qcom,cpubw/min_freq",
-      "Values": [
-        "13763",
-        "5195",
-        "1525",
-        "762"
-      ],
-      "ResetOnInit": true
-    },
-    {
-      "Name": "PMQoSCpuDmaLatency",
-      "Path": "/dev/cpu_dma_latency",
-      "Values": [
-        "44",
-        "100"
-      ],
-      "HoldFd": true
-    }
-  ],
-  "Actions": [
-    {
-      "PowerHint": "VIDEO_ENCODE",
-      "Node": "CPUBigClusterMaxFreq",
-      "Duration": 0,
-      "Value": "1958400"
-    },
-    {
-      "PowerHint": "SUSTAINED_PERFORMANCE",
-      "Node": "CPUBigClusterMaxFreq",
-      "Duration": 0,
-      "Value": "1267200"
-    },
-    {
-      "PowerHint": "SUSTAINED_PERFORMANCE",
-      "Node": "CPULittleClusterMaxFreq",
-      "Duration": 0,
-      "Value": "1248000"
-    },
-    {
-      "PowerHint": "SUSTAINED_PERFORMANCE",
-      "Node": "GPUMaxFreq",
-      "Duration": 0,
-      "Value": "342000000"
-    },
-    {
-      "PowerHint": "VR_MODE",
-      "Node": "CPUBigClusterMaxFreq",
-      "Duration": 0,
-      "Value": "1574400"
-    },
-    {
-      "PowerHint": "VR_MODE",
-      "Node": "CPUBigClusterMinFreq",
-      "Duration": 0,
-      "Value": "1574400"
-    },
-    {
-      "PowerHint": "VR_MODE",
-      "Node": "CPULittleClusterMaxFreq",
-      "Duration": 0,
-      "Value": "1555200"
-    },
-    {
-      "PowerHint": "VR_MODE",
-      "Node": "CPULittleClusterMinFreq",
-      "Duration": 0,
-      "Value": "1555200"
-    },
-    {
-      "PowerHint": "VR_MODE",
-      "Node": "GPUMaxFreq",
-      "Duration": 0,
-      "Value": "515000000"
-    },
-    {
-      "PowerHint": "VR_MODE",
-      "Node": "GPUMinFreq",
-      "Duration": 0,
-      "Value": "515000000"
-    },
-    {
-      "PowerHint": "VR_MODE",
-      "Node": "GPUBusMinFreq",
-      "Duration": 0,
-      "Value": "11863"
-    },
-    {
-      "PowerHint": "VR_SUSTAINED_PERFORMANCE",
-      "Node": "CPUBigClusterMaxFreq",
-      "Duration": 0,
-      "Value": "1344000"
-    },
-    {
-      "PowerHint": "VR_SUSTAINED_PERFORMANCE",
-      "Node": "CPUBigClusterMinFreq",
-      "Duration": 0,
-      "Value": "1344000"
-    },
-    {
-      "PowerHint": "VR_SUSTAINED_PERFORMANCE",
-      "Node": "CPULittleClusterMaxFreq",
-      "Duration": 0,
-      "Value": "1478400"
-    },
-    {
-      "PowerHint": "VR_SUSTAINED_PERFORMANCE",
-      "Node": "CPULittleClusterMinFreq",
-      "Duration": 0,
-      "Value": "1478400"
-    },
-    {
-      "PowerHint": "VR_SUSTAINED_PERFORMANCE",
-      "Node": "GPUMaxFreq",
-      "Duration": 0,
-      "Value": "414000000"
-    },
-    {
-      "PowerHint": "VR_SUSTAINED_PERFORMANCE",
-      "Node": "GPUMinFreq",
-      "Duration": 0,
-      "Value": "414000000"
-    },
-    {
-      "PowerHint": "VR_SUSTAINED_PERFORMANCE",
-      "Node": "GPUBusMinFreq",
-      "Duration": 0,
-      "Value": "7759"
-    },
-    {
-      "PowerHint": "INTERACTION",
-      "Node": "CPUBigClusterMinFreq",
-      "Duration": 0,
-      "Value": "1132800"
-    },
-    {
-      "PowerHint": "INTERACTION",
-      "Node": "CPULittleClusterMinFreq",
-      "Duration": 0,
-      "Value": "1134000"
-    },
-    {
-      "PowerHint": "INTERACTION",
-      "Node": "TASchedtuneBoost",
-      "Duration": 0,
-      "Value": "50"
-    },
-    {
-      "PowerHint": "INTERACTION",
-      "Node": "CPUBWHystTriggerCount",
-      "Duration": 0,
-      "Value": "0"
-    },
-    {
-      "PowerHint": "INTERACTION",
-      "Node": "CPUBWHystLength",
-      "Duration": 0,
-      "Value": "0"
-    },
-    {
-      "PowerHint": "INTERACTION",
-      "Node": "CPUBWHistMemory",
-      "Duration": 0,
-      "Value": "0"
-    },
-    {
-      "PowerHint": "INTERACTION",
-      "Node": "CPUBWMinFreq",
-      "Duration": 0,
-      "Value": "5195"
-    },
-    {
-      "PowerHint": "LAUNCH",
-      "Node": "CPUBigClusterMaxFreq",
-      "Duration": 5000,
-      "Value": "2457600"
-    },
-    {
-      "PowerHint": "LAUNCH",
-      "Node": "CPUBigClusterMinFreq",
-      "Duration": 5000,
-      "Value": "2457600"
-    },
-    {
-      "PowerHint": "LAUNCH",
-      "Node": "CPULittleClusterMinFreq",
-      "Duration": 5000,
-      "Value": "1900800"
-    },
-    {
-      "PowerHint": "LAUNCH",
-      "Node": "PMQoSCpuDmaLatency",
-      "Duration": 5000,
-      "Value": "44"
-    },
-    {
-      "PowerHint": "LAUNCH",
-      "Node": "CPUBWHystTriggerCount",
-      "Duration": 5000,
-      "Value": "0"
-    },
-    {
-      "PowerHint": "LAUNCH",
-      "Node": "CPUBWHystLength",
-      "Duration": 5000,
-      "Value": "0"
-    },
-    {
-      "PowerHint": "LAUNCH",
-      "Node": "CPUBWHistMemory",
-      "Duration": 5000,
-      "Value": "0"
-    },
-    {
-      "PowerHint": "LAUNCH",
-      "Node": "CPUBWMinFreq",
-      "Duration": 5000,
-      "Value": "13763"
-    },
-    {
-      "PowerHint": "CAMERA_LAUNCH",
-      "Node": "CPUBigClusterMaxFreq",
-      "Duration": 1000,
-      "Value": "2457600"
-    },
-    {
-      "PowerHint": "CAMERA_LAUNCH",
-      "Node": "CPUBigClusterMinFreq",
-      "Duration": 1000,
-      "Value": "2457600"
-    },
-    {
-      "PowerHint": "CAMERA_LAUNCH",
-      "Node": "CPULittleClusterMinFreq",
-      "Duration": 1000,
-      "Value": "1900800"
-    },
-    {
-      "PowerHint": "CAMERA_LAUNCH",
-      "Node": "PMQoSCpuDmaLatency",
-      "Duration": 1000,
-      "Value": "44"
-    },
-    {
-      "PowerHint": "CAMERA_STREAMING",
-      "Node": "CPUBigClusterMaxFreq",
-      "Duration": 1000,
-      "Value": "2457600"
-    },
-    {
-      "PowerHint": "CAMERA_STREAMING",
-      "Node": "CPUBigClusterMinFreq",
-      "Duration": 1000,
-      "Value": "2457600"
-    },
-    {
-      "PowerHint": "CAMERA_STREAMING",
-      "Node": "CPULittleClusterMinFreq",
-      "Duration": 1000,
-      "Value": "1900800"
-    },
-    {
-      "PowerHint": "CAMERA_STREAMING",
-      "Node": "PMQoSCpuDmaLatency",
-      "Duration": 1000,
-      "Value": "44"
-    },
-    {
-      "PowerHint": "CAMERA_SHOT",
-      "Node": "CPUBigClusterMaxFreq",
-      "Duration": 1000,
-      "Value": "2457600"
-    },
-    {
-      "PowerHint": "CAMERA_SHOT",
-      "Node": "CPUBigClusterMinFreq",
-      "Duration": 1000,
-      "Value": "2457600"
-    },
-    {
-      "PowerHint": "CAMERA_SHOT",
-      "Node": "CPULittleClusterMinFreq",
-      "Duration": 1000,
-      "Value": "1900800"
-    },
-    {
-      "PowerHint": "CAMERA_SHOT",
-      "Node": "PMQoSCpuDmaLatency",
-      "Duration": 1000,
-      "Value": "44"
-    },
-    {
-      "PowerHint": "CAMERA_SHOT",
-      "Node": "CPUBWHystTriggerCount",
-      "Duration": 1000,
-      "Value": "0"
-    },
-    {
-      "PowerHint": "CAMERA_SHOT",
-      "Node": "CPUBWHystLength",
-      "Duration": 1000,
-      "Value": "0"
-    },
-    {
-      "PowerHint": "CAMERA_SHOT",
-      "Node": "CPUBWHistMemory",
-      "Duration": 1000,
-      "Value": "0"
-    },
-    {
-      "PowerHint": "CAMERA_SHOT",
-      "Node": "CPUBWMinFreq",
-      "Duration": 1000,
-      "Value": "13763"
-    },
-    {
-      "PowerHint": "AUDIO_STREAMING",
-      "Node": "CPUBigClusterMinFreq",
-      "Duration": 2000,
-      "Value": "1420800"
-    },
-    {
-      "PowerHint": "AUDIO_STREAMING",
-      "Node": "PMQoSCpuDmaLatency",
-      "Duration": 2000,
-      "Value": "44"
-    },
-    {
-      "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/power-libperfmgr/Android.bp b/powerstats/Android.bp
similarity index 68%
rename from power-libperfmgr/Android.bp
rename to powerstats/Android.bp
index 8deca67..491498d 100644
--- a/power-libperfmgr/Android.bp
+++ b/powerstats/Android.bp
@@ -13,25 +13,28 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 cc_binary {
-    name: "android.hardware.power@1.2-service.wahoo-libperfmgr",
+    name: "android.hardware.power.stats@1.0-service.pixel",
     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"],
+    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",
-        "libcutils",
-        "android.hardware.power@1.0",
-        "android.hardware.power@1.1",
-        "android.hardware.power@1.2",
-        "libperfmgr",
+        "android.hardware.power.stats@1.0",
+        "pixelpowerstats_provider_aidl_interface-cpp",
+        "libbinder",
     ],
-    proprietary: true,
+    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..ce71b6f
--- /dev/null
+++ b/powerstats/service.cpp
@@ -0,0 +1,165 @@
+/*
+ * 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-base/properties.h>
+#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.");
+
+    bool isDebuggable = android::base::GetBoolProperty("ro.debuggable", false);
+
+    PowerStats *service = new PowerStats();
+
+    if (isDebuggable) {
+        // 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/private/mediaswcodec.te b/sepolicy/private/mediaswcodec.te
new file mode 100644
index 0000000..3690750
--- /dev/null
+++ b/sepolicy/private/mediaswcodec.te
@@ -0,0 +1,2 @@
+allow mediaswcodec gpu_device:chr_file { ioctl open read write };
+
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..b66f65a 100644
--- a/sepolicy/vendor/file_contexts
+++ b/sepolicy/vendor/file_contexts
@@ -167,35 +167,40 @@
 /vendor/bin/oemlock_provision   u:object_r:hal_bootctl_default_exec:s0
 /vendor/bin/oemlock-bridge      u:object_r:hal_bootctl_default_exec:s0
 /vendor/bin/hw/android\.hardware\.usb@1\.1-service\.wahoo             u:object_r:hal_usb_impl_exec:s0
-/vendor/bin/hw/android\.hardware\.power@1\.2-service\.wahoo-libperfmgr u:object_r:hal_power_default_exec:s0
+/vendor/bin/hw/android\.hardware\.power@1\.3-service\.pixel-libperfmgr      u:object_r:hal_power_default_exec:s0
 /vendor/bin/hw/android\.hardware\.power\.stats@1\.0-service\.pixel u:object_r:hal_power_stats_default_exec:s0
 /vendor/bin/chre                u:object_r:chre_exec:s0
 /vendor/bin/time_daemon         u:object_r:time_daemon_exec:s0
 /vendor/bin/imsrcsd             u:object_r:hal_rcsservice_exec:s0
 /vendor/bin/init\.qcom\.devstart\.sh                                 u:object_r:init-qcom-devstart-sh_exec:s0
 /vendor/bin/init\.qcom\.ipastart\.sh                                 u:object_r:init-qcom-ipastart-sh_exec:s0
-/vendor/bin/init\.qcom\.wlan\.sh                                     u:object_r:init-qcom-wlan-sh_exec:s0
 /vendor/bin/init\.insmod\.sh                                         u:object_r:init-insmod-sh_exec:s0
 /vendor/etc/init\.insmod\.cfg                                        u:object_r:init-insmod-sh_exec:s0
 /vendor/bin/init\.power\.sh     u:object_r:init_power_exec:s0
 /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 28d1f7a..46b5aff 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 5632c3b..6d4a815 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 8e6eca1..bfa6a6b 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..7e6f60d 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;
@@ -17,6 +8,11 @@
 allow hal_power_default latency_device:chr_file rw_file_perms;
 allow hal_power_default cgroup:dir search;
 allow hal_power_default cgroup:file rw_file_perms;
+allow hal_power_default sysfs_touch:file w_file_perms;
+allow hal_power_default sysfs_touch:dir search;
 
 # 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_power_stats_default.te b/sepolicy/vendor/hal_power_stats_default.te
index da4c298..5c773db 100644
--- a/sepolicy/vendor/hal_power_stats_default.te
+++ b/sepolicy/vendor/hal_power_stats_default.te
@@ -1,6 +1,7 @@
 # power.stats HAL needs access to rpm, and wlan sysfs nodes in /d/
 r_dir_file(hal_power_stats_default, debugfs_rpm)
 r_dir_file(hal_power_stats_default, debugfs_wlan)
+get_prop(hal_power_stats_default, exported_wifi_prop) # Needed to detect wifi on/off
 
 # power.stats HAL needs access to the easel sysfs node
 r_dir_file(hal_power_stats_default, sysfs_easel)
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/hal_wifi_default.te b/sepolicy/vendor/hal_wifi_default.te
index a015558..d6f02d5 100644
--- a/sepolicy/vendor/hal_wifi_default.te
+++ b/sepolicy/vendor/hal_wifi_default.te
@@ -11,6 +11,9 @@
 # Allow wifi hal to read debug info from the driver.
 r_dir_file(hal_wifi_default, proc_wifi_dbg)
 
+# Write wlan driver/fw version into property
+set_prop(hal_wifi_default, vendor_wifi_version)
+
 dontaudit hal_wifi_default kernel:system module_request;
 dontaudit hal_wifi_default self:capability sys_module;
 
@@ -19,4 +22,4 @@
 
 # Allow wifi hal to access wlan debugfs files and directories
 allow hal_wifi_default debugfs_wlan:dir r_dir_perms;
-')
\ No newline at end of file
+')
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/init-wlan-sh.te b/sepolicy/vendor/init-wlan-sh.te
deleted file mode 100644
index 3380c86..0000000
--- a/sepolicy/vendor/init-wlan-sh.te
+++ /dev/null
@@ -1,14 +0,0 @@
-type init-qcom-wlan-sh, domain;
-type init-qcom-wlan-sh_exec, exec_type, vendor_file_type, file_type;
-
-init_daemon_domain(init-qcom-wlan-sh)
-
-allow init-qcom-wlan-sh vendor_shell_exec:file rx_file_perms;
-allow init-qcom-wlan-sh vendor_toolbox_exec:file rx_file_perms;
-
-# Set the vendor.wlan.driver.version and vendor.wlan.firmware.version property
-set_prop(init-qcom-wlan-sh, vendor_wifi_version)
-
-# /sys/kernel/wifi/wlan/driver_version and /sys/kernel/wifi/wlan/fw/0/version
-allow init-qcom-wlan-sh sysfs_msm_wlan:dir r_dir_perms;
-allow init-qcom-wlan-sh sysfs_msm_wlan:file r_file_perms;
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 7bbcc59..2dce241 100644
--- a/sepolicy/vendor/netmgrd.te
+++ b/sepolicy/vendor/netmgrd.te
@@ -43,7 +43,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 594a4f5..f6628b0 100644
--- a/sepolicy/vendor/property.te
+++ b/sepolicy/vendor/property.te
@@ -25,3 +25,6 @@
 type vendor_charge_prop, property_type;
 type vendor_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 a8c28e7..8308175 100644
--- a/sepolicy/vendor/property_contexts
+++ b/sepolicy/vendor/property_contexts
@@ -17,15 +17,18 @@
 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
 persist.radio.atfwd.start  u:object_r:atfwd_start_prop:s0
 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.state                           u:object_r:power_prop:s0
+vendor.powerhal.audio                           u:object_r:power_prop:s0
+vendor.powerhal.lpm                             u:object_r:power_prop:s0
+vendor.powerhal.init                            u:object_r:power_prop:s0
+vendor.powerhal.rendering                       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
@@ -53,6 +56,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.
@@ -214,3 +220,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/ramdump.te b/sepolicy/vendor/ramdump.te
index 7514dea..e059227 100644
--- a/sepolicy/vendor/ramdump.te
+++ b/sepolicy/vendor/ramdump.te
@@ -22,5 +22,7 @@
   # read from /fstab.taimen
   allow ramdump rootfs:file r_file_perms;
 
+  dontaudit ramdump metadata_file:dir search;
+
   r_dir_file(ramdump, sysfs_type)
 ')
diff --git a/sepolicy/vendor/seapp_contexts b/sepolicy/vendor/seapp_contexts
index a4f429b..e1f512c 100644
--- a/sepolicy/vendor/seapp_contexts
+++ b/sepolicy/vendor/seapp_contexts
@@ -1,7 +1,7 @@
 user=system seinfo=platform name=com.google.SSRestartDetector domain=ssr_detector_app type=system_app_data_file
 user=_app seinfo=platform name=com.android.pixellogger domain=logger_app type=app_data_file levelFrom=all
 user=_app seinfo=platform name=com.android.ramdump domain=ramdump_app type=app_data_file levelFrom=all
-user=_app seinfo=platform name=com.google.mds domain=mds_app type=app_data_file levelFrom=all
+user=_app seinfo=google name=com.google.mds domain=mds_app type=app_data_file levelFrom=all
 
 #TODO Remove user "system" when b/63588267 is resolved
 user=system seinfo=platform name=com.qualcomm.telephony domain=qtelephony type=system_app_data_file
@@ -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..8a47846 100644
--- a/sound_trigger_platform_info.xml
+++ b/sound_trigger_platform_info.xml
@@ -33,6 +33,7 @@
         <param max_ape_sessions="8" />
         <param enable_failure_detection="false" />
         <param support_device_switch="false" />
+        <param concurrent_capture="true" />
     </common_config>
     <acdb_ids>
         <param DEVICE_HANDSET_MIC_APE="100" />
@@ -52,6 +53,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 +73,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/vibrator/Vibrator.cpp b/vibrator/Vibrator.cpp
index 9657684..ff66d8e 100644
--- a/vibrator/Vibrator.cpp
+++ b/vibrator/Vibrator.cpp
@@ -176,15 +176,30 @@
 }
 
 Return<void> Vibrator::perform(V1_0::Effect effect, EffectStrength strength, perform_cb _hidl_cb) {
-    return performEffect(static_cast<Effect>(effect), strength, _hidl_cb);
+    return performWrapper(effect, strength, _hidl_cb);
 }
 
 Return<void> Vibrator::perform_1_1(V1_1::Effect_1_1 effect, EffectStrength strength,
         perform_cb _hidl_cb) {
-    return performEffect(static_cast<Effect>(effect), strength, _hidl_cb);
+    return performWrapper(effect, strength, _hidl_cb);
 }
 
 Return<void> Vibrator::perform_1_2(Effect effect, EffectStrength strength, perform_cb _hidl_cb) {
+    return performWrapper(effect, strength, _hidl_cb);
+}
+
+template <typename T>
+Return<void> Vibrator::performWrapper(T effect, EffectStrength strength, perform_cb _hidl_cb) {
+    auto validEffectRange = hidl_enum_range<T>();
+    if (effect < *validEffectRange.begin() || effect > *std::prev(validEffectRange.end())) {
+        _hidl_cb(Status::UNSUPPORTED_OPERATION, 0);
+        return Void();
+    }
+    auto validStrengthRange = hidl_enum_range<EffectStrength>();
+    if (strength < *validStrengthRange.begin() || strength > *std::prev(validStrengthRange.end())) {
+        _hidl_cb(Status::UNSUPPORTED_OPERATION, 0);
+        return Void();
+    }
     return performEffect(static_cast<Effect>(effect), strength, _hidl_cb);
 }
 
diff --git a/vibrator/Vibrator.h b/vibrator/Vibrator.h
index f9daf7c..24510d7 100644
--- a/vibrator/Vibrator.h
+++ b/vibrator/Vibrator.h
@@ -50,6 +50,8 @@
 
 private:
     Return<Status> on(uint32_t timeoutMs, bool forceOpenLoop, bool isWaveform);
+    template <typename T>
+    Return<void> performWrapper(T effect, EffectStrength strength, perform_cb _hidl_cb);
     Return<void> performEffect(Effect effect, EffectStrength strength, perform_cb _hidl_cb);
     std::ofstream mActivate;
     std::ofstream mDuration;
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