diff --git a/Android.bp b/Android.bp
deleted file mode 100644
index 9f2d303a..00000000
--- a/Android.bp
+++ /dev/null
@@ -1,7 +0,0 @@
-subdirs = [
- "thermal",
- "vr",
- "vibrator",
- "wifi_offload",
- "usb",
-]
diff --git a/BoardConfig.mk b/BoardConfig.mk
index 01f9c42e..5f9af5f5 100644
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -37,6 +37,7 @@ BOARD_KERNEL_CMDLINE += swiotlb=2048
BOARD_KERNEL_CMDLINE += firmware_class.path=/vendor/firmware
BOARD_KERNEL_CMDLINE += loop.max_part=7
BOARD_KERNEL_CMDLINE += raid=noautodetect
+BOARD_KERNEL_CMDLINE += usbcore.autosuspend=7
BOARD_KERNEL_BASE := 0x00000000
BOARD_KERNEL_PAGESIZE := 4096
@@ -80,7 +81,7 @@ TARGET_COPY_OUT_VENDOR := vendor
# Install odex files into the other system image
BOARD_USES_SYSTEM_OTHER_ODEX := true
-BOARD_ROOT_EXTRA_FOLDERS := persist firmware metadata
+BOARD_ROOT_EXTRA_FOLDERS := persist firmware
BOARD_SEPOLICY_DIRS += device/google/wahoo/sepolicy/vendor
BOARD_PLAT_PUBLIC_SEPOLICY_DIR := device/google/wahoo/sepolicy/public
@@ -91,6 +92,7 @@ TARGET_ANDROID_FILESYSTEM_CONFIG_H := device/google/wahoo/android_filesystem_con
QCOM_BOARD_PLATFORMS += msm8998
BOARD_HAVE_BLUETOOTH_QCOM := true
+BOARD_USES_SDM845_BLUETOOTH_HAL := true
BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := device/google/wahoo/bluetooth
# Camera
@@ -151,7 +153,8 @@ BOARD_CHARGER_ENABLE_SUSPEND := true
# Vendor Interface Manifest
DEVICE_MANIFEST_FILE := device/google/wahoo/manifest.xml
DEVICE_MATRIX_FILE := device/google/wahoo/compatibility_matrix.xml
-
+DEVICE_FRAMEWORK_MANIFEST_FILE := device/google/wahoo/framework_manifest.xml
+DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE := device/google/wahoo/device_framework_matrix.xml
BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true
# Use mke2fs to create ext4 images
diff --git a/CleanSpec.mk b/CleanSpec.mk
index d23c619b..aa65532f 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -144,5 +144,51 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib64/vndk-sp/libz.so)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/priv-app/EuiccGoogle/esim.img)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/priv-app/EuiccGoogle/esim2.img)
+# Remove init.recovery.*.rc file in root directory (only needed in recovery root).
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/root/init.recovery.$(PRODUCT_HARDWARE).rc)
+
+# Remove build and default prop.
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/*.prop)
+
# android.hardware.thermal@1.0-wahoo.so can be a static lib
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib/hw/android.hardware.thermal@1.0-wahoo.so)
+
+# Remove android.hardware.keymaster@4.0-service
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.keymaster@4.0-service)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.keymaster@4.0-service.rc)
+
+# Health HAL 2.0
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.health@2.0-service)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.health@2.0-service.rc)
+
+# Remove PowerHAL
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.power*)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.power*)
+
+# Remove Vibrator HAL 1.1
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.vibrator@1.1-service.wahoo.rc)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.vibrator@1.1-service.wahoo)
+
+# Remove all HALs (actual bitness now being specified)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib/hw/*)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib64/hw/*)
+
+# 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 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 healthd
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/bin/healthd)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/etc/init/healthd.rc)
+
+# Remove android.hardware.keymaster@4.0-service
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.keymaster@4.0-service)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.keymaster@4.0-service.rc)
+
diff --git a/audio_policy_configuration.xml b/audio_policy_configuration.xml
index 07daa6c8..6ccfc176 100644
--- a/audio_policy_configuration.xml
+++ b/audio_policy_configuration.xml
@@ -73,6 +73,12 @@
+
+
+
+ sources="voice_tx,incall_music_uplink"/>
+
+
+
diff --git a/default-permissions.xml b/default-permissions.xml
index 5c373157..7c653b51 100644
--- a/default-permissions.xml
+++ b/default-permissions.xml
@@ -49,6 +49,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/device.mk b/device.mk
index bb1fc983..7e4864c6 100755
--- a/device.mk
+++ b/device.mk
@@ -14,16 +14,29 @@
# limitations under the License.
#
+ifneq (,$(filter 27, $(PRODUCT_EXTRA_VNDK_VERSIONS)))
+ _vndk_test := true
+endif
+
+ifeq (,$(_vndk_test))
+PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE := true
+endif
+PRODUCT_ACTIONABLE_COMPATIBLE_PROPERTY_DISABLE := true
+
PRODUCT_PROPERTY_OVERRIDES += \
keyguard.no_require_sim=true
+PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
+ ro.adb.secure=1
+
PRODUCT_COPY_FILES += \
device/google/wahoo/default-permissions.xml:$(TARGET_COPY_OUT_VENDOR)/etc/default-permissions/default-permissions.xml \
- frameworks/native/data/etc/handheld_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/handheld_core_hardware.xml
+ frameworks/native/data/etc/handheld_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/handheld_core_hardware.xml \
+ frameworks/native/data/etc/android.software.verified_boot.xml:system/etc/permissions/android.software.verified_boot.xml
# Set the SVN for the targeted MR release
PRODUCT_PROPERTY_OVERRIDES += \
- ro.vendor.build.svn=4
+ ro.vendor.build.svn=17
# Enforce privapp-permissions whitelist
PRODUCT_PROPERTY_OVERRIDES += \
@@ -58,7 +71,7 @@ DEVICE_PACKAGE_OVERLAYS += $(LOCAL_PATH)/overlay
PRODUCT_COPY_FILES += \
$(LOCAL_KERNEL):kernel \
- $(LOCAL_PATH)/init.recovery.hardware.rc:root/init.recovery.$(PRODUCT_HARDWARE).rc \
+ $(LOCAL_PATH)/init.recovery.hardware.rc:recovery/root/init.recovery.$(PRODUCT_HARDWARE).rc \
$(LOCAL_PATH)/init.hardware.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.$(PRODUCT_HARDWARE).rc \
$(LOCAL_PATH)/init.hardware.usb.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.wahoo.usb.rc \
$(LOCAL_PATH)/ueventd.hardware.rc:$(TARGET_COPY_OUT_VENDOR)/ueventd.rc \
@@ -69,6 +82,7 @@ PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/uinput-fpc.idc:system/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 \
frameworks/native/services/vr/virtual_touchpad/idc/vr-virtual-touchpad-0.idc:$(TARGET_COPY_OUT_VENDOR)/usr/idc/vr-virtual-touchpad-0.idc \
@@ -133,9 +147,11 @@ PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.camera.front.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.front.xml \
frameworks/native/data/etc/android.hardware.camera.full.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.full.xml\
frameworks/native/data/etc/android.hardware.camera.raw.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.raw.xml\
+ frameworks/native/data/etc/android.hardware.camera.ar.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.ar.xml\
frameworks/native/data/etc/android.hardware.bluetooth.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth.xml \
frameworks/native/data/etc/android.hardware.bluetooth_le.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth_le.xml \
frameworks/native/data/etc/android.hardware.sensor.accelerometer.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.accelerometer.xml \
+ frameworks/native/data/etc/android.hardware.sensor.assist.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.assist.xml \
frameworks/native/data/etc/android.hardware.sensor.compass.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.compass.xml \
frameworks/native/data/etc/android.hardware.sensor.gyroscope.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.gyroscope.xml \
frameworks/native/data/etc/android.hardware.sensor.light.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.light.xml \
@@ -152,6 +168,7 @@ PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.wifi.direct.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.direct.xml \
frameworks/native/data/etc/android.hardware.wifi.aware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.aware.xml \
frameworks/native/data/etc/android.hardware.wifi.passpoint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.passpoint.xml \
+ frameworks/native/data/etc/android.hardware.wifi.rtt.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.rtt.xml \
frameworks/native/data/etc/android.software.sip.voip.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.sip.voip.xml \
frameworks/native/data/etc/android.hardware.usb.accessory.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.usb.accessory.xml \
frameworks/native/data/etc/android.hardware.usb.host.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.usb.host.xml \
@@ -163,15 +180,19 @@ PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.vr.high_performance.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vr.high_performance.xml \
frameworks/native/data/etc/android.hardware.vulkan.compute-0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.compute.xml \
frameworks/native/data/etc/android.hardware.vulkan.level-0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.level.xml \
- frameworks/native/data/etc/android.hardware.vulkan.version-1_0_3.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.version.xml \
+ frameworks/native/data/etc/android.hardware.vulkan.version-1_1.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.version.xml \
frameworks/native/data/etc/android.hardware.telephony.carrierlock.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.telephony.carrierlock.xml \
# power HAL
PRODUCT_PACKAGES += \
- android.hardware.power@1.1-service.wahoo
+ android.hardware.power@1.2-service.wahoo-libperfmgr
PRODUCT_COPY_FILES += \
- $(LOCAL_PATH)/powerhint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/powerhint.xml
+ $(LOCAL_PATH)/powerhint.json:$(TARGET_COPY_OUT_VENDOR)/etc/powerhint.json
+
+# health HAL
+PRODUCT_PACKAGES += \
+ android.hardware.health@2.0-service.wahoo
# Audio fluence, ns, aec property, voice and media volume steps
PRODUCT_PROPERTY_OVERRIDES += \
@@ -187,6 +208,10 @@ PRODUCT_PROPERTY_OVERRIDES += \
PRODUCT_PROPERTY_OVERRIDES += \
ro.opengles.version=196610
+# b/73640835
+PRODUCT_PROPERTY_OVERRIDES += \
+ sdm.debug.rotator_downscale=1
+
# Enable camera EIS3.0
PRODUCT_PROPERTY_OVERRIDES += \
persist.camera.is_type=5 \
@@ -216,15 +241,27 @@ PRODUCT_PROPERTY_OVERRIDES += \
persist.radio.sap_silent_pin=1 \
persist.radio.sib16_support=1 \
persist.radio.data_con_rprt=true \
- persist.radio.always_send_plmn=true \
- persist.rcs.supported=1 \
+ persist.radio.always_send_plmn=false\
+ persist.rcs.supported=1
+
+ifeq (,$(_vndk_test))
+PRODUCT_PROPERTY_OVERRIDES += \
+ vendor.rild.libpath=/vendor/lib64/libril-qc-qmi-1.so
+else
+PRODUCT_PROPERTY_OVERRIDES += \
rild.libpath=/vendor/lib64/libril-qc-qmi-1.so
+endif
# Disable snapshot timer
PRODUCT_PROPERTY_OVERRIDES += \
persist.radio.snapshot_enabled=0 \
persist.radio.snapshot_timer=0
+# By default, enable zram; experiment can toggle the flag,
+# which takes effect on boot
+PRODUCT_PROPERTY_OVERRIDES += \
+ persist.sys.zram_enabled=1
+
PRODUCT_PROPERTY_OVERRIDES += \
ro.vendor.extension_library=libqti-perfd-client.so
@@ -274,10 +311,10 @@ PRODUCT_COPY_FILES += \
PRODUCT_PACKAGES += \
hwcomposer.msm8998 \
- android.hardware.graphics.composer@2.1-impl \
+ android.hardware.graphics.composer@2.1-impl:64 \
android.hardware.graphics.composer@2.1-service \
gralloc.msm8998 \
- android.hardware.graphics.allocator@2.0-impl \
+ android.hardware.graphics.allocator@2.0-impl:64 \
android.hardware.graphics.allocator@2.0-service \
android.hardware.graphics.mapper@2.0-impl \
libbt-vendor
@@ -289,7 +326,7 @@ PRODUCT_PACKAGES += \
# Light HAL
PRODUCT_PACKAGES += \
lights.$(PRODUCT_HARDWARE) \
- android.hardware.light@2.0-impl \
+ android.hardware.light@2.0-impl:64 \
android.hardware.light@2.0-service
# eSE applet HALs
@@ -304,22 +341,31 @@ PRODUCT_PACKAGES += \
# Bluetooth HAL
PRODUCT_PACKAGES += \
- libbt-vendor \
- android.hardware.bluetooth@1.0-impl \
- android.hardware.bluetooth@1.0-service
+ android.hardware.bluetooth@1.0-impl-qti:64 \
+ android.hardware.bluetooth@1.0-service-qti \
+ android.hardware.bluetooth@1.0-service-qti.rc
+
+# Bluetooth SoC
+PRODUCT_PROPERTY_OVERRIDES += \
+ vendor.qcom.bluetooth.soc=cherokee
+
+# Property for loading BDA from bdaddress module in kernel
+PRODUCT_PROPERTY_OVERRIDES += \
+ ro.vendor.bt.bdaddr_path=/sys/module/bdaddress/parameters/bdaddress
+
+# Bluetooth WiPower
+PRODUCT_PROPERTY_OVERRIDES += \
+ ro.vendor.bluetooth.emb_wp_mode=false \
+ ro.vendor.bluetooth.wipower=false
# DRM HAL
PRODUCT_PACKAGES += \
- android.hardware.drm@1.0-impl \
+ android.hardware.drm@1.0-impl:32 \
android.hardware.drm@1.0-service \
- android.hardware.drm@1.0-service.widevine \
+ android.hardware.drm@1.1-service.widevine \
android.hardware.drm@1.1-service.clearkey \
move_widevine_data.sh
-# NeuralNetworks HAL
-PRODUCT_PACKAGES += \
- android.hardware.neuralnetworks@1.0-service-hvx
-
# NFC packages
PRODUCT_PACKAGES += \
NfcNci \
@@ -345,7 +391,7 @@ PRODUCT_PACKAGES += \
libc2dcolorconvert
PRODUCT_PACKAGES += \
- android.hardware.camera.provider@2.4-impl \
+ android.hardware.camera.provider@2.4-impl:32 \
android.hardware.camera.provider@2.4-service \
camera.device@3.2-impl \
camera.msm8998 \
@@ -355,7 +401,7 @@ PRODUCT_PACKAGES += \
PRODUCT_PACKAGES += \
sensors.$(PRODUCT_HARDWARE) \
- android.hardware.sensors@1.0-impl \
+ android.hardware.sensors@1.0-impl:64 \
android.hardware.sensors@1.0-service
PRODUCT_COPY_FILES += \
@@ -371,17 +417,17 @@ PRODUCT_PACKAGES += \
# Context hub HAL
PRODUCT_PACKAGES += \
- android.hardware.contexthub@1.0-impl.generic \
+ android.hardware.contexthub@1.0-impl.generic:64 \
android.hardware.contexthub@1.0-service
# Boot control HAL
PRODUCT_PACKAGES += \
- android.hardware.boot@1.0-impl \
+ android.hardware.boot@1.0-impl:64 \
android.hardware.boot@1.0-service \
# Vibrator HAL
PRODUCT_PACKAGES += \
- android.hardware.vibrator@1.1-service.wahoo
+ android.hardware.vibrator@1.2-service.wahoo
# Thermal packages
PRODUCT_PACKAGES += \
@@ -416,7 +462,6 @@ PRODUCT_PACKAGES += $(WPA)
# Wifi
PRODUCT_PACKAGES += \
android.hardware.wifi@1.0-service \
- android.hardware.wifi.offload@1.0-service \
wificond \
wifilogd \
libwpa_client
@@ -437,12 +482,13 @@ PRODUCT_PACKAGES += \
audio.a2dp.default \
audio.usb.default \
audio.r_submix.default \
- libaudio-resampler
+ libaudio-resampler \
+ audio.hearing_aid.default
PRODUCT_PACKAGES += \
- android.hardware.audio@2.0-impl \
- android.hardware.audio.effect@2.0-impl \
- android.hardware.soundtrigger@2.0-impl \
+ 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@2.0-service
# stereo speakers: orientation changes swap L/R channels
@@ -480,6 +526,7 @@ PRODUCT_COPY_FILES += \
frameworks/av/services/audiopolicy/config/r_submix_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/r_submix_audio_policy_configuration.xml \
frameworks/av/services/audiopolicy/config/audio_policy_volumes.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy_volumes.xml \
frameworks/av/services/audiopolicy/config/default_volume_tables.xml:$(TARGET_COPY_OUT_VENDOR)/etc/default_volume_tables.xml \
+ frameworks/av/services/audiopolicy/config/hearing_aid_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/hearing_aid_audio_policy_configuration.xml \
# audio hal tables
PRODUCT_COPY_FILES += \
@@ -503,7 +550,7 @@ PRODUCT_COPY_FILES += \
# Fingerprint HIDL implementation
PRODUCT_PACKAGES += \
- android.hardware.biometrics.fingerprint@2.1-service.wahoo
+ android.hardware.biometrics.fingerprint@2.1-service.fpc
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.fingerprint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.fingerprint.xml
@@ -520,6 +567,10 @@ PRODUCT_COPY_FILES += \
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/seccomp_policy/mediacodec.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/mediacodec.policy
+# Keymaster configuration
+PRODUCT_COPY_FILES += \
+ frameworks/native/data/etc/android.software.device_id_attestation.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.device_id_attestation.xml
+
ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
# Subsystem ramdump
PRODUCT_PROPERTY_OVERRIDES += \
@@ -558,9 +609,6 @@ PRODUCT_PACKAGES += \
PRODUCT_PROPERTY_OVERRIDES += \
ro.frp.pst=/dev/block/platform/soc/1da4000.ufshc/by-name/frp
-PRODUCT_PROPERTY_OVERRIDES += \
- ro.vendor.vndk.version=27.1.0 \
-
# Include vndk/vndk-sp/ll-ndk modules
PRODUCT_PACKAGES += vndk_package
@@ -570,12 +618,9 @@ PRODUCT_ENFORCE_RRO_TARGETS := framework-res
PRODUCT_PROPERTY_OVERRIDES += \
dalvik.vm.heapgrowthlimit=256m
-PRODUCT_PROPERTY_OVERRIDES += \
- qcom.bluetooth.soc=cherokee
-
+# Privileged permissions whitelist
PRODUCT_COPY_FILES += \
- device/google/wahoo/tango_permissions.xml:system/etc/permissions/tango_permissions.xml \
- device/google/wahoo/libtango_device2.jar:system/framework/libtango_device2.jar
+ device/google/wahoo/permissions/privapp-permissions-aosp_wahoo.xml:system/etc/permissions/privapp-permissions-aosp_wahoo.xml
PRODUCT_PACKAGES += \
ipacm
@@ -603,7 +648,7 @@ PRODUCT_PROPERTY_OVERRIDES += \
# Enable CameraHAL perfd usage
PRODUCT_PROPERTY_OVERRIDES += \
- persist.camera.perfd.enable=true
+ persist.camera.perfd.enable=false
# Enable Gcam FD Ensemble
PRODUCT_PROPERTY_OVERRIDES += \
@@ -616,3 +661,13 @@ PRODUCT_DEXPREOPT_SPEED_APPS += \
# audio effects config
PRODUCT_PROPERTY_OVERRIDES += \
fmas.hdph_sgain=0
+
+# NFC/camera interaction workaround - DO NOT COPY TO NEW DEVICES
+PRODUCT_PROPERTY_OVERRIDES += \
+ ro.camera.notify_nfc=1
+
+# default usb oem functions
+ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
+ PRODUCT_PROPERTY_OVERRIDES += \
+ persist.vendor.usb.usbradio.config=diag
+endif
diff --git a/device_framework_matrix.xml b/device_framework_matrix.xml
new file mode 100644
index 00000000..917ae5c9
--- /dev/null
+++ b/device_framework_matrix.xml
@@ -0,0 +1,66 @@
+
+
+ vendor.qti.atcmdfwd
+ 1.0
+
+ IAtCmdFwd
+ AtCmdFwdService
+
+
+
+ vendor.qti.qcril.am
+ 1.0
+
+ IQcRilAudio
+ slot1
+
+
+
+ com.qualcomm.qti.ims.radio
+ 1.1
+
+ IImsRadio
+ imsradio0
+
+
+
+ com.qualcomm.qti.imsrtpservice
+ 1.0
+
+ IRTPService
+ imsrtpservice
+
+
+
+ com.qualcomm.qti.qcril.qcrilhook
+ 1.0
+
+ IQtiOemHook
+ oemhook0
+
+
+
+ com.qualcomm.qti.uceservice
+ 1.0
+
+ IUceService
+ com.qualcomm.qti.uceservice
+
+
+
+ com.quicinc.cne.api
+ 1.0
+
+ IApiService
+ cnd
+
+
+
+ com.quicinc.cne.server
+ 1.0
+
+ IServer
+ cnd
+
+
+
diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp
index f50919cd..f676ad89 100755
--- a/dumpstate/DumpstateDevice.cpp
+++ b/dumpstate/DumpstateDevice.cpp
@@ -21,10 +21,11 @@
#include
#include
#include
-#include
#include
-#include
-#include
+#include
+
+#define _SVID_SOURCE
+#include
#include "DumpstateUtil.h"
@@ -35,6 +36,8 @@
#define DIAG_MDLOG_PROPERTY "sys.modem.diag.mdlog"
#define DIAG_MDLOG_STATUS_PROPERTY "sys.modem.diag.mdlog_on"
+#define DIAG_MDLOG_NUMBER_BUGREPORT "persist.sys.modem.diag.mdlog_br_num"
+
using android::os::dumpstate::CommandOptions;
using android::os::dumpstate::DumpFileToFd;
using android::os::dumpstate::PropertiesHelper;
@@ -46,6 +49,54 @@ namespace dumpstate {
namespace V1_0 {
namespace implementation {
+#define DIAG_LOG_PREFIX "diag_log_"
+
+void DumpstateDevice::dumpDiagLogs(int fd, std::string srcDir, std::string destDir) {
+ struct dirent **dirent_list = NULL;
+ int num_entries = scandir(srcDir.c_str(),
+ &dirent_list,
+ 0,
+ (int (*)(const struct dirent **, const struct dirent **)) alphasort);
+ if (!dirent_list) {
+ return;
+ } else if (num_entries <= 0) {
+ return;
+ }
+
+ int maxFileNum = android::base::GetIntProperty(DIAG_MDLOG_NUMBER_BUGREPORT, 100);
+ int copiedFiles = 0;
+
+ for (int i = num_entries - 1; i >= 0; i--) {
+ ALOGD("Found %s\n", dirent_list[i]->d_name);
+
+ if (0 != strncmp(dirent_list[i]->d_name, DIAG_LOG_PREFIX, strlen(DIAG_LOG_PREFIX))) {
+ continue;
+ }
+
+ if ((copiedFiles >= maxFileNum) && (maxFileNum != -1)) {
+ ALOGD("Skipped %s\n", dirent_list[i]->d_name);
+ continue;
+ }
+
+ copiedFiles++;
+
+ CommandOptions options = CommandOptions::WithTimeout(120).Build();
+ std::string srcLogFile = srcDir + "/" + dirent_list[i]->d_name;
+ std::string destLogFile = destDir + "/" + dirent_list[i]->d_name;
+
+ std::string copyCmd= "/vendor/bin/cp " + srcLogFile + " " + destLogFile;
+
+ ALOGD("Copying %s to %s\n", srcLogFile.c_str(), destLogFile.c_str());
+ RunCommandToFd(fd, "CP DIAG LOGS", { "/vendor/bin/sh", "-c", copyCmd.c_str() }, options);
+ }
+
+ while (num_entries--) {
+ free(dirent_list[num_entries]);
+ }
+
+ free(dirent_list);
+}
+
void DumpstateDevice::dumpModem(int fd, int fdModem)
{
std::string modemLogDir = android::base::GetProperty(MODEM_LOG_LOC_PROPERTY, "");
@@ -68,7 +119,8 @@ void DumpstateDevice::dumpModem(int fd, int fdModem)
"/data/vendor/radio/ril_log",
"/data/vendor/radio/ril_log_old",
"/data/vendor/netmgr/netmgr_log",
- "/data/vendor/netmgr/netmgr_log_old"
+ "/data/vendor/netmgr/netmgr_log_old",
+ "/data/vendor/radio/power_anomaly_data.txt"
};
std::string modemLogMkDirCmd= "/vendor/bin/mkdir -p " + modemLogAllDir;
@@ -77,8 +129,6 @@ void DumpstateDevice::dumpModem(int fd, int fdModem)
if (smlogEnabled) {
RunCommandToFd(fd, "SMLOG DUMP", { "smlog_dump", "-d", "-o", modemLogAllDir.c_str() }, options);
} else if (diagLogEnabled) {
- std::string copyCmd= "/vendor/bin/cp -rf " + diagLogDir + " " + modemLogAllDir;
-
android::base::SetProperty(DIAG_MDLOG_PROPERTY, "false");
ALOGD("Waiting for diag log to exit\n");
@@ -92,7 +142,7 @@ void DumpstateDevice::dumpModem(int fd, int fdModem)
sleep(1);
}
- RunCommandToFd(fd, "CP DIAG LOGS", { "/vendor/bin/sh", "-c", copyCmd.c_str()}, options);
+ dumpDiagLogs(fd, diagLogDir, modemLogAllDir);
android::base::SetProperty(DIAG_MDLOG_PROPERTY, "true");
}
@@ -178,7 +228,7 @@ Return DumpstateDevice::dumpstateBoard(const hidl_handle& handle) {
int fdModem = handle->data[1];
dumpModem(fd, fdModem);
}
-
+ RunCommandToFd(fd, "VENDOR PROPERTIES", {"/vendor/bin/getprop"});
DumpFileToFd(fd, "SoC serial number", "/sys/devices/soc0/serial_number");
DumpFileToFd(fd, "CPU present", "/sys/devices/system/cpu/present");
DumpFileToFd(fd, "CPU online", "/sys/devices/system/cpu/online");
@@ -195,14 +245,11 @@ Return DumpstateDevice::dumpstateBoard(const hidl_handle& handle) {
DumpFileToFd(fd, "SMD Log", "/d/ipc_logging/smd/log");
RunCommandToFd(fd, "ION HEAPS", {"/vendor/bin/sh", "-c", "for d in $(ls -d /d/ion/*); do for f in $(ls $d); do echo --- $d/$f; cat $d/$f; done; done"});
DumpFileToFd(fd, "dmabuf info", "/d/dma_buf/bufinfo");
- RunCommandToFd(fd, "Temperatures", {"/vendor/bin/sh", "-c", "for f in `ls /sys/class/thermal` ; do type=`cat /sys/class/thermal/$f/type` ; temp=`cat /sys/class/thermal/$f/temp` ; echo \"$type: $temp\" ; done"});
RunCommandToFd(fd, "Easel debug info", {"/vendor/bin/sh", "-c", "for f in `ls /sys/bus/i2c/devices/9-0008/@(*curr|temperature|vbat|total_power)`; do echo \"$f: `cat $f`\" ; done; file=/sys/devices/virtual/misc/mnh_sm/state; echo \"$file: `cat $file`\""});
- DumpFileToFd(fd, "cpu0-3 time-in-state", "/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state");
- RunCommandToFd(fd, "cpu0-3 cpuidle", {"/vendor/bin/sh", "-c", "for d in $(ls -d /sys/devices/system/cpu/cpu0/cpuidle/state*); do echo \"$d: `cat $d/name` `cat $d/desc` `cat $d/time` `cat $d/usage`\"; done"});
- DumpFileToFd(fd, "cpu4-7 time-in-state", "/sys/devices/system/cpu/cpu4/cpufreq/stats/time_in_state");
- RunCommandToFd(fd, "cpu4-7 cpuidle", {"/vendor/bin/sh", "-c", "for d in $(ls -d /sys/devices/system/cpu/cpu4/cpuidle/state*); do echo \"$d: `cat $d/name` `cat $d/desc` `cat $d/time` `cat $d/usage`\"; done"});
- DumpFileToFd(fd, "cpu0-3 thermal limit", "/sys/devices/virtual/thermal/cooling_device0/cur_state");
- DumpFileToFd(fd, "cpu4-7 thermal limit", "/sys/devices/virtual/thermal/cooling_device1/cur_state");
+ RunCommandToFd(fd, "Temperatures", {"/vendor/bin/sh", "-c", "for f in /sys/class/thermal/thermal* ; do type=`cat $f/type` ; temp=`cat $f/temp` ; echo \"$type: $temp\" ; done"});
+ RunCommandToFd(fd, "Cooling Device Current State", {"/vendor/bin/sh", "-c", "for f in /sys/class/thermal/cooling* ; do type=`cat $f/type` ; temp=`cat $f/cur_state` ; echo \"$type: $temp\" ; done"});
+ RunCommandToFd(fd, "CPU time-in-state", {"/vendor/bin/sh", "-c", "for cpu in /sys/devices/system/cpu/cpu*; do f=$cpu/cpufreq/stats/time_in_state; if [ ! -f $f ]; then continue; fi; echo $f:; cat $f; done"});
+ RunCommandToFd(fd, "CPU cpuidle", {"/vendor/bin/sh", "-c", "for cpu in /sys/devices/system/cpu/cpu*; do for d in $cpu/cpuidle/state*; do if [ ! -d $d ]; then continue; fi; echo \"$d: `cat $d/name` `cat $d/desc` `cat $d/time` `cat $d/usage`\"; done; done"});
DumpFileToFd(fd, "MDP xlogs", "/data/vendor/display/mdp_xlog");
DumpFileToFd(fd, "TCPM logs", "/d/tcpm/usbpd0");
DumpFileToFd(fd, "PD Engine", "/d/pd_engine/usbpd0");
@@ -210,15 +257,14 @@ Return DumpstateDevice::dumpstateBoard(const hidl_handle& handle) {
DumpFileToFd(fd, "ipc-local-ports", "/d/msm_ipc_router/dump_local_ports");
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"});
+ // 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"});
+ DumpFileToFd(fd, "Battery cycle count", "/sys/class/power_supply/bms/device/cycle_counts_bins");
+ RunCommandToFd(fd, "QCOM FG SRAM", {"/vendor/bin/sh", "-c", "echo 0 > /d/fg/sram/address ; echo 500 > /d/fg/sram/count ; cat /d/fg/sram/data"});
- /* Check if qsee_logger tool exists */
- if (!access("/vendor/bin/qsee_logger", X_OK)) {
- RunCommandToFd(fd, "FP LOGS", {"qsee_logger", "-d"});
- }
+ DumpFileToFd(fd, "WLAN FW Log Symbol Table", "/vendor/firmware/Data.msc");
- DumpFileToFd(fd, "Battery type", "/sys/class/power_supply/bms/battery_type");
-
- RunCommandToFd(fd, "Battery cycle count", {"/vendor/bin/sh", "-c", "for f in 1 2 3 4 5 6 7 8 ; do echo $f > /sys/class/power_supply/bms/cycle_count_id; count=`cat /sys/class/power_supply/bms/cycle_count`; echo \"$f: $count\"; done"});
return Void();
};
diff --git a/dumpstate/DumpstateDevice.h b/dumpstate/DumpstateDevice.h
index 650c0cd0..0a1d0239 100644
--- a/dumpstate/DumpstateDevice.h
+++ b/dumpstate/DumpstateDevice.h
@@ -19,6 +19,7 @@
#include
#include
#include
+#include
namespace android {
namespace hardware {
@@ -39,6 +40,7 @@ struct DumpstateDevice : public IDumpstateDevice {
// Methods from ::android::hardware::dumpstate::V1_0::IDumpstateDevice follow.
Return dumpstateBoard(const hidl_handle& h) override;
+ void dumpDiagLogs(int fd, std::string srcDir, std::string destDir);
void dumpModem(int fd, int fdModem);
};
diff --git a/dumpstate/android.hardware.dumpstate@1.0-service.wahoo.rc b/dumpstate/android.hardware.dumpstate@1.0-service.wahoo.rc
index 924782f0..4c024a0b 100644
--- a/dumpstate/android.hardware.dumpstate@1.0-service.wahoo.rc
+++ b/dumpstate/android.hardware.dumpstate@1.0-service.wahoo.rc
@@ -1,4 +1,8 @@
-service dumpstate-1-0 /vendor/bin/hw/android.hardware.dumpstate@1.0-service.wahoo
+service vendor.dumpstate-1-0 /vendor/bin/hw/android.hardware.dumpstate@1.0-service.wahoo
class hal
user system
group system
+ interface android.hardware.dumpstate@1.0::IDumpstateDevice default
+
+on boot
+ chmod 0444 /sys/kernel/debug/tzdbg/qsee_log
diff --git a/folio_daemon/Android.mk b/folio_daemon/Android.mk
index d2787c06..ed5b5daa 100755
--- a/folio_daemon/Android.mk
+++ b/folio_daemon/Android.mk
@@ -1,4 +1,8 @@
LOCAL_PATH := $(call my-dir)
+
+# Disabling when building with PDK (b/68767391)
+ifneq ($(TARGET_BUILD_PDK),true)
+
include $(CLEAR_VARS)
LOCAL_SHARED_LIBRARIES := \
@@ -20,3 +24,5 @@ LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_OWNER := google
include $(BUILD_EXECUTABLE)
+
+endif
diff --git a/framework_manifest.xml b/framework_manifest.xml
new file mode 100644
index 00000000..c82d51c8
--- /dev/null
+++ b/framework_manifest.xml
@@ -0,0 +1,12 @@
+
+
+ vendor.qti.atcmdfwd
+ hwbinder
+ 1.0
+
+ IAtCmdFwd
+ AtCmdFwdService
+
+
+
+
diff --git a/fstab.hardware b/fstab.hardware
index 7d1e9ac0..d2fc516f 100644
--- a/fstab.hardware
+++ b/fstab.hardware
@@ -2,7 +2,7 @@
#
/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
+/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/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
diff --git a/gps.conf b/gps.conf
index 4e8fffa7..54482b19 100644
--- a/gps.conf
+++ b/gps.conf
@@ -26,7 +26,7 @@ NTP_SERVER = time.google.com
# DEBUG LEVELS: 0 - none, 1 - Error, 2 - Warning, 3 - Info
# 4 - Debug, 5 - Verbose
# If DEBUG_LEVEL is commented, Android's logging levels will be used
-DEBUG_LEVEL = 2
+DEBUG_LEVEL = 3
# Intermediate position report, 1=enable, 0=disable
INTERMEDIATE_POS=0
diff --git a/health/Android.bp b/health/Android.bp
new file mode 100644
index 00000000..d78a7c04
--- /dev/null
+++ b/health/Android.bp
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+cc_binary {
+ name: "android.hardware.health@2.0-service.wahoo",
+ init_rc: ["android.hardware.health@2.0-service.wahoo.rc"],
+ proprietary: true,
+ relative_install_path: "hw",
+ srcs: [
+ "HealthService.cpp",
+ "CycleCountBackupRestore.cpp",
+ "LearnedCapacityBackupRestore.cpp",
+ ],
+
+ cflags: [
+ "-Wall",
+ "-Werror",
+ ],
+
+ static_libs: [
+ "android.hardware.health@2.0-impl",
+ "android.hardware.health@1.0-convert",
+ "libhealthservice",
+ "libbatterymonitor",
+ ],
+
+ shared_libs: [
+ "libbase",
+ "libcutils",
+ "libhidlbase",
+ "libhidltransport",
+ "libhwbinder",
+ "libutils",
+ "android.hardware.health@2.0",
+ ],
+
+ header_libs: ["libhealthd_headers"],
+}
diff --git a/health/CycleCountBackupRestore.cpp b/health/CycleCountBackupRestore.cpp
new file mode 100644
index 00000000..b9f83df0
--- /dev/null
+++ b/health/CycleCountBackupRestore.cpp
@@ -0,0 +1,132 @@
+/*
+ * 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 "CycleCountBackupRestore.h"
+
+namespace device {
+namespace google {
+namespace wahoo {
+namespace health {
+
+static constexpr char kCycCntFile[] = "sys/class/power_supply/bms/device/cycle_counts_bins";
+static constexpr char kSysPersistFile[] = "/persist/battery/qcom_cycle_counts_bins";
+static constexpr int kBuffSize = 256;
+
+CycleCountBackupRestore::CycleCountBackupRestore() { }
+
+void CycleCountBackupRestore::Restore()
+{
+ ReadFromStorage();
+ ReadFromSRAM();
+ UpdateAndSave();
+}
+
+void CycleCountBackupRestore::Backup()
+{
+ ReadFromSRAM();
+ UpdateAndSave();
+}
+
+void CycleCountBackupRestore::ReadFromStorage()
+{
+ std::string buffer;
+
+ if (!android::base::ReadFileToString(std::string(kSysPersistFile), &buffer)) {
+ LOG(ERROR) << "Cannot read the storage file";
+ return;
+ }
+
+ if (sscanf(buffer.c_str(), "%d %d %d %d %d %d %d %d",
+ &sw_bins_[0], &sw_bins_[1], &sw_bins_[2], &sw_bins_[3],
+ &sw_bins_[4], &sw_bins_[5], &sw_bins_[6], &sw_bins_[7])
+ != kBucketCount)
+ LOG(ERROR) << "data format is wrong in the storage file: " << buffer;
+ else
+ LOG(INFO) << "Storage data: " << buffer;
+}
+
+void CycleCountBackupRestore::SaveToStorage()
+{
+ char strData[kBuffSize];
+
+ snprintf(strData, kBuffSize, "%d %d %d %d %d %d %d %d",
+ sw_bins_[0], sw_bins_[1], sw_bins_[2], sw_bins_[3],
+ sw_bins_[4], sw_bins_[5], sw_bins_[6], sw_bins_[7]);
+
+ LOG(INFO) << "Save to Storage: " << strData;
+
+ if (!android::base::WriteStringToFile(strData, std::string(kSysPersistFile)))
+ LOG(ERROR) << "Write file error: " << strerror(errno);
+}
+
+void CycleCountBackupRestore::ReadFromSRAM()
+{
+ std::string buffer;
+
+ if (!android::base::ReadFileToString(std::string(kCycCntFile), &buffer)) {
+ LOG(ERROR) << "Read cycle counter error: " << strerror(errno);
+ return;
+ }
+
+ buffer = android::base::Trim(buffer);
+
+ if (sscanf(buffer.c_str(), "%d %d %d %d %d %d %d %d",
+ &hw_bins_[0], &hw_bins_[1], &hw_bins_[2], &hw_bins_[3],
+ &hw_bins_[4], &hw_bins_[5], &hw_bins_[6], &hw_bins_[7])
+ != kBucketCount)
+ LOG(ERROR) << "Failed to parse SRAM bins: " << buffer;
+ else
+ LOG(INFO) << "SRAM data: " << buffer;
+}
+
+void CycleCountBackupRestore::SaveToSRAM()
+{
+ char strData[kBuffSize];
+
+ snprintf(strData, kBuffSize, "%d %d %d %d %d %d %d %d",
+ hw_bins_[0], hw_bins_[1], hw_bins_[2], hw_bins_[3],
+ hw_bins_[4], hw_bins_[5], hw_bins_[6], hw_bins_[7]);
+
+ LOG(INFO) << "Save to SRAM: " << strData ;
+
+ if (!android::base::WriteStringToFile(strData, std::string(kCycCntFile)))
+ LOG(ERROR) << "Write data error: " << strerror(errno);
+}
+
+
+void CycleCountBackupRestore::UpdateAndSave()
+{
+ bool backup = false;
+ bool restore = false;
+ for (int i = 0; i < kBucketCount; i++) {
+ if (hw_bins_[i] < sw_bins_[i]) {
+ hw_bins_[i] = sw_bins_[i];
+ restore = true;
+ } else if (hw_bins_[i] > sw_bins_[i]) {
+ sw_bins_[i] = hw_bins_[i];
+ backup = true;
+ }
+ }
+ if (restore)
+ SaveToSRAM();
+ if (backup)
+ SaveToStorage();
+}
+
+} // namespace health
+} // namespace wahoo
+} // namespace google
+} // namespace device
diff --git a/health/CycleCountBackupRestore.h b/health/CycleCountBackupRestore.h
new file mode 100644
index 00000000..e113c323
--- /dev/null
+++ b/health/CycleCountBackupRestore.h
@@ -0,0 +1,54 @@
+/*
+ * 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_HEALTH_CYCLECOUNTBACKUPRESTORE_H
+#define DEVICE_GOOGLE_WAHOO_HEALTH_CYCLECOUNTBACKUPRESTORE_H
+
+#include
+#include
+#include
+#include
+
+namespace device {
+namespace google {
+namespace wahoo {
+namespace health {
+
+static constexpr int kBucketCount = 8;
+
+class CycleCountBackupRestore {
+public:
+ CycleCountBackupRestore();
+ void Restore();
+ void Backup();
+
+private:
+ int sw_bins_[kBucketCount];
+ int hw_bins_[kBucketCount];
+
+ void ReadFromStorage();
+ void SaveToStorage();
+ void ReadFromSRAM();
+ void SaveToSRAM();
+ void UpdateAndSave();
+};
+
+} // namespace health
+} // namespace wahoo
+} // namespace google
+} // namespace device
+
+#endif // #ifndef DEVICE_GOOGLE_WAHOO_HEALTH_CYCLECOUNTBACKUPRESTORE_H
diff --git a/health/HealthService.cpp b/health/HealthService.cpp
new file mode 100644
index 00000000..677ca659
--- /dev/null
+++ b/health/HealthService.cpp
@@ -0,0 +1,178 @@
+/*
+ * 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.health@2.0-service.wahoo"
+#include
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+#include
+#include
+
+#include "CycleCountBackupRestore.h"
+#include "LearnedCapacityBackupRestore.h"
+
+using android::hardware::health::V2_0::StorageInfo;
+using android::hardware::health::V2_0::DiskStats;
+using ::device::google::wahoo::health::CycleCountBackupRestore;
+using ::device::google::wahoo::health::LearnedCapacityBackupRestore;
+
+static constexpr int kBackupTrigger = 20;
+static CycleCountBackupRestore ccBackupRestore;
+static LearnedCapacityBackupRestore lcBackupRestore;
+
+int cycle_count_backup(int battery_level)
+{
+ static int saved_soc = 0;
+ static int soc_inc = 0;
+ static bool is_first = true;
+
+ if (is_first) {
+ is_first = false;
+ saved_soc = battery_level;
+ return 0;
+ }
+
+ if (battery_level > saved_soc) {
+ soc_inc += battery_level - saved_soc;
+ }
+
+ saved_soc = battery_level;
+
+ if (soc_inc >= kBackupTrigger) {
+ ccBackupRestore.Backup();
+ soc_inc = 0;
+ }
+ return 0;
+}
+
+// See : hardware/interfaces/health/2.0/README
+
+void healthd_board_init(struct healthd_config*)
+{
+ ccBackupRestore.Restore();
+ lcBackupRestore.Restore();
+}
+
+int healthd_board_battery_update(struct android::BatteryProperties *props)
+{
+ cycle_count_backup(props->batteryLevel);
+ lcBackupRestore.Backup();
+ return 0;
+}
+
+const char kUFSHealthFile[] = "/sys/kernel/debug/ufshcd0/dump_health_desc";
+const char kUFSHealthVersionFile[] = "/sys/kernel/debug/ufshcd0/show_hba";
+const char kDiskStatsFile[] = "/sys/block/sda/stat";
+const char kUFSName[] = "UFS0";
+
+/*
+ * Implementation based on system/core/storaged/storaged_info.cc
+ */
+void get_storage_info(std::vector& vec_storage_info) {
+ StorageInfo storage_info = {};
+ std::string buffer, version;
+
+ storage_info.attr.isInternal = true;
+ storage_info.attr.isBootDevice = true;
+ storage_info.attr.name = std::string(kUFSName);
+
+ if (!android::base::ReadFileToString(std::string(kUFSHealthVersionFile), &version)) {
+ return;
+ }
+
+ std::vector lines = android::base::Split(version, "\n");
+ if (lines.empty()) {
+ return;
+ }
+
+ char rev[8];
+ if (sscanf(lines[6].c_str(), "hba->ufs_version = 0x%7s\n", rev) < 1) {
+ return;
+ }
+
+ storage_info.version = "ufs " + std::string(rev);
+
+ if (!android::base::ReadFileToString(std::string(kUFSHealthFile), &buffer)) {
+ return;
+ }
+
+ lines = android::base::Split(buffer, "\n");
+ if (lines.empty()) {
+ return;
+ }
+
+ for (size_t i = 1; i < lines.size(); i++) {
+ char token[32];
+ uint16_t val;
+ int ret;
+ if ((ret = sscanf(lines[i].c_str(),
+ "Health Descriptor[Byte offset 0x%*d]: %31s = 0x%hx",
+ token, &val)) < 2) {
+ continue;
+ }
+
+ if (std::string(token) == "bPreEOLInfo") {
+ storage_info.eol = val;
+ } else if (std::string(token) == "bDeviceLifeTimeEstA") {
+ storage_info.lifetimeA = val;
+ } else if (std::string(token) == "bDeviceLifeTimeEstB") {
+ storage_info.lifetimeB = val;
+ }
+ }
+
+ vec_storage_info.resize(1);
+ vec_storage_info[0] = storage_info;
+ return;
+}
+
+/*
+ * Implementation based on parse_disk_stats() in system/core/storaged_diskstats.cpp
+ */
+void get_disk_stats(std::vector& vec_stats) {
+ const size_t kDiskStatsSize = 11;
+ struct DiskStats stats = {};
+
+ stats.attr.isInternal = true;
+ stats.attr.isBootDevice = true;
+ stats.attr.name = std::string(kUFSName);
+
+
+ std::string buffer;
+ if (!android::base::ReadFileToString(std::string(kDiskStatsFile), &buffer)) {
+ LOG(ERROR) << kDiskStatsFile << ": ReadFileToString failed.";
+ return;
+ }
+
+ // Regular diskstats entries
+ std::stringstream ss(buffer);
+ for (uint i = 0; i < kDiskStatsSize; ++i) {
+ ss >> *(reinterpret_cast(&stats) + i);
+ }
+ vec_stats.resize(1);
+ vec_stats[0] = stats;
+
+ return;
+}
+
+int main(void) {
+ return health_service_main();
+}
diff --git a/health/LearnedCapacityBackupRestore.cpp b/health/LearnedCapacityBackupRestore.cpp
new file mode 100644
index 00000000..48fe4610
--- /dev/null
+++ b/health/LearnedCapacityBackupRestore.cpp
@@ -0,0 +1,114 @@
+/*
+ * 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 "LearnedCapacityBackupRestore.h"
+
+namespace device {
+namespace google {
+namespace wahoo {
+namespace health {
+
+static constexpr char kChgFullFile[] = "sys/class/power_supply/bms/charge_full";
+static constexpr char kSysCFPersistFile[] = "/persist/battery/qcom_charge_full";
+static constexpr int kBuffSize = 256;
+
+LearnedCapacityBackupRestore::LearnedCapacityBackupRestore() {}
+
+void LearnedCapacityBackupRestore::Restore() {
+ ReadFromStorage();
+ ReadFromSRAM();
+ UpdateAndSave();
+}
+
+void LearnedCapacityBackupRestore::Backup() {
+ ReadFromSRAM();
+ UpdateAndSave();
+}
+
+void LearnedCapacityBackupRestore::ReadFromStorage() {
+ std::string buffer;
+
+ if (!android::base::ReadFileToString(std::string(kSysCFPersistFile), &buffer)) {
+ LOG(ERROR) << "Cannot read the storage file";
+ return;
+ }
+
+ if (sscanf(buffer.c_str(), "%d", &sw_cap_) < 1)
+ LOG(ERROR) << "data format is wrong in the storage file: " << buffer;
+ else
+ LOG(INFO) << "Storage data: " << buffer;
+}
+
+void LearnedCapacityBackupRestore::SaveToStorage() {
+ char strData[kBuffSize];
+
+ snprintf(strData, kBuffSize, "%d", sw_cap_);
+
+ LOG(INFO) << "Save to Storage: " << strData;
+
+ if (!android::base::WriteStringToFile(strData, std::string(kSysCFPersistFile)))
+ LOG(ERROR) << "Write file error: " << strerror(errno);
+}
+
+void LearnedCapacityBackupRestore::ReadFromSRAM() {
+ std::string buffer;
+
+ if (!android::base::ReadFileToString(std::string(kChgFullFile), &buffer)) {
+ LOG(ERROR) << "Read cycle counter error: " << strerror(errno);
+ return;
+ }
+
+ buffer = android::base::Trim(buffer);
+
+ if (sscanf(buffer.c_str(), "%d", &hw_cap_) < 1)
+ LOG(ERROR) << "Failed to parse SRAM bins: " << buffer;
+ else
+ LOG(INFO) << "SRAM data: " << buffer;
+}
+
+void LearnedCapacityBackupRestore::SaveToSRAM() {
+ char strData[kBuffSize];
+
+ snprintf(strData, kBuffSize, "%d", hw_cap_);
+
+ LOG(INFO) << "Save to SRAM: " << strData;
+
+ if (!android::base::WriteStringToFile(strData, std::string(kChgFullFile)))
+ 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
+} // namespace device
diff --git a/health/LearnedCapacityBackupRestore.h b/health/LearnedCapacityBackupRestore.h
new file mode 100644
index 00000000..13d38e25
--- /dev/null
+++ b/health/LearnedCapacityBackupRestore.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_HEALTH_LEARNEDCAPACITYBACKUPRESTORE_H
+#define DEVICE_GOOGLE_WAHOO_HEALTH_LEARNEDCAPACITYBACKUPRESTORE_H
+
+#include
+#include
+#include
+#include
+
+namespace device {
+namespace google {
+namespace wahoo {
+namespace health {
+
+class LearnedCapacityBackupRestore {
+ public:
+ LearnedCapacityBackupRestore();
+ void Restore();
+ void Backup();
+
+ private:
+ int sw_cap_;
+ int hw_cap_;
+
+ void ReadFromStorage();
+ void SaveToStorage();
+ void ReadFromSRAM();
+ void SaveToSRAM();
+ void UpdateAndSave();
+};
+
+} // namespace health
+} // namespace wahoo
+} // namespace google
+} // namespace device
+
+#endif // #ifndef DEVICE_GOOGLE_WAHOO_HEALTH_LEARNEDCAPACITYBACKUPRESTORE_H
diff --git a/health/android.hardware.health@2.0-service.wahoo.rc b/health/android.hardware.health@2.0-service.wahoo.rc
new file mode 100644
index 00000000..2949265d
--- /dev/null
+++ b/health/android.hardware.health@2.0-service.wahoo.rc
@@ -0,0 +1,5 @@
+service vendor.health-hal-2-0 /vendor/bin/hw/android.hardware.health@2.0-service.wahoo
+ class hal
+ user system
+ group system
+ file /dev/kmsg w
diff --git a/init.hardware.diag.rc.userdebug b/init.hardware.diag.rc.userdebug
index bf9d5568..6977fc63 100644
--- a/init.hardware.diag.rc.userdebug
+++ b/init.hardware.diag.rc.userdebug
@@ -21,18 +21,20 @@ on post-fs-data
# Modem logging collection
mkdir /data/vendor/radio 0777 radio radio
mkdir /data/vendor/radio/diag_logs 0777 system system
+ chmod 777 /data/vendor/radio/diag_logs/cfg
+ chmod 777 /data/vendor/radio/diag_logs/custom_cfg
# WLAN logging collection
mkdir /data/vendor/wifi 0777 system system
mkdir /data/vendor/wifi/cnss_diag 0777 system system
-service diag_mdlog_start /vendor/bin/diag_mdlog
+service vendor.diag_mdlog_start /vendor/bin/diag_mdlog
class late_start
user shell
group system diag media_rw
disabled
oneshot
-service diag_mdlog_stop /vendor/bin/diag_mdlog -k
+service vendor.diag_mdlog_stop /vendor/bin/diag_mdlog -k
class late_start
user shell
group system diag media_rw
@@ -43,49 +45,56 @@ on boot && property:persist.sys.modem.diag.mdlog=*
setprop sys.modem.diag.mdlog ${persist.sys.modem.diag.mdlog}
on property:sys.modem.diag.mdlog=true
- start diag_mdlog_start
+ start vendor.diag_mdlog_start
on property:sys.modem.diag.mdlog=false
- start diag_mdlog_stop
+ start vendor.diag_mdlog_stop
on property:persist.sys.cnss.diag_qxdm=true
- start cnss_diag
+ start vendor.cnss_diag
on property:persist.sys.cnss.diag_qxdm=false
- stop cnss_diag
+ stop vendor.cnss_diag
on property:persist.sys.cnss.diag_txt=true
- start cnss_diag_txt
+ start vendor.cnss_diag_txt
on property:persist.sys.cnss.diag_txt=false
- stop cnss_diag_txt
+ stop vendor.cnss_diag_txt
-service cnss_diag /vendor/bin/cnss_diag -q -u -w
- class late_start
- user system
- group system
- oneshot
-
-service cnss_diag_txt /vendor/bin/cnss_diag -s -f -m /data/vendor/wifi/cnss_diag/cnss_diag.conf
+service vendor.cnss_diag /vendor/bin/cnss_diag -q -u -w
class late_start
user system
group system
disabled
oneshot
-on property:debug.htc.ramdump.crash=true
+service vendor.cnss_diag_txt /vendor/bin/cnss_diag -s -f -m /data/vendor/wifi/cnss_diag/cnss_diag.conf
+ class late_start
+ user system
+ group system
+ disabled
+ oneshot
+
+on property:vendor.debug.ramdump.force_crash=true
write /proc/sysrq-trigger "c"
on property:sys.logger.bluetooth=true
- setprop persist.service.bdroid.snooplog true
- setprop persist.service.bdroid.fwsnoop true
+ setprop persist.vendor.service.bdroid.snooplog true
+ setprop persist.vendor.service.bdroid.fwsnoop true
on property:sys.logger.bluetooth=false
- setprop persist.service.bdroid.snooplog false
- setprop persist.service.bdroid.fwsnoop false
+ setprop persist.vendor.service.bdroid.snooplog false
+ setprop persist.vendor.service.bdroid.fwsnoop false
on property:persist.bluetooth.btsnoopenable=true
- setprop persist.service.bdroid.soclog true
+ setprop persist.vendor.service.bdroid.soclog true
on property:persist.bluetooth.btsnoopenable=false
- setprop persist.service.bdroid.soclog false
+ setprop persist.vendor.service.bdroid.soclog false
+
+on property:vendor.usb.config=*
+ start usbd
+
+on property:persist.vendor.usb.usbradio.config=*
+ start usbd
diff --git a/init.hardware.rc b/init.hardware.rc
index b8f335a7..c6843990 100644
--- a/init.hardware.rc
+++ b/init.hardware.rc
@@ -27,11 +27,10 @@ on charger
# Enable UFS powersaving
write /sys/devices/soc/${ro.boot.bootdevice}/clkscale_enable 1
write /sys/devices/soc/${ro.boot.bootdevice}/clkgate_enable 1
- write /sys/devices/soc/${ro.boot.bootdevice}/hibern8_on_idle_enable 1
write /sys/class/typec/port0/port_type sink
write /sys/module/lpm_levels/parameters/sleep_disabled N
-service charger /charger
+service vendor.charger /charger
class charger
seclabel u:r:charger:s0
@@ -39,13 +38,12 @@ on early-init
mount debugfs debugfs /sys/kernel/debug
chmod 0755 /sys/kernel/debug
# Loading kernel modules in background
- start insmod_sh
+ start vendor.insmod_sh
on init
# Disable UFS powersaving
write /sys/devices/soc/${ro.boot.bootdevice}/clkscale_enable 0
write /sys/devices/soc/${ro.boot.bootdevice}/clkgate_enable 0
- write /sys/devices/soc/${ro.boot.bootdevice}/hibern8_on_idle_enable 0
write /sys/module/lpm_levels/parameters/sleep_disabled Y
# QSEE rpmb listener need symlink for bootdevice
@@ -54,7 +52,7 @@ on init
# start qseecomd early as we mount system/ vendor/ early
# vold needs keymaster that needs qseecomd
- start qseecomd
+ start vendor.qseecomd
# Support legacy paths
symlink /sdcard /mnt/sdcard
@@ -162,6 +160,8 @@ on init
write /proc/sys/vm/page-cluster 0
on fs
+ # Start HW service manager early
+ start hwservicemanager
mount_all /vendor/etc/fstab.${ro.hardware} --early
mkdir /persist/data 0700 system system
@@ -189,21 +189,26 @@ on fs
chmod 0770 /persist/rfs/apq
chmod 0770 /persist/rfs/apq/gnss
chmod 0770 /persist/hlos_rfs
- restorecon_recursive /persist
- # Start HW service manager early
- start hwservicemanager
+ # for android.hardware.health@2.0-service.marlin cycle count backup
+ mkdir /persist/battery 0700 system system
+
+ restorecon_recursive /persist
on late-fs
# Start devices by sysfs trigger
- start devstart_sh
+ start vendor.devstart_sh
# Start services for bootanim
start surfaceflinger
start bootanim
- start hwcomposer-2-1
- start configstore-hal-1-0
- start gralloc-2-0
+ start vendor.hwcomposer-2-1
+ start vendor.configstore-hal
+ start vendor.gralloc-2-0
+ # Wait for hwservicemanager ready since fsck might be triggered in mount_all --late
+ # In such case, init won't responce the property_set from hwservicemanager and then
+ # cause services for bootanim not running.
+ wait_for_prop hwservicemanager.ready true
# Mount RW partitions which need run fsck
mount_all /vendor/etc/fstab.${ro.hardware} --late
@@ -211,7 +216,7 @@ on late-fs
mkdir /persist/time 0770 system system
# Start time daemon early so that the system time can be set early
- start time_daemon
+ start vendor.time_daemon
on post-fs
# set RLIMIT_MEMLOCK to 64MB
@@ -226,7 +231,7 @@ on post-fs
on property:sys.user.0.ce_available=true
mkdir /data/misc_ce/0/ramoops
- start ramoops_sh
+ start vendor.ramoops_sh
on property:sys.ramoops.decrypted=true
mount pstore pstore /sys/fs/pstore
@@ -240,7 +245,7 @@ on property:sys.ramoops.decrypted=true
on property:sys.listeners.registered=true
# load IPA FWs
- start ipastart_sh
+ start vendor.ipastart_sh
on post-fs-data
# We can start netd here before in is launched in common init.rc on zygote-start
@@ -283,8 +288,10 @@ on zygote-start
# Create the directories used by the Wireless subsystem
mkdir /data/misc/wifi 0770 wifi wifi
- mkdir /data/misc/wifi/sockets 0770 wifi wifi
mkdir /data/misc/wifi/wpa_supplicant 0770 wifi wifi
+ mkdir /data/vendor/wifi 0771 wifi wifi
+ mkdir /data/vendor/wifi/wpa 0770 wifi wifi
+ mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi
mkdir /data/misc/dhcp 0770 dhcp dhcp
chown dhcp dhcp /data/misc/dhcp
@@ -385,6 +392,13 @@ on zygote-start
# 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
@@ -418,6 +432,16 @@ on early-boot
chown system system /sys/class/leds/blue/rgb_start
chown system system /sys/class/graphics/fb0/msm_fb_persist_mode
+ # dumpstate needs to read, vendor.health-hal needs to be able to RW
+ chown system system /sys/devices/soc/800f000.qcom,spmi/spmi-0/spmi0-02/800f000.qcom,spmi:qcom,pmi8998@2:qpnp,fg/cycle_counts_bins
+ # HardwareInfo needs to be able to read CC bins
+ chmod 644 /sys/devices/soc/800f000.qcom,spmi/spmi-0/spmi0-02/800f000.qcom,spmi:qcom,pmi8998@2:qpnp,fg/cycle_counts_bins
+
+ # dumpstate needs to read, vendor.health-hal needs to be able to RW
+ chown system system /sys/devices/soc/800f000.qcom,spmi/spmi-0/spmi0-02/800f000.qcom,spmi:qcom,pmi8998@2:qpnp,fg/power_supply/bms/charge_full
+ # HardwareInfo needs to be able to read charge_full
+ chmod 644 /sys/devices/soc/800f000.qcom,spmi/spmi-0/spmi0-02/800f000.qcom,spmi:qcom,pmi8998@2:qpnp,fg/power_supply/bms/charge_full
+
on boot
mkdir /dev/socket/qmux_radio 0770 radio radio
chmod 2770 /dev/socket/qmux_radio
@@ -459,10 +483,6 @@ on boot
# Wifi firmware reload path
chown wifi wifi /sys/module/wlan/parameters/fwpath
- # Allow system to write to cycle_count_id to iterate and get stats
- chown system system /sys/class/power_supply/bms/cycle_count_id
- chmod 0666 /sys/class/power_supply/bms/cycle_count_id
-
# default country code
setprop ro.boot.wificountrycode 00
@@ -479,39 +499,39 @@ on boot
# ftm4 VR mode
chown system system /sys/devices/virtual/input/ftm4_touch/vrmode
-service init-elabel-sh /system/bin/init.elabel.sh
+service vendor.init-elabel-sh /system/bin/init.elabel.sh
class late_start
user system
group system
oneshot
-service init-radio-sh /vendor/bin/init.radio.sh
+service vendor.init-radio-sh /vendor/bin/init.radio.sh
class late_start
user radio
group root radio
oneshot
-service folio_daemon /system/bin/folio_daemon
+service vendor.folio_daemon /system/bin/folio_daemon
class late_start
user system
group system
+ disabled
-service perfd /vendor/bin/perfd
- class main
- user root
- group root readproc system
- socket perfd seqpacket 0666 root system
- disabled
+on property:init.svc.zygote=running
+ start vendor.folio_daemon
-service thermal-engine /vendor/bin/thermal-engine -c ${sys.qcom.thermalcfg:-/vendor/etc/thermal-engine.conf}
- class main
+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}
+ class hal
user root
group root system diag
socket thermal-send-client stream 0666 system system
socket thermal-recv-client stream 0660 system system
socket thermal-recv-passive-client stream 0666 system system
-service msm_irqbalance /vendor/bin/msm_irqbalance -f /vendor/etc/msm_irqbalance.conf
+service vendor.msm_irqbalance /vendor/bin/msm_irqbalance -f /vendor/etc/msm_irqbalance.conf
socket msm_irqbalance seqpacket 660 root system
class core
user root
@@ -519,53 +539,52 @@ service msm_irqbalance /vendor/bin/msm_irqbalance -f /vendor/etc/msm_irqbalance.
writepid /dev/cpuset/system-background/tasks
on property:persist.sys.ssr.restart_level=*
- start ssr_setup
+ start vendor.ssr_setup
-service ssr_setup /vendor/bin/ssr_setup
+service vendor.ssr_setup /vendor/bin/ssr_setup
oneshot
disabled
-service ssr_diag /vendor/bin/ssr_diag
+service vendor.ssr_diag /vendor/bin/ssr_diag
class late_start
user system
group system
disabled
-service per_mgr /vendor/bin/pm-service
+service vendor.per_mgr /vendor/bin/pm-service
class core
user system
group system
ioprio rt 4
shutdown critical
-service per_proxy /vendor/bin/pm-proxy
+service vendor.per_proxy /vendor/bin/pm-proxy
class core
user system
group system
disabled
on property:sys.post_boot.parsed=1
- start perfd
+ # 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
on property:sys.boot_completed=1
# Enable power setting and set sys.post_boot.parsed to 1
- # to start perfd
- start power_sh
+ start vendor.power_sh
# Enable UFS powersaving
write /sys/devices/soc/${ro.boot.bootdevice}/clkscale_enable 1
write /sys/devices/soc/${ro.boot.bootdevice}/clkgate_enable 1
- write /sys/devices/soc/${ro.boot.bootdevice}/hibern8_on_idle_enable 1
write /sys/module/lpm_levels/parameters/sleep_disabled N
- # Enable ZRAM on boot_complete
- swapon_all /vendor/etc/fstab.${ro.hardware}
-
# Setup final cpuset
write /dev/cpuset/top-app/cpus 0-7
write /dev/cpuset/foreground/cpus 0-3,6-7
write /dev/cpuset/background/cpus 0-1
write /dev/cpuset/system-background/cpus 0-3
+ write /dev/cpuset/restricted/cpus 0-3
# Update DVR cpusets to runtime values.
write /dev/cpuset/kernel/cpus 2,3
@@ -578,7 +597,7 @@ on property:sys.boot_completed=1
# UFS health
chmod 755 /sys/kernel/debug/ufshcd0
- chown 644 /sys/kernel/debug/ufshcd0/err_state
+ chmod 644 /sys/kernel/debug/ufshcd0/err_state
chmod 644 /sys/kernel/debug/ufshcd0/power_mode
chmod 644 /sys/kernel/debug/ufshcd0/host_regs
chmod 644 /sys/kernel/debug/ufshcd0/show_hba
@@ -589,26 +608,43 @@ on property:sys.boot_completed=1
chmod 644 /sys/kernel/debug/ufshcd0/stats/query_stats
chmod 644 /sys/kernel/debug/ufshcd0/stats/err_stats
-on property:init.svc.per_mgr=running
- start per_proxy
+ # QCOM FG SRAM dump for dumpstate
+ chown system system /d/fg/sram/data
+ chown system system /d/fg/sram/count
+ chown system system /d/fg/sram/address
+
+ # com.google.android.hardwareinfo needs to be able to read cycle counts
+ chmod 0666 /sys/class/power_supply/bms/cycle_count_id
+
+ trigger sys-boot-completed-set
+
+# We want one opportunity per boot to enable zram, so we
+# use a trigger we fire from the above stanza. If
+# persist.sys.zram_enabled becomes true after boot,
+# 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}
+
+on property:init.svc.vendor.per_mgr=running
+ start vendor.per_proxy
on shutdown
- stop per_proxy
+ stop vendor.per_proxy
# Disable subsystem restart
write /sys/module/subsystem_restart/parameters/disable_restart_work 0x9889deed
-service qseecomd /vendor/bin/qseecomd
+service vendor.qseecomd /vendor/bin/qseecomd
class core
user root
group root
shutdown critical
-service time_daemon /vendor/bin/time_daemon
+service vendor.time_daemon /vendor/bin/time_daemon
class core
user root
group root
-service ss_ramdump /vendor/bin/subsystem_ramdump
+service vendor.ss_ramdump /vendor/bin/subsystem_ramdump
class main
user root
group root system
@@ -618,12 +654,12 @@ on property:persist.sys.ssr.enable_ramdumps=1
write /sys/module/subsystem_restart/parameters/enable_ramdumps 1
mkdir /data/vendor/ssrdump 771 root system
mkdir /data/vendor/ramdump 771 root system
- start ss_ramdump
+ start vendor.ss_ramdump
on property:persist.sys.ssr.enable_ramdumps=0
write /sys/module/subsystem_restart/parameters/enable_ramdumps 0
-service sensors /vendor/bin/sensors.qcom
+service vendor.sensors /vendor/bin/sensors.qcom
class core
user system
group system
@@ -631,55 +667,53 @@ service sensors /vendor/bin/sensors.qcom
# register QMI services
capabilities NET_BIND_SERVICE
-service adsprpcd /vendor/bin/adsprpcd
+service vendor.adsprpcd /vendor/bin/adsprpcd
class main
user media
group media
-service irsc_util /vendor/bin/irsc_util "/vendor/etc/sec_config"
+service vendor.irsc_util /vendor/bin/irsc_util "/vendor/etc/sec_config"
class core
user root
oneshot
-service rmt_storage /vendor/bin/rmt_storage
+service vendor.rmt_storage /vendor/bin/rmt_storage
class core
user root
ioprio rt 0
shutdown critical
-service tftp_server /vendor/bin/tftp_server
+service vendor.tftp_server /vendor/bin/tftp_server
class core
user root
group root system
service wpa_supplicant /vendor/bin/hw/wpa_supplicant \
- -ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf \
- -I/vendor/etc/wifi/p2p_supplicant_overlay.conf -N \
- -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
- -I/vendor/etc/wifi/wpa_supplicant_overlay.conf \
- -O/data/misc/wifi/sockets -puse_p2p_group_interface=1 -dd \
+ -O/data/vendor/wifi/wpa/sockets -puse_p2p_group_interface=1 -dd \
-g@android:wpa_wlan0
# we will start as root and wpa_supplicant will switch to user wifi
# after setting up the capabilities required for WEXT
# user wifi
# group wifi inet keystore
+ interface android.hardware.wifi.supplicant@1.0::ISupplicant default
+ interface android.hardware.wifi.supplicant@1.1::ISupplicant default
class main
socket wpa_wlan0 dgram 660 wifi wifi
disabled
oneshot
-service cnss-daemon /vendor/bin/cnss-daemon -n -l
+service vendor.cnss-daemon /vendor/bin/cnss-daemon -n -l
class late_start
user system
group system inet wifi
-service imsqmidaemon /vendor/bin/imsqmidaemon
+service vendor.imsqmidaemon /vendor/bin/imsqmidaemon
class main
user system
socket ims_qmid stream 0660 system radio
group radio log diag
-service imsdatadaemon /vendor/bin/imsdatadaemon
+service vendor.imsdatadaemon /vendor/bin/imsdatadaemon
class main
user system
socket ims_datad stream 0660 system radio
@@ -687,81 +721,80 @@ service imsdatadaemon /vendor/bin/imsdatadaemon
disabled
on property:vendor.ims.QMI_DAEMON_STATUS=1
- start imsdatadaemon
+ start vendor.imsdatadaemon
-service ims_rtp_daemon /vendor/bin/ims_rtp_daemon
+service vendor.ims_rtp_daemon /vendor/bin/ims_rtp_daemon
class main
user system
group radio diag inet log
disabled
-service imsrcsservice /vendor/bin/imsrcsd
+service vendor.imsrcsservice /vendor/bin/imsrcsd
class hal
user system
group radio diag inet log
disabled
on property:vendor.ims.DATA_DAEMON_STATUS=1
- start ims_rtp_daemon
- start imsrcsservice
+ start vendor.ims_rtp_daemon
+ start vendor.imsrcsservice
-#TODO evaluate group system once b/62571088 is resolved
-service cnd /vendor/bin/cnd
+service vendor.cnd /vendor/bin/cnd
class main
- user system
+ user radio
group inet system wifi radio wakelock
-service netmgrd /vendor/bin/netmgrd
+service vendor.netmgrd /vendor/bin/netmgrd
class main
user root
group root wifi wakelock radio inet
-service port-bridge /vendor/bin/port-bridge
+service vendor.port-bridge /vendor/bin/port-bridge
class main
user radio
group radio system inet
oneshot
-service ipacm /vendor/bin/ipacm
+service vendor.ipacm /vendor/bin/ipacm
class main
user radio
group radio inet
-service qti /vendor/bin/qti
+service vendor.qti /vendor/bin/qti
class main
user radio
group radio net_raw diag usb net_admin
on property:wc_transport.start_hci=true
- start hci_filter
+ start vendor.hci_filter
on property:wc_transport.start_hci=false
- stop hci_filter
+ stop vendor.hci_filter
-service hci_filter /vendor/bin/wcnss_filter
+service vendor.hci_filter /vendor/bin/wcnss_filter
class late_start
user bluetooth
group bluetooth diag system wakelock
disabled
-service loc_launcher /vendor/bin/loc_launcher
+service vendor.loc_launcher /vendor/bin/loc_launcher
class late_start
group gps inet diag wifi
-service pd_mapper /vendor/bin/pd-mapper
+service vendor.pd_mapper /vendor/bin/pd-mapper
class core
-service atfwd /vendor/bin/ATFWD-daemon
+service vendor.atfwd /vendor/bin/ATFWD-daemon
class late_start
user system
group system radio
disabled
on property:persist.radio.atfwd.start=true
- start atfwd
+ start vendor.atfwd
on property:persist.radio.atfwd.start=false
- stop atfwd
+ stop vendor.atfwd
# b/68982314
on property:sys.uidcpupower=*
@@ -778,45 +811,81 @@ service bugreport /system/bin/dumpstate -d -p -B -z \
oneshot
keycodes 114 115 116
-service chre /vendor/bin/chre
+service vendor.chre /vendor/bin/chre
class late_start
user system
group system
socket chre seqpacket 0660 root system
shutdown critical
-service power_sh /vendor/bin/init.power.sh
+service vendor.power_sh /vendor/bin/init.power.sh
class main
user root
group root system
disabled
oneshot
-service devstart_sh /vendor/bin/init.qcom.devstart.sh
+service vendor.devstart_sh /vendor/bin/init.qcom.devstart.sh
class main
user root
group root system
disabled
oneshot
-service ipastart_sh /vendor/bin/init.qcom.ipastart.sh
+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
group net_admin
disabled
oneshot
-service insmod_sh /vendor/bin/init.insmod.sh
+service vendor.insmod_sh /vendor/bin/init.insmod.sh
class main
user root
group root system
disabled
oneshot
-service ramoops_sh /system/bin/init.ramoops.sh
+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
+ write /sys/module/vdso/parameters/enable_64 1
+
+on property:sys.vdso=false
+ write /sys/module/vdso/parameters/enable_32 0
+ write /sys/module/vdso/parameters/enable_64 0
+
+on property:sys.vdso=64
+ write /sys/module/vdso/parameters/enable_32 0
+
+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
+
+# system will not set the sys.retaildemo.enabled to 0 but this is used to set back to default charging
+on property:sys.retaildemo.enabled=0
+ setprop persist.vendor.charge.stop.level 100
+ setprop persist.vendor.charge.start.level 0
diff --git a/init.hardware.usb.rc b/init.hardware.usb.rc
index c134dd58..09ae4d53 100644
--- a/init.hardware.usb.rc
+++ b/init.hardware.usb.rc
@@ -16,8 +16,8 @@
on early-boot
mount configfs none /config
- mkdir /config/usb_gadget/g1 0770 shell shell
- mkdir /config/usb_gadget/g1/strings/0x409 0770 shell shell
+ mkdir /config/usb_gadget/g1 0770
+ mkdir /config/usb_gadget/g1/strings/0x409 0770
write /config/usb_gadget/g1/bcdUSB 0x0200
write /config/usb_gadget/g1/idVendor 0x18d1
write /config/usb_gadget/g1/bcdDevice 0x0440
@@ -30,6 +30,7 @@ on early-boot
mkdir /config/usb_gadget/g1/functions/midi.gs5
mkdir /config/usb_gadget/g1/functions/ffs.adb
mkdir /config/usb_gadget/g1/functions/ffs.mtp
+ mkdir /config/usb_gadget/g1/functions/ffs.ptp
mkdir /config/usb_gadget/g1/functions/diag.diag
mkdir /config/usb_gadget/g1/functions/cser.dun.0
mkdir /config/usb_gadget/g1/functions/cser.nmea.1
@@ -37,16 +38,16 @@ on early-boot
mkdir /config/usb_gadget/g1/functions/gsi.rndis
mkdir /config/usb_gadget/g1/functions/qdss.qdss
mkdir /config/usb_gadget/g1/configs/b.1 0770
- mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell
+ mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770
write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1
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
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
- setprop sys.usb.ffs.max_write 524288
- setprop sys.usb.ffs.max_read 524288
+ mount functionfs ptp /dev/usb-ffs/ptp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1
setprop sys.usb.mtp.device_type 3
setprop sys.usb.controller "a800000.dwc3"
write /sys/module/libcomposite/parameters/disable_l1_for_hs "y"
diff --git a/init.power.sh b/init.power.sh
index 3dc650d0..949eae70 100755
--- a/init.power.sh
+++ b/init.power.sh
@@ -18,7 +18,6 @@ for cpubw in /sys/class/devfreq/*qcom,cpubw*
do
write $cpubw/governor "bw_hwmon"
write $cpubw/polling_interval 50
- write $cpubw/min_freq 1525
write $cpubw/bw_hwmon/mbps_zones "3143 5859 11863 13763"
write $cpubw/bw_hwmon/sample_ms 4
write $cpubw/bw_hwmon/io_percent 34
@@ -35,12 +34,12 @@ done
write /sys/class/devfreq/soc:qcom,mincpubw/governor "cpufreq"
# Enable memlat governor
-for memlat in /sys/class/devfreq/*qcom,memlat-cpu*
-do
- write $memlat/governor "mem_latency"
- write $memlat/polling_interval 10
- write $memlat/mem_latency/ratio_ceil 400
-done
+#for memlat in /sys/class/devfreq/*qcom,memlat-cpu*
+#do
+# write $memlat/governor "mem_latency"
+# write $memlat/polling_interval 10
+# write $memlat/mem_latency/ratio_ceil 400
+#done
# Signal perfd that boot has completed
setprop sys.post_boot.parsed 1
diff --git a/init.qcom.wlan.sh b/init.qcom.wlan.sh
new file mode 100644
index 00000000..78587015
--- /dev/null
+++ b/init.qcom.wlan.sh
@@ -0,0 +1,6 @@
+#! /vendor/bin/sh
+
+wlan_driver_version=`cat /sys/kernel/wifi/wlan/driver_version`
+setprop sys.wlan.driver.version "$wlan_driver_version"
+wlan_fw_version=`cat /sys/kernel/wifi/wlan/fw/0/version`
+setprop sys.wlan.firmware.version "$wlan_fw_version"
diff --git a/liblight/lights.c b/liblight/lights.c
index c2de6d34..d5717488 100644
--- a/liblight/lights.c
+++ b/liblight/lights.c
@@ -39,8 +39,6 @@
#define LIGHTS_SUPPORT_BATTERY 0
#define CG_COLOR_ID_PROPERTY "ro.boot.hardware.color"
-#define LP_MODE_BRIGHTNESS_PROPERTY "sys.display.low_persistence_mode_brightness"
-
static pthread_once_t g_init = PTHREAD_ONCE_INIT;
static pthread_mutex_t g_lock = PTHREAD_MUTEX_INITIALIZER;
static struct light_state_t g_notification;
@@ -196,12 +194,6 @@ set_light_backlight(struct light_device_t* dev,
ALOGE("%s: Failed to write to %s: %s\n", __FUNCTION__, PERSISTENCE_FILE,
strerror(errno));
}
- if (lpEnabled != 0) {
- // Try to get the brigntess though property, otherwise it will
- // set the default brightness, which is defined in BoardConfig.mk.
- brightness = property_get_int32(LP_MODE_BRIGHTNESS_PROPERTY,
- DEFAULT_LOW_PERSISTENCE_MODE_BRIGHTNESS);
- }
}
g_last_backlight_mode = state->brightnessMode;
diff --git a/libtango_device2.jar b/libtango_device2.jar
deleted file mode 100644
index 36d86087..00000000
Binary files a/libtango_device2.jar and /dev/null differ
diff --git a/lisa/board.json b/lisa/board.json
new file mode 100644
index 00000000..65d7777c
--- /dev/null
+++ b/lisa/board.json
@@ -0,0 +1,41 @@
+{
+ "board" : {
+ "cores" : [
+ "a53", "a53", "a53", "a53",
+ "a72", "a72", "a72", "a72"
+ ],
+ "big_core" : "a72",
+ "modules" : ["bl", "cpufreq"]
+ },
+ "nrg_model" : {
+ "little" : {
+ "cpu" : {
+ "nrg_max" : 201,
+ "cap_max" : 438
+ },
+ "cluster" : {
+ "nrg_max" : 66
+ }
+ },
+ "big": {
+ "cpu" : {
+ "nrg_max" : 1138,
+ "cap_max" : 1024
+ },
+ "cluster" : {
+ "nrg_max" : 203
+ }
+ }
+ },
+
+ "update-config" : {
+ "kernel" : {
+ "build-script" : "update-script.sh kernel build",
+ "flash-script" : "update-script.sh kernel flash"
+ },
+ "all" : {
+ "build-script" : "update-script.sh all build",
+ "flash-script" : "update-script.sh all flash"
+ }
+ }
+}
diff --git a/lisa/update-script.sh b/lisa/update-script.sh
new file mode 100755
index 00000000..6255dae7
--- /dev/null
+++ b/lisa/update-script.sh
@@ -0,0 +1,111 @@
+#!/bin/bash
+
+build_kernel() {
+ echo "==========Building kernel image=========="
+ cd $ANDROID_BUILD_TOP
+ source build/envsetup.sh
+ lunch walleye-userdebug
+ cd $LOCAL_KERNEL_HOME
+ . ./build.config
+ make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} ${DEFCONFIG}
+ make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} -j32
+ cp $LOCAL_KERNEL_HOME/arch/arm64/boot/Image.lz4-dtb arch/arm64/boot/dtbo.img `find . -name '*.ko'` $ANDROID_BUILD_TOP/device/google/wahoo-kernel
+}
+
+build_image() {
+ cd $ANDROID_BUILD_TOP
+ source build/envsetup.sh
+ lunch walleye-userdebug
+ if [ "$1" = "bootimage" ]; then
+ echo "==========Building bootimage=========="
+ make -j32 vendorimage-nodeps
+ make -j32 vbmetaimage-nodeps
+ make -j32 bootimage
+ else
+ echo "==========Building complete image=========="
+ make -j32
+ fi
+}
+
+wait_for_fastboot() {
+ # wait for device to enter fastboot, max wait is 200secs
+ local i=0
+ while [ $i -lt 100 ]
+ do
+ if [ -n "`fastboot devices`" ]; then
+ break
+ else
+ sleep 2
+ i=$((i+1))
+ fi
+ done
+}
+
+flash_android() {
+ # reboot the device if it's online
+ if [ "`adb devices`" != "List of devices attached" ]; then
+ echo "==========Rebooting the device into fastboot=========="
+ adb reboot bootloader
+ fi
+
+ echo "==========Waiting for device to enter fastboot=========="
+ wait_for_fastboot
+
+ if [ -z "`fastboot devices`" ]; then
+ echo "==========Device failed to enter fastboot=========="
+ exit
+ fi
+
+ # flash the device
+ if [ "$1" = "bootimage" ]; then
+ echo "==========Flashing bootimage=========="
+ fastboot flash vbmeta
+ fastboot flash vendor
+ fastboot flash boot
+ fastboot reboot
+ else
+ echo "==========Flashing complete image=========="
+ fastboot flashall
+ fi
+
+ echo "==========Waiting for device to come online=========="
+ # wait for device to boot
+ adb wait-for-device
+}
+
+# check input parameters
+if [ "$1" != "kernel" ] && [ "$1" != "all" ]; then
+ echo "First parameter \"$1\" is invalid. Should be \"kernel\" or \"all\"."
+ exit
+fi
+
+if [ "$2" != "build" ] && [ "$2" != "flash" ]; then
+ echo "Second parameter \"$2\" is invalid. Should be \"build\" or \"flash\"."
+ exit
+fi
+
+if [ -z "$ANDROID_BUILD_TOP" ]; then
+ echo "ANDROID_BUILD_TOP environment variable is not set."
+ exit
+fi
+
+if [ -z "$LOCAL_KERNEL_HOME" ]; then
+ echo "LOCAL_KERNEL_HOME environment variable is not set."
+ exit
+fi
+
+if [ "$2" = "build" ]; then
+ build_kernel
+ if [ "$1" = "kernel" ]; then
+ build_image bootimage
+ else
+ build_image
+ fi
+else
+ if [ "$1" = "kernel" ]; then
+ flash_android bootimage
+ else
+ flash_android
+ fi
+fi
+
diff --git a/manifest.xml b/manifest.xml
index 3466562d..2409a728 100644
--- a/manifest.xml
+++ b/manifest.xml
@@ -2,7 +2,7 @@
android.hardware.audio
hwbinder
- 2.0
+ 4.0
IDevicesFactory
default
@@ -11,7 +11,7 @@
android.hardware.audio.effect
hwbinder
- 2.0
+ 4.0
IEffectsFactory
default
@@ -65,7 +65,7 @@
android.hardware.configstore
hwbinder
- 1.0
+ 1.1
ISurfaceFlingerConfigs
default
@@ -83,19 +83,19 @@
android.hardware.drm
hwbinder
- 1.1
+ 1.0
ICryptoFactory
default
- widevine
- clearkey
IDrmFactory
default
- widevine
- clearkey
+ @1.1::ICryptoFactory/clearkey
+ @1.1::IDrmFactory/clearkey
+ @1.1::ICryptoFactory/widevine
+ @1.1::IDrmFactory/widevine
android.hardware.dumpstate
@@ -151,6 +151,15 @@
default
+
+ android.hardware.health
+ hwbinder
+ 2.0
+
+ IHealth
+ default
+
+
android.hardware.keymaster
hwbinder
@@ -191,15 +200,6 @@
default
-
- android.hardware.neuralnetworks
- hwbinder
- 1.0
-
- IDevice
- hvx
-
-
android.hardware.nfc
hwbinder
@@ -221,7 +221,7 @@
android.hardware.power
hwbinder
- 1.1
+ 1.2
IPower
default
@@ -270,7 +270,7 @@
android.hardware.soundtrigger
hwbinder
- 2.0
+ 2.1
ISoundTriggerHw
default
@@ -324,7 +324,7 @@
android.hardware.vibrator
hwbinder
- 1.1
+ 1.2
IVibrator
default
@@ -351,34 +351,34 @@
android.hardware.wifi
hwbinder
- 1.1
+ 1.2
IWifi
default
- android.hardware.wifi.supplicant
+ android.hardware.wifi.hostapd
hwbinder
1.0
+
+ IHostapd
+ default
+
+
+
+ android.hardware.wifi.supplicant
+ hwbinder
+ 1.1
ISupplicant
default
-
- android.hardware.wifi.offload
- hwbinder
- 1.0
-
- IOffload
- default
-
-
com.qualcomm.qti.ims.radio
hwbinder
- 1.0
+ 1.1
IImsRadio
imsradio0
@@ -418,13 +418,11 @@
IQcRilAudio
slot1
- slot2
com.quicinc.cne.server
hwbinder
-
1.0
IServer
@@ -434,20 +432,10 @@
com.quicinc.cne.api
hwbinder
-
1.0
IApiService
cnd
-
- vendor.qti.atcmdfwd
- hwbinder
- 1.0
-
- IAtCmdFwd
- AtCmdFwdService
-
-
diff --git a/media_codecs_performance.xml b/media_codecs_performance.xml
index 7f1b2545..d496f912 100644
--- a/media_codecs_performance.xml
+++ b/media_codecs_performance.xml
@@ -1,5 +1,5 @@
-
-
+
-
-
-
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
+
+
+
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
-
+
+
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
+
-
-
-
-
-
+
+
+
-
-
-
-
+
+
+
+
+
diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml
index fd3a0ad3..5f42508a 100755
--- a/overlay/frameworks/base/core/res/res/values/config.xml
+++ b/overlay/frameworks/base/core/res/res/values/config.xml
@@ -66,6 +66,13 @@
true
+
+
+ - 0
+ - 1
+ - 2
+
+
true
@@ -229,7 +236,7 @@
- true
+ true
true
@@ -243,9 +250,6 @@
true
-
- true
-
true
@@ -298,18 +302,6 @@
rmem_min,rmem_def,rmem_max,wmem_min,wmem_def,wmem_max -->
524288,2097152,8388608,262144,524288,4194304
-
- 1
-
-
- 100
-
-
- 250
-
-
- 3800
-
6
@@ -325,13 +317,13 @@
- "/system/framework/arm64/boot-framework.oat"
- - "/system/framework/arm64/boot-framework.vdex"
+ - "/system/framework/boot-framework.vdex"
- "/system/framework/oat/arm64/services.odex"
- "/system/framework/oat/arm64/services.vdex"
- "/system/framework/arm64/boot.oat"
- - "/system/framework/arm64/boot.vdex"
+ - "/system/framework/boot.vdex"
- "/system/framework/arm64/boot-core-libart.oat"
- - "/system/framework/arm64/boot-core-libart.vdex"
+ - "/system/framework/boot-core-libart.vdex"
@@ -347,5 +339,6 @@
true
- com.google.android.GoogleCamera:com.google.intelligence.sense
+ com.google.android.gms:com.google.android.GoogleCamera:com.google.intelligence.sense:com.google.android.settings.intelligence
+
diff --git a/overlay/packages/apps/Bluetooth/res/values/config.xml b/overlay/packages/apps/Bluetooth/res/values/config.xml
index e4031055..6db14c05 100644
--- a/overlay/packages/apps/Bluetooth/res/values/config.xml
+++ b/overlay/packages/apps/Bluetooth/res/values/config.xml
@@ -29,5 +29,4 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
true
- true
diff --git a/overlay/packages/services/Telephony/res/values/config.xml b/overlay/packages/services/Telephony/res/values/config.xml
index 29ef7ce5..297ef385 100644
--- a/overlay/packages/services/Telephony/res/values/config.xml
+++ b/overlay/packages/services/Telephony/res/values/config.xml
@@ -21,4 +21,9 @@
true
true
+
+ true
diff --git a/p2p_supplicant_overlay.conf b/p2p_supplicant_overlay.conf
index b5e89e03..b8902bf9 100644
--- a/p2p_supplicant_overlay.conf
+++ b/p2p_supplicant_overlay.conf
@@ -1,2 +1,3 @@
disable_scan_offload=1
p2p_no_group_iface=1
+p2p_go_vht=1
diff --git a/permissions/privapp-permissions-aosp_wahoo.xml b/permissions/privapp-permissions-aosp_wahoo.xml
new file mode 100644
index 00000000..1fe50a34
--- /dev/null
+++ b/permissions/privapp-permissions-aosp_wahoo.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/power-libperfmgr/Android.bp b/power-libperfmgr/Android.bp
new file mode 100644
index 00000000..8deca675
--- /dev/null
+++ b/power-libperfmgr/Android.bp
@@ -0,0 +1,37 @@
+//
+// Copyright (C) 2018 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+cc_binary {
+ name: "android.hardware.power@1.2-service.wahoo-libperfmgr",
+ relative_install_path: "hw",
+ init_rc: ["android.hardware.power@1.2-service.wahoo-libperfmgr.rc"],
+ srcs: ["service.cpp", "Power.cpp", "InteractionHandler.cpp", "power-helper.c"],
+ cflags: [
+ "-Wall",
+ "-Werror",
+ ],
+ shared_libs: [
+ "libbase",
+ "libhidlbase",
+ "libhidltransport",
+ "liblog",
+ "libutils",
+ "libcutils",
+ "android.hardware.power@1.0",
+ "android.hardware.power@1.1",
+ "android.hardware.power@1.2",
+ "libperfmgr",
+ ],
+ proprietary: true,
+}
diff --git a/power/InteractionHandler.cpp b/power-libperfmgr/InteractionHandler.cpp
similarity index 87%
rename from power/InteractionHandler.cpp
rename to power-libperfmgr/InteractionHandler.cpp
index ac00514f..b8ce3ef1 100644
--- a/power/InteractionHandler.cpp
+++ b/power-libperfmgr/InteractionHandler.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017 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.
@@ -16,7 +16,7 @@
//#define LOG_NDEBUG 0
-#define LOG_TAG "PowerInteractionHandler"
+#define LOG_TAG "android.hardware.power@1.2-service.wahoo-libperfmgr"
#define ATRACE_TAG (ATRACE_TAG_POWER | ATRACE_TAG_HAL)
#include
@@ -28,11 +28,6 @@
#include
#include "InteractionHandler.h"
-#include "power-common.h"
-#include "power-helper.h"
-#include "powerhintparser.h"
-#include "hint-data.h"
-#include "utils.h"
#define FB_IDLE_PATH "/sys/class/graphics/fb0/idle_state"
#define MAX_LENGTH 64
@@ -40,12 +35,13 @@
#define MSINSEC 1000L
#define USINMS 1000000L
-InteractionHandler::InteractionHandler()
+InteractionHandler::InteractionHandler(std::shared_ptr const & hint_manager)
: mState(INTERACTION_STATE_UNINITIALIZED),
mWaitMs(100),
mMinDurationMs(1400),
mMaxDurationMs(5650),
- mDurationMs(0) {
+ mDurationMs(0),
+ mHintManager(hint_manager) {
}
InteractionHandler::~InteractionHandler() {
@@ -95,22 +91,18 @@ void InteractionHandler::Exit() {
}
void InteractionHandler::PerfLock() {
- int *resource_values;
- int num_resources;
-
- resource_values = getPowerhint(INTERACTION_HINT_ID, &num_resources);
- if (resource_values != NULL) {
- ALOGV("%s: acquiring perf lock", __func__);
- perform_hint_action(INTERACTION_HINT_ID,
- resource_values, num_resources);
-
- ATRACE_INT("interaction_lock", 1);
+ 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__);
- undo_hint_action(INTERACTION_HINT_ID);
+ if (!mHintManager->EndHint("INTERACTION")) {
+ ALOGE("%s: end hint INTERACTION failed", __func__);
+ }
ATRACE_INT("interaction_lock", 0);
}
@@ -123,12 +115,6 @@ long long InteractionHandler::CalcTimespecDiffMs(struct timespec start,
}
void InteractionHandler::Acquire(int32_t duration) {
- if (is_perf_hint_active(SUSTAINED_PERF_HINT_ID) ||
- is_perf_hint_active(VR_MODE_HINT_ID)) {
- ALOGV("%s: ignoring due to other active perf hints", __func__);
- return;
- }
-
ATRACE_CALL();
std::lock_guard lk(mLock);
diff --git a/power/InteractionHandler.h b/power-libperfmgr/InteractionHandler.h
similarity index 86%
rename from power/InteractionHandler.h
rename to power-libperfmgr/InteractionHandler.h
index 8b5aebc9..893c72f0 100644
--- a/power/InteractionHandler.h
+++ b/power-libperfmgr/InteractionHandler.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017 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.
@@ -21,6 +21,10 @@
#include
#include
+#include
+
+using ::android::perfmgr::HintManager;
+
enum interaction_state {
INTERACTION_STATE_UNINITIALIZED,
INTERACTION_STATE_IDLE,
@@ -29,7 +33,7 @@ enum interaction_state {
};
struct InteractionHandler {
- InteractionHandler();
+ InteractionHandler(std::shared_ptr const & hint_manager);
~InteractionHandler();
bool Init();
void Exit();
@@ -61,7 +65,7 @@ struct InteractionHandler {
std::unique_ptr mThread;
std::mutex mLock;
std::condition_variable mCond;
+ std::shared_ptr mHintManager;
};
#endif //INTERACTIONHANDLER_H
-
diff --git a/power-libperfmgr/Power.cpp b/power-libperfmgr/Power.cpp
new file mode 100644
index 00000000..c0fadac3
--- /dev/null
+++ b/power-libperfmgr/Power.cpp
@@ -0,0 +1,542 @@
+/*
+ * 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
+#include
+#include
+#include
+#include
+
+#include
+
+#include
+#include
+
+#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 Power::setInteractive(bool /* interactive */) {
+ return Void();
+}
+
+Return 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 Power::setFeature(Feature /*feature*/, bool /*activate*/) {
+ //Nothing to do
+ return Void();
+}
+
+Return Power::getPlatformLowPowerStats(getPlatformLowPowerStats_cb _hidl_cb) {
+
+ hidl_vec 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(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(¤tState) != 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 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 Power::getSubsystemLowPowerStats(getSubsystemLowPowerStats_cb _hidl_cb) {
+ hidl_vec 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 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 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 (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(hint), data);
+ }
+ return Void();
+}
+
+constexpr const char* boolToString(bool b) {
+ return b ? "true" : "false";
+}
+
+Return Power::debug(const hidl_handle& handle, const hidl_vec&) {
+ 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/Power.h b/power-libperfmgr/Power.h
similarity index 55%
rename from power/Power.h
rename to power-libperfmgr/Power.h
index 9d4f79fd..a39323f2 100644
--- a/power/Power.h
+++ b/power-libperfmgr/Power.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017 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,54 +14,70 @@
* limitations under the License.
*/
-#ifndef ANDROID_HARDWARE_POWER_V1_1_POWER_H
-#define ANDROID_HARDWARE_POWER_V1_1_POWER_H
+#ifndef ANDROID_HARDWARE_POWER_V1_2_POWER_H
+#define ANDROID_HARDWARE_POWER_V1_2_POWER_H
-#include
+#include
+
+#include
#include
#include
-#include
+#include
#include "InteractionHandler.h"
namespace android {
namespace hardware {
namespace power {
-namespace V1_1 {
+namespace V1_2 {
namespace implementation {
using ::android::hardware::power::V1_0::Feature;
-using ::android::hardware::power::V1_0::PowerHint;
-using ::android::hardware::power::V1_1::IPower;
+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 setInteractive(bool interactive) override;
- Return powerHint(PowerHint hint, int32_t data) override;
+ Return setInteractive(bool /* interactive */) override;
+ Return powerHint(PowerHint_1_0 hint, int32_t data) override;
Return setFeature(Feature feature, bool activate) override;
Return getPlatformLowPowerStats(getPlatformLowPowerStats_cb _hidl_cb) override;
// Methods from ::android::hardware::power::V1_1::IPower follow.
Return getSubsystemLowPowerStats(getSubsystemLowPowerStats_cb _hidl_cb) override;
- Return powerHintAsync(PowerHint hint, int32_t data) override;
+ Return powerHintAsync(PowerHint_1_0 hint, int32_t data) override;
+
+ // Methods from ::android::hardware::power::V1_2::IPower follow.
+ Return powerHintAsync_1_2(PowerHint_1_2 hint, int32_t data) override;
// Methods from ::android::hidl::base::V1_0::IBase follow.
+ Return debug(const hidl_handle& fd, const hidl_vec& args) override;
private:
- InteractionHandler mInteractionHandler;
static bool isSupportedGovernor();
+
+ std::shared_ptr mHintManager;
+ InteractionHandler mInteractionHandler;
+ std::atomic mVRModeOn;
+ std::atomic mSustainedPerfModeOn;
+ std::atomic mEncoderModeOn;
};
} // namespace implementation
-} // namespace V1_1
+} // namespace V1_2
} // namespace power
} // namespace hardware
} // namespace android
-#endif // ANDROID_HARDWARE_POWER_V1_1_POWER_H
+#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
new file mode 100644
index 00000000..d77b8f05
--- /dev/null
+++ b/power-libperfmgr/android.hardware.power@1.2-service.wahoo-libperfmgr.rc
@@ -0,0 +1,21 @@
+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
new file mode 100644
index 00000000..059e358c
--- /dev/null
+++ b/power-libperfmgr/power-helper.c
@@ -0,0 +1,221 @@
+/*
+ * 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
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+
+#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/power-helper.h b/power-libperfmgr/power-helper.h
similarity index 92%
rename from power/power-helper.h
rename to power-libperfmgr/power-helper.h
index b2ef147a..0e12396b 100644
--- a/power/power-helper.h
+++ b/power-libperfmgr/power-helper.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ * 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
@@ -34,9 +34,6 @@
extern "C" {
#endif
-#include "hardware/power.h"
-
-
enum stats_type {
//Platform Stats
RPM_MODE_XO = 0,
@@ -56,6 +53,7 @@ enum stats_type {
enum subsystem_type {
SUBSYSTEM_WLAN = 0,
+ SUBSYSTEM_EASEL,
//Don't add any lines after this line
SUBSYSTEM_COUNT
@@ -93,14 +91,9 @@ struct stat_pair {
size_t num_parameters;
};
-
-void power_init(void);
-void power_hint(power_hint_t hint, void *data);
-void power_set_interactive(int on);
int extract_platform_stats(uint64_t *list);
int extract_wlan_stats(uint64_t *list);
-
-int is_perf_hint_active(int hint);
+int get_easel_state(unsigned long *current_state);
#ifdef __cplusplus
}
diff --git a/power/service.cpp b/power-libperfmgr/service.cpp
similarity index 70%
rename from power/service.cpp
rename to power-libperfmgr/service.cpp
index 5b3a47d6..c128f95d 100644
--- a/power/service.cpp
+++ b/power-libperfmgr/service.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017 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,11 +14,11 @@
* limitations under the License.
*/
-#define LOG_TAG "android.hardware.power@1.1-service.wahoo"
+#define LOG_TAG "android.hardware.power@1.2-service.wahoo-libperfmgr"
#include
#include
-#include
+
#include "Power.h"
using android::sp;
@@ -30,38 +30,30 @@ using android::hardware::configureRpcThreadpool;
using android::hardware::joinRpcThreadpool;
// Generated HIDL files
-using android::hardware::power::V1_1::IPower;
-using android::hardware::power::V1_1::implementation::Power;
+using android::hardware::power::V1_2::IPower;
+using android::hardware::power::V1_2::implementation::Power;
-int main() {
+int main(int /* argc */, char** /* argv */) {
+ ALOGI("Power HAL Service 1.2 for Wahoo is starting");
- status_t status;
- android::sp service = nullptr;
-
- ALOGI("Power HAL Service 1.1 for Wahoo is starting.");
-
- service = new Power();
+ android::sp service = new Power();
if (service == nullptr) {
ALOGE("Can not create an instance of Power HAL Iface, exiting.");
-
- goto shutdown;
+ return 1;
}
configureRpcThreadpool(1, true /*callerWillJoin*/);
- status = service->registerAsService();
+ status_t status = service->registerAsService();
if (status != OK) {
- ALOGE("Could not register service for Power HAL Iface (%d).", status);
- goto shutdown;
+ ALOGE("Could not register service for Power HAL Iface (%d), exiting.", status);
+ return 1;
}
ALOGI("Power Service is ready");
joinRpcThreadpool();
- //Should not pass this line
-shutdown:
// In normal operation, we don't expect the thread pool to exit
-
ALOGE("Power Service is shutting down");
return 1;
}
diff --git a/power/Android.mk b/power/Android.mk
deleted file mode 100644
index f2e29188..00000000
--- a/power/Android.mk
+++ /dev/null
@@ -1,58 +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.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_PROPRIETARY_MODULE := true
-LOCAL_MODULE_OWNER := qcom
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE := android.hardware.power@1.1-service.wahoo
-LOCAL_INIT_RC := android.hardware.power@1.1-service.wahoo.rc
-LOCAL_SRC_FILES := service.cpp \
- Power.cpp \
- InteractionHandler.cpp \
- power-helper.c \
- metadata-parser.c \
- utils.c \
- list.c \
- hint-data.c \
- powerhintparser.c
-
-LOCAL_C_INCLUDES := external/libxml2/include \
- external/icu/icu4c/source/common
-
-# Include target-specific files.
-LOCAL_SRC_FILES += power-8998.c
-
-
-# Enable interaction boost all the time
-LOCAL_CFLAGS += -DINTERACTION_BOOST -Werror
-
-LOCAL_SHARED_LIBRARIES := \
- libbase \
- liblog \
- libcutils \
- libdl \
- libxml2 \
- libhidlbase \
- libhidltransport \
- libhardware \
- libutils \
- android.hardware.power@1.1 \
-
-include $(BUILD_EXECUTABLE)
diff --git a/power/Power.cpp b/power/Power.cpp
deleted file mode 100644
index c74cb573..00000000
--- a/power/Power.cpp
+++ /dev/null
@@ -1,209 +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.power@1.1-service.wahoo"
-
-#include
-#include
-#include
-#include
-#include
-#include "Power.h"
-#include "power-common.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_1 {
-namespace implementation {
-
-using ::android::hardware::power::V1_0::Feature;
-using ::android::hardware::power::V1_0::PowerHint;
-using ::android::hardware::power::V1_0::PowerStatePlatformSleepState;
-using ::android::hardware::power::V1_0::Status;
-using ::android::hardware::power::V1_1::PowerStateSubsystem;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::Return;
-using ::android::hardware::Void;
-
-Power::Power() {
- power_init();
- mInteractionHandler.Init();
-}
-
-// Methods from ::android::hardware::power::V1_0::IPower follow.
-Return Power::setInteractive(bool interactive) {
- if (!isSupportedGovernor()) {
- return Void();
- }
- power_set_interactive(interactive ? 1 : 0);
- return Void();
-}
-
-Return Power::powerHint(PowerHint hint, int32_t data) {
- if (android::base::GetProperty("init.svc.perfd", "") != "running") {
- ALOGW("perfd is not started");
- return Void();
- }
-
- power_hint_t h = static_cast(hint);
- if (!isSupportedGovernor()) {
- return Void();
- }
- if (h == POWER_HINT_INTERACTION) {
- mInteractionHandler.Acquire(data);
- return Void();
- }
- power_hint(h, data ? &data : NULL);
- return Void();
-}
-
-Return Power::setFeature(Feature /*feature*/, bool /*activate*/) {
- //Nothing to do
- return Void();
-}
-
-Return Power::getPlatformLowPowerStats(getPlatformLowPowerStats_cb _hidl_cb) {
-
- hidl_vec 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(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;
- int ret;
-
- ret = extract_wlan_stats(stats);
- if (ret)
- return ret;
-
- subsystem.name = "wlan";
- 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;
-}
-
-// Methods from ::android::hardware::power::V1_1::IPower follow.
-Return Power::getSubsystemLowPowerStats(getSubsystemLowPowerStats_cb _hidl_cb) {
-
- hidl_vec subsystems;
- int ret;
-
- subsystems.resize(SUBSYSTEM_COUNT);
-
- //We currently have only one Subsystem for WLAN
- ret = get_wlan_low_power_stats(subsystems[SUBSYSTEM_WLAN]);
- if (ret != 0)
- goto done;
-
- //Add query for other subsystems here
-
-done:
- _hidl_cb(subsystems, Status::SUCCESS);
- return Void();
-}
-
-bool Power::isSupportedGovernor() {
- std::string buf;
- if (android::base::ReadFileToString(SCALING_GOVERNOR_PATH, &buf)) {
- buf = android::base::Trim(buf);
- }
- // Only support EAS 1.2, legacy EAS and HMP
- if (buf == SCHEDUTIL_GOVERNOR || buf == SCHED_GOVERNOR || buf == INTERACTIVE_GOVERNOR) {
- return true;
- } else {
- ALOGE("Governor not supported by powerHAL, skipping");
- return false;
- }
-}
-
-Return Power::powerHintAsync(PowerHint hint, int32_t data) {
- // just call the normal power hint in this oneway function
- return powerHint(hint, data);
-}
-
-} // namespace implementation
-} // namespace V1_1
-} // namespace power
-} // namespace hardware
-} // namespace android
diff --git a/power/android.hardware.power@1.1-service.wahoo.rc b/power/android.hardware.power@1.1-service.wahoo.rc
deleted file mode 100644
index 064cf35a..00000000
--- a/power/android.hardware.power@1.1-service.wahoo.rc
+++ /dev/null
@@ -1,4 +0,0 @@
-service power-hal-1-1 /vendor/bin/hw/android.hardware.power@1.1-service.wahoo
- class hal
- user system
- group system
diff --git a/power/hint-data.c b/power/hint-data.c
deleted file mode 100644
index f3403b7c..00000000
--- a/power/hint-data.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- */
-
-#include
-
-#include "hint-data.h"
-
-int hint_compare(struct hint_data *first_hint,
- struct hint_data *other_hint) {
- if (first_hint == other_hint) {
- return 0;
- } else if ((first_hint && other_hint) &&
- (first_hint->hint_id == other_hint->hint_id)) {
- return 0;
- } else {
- return 1;
- }
-}
-
-void hint_dump(struct hint_data *hint)
-{
- ALOGV("hint_id: %lu", hint->hint_id);
-}
diff --git a/power/hint-data.h b/power/hint-data.h
deleted file mode 100644
index 7be3b3b2..00000000
--- a/power/hint-data.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- */
-
-/* Default use-case hint IDs */
-#define DEFAULT_VIDEO_ENCODE_HINT_ID (0x0A00)
-#define DEFAULT_VIDEO_DECODE_HINT_ID (0x0B00)
-#define DISPLAY_STATE_HINT_ID (0x0C00)
-#define DISPLAY_STATE_HINT_ID_2 (0x0D00)
-#define CAM_PREVIEW_HINT_ID (0x0E00)
-#define SUSTAINED_PERF_HINT_ID (0x0F00)
-#define VR_MODE_HINT_ID (0x1000)
-#define VR_MODE_SUSTAINED_PERF_HINT_ID (0x1001)
-#define INTERACTION_HINT_ID (0x1A00)
-#define BOOST_HINT_ID (0x1B00)
-
-struct hint_data {
- unsigned long hint_id; /* This is our key. */
- unsigned long perflock_handle;
-};
-
-int hint_compare(struct hint_data *first_hint,
- struct hint_data *other_hint);
-void hint_dump(struct hint_data *hint);
diff --git a/power/list.c b/power/list.c
deleted file mode 100644
index 30a16943..00000000
--- a/power/list.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- */
-
-#include
-#include
-#include
-
-#include "list.h"
-#include
-
-int init_list_head(struct list_node *head)
-{
- if (head == NULL)
- return -1;
-
- memset(head, 0, sizeof(*head));
-
- return 0;
-}
-
-struct list_node *add_list_node(struct list_node *head, void *data)
-{
- /* Create a new list_node. And put 'data' into it. */
- struct list_node *new_node;
-
- if (head == NULL) {
- return NULL;
- }
-
- if (!(new_node = malloc(sizeof(struct list_node)))) {
- return NULL;
- }
-
- new_node->data = data;
- new_node->next = head->next;
- new_node->compare = head->compare;
- new_node->dump = head->dump;
- head->next = new_node;
-
- return new_node;
-}
-
-int is_list_empty(struct list_node *head)
-{
- return (head == NULL || head->next == NULL);
-}
-
-/*
- * Delink and de-allocate 'node'.
- */
-int remove_list_node(struct list_node *head, struct list_node *del_node)
-{
- struct list_node *current_node;
- struct list_node *saved_node;
-
- if (head == NULL || head->next == NULL) {
- return -1;
- }
-
- current_node = head->next;
- saved_node = head;
-
- while (current_node && current_node != del_node) {
- saved_node = current_node;
- current_node = current_node->next;
- }
-
- if (saved_node) {
- if (current_node) {
- saved_node->next = current_node->next;
- } else {
- /* Node not found. */
- return -1;
- }
- }
-
- if (del_node) {
- free(del_node);
- }
-
- return 0;
-}
-
-void dump_list(struct list_node *head)
-{
- struct list_node *current_node = head;
-
- if (head == NULL)
- return;
-
- ALOGV("List:\n");
-
- while ((current_node = current_node->next)) {
- if (current_node->dump) {
- current_node->dump(current_node->data);
- }
- }
-}
-
-struct list_node *find_node(struct list_node *head, void *comparison_data)
-{
- struct list_node *current_node = head;
-
- if (head == NULL)
- return NULL;
-
- while ((current_node = current_node->next)) {
- if (current_node->compare) {
- if (current_node->compare(current_node->data,
- comparison_data) == 0) {
- /* Match found. Return current_node. */
- return current_node;
- }
- }
- }
-
- /* No match found. */
- return NULL;
-}
diff --git a/power/list.h b/power/list.h
deleted file mode 100644
index d68c3df1..00000000
--- a/power/list.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- */
-
-struct list_node {
- struct list_node *next;
- void *data;
- int (*compare)(void *data1, void *data2);
- void (*dump)(void *data);
-};
-
-int init_list_head(struct list_node *head);
-struct list_node * add_list_node(struct list_node *head, void *data);
-int remove_list_node(struct list_node *head, struct list_node *del_node);
-void dump_list(struct list_node *head);
-struct list_node *find_node(struct list_node *head, void *comparison_data);
diff --git a/power/metadata-defs.h b/power/metadata-defs.h
deleted file mode 100644
index e3ce944d..00000000
--- a/power/metadata-defs.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Copyright (c) 2012, 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 ATTRIBUTE_VALUE_DELIM ('=')
-#define ATTRIBUTE_STRING_DELIM (";")
-
-#define METADATA_PARSING_ERR (-1)
-#define METADATA_PARSING_CONTINUE (0)
-#define METADATA_PARSING_DONE (1)
-
-#define MIN(x,y) (((x)>(y))?(y):(x))
-
-struct video_encode_metadata_t {
- int hint_id;
- int state;
-};
-
-struct video_decode_metadata_t {
- int hint_id;
- int state;
-};
-
-int parse_metadata(char *metadata, char **metadata_saveptr,
- char *attribute, unsigned int attribute_size, char *value, unsigned int value_size);
-int parse_video_encode_metadata(char *metadata,
- struct video_encode_metadata_t *video_encode_metadata);
-int parse_video_decode_metadata(char *metadata,
- struct video_decode_metadata_t *video_decode_metadata);
diff --git a/power/metadata-parser.c b/power/metadata-parser.c
deleted file mode 100644
index ffe092b5..00000000
--- a/power/metadata-parser.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/* Copyright (c) 2012, 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.
- *
- */
-
-#include
-#include
-#include
-
-#include "metadata-defs.h"
-
-int parse_metadata(char *metadata, char **metadata_saveptr,
- char *attribute, unsigned int attribute_size, char *value, unsigned int value_size)
-{
- char *attribute_string;
- char *attribute_value_delim;
- unsigned int bytes_to_copy;
-
- attribute_string = strtok_r(metadata, ATTRIBUTE_STRING_DELIM,
- metadata_saveptr);
-
- if (attribute_string == NULL)
- return METADATA_PARSING_DONE;
-
- attribute[0] = value[0] = '\0';
-
- if ((attribute_value_delim = strchr(attribute_string,
- ATTRIBUTE_VALUE_DELIM)) != NULL) {
- unsigned int attribute_len = (unsigned int) (attribute_value_delim - attribute_string);
- /* copy only attribute len + NUL character, or as much as can be fit */
- bytes_to_copy = MIN(attribute_len + 1, attribute_size);
-
- strlcpy(attribute, attribute_string, bytes_to_copy);
- strlcpy(value, attribute_value_delim + 1, value_size);
- }
-
- return METADATA_PARSING_CONTINUE;
-}
-
-int parse_video_encode_metadata(char *metadata,
- struct video_encode_metadata_t *video_encode_metadata)
-{
- char attribute[1024], value[1024], *saveptr;
- char *temp_metadata = metadata;
- int parsing_status;
-
- while ((parsing_status = parse_metadata(temp_metadata, &saveptr,
- attribute, sizeof(attribute), value, sizeof(value))) == METADATA_PARSING_CONTINUE) {
- if (strlen(attribute) == strlen("hint_id") &&
- (strncmp(attribute, "hint_id", strlen("hint_id")) == 0)) {
- if (strlen(value) > 0) {
- video_encode_metadata->hint_id = atoi(value);
- }
- }
-
- if (strlen(attribute) == strlen("state") &&
- (strncmp(attribute, "state", strlen("state")) == 0)) {
- if (strlen(value) > 0) {
- video_encode_metadata->state = atoi(value);
- }
- }
-
- temp_metadata = NULL;
- }
-
- if (parsing_status == METADATA_PARSING_ERR)
- return -1;
-
- return 0;
-}
-
-int parse_video_decode_metadata(char *metadata,
- struct video_decode_metadata_t *video_decode_metadata)
-{
- char attribute[1024], value[1024], *saveptr;
- char *temp_metadata = metadata;
- int parsing_status;
-
- while ((parsing_status = parse_metadata(temp_metadata, &saveptr,
- attribute, sizeof(attribute), value, sizeof(value))) == METADATA_PARSING_CONTINUE) {
- if (strlen(attribute) == strlen("hint_id") &&
- (strncmp(attribute, "hint_id", strlen("hint_id")) == 0)) {
- if (strlen(value) > 0) {
- video_decode_metadata->hint_id = atoi(value);
- }
- }
-
- if (strlen(attribute) == strlen("state") &&
- (strncmp(attribute, "state", strlen("state")) == 0)) {
- if (strlen(value) > 0) {
- video_decode_metadata->state = atoi(value);
- }
- }
-
- temp_metadata = NULL;
- }
-
- if (parsing_status == METADATA_PARSING_ERR)
- return -1;
-
- return 0;
-}
diff --git a/power/performance.h b/power/performance.h
deleted file mode 100755
index 85a611d3..00000000
--- a/power/performance.h
+++ /dev/null
@@ -1,264 +0,0 @@
-/* Copyright (c) 2012, 2014, 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.
- *
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define FAILED -1
-#define SUCCESS 0
-#define INDEFINITE_DURATION 0
-
-enum SCREEN_DISPLAY_TYPE {
- DISPLAY_OFF = 0x00FF,
-};
-
-enum PWR_CLSP_TYPE {
- ALL_CPUS_PWR_CLPS_DIS = 0x101,
-};
-
-/* For CPUx min freq, the leftmost byte
- * represents the CPU and the
- * rightmost byte represents the frequency
- * All intermediate frequencies on the
- * device are supported. The hex value
- * passed into PerfLock will be multiplied
- * by 10^5. This frequency or the next
- * highest frequency available will be set
- *
- * For example, if 1.4 Ghz is required on
- * CPU0, use 0x20E
- *
- * If the highest available frequency
- * on the device is required, use
- * CPUx_MIN_FREQ_TURBO_MAX
- * where x represents the CPU
- */
-enum CPU0_MIN_FREQ_LVL {
- CPU0_MIN_FREQ_NONTURBO_MAX = 0x20A,
- CPU0_MIN_FREQ_TURBO_MAX = 0x2FE,
-};
-
-enum CPU1_MIN_FREQ_LVL {
- CPU1_MIN_FREQ_NONTURBO_MAX = 0x30A,
- CPU1_MIN_FREQ_TURBO_MAX = 0x3FE,
-};
-
-enum CPU2_MIN_FREQ_LVL {
- CPU2_MIN_FREQ_NONTURBO_MAX = 0x40A,
- CPU2_MIN_FREQ_TURBO_MAX = 0x4FE,
-};
-
-enum CPU3_MIN_FREQ_LVL {
- CPU3_MIN_FREQ_NONTURBO_MAX = 0x50A,
- CPU3_MIN_FREQ_TURBO_MAX = 0x5FE,
-};
-
-enum CPU0_MAX_FREQ_LVL {
- CPU0_MAX_FREQ_NONTURBO_MAX = 0x150A,
-};
-
-enum CPU1_MAX_FREQ_LVL {
- CPU1_MAX_FREQ_NONTURBO_MAX = 0x160A,
-};
-
-enum CPU2_MAX_FREQ_LVL {
- CPU2_MAX_FREQ_NONTURBO_MAX = 0x170A,
-};
-
-enum CPU3_MAX_FREQ_LVL {
- CPU3_MAX_FREQ_NONTURBO_MAX = 0x180A,
-};
-
-enum MIN_CPUS_ONLINE_LVL {
- CPUS_ONLINE_MIN_2 = 0x702,
- CPUS_ONLINE_MIN_3 = 0x703,
- CPUS_ONLINE_MIN_4 = 0x704,
- CPUS_ONLINE_MPD_OVERRIDE = 0x777,
- CPUS_ONLINE_MAX = 0x7FF,
-};
-
-enum MAX_CPUS_ONLINE_LVL {
- CPUS_ONLINE_MAX_LIMIT_1 = 0x8FE,
- CPUS_ONLINE_MAX_LIMIT_2 = 0x8FD,
- CPUS_ONLINE_MAX_LIMIT_3 = 0x8FC,
- CPUS_ONLINE_MAX_LIMIT_4 = 0x8FB,
- CPUS_ONLINE_MAX_LIMIT_MAX = 0x8FB,
-};
-
-enum SAMPLING_RATE_LVL {
- MS_500 = 0xBCD,
- MS_50 = 0xBFA,
- MS_20 = 0xBFD,
-};
-
-enum ONDEMAND_IO_BUSY_LVL {
- IO_BUSY_OFF = 0xC00,
- IO_BUSY_ON = 0xC01,
-};
-
-enum ONDEMAND_SAMPLING_DOWN_FACTOR_LVL {
- SAMPLING_DOWN_FACTOR_1 = 0xD01,
- SAMPLING_DOWN_FACTOR_4 = 0xD04,
-};
-
-enum INTERACTIVE_TIMER_RATE_LVL {
- TR_MS_500 = 0xECD,
- TR_MS_100 = 0xEF5,
- TR_MS_50 = 0xEFA,
- TR_MS_30 = 0xEFC,
- TR_MS_20 = 0xEFD,
-};
-
-/* This timer rate applicable to cpu0
- across 8939 series chipset */
-enum INTERACTIVE_TIMER_RATE_LVL_CPU0_8939 {
- TR_MS_CPU0_500 = 0x30CD,
- TR_MS_CPU0_100 = 0x30F5,
- TR_MS_CPU0_50 = 0x30FA,
- TR_MS_CPU0_30 = 0x30FC,
- TR_MS_CPU0_20 = 0x30FD,
-};
-
-/* This timer rate applicable to cpu4
- across 8939 series chipset */
-enum INTERACTIVE_TIMER_RATE_LVL_CPU4_8939 {
- TR_MS_CPU4_500 = 0x3BCD,
- TR_MS_CPU4_100 = 0x3BF5,
- TR_MS_CPU4_50 = 0x3BFA,
- TR_MS_CPU4_30 = 0x3BFC,
- TR_MS_CPU4_20 = 0x3BFD,
-};
-
-/* This timer rate applicable to big.little arch */
-enum INTERACTIVE_TIMER_RATE_LVL_BIG_LITTLE {
- BIG_LITTLE_TR_MS_100 = 0x64,
- BIG_LITTLE_TR_MS_50 = 0x32,
- BIG_LITTLE_TR_MS_40 = 0x28,
- BIG_LITTLE_TR_MS_30 = 0x1E,
- BIG_LITTLE_TR_MS_20 = 0x14,
-};
-
-/* INTERACTIVE opcodes */
-enum INTERACTIVE_OPCODES {
- INT_OP_CLUSTER0_TIMER_RATE = 0x41424000,
- INT_OP_CLUSTER1_TIMER_RATE = 0x41424100,
- INT_OP_CLUSTER0_USE_SCHED_LOAD = 0x41430000,
- INT_OP_CLUSTER1_USE_SCHED_LOAD = 0x41430100,
- INT_OP_CLUSTER0_USE_MIGRATION_NOTIF = 0x41434000,
- INT_OP_CLUSTER1_USE_MIGRATION_NOTIF = 0x41434100,
- INT_OP_NOTIFY_ON_MIGRATE = 0x4241C000
-};
-
-enum INTERACTIVE_HISPEED_FREQ_LVL {
- HS_FREQ_1026 = 0xF0A,
-};
-
-enum INTERACTIVE_HISPEED_LOAD_LVL {
- HISPEED_LOAD_90 = 0x105A,
-};
-
-enum SYNC_FREQ_LVL {
- SYNC_FREQ_300 = 0x1103,
- SYNC_FREQ_600 = 0X1106,
- SYNC_FREQ_384 = 0x1103,
- SYNC_FREQ_NONTURBO_MAX = 0x110A,
- SYNC_FREQ_TURBO = 0x110F,
-};
-
-enum OPTIMAL_FREQ_LVL {
- OPTIMAL_FREQ_300 = 0x1203,
- OPTIMAL_FREQ_600 = 0x1206,
- OPTIMAL_FREQ_384 = 0x1203,
- OPTIMAL_FREQ_NONTURBO_MAX = 0x120A,
- OPTIMAL_FREQ_TURBO = 0x120F,
-};
-
-enum SCREEN_PWR_CLPS_LVL {
- PWR_CLPS_DIS = 0x1300,
- PWR_CLPS_ENA = 0x1301,
-};
-
-enum THREAD_MIGRATION_LVL {
- THREAD_MIGRATION_SYNC_OFF = 0x1400,
-};
-
-enum SCHED_GUIDED_LVL {
- INTERACTIVE_USE_SCHED_LOAD_OFF = 0x5201,
- INTERACTIVE_USE_MIGRATION_NOTIF_OFF = 0x5301
-};
-
-enum INTERACTIVE_IO_BUSY_LVL {
- INTERACTIVE_IO_BUSY_OFF = 0x1B00,
- INTERACTIVE_IO_BUSY_ON = 0x1B01,
-};
-
-enum SCHED_BOOST_LVL {
- SCHED_BOOST_ON = 0x1E01,
-};
-
-enum CPU4_MIN_FREQ_LVL {
- CPU4_MIN_FREQ_NONTURBO_MAX = 0x1F0A,
- CPU4_MIN_FREQ_TURBO_MAX = 0x1FFE,
-};
-
-enum CPU5_MIN_FREQ_LVL {
- CPU5_MIN_FREQ_NONTURBO_MAX = 0x200A,
- CPU5_MIN_FREQ_TURBO_MAX = 0x20FE,
-};
-
-enum CPU6_MIN_FREQ_LVL {
- CPU6_MIN_FREQ_NONTURBO_MAX = 0x210A,
- CPU6_MIN_FREQ_TURBO_MAX = 0x21FE,
-};
-
-enum CPU7_MIN_FREQ_LVL {
- CPU7_MIN_FREQ_NONTURBO_MAX = 0x220A,
- CPU7_MIN_FREQ_TURBO_MAX = 0x22FE,
-};
-
-enum CPU4_MAX_FREQ_LVL {
- CPU4_MAX_FREQ_NONTURBO_MAX = 0x230A,
-};
-
-enum CPU5_MAX_FREQ_LVL {
- CPU5_MAX_FREQ_NONTURBO_MAX = 0x240A,
-};
-
-enum CPU6_MAX_FREQ_LVL {
- CPU6_MAX_FREQ_NONTURBO_MAX = 0x250A,
-};
-
-enum CPU7_MAX_FREQ_LVL {
- CPU7_MAX_FREQ_NONTURBO_MAX = 0x260A,
-};
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/power/power-8998.c b/power/power-8998.c
deleted file mode 100644
index dbc6542f..00000000
--- a/power/power-8998.c
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- * 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.
- */
-#define LOG_NIDEBUG 0
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#define ATRACE_TAG (ATRACE_TAG_POWER | ATRACE_TAG_HAL)
-#define LOG_TAG "QCOM PowerHAL"
-#include
-#include
-#include
-#include
-
-#include "utils.h"
-#include "metadata-defs.h"
-#include "hint-data.h"
-#include "performance.h"
-#include "power-common.h"
-#include "powerhintparser.h"
-
-static int sustained_mode_handle = 0;
-static int vr_mode_handle = 0;
-static int launch_handle = 0;
-static int sustained_performance_mode = 0;
-static int vr_mode = 0;
-static int launch_mode = 0;
-#define CHECK_HANDLE(x) (((x)>0) && ((x)!=-1))
-
-int is_perf_hint_active(int hint)
-{
- switch (hint) {
- case SUSTAINED_PERF_HINT_ID:
- return sustained_performance_mode != 0;
- case VR_MODE_HINT_ID:
- return vr_mode != 0;
- case VR_MODE_SUSTAINED_PERF_HINT_ID:
- return vr_mode != 0 && sustained_performance_mode != 0;
- }
- return 0;
-}
-
-static int process_sustained_perf_hint(void *data)
-{
- int duration = 0;
- int *resource_values = NULL;
- int resources = 0;
-
- if (data && sustained_performance_mode == 0) {
- if (vr_mode == 0) { // Sustained mode only.
- resource_values = getPowerhint(SUSTAINED_PERF_HINT_ID, &resources);
- if (!resource_values) {
- ALOGE("Can't get sustained perf hints from xml ");
- return HINT_NONE;
- }
- sustained_mode_handle = interaction_with_handle(
- sustained_mode_handle, duration, resources, resource_values);
- if (!CHECK_HANDLE(sustained_mode_handle)) {
- ALOGE("Failed interaction_with_handle for sustained_mode_handle");
- return HINT_NONE;
- }
- } else if (vr_mode == 1) { // Sustained + VR mode.
- release_request(vr_mode_handle);
- resource_values = getPowerhint(VR_MODE_SUSTAINED_PERF_HINT_ID, &resources);
- if (!resource_values) {
- ALOGE("Can't get VR mode sustained perf hints from xml ");
- return HINT_NONE;
- }
- sustained_mode_handle = interaction_with_handle(
- sustained_mode_handle, duration, resources, resource_values);
- if (!CHECK_HANDLE(sustained_mode_handle)) {
- ALOGE("Failed interaction_with_handle for sustained_mode_handle");
- return HINT_NONE;
- }
- }
- sustained_performance_mode = 1;
- } else if (sustained_performance_mode == 1) {
- release_request(sustained_mode_handle);
- if (vr_mode == 1) { // Switch back to VR Mode.
- resource_values = getPowerhint(VR_MODE_HINT_ID, &resources);
- if (!resource_values) {
- ALOGE("Can't get VR mode perf hints from xml ");
- return HINT_NONE;
- }
- vr_mode_handle = interaction_with_handle(
- vr_mode_handle, duration, resources, resource_values);
- if (!CHECK_HANDLE(vr_mode_handle)) {
- ALOGE("Failed interaction_with_handle for vr_mode_handle");
- return HINT_NONE;
- }
- }
- sustained_performance_mode = 0;
- }
- return HINT_HANDLED;
-}
-
-static int process_vr_mode_hint(void *data)
-{
- int duration = 0;
- int *resource_values = NULL;
- int resources = 0;
-
- if (data && vr_mode == 0) {
- if (sustained_performance_mode == 0) { // VR mode only.
- resource_values = getPowerhint(VR_MODE_HINT_ID, &resources);
- if (!resource_values) {
- ALOGE("Can't get VR mode perf hints from xml ");
- return HINT_NONE;
- }
- vr_mode_handle = interaction_with_handle(
- vr_mode_handle, duration, resources, resource_values);
- if (!CHECK_HANDLE(vr_mode_handle)) {
- ALOGE("Failed interaction_with_handle for vr_mode_handle");
- return HINT_NONE;
- }
- } else if (sustained_performance_mode == 1) { // Sustained + VR mode.
- release_request(sustained_mode_handle);
- resource_values = getPowerhint(VR_MODE_SUSTAINED_PERF_HINT_ID, &resources);
- if (!resource_values) {
- ALOGE("Can't get VR mode sustained perf hints from xml ");
- return HINT_NONE;
- }
- vr_mode_handle = interaction_with_handle(
- vr_mode_handle, duration, resources, resource_values);
- if (!CHECK_HANDLE(vr_mode_handle)) {
- ALOGE("Failed interaction_with_handle for vr_mode_handle");
- return HINT_NONE;
- }
- }
- vr_mode = 1;
- } else if (vr_mode == 1) {
- release_request(vr_mode_handle);
- if (sustained_performance_mode == 1) { // Switch back to sustained Mode.
- resource_values = getPowerhint(SUSTAINED_PERF_HINT_ID, &resources);
- if (!resource_values) {
- ALOGE("Can't get sustained perf hints from xml ");
- return HINT_NONE;
- }
- sustained_mode_handle = interaction_with_handle(
- sustained_mode_handle, duration, resources, resource_values);
- if (!CHECK_HANDLE(sustained_mode_handle)) {
- ALOGE("Failed interaction_with_handle for sustained_mode_handle");
- return HINT_NONE;
- }
- }
- vr_mode = 0;
- }
-
- return HINT_HANDLED;
-}
-
-static int process_boost(int boost_handle, int duration)
-{
- int *resource_values;
- int resources;
-
- resource_values = getPowerhint(BOOST_HINT_ID, &resources);
-
- if (resource_values != NULL) {
- boost_handle = interaction_with_handle(
- boost_handle, duration, resources, resource_values);
- if (!CHECK_HANDLE(boost_handle)) {
- ALOGE("Failed interaction_with_handle for boost_handle");
- }
- }
-
- return boost_handle;
-}
-
-static int process_video_encode_hint(void *data)
-{
- static int boost_handle = -1;
-
- if (data) {
- // TODO: remove the launch boost based on camera launch time
- int duration = 2000; // boosts 2s for starting encoding
- boost_handle = process_boost(boost_handle, duration);
- ALOGD("LAUNCH ENCODER-ON: %d MS", duration);
- int *resource_values = NULL;
- int resources = 0;
- resource_values = getPowerhint(DEFAULT_VIDEO_ENCODE_HINT_ID, &resources);
- if (resource_values != NULL)
- perform_hint_action(DEFAULT_VIDEO_ENCODE_HINT_ID, resource_values, resources);
- ALOGD("Video Encode hint start");
- return HINT_HANDLED;
- } else {
- undo_hint_action(DEFAULT_VIDEO_ENCODE_HINT_ID);
- ALOGD("Video Encode hint stop");
- return HINT_HANDLED;
- }
- return HINT_NONE;
-}
-
-static int process_activity_launch_hint(void *data)
-{
- // boost will timeout in 1.25s
- int duration = 1250;
- ATRACE_BEGIN("launch");
- if (sustained_performance_mode || vr_mode) {
- ATRACE_END();
- return HINT_HANDLED;
- }
-
- ALOGD("LAUNCH HINT: %s", data ? "ON" : "OFF");
- // restart the launch hint if the framework has not yet released
- // this shouldn't happen, but we've seen bugs where it could
- if (data) {
- launch_handle = process_boost(launch_handle, duration);
- if (launch_handle > 0) {
- launch_mode = 1;
- ALOGD("Activity launch hint handled");
- ATRACE_INT("launch_lock", 1);
- ATRACE_END();
- return HINT_HANDLED;
- } else {
- ATRACE_END();
- return HINT_NONE;
- }
- } else if (data == NULL && launch_mode == 1) {
- // framework release hints aren't necessarily reliable
- // always wait the full duration
- // release_request(launch_handle);
- ATRACE_INT("launch_lock", 0);
- launch_mode = 0;
- ATRACE_END();
- return HINT_HANDLED;
- }
- ATRACE_END();
- return HINT_NONE;
-}
-
-int power_hint_override(power_hint_t hint, void *data)
-{
- int ret_val = HINT_NONE;
- switch(hint) {
- case POWER_HINT_VIDEO_ENCODE:
- ret_val = process_video_encode_hint(data);
- break;
- case POWER_HINT_SUSTAINED_PERFORMANCE:
- ret_val = process_sustained_perf_hint(data);
- break;
- case POWER_HINT_VR_MODE:
- ret_val = process_vr_mode_hint(data);
- break;
- case POWER_HINT_LAUNCH:
- ret_val = process_activity_launch_hint(data);
- break;
- default:
- break;
- }
- return ret_val;
-}
-
-int set_interactive_override(int UNUSED(on))
-{
- return HINT_HANDLED; /* Don't excecute this code path, not in use */
-}
diff --git a/power/power-common.h b/power/power-common.h
deleted file mode 100644
index aff3cd24..00000000
--- a/power/power-common.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 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 NODE_MAX (64)
-
-#define SCALING_GOVERNOR_PATH "/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"
-#define DCVS_CPU0_SLACK_MAX_NODE "/sys/module/msm_dcvs/cores/cpu0/slack_time_max_us"
-#define DCVS_CPU0_SLACK_MIN_NODE "/sys/module/msm_dcvs/cores/cpu0/slack_time_min_us"
-#define MPDECISION_SLACK_MAX_NODE "/sys/module/msm_mpdecision/slack_time_max_us"
-#define MPDECISION_SLACK_MIN_NODE "/sys/module/msm_mpdecision/slack_time_min_us"
-#define SCALING_MIN_FREQ "/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq"
-#define ONDEMAND_GOVERNOR "ondemand"
-#define INTERACTIVE_GOVERNOR "interactive"
-#define SCHEDUTIL_GOVERNOR "schedutil"
-#define SCHED_GOVERNOR "sched"
-
-#define MSMDCVS_GOVERNOR "msm-dcvs"
-#define SCHED_GOVERNOR "sched"
-
-#define HINT_HANDLED (0)
-#define HINT_NONE (-1)
-
-enum CPU_GOV_CHECK {
- CPU0 = 0,
- CPU1 = 1,
- CPU2 = 2,
- CPU3 = 3
-};
-
-#define UNUSED(x) UNUSED_ ## x __attribute__((__unused__))
diff --git a/power/power-helper.c b/power/power-helper.c
deleted file mode 100644
index e449ac1f..00000000
--- a/power/power-helper.c
+++ /dev/null
@@ -1,450 +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
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#define LOG_TAG "QCOM PowerHAL"
-#include
-#include
-
-#include "utils.h"
-#include "metadata-defs.h"
-#include "hint-data.h"
-#include "performance.h"
-#include "power-common.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
-
-#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 saved_dcvs_cpu0_slack_max = -1;
-static int saved_dcvs_cpu0_slack_min = -1;
-static int saved_mpdecision_slack_max = -1;
-static int saved_mpdecision_slack_min = -1;
-static int saved_interactive_mode = -1;
-static int slack_node_rw_failed = 0;
-static int display_hint_sent;
-
-void power_init(void)
-{
- ALOGI("QCOM power HAL initing.");
-}
-
-int __attribute__ ((weak)) power_hint_override(power_hint_t UNUSED(hint),
- void *UNUSED(data))
-{
- return HINT_NONE;
-}
-
-/* Declare function before use */
-void interaction(int duration, int num_args, int opt_list[]);
-
-void power_hint(power_hint_t hint, void *data)
-{
- /* Check if this hint has been overridden. */
- if (power_hint_override(hint, data) == HINT_HANDLED) {
- /* The power_hint has been handled. We can skip the rest. */
- return;
- }
-
- switch(hint) {
- case POWER_HINT_VSYNC:
- break;
- case POWER_HINT_SUSTAINED_PERFORMANCE:
- ALOGD("Sustained perf power hint not handled in power_hint_override");
- break;
- case POWER_HINT_VR_MODE:
- ALOGD("VR mode power hint not handled in power_hint_override");
- break;
- case POWER_HINT_INTERACTION:
- {
- int resources[] = {0x702, 0x20F, 0x30F};
- int duration = 3000;
-
- interaction(duration, sizeof(resources)/sizeof(resources[0]), resources);
- }
- break;
- default:
- break;
- }
-}
-
-int __attribute__ ((weak)) is_perf_hint_active(int UNUSED(hint))
-{
- return 0;
-}
-
-int __attribute__ ((weak)) set_interactive_override(int UNUSED(on))
-{
- return HINT_NONE;
-}
-
-void power_set_interactive(int on)
-{
- char governor[80];
- char tmp_str[NODE_MAX];
- struct video_encode_metadata_t video_encode_metadata;
- int rc = 0;
-
- if (set_interactive_override(on) == HINT_HANDLED) {
- return;
- }
-
- ALOGD("Got set_interactive hint");
-
- if (get_scaling_governor(governor, sizeof(governor)) == -1) {
- ALOGE("Can't obtain scaling governor.");
-
- return;
- }
-
- if (!on) {
- /* Display off. */
- if ((strncmp(governor, ONDEMAND_GOVERNOR, strlen(ONDEMAND_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(ONDEMAND_GOVERNOR))) {
- int resource_values[] = {DISPLAY_OFF, MS_500, THREAD_MIGRATION_SYNC_OFF};
-
- if (!display_hint_sent) {
- perform_hint_action(DISPLAY_STATE_HINT_ID,
- resource_values, sizeof(resource_values)/sizeof(resource_values[0]));
- display_hint_sent = 1;
- }
- } else if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
- int resource_values[] = {TR_MS_50, THREAD_MIGRATION_SYNC_OFF};
-
- if (!display_hint_sent) {
- perform_hint_action(DISPLAY_STATE_HINT_ID,
- resource_values, sizeof(resource_values)/sizeof(resource_values[0]));
- display_hint_sent = 1;
- }
- } else if ((strncmp(governor, MSMDCVS_GOVERNOR, strlen(MSMDCVS_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(MSMDCVS_GOVERNOR))) {
- if (saved_interactive_mode == 1){
- /* Display turned off. */
- if (sysfs_read(DCVS_CPU0_SLACK_MAX_NODE, tmp_str, NODE_MAX - 1)) {
- if (!slack_node_rw_failed) {
- ALOGE("Failed to read from %s", DCVS_CPU0_SLACK_MAX_NODE);
- }
-
- rc = 1;
- } else {
- saved_dcvs_cpu0_slack_max = atoi(tmp_str);
- }
-
- if (sysfs_read(DCVS_CPU0_SLACK_MIN_NODE, tmp_str, NODE_MAX - 1)) {
- if (!slack_node_rw_failed) {
- ALOGE("Failed to read from %s", DCVS_CPU0_SLACK_MIN_NODE);
- }
-
- rc = 1;
- } else {
- saved_dcvs_cpu0_slack_min = atoi(tmp_str);
- }
-
- if (sysfs_read(MPDECISION_SLACK_MAX_NODE, tmp_str, NODE_MAX - 1)) {
- if (!slack_node_rw_failed) {
- ALOGE("Failed to read from %s", MPDECISION_SLACK_MAX_NODE);
- }
-
- rc = 1;
- } else {
- saved_mpdecision_slack_max = atoi(tmp_str);
- }
-
- if (sysfs_read(MPDECISION_SLACK_MIN_NODE, tmp_str, NODE_MAX - 1)) {
- if(!slack_node_rw_failed) {
- ALOGE("Failed to read from %s", MPDECISION_SLACK_MIN_NODE);
- }
-
- rc = 1;
- } else {
- saved_mpdecision_slack_min = atoi(tmp_str);
- }
-
- /* Write new values. */
- if (saved_dcvs_cpu0_slack_max != -1) {
- snprintf(tmp_str, NODE_MAX, "%d", 10 * saved_dcvs_cpu0_slack_max);
-
- if (sysfs_write(DCVS_CPU0_SLACK_MAX_NODE, tmp_str) != 0) {
- if (!slack_node_rw_failed) {
- ALOGE("Failed to write to %s", DCVS_CPU0_SLACK_MAX_NODE);
- }
-
- rc = 1;
- }
- }
-
- if (saved_dcvs_cpu0_slack_min != -1) {
- snprintf(tmp_str, NODE_MAX, "%d", 10 * saved_dcvs_cpu0_slack_min);
-
- if (sysfs_write(DCVS_CPU0_SLACK_MIN_NODE, tmp_str) != 0) {
- if(!slack_node_rw_failed) {
- ALOGE("Failed to write to %s", DCVS_CPU0_SLACK_MIN_NODE);
- }
-
- rc = 1;
- }
- }
-
- if (saved_mpdecision_slack_max != -1) {
- snprintf(tmp_str, NODE_MAX, "%d", 10 * saved_mpdecision_slack_max);
-
- if (sysfs_write(MPDECISION_SLACK_MAX_NODE, tmp_str) != 0) {
- if(!slack_node_rw_failed) {
- ALOGE("Failed to write to %s", MPDECISION_SLACK_MAX_NODE);
- }
-
- rc = 1;
- }
- }
-
- if (saved_mpdecision_slack_min != -1) {
- snprintf(tmp_str, NODE_MAX, "%d", 10 * saved_mpdecision_slack_min);
-
- if (sysfs_write(MPDECISION_SLACK_MIN_NODE, tmp_str) != 0) {
- if(!slack_node_rw_failed) {
- ALOGE("Failed to write to %s", MPDECISION_SLACK_MIN_NODE);
- }
-
- rc = 1;
- }
- }
- }
-
- slack_node_rw_failed = rc;
- }
- } else {
- /* Display on. */
- if ((strncmp(governor, ONDEMAND_GOVERNOR, strlen(ONDEMAND_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(ONDEMAND_GOVERNOR))) {
- undo_hint_action(DISPLAY_STATE_HINT_ID);
- display_hint_sent = 0;
- } else if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
- undo_hint_action(DISPLAY_STATE_HINT_ID);
- display_hint_sent = 0;
- } else if ((strncmp(governor, MSMDCVS_GOVERNOR, strlen(MSMDCVS_GOVERNOR)) == 0) &&
- (strlen(governor) == strlen(MSMDCVS_GOVERNOR))) {
- if (saved_interactive_mode == -1 || saved_interactive_mode == 0) {
- /* Display turned on. Restore if possible. */
- if (saved_dcvs_cpu0_slack_max != -1) {
- snprintf(tmp_str, NODE_MAX, "%d", saved_dcvs_cpu0_slack_max);
-
- if (sysfs_write(DCVS_CPU0_SLACK_MAX_NODE, tmp_str) != 0) {
- if (!slack_node_rw_failed) {
- ALOGE("Failed to write to %s", DCVS_CPU0_SLACK_MAX_NODE);
- }
-
- rc = 1;
- }
- }
-
- if (saved_dcvs_cpu0_slack_min != -1) {
- snprintf(tmp_str, NODE_MAX, "%d", saved_dcvs_cpu0_slack_min);
-
- if (sysfs_write(DCVS_CPU0_SLACK_MIN_NODE, tmp_str) != 0) {
- if (!slack_node_rw_failed) {
- ALOGE("Failed to write to %s", DCVS_CPU0_SLACK_MIN_NODE);
- }
-
- rc = 1;
- }
- }
-
- if (saved_mpdecision_slack_max != -1) {
- snprintf(tmp_str, NODE_MAX, "%d", saved_mpdecision_slack_max);
-
- if (sysfs_write(MPDECISION_SLACK_MAX_NODE, tmp_str) != 0) {
- if (!slack_node_rw_failed) {
- ALOGE("Failed to write to %s", MPDECISION_SLACK_MAX_NODE);
- }
-
- rc = 1;
- }
- }
-
- if (saved_mpdecision_slack_min != -1) {
- snprintf(tmp_str, NODE_MAX, "%d", saved_mpdecision_slack_min);
-
- if (sysfs_write(MPDECISION_SLACK_MIN_NODE, tmp_str) != 0) {
- if (!slack_node_rw_failed) {
- ALOGE("Failed to write to %s", MPDECISION_SLACK_MIN_NODE);
- }
-
- rc = 1;
- }
- }
- }
-
- slack_node_rw_failed = rc;
- }
- }
-
- saved_interactive_mode = !!on;
-}
-
-
-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));
-}
diff --git a/power/powerhintparser.c b/power/powerhintparser.c
deleted file mode 100644
index 31d9625a..00000000
--- a/power/powerhintparser.c
+++ /dev/null
@@ -1,174 +0,0 @@
-/* Copyright (c) 2016-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.
- *
- */
-
-#define LOG_TAG "QCOM PowerHAL"
-
-#include
-#include
-#include
-#include "powerhintparser.h"
-
-int parsePowerhintXML() {
-
- xmlDocPtr doc;
- xmlNodePtr currNode;
- const char *opcode_str, *value_str, *type_str;
- int opcode = 0, value = 0, type = 0;
- int numParams = 0;
- static int hintCount;
-
- if(access(POWERHINT_XML, F_OK) < 0) {
- return -1;
- }
-
- doc = xmlReadFile(POWERHINT_XML, "UTF-8", XML_PARSE_RECOVER);
- if(!doc) {
- ALOGE("Document not parsed successfully");
- return -1;
- }
-
- currNode = xmlDocGetRootElement(doc);
- if(!currNode) {
- ALOGE("Empty document");
- xmlFreeDoc(doc);
- xmlCleanupParser();
- return -1;
- }
-
- // Confirm the root-element of the tree
- if(xmlStrcmp(currNode->name, BAD_CAST "Powerhint")) {
- ALOGE("document of the wrong type, root node != root");
- xmlFreeDoc(doc);
- xmlCleanupParser();
- return -1;
- }
-
- currNode = currNode->xmlChildrenNode;
-
- for(; currNode != NULL; currNode=currNode->next) {
-
- if(currNode->type != XML_ELEMENT_NODE)
- continue;
-
- xmlNodePtr node = currNode;
-
- if(hintCount == MAX_HINT) {
- ALOGE("Number of hints exceeded the max count of %d\n",MAX_HINT);
- break;
- }
-
- if(!xmlStrcmp(node->name, BAD_CAST "Hint")) {
- if(xmlHasProp(node, BAD_CAST "type")) {
- type_str = (const char*)xmlGetProp(node, BAD_CAST "type");
- if (type_str == NULL)
- {
- ALOGE("xmlGetProp failed on type");
- xmlFreeDoc(doc);
- xmlCleanupParser();
- return -1;
- }
- type = strtol(type_str, NULL, 16);
- }
-
- node = node->children;
- while(node != NULL) {
- if(!xmlStrcmp(node->name, BAD_CAST "Resource")) {
-
- if(xmlHasProp(node, BAD_CAST "opcode")) {
- opcode_str = (const char*)xmlGetProp(node, BAD_CAST "opcode");
- if (opcode_str == NULL)
- {
- ALOGE("xmlGetProp failed on opcode");
- xmlFreeDoc(doc);
- xmlCleanupParser();
- return -1;
- }
- opcode = strtol(opcode_str, NULL, 16);
- }
- if(xmlHasProp(node, BAD_CAST "value")) {
- value_str = (const char*)xmlGetProp(node, BAD_CAST "value");
- if (value_str == NULL)
- {
- ALOGE("xmlGetProp failed on value");
- xmlFreeDoc(doc);
- xmlCleanupParser();
- return -1;
- }
- value = strtol(value_str, NULL, 16);
- }
- if(opcode > 0) {
- if(numParams < (MAX_PARAM-1)) {
- powerhint[hintCount].paramList[numParams++] = opcode;
- powerhint[hintCount].paramList[numParams++] = value;
- } else {
- ALOGE("Maximum parameters exceeded for Hint ID %x\n",type);
- opcode = value = 0;
- break;
- }
- }
-
- opcode = value = 0;
- }
- node = node->next;
- }
- powerhint[hintCount].type = type;
- powerhint[hintCount].numParams = numParams;
- numParams = 0;
- }
- hintCount++;
- }
-
- xmlFreeDoc(doc);
- xmlCleanupParser();
- return 0;
-}
-
-int* getPowerhint(int hint_id, int *params) {
-
- int *result = NULL;
-
- if(!hint_id)
- return result;
-
- ALOGV("Powerhal hint received=%x\n",hint_id);
-
- if(!powerhint[0].numParams) {
- parsePowerhintXML();
- }
-
- for(int i = 0; i < MAX_HINT; i++) {
- if(hint_id == powerhint[i].type) {
- *params = powerhint[i].numParams;
- result = powerhint[i].paramList;
- break;
- }
- }
-
- return result;
-}
diff --git a/power/powerhintparser.h b/power/powerhintparser.h
deleted file mode 100644
index c1da1de1..00000000
--- a/power/powerhintparser.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* 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.
- *
- */
-
-#ifndef __POWERHINTPARSER__
-#define __POWERHINTPARSER__
-
-#define POWERHINT_XML "/vendor/etc/powerhint.xml"
-#define MAX_HINT 8
-#define MAX_PARAM 30
-
-typedef struct perflock_param_t {
- int type;
- int numParams;
- int paramList[MAX_PARAM];//static limit on number of hints - 15
-}perflock_param_t;
-
-static perflock_param_t powerhint[MAX_HINT];
-
-int parsePowerhintXML();
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int *getPowerhint(int, int *);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __POWERHINTPARSER__ */
diff --git a/power/utils.c b/power/utils.c
deleted file mode 100644
index 9661e5ea..00000000
--- a/power/utils.c
+++ /dev/null
@@ -1,327 +0,0 @@
-/*
- * Copyright (c) 2012-2013,2015-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.
- */
-#define LOG_NIDEBUG 0
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "utils.h"
-#include "list.h"
-#include "hint-data.h"
-#include "power-common.h"
-
-#define LOG_TAG "QCOM PowerHAL"
-#include
-
-static void *qcopt_handle;
-static int (*perf_lock_acq)(unsigned long handle, int duration,
- int list[], int numArgs);
-static int (*perf_lock_rel)(unsigned long handle);
-static struct list_node active_hint_list_head;
-
-static void *get_qcopt_handle()
-{
- char qcopt_lib_path[PATH_MAX] = {0};
- void *handle = NULL;
-
- dlerror();
-
- if (property_get("ro.vendor.extension_library", qcopt_lib_path,
- NULL)) {
- handle = dlopen(qcopt_lib_path, RTLD_NOW);
- if (!handle) {
- ALOGE("Unable to open %s: %s\n", qcopt_lib_path,
- dlerror());
- }
- }
-
- return handle;
-}
-
-static void __attribute__ ((constructor)) initialize(void)
-{
- qcopt_handle = get_qcopt_handle();
-
- if (!qcopt_handle) {
- ALOGE("Failed to get qcopt handle.\n");
- } else {
- /*
- * qc-opt handle obtained. Get the perflock acquire/release
- * function pointers.
- */
- perf_lock_acq = dlsym(qcopt_handle, "perf_lock_acq");
-
- if (!perf_lock_acq) {
- ALOGE("Unable to get perf_lock_acq function handle.\n");
- }
-
- perf_lock_rel = dlsym(qcopt_handle, "perf_lock_rel");
-
- if (!perf_lock_rel) {
- ALOGE("Unable to get perf_lock_rel function handle.\n");
- }
- }
-}
-
-static void __attribute__ ((destructor)) cleanup(void)
-{
- if (qcopt_handle) {
- if (dlclose(qcopt_handle))
- ALOGE("Error occurred while closing qc-opt library.");
- }
-}
-
-int sysfs_read(char *path, char *s, int num_bytes)
-{
- char buf[80];
- int count;
- int ret = 0;
- int fd = open(path, O_RDONLY);
-
- if (fd < 0) {
- strerror_r(errno, buf, sizeof(buf));
- ALOGE("Error opening %s: %s\n", path, buf);
-
- return -1;
- }
-
- if ((count = read(fd, s, num_bytes - 1)) < 0) {
- strerror_r(errno, buf, sizeof(buf));
- ALOGE("Error writing to %s: %s\n", path, buf);
-
- ret = -1;
- } else {
- s[count] = '\0';
- }
-
- close(fd);
-
- return ret;
-}
-
-int sysfs_write(char *path, char *s)
-{
- char buf[80];
- int len;
- int ret = 0;
- int fd = open(path, O_WRONLY);
-
- if (fd < 0) {
- strerror_r(errno, buf, sizeof(buf));
- ALOGE("Error opening %s: %s\n", path, buf);
- return -1 ;
- }
-
- len = write(fd, s, strlen(s));
- if (len < 0) {
- strerror_r(errno, buf, sizeof(buf));
- ALOGE("Error writing to %s: %s\n", path, buf);
-
- ret = -1;
- }
-
- close(fd);
-
- return ret;
-}
-
-int get_scaling_governor(char governor[], int size)
-{
- if (sysfs_read(SCALING_GOVERNOR_PATH, governor,
- size) == -1) {
- // Can't obtain the scaling governor. Return.
- return -1;
- } else {
- // Strip newline at the end.
- int len = strlen(governor);
-
- len--;
-
- while (len >= 0 && (governor[len] == '\n' || governor[len] == '\r'))
- governor[len--] = '\0';
- }
-
- return 0;
-}
-
-int is_interactive_governor(char* governor) {
- if (strncmp(governor, INTERACTIVE_GOVERNOR, (strlen(INTERACTIVE_GOVERNOR)+1)) == 0)
- return 1;
- return 0;
-}
-
-void interaction(int duration, int num_args, int opt_list[])
-{
-#ifdef INTERACTION_BOOST
- static int lock_handle = 0;
-
- if (duration < 0 || num_args < 1 || opt_list[0] == 0)
- return;
-
- if (qcopt_handle) {
- if (perf_lock_acq) {
- lock_handle = perf_lock_acq(lock_handle, duration, opt_list, num_args);
- if (lock_handle == -1)
- ALOGE("Failed to acquire lock.");
- }
- }
-#endif
-}
-
-int interaction_with_handle(int lock_handle, int duration, int num_args, int opt_list[])
-{
-#ifdef INTERACTION_BOOST
- if (duration < 0 || num_args < 1 || opt_list[0] == 0)
- return 0;
-
- if (qcopt_handle) {
- if (perf_lock_acq) {
- lock_handle = perf_lock_acq(lock_handle, duration, opt_list, num_args);
- if (lock_handle == -1)
- ALOGE("Failed to acquire lock.");
- }
- }
- return lock_handle;
-#else
- return 0;
-#endif
-}
-
-void release_request(int lock_handle) {
- if (qcopt_handle && perf_lock_rel)
- perf_lock_rel(lock_handle);
-}
-
-void perform_hint_action(int hint_id, int resource_values[], int num_resources)
-{
- if (qcopt_handle) {
- struct hint_data temp_hint_data = {
- .hint_id = hint_id
- };
- struct list_node *found_node = find_node(&active_hint_list_head,
- &temp_hint_data);
- if (found_node) {
- ALOGE("hint ID %d already active", hint_id);
- return;
- }
- if (perf_lock_acq) {
- /* Acquire an indefinite lock for the requested resources. */
- int lock_handle = perf_lock_acq(0, 0, resource_values,
- num_resources);
-
- if (lock_handle == -1) {
- ALOGE("%s: Failed to acquire lock.", __func__);
- } else {
- /* Add this handle to our internal hint-list. */
- struct hint_data *new_hint =
- (struct hint_data *)malloc(sizeof(struct hint_data));
-
- if (new_hint) {
- if (!active_hint_list_head.compare) {
- active_hint_list_head.compare =
- (int (*)(void *, void *))hint_compare;
- active_hint_list_head.dump = (void (*)(void *))hint_dump;
- }
-
- new_hint->hint_id = hint_id;
- new_hint->perflock_handle = lock_handle;
-
- if (add_list_node(&active_hint_list_head, new_hint) == NULL) {
- free(new_hint);
- /* Can't keep track of this lock. Release it. */
- if (perf_lock_rel)
- perf_lock_rel(lock_handle);
-
- ALOGE("Failed to process hint.");
- }
- } else {
- /* Can't keep track of this lock. Release it. */
- if (perf_lock_rel)
- perf_lock_rel(lock_handle);
-
- ALOGE("Failed to process hint.");
- }
- }
- }
- }
-}
-
-void undo_hint_action(int hint_id)
-{
- if (qcopt_handle) {
- if (perf_lock_rel) {
- /* Get hint-data associated with this hint-id */
- struct list_node *found_node;
- struct hint_data temp_hint_data = {
- .hint_id = hint_id
- };
-
- found_node = find_node(&active_hint_list_head,
- &temp_hint_data);
-
- if (found_node) {
- /* Release this lock. */
- struct hint_data *found_hint_data =
- (struct hint_data *)(found_node->data);
-
- if (found_hint_data) {
- if (perf_lock_rel(found_hint_data->perflock_handle) == -1)
- ALOGE("Perflock release failed: %d", hint_id);
- }
-
- if (found_node->data) {
- /* We can free the hint-data for this node. */
- free(found_node->data);
- }
-
- remove_list_node(&active_hint_list_head, found_node);
- ALOGV("Undo of hint ID %d succeeded", hint_id);
- } else {
- ALOGE("Invalid hint ID: %d", hint_id);
- }
- }
- }
-}
-
-/*
- * Used to release initial lock holding
- * two cores online when the display is on
- */
-void undo_initial_hint_action()
-{
- if (qcopt_handle) {
- if (perf_lock_rel) {
- perf_lock_rel(1);
- }
- }
-}
diff --git a/power/utils.h b/power/utils.h
deleted file mode 100644
index fb7aa113..00000000
--- a/power/utils.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2012-2013,2015-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.
- */
-
-
-#ifndef UTILS_H
-#define UTILS_H
-#include
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int sysfs_read(char *path, char *s, int num_bytes);
-int sysfs_write(char *path, char *s);
-int get_scaling_governor(char governor[], int size);
-int get_scaling_governor_check_cores(char governor[], int size, int core_num);
-int is_interactive_governor(char *);
-
-void vote_ondemand_io_busy_off();
-void unvote_ondemand_io_busy_off();
-void vote_ondemand_sdf_low();
-void unvote_ondemand_sdf_low();
-void perform_hint_action(int hint_id, int resource_values[],
- int num_resources);
-void undo_hint_action(int hint_id);
-void release_request(int lock_handle);
-int interaction_with_handle(int lock_handle,
- int duration,
- int num_args,
- int opt_list[]);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //UTILS_H
\ No newline at end of file
diff --git a/powerhint.json b/powerhint.json
new file mode 100644
index 00000000..f0789744
--- /dev/null
+++ b/powerhint.json
@@ -0,0 +1,453 @@
+{
+ "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
index 19373d49..01d6e424 100755
--- a/powerhint.xml
+++ b/powerhint.xml
@@ -39,7 +39,6 @@
-
@@ -69,12 +68,35 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sepolicy/private/certs/wfcactivation.x509.pem b/sepolicy/private/certs/wfcactivation.x509.pem
new file mode 100644
index 00000000..bead020b
--- /dev/null
+++ b/sepolicy/private/certs/wfcactivation.x509.pem
@@ -0,0 +1,23 @@
+-----BEGIN CERTIFICATE-----
+MIIDyTCCArGgAwIBAgIJAODrqTpclyUkMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNV
+BAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1Nb3VudGFpbiBW
+aWV3MRQwEgYDVQQKDAtHb29nbGUgSW5jLjEQMA4GA1UECwwHQW5kcm9pZDEXMBUG
+A1UEAwwOd2ZjX2FjdGl2YXRpb24wHhcNMTgwMjIxMDA1NTM4WhcNNDUwNzA5MDA1
+NTM4WjB7MQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UE
+BwwNTW91bnRhaW4gVmlldzEUMBIGA1UECgwLR29vZ2xlIEluYy4xEDAOBgNVBAsM
+B0FuZHJvaWQxFzAVBgNVBAMMDndmY19hY3RpdmF0aW9uMIIBIjANBgkqhkiG9w0B
+AQEFAAOCAQ8AMIIBCgKCAQEAruKdMaQjRrlTwLHWAhUwLXoq+1glzoQ5ibqHDg4i
+GPPlwT7qPG8xWW6UmTiLNES6YSDpvCvptqrZccecviYfYIg7/JCF/xr2cFt9Gyyo
+L0muemdUMFjGQJxKCQMi8jlqPVgfcy7ZEfVvoDWUupD7hVVA6TFkWH1nv/5GzJVK
+h7D4vBaYE6qwM1+NJjrbk1O8SMMCES7MkJhpnfbRYr8d5uxSzDWqqeqvM6CFSvKw
+cxqbCcNl0MDgSCgtnxzZZjg5AFuPECV8lgJpxFEqgEIK1fsebK5G8o4buokMW+W4
+ZT2LZtMq/qsZXl59h22KQX2w5mcI6KyV8WZOcPPOm8uf8wIDAQABo1AwTjAdBgNV
+HQ4EFgQU9jpHDUfkIqBODCp9/c5TsraA9sowHwYDVR0jBBgwFoAU9jpHDUfkIqBO
+DCp9/c5TsraA9sowDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAZMf+
+KD3oFS0cv/C0qQx28wW5BKFb/PM6RxDwTRF7yyJj4+uZU0+O8NJEqBNDgHusFJR6
+2ZXXiWDqzNb0scZxD95FP1YxiLPAcbn2oCTkGPYcCsBmT1i25RsIKTb7fR3UJ/bY
+V55CQy1FjX5H1katVpezi1bs17stqrjL0aCk8s7wZPQ9KTy7SfMF9rUfg8ltrj8s
+MD5cq21GJuJMpI2kNUV7IT+4B3CeHzpm0iy8NmbavgNezZAx1za4QIySNcKfdsSs
+7PsNYPS0R9BeZK/4u4/yrQvRV0lXzQcIJPpwr0cfuhcgcHG8sbCLaw4Ph6go9kRL
+hvY7ZX9pdBLS8ukQ4w==
+-----END CERTIFICATE-----
diff --git a/sepolicy/private/keys.conf b/sepolicy/private/keys.conf
new file mode 100644
index 00000000..9b0aa03d
--- /dev/null
+++ b/sepolicy/private/keys.conf
@@ -0,0 +1,2 @@
+[@WFCACTIVATION]
+ALL : device/google/wahoo/sepolicy/private/certs/wfcactivation.x509.pem
diff --git a/sepolicy/private/mac_permissions.xml b/sepolicy/private/mac_permissions.xml
new file mode 100644
index 00000000..636d5794
--- /dev/null
+++ b/sepolicy/private/mac_permissions.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
diff --git a/sepolicy/private/platform_app.te b/sepolicy/private/platform_app.te
new file mode 100644
index 00000000..f8133eee
--- /dev/null
+++ b/sepolicy/private/platform_app.te
@@ -0,0 +1 @@
+allow platform_app qchook_service:service_manager find;
diff --git a/sepolicy/private/radio.te b/sepolicy/private/radio.te
index 9e505223..d187ca8e 100644
--- a/sepolicy/private/radio.te
+++ b/sepolicy/private/radio.te
@@ -1 +1,2 @@
allow radio uce_service:service_manager find;
+add_service(radio, qchook_service)
diff --git a/sepolicy/private/seapp_contexts b/sepolicy/private/seapp_contexts
new file mode 100644
index 00000000..9dde7c20
--- /dev/null
+++ b/sepolicy/private/seapp_contexts
@@ -0,0 +1,6 @@
+#Add new domain for DataServices
+#TODO Remove user "system" when b/38043081 is resolved
+user=system seinfo=platform name=.dataservices domain=dataservice_app type=system_app_data_file
+
+# Domain for WfcActivation app
+user=_app seinfo=wfcactivation name=com.google.android.wfcactivation domain=wfc_activation_app levelFrom=all
diff --git a/sepolicy/private/service.te b/sepolicy/private/service.te
index d6581237..e5abcaab 100644
--- a/sepolicy/private/service.te
+++ b/sepolicy/private/service.te
@@ -1,2 +1,3 @@
type cne_service, service_manager_type;
type uce_service, service_manager_type;
+type qchook_service, service_manager_type;
diff --git a/sepolicy/private/service_contexts b/sepolicy/private/service_contexts
index 20fa4e6e..bf26183b 100644
--- a/sepolicy/private/service_contexts
+++ b/sepolicy/private/service_contexts
@@ -2,3 +2,4 @@ qti.ims.ext u:object_r:radio_service:s0
cneservice u:object_r:cne_service:s0
uce u:object_r:uce_service:s0
rcs u:object_r:radio_service:s0
+qchook u:object_r:qchook_service:s0
diff --git a/sepolicy/private/wfc_activation_app.te b/sepolicy/private/wfc_activation_app.te
new file mode 100644
index 00000000..cd32efc4
--- /dev/null
+++ b/sepolicy/private/wfc_activation_app.te
@@ -0,0 +1,9 @@
+type wfc_activation_app, domain, coredomain;
+
+app_domain(wfc_activation_app)
+net_domain(wfc_activation_app)
+
+# Services
+allow wfc_activation_app app_api_service:service_manager find;
+allow wfc_activation_app qchook_service:service_manager find;
+allow wfc_activation_app radio_service:service_manager find;
diff --git a/sepolicy/vendor/atfwd.te b/sepolicy/vendor/atfwd.te
index ad96a120..6dbd56bb 100644
--- a/sepolicy/vendor/atfwd.te
+++ b/sepolicy/vendor/atfwd.te
@@ -13,4 +13,4 @@ allowxperm atfwd self:socket ioctl msm_sock_ipc_ioctls;
r_dir_file(atfwd, sysfs_type)
-set_prop(atfwd, radio_prop)
+set_prop(atfwd, vendor_radio_prop)
diff --git a/sepolicy/vendor/audioserver.te b/sepolicy/vendor/audioserver.te
index 02c801ca..4dd8b7cc 100644
--- a/sepolicy/vendor/audioserver.te
+++ b/sepolicy/vendor/audioserver.te
@@ -1,6 +1,4 @@
binder_call(audioserver, bootanim)
-allow audioserver perfd_socket:sock_file write;
-
allow audioserver sysfs_soc:file r_file_perms;
allow audioserver sysfs_soc:dir search;
diff --git a/sepolicy/vendor/bluetooth.te b/sepolicy/vendor/bluetooth.te
index 0f5673a9..a71c1450 100644
--- a/sepolicy/vendor/bluetooth.te
+++ b/sepolicy/vendor/bluetooth.te
@@ -1,4 +1,5 @@
typeattribute bluetooth system_writes_vendor_properties_violators;
+set_prop(bluetooth, vendor_bluetooth_prop)
set_prop(bluetooth, wc_prop)
# Allow access to net_admin ioctls
diff --git a/sepolicy/vendor/bug_map b/sepolicy/vendor/bug_map
index 247386bc..b25e3266 100644
--- a/sepolicy/vendor/bug_map
+++ b/sepolicy/vendor/bug_map
@@ -1,3 +1,4 @@
+bootanim vendor_default_prop file 79617173
cnd vendor_shell_exec file 77922167
drmserver app_data_file dir 77869200
drmserver sdcardfs dir 77869200
@@ -18,8 +19,14 @@ netutils_wrapper sysfs_timestamp_switch file 77871509
netutils_wrapper tmpfs dir 77871509
netutils_wrapper vendor_app_file dir 77871509
netutils_wrapper vendor_framework_file dir 77871509
+nfc vendor_default_prop file 79617173
per_proxy exported3_system_prop file 79541095
+priv_app vendor_default_prop file 79617173
+platform_app vendor_default_prop file 79617173
radio vendor_default_prop file 77915129
rfs_access unlabeled file 78019660
rild system_prop file 77960261
+surfaceflinger vendor_default_prop file 79617173
+system_app vendor_default_prop file 79617173
thermal-engine thermal-engine capability 78019417
+untrusted_app vendor_default_prop file 79617173
diff --git a/sepolicy/vendor/charger.te b/sepolicy/vendor/charger.te
new file mode 100644
index 00000000..e8472810
--- /dev/null
+++ b/sepolicy/vendor/charger.te
@@ -0,0 +1,2 @@
+typeattribute charger system_writes_vendor_properties_violators;
+set_prop(charger, public_vendor_system_prop)
diff --git a/sepolicy/vendor/con_monitor.te b/sepolicy/vendor/con_monitor.te
new file mode 100644
index 00000000..8730e566
--- /dev/null
+++ b/sepolicy/vendor/con_monitor.te
@@ -0,0 +1,12 @@
+# ConnectivityMonitor app
+type con_monitor_app, domain;
+
+app_domain(con_monitor_app)
+
+set_prop(con_monitor_app, radio_prop)
+allow con_monitor_app app_api_service:service_manager find;
+allow con_monitor_app radio_vendor_data_file:dir rw_dir_perms;
+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
diff --git a/sepolicy/vendor/domain.te b/sepolicy/vendor/domain.te
index eedf87fd..0a0cc413 100644
--- a/sepolicy/vendor/domain.te
+++ b/sepolicy/vendor/domain.te
@@ -5,3 +5,7 @@
allow domain debugfs_kgsl:dir search;
allow domain debugfs_ion:dir search;
+
+get_prop(domain, public_vendor_default_prop)
+get_prop(domain, public_vendor_system_prop)
+get_prop(domain, vendor_radio_prop)
diff --git a/sepolicy/vendor/dumpstate.te b/sepolicy/vendor/dumpstate.te
index e2bdda42..6892e27f 100644
--- a/sepolicy/vendor/dumpstate.te
+++ b/sepolicy/vendor/dumpstate.te
@@ -10,9 +10,6 @@ userdebug_or_eng(`
binder_call(dumpstate, per_mgr)
')
-allow hal_dumpstate sysfs_batteryinfo:dir search;
-allow hal_dumpstate sysfs_batteryinfo:file rw_file_perms;
-
# For collecting bugreports.
allow dumpstate sysfs_scsi_devices_0000:file r_file_perms;
allow dumpstate sysfs_scsi_devices_other:file r_file_perms;
diff --git a/sepolicy/vendor/file.te b/sepolicy/vendor/file.te
index e8e080aa..108b7361 100644
--- a/sepolicy/vendor/file.te
+++ b/sepolicy/vendor/file.te
@@ -8,6 +8,7 @@ type sysfs_laser, sysfs_type, fs_type;
type sysfs_mdss_mdp_caps, sysfs_type, fs_type;
type sysfs_msm_subsys, sysfs_type, fs_type;
type sysfs_msm_subsys_restart, sysfs_type, fs_type;
+type sysfs_msm_wlan, sysfs_type, fs_type;
type sysfs_rmtfs, sysfs_type, fs_type;
type sysfs_soc, sysfs_type, fs_type;
type sysfs_scsi_devices_0000, sysfs_type, fs_type;
@@ -17,6 +18,8 @@ type sysfs_timestamp_switch, sysfs_type, fs_type;
type sysfs_touch, sysfs_type, fs_type;
type sysfs_usb_c, sysfs_type, fs_type;
type sysfs_usb_device, sysfs_type, fs_type;
+# b/70518189 vDSO experiments
+type sysfs_vdso, fs_type, sysfs_type;
type debugfs_clk, debugfs_type, fs_type;
type debugfs_ion, debugfs_type, fs_type;
@@ -29,7 +32,9 @@ type debugfs_wlan, debugfs_type, fs_type;
type debugfs_mdp, debugfs_type, fs_type;
type debugfs_icnss, debugfs_type, fs_type;
type debugfs_ufs, debugfs_type, fs_type;
+type debugfs_fg_sram, debugfs_type, fs_type;
type debugfs_dma_bufinfo, debugfs_type, fs_type;
+type debugfs_tzdbg, debugfs_type, fs_type;
# /proc
type proc_wifi_dbg, fs_type, proc_type;
@@ -58,6 +63,7 @@ type persist_haptics_file, file_type;
type persist_rfs_file, file_type;
type persist_sensors_file, file_type;
type persist_time_file, file_type;
+type persist_battery_file, file_type;
type netmgr_data_file, file_type, data_file_type;
type ipa_vendor_data_file, file_type, data_file_type;
diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts
index 1a4a37f1..bafabd93 100644
--- a/sepolicy/vendor/file_contexts
+++ b/sepolicy/vendor/file_contexts
@@ -122,7 +122,7 @@
# files in /vendor
/vendor/bin/hw/android\.hardware\.dumpstate@1\.0-service.wahoo u:object_r:hal_dumpstate_impl_exec:s0
/vendor/bin/hw/android\.hardware\.vr@1\.0-service.wahoo u:object_r:hal_vr_default_exec:s0
-/vendor/bin/hw/android\.hardware\.biometrics\.fingerprint@2\.1-service.wahoo u:object_r:hal_fingerprint_default_exec:s0
+/vendor/bin/hw/android\.hardware\.biometrics\.fingerprint@2\.1-service\.fpc u:object_r:hal_fingerprint_default_exec:s0
/vendor/bin/msm_irqbalance u:object_r:irqbalance_exec:s0
/vendor/bin/perfd u:object_r:perfd_exec:s0
/vendor/bin/thermal-engine u:object_r:thermal-engine_exec:s0
@@ -168,22 +168,26 @@
/vendor/bin/hw/android\.hardware\.oemlock@1\.0-service u:object_r:hal_oemlock_default_exec:s0
/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\.power@1\.1-service.wahoo u:object_r:hal_power_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 u:object_r:hal_power_default_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\.thermal@1\.0-service.wahoo u:object_r:hal_thermal_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/hw/android\.hardware\.drm@1\.0-service\.widevine u:object_r:hal_drm_widevine_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\.vibrator@1\.1-service\.wahoo u:object_r:hal_vibrator_default_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
@@ -200,9 +204,9 @@
/vendor/lib(64)?/libgsl\.so u:object_r:same_process_hal_file:s0
/vendor/lib(64)?/hw/vulkan\.msm8998\.so u:object_r:same_process_hal_file:s0
-/vendor/lib(64)?/libEGL_adreno\.so u:object_r:same_process_hal_file:s0
-/vendor/lib(64)?/libGLESv1_CM_adreno\.so u:object_r:same_process_hal_file:s0
-/vendor/lib(64)?/libGLESv2_adreno\.so u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/egl/libEGL_adreno\.so u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/egl/libGLESv1_CM_adreno\.so u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/egl/libGLESv2_adreno\.so u:object_r:same_process_hal_file:s0
/vendor/lib(64)?/libdrmutils\.so u:object_r:same_process_hal_file:s0
/vendor/lib(64)?/libdrm\.so u:object_r:same_process_hal_file:s0
@@ -215,7 +219,7 @@
# To test: run cts -m CtsRenderscriptTestCases
/vendor/lib(64)?/libRSDriver_adreno\.so u:object_r:same_process_hal_file:s0
/vendor/lib(64)?/libCB\.so u:object_r:same_process_hal_file:s0
-/vendor/lib(64)?/libllvm-qgl\.so u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libllvm-glnext\.so u:object_r:same_process_hal_file:s0
/vendor/lib(64)?/libbccQTI\.so u:object_r:same_process_hal_file:s0
/vendor/lib(64)?/libllvm-qcom\.so u:object_r:same_process_hal_file:s0
/vendor/lib(64)?/librs_adreno\.so u:object_r:same_process_hal_file:s0
@@ -226,9 +230,6 @@
# needed by radio
/vendor/lib(64)?/libimsmedia_jni\.so u:object_r:same_process_hal_file:s0
-# libGLESv2_adreno depends on this
-/vendor/lib(64)?/libllvm-glnext\.so u:object_r:same_process_hal_file:s0
-
# Hexagon DSP host runtime and DSP-side executable needed for Halide operation
/vendor/lib(64)?/libadsprpc\.so u:object_r:same_process_hal_file:s0
/vendor/lib/dsp/fastrpc_shell_0 u:object_r:hexagon_halide_file:s0
@@ -249,7 +250,7 @@
/data/vendor/display(/.*)? u:object_r:display_vendor_data_file:s0
/data/vendor/nfc(/.*)? u:object_r:nfc_vendor_data_file:s0
/data/vendor/radio(/.*)? u:object_r:radio_vendor_data_file:s0
-/data/vendor/wifi(/.*)? u:object_r:cnss_vendor_data_file:s0
+/data/vendor/wifi/cnss_diag(/.*)? u:object_r:cnss_vendor_data_file:s0
/data/vendor/ramdump(/.*)? u:object_r:ramdump_vendor_data_file:s0
/data/vendor/ssrdump(/.*)? u:object_r:ramdump_vendor_data_file:s0
/data/vendor/modem_dump(/.*)? u:object_r:modem_dump_file:s0
@@ -281,6 +282,7 @@
/persist/rfs(/.*)? u:object_r:persist_rfs_file:s0
/persist/sensors(/.*)? u:object_r:persist_sensors_file:s0
/persist/time(/.*)? u:object_r:persist_time_file:s0
+/persist/battery(/.*)? u:object_r:persist_battery_file:s0
-/metadata u:object_r:rootfs:s0
-/metadata/.* u:object_r:vold_data_file:s0
+# b/70518189 vDSO experiments
+/sys/module/vdso/parameters u:object_r:sysfs_vdso:s0
diff --git a/sepolicy/vendor/genfs_contexts b/sepolicy/vendor/genfs_contexts
index 9dc26438..80a2fc7a 100644
--- a/sepolicy/vendor/genfs_contexts
+++ b/sepolicy/vendor/genfs_contexts
@@ -59,12 +59,13 @@ genfscon sysfs /devices/soc/8c0000.qcom,msm-cam u:object
genfscon sysfs /devices/soc0 u:object_r:sysfs_soc:s0
genfscon sysfs /devices/soc/caa0000.qcom,jpeg u:object_r:sysfs_camera:s0
genfscon sysfs /devices/soc/caa4000.qcom,fd u:object_r:sysfs_camera:s0
-genfscon sysfs /devices/soc/800f000.qcom,spmi/spmi-0/spmi0-02/800f000.qcom,spmi:qcom,pmi8998@2:qpnp,fg/power_supply u:object_r:sysfs_batteryinfo:s0
+genfscon sysfs /devices/soc/800f000.qcom,spmi/spmi-0/spmi0-02/800f000.qcom,spmi:qcom,pmi8998@2:qpnp,fg u:object_r:sysfs_batteryinfo:s0
genfscon sysfs /devices/soc/800f000.qcom,spmi/spmi-0/spmi0-02/800f000.qcom,spmi:qcom,pmi8998@2:qcom,qpnp-smb2/power_supply u:object_r:sysfs_batteryinfo:s0
genfscon sysfs /bus/msm_subsys u:object_r:sysfs_msm_subsys:s0
genfscon sysfs /module/subsystem_restart u:object_r:sysfs_msm_subsys_restart:s0
genfscon sysfs /kernel/boot_adsp/boot u:object_r:sysfs_msm_subsys:s0
genfscon sysfs /kernel/boot_slpi/boot u:object_r:sysfs_msm_subsys:s0
+genfscon sysfs /kernel/wifi/wlan u:object_r:sysfs_msm_wlan:s0
genfscon sysfs /devices/soc/c1b7000.i2c/i2c-9/9-0008 u:object_r:sysfs_easel:s0
genfscon sysfs /class/typec u:object_r:sysfs_usb_c:s0
genfscon sysfs /class/typec/usbc0 u:object_r:sysfs_usb_c:s0
@@ -93,5 +94,6 @@ genfscon debugfs /mdp u:object_r:debugfs_mdp:s0
genfscon debugfs /rmt_storage u:object_r:debugfs_rmt_storage:s0
genfscon debugfs /icnss u:object_r:debugfs_icnss:s0
genfscon debugfs /ufshcd0 u:object_r:debugfs_ufs:s0
-
+genfscon debugfs /fg/sram u:object_r:debugfs_fg_sram:s0
genfscon debugfs /dma_buf/bufinfo u:object_r:debugfs_dma_bufinfo:s0
+genfscon debugfs /tzdbg u:object_r:debugfs_tzdbg:s0
diff --git a/sepolicy/vendor/hal_audio_default.te b/sepolicy/vendor/hal_audio_default.te
index 357b4cdf..47f4f7e3 100644
--- a/sepolicy/vendor/hal_audio_default.te
+++ b/sepolicy/vendor/hal_audio_default.te
@@ -3,8 +3,10 @@ r_dir_file(hal_audio_default, sysfs_soc)
allow hal_audio_default audio_vendor_data_file:dir rw_dir_perms;
allow hal_audio_default audio_vendor_data_file:file create_file_perms;
-allow hal_audio_default perfd:unix_stream_socket connectto;
-allow hal_audio_default perfd_socket:sock_file write;
+dontaudit hal_audio_default perfd:unix_stream_socket connectto;
+dontaudit hal_audio_default perfd_socket:sock_file write;
+
+hal_client_domain(hal_audio_default, hal_power)
userdebug_or_eng(`
allow hal_audio diag_device:chr_file rw_file_perms;
diff --git a/sepolicy/vendor/hal_bluetooth_default.te b/sepolicy/vendor/hal_bluetooth_default.te
index d345ee72..6725dead 100644
--- a/sepolicy/vendor/hal_bluetooth_default.te
+++ b/sepolicy/vendor/hal_bluetooth_default.te
@@ -6,4 +6,17 @@ allow hal_bluetooth_default wcnss_filter:unix_stream_socket connectto;
allow hal_bluetooth fwk_scheduler_hwservice:hwservice_manager find;
allow hal_bluetooth system_server:binder call;
+set_prop(hal_bluetooth_default, vendor_bluetooth_prop)
set_prop(hal_bluetooth_default, wc_prop)
+
+userdebug_or_eng(`
+ allow hal_bluetooth_default diag_device:chr_file rw_file_perms;
+ allow hal_bluetooth_default ramdump_vendor_data_file:dir w_dir_perms;
+ allow hal_bluetooth_default ramdump_vendor_data_file:file { create w_file_perms };
+ allow hal_bluetooth_default sysfs_timestamp_switch:file r_file_perms;
+ r_dir_file(hal_bluetooth_default, debugfs_ipc)
+ r_dir_file(hal_bluetooth_default, sysfs_diag)
+ set_prop(hal_bluetooth_default, vendor_ssr_prop)
+')
+
+dontaudit hal_bluetooth_default diag_device:chr_file rw_file_perms;
diff --git a/sepolicy/vendor/hal_camera.te b/sepolicy/vendor/hal_camera.te
index 15447cc3..ad9a0307 100644
--- a/sepolicy/vendor/hal_camera.te
+++ b/sepolicy/vendor/hal_camera.te
@@ -1,7 +1,7 @@
# communicate with perfd
-allow hal_camera perfd:unix_stream_socket connectto;
-allow hal_camera perfd_socket:sock_file write;
-allow hal_camera perfd_socket:sock_file w_file_perms;
+dontaudit hal_camera perfd:unix_stream_socket connectto;
+dontaudit hal_camera perfd_socket:sock_file write;
+dontaudit hal_camera perfd_socket:sock_file w_file_perms;
allow hal_camera self:capability sys_nice;
diff --git a/sepolicy/vendor/hal_drm_widevine.te b/sepolicy/vendor/hal_drm_widevine.te
index a8750c6c..f2725022 100644
--- a/sepolicy/vendor/hal_drm_widevine.te
+++ b/sepolicy/vendor/hal_drm_widevine.te
@@ -1,4 +1,4 @@
-# policy for /vendor/bin/hw/android.hardware.drm@1.0-service.widevine
+# 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 5387dc36..39a89957 100644
--- a/sepolicy/vendor/hal_dumpstate_impl.te
+++ b/sepolicy/vendor/hal_dumpstate_impl.te
@@ -19,6 +19,8 @@ userdebug_or_eng(`
allow hal_dumpstate_impl netmgr_data_file:file r_file_perms;
allow hal_dumpstate_impl debugfs_ipc:dir r_dir_perms;
allow hal_dumpstate_impl debugfs_ipc:file r_file_perms;
+ allow hal_dumpstate_impl debugfs_tzdbg:dir search;
+ allow hal_dumpstate_impl debugfs_tzdbg:file r_file_perms;
allow hal_dumpstate_impl sysfs_usb_device:dir r_dir_perms;
allow hal_dumpstate_impl sysfs_usb_device:file r_file_perms;
allow hal_dumpstate_impl sysfs_msm_subsys:file write;
@@ -26,6 +28,8 @@ userdebug_or_eng(`
set_prop(hal_dumpstate_impl, modem_diag_prop)
')
+get_prop(hal_dumpstate_impl, vendor_radio_prop)
+
allow hal_dumpstate_impl uio_device:chr_file rw_file_perms;
r_dir_file(hal_dumpstate_impl, sysfs_uio)
r_dir_file(hal_dumpstate_impl, sysfs_rmtfs)
@@ -50,7 +54,7 @@ allow hal_dumpstate_impl debugfs_ufs:file r_file_perms;
allow hal_dumpstate_impl sysfs:dir r_dir_perms;
# rpm stat
# usb logs
-userdebug_or_eng(`allow hal_dumpstate_impl debugfs_usb:file r_file_perms;')
+allow hal_dumpstate_impl debugfs_usb:file r_file_perms;
#Access display debug data
allow hal_dumpstate_impl display_vendor_data_file:dir r_dir_perms;
@@ -68,3 +72,11 @@ allow hal_dumpstate_impl sysfs_scsi_devices_0000:file r_file_perms;
allow hal_dumpstate_impl shell_data_file:file getattr;
userdebug_or_eng(`allow hal_dumpstate_impl debugfs_dma_bufinfo:file r_file_perms;')
dontaudit hal_dumpstate_impl debugfs_dma_bufinfo:file r_file_perms;
+
+# Query and dump power supply nodes
+allow hal_dumpstate_impl sysfs_batteryinfo:dir search;
+allow hal_dumpstate_impl sysfs_batteryinfo:file r_file_perms;
+
+# Dump QCOM FG content
+allow hal_dumpstate_impl debugfs_fg_sram:dir search;
+allow hal_dumpstate_impl debugfs_fg_sram:file rw_file_perms;
diff --git a/sepolicy/vendor/hal_health_default.te b/sepolicy/vendor/hal_health_default.te
new file mode 100644
index 00000000..bb3a65a7
--- /dev/null
+++ b/sepolicy/vendor/hal_health_default.te
@@ -0,0 +1,11 @@
+r_dir_file(hal_health_default, sysfs_msm_subsys)
+
+allow hal_health_default debugfs_ufs:dir search;
+allow hal_health_default sysfs_scsi_devices_0000:dir search;
+allow hal_health_default debugfs_ufs:file { getattr open read };
+allow hal_health_default sysfs_scsi_devices_0000:file { getattr open read };
+
+allow hal_health_default persist_battery_file:file create_file_perms;
+allow hal_health_default persist_battery_file:dir rw_dir_perms;
+allow hal_health_default persist_file:dir search;
+allow hal_health_default sysfs_batteryinfo:file rw_file_perms;
diff --git a/sepolicy/vendor/hal_nfc_default.te b/sepolicy/vendor/hal_nfc_default.te
index 7367b5a6..21614c4f 100644
--- a/sepolicy/vendor/hal_nfc_default.te
+++ b/sepolicy/vendor/hal_nfc_default.te
@@ -4,3 +4,4 @@ allow hal_nfc_default nfc_vendor_data_file:file create_file_perms;
dontaudit hal_nfc_default nxpese_hwservice:hwservice_manager find;
dontaudit hal_nfc_default nxpnfc_hwservice:hwservice_manager add;
+dontaudit hal_nfc_default persist_nfc_prop:file read;
diff --git a/sepolicy/vendor/hal_power_default.te b/sepolicy/vendor/hal_power_default.te
index b588634b..dce10ed5 100644
--- a/sepolicy/vendor/hal_power_default.te
+++ b/sepolicy/vendor/hal_power_default.te
@@ -1,6 +1,3 @@
-allow hal_power_default perfd:unix_stream_socket connectto;
-allow hal_power_default perfd_socket:sock_file write;
-
allow hal_power_default sysfs_graphics:dir search;
allow hal_power_default sysfs_graphics:file r_file_perms;
@@ -8,3 +5,18 @@ 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;
+allow hal_power_default sysfs_devices_system_cpu:file rw_file_perms;
+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;
+
+# To get/set powerhal state property
+set_prop(hal_power_default, power_prop)
diff --git a/sepolicy/vendor/hal_usb_impl.te b/sepolicy/vendor/hal_usb_impl.te
index dcacb723..98587dca 100644
--- a/sepolicy/vendor/hal_usb_impl.te
+++ b/sepolicy/vendor/hal_usb_impl.te
@@ -7,8 +7,10 @@ init_daemon_domain(hal_usb_impl)
allow hal_usb_impl sysfs_msm_subsys:dir search;
allow hal_usb_impl sysfs_msm_subsys:file r_file_perms;
-allow hal_usb_impl sysfs_usb_c:dir r_dir_perms;
-allow hal_usb_impl sysfs_usb_c:lnk_file read;
-allow hal_usb_impl sysfs_usb_c:file rw_file_perms;
+r_dir_file(hal_usb_impl, sysfs_usb_c)
+allow hal_usb_impl sysfs_usb_c:file w_file_perms;
allow hal_usb_impl sysfs_usb_device:dir r_dir_perms;
allow hal_usb_impl sysfs_usb_device:file rw_file_perms;
+allow hal_usb_impl configfs:file create_file_perms;
+
+set_prop(hal_usb_impl, vendor_usb_config_prop)
diff --git a/sepolicy/vendor/hal_wifi_supplicant_default.te b/sepolicy/vendor/hal_wifi_supplicant_default.te
index 4f13574e..cab782ac 100644
--- a/sepolicy/vendor/hal_wifi_supplicant_default.te
+++ b/sepolicy/vendor/hal_wifi_supplicant_default.te
@@ -4,7 +4,3 @@ typeattribute hal_wifi_supplicant_default data_between_core_and_vendor_violators
allow hal_wifi_supplicant_default wifi_data_file:dir create_dir_perms;
allow hal_wifi_supplicant_default wifi_data_file:file create_file_perms;
-
-# Create a socket for receiving info from wpa
-allow hal_wifi_supplicant_default wpa_socket:dir create_dir_perms;
-allow hal_wifi_supplicant_default wpa_socket:sock_file create_file_perms;
diff --git a/sepolicy/vendor/hardware_info_app.te b/sepolicy/vendor/hardware_info_app.te
index 70cb8010..27ce4405 100644
--- a/sepolicy/vendor/hardware_info_app.te
+++ b/sepolicy/vendor/hardware_info_app.te
@@ -14,8 +14,7 @@ allow hardware_info_app shell_data_file:file { open read };
# SysFS
allow hardware_info_app sysfs_batteryinfo:dir search;
-allow hardware_info_app sysfs_batteryinfo:file { getattr open read write };
-allow hardware_info_app sysfs_batteryinfo:file write;
+allow hardware_info_app sysfs_batteryinfo:file { getattr open read };
allow hardware_info_app sysfs_camera:dir search;
allow hardware_info_app sysfs_camera:file { getattr open read };
allow hardware_info_app sysfs_msm_subsys:dir search;
@@ -24,3 +23,6 @@ allow hardware_info_app sysfs_scsi_devices_0000:file { getattr open read };
allow hardware_info_app sysfs_soc:dir search;
allow hardware_info_app sysfs_soc:file { getattr open read };
+# DebugFS
+allow hardware_info_app debugfs_ufs:dir search;
+allow hardware_info_app debugfs_ufs:file r_file_perms;
diff --git a/sepolicy/vendor/healthd.te b/sepolicy/vendor/healthd.te
new file mode 100644
index 00000000..6b22ced3
--- /dev/null
+++ b/sepolicy/vendor/healthd.te
@@ -0,0 +1,2 @@
+typeattribute healthd system_writes_vendor_properties_violators;
+set_prop(healthd, public_vendor_system_prop)
diff --git a/sepolicy/vendor/hostapd.te b/sepolicy/vendor/hostapd.te
deleted file mode 100644
index 86b985ae..00000000
--- a/sepolicy/vendor/hostapd.te
+++ /dev/null
@@ -1,11 +0,0 @@
-# TODO(b/36657258): Remove data_between_core_and_vendor_violators once
-# hostapd no longer directly accesses /data outside /data/vendor.
-typeattribute hostapd data_between_core_and_vendor_violators;
-# hostapd can read and write WiFi related data and configuration.
-allow hostapd wifi_data_file:file rw_file_perms;
-r_dir_file(hostapd, wifi_data_file)
-
-# hostapd wants to create the directory holding its control socket.
-allow hostapd hostapd_socket:dir create_dir_perms;
-# hostapd needs to create, bind to, read, and write its control socket.
-allow hostapd hostapd_socket:sock_file create_file_perms;
diff --git a/sepolicy/vendor/init-devstart-sh.te b/sepolicy/vendor/init-devstart-sh.te
index 9b762638..47de30f8 100644
--- a/sepolicy/vendor/init-devstart-sh.te
+++ b/sepolicy/vendor/init-devstart-sh.te
@@ -10,7 +10,7 @@ allow init-qcom-devstart-sh vendor_toolbox_exec:file rx_file_perms;
allow init-qcom-devstart-sh vendor_file:file rx_file_perms;
# Set the sys.qcom.devup property
-set_prop(init-qcom-devstart-sh, system_prop)
+set_prop(init-qcom-devstart-sh, public_vendor_system_prop)
# Set boot_adsp and boot_slpi to 1
allow init-qcom-devstart-sh sysfs_msm_subsys:file w_file_perms;
diff --git a/sepolicy/vendor/init-insmod-sh.te b/sepolicy/vendor/init-insmod-sh.te
index 024984a5..184dd03f 100644
--- a/sepolicy/vendor/init-insmod-sh.te
+++ b/sepolicy/vendor/init-insmod-sh.te
@@ -7,7 +7,7 @@ allow init-insmod-sh vendor_shell_exec:file rx_file_perms;
allow init-insmod-sh vendor_toolbox_exec:file rx_file_perms;
# Set the sys.touch.modules.ready property
-set_prop(init-insmod-sh, system_prop)
+set_prop(init-insmod-sh, public_vendor_system_prop)
# Allow insmod
allow init-insmod-sh self:capability sys_module;
diff --git a/sepolicy/vendor/init-wlan-sh.te b/sepolicy/vendor/init-wlan-sh.te
new file mode 100644
index 00000000..36179ef6
--- /dev/null
+++ b/sepolicy/vendor/init-wlan-sh.te
@@ -0,0 +1,14 @@
+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 sys.wlan.driver.version and sys.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/init.te b/sepolicy/vendor/init.te
index fe41cf49..0ecbfe5b 100644
--- a/sepolicy/vendor/init.te
+++ b/sepolicy/vendor/init.te
@@ -15,3 +15,6 @@ allow init boot_block_device:lnk_file relabelto;
allow init persist_block_device:lnk_file relabelto;
dontaudit init kernel:system module_request;
+
+# b/70518189 vDSO experiments
+allow init sysfs_vdso:file w_file_perms;
diff --git a/sepolicy/vendor/logger_app.te b/sepolicy/vendor/logger_app.te
index 46874dae..c5262ba6 100644
--- a/sepolicy/vendor/logger_app.te
+++ b/sepolicy/vendor/logger_app.te
@@ -19,4 +19,6 @@ userdebug_or_eng(`
set_prop(logger_app, cnss_diag_prop)
set_prop(logger_app, modem_diag_prop)
set_prop(logger_app, bluetooth_log_prop)
+
+ get_prop(logger_app, vendor_usb_config_prop)
')
diff --git a/sepolicy/vendor/mediacodec.te b/sepolicy/vendor/mediacodec.te
index eb6476fb..1bbadd8e 100644
--- a/sepolicy/vendor/mediacodec.te
+++ b/sepolicy/vendor/mediacodec.te
@@ -1,5 +1,7 @@
-allow mediacodec perfd:unix_stream_socket connectto;
-allow mediacodec perfd_socket:sock_file write;
+# VIDEO_DECODE_PLAYBACK_HINT is for interactive governor in HMP kernels
+# Do not grant the access
+dontaudit mediacodec perfd:unix_stream_socket connectto;
+dontaudit mediacodec perfd_socket:sock_file write;
allow mediacodec sysfs_soc:file r_file_perms;
allow mediacodec sysfs_soc:dir search;
diff --git a/sepolicy/vendor/netmgrd.te b/sepolicy/vendor/netmgrd.te
index 22c59775..c2454527 100644
--- a/sepolicy/vendor/netmgrd.te
+++ b/sepolicy/vendor/netmgrd.te
@@ -4,7 +4,7 @@ type netmgrd_exec, exec_type, vendor_file_type, file_type;
net_domain(netmgrd)
init_daemon_domain(netmgrd)
-set_prop(netmgrd, net_radio_prop)
+set_prop(netmgrd, vendor_net_radio_prop)
set_prop(netmgrd, net_rmnet_prop)
# communicate with netd
diff --git a/sepolicy/vendor/perfd.te b/sepolicy/vendor/perfd.te
index fa99d156..950e1d65 100644
--- a/sepolicy/vendor/perfd.te
+++ b/sepolicy/vendor/perfd.te
@@ -2,31 +2,3 @@ type perfd, domain;
type perfd_exec, exec_type, vendor_file_type, file_type;
init_daemon_domain(perfd)
-
-r_dir_file(perfd, sysfs_msm_subsys)
-
-# perfd uses kill(pid, 0) to determine if a process exists.
-# Determining if a process exists does not require the kill capability
-# since a permission denied indicates the process exists.
-dontaudit perfd self:capability kill;
-
-allow perfd mediacodec:process signull;
-allow perfd hal_power_default:process signull;
-
-allow perfd cgroup:file r_file_perms;
-allow perfd post_boot_prop:file r_file_perms;
-
-allow perfd proc:file rw_file_perms;
-allow perfd sysfs_clkscale:file r_file_perms;
-allow perfd sysfs_graphics:dir search;
-allow perfd sysfs_graphics:file r_file_perms;
-allow perfd sysfs_soc:dir search;
-allow perfd sysfs_soc:file r_file_perms;
-allow perfd sysfs_graphics:dir search;
-allow perfd sysfs_graphics:file r_file_perms;
-allow perfd sysfs_msm_subsys:file w_file_perms;
-allow perfd sysfs_devices_system_cpu:file w_file_perms;
-
-allow perfd perfd_socket:sock_file write;
-
-allow perfd latency_device:chr_file w_file_perms;
diff --git a/sepolicy/vendor/property.te b/sepolicy/vendor/property.te
index 9f38fab0..7651a235 100644
--- a/sepolicy/vendor/property.te
+++ b/sepolicy/vendor/property.te
@@ -3,15 +3,24 @@ type cnd_prop, property_type;
type ims_prop, property_type;
type keymaster_prop, property_type;
type net_rmnet_prop, property_type;
-type ramdump_prop, property_type;
+type vendor_ramdump_prop, property_type;
type post_boot_prop, property_type;
-type ssr_prop, property_type;
+type public_vendor_default_prop, property_type;
+type public_vendor_system_prop, property_type;
+type vendor_ssr_prop, property_type;
type cnss_diag_prop, property_type;
type tee_listener_prop, property_type;
type wc_prop, property_type;
type thermal_prop, property_type;
type modem_diag_prop, property_type;
-type tel_mon_prop, property_type;
type sys_time_prop, property_type;
type atfwd_start_prop, property_type;
type bluetooth_log_prop, property_type;
+type power_prop, property_type;
+type vendor_bluetooth_prop, property_type;
+type vendor_net_radio_prop, property_type;
+type vendor_radio_prop, property_type;
+type vendor_wifi_version, property_type;
+type vendor_usb_config_prop, property_type;
+type vendor_charge_prop, property_type;
+type persist_nfc_prop, property_type;
diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts
index 9094079c..112fcfa4 100644
--- a/sepolicy/vendor/property_contexts
+++ b/sepolicy/vendor/property_contexts
@@ -6,22 +6,204 @@ sys.ims. u:object_r:ims_prop:s0
vendor.ims. u:object_r:ims_prop:s0
sys.keymaster.loaded u:object_r:keymaster_prop:s0
net.r_rmnet_data0 u:object_r:net_rmnet_prop:s0
-persist.net.doxlat u:object_r:net_radio_prop:s0
+persist.net.doxlat u:object_r:vendor_net_radio_prop:s0
sys.post_boot. u:object_r:post_boot_prop:s0
-radio. u:object_r:radio_prop:s0
-rcs.publish.status u:object_r:radio_prop:s0
-debug.htc.hrdump u:object_r:ramdump_prop:s0
-debug.htc.ramdump u:object_r:ramdump_prop:s0
-persist.sys.crash_rcu u:object_r:ramdump_prop:s0
-debug.ssrdump u:object_r:ssr_prop:s0
+radio. u:object_r:vendor_radio_prop:s0
+rcs.publish.status u:object_r:vendor_radio_prop:s0
+vendor.debug.ramdump. u:object_r:vendor_ramdump_prop:s0
+persist.vendor.sys.crash_rcu u:object_r:vendor_ramdump_prop:s0
+vendor.debug.ssrdump u:object_r:vendor_ssr_prop:s0
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.thermal-engine u:object_r:thermal_prop:s0
+ctl.vendor.thermal-engine 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
-persist.radio.enable_tel_mon u:object_r:tel_mon_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
+sys.wlan.driver.version u:object_r:vendor_wifi_version:s0
+sys.wlan.firmware.version u:object_r:vendor_wifi_version:s0
+persist.vendor.usb.config u:object_r:vendor_usb_config_prop:s0
+vendor.usb.config u:object_r:vendor_usb_config_prop:s0
+persist.vendor.charge. u:object_r:vendor_charge_prop:s0
+
+# public_vendor_default_prop
+# They are public_vendor_default_props for vendor-specific extension.
+# Usually they are for vndk-sp libs and vendor apks.
+fastrpc.perf. u:object_r:public_vendor_default_prop:s0
+persist.cne.cqetimer u:object_r:public_vendor_default_prop:s0
+persist.cne.feature u:object_r:public_vendor_default_prop:s0
+persist.cne.logging.qxdm u:object_r:public_vendor_default_prop:s0
+persist.gcam. u:object_r:public_vendor_default_prop:s0
+persist.vendor.cnd.iwlan u:object_r:public_vendor_default_prop:s0
+persist.vendor.cnd.wqe u:object_r:public_vendor_default_prop:s0
+ro.graphics.memory u:object_r:public_vendor_default_prop:s0
+ro.boot.ddrsize u:object_r:public_vendor_default_prop:s0
+ro.boot.hardware.ddr u:object_r:public_vendor_default_prop:s0
+ro.boot.hardware.ufs u:object_r:public_vendor_default_prop:s0
+ro.qcom.adreno. u:object_r:public_vendor_default_prop:s0
+ro.vendor.graphics.memory u:object_r:public_vendor_default_prop:s0
+vendor.debug.egl.changepixelformat u:object_r:public_vendor_default_prop:s0
+vendor.debug.prerotation.disable u:object_r:public_vendor_default_prop:s0
+vendor.debug.rs. u:object_r:public_vendor_default_prop:s0
+
+# public_vendor_system_prop
+# They are public_vendor_system_props for vendor-specific extension.
+sys.all.modules.ready u:object_r:public_vendor_system_prop:s0
+sys.qcom.devup u:object_r:public_vendor_system_prop:s0
+sys.slpi.firmware.version u:object_r:public_vendor_system_prop:s0
+
+# vendor_default_prop
+# default_prop isn't accessible from vendor components.
+# So vendor_default_prop should be marked.
+audio_hal.in_period_size u:object_r:vendor_default_prop:s0
+audio_hal.period_multiplier u:object_r:vendor_default_prop:s0
+audio_hal.period_size u:object_r:vendor_default_prop:s0
+audio.adm. u:object_r:vendor_default_prop:s0
+audio.snd_card.open.retries u:object_r:vendor_default_prop:s0
+audio.usb.enable.debug u:object_r:vendor_default_prop:s0
+audio.volume.headset.gain.depcal u:object_r:vendor_default_prop:s0
+audio.volume.listener.dump u:object_r:vendor_default_prop:s0
+boost_override u:object_r:vendor_default_prop:s0
+cameradaemon.SaveMemAtBoot u:object_r:vendor_default_prop:s0
+camera.cpp. u:object_r:vendor_default_prop:s0
+camera.eis.fov_correction u:object_r:vendor_default_prop:s0
+camera.hdrplus.donotpoweroneasel u:object_r:vendor_default_prop:s0
+com.qti. u:object_r:vendor_default_prop:s0
+cpp.set.clock u:object_r:vendor_default_prop:s0
+disable.cpp.power.collapse u:object_r:vendor_default_prop:s0
+downmix_override_mode u:object_r:vendor_default_prop:s0
+fmas. u:object_r:vendor_default_prop:s0
+gpu.stats.debug.level u:object_r:vendor_default_prop:s0
+hw.hdmi.resolution u:object_r:vendor_default_prop:s0
+fpc_kpi u:object_r:vendor_default_prop:s0
+media.aac_51_output_enabled u:object_r:vendor_default_prop:s0
+mmp.enable.3g2 u:object_r:vendor_default_prop:s0
+mm.enable.qcom_parser u:object_r:vendor_default_prop:s0
+mm.enable.smoothstreaming u:object_r:vendor_default_prop:s0
+perflocks.predefined_clust_map u:object_r:vendor_default_prop:s0
+perflocks.predefined_freq_map u:object_r:vendor_default_prop:s0
+persist.audio.calfile0 u:object_r:vendor_default_prop:s0
+persist.audio.dualmic.config u:object_r:vendor_default_prop:s0
+persist.audio.fluence. u:object_r:vendor_default_prop:s0
+persist.cam.pp.feat.mask u:object_r:vendor_default_prop:s0
+persist.cne.override.memlimit u:object_r:vendor_default_prop:s0
+persist.data_netmgrd_mtu u:object_r:vendor_default_prop:s0
+persist.data_netmgrd_nint u:object_r:vendor_default_prop:s0
+persist.data.df. u:object_r:vendor_default_prop:s0
+persist.data.dont_use_epc u:object_r:vendor_default_prop:s0
+persist.data.dont_use_npflag u:object_r:vendor_default_prop:s0
+persist.data.dpm.enable u:object_r:vendor_default_prop:s0
+persist.data.dropssdp u:object_r:vendor_default_prop:s0
+persist.data.ibfc.enable u:object_r:vendor_default_prop:s0
+persist.data.iwlan.enable u:object_r:vendor_default_prop:s0
+persist.data.iwlan.ims.enable u:object_r:vendor_default_prop:s0
+persist.data.iwlan.rekey u:object_r:vendor_default_prop:s0
+persist.data.llf.enable u:object_r:vendor_default_prop:s0
+persist.data.mode u:object_r:vendor_default_prop:s0
+persist.data.netmgrd.qos.enable u:object_r:vendor_default_prop:s0
+persist.data.netmgrd.qos.hybrid u:object_r:vendor_default_prop:s0
+persist.data.netmgr.log_to_file u:object_r:vendor_default_prop:s0
+persist.data.netmgr.wl.timeout u:object_r:vendor_default_prop:s0
+persist.data.port_bridge.log u:object_r:vendor_default_prop:s0
+persist.data.profile_update u:object_r:vendor_default_prop:s0
+persist.data.qmi.adb_logmask u:object_r:vendor_default_prop:s0
+persist.data.rmnet.en u:object_r:vendor_default_prop:s0
+persist.data.target.msm8998 u:object_r:vendor_default_prop:s0
+persist.data.tcpackprio.enable u:object_r:vendor_default_prop:s0
+persist.data.wda.enable u:object_r:vendor_default_prop:s0
+persist.debug.sensors.elmyra.rate u:object_r:vendor_default_prop:s0
+persist.debug.sensors.hal u:object_r:vendor_default_prop:s0
+persist.debug.sf.showfps u:object_r:vendor_default_prop:s0
+persist.delta_time.enable u:object_r:vendor_default_prop:s0
+persist.enable.max.pending.buf u:object_r:vendor_default_prop:s0
+persist.env.spec u:object_r:vendor_default_prop:s0
+persist.fci u:object_r:vendor_default_prop:s0
+persist.fuse_sdcard u:object_r:vendor_default_prop:s0
+persist.hwc.blit.comp u:object_r:vendor_default_prop:s0
+persist.metadata_dynfps.disable u:object_r:vendor_default_prop:s0
+persist.msmirqbalance.debug u:object_r:vendor_default_prop:s0
+persist.net.logmask u:object_r:vendor_default_prop:s0
+persist.partial.skip u:object_r:vendor_default_prop:s0
+persist.pd_locater_debug u:object_r:vendor_default_prop:s0
+persist.qcril u:object_r:vendor_default_prop:s0
+persist.rild.nitz_ u:object_r:vendor_default_prop:s0
+persist.rmnet.data.enable u:object_r:vendor_default_prop:s0
+persist.sensors.elmyra.sensitivity u:object_r:vendor_default_prop:s0
+persist.sensors.hal_timeout u:object_r:vendor_default_prop:s0
+persist.sys.ssr.enable_ramdumps u:object_r:vendor_default_prop:s0
+persist.sys.ssr.restart_level u:object_r:vendor_default_prop:s0
+persist.timed.enable u:object_r:vendor_default_prop:s0
+persist.tnr.process.plates u:object_r:vendor_default_prop:s0
+qcom.bluetooth.soc u:object_r:vendor_default_prop:s0
+qcril.support.encrypted_calls u:object_r:vendor_default_prop:s0
+qdcm. u:object_r:vendor_default_prop:s0
+rild.libargs u:object_r:vendor_default_prop:s0
+rild.libpath u:object_r:vendor_default_prop:s0
+ro.alarm_boot u:object_r:vendor_default_prop:s0
+ro.boot.factoryota u:object_r:vendor_default_prop:s0
+ro.boot.mid u:object_r:vendor_default_prop:s0
+ro.boot.temp_protect_ignore u:object_r:vendor_default_prop:s0
+ro.camera.wrapper.hal3TrebleMinorVersion u:object_r:vendor_default_prop:s0
+ro.fota.oem u:object_r:vendor_default_prop:s0
+ro.lean u:object_r:vendor_default_prop:s0
+ro.min_freq_0 u:object_r:vendor_default_prop:s0
+ro.min_freq_4 u:object_r:vendor_default_prop:s0
+ro.oem_unlock.pst u:object_r:vendor_default_prop:s0
+ro.qcom. u:object_r:vendor_default_prop:s0
+ro.qc.sdk.audio.fluencetype u:object_r:vendor_default_prop:s0
+ro.qfusion_use_report_period u:object_r:vendor_default_prop:s0
+ro.qti. u:object_r:vendor_default_prop:s0
+ro.qualcomm. u:object_r:vendor_default_prop:s0
+ro.radio.log_loc u:object_r:vendor_default_prop:s0
+ro.radio.log_prefix u:object_r:vendor_default_prop:s0
+ro.rfkilldisabled u:object_r:vendor_default_prop:s0
+ro.vendor.build.svn u:object_r:vendor_default_prop:s0
+ro.vendor.extension_library u:object_r:vendor_default_prop:s0
+ro.vibrator.hal.click.duration u:object_r:vendor_default_prop:s0
+ro.vibrator.hal.tick.duration u:object_r:vendor_default_prop:s0
+ro.vibrator.hal.heavyclick.duration u:object_r:vendor_default_prop:s0
+sdm. u:object_r:vendor_default_prop:s0
+sys.disable_ext_animation u:object_r:vendor_default_prop:s0
+sys.display.low_persistence_mode_brightness u:object_r:vendor_default_prop:s0
+sys.hwc_disable_hdr u:object_r:vendor_default_prop:s0
+sys.qca1530 u:object_r:vendor_default_prop:s0
+vendor.audio.adm.buffering.ms u:object_r:vendor_default_prop:s0
+vendor.vidc.enc.dcvs.extra-buff-count u:object_r:vendor_default_prop:s0
+ubwc.no.compression u:object_r:vendor_default_prop:s0
+
+# vendor_radio_prop
+persist.radio.always_send_plmn u:object_r:vendor_radio_prop:s0
+persist.radio.apm_sim_not_pwdn u:object_r:vendor_radio_prop:s0
+persist.radio.custom_ecc u:object_r:vendor_radio_prop:s0
+persist.radio.data_con_rprt u:object_r:vendor_radio_prop:s0
+persist.radio.data_ltd_sys_ind u:object_r:vendor_radio_prop:s0
+persist.radio.is_wps_enabled u:object_r:vendor_radio_prop:s0
+persist.radio.RATE_ADAPT_ENABLE u:object_r:vendor_radio_prop:s0
+persist.radio.ROTATION_ENABLE u:object_r:vendor_radio_prop:s0
+persist.radio.sap_silent_pin u:object_r:vendor_radio_prop:s0
+persist.radio.sib16_support u:object_r:vendor_radio_prop:s0
+persist.radio.smlog_switch u:object_r:vendor_radio_prop:s0
+persist.radio.snapshot_enabled u:object_r:vendor_radio_prop:s0
+persist.radio.snapshot_timer u:object_r:vendor_radio_prop:s0
+persist.radio.videopause.mode u:object_r:vendor_radio_prop:s0
+persist.radio.VT_ENABLE u:object_r:vendor_radio_prop:s0
+persist.radio.VT_HYBRID_ENABLE u:object_r:vendor_radio_prop:s0
+
+# vendor_bluetooth_prop
+persist.vendor.bluetooth.a4wp u:object_r:vendor_bluetooth_prop:s0
+persist.vendor.bluetooth.csoc.cnt u:object_r:vendor_bluetooth_prop:s0
+persist.vendor.service.bdroid.fwsnoop u:object_r:vendor_bluetooth_prop:s0
+persist.vendor.service.bdroid.sibs u:object_r:vendor_bluetooth_prop:s0
+persist.vendor.service.bdroid.snooplog u:object_r:vendor_bluetooth_prop:s0
+persist.vendor.service.bdroid.soclog u:object_r:vendor_bluetooth_prop:s0
+persist.vendor.service.bdroid.ssrlvl u:object_r:vendor_bluetooth_prop:s0
+ro.vendor.bluetooth.emb_wp_mode u:object_r:vendor_bluetooth_prop:s0
+ro.vendor.bluetooth.wipower u:object_r:vendor_bluetooth_prop:s0
+
+# persist_nfc_prop
+persist.nfc. u:object_r:persist_nfc_prop:s0
diff --git a/sepolicy/vendor/radio.te b/sepolicy/vendor/radio.te
index 73d9b526..30a7838f 100644
--- a/sepolicy/vendor/radio.te
+++ b/sepolicy/vendor/radio.te
@@ -1,6 +1,5 @@
get_prop(radio, ims_prop)
typeattribute radio system_writes_vendor_properties_violators;
-userdebug_or_eng(`set_prop(radio, tel_mon_prop)')
allow radio qmuxd_socket:dir search;
allow radio qmuxd_socket:sock_file write;
@@ -33,3 +32,8 @@ userdebug_or_eng(`
')
dontaudit radio diag_device:chr_file rw_file_perms;
dontaudit radio sysfs_diag:dir search;
+
+# read /proc/cmdline
+allow radio proc_cmdline:file r_file_perms;
+
+get_prop(radio, vendor_radio_prop)
diff --git a/sepolicy/vendor/ramdump.te b/sepolicy/vendor/ramdump.te
index caa01582..7514dead 100644
--- a/sepolicy/vendor/ramdump.te
+++ b/sepolicy/vendor/ramdump.te
@@ -4,13 +4,16 @@ userdebug_or_eng(`
type ramdump, domain;
init_daemon_domain(ramdump)
- set_prop(ramdump, ramdump_prop)
+ set_prop(ramdump, vendor_ramdump_prop)
allow ramdump self:capability sys_rawio;
allow ramdump ramdump_vendor_data_file:dir create_dir_perms;
allow ramdump ramdump_vendor_data_file:file create_file_perms;
- allow ramdump proc:file r_file_perms;
+ allow ramdump {
+ proc
+ proc_cmdline
+ }:file r_file_perms;
allow ramdump block_device:dir search;
allow ramdump misc_block_device:blk_file rw_file_perms;
diff --git a/sepolicy/vendor/ramdump_app.te b/sepolicy/vendor/ramdump_app.te
index e9c4f056..ed9bf33b 100644
--- a/sepolicy/vendor/ramdump_app.te
+++ b/sepolicy/vendor/ramdump_app.te
@@ -9,6 +9,6 @@ userdebug_or_eng(`
allow ramdump_app ramdump_vendor_data_file:file create_file_perms;
allow ramdump_app ramdump_vendor_data_file:dir create_dir_perms;
- set_prop(ramdump_app, ramdump_prop);
- get_prop(system_app, ssr_prop)
+ set_prop(ramdump_app, vendor_ramdump_prop);
+ get_prop(system_app, vendor_ssr_prop)
')
diff --git a/sepolicy/vendor/rild.te b/sepolicy/vendor/rild.te
index 65768b70..609bf2f7 100644
--- a/sepolicy/vendor/rild.te
+++ b/sepolicy/vendor/rild.te
@@ -27,3 +27,8 @@ dontaudit rild diag_device:chr_file rw_file_perms;
allow rild radio_vendor_data_file:dir rw_dir_perms;
allow rild radio_vendor_data_file:file create_file_perms;
+
+get_prop(rild, vendor_radio_prop)
+
+# Allow vendor native process to read the proc file of xt_qtaguid
+allow rild proc_qtaguid_stat:file r_file_perms;
diff --git a/sepolicy/vendor/seapp_contexts b/sepolicy/vendor/seapp_contexts
index d13ddad6..6d17cf73 100644
--- a/sepolicy/vendor/seapp_contexts
+++ b/sepolicy/vendor/seapp_contexts
@@ -1,15 +1,11 @@
user=system seinfo=platform name=com.google.SSRestartDetector domain=ssr_detector_app type=system_app_data_file
-user=_app seinfo=platform name=com.android.nexuslogger domain=logger_app type=app_data_file levelFrom=all
+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
#TODO Remove user "system" when b/63588267 is resolved
user=system seinfo=platform name=com.qualcomm.telephony domain=qtelephony type=system_app_data_file
-#Add new domain for DataServices
-#TODO Remove user "system" when b/38043081 is resolved
-user=system seinfo=platform name=.dataservices domain=dataservice_app type=system_app_data_file
-
# The default domain for tango_core / arcore process
user=_app seinfo=tango name=com.google.tango* domain=tango_core type=app_data_file levelFrom=user
user=_app seinfo=arcore name=com.google.ar.core* domain=tango_core type=app_data_file levelFrom=user
@@ -28,3 +24,6 @@ user=_app seinfo=platform name=com.qualcomm.timeservice domain=timeservice_app t
# Domain for easelservice app
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
diff --git a/sepolicy/vendor/ssr_detector.te b/sepolicy/vendor/ssr_detector.te
index 27882d51..a5ffd3b3 100644
--- a/sepolicy/vendor/ssr_detector.te
+++ b/sepolicy/vendor/ssr_detector.te
@@ -6,7 +6,8 @@ app_domain(ssr_detector_app)
userdebug_or_eng(`
allow ssr_detector_app ramdump_vendor_data_file:dir r_dir_perms;
allow ssr_detector_app ramdump_vendor_data_file:file r_file_perms;
- get_prop(ssr_detector_app, ssr_prop)
+ get_prop(ssr_detector_app, vendor_ssr_prop)
+ get_prop(ssr_detector_app, vendor_wifi_version)
')
allow ssr_detector_app app_api_service:service_manager find;
diff --git a/sepolicy/vendor/ssr_setup.te b/sepolicy/vendor/ssr_setup.te
index 9aa54ee7..b05c3568 100644
--- a/sepolicy/vendor/ssr_setup.te
+++ b/sepolicy/vendor/ssr_setup.te
@@ -3,8 +3,6 @@ type ssr_setup_exec, exec_type, vendor_file_type, file_type;
init_daemon_domain(ssr_setup);
-userdebug_or_eng(`
allow ssr_setup sysfs_msm_subsys:dir r_dir_perms;
allow ssr_setup sysfs_msm_subsys:file rw_file_perms;
-allow ssr_setup sysfs_msm_subsys:lnk_file read;
-')
+allow ssr_setup sysfs_msm_subsys:lnk_file read;
\ No newline at end of file
diff --git a/sepolicy/vendor/subsystem_ramdump.te b/sepolicy/vendor/subsystem_ramdump.te
index 60a0a6d7..fada78ec 100644
--- a/sepolicy/vendor/subsystem_ramdump.te
+++ b/sepolicy/vendor/subsystem_ramdump.te
@@ -13,5 +13,5 @@ userdebug_or_eng(`
allow subsystem_ramdump ramdump_vendor_data_file:dir rw_dir_perms;
allow subsystem_ramdump ramdump_vendor_data_file:file create_file_perms;
- set_prop(subsystem_ramdump, ssr_prop);
+ set_prop(subsystem_ramdump, vendor_ssr_prop);
')
diff --git a/sepolicy/vendor/surfaceflinger.te b/sepolicy/vendor/surfaceflinger.te
index 6437fb82..636d98b4 100644
--- a/sepolicy/vendor/surfaceflinger.te
+++ b/sepolicy/vendor/surfaceflinger.te
@@ -3,3 +3,5 @@ dontaudit surfaceflinger vendor_file:file read;
dontaudit surfaceflinger kernel:system module_request;
allow surfaceflinger debugfs_ion:dir search;
+typeattribute surfaceflinger system_writes_vendor_properties_violators;
+set_prop(surfaceflinger, public_vendor_system_prop)
diff --git a/sepolicy/vendor/system_app.te b/sepolicy/vendor/system_app.te
index 6fbccc86..61cc5338 100644
--- a/sepolicy/vendor/system_app.te
+++ b/sepolicy/vendor/system_app.te
@@ -1,12 +1,10 @@
-# Needed by Settings app's TelephonyMonitorPreferenceController, available only on a subset of
-# userdebug and eng devices
-userdebug_or_eng(`set_prop(system_app, tel_mon_prop)')
-
-# Needed by Settings app's CameraHalHdrplusPreferenceController, available only on a subset of
-# userdebug and eng devices
+# Needed by Settings app's CameraHalHdrplusPreferenceController
typeattribute system_app system_writes_vendor_properties_violators;
-userdebug_or_eng(`set_prop(system_app, camera_prop)')
+set_prop(system_app, camera_prop)
# read regulatory info
allow system_app elabel_data_file:dir r_dir_perms;
allow system_app elabel_data_file:file r_file_perms;
+
+set_prop(system_app, vendor_bluetooth_prop)
+set_prop(system_app, public_vendor_system_prop)
diff --git a/sepolicy/vendor/system_server.te b/sepolicy/vendor/system_server.te
index d71ce1d6..bcba87c3 100644
--- a/sepolicy/vendor/system_server.te
+++ b/sepolicy/vendor/system_server.te
@@ -23,4 +23,7 @@ dontaudit system_server untrusted_app:file write;
dontaudit system_server hal_audio_default:file write;
dontaudit system_server appdomain:file write;
+typeattribute system_server system_writes_vendor_properties_violators;
+set_prop(system_server, public_vendor_system_prop)
+
dontaudit system_server self:capability sys_module;
diff --git a/sepolicy/vendor/vendor_init.te b/sepolicy/vendor/vendor_init.te
index abcd08f3..ef333dbf 100644
--- a/sepolicy/vendor/vendor_init.te
+++ b/sepolicy/vendor/vendor_init.te
@@ -14,7 +14,19 @@ allow vendor_init debugfs_clk:file w_file_perms;
allow vendor_init proc_uid_cpupower:file write;
dontaudit vendor_init kernel:system module_request;
-get_prop(vendor_init, modem_diag_prop)
+# Allow vendor_init to write to /proc/sysrq-trigger on userdebug and eng builds
+userdebug_or_eng(`
+ allow vendor_init proc_sysrq:file w_file_perms;
+')
+
+set_prop(vendor_init, vendor_bluetooth_prop)
+set_prop(vendor_init, camera_prop)
+set_prop(vendor_init, modem_diag_prop)
+set_prop(vendor_init, power_prop)
+set_prop(vendor_init, public_vendor_default_prop)
+set_prop(vendor_init, vendor_radio_prop)
+set_prop(vendor_init, thermal_prop)
+set_prop(vendor_init, vendor_charge_prop)
dontaudit vendor_init unlabeled:dir getattr;
dontaudit vendor_init unlabeled:file getattr;
diff --git a/sepolicy/vendor/wcnss_filter.te b/sepolicy/vendor/wcnss_filter.te
index 910fb0ea..c1ebac94 100644
--- a/sepolicy/vendor/wcnss_filter.te
+++ b/sepolicy/vendor/wcnss_filter.te
@@ -4,7 +4,7 @@ type wcnss_filter_exec, exec_type, vendor_file_type, file_type;
init_daemon_domain(wcnss_filter)
set_prop(wcnss_filter, wc_prop)
-set_prop(wcnss_filter, bluetooth_prop)
+set_prop(wcnss_filter, vendor_bluetooth_prop)
allow wcnss_filter hci_attach_dev:chr_file rw_file_perms;
@@ -15,7 +15,7 @@ userdebug_or_eng(`
allow wcnss_filter sysfs_timestamp_switch:file r_file_perms;
r_dir_file(wcnss_filter, debugfs_ipc)
r_dir_file(wcnss_filter, sysfs_diag)
- set_prop(wcnss_filter, ssr_prop)
+ set_prop(wcnss_filter, vendor_ssr_prop)
')
#allow wakelock
diff --git a/sound_trigger_platform_info.xml b/sound_trigger_platform_info.xml
index 30944a80..0ce2d6ab 100644
--- a/sound_trigger_platform_info.xml
+++ b/sound_trigger_platform_info.xml
@@ -62,6 +62,7 @@
+
@@ -70,6 +71,7 @@
+
diff --git a/system.prop b/system.prop
index 98af2088..20d70340 100644
--- a/system.prop
+++ b/system.prop
@@ -69,13 +69,3 @@ persist.data.df.dev_name=rmnet_usb0
#ro.use_data_netmgrd=true
persist.data.netmgrd.qos.enable=true
persist.data.mode=concurrent
-
-#system prop for A4WP profile support
-ro.bluetooth.a4wp=false
-
-#system prop for wipower support
-ro.bluetooth.emb_wp_mode=false
-ro.bluetooth.wipower=false
-
-# Property for loading BDA from bdaddress module in kernel
-ro.bt.bdaddr_path=/sys/module/bdaddress/parameters/bdaddress
diff --git a/tango_permissions.xml b/tango_permissions.xml
deleted file mode 100644
index e7b4fcc0..00000000
--- a/tango_permissions.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
diff --git a/thermal/Android.bp b/thermal/Android.bp
index be1e7039..43c003ea 100644
--- a/thermal/Android.bp
+++ b/thermal/Android.bp
@@ -5,6 +5,7 @@ cc_library {
vendor: true,
relative_install_path: "hw",
srcs: [
+ "sensors.cpp",
"Thermal.cpp",
"thermal-helper.cpp",
],
diff --git a/thermal/Thermal.cpp b/thermal/Thermal.cpp
index a9bd3715..b47a54d8 100644
--- a/thermal/Thermal.cpp
+++ b/thermal/Thermal.cpp
@@ -17,6 +17,7 @@
#include
#include
+#include
#include
#include "Thermal.h"
@@ -59,13 +60,13 @@ Return Thermal::getTemperatures(getTemperatures_cb _hidl_cb) {
status.code = ThermalStatusCode::FAILURE;
status.debugMessage = "Unsupported hardware";
_hidl_cb(status, temperatures);
+ LOG(ERROR) << "ThermalHAL not initialized properly.";
return Void();
}
- ssize_t ret = fillTemperatures(&temperatures);
- if (ret < 0) {
+ if (fillTemperatures(&temperatures) != kTemperatureNum) {
status.code = ThermalStatusCode::FAILURE;
- status.debugMessage = strerror(-ret);
+ status.debugMessage = "Error reading thermal sensors.";
}
_hidl_cb(status, temperatures);
@@ -92,6 +93,7 @@ Return Thermal::getCpuUsages(getCpuUsages_cb _hidl_cb) {
status.code = ThermalStatusCode::FAILURE;
status.debugMessage = "Unsupported hardware";
_hidl_cb(status, cpuUsages);
+ LOG(ERROR) << "ThermalHAL not initialized properly.";
return Void();
}
@@ -122,6 +124,7 @@ Return Thermal::getCoolingDevices(getCoolingDevices_cb _hidl_cb) {
status.code = ThermalStatusCode::FAILURE;
status.debugMessage = "Unsupported hardware";
_hidl_cb(status, coolingDevices);
+ LOG(ERROR) << "ThermalHAL not initialized properly.";
return Void();
}
@@ -176,6 +179,58 @@ void Thermal::notifyThrottling(
}
}
+Return Thermal::debug(const hidl_handle& handle, const hidl_vec&) {
+ 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 temperatures;
+ hidl_vec 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
diff --git a/thermal/Thermal.h b/thermal/Thermal.h
index a62b9e32..270f0663 100644
--- a/thermal/Thermal.h
+++ b/thermal/Thermal.h
@@ -54,7 +54,8 @@ struct Thermal : public IThermal {
// Methods from ::android::hardware::thermal::V1_1::IThermal follow.
Return registerThermalCallback(
const sp& callback) override;
-
+ // Methods from ::android::hidl::base::V1_0::IBase follow.
+ Return debug(const hidl_handle& fd, const hidl_vec& args) override;
private:
bool enabled;
};
diff --git a/thermal/sensors.cpp b/thermal/sensors.cpp
new file mode 100644
index 00000000..7df880bd
--- /dev/null
+++ b/thermal/sensors.cpp
@@ -0,0 +1,100 @@
+/*
+ * 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
+
+#include
+#include
+#include
+#include
+#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
new file mode 100644
index 00000000..4924ac27
--- /dev/null
+++ b/thermal/sensors.h
@@ -0,0 +1,76 @@
+/*
+ * 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
+#include
+#include
+
+#include
+
+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:
+ //
+ std::unordered_map>
+ 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
index 878c82f5..6e9cf17d 100644
--- a/thermal/thermal-helper.cpp
+++ b/thermal/thermal-helper.cpp
@@ -20,11 +20,17 @@
#include
#include
#include
+#include
+#include
+#include
+#include
#include
#include
+#include
#include
+#include "sensors.h"
#include "thermal-helper.h"
namespace android {
@@ -33,14 +39,102 @@ 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:
+//
+const std::unordered_map>
+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 unsigned int gSkinSensorNum;
static std::string gSkinSensorType;
-static unsigned int gTsensOffset;
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:
+//
+std::unordered_map>
+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(
+ 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
@@ -51,9 +145,6 @@ bool initThermal() {
std::string hardware = android::base::GetProperty("ro.hardware", "");
if (hardware == "walleye") {
LOG(ERROR) << "Initialization on Walleye";
- gSkinSensorNum = kWalleyeSkinSensorNum;
- gSkinSensorType = kWalleyeSkinSensorType;
- gTsensOffset = kWalleyeTsensOffset;
gSkinThrottlingThreshold = kWalleyeSkinThrottlingThreshold;
gSkinShutdownThreshold = kWalleyeSkinShutdownThreshold;
gVrThrottledBelowMin = kWalleyeVrThrottledBelowMin;
@@ -61,17 +152,11 @@ bool initThermal() {
std::string rev = android::base::GetProperty("ro.revision", "");
if (rev == "rev_a" || rev == "rev_b") {
LOG(ERROR) << "Initialization on Taimen pre revision C";
- gSkinSensorNum = kTaimenRabSkinSensorNum;
- gSkinSensorType = kTaimenRabSkinSensorType;
- gTsensOffset = kTaimenRabTsensOffset;
gSkinThrottlingThreshold = kTaimenRabSkinThrottlingThreshold;
gSkinShutdownThreshold = kTaimenRabSkinShutdownThreshold;
gVrThrottledBelowMin = kTaimenRabVrThrottledBelowMin;
} else {
LOG(ERROR) << "Initialization on Taimen revision C and later";
- gSkinSensorNum = kTaimenRcSkinSensorNum;
- gSkinSensorType = kTaimenRcSkinSensorType;
- gTsensOffset = kTaimenRcTsensOffset;
gSkinThrottlingThreshold = kTaimenRcSkinThrottlingThreshold;
gSkinShutdownThreshold = kTaimenRcSkinShutdownThreshold;
gVrThrottledBelowMin = kTaimenRcVrThrottledBelowMin;
@@ -80,127 +165,25 @@ bool initThermal() {
LOG(ERROR) << "Unsupported hardware: " << hardware;
return false;
}
- return true;
+ gSensorTypeToThresholdsMap[TemperatureType::SKIN] =
+ std::make_tuple(gSkinThrottlingThreshold, gSkinShutdownThreshold,
+ gVrThrottledBelowMin);
+ return initializeSensors();
}
-/**
- * Reads device temperature.
- *
- * @param sensor_num Number of sensor file with temperature.
- * @param type Device temperature type.
- * @param name Device temperature name.
- * @param mult Multiplier used to translate temperature to Celsius.
- * @param throttling_threshold Throttling threshold for the temperature.
- * @param shutdown_threshold Shutdown threshold for the temperature.
- * @param out Pointer to temperature_t structure that will be filled with current
- * values.
- *
- * @return 0 on success or negative value -errno on error.
- */
-static ssize_t readTemperature(int sensor_num, TemperatureType type, const char *name, float mult,
- float throttling_threshold, float shutdown_threshold,
- float vr_throttling_threshold, Temperature *out) {
- FILE *file;
- char file_name[PATH_MAX];
- float temp;
-
- sprintf(file_name, kTemperatureFileFormat, sensor_num);
- file = fopen(file_name, "r");
- if (file == NULL) {
- PLOG(ERROR) << "readTemperature: failed to open file (" << file_name << ")";
- return -errno;
- }
- if (1 != fscanf(file, "%f", &temp)) {
- fclose(file);
- PLOG(ERROR) << "readTemperature: failed to read a float";
- return errno ? -errno : -EIO;
- }
-
- fclose(file);
-
- (*out).type = type;
- (*out).name = name;
- (*out).currentValue = temp * mult;
- (*out).throttlingThreshold = throttling_threshold;
- (*out).shutdownThreshold = shutdown_threshold;
- (*out).vrThrottlingThreshold = vr_throttling_threshold;
-
- LOG(DEBUG) << android::base::StringPrintf(
- "readTemperature: %d, %d, %s, %g, %g, %g, %g",
- sensor_num, type, name, temp * mult, throttling_threshold,
- shutdown_threshold, vr_throttling_threshold);
-
- return 0;
-}
-
-static ssize_t getCpuTemperatures(hidl_vec *temperatures) {
- size_t cpu;
-
- for (cpu = 0; cpu < kCpuNum; cpu++) {
- if (cpu >= temperatures->size()) {
- break;
- }
- // temperature in decidegrees Celsius.
- ssize_t result = readTemperature(kCpuTsensOffset[cpu] + gTsensOffset, TemperatureType::CPU, kCpuLabel[cpu],
- 0.1, kCpuThrottlingThreshold, kCpuShutdownThreshold, kCpuThrottlingThreshold,
- &(*temperatures)[cpu]);
- if (result != 0) {
- return result;
+ssize_t fillTemperatures(hidl_vec* 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 cpu;
-}
-
-ssize_t fillTemperatures(hidl_vec *temperatures) {
- ssize_t result = 0;
- size_t current_index = 0;
-
- if (temperatures == NULL || temperatures->size() < kTemperatureNum) {
- LOG(ERROR) << "fillTemperatures: incorrect buffer";
- return -EINVAL;
- }
-
- result = getCpuTemperatures(temperatures);
- if (result < 0) {
- return result;
- }
- current_index += result;
-
- // GPU temperature.
- if (current_index < temperatures->size()) {
- // temperature in decidegrees Celsius.
- result = readTemperature(gTsensOffset + kGpuTsensOffset, TemperatureType::GPU, kGpuLabel, 0.1,
- NAN, NAN, NAN, &(*temperatures)[current_index]);
- if (result < 0) {
- return result;
- }
- current_index++;
- }
-
- // Battery temperature.
- if (current_index < temperatures->size()) {
- // battery: temperature in millidegrees Celsius.
- result = readTemperature(kBatterySensorNum, TemperatureType::BATTERY, kBatteryLabel,
- 0.001, NAN, kBatteryShutdownThreshold, NAN,
- &(*temperatures)[current_index]);
- if (result < 0) {
- return result;
- }
- current_index++;
- }
-
- // Skin temperature.
- if (current_index < temperatures->size()) {
- // temperature in Celsius.
- result = readTemperature(gSkinSensorNum, TemperatureType::SKIN, kSkinLabel, 1.,
- gSkinThrottlingThreshold, gSkinShutdownThreshold, gVrThrottledBelowMin,
- &(*temperatures)[current_index]);
- if (result < 0) {
- return result;
- }
- current_index++;
- }
- return kTemperatureNum;
+ return current_index;
}
ssize_t fillCpuUsages(hidl_vec *cpuUsages) {
diff --git a/thermal/thermal-helper.h b/thermal/thermal-helper.h
index 311a67d8..ef0b61ff 100644
--- a/thermal/thermal-helper.h
+++ b/thermal/thermal-helper.h
@@ -40,46 +40,32 @@ 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 kWalleyeSkinSensorNum = 9;
-constexpr auto kWalleyeSkinSensorType = "back_therm";
-constexpr unsigned int kWalleyeTsensOffset = 11;
constexpr unsigned int kWalleyeSkinThrottlingThreshold = 40;
constexpr unsigned int kWalleyeSkinShutdownThreshold = 56;
constexpr unsigned int kWalleyeVrThrottledBelowMin = 52;
-constexpr unsigned int kTaimenRabSkinSensorNum = 8;
-constexpr auto kTaimenRabSkinSensorType = "bd_therm";
-constexpr unsigned int kTaimenRabTsensOffset = 9;
constexpr unsigned int kTaimenRabSkinThrottlingThreshold = 49;
constexpr unsigned int kTaimenRabSkinShutdownThreshold = 66;
constexpr unsigned int kTaimenRabVrThrottledBelowMin = 62;
-constexpr unsigned int kTaimenRcSkinSensorNum = 8;
-constexpr auto kTaimenRcSkinSensorType = "bd_therm2";
-constexpr unsigned int kTaimenRcTsensOffset = 9;
constexpr unsigned int kTaimenRcSkinThrottlingThreshold = 38;
constexpr unsigned int kTaimenRcSkinShutdownThreshold = 54;
constexpr unsigned int kTaimenRcVrThrottledBelowMin = 50;
-
-constexpr unsigned int kBatterySensorNum = 0;
-constexpr unsigned int kGpuTsensOffset = 11;
constexpr unsigned int kCpuNum = 8;
-constexpr const char *kGpuLabel = "GPU";
-constexpr const char *kBatteryLabel = "battery";
-constexpr const char *kSkinLabel = "skin";
-constexpr const char *kCpuLabel[kCpuNum] = {"CPU0", "CPU1", "CPU2", "CPU3", "CPU4", "CPU5", "CPU6", "CPU7"};
-constexpr int kCpuTsensOffset[kCpuNum] = {1, 2, 4, 3, 5, 6, 7, 8};
+constexpr const char *kCpuLabel[kCpuNum] = {
+ "CPU0", "CPU1", "CPU2", "CPU3", "CPU4", "CPU5", "CPU6", "CPU7"};
-// Sum of kCpuNum + 3 for GPU, BATTERY, and SKIN.
-constexpr unsigned int kTemperatureNum = 3 + kCpuNum;
+// 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;
diff --git a/ueventd.hardware.rc b/ueventd.hardware.rc
index b6408602..1a7fb35b 100644
--- a/ueventd.hardware.rc
+++ b/ueventd.hardware.rc
@@ -104,11 +104,8 @@
/sys/devices/soc/soc:fp_fpc* wakeup_enable 0200 system system
# Easel
-/dev/easelcomm-client 0660 cameraserver camera
-/dev/mnh_sm 0664 cameraserver camera
-
-# TODO (b/37941164): Temporary for easel
-/sys/devices/soc/c1b7000.i2c/i2c-9/9-0008* asr_dual_phase 0660 cameraserver camera
+/dev/easelcomm-client 0666 cameraserver camera
+/dev/mnh_sm 0666 cameraserver camera
# Storage: for factory reset protection feature
/dev/block/platform/soc/1da4000.ufshc/by-name/frp 0660 system system
diff --git a/usb/UsbGadget.cpp b/usb/UsbGadget.cpp
index 33944433..603afbba 100644
--- a/usb/UsbGadget.cpp
+++ b/usb/UsbGadget.cpp
@@ -32,6 +32,7 @@ constexpr int EPOLL_EVENTS = 10;
constexpr bool DEBUG = false;
constexpr int DISCONNECT_WAIT_US = 10000;
+#define BUILD_TYPE "ro.build.type"
#define GADGET_PATH "/config/usb_gadget/g1/"
#define PULLUP_PATH GADGET_PATH "UDC"
#define GADGET_NAME "a800000.dwc3"
@@ -49,6 +50,9 @@ constexpr int DISCONNECT_WAIT_US = 10000;
#define FUNCTION_PATH CONFIG_PATH FUNCTION_NAME
#define RNDIS_PATH FUNCTIONS_PATH "gsi.rndis"
+#define PERSISTENT_VENDOR_CONFIG "persist.vendor.usb.usbradio.config"
+#define VENDOR_CONFIG "vendor.usb.config"
+
namespace android {
namespace hardware {
namespace usb {
@@ -165,10 +169,8 @@ static void *monitorFfs(void *param) {
}
UsbGadget::UsbGadget()
- : mMonitorCreated(false),
- mCurrentUsbFunctionsApplied(false) {
- if (access(OS_DESC_PATH, R_OK) != 0)
- ALOGE("configfs setup not done yet");
+ : mMonitorCreated(false), mCurrentUsbFunctionsApplied(false) {
+ if (access(OS_DESC_PATH, R_OK) != 0) ALOGE("configfs setup not done yet");
}
static int unlinkFunctions(const char *path) {
@@ -277,42 +279,138 @@ static V1_0::Status setVidPid(const char *vid, const char *pid) {
return Status::SUCCESS;
}
+static std::string getVendorFunctions() {
+ if (GetProperty(BUILD_TYPE, "") == "user") return "user";
+
+ std::string bootMode = GetProperty(PERSISTENT_BOOT_MODE, "");
+ std::string persistVendorFunctions =
+ GetProperty(PERSISTENT_VENDOR_CONFIG, "");
+ std::string vendorFunctions = GetProperty(VENDOR_CONFIG, "");
+ std::string ret = "";
+
+ if (vendorFunctions != "") {
+ ret = vendorFunctions;
+ } else if (bootMode == "usbradio") {
+ if (persistVendorFunctions != "")
+ ret = persistVendorFunctions;
+ else
+ ret = "diag";
+ // vendor.usb.config will reflect the current configured functions
+ SetProperty(VENDOR_CONFIG, ret);
+ }
+
+ return ret;
+}
+
static V1_0::Status validateAndSetVidPid(uint64_t functions) {
V1_0::Status ret = Status::SUCCESS;
+ std::string vendorFunctions = getVendorFunctions();
+
switch (functions) {
case static_cast(GadgetFunction::MTP):
- ret = setVidPid("0x18d1", "0x4ee1");
+ if (vendorFunctions == "diag") {
+ ret = setVidPid("0x05C6", "0x901B");
+ } else {
+ if (!(vendorFunctions == "user" || vendorFunctions == ""))
+ ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
+ ret = setVidPid("0x18d1", "0x4ee1");
+ }
break;
case GadgetFunction::ADB | GadgetFunction::MTP:
- ret = setVidPid("0x18d1", "0x4ee2");
+ if (vendorFunctions == "diag") {
+ ret = setVidPid("0x05C6", "0x903A");
+ } else {
+ if (!(vendorFunctions == "user" || vendorFunctions == ""))
+ ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
+ ret = setVidPid("0x18d1", "0x4ee2");
+ }
break;
case static_cast(GadgetFunction::RNDIS):
- ret = setVidPid("0x18d1", "0x4ee3");
+ if (vendorFunctions == "diag") {
+ ret = setVidPid("0x05C6", "0x902C");
+ } else if (vendorFunctions == "serial_cdev,diag") {
+ ret = setVidPid("0x05C6", "0x90B5");
+ } else {
+ if (!(vendorFunctions == "user" || vendorFunctions == ""))
+ ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
+ ret = setVidPid("0x18d1", "0x4ee3");
+ }
break;
case GadgetFunction::ADB | GadgetFunction::RNDIS:
- ret = setVidPid("0x18d1", "0x4ee4");
+ if (vendorFunctions == "diag") {
+ ret = setVidPid("0x05C6", "0x902D");
+ } else if (vendorFunctions == "serial_cdev,diag") {
+ ret = setVidPid("0x05C6", "0x90B6");
+ } else {
+ if (!(vendorFunctions == "user" || vendorFunctions == ""))
+ ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
+ ret = setVidPid("0x18d1", "0x4ee4");
+ }
break;
case static_cast(GadgetFunction::PTP):
+ if (!(vendorFunctions == "user" || vendorFunctions == ""))
+ ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
ret = setVidPid("0x18d1", "0x4ee5");
break;
case GadgetFunction::ADB | GadgetFunction::PTP:
+ if (!(vendorFunctions == "user" || vendorFunctions == ""))
+ ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
ret = setVidPid("0x18d1", "0x4ee6");
break;
case static_cast(GadgetFunction::ADB):
- ret = setVidPid("0x18d1", "0x4ee7");
+ if (vendorFunctions == "diag") {
+ ret = setVidPid("0x05C6", "0x901D");
+ } else if (vendorFunctions == "diag,serial_cdev,rmnet_gsi") {
+ ret = setVidPid("0x05C6", "0x9091");
+ } else if (vendorFunctions == "diag,serial_cdev") {
+ ret = setVidPid("0x05C6", "0x901F");
+ } else {
+ if (!(vendorFunctions == "user" || vendorFunctions == ""))
+ ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
+ ret = setVidPid("0x18d1", "0x4ee7");
+ }
break;
case static_cast(GadgetFunction::MIDI):
+ if (!(vendorFunctions == "user" || vendorFunctions == ""))
+ ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
ret = setVidPid("0x18d1", "0x4ee8");
break;
case GadgetFunction::ADB | GadgetFunction::MIDI:
+ if (!(vendorFunctions == "user" || vendorFunctions == ""))
+ ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
ret = setVidPid("0x18d1", "0x4ee9");
break;
case static_cast(GadgetFunction::ACCESSORY):
+ if (!(vendorFunctions == "user" || vendorFunctions == ""))
+ ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
ret = setVidPid("0x18d1", "0x2d00");
break;
case GadgetFunction::ADB | GadgetFunction::ACCESSORY:
+ if (!(vendorFunctions == "user" || vendorFunctions == ""))
+ ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
ret = setVidPid("0x18d1", "0x2d01");
break;
+ case static_cast(GadgetFunction::AUDIO_SOURCE):
+ if (!(vendorFunctions == "user" || vendorFunctions == ""))
+ ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
+ ret = setVidPid("0x18d1", "0x2d02");
+ break;
+ case GadgetFunction::ADB | GadgetFunction::AUDIO_SOURCE:
+ if (!(vendorFunctions == "user" || vendorFunctions == ""))
+ ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
+ ret = setVidPid("0x18d1", "0x2d03");
+ break;
+ case GadgetFunction::ACCESSORY | GadgetFunction::AUDIO_SOURCE:
+ if (!(vendorFunctions == "user" || vendorFunctions == ""))
+ ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
+ ret = setVidPid("0x18d1", "0x2d04");
+ break;
+ case GadgetFunction::ADB | GadgetFunction::ACCESSORY |
+ GadgetFunction::AUDIO_SOURCE:
+ if (!(vendorFunctions == "user" || vendorFunctions == ""))
+ ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
+ ret = setVidPid("0x18d1", "0x2d05");
+ break;
default:
ALOGE("Combination not supported");
ret = Status::CONFIGURATION_NOT_SUPPORTED;
@@ -335,8 +433,7 @@ V1_0::Status UsbGadget::setupFunctions(
int i = 0;
std::string bootMode = GetProperty(PERSISTENT_BOOT_MODE, "");
- if (((functions & GadgetFunction::PTP) != 0) ||
- ((functions & GadgetFunction::MTP) != 0)) {
+ if (((functions & GadgetFunction::MTP) != 0)) {
ffsEnabled = true;
ALOGI("setCurrentUsbFunctions mtp");
if (!WriteStringToFile("1", DESC_USE_PATH)) return Status::ERROR;
@@ -344,18 +441,32 @@ V1_0::Status UsbGadget::setupFunctions(
if (inotify_add_watch(inotifyFd, "/dev/usb-ffs/mtp/", IN_ALL_EVENTS) == -1)
return Status::ERROR;
-
if (linkFunction("ffs.mtp", i++)) return Status::ERROR;
// Add endpoints to be monitored.
mEndpointList.push_back("/dev/usb-ffs/mtp/ep1");
mEndpointList.push_back("/dev/usb-ffs/mtp/ep2");
mEndpointList.push_back("/dev/usb-ffs/mtp/ep3");
+ } else if (((functions & GadgetFunction::PTP) != 0)) {
+ ffsEnabled = true;
+ ALOGI("setCurrentUsbFunctions ptp");
+ if (!WriteStringToFile("1", DESC_USE_PATH)) return Status::ERROR;
+
+ if (inotify_add_watch(inotifyFd, "/dev/usb-ffs/ptp/", IN_ALL_EVENTS) == -1)
+ return Status::ERROR;
+
+
+ if (linkFunction("ffs.ptp", i++)) return Status::ERROR;
+
+ // Add endpoints to be monitored.
+ mEndpointList.push_back("/dev/usb-ffs/ptp/ep1");
+ mEndpointList.push_back("/dev/usb-ffs/ptp/ep2");
+ mEndpointList.push_back("/dev/usb-ffs/ptp/ep3");
}
if ((functions & GadgetFunction::MIDI) != 0) {
ALOGI("setCurrentUsbFunctions MIDI");
- if (linkFunction("midi.gs5", i++)) return Status::ERROR;;
+ if (linkFunction("midi.gs5", i++)) return Status::ERROR;
}
if ((functions & GadgetFunction::ACCESSORY) != 0) {
@@ -363,16 +474,29 @@ V1_0::Status UsbGadget::setupFunctions(
if (linkFunction("accessory.gs2", i++)) return Status::ERROR;
}
+ if ((functions & GadgetFunction::AUDIO_SOURCE) != 0) {
+ ALOGI("setCurrentUsbFunctions Audio Source");
+ if (linkFunction("audio_source.gs3", i++)) return Status::ERROR;
+ }
+
if ((functions & GadgetFunction::RNDIS) != 0) {
ALOGI("setCurrentUsbFunctions rndis");
if (linkFunction("gsi.rndis", i++)) return Status::ERROR;
}
- if (bootMode == "usbradio") {
+ std::string vendorFunctions = getVendorFunctions();
+ if (vendorFunctions != "") {
ALOGI("enable usbradio debug functions");
- if (linkFunction("diag.diag", i++)) return Status::ERROR;
- if (linkFunction("cser.dun.0", i++)) return Status::ERROR;
- if (linkFunction("gsi.rmnet", i++)) return Status::ERROR;
+ char *function = strtok(const_cast(vendorFunctions.c_str()), ",");
+ while (function != NULL) {
+ if (string(function) == "diag" && linkFunction("diag.diag", i++))
+ return Status::ERROR;
+ if (string(function) == "serial_cdev" && linkFunction("cser.dun.0", i++))
+ return Status::ERROR;
+ if (string(function) == "rmnet_gsi" && linkFunction("gsi.rmnet", i++))
+ return Status::ERROR;
+ function = strtok(NULL, ",");
+ }
}
if ((functions & GadgetFunction::ADB) != 0) {
diff --git a/usb/UsbGadget.h b/usb/UsbGadget.h
index ef2ea4dc..9a2c4dd3 100644
--- a/usb/UsbGadget.h
+++ b/usb/UsbGadget.h
@@ -23,6 +23,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -40,6 +41,7 @@ namespace implementation {
using ::android::sp;
using ::android::base::GetProperty;
+using ::android::base::SetProperty;
using ::android::base::unique_fd;
using ::android::base::WriteStringToFile;
using ::android::hardware::hidl_array;
diff --git a/vibrator/Android.bp b/vibrator/Android.bp
index b4f5fa7d..c02ae54e 100644
--- a/vibrator/Android.bp
+++ b/vibrator/Android.bp
@@ -13,9 +13,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
cc_binary {
- name: "android.hardware.vibrator@1.1-service.wahoo",
+ name: "android.hardware.vibrator@1.2-service.wahoo",
relative_install_path: "hw",
- init_rc: ["android.hardware.vibrator@1.1-service.wahoo.rc"],
+ init_rc: ["android.hardware.vibrator@1.2-service.wahoo.rc"],
srcs: ["service.cpp", "Vibrator.cpp"],
cflags: [
"-Wall",
@@ -31,6 +31,7 @@ cc_binary {
"libhardware",
"android.hardware.vibrator@1.0",
"android.hardware.vibrator@1.1",
+ "android.hardware.vibrator@1.2",
],
proprietary: true,
}
diff --git a/vibrator/Vibrator.cpp b/vibrator/Vibrator.cpp
index db64bb13..96576848 100644
--- a/vibrator/Vibrator.cpp
+++ b/vibrator/Vibrator.cpp
@@ -33,7 +33,7 @@
namespace android {
namespace hardware {
namespace vibrator {
-namespace V1_1 {
+namespace V1_2 {
namespace implementation {
static constexpr int8_t MAX_RTP_INPUT = 127;
@@ -42,18 +42,22 @@ static constexpr int8_t MIN_RTP_INPUT = 0;
static constexpr char RTP_MODE[] = "rtp";
static constexpr char WAVEFORM_MODE[] = "waveform";
-// Use effect #1 in the waveform library
+// Use effect #1 in the waveform library for CLICK effect
static constexpr char WAVEFORM_CLICK_EFFECT_SEQ[] = "1 0";
static constexpr int32_t WAVEFORM_CLICK_EFFECT_MS = 6;
-// Use effect #2 in the waveform library
+// Use effect #2 in the waveform library for TICK effect
static constexpr char WAVEFORM_TICK_EFFECT_SEQ[] = "2 0";
static constexpr int32_t WAVEFORM_TICK_EFFECT_MS = 2;
-// Use effect #3 in the waveform library
+// Use effect #3 in the waveform library for DOUBLE_CLICK effect
static constexpr char WAVEFORM_DOUBLE_CLICK_EFFECT_SEQ[] = "3 0";
static constexpr uint32_t WAVEFORM_DOUBLE_CLICK_EFFECT_MS = 135;
+// Use effect #4 in the waveform library for HEAVY_CLICK effect
+static constexpr char WAVEFORM_HEAVY_CLICK_EFFECT_SEQ[] = "4 0";
+static constexpr uint32_t WAVEFORM_HEAVY_CLICK_EFFECT_MS = 8;
+
// Timeout threshold for selecting open or closed loop mode
static constexpr int8_t LOOP_MODE_THRESHOLD_MS = 20;
@@ -76,6 +80,8 @@ Vibrator::Vibrator(std::ofstream&& activate, std::ofstream&& duration,
mClickDuration = property_get_int32("ro.vibrator.hal.click.duration", WAVEFORM_CLICK_EFFECT_MS);
mTickDuration = property_get_int32("ro.vibrator.hal.tick.duration", WAVEFORM_TICK_EFFECT_MS);
+ mHeavyClickDuration = property_get_int32(
+ "ro.vibrator.hal.heavyclick.duration", WAVEFORM_HEAVY_CLICK_EFFECT_MS);
// This enables effect #1 from the waveform library to be triggered by SLPI
// while the AP is in suspend mode
@@ -116,7 +122,7 @@ Return Vibrator::on(uint32_t timeoutMs, bool forceOpenLoop, bool isWavef
return Status::OK;
}
-// Methods from ::android::hardware::vibrator::V1_1::IVibrator follow.
+// Methods from ::android::hardware::vibrator::V1_2::IVibrator follow.
Return Vibrator::on(uint32_t timeoutMs) {
return on(timeoutMs, false /* forceOpenLoop */, false /* isWaveform */);
}
@@ -158,7 +164,7 @@ static uint8_t convertEffectStrength(EffectStrength strength) {
switch (strength) {
case EffectStrength::LIGHT:
- scale = 1; // 50%
+ scale = 2; // 50%
break;
case EffectStrength::MEDIUM:
case EffectStrength::STRONG:
@@ -169,52 +175,53 @@ static uint8_t convertEffectStrength(EffectStrength strength) {
return scale;
}
-Return Vibrator::perform(Effect effect, EffectStrength strength, perform_cb _hidl_cb) {
+Return Vibrator::perform(V1_0::Effect effect, EffectStrength strength, perform_cb _hidl_cb) {
+ return performEffect(static_cast(effect), strength, _hidl_cb);
+}
+
+Return Vibrator::perform_1_1(V1_1::Effect_1_1 effect, EffectStrength strength,
+ perform_cb _hidl_cb) {
+ return performEffect(static_cast(effect), strength, _hidl_cb);
+}
+
+Return Vibrator::perform_1_2(Effect effect, EffectStrength strength, perform_cb _hidl_cb) {
+ return performEffect(static_cast(effect), strength, _hidl_cb);
+}
+
+Return Vibrator::performEffect(Effect effect, EffectStrength strength, perform_cb _hidl_cb) {
Status status = Status::OK;
uint32_t timeMS;
- if (effect == Effect::CLICK) {
+ switch (effect) {
+ case Effect::CLICK:
mSequencer << WAVEFORM_CLICK_EFFECT_SEQ << std::endl;
timeMS = mClickDuration;
- } else if (effect == Effect::DOUBLE_CLICK) {
+ break;
+ case Effect::DOUBLE_CLICK:
mSequencer << WAVEFORM_DOUBLE_CLICK_EFFECT_SEQ << std::endl;
timeMS = WAVEFORM_DOUBLE_CLICK_EFFECT_MS;
- } else {
- _hidl_cb(Status::UNSUPPORTED_OPERATION, 0);
- return Void();
- }
-
- mScale << convertEffectStrength(strength) << std::endl;
- on(timeMS, true /* forceOpenLoop */, true /* isWaveform */);
-
- _hidl_cb(status, timeMS);
- return Void();
-}
-
-Return Vibrator::perform_1_1(Effect_1_1 effect, EffectStrength strength,
- perform_cb _hidl_cb) {
- Status status = Status::OK;
- uint32_t timeMS;
-
- if (effect == Effect_1_1::TICK) {
+ break;
+ case Effect::TICK:
mSequencer << WAVEFORM_TICK_EFFECT_SEQ << std::endl;
timeMS = mTickDuration;
- } else if (effect < Effect_1_1::TICK) {
- return perform(static_cast(effect), strength, _hidl_cb);
- } else {
+ break;
+ case Effect::HEAVY_CLICK:
+ mSequencer << WAVEFORM_HEAVY_CLICK_EFFECT_SEQ << std::endl;
+ timeMS = mHeavyClickDuration;
+ break;
+ default:
_hidl_cb(Status::UNSUPPORTED_OPERATION, 0);
return Void();
}
-
mScale << convertEffectStrength(strength) << std::endl;
on(timeMS, true /* forceOpenLoop */, true /* isWaveform */);
-
_hidl_cb(status, timeMS);
return Void();
}
+
} // namespace implementation
-} // namespace V1_1
+} // namespace V1_2
} // namespace vibrator
} // namespace hardware
} // namespace android
diff --git a/vibrator/Vibrator.h b/vibrator/Vibrator.h
index 82d4da20..f9daf7cd 100644
--- a/vibrator/Vibrator.h
+++ b/vibrator/Vibrator.h
@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef ANDROID_HARDWARE_VIBRATOR_V1_1_VIBRATOR_H
-#define ANDROID_HARDWARE_VIBRATOR_V1_1_VIBRATOR_H
+#ifndef ANDROID_HARDWARE_VIBRATOR_V1_2_VIBRATOR_H
+#define ANDROID_HARDWARE_VIBRATOR_V1_2_VIBRATOR_H
-#include