Merge Android Pie into master

Bug: 112104996
Change-Id: Idc8075e8e05d75b90a512c096be41fcc50846cf7
This commit is contained in:
Xin Li
2018-08-06 16:50:11 -07:00
148 changed files with 3938 additions and 3318 deletions

View File

@@ -1,7 +0,0 @@
subdirs = [
"thermal",
"vr",
"vibrator",
"wifi_offload",
"usb",
]

View File

@@ -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

View File

@@ -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)

View File

@@ -73,6 +73,12 @@
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,16000,32000,48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="incall_music_uplink" role="source"
flags="AUDIO_OUTPUT_FLAG_INCALL_MUSIC">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,16000,48000"
channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="primary input" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_8_24_BIT"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
@@ -150,7 +156,7 @@
<route type="mix" sink="USB Headset Out"
sources="primary output,raw,deep_buffer,compressed_offload,hifi_playback,mmap_no_irq_out,voip_rx"/>
<route type="mix" sink="Telephony Tx"
sources="voice_tx"/>
sources="voice_tx,incall_music_uplink"/>
<route type="mix" sink="primary input"
sources="Built-In Mic,Built-In Back Mic,BT SCO Headset Mic,USB Device In,USB Headset In"/>
<route type="mix" sink="fast input"
@@ -191,6 +197,9 @@
<!-- Remote Submix Audio HAL -->
<xi:include href="r_submix_audio_policy_configuration.xml"/>
<!-- Hearing aid Audio HAL -->
<xi:include href="hearing_aid_audio_policy_configuration.xml"/>
</modules>
<!-- Volume section -->

View File

@@ -49,6 +49,23 @@
<!-- Contacts -->
<permission name="android.permission.READ_CONTACTS" fixed="false"/>
<permission name="android.permission.WRITE_CONTACTS" fixed="false"/>
<!-- Call logs -->
<permission name="android.permission.READ_CALL_LOG" fixed="false"/>
<permission name="android.permission.WRITE_CALL_LOG" fixed="false"/>
<!-- SMS -->
<permission name="android.permission.RECEIVE_SMS" fixed="false"/>
<permission name="android.permission.READ_PHONE_NUMBERS" fixed="false"/>
</exception>
<exception
package="com.google.android.apps.restore"
sha256-cert-digest="56:BE:13:2B:78:06:56:FE:24:44:CD:34:32:6E:B5:D7:AA:C9:1D:20:96:AB:F0:FE:67:3A:99:27:06:22:EC:87">
<!-- External storage -->
<permission name="android.permission.READ_EXTERNAL_STORAGE" fixed="false"/>
<permission name="android.permission.WRITE_EXTERNAL_STORAGE" fixed="false"/>
<!-- Contacts -->
<permission name="android.permission.READ_CONTACTS" fixed="false"/>
<permission name="android.permission.WRITE_CONTACTS" fixed="false"/>
</exception>
<exception
@@ -85,4 +102,28 @@
<permission name="android.permission.WRITE_EXTERNAL_STORAGE" fixed="false"/>
</exception>
<exception
package="com.google.android.apps.miphone.aiai"
sha256-cert-digest="8A:99:84:2F:79:25:51:71:7D:3A:19:E1:55:A6:D6:A6:E3:75:BD:1E:19:FB:CE:FF:43:8E:20:D2:F7:8D:8D:BE">
<!-- Calendar -->
<permission name="android.permission.READ_CALENDAR" fixed="false"/>
<!-- Contacts -->
<permission name="android.permission.READ_CONTACTS" fixed="false"/>
<!-- Location -->
<permission name="android.permission.ACCESS_COARSE_LOCATION" fixed="false"/>
<permission name="android.permission.ACCESS_FINE_LOCATION" fixed="false"/>
<!-- Phone -->
<permission name="android.permission.CALL_PHONE" fixed="false"/>
<permission name="android.permission.READ_CALL_LOG" fixed="false"/>
<!-- SMS -->
<permission name="android.permission.READ_SMS" fixed="false"/>
</exception>
<exception package="com.google.android.settings.intelligence">
<!-- Calendar -->
<permission name="android.permission.READ_CALENDAR" fixed="true"/>
<!-- Location -->
<permission name="android.permission.ACCESS_FINE_LOCATION" fixed="true"/>
</exception>
</exceptions>

135
device.mk
View File

@@ -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

View File

@@ -0,0 +1,66 @@
<compatibility-matrix version="1.0" type="framework">
<hal format="hidl" optional="true">
<name>vendor.qti.atcmdfwd</name>
<version>1.0</version>
<interface>
<name>IAtCmdFwd</name>
<instance>AtCmdFwdService</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.qti.qcril.am</name>
<version>1.0</version>
<interface>
<name>IQcRilAudio</name>
<instance>slot1</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>com.qualcomm.qti.ims.radio</name>
<version>1.1</version>
<interface>
<name>IImsRadio</name>
<instance>imsradio0</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>com.qualcomm.qti.imsrtpservice</name>
<version>1.0</version>
<interface>
<name>IRTPService</name>
<instance>imsrtpservice</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>com.qualcomm.qti.qcril.qcrilhook</name>
<version>1.0</version>
<interface>
<name>IQtiOemHook</name>
<instance>oemhook0</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>com.qualcomm.qti.uceservice</name>
<version>1.0</version>
<interface>
<name>IUceService</name>
<instance>com.qualcomm.qti.uceservice</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>com.quicinc.cne.api</name>
<version>1.0</version>
<interface>
<name>IApiService</name>
<instance>cnd</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>com.quicinc.cne.server</name>
<version>1.0</version>
<interface>
<name>IServer</name>
<instance>cnd</instance>
</interface>
</hal>
</compatibility-matrix>

View File

@@ -21,10 +21,11 @@
#include <android-base/properties.h>
#include <android-base/unique_fd.h>
#include <cutils/properties.h>
#include <libgen.h>
#include <log/log.h>
#include <stdlib.h>
#include <string>
#include <string.h>
#define _SVID_SOURCE
#include <dirent.h>
#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<void> 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<void> 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<void> 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();
};

View File

@@ -19,6 +19,7 @@
#include <android/hardware/dumpstate/1.0/IDumpstateDevice.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
#include <string>
namespace android {
namespace hardware {
@@ -39,6 +40,7 @@ struct DumpstateDevice : public IDumpstateDevice {
// Methods from ::android::hardware::dumpstate::V1_0::IDumpstateDevice follow.
Return<void> dumpstateBoard(const hidl_handle& h) override;
void dumpDiagLogs(int fd, std::string srcDir, std::string destDir);
void dumpModem(int fd, int fdModem);
};

View File

@@ -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

View File

@@ -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

12
framework_manifest.xml Normal file
View File

@@ -0,0 +1,12 @@
<manifest version="1.0" type="framework">
<hal format="hidl">
<name>vendor.qti.atcmdfwd</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IAtCmdFwd</name>
<instance>AtCmdFwdService</instance>
</interface>
</hal>
</manifest>

View File

@@ -2,7 +2,7 @@
#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
/dev/block/platform/soc/1da4000.ufshc/by-name/system / ext4 ro,barrier=1 wait,slotselect,avb
/dev/block/platform/soc/1da4000.ufshc/by-name/userdata /data ext4 errors=panic,noatime,nosuid,nodev,barrier=1,noauto_da_alloc latemount,wait,check,formattable,fileencryption=ice:aes-256-heh,eraseblk=16777216,logicalblk=4096,quota
/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

View File

@@ -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

50
health/Android.bp Normal file
View File

@@ -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"],
}

View File

@@ -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

View File

@@ -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 <string>
#include <android-base/file.h>
#include <android-base/strings.h>
#include <android-base/logging.h>
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

178
health/HealthService.cpp Normal file
View File

@@ -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 <android-base/logging.h>
#include <healthd/healthd.h>
#include <health2/Health.h>
#include <health2/service.h>
#include <hidl/HidlTransportSupport.h>
#include <android-base/file.h>
#include <android-base/strings.h>
#include <vector>
#include <string>
#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<StorageInfo>& 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<std::string> 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<DiskStats>& 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<uint64_t*>(&stats) + i);
}
vec_stats.resize(1);
vec_stats[0] = stats;
return;
}
int main(void) {
return health_service_main();
}

View File

@@ -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

View File

@@ -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 <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/strings.h>
#include <string>
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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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"

View File

@@ -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

6
init.qcom.wlan.sh Normal file
View File

@@ -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"

View File

@@ -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;

Binary file not shown.

41
lisa/board.json Normal file
View File

@@ -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"
}
}
}

111
lisa/update-script.sh Executable file
View File

@@ -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

View File

@@ -2,7 +2,7 @@
<hal format="hidl">
<name>android.hardware.audio</name>
<transport>hwbinder</transport>
<version>2.0</version>
<version>4.0</version>
<interface>
<name>IDevicesFactory</name>
<instance>default</instance>
@@ -11,7 +11,7 @@
<hal format="hidl">
<name>android.hardware.audio.effect</name>
<transport>hwbinder</transport>
<version>2.0</version>
<version>4.0</version>
<interface>
<name>IEffectsFactory</name>
<instance>default</instance>
@@ -65,7 +65,7 @@
<hal format="hidl">
<name>android.hardware.configstore</name>
<transport>hwbinder</transport>
<version>1.0</version>
<version>1.1</version>
<interface>
<name>ISurfaceFlingerConfigs</name>
<instance>default</instance>
@@ -83,19 +83,19 @@
<hal format="hidl">
<name>android.hardware.drm</name>
<transport>hwbinder</transport>
<version>1.1</version>
<version>1.0</version>
<interface>
<name>ICryptoFactory</name>
<instance>default</instance>
<instance>widevine</instance>
<instance>clearkey</instance>
</interface>
<interface>
<name>IDrmFactory</name>
<instance>default</instance>
<instance>widevine</instance>
<instance>clearkey</instance>
</interface>
<fqname>@1.1::ICryptoFactory/clearkey</fqname>
<fqname>@1.1::IDrmFactory/clearkey</fqname>
<fqname>@1.1::ICryptoFactory/widevine</fqname>
<fqname>@1.1::IDrmFactory/widevine</fqname>
</hal>
<hal format="hidl">
<name>android.hardware.dumpstate</name>
@@ -151,6 +151,15 @@
<instance>default</instance>
</interface>
</hal>
<hal format="hidl">
<name>android.hardware.health</name>
<transport>hwbinder</transport>
<version>2.0</version>
<interface>
<name>IHealth</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl">
<name>android.hardware.keymaster</name>
<transport>hwbinder</transport>
@@ -191,15 +200,6 @@
<instance>default</instance>
</interface>
</hal>
<hal format="hidl">
<name>android.hardware.neuralnetworks</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IDevice</name>
<instance>hvx</instance>
</interface>
</hal>
<hal format="hidl">
<name>android.hardware.nfc</name>
<transport>hwbinder</transport>
@@ -221,7 +221,7 @@
<hal format="hidl">
<name>android.hardware.power</name>
<transport>hwbinder</transport>
<version>1.1</version>
<version>1.2</version>
<interface>
<name>IPower</name>
<instance>default</instance>
@@ -270,7 +270,7 @@
<hal format="hidl">
<name>android.hardware.soundtrigger</name>
<transport>hwbinder</transport>
<version>2.0</version>
<version>2.1</version>
<interface>
<name>ISoundTriggerHw</name>
<instance>default</instance>
@@ -324,7 +324,7 @@
<hal format="hidl">
<name>android.hardware.vibrator</name>
<transport>hwbinder</transport>
<version>1.1</version>
<version>1.2</version>
<interface>
<name>IVibrator</name>
<instance>default</instance>
@@ -351,34 +351,34 @@
<hal format="hidl">
<name>android.hardware.wifi</name>
<transport>hwbinder</transport>
<version>1.1</version>
<version>1.2</version>
<interface>
<name>IWifi</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl">
<name>android.hardware.wifi.supplicant</name>
<name>android.hardware.wifi.hostapd</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IHostapd</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl">
<name>android.hardware.wifi.supplicant</name>
<transport>hwbinder</transport>
<version>1.1</version>
<interface>
<name>ISupplicant</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl">
<name>android.hardware.wifi.offload</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IOffload</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl">
<name>com.qualcomm.qti.ims.radio</name>
<transport>hwbinder</transport>
<version>1.0</version>
<version>1.1</version>
<interface>
<name>IImsRadio</name>
<instance>imsradio0</instance>
@@ -418,13 +418,11 @@
<interface>
<name>IQcRilAudio</name>
<instance>slot1</instance>
<instance>slot2</instance>
</interface>
</hal>
<hal format="hidl">
<name>com.quicinc.cne.server</name>
<transport>hwbinder</transport>
<impl level="generic"></impl>
<version>1.0</version>
<interface>
<name>IServer</name>
@@ -434,20 +432,10 @@
<hal format="hidl">
<name>com.quicinc.cne.api</name>
<transport>hwbinder</transport>
<impl level="generic"></impl>
<version>1.0</version>
<interface>
<name>IApiService</name>
<instance>cnd</instance>
</interface>
</hal>
<hal format="hidl">
<name>vendor.qti.atcmdfwd</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IAtCmdFwd</name>
<instance>AtCmdFwdService</instance>
</interface>
</hal>
</manifest>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2017 The Android Open Source Project
<!-- Copyright 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,138 +14,148 @@
limitations under the License.
-->
<!-- Generated file for wahoo using measurements between OPM1.170815.001 and OPM1.170912.002 -->
<!-- Generated file for wahoo using measurements between PPR1.180405.004 and PPR1.180514.002 -->
<MediaCodecs>
<!-- Measurements between OPD1.170804.003 and OPM1.170908.002 -->
<Encoders>
<MediaCodec name="OMX.qcom.video.encoder.h263" type="video/3gpp" update="true">
<Limit name="measured-frame-rate-176x144" range="390-390" /> <!-- N=228 v98%=1.2 -->
<Limit name="measured-frame-rate-352x288" range="416-424" /> <!-- N=228 v98%=1.2 -->
<!-- measured 98%:189-648 med:213/238 FLAKY(107 - 648 < mx=649.8) -->
<Limit name="measured-frame-rate-176x144" range="213-324" /> <!-- N=270 v98%=1.9 (PPR1.180405.002-) -->
<Limit name="measured-frame-rate-352x288" range="289-289" /> <!-- N=260 v98%=1.4 -->
</MediaCodec>
<MediaCodec name="OMX.qcom.video.encoder.avc" type="video/avc" update="true">
<Limit name="measured-frame-rate-320x240" range="427-431" /> <!-- N=228 v98%=1.2 -->
<Limit name="measured-frame-rate-720x480" range="168-168" /> <!-- N=228 v98%=1.2 -->
<Limit name="measured-frame-rate-1280x720" range="88-88" /> <!-- N=226 v98%=1.1 -->
<Limit name="measured-frame-rate-1920x1080" range="31-31" /> <!-- N=228 v98%=1.2 -->
<Limit name="measured-frame-rate-320x240" range="280-280" /> <!-- N=264 v98%=1.3 -->
<Limit name="measured-frame-rate-720x480" range="93-109" /> <!-- N=258 v98%=1.6 -->
<Limit name="measured-frame-rate-1280x720" range="87-87" /> <!-- N=266 v98%=1.3 (PPR1.180405.002-) -->
<Limit name="measured-frame-rate-1920x1080" range="33-33" /> <!-- N=258 v98%=1.4 -->
</MediaCodec>
<MediaCodec name="OMX.qcom.video.encoder.hevc" type="video/hevc" update="true">
<Limit name="measured-frame-rate-320x240" range="444-452" /> <!-- N=228 v98%=1.2 -->
<Limit name="measured-frame-rate-720x480" range="176-176" /> <!-- N=228 v98%=1.2 -->
<Limit name="measured-frame-rate-1280x720" range="124-125" /> <!-- N=228 v98%=1.1 -->
<Limit name="measured-frame-rate-1920x1080" range="52-52" /> <!-- N=228 v98%=1.2 -->
<Limit name="measured-frame-rate-3840x2160" range="21-21" /> <!-- N=228 v98%=1.3 -->
<Limit name="measured-frame-rate-320x240" range="329-329" /> <!-- N=262 v98%=1.3 -->
<!-- measured 98%:81-197 med:96/96 FLAKY(48 - 198 < mx=201.0) -->
<Limit name="measured-frame-rate-720x480" range="96-99" /> <!-- N=262 v98%=1.6 -->
<Limit name="measured-frame-rate-1280x720" range="125-125" /> <!-- N=262 v98%=1.1 -->
<Limit name="measured-frame-rate-1920x1080" range="49-49" /> <!-- N=250 v98%=1.2 -->
<Limit name="measured-frame-rate-3840x2160" range="17-20" /> <!-- N=262 v98%=1.3 (PPR1.180405.002-) -->
</MediaCodec>
<MediaCodec name="OMX.qcom.video.encoder.mpeg4" type="video/mp4v-es" update="true">
<Limit name="measured-frame-rate-176x144" range="384-384" /> <!-- N=228 v98%=1.2 -->
<Limit name="measured-frame-rate-352x288" range="387-399" /> <!-- N=228 v98%=1.2 -->
<!-- measured 98%:80-244 med:217/209 FLAKY(mn=73.3 < 80 - 418) -->
<Limit name="measured-frame-rate-640x480" range="146-209" /> <!-- TWEAKED N=228 v98%=1.7 -->
<!-- measured 98%:187-644 med:237/281 FLAKY(119 - 644 < mx=644.3) -->
<Limit name="measured-frame-rate-176x144" range="237-322" /> <!-- N=258 v98%=1.9 -->
<Limit name="measured-frame-rate-352x288" range="293-320" /> <!-- N=254 v98%=1.4 (PPR1.180405.002-) -->
<!-- measured 98%:78-257 med:225/225 FLAKY(mn=70.1 < 78 - 450) -->
<Limit name="measured-frame-rate-640x480" range="155-225" /> <!-- N=250 v98%=1.8 -->
</MediaCodec>
<MediaCodec name="OMX.qcom.video.encoder.vp8" type="video/x-vnd.on2.vp8" update="true">
<Limit name="measured-frame-rate-320x180" range="335-335" /> <!-- N=228 v98%=1.2 -->
<Limit name="measured-frame-rate-640x360" range="262-267" /> <!-- N=228 v98%=1.2 -->
<Limit name="measured-frame-rate-1280x720" range="82-82" /> <!-- N=228 v98%=1.1 -->
<Limit name="measured-frame-rate-1920x1080" range="32-32" /> <!-- N=228 v98%=1.3 -->
<!-- measured 93%:140-368 med:205/199 FLAKY(96 - 416 < mx=491.4) -->
<Limit name="measured-frame-rate-320x180" range="192-208" /> <!-- N=278 v93%=1.6 -->
<Limit name="measured-frame-rate-640x360" range="250-250" /> <!-- N=268 v98%=1.2 -->
<Limit name="measured-frame-rate-1280x720" range="87-87" /> <!-- N=254 v98%=1.1 -->
<Limit name="measured-frame-rate-1920x1080" range="34-34" /> <!-- N=254 v98%=1.3 (PPR1.180405.002-) -->
</MediaCodec>
<!-- Measurements between PPR1.180405.002 and PPR1.180514.002 -->
<MediaCodec name="OMX.google.h263.encoder" type="video/3gpp" update="true">
<!-- measured 98%:179-448 med:322/323 FLAKY(mn=143.6 < 161 - 646) -->
<Limit name="measured-frame-rate-176x144" range="287-323" /> <!-- TWEAKED N=228 v98%=1.6 -->
<!-- measured 98%:155-917 med:364/365 FLAKY(mn=132.7 < 150 - 956) variance:2.4 -->
<Limit name="measured-frame-rate-176x144" range="300-478" /> <!-- N=280 -->
</MediaCodec>
<MediaCodec name="OMX.google.h264.encoder" type="video/avc" update="true">
<!-- measured 97%:215-350 med:304/304 FLAKY(mn=83.7 < 152 - 608) -->
<Limit name="measured-frame-rate-320x240" range="167-304" /> <!-- TWEAKED N=224 v97%=1.3 -->
<!-- measured 98%:71-122 med:110/110 FLAKY(mn=46.8 < 55 - 220) -->
<Limit name="measured-frame-rate-720x480" range="93-110" /> <!-- TWEAKED N=228 v98%=1.3 -->
<!-- measured 98%:50-73 med:64/64 FLAKY(mn=24.1 < 32 - 128) -->
<Limit name="measured-frame-rate-1280x720" range="48-64" /> <!-- TWEAKED N=226 v98%=1.2 -->
<!-- measured 98%:21-37 med:29/29 FLAKY(mn=12.1 < 15 - 58) -->
<Limit name="measured-frame-rate-1920x1080" range="24-29" /> <!-- TWEAKED N=228 v98%=1.3 -->
<!-- measured 98%:79-351 med:278/277 FLAKY(mn=73.9 < 78 - 554) variance:2.1 -->
<Limit name="measured-frame-rate-320x240" range="155-277" /> <!-- N=244 -->
<!-- measured 98%:47-118 med:95/94 FLAKY(mn=45.2 < 46 - 188) -->
<Limit name="measured-frame-rate-720x480" range="90-94" /> <!-- TWEAKED N=258 v98%=1.6 (PPR1.180405.002-) -->
<!-- measured 98%:12-72 med:54/54 FLAKY(mn=12.1 < 13 - 108) variance:2.4 -->
<Limit name="measured-frame-rate-1280x720" range="25-54" /> <!-- N=274 (PPR1.180405.002-) -->
<Limit name="measured-frame-rate-1920x1080" range="24-27" /> <!-- N=256 v98%=1.4 -->
</MediaCodec>
<!-- Measurements between PPR1.180405.002 and PPR1.180514.002 -->
<MediaCodec name="OMX.google.mpeg4.encoder" type="video/mp4v-es" update="true">
<Limit name="measured-frame-rate-176x144" range="341-341" /> <!-- N=228 v98%=1.4 -->
<!-- measured 98%:150-1017 med:412/406 FLAKY(mn=126.9 < 147 - 1062) variance:2.6 -->
<Limit name="measured-frame-rate-176x144" range="253-531" /> <!-- TWEAKED N=270 -->
</MediaCodec>
<MediaCodec name="OMX.google.vp8.encoder" type="video/x-vnd.on2.vp8" update="true">
<Limit name="measured-frame-rate-320x180" range="73-73" /> <!-- N=228 v98%=1.4 -->
<Limit name="measured-frame-rate-640x360" range="45-45" /> <!-- N=226 v98%=1.2 -->
<Limit name="measured-frame-rate-1280x720" range="36-36" /> <!-- N=228 v98%=1.1 -->
<Limit name="measured-frame-rate-1920x1080" range="23-23" /> <!-- N=228 v98%=1.1 -->
</MediaCodec>
<!-- Measurements between OPM1.170809.002 and OPM1.170908.002 -->
<MediaCodec name="OMX.google.vp9.encoder" type="video/x-vnd.on2.vp9" update="true">
<Limit name="measured-frame-rate-320x180" range="205-205" /> <!-- N=102 v98%=1.0 -->
<Limit name="measured-frame-rate-640x360" range="68-68" /> <!-- N=102 v98%=1.0 -->
<Limit name="measured-frame-rate-1280x720" range="17-17" /> <!-- N=102 v98%=1.1 -->
<!-- measured 98%:38-97 med:75/75 FLAKY(mn=23.9 < 38 - 150) -->
<Limit name="measured-frame-rate-320x180" range="57-75" /> <!-- TWEAKED N=252 v98%=1.6 -->
<Limit name="measured-frame-rate-640x360" range="43-43" /> <!-- N=258 v98%=1.4 (PPR1.180405.002-) -->
<Limit name="measured-frame-rate-1280x720" range="17-17" /> <!-- N=300 v98%=1.3 -->
<Limit name="measured-frame-rate-1920x1080" range="12-12" /> <!-- N=254 v98%=1.2 (PPR1.180405.002-) -->
</MediaCodec>
</Encoders>
<Decoders>
<MediaCodec name="OMX.qcom.video.decoder.h263" type="video/3gpp" update="true">
<Limit name="measured-frame-rate-176x144" range="505-507" /> <!-- N=162 v98%=1.3 -->
<Limit name="measured-frame-rate-352x288" range="470-472" /> <!-- N=162 v98%=1.3 -->
<!-- measured 90%:359-764 med:368/368 FLAKY(184 - 808 < mx=1036.3) -->
<Limit name="measured-frame-rate-176x144" range="368-404" /> <!-- N=242 v90%=1.5 -->
<Limit name="measured-frame-rate-352x288" range="362-608" /> <!-- N=236 v98%=1.7 -->
</MediaCodec>
<MediaCodec name="OMX.qcom.video.decoder.avc" type="video/avc" update="true">
<Limit name="measured-frame-rate-320x240" range="342-342" /> <!-- N=162 v98%=1.3 -->
<Limit name="measured-frame-rate-720x480" range="303-303" /> <!-- N=162 v98%=1.3 -->
<Limit name="measured-frame-rate-1280x720" range="247-247" /> <!-- N=162 v98%=1.3 -->
<Limit name="measured-frame-rate-1920x1080" range="148-148" /> <!-- N=162 v98%=1.2 -->
<Limit name="measured-frame-rate-320x240" range="243-243" /> <!-- N=192 v98%=1.4 (PPR1.180405.002-) -->
<Limit name="measured-frame-rate-720x480" range="228-249" /> <!-- N=242 v98%=1.5 -->
<Limit name="measured-frame-rate-1280x720" range="212-213" /> <!-- N=236 v98%=1.3 -->
<Limit name="measured-frame-rate-1920x1080" range="142-142" /> <!-- N=192 v98%=1.1 (PPR1.180405.002-) -->
</MediaCodec>
<MediaCodec name="OMX.qcom.video.decoder.hevc" type="video/hevc" update="true">
<Limit name="measured-frame-rate-352x288" range="346-346" /> <!-- N=162 v98%=1.4 -->
<Limit name="measured-frame-rate-640x360" range="326-326" /> <!-- N=162 v98%=1.3 -->
<Limit name="measured-frame-rate-720x480" range="311-311" /> <!-- N=162 v98%=1.3 -->
<Limit name="measured-frame-rate-1280x720" range="267-267" /> <!-- N=162 v98%=1.3 -->
<Limit name="measured-frame-rate-1920x1080" range="258-258" /> <!-- N=162 v98%=1.0 -->
<Limit name="measured-frame-rate-3840x2160" range="71-71" /> <!-- N=162 v98%=1.0 -->
<!-- measured 98%:269-691 med:281/281 FLAKY(141 - 692 < mx=702.7) -->
<Limit name="measured-frame-rate-352x288" range="281-347" /> <!-- TWEAKED N=220 v98%=1.6 -->
<!-- measured 98%:251-506 med:262/262 FLAKY(131 - 524 < mx=526.0) -->
<Limit name="measured-frame-rate-640x360" range="262-264" /> <!-- TWEAKED N=192 v98%=1.4 (PPR1.180405.002-) -->
<Limit name="measured-frame-rate-720x480" range="251-251" /> <!-- N=192 v98%=1.4 (PPR1.180405.002-) -->
<Limit name="measured-frame-rate-1280x720" range="233-233" /> <!-- N=164 v98%=1.2 (PPR1.180405.002-) -->
<Limit name="measured-frame-rate-1920x1080" range="243-243" /> <!-- N=242 v98%=1.1 -->
<Limit name="measured-frame-rate-3840x2160" range="71-71" /> <!-- N=192 v98%=1.0 (PPR1.180405.002-) -->
</MediaCodec>
<MediaCodec name="OMX.qcom.video.decoder.mpeg4" type="video/mp4v-es" update="true">
<Limit name="measured-frame-rate-176x144" range="459-459" /> <!-- N=162 v98%=1.3 -->
<Limit name="measured-frame-rate-480x360" range="433-434" /> <!-- N=164 v98%=1.4 -->
<Limit name="measured-frame-rate-176x144" range="354-628" /> <!-- N=236 v98%=1.7 -->
<!-- measured 98%:331-944 med:338/338 FLAKY(169 - 944 < mx=952.4) -->
<Limit name="measured-frame-rate-480x360" range="338-472" /> <!-- N=242 v98%=1.7 -->
</MediaCodec>
<MediaCodec name="OMX.qcom.video.decoder.vp8" type="video/x-vnd.on2.vp8" update="true">
<Limit name="measured-frame-rate-320x180" range="418-419" /> <!-- N=162 v98%=1.3 -->
<Limit name="measured-frame-rate-640x360" range="414-414" /> <!-- N=162 v98%=1.3 -->
<Limit name="measured-frame-rate-1280x720" range="309-309" /> <!-- N=162 v98%=1.3 -->
<Limit name="measured-frame-rate-1920x1080" range="145-145" /> <!-- N=162 v98%=1.2 -->
<!-- measured 98%:319-910 med:328/327 FLAKY(164 - 910 < mx=910.7) -->
<Limit name="measured-frame-rate-320x180" range="327-456" /> <!-- TWEAKED N=219 v98%=1.7 -->
<!-- measured 98%:316-738 med:331/331 FLAKY(166 - 738 < mx=738.6) -->
<Limit name="measured-frame-rate-640x360" range="331-369" /> <!-- N=242 v98%=1.5 -->
<Limit name="measured-frame-rate-1280x720" range="286-286" /> <!-- N=236 v98%=1.1 -->
<Limit name="measured-frame-rate-1920x1080" range="143-143" /> <!-- N=192 v98%=1.0 (PPR1.180405.002-) -->
</MediaCodec>
<MediaCodec name="OMX.qcom.video.decoder.vp9" type="video/x-vnd.on2.vp9" update="true">
<Limit name="measured-frame-rate-320x180" range="342-342" /> <!-- N=162 v98%=1.3 -->
<Limit name="measured-frame-rate-640x360" range="335-335" /> <!-- N=162 v98%=1.3 -->
<Limit name="measured-frame-rate-1280x720" range="271-271" /> <!-- N=162 v98%=1.3 -->
<Limit name="measured-frame-rate-1920x1080" range="153-153" /> <!-- N=162 v98%=1.3 -->
<Limit name="measured-frame-rate-3840x2160" range="36-36" /> <!-- N=162 v98%=1.3 -->
<Limit name="measured-frame-rate-320x180" range="249-446" /> <!-- N=236 v98%=1.7 -->
<Limit name="measured-frame-rate-640x360" range="248-390" /> <!-- N=236 v98%=1.6 -->
<Limit name="measured-frame-rate-1280x720" range="256-256" /> <!-- N=242 v98%=1.1 -->
<Limit name="measured-frame-rate-1920x1080" range="151-151" /> <!-- N=164 v98%=1.0 (PPR1.180405.002-) -->
<Limit name="measured-frame-rate-3840x2160" range="36-36" /> <!-- N=236 v98%=1.0 -->
</MediaCodec>
<!-- Measurements between PPR1.180405.002 and PPR1.180514.002 -->
<MediaCodec name="OMX.google.h263.decoder" type="video/3gpp" update="true">
<Limit name="measured-frame-rate-176x144" range="150-150" /> <!-- N=162 v98%=1.3 -->
<!-- measured 98%:141-1306 med:155/156 FLAKY(78 - 682 < mx=1328.0) RG.VARIANCE:2.1 -->
<Limit name="measured-frame-rate-176x144" range="155-341" /> <!-- N=192 v98%=3.0 -->
</MediaCodec>
<MediaCodec name="OMX.google.h264.decoder" type="video/avc" update="true">
<!-- measured 98%:130-275 med:158/158 FLAKY(79 - 316 < mx=637.8) -->
<Limit name="measured-frame-rate-320x240" range="158-319" /> <!-- TWEAKED N=161 v98%=1.5 -->
<Limit name="measured-frame-rate-720x480" range="56-56" /> <!-- N=162 v98%=1.3 -->
<Limit name="measured-frame-rate-1280x720" range="28-28" /> <!-- N=162 v98%=1.5 -->
<Limit name="measured-frame-rate-1920x1080" range="15-15" /> <!-- N=162 v98%=1.5 -->
<!-- measured 98%:92-723 med:353/336 FLAKY(77 - 672 < mx=744.6) variance:2.8 -->
<Limit name="measured-frame-rate-320x240" range="170-373" /> <!-- TWEAKED N=218 -->
<!-- measured 98%:38-153 med:51/50 FLAKY(25 - 154 < mx=167.4) -->
<Limit name="measured-frame-rate-720x480" range="50-77" /> <!-- N=168 v98%=2.0 (PPR1.180405.002-) -->
<Limit name="measured-frame-rate-1280x720" range="28-38" /> <!-- N=242 v98%=1.7 -->
<Limit name="measured-frame-rate-1920x1080" range="15-15" /> <!-- N=164 v98%=1.4 (PPR1.180405.002-) -->
</MediaCodec>
<MediaCodec name="OMX.google.hevc.decoder" type="video/hevc" update="true">
<Limit name="measured-frame-rate-352x288" range="631-631" /> <!-- N=158 v98%=1.2 -->
<Limit name="measured-frame-rate-640x360" range="250-250" /> <!-- N=153 v98%=1.2 -->
<Limit name="measured-frame-rate-720x480" range="218-218" /> <!-- N=154 v98%=1.3 -->
<Limit name="measured-frame-rate-1280x720" range="102-103" /> <!-- N=159 v98%=1.3 -->
<!-- measured 98%:43-66 med:60/60 FLAKY(mn=0.0 < 30 - 120) -->
<Limit name="measured-frame-rate-1920x1080" range="60-60" /> <!-- N=160 v98%=1.2 -->
<Limit name="measured-frame-rate-352x288" range="625-626" /> <!-- N=177 v98%=1.1 (PPR1.180405.002-) -->
<Limit name="measured-frame-rate-640x360" range="289-289" /> <!-- N=188 v98%=1.3 (PPR1.180405.002-) -->
<Limit name="measured-frame-rate-720x480" range="227-227" /> <!-- N=221 v98%=1.3 -->
<Limit name="measured-frame-rate-1280x720" range="84-84" /> <!-- N=188 v98%=1.3 (PPR1.180405.002-) -->
<!-- measured 98%:40-59 med:46/46 FLAKY(mn=0.0 < 23 - 92) -->
<Limit name="measured-frame-rate-1920x1080" range="46-46" /> <!-- N=230 v98%=1.2 -->
</MediaCodec>
<!-- Measurements between PPR1.180405.002 and PPR1.180514.002 -->
<MediaCodec name="OMX.google.mpeg4.decoder" type="video/mp4v-es" update="true">
<Limit name="measured-frame-rate-176x144" range="177-177" /> <!-- N=162 v98%=1.4 -->
<!-- measured 98%:172-1548 med:187/187 FLAKY(94 - 822 < mx=1579.8) RG.VARIANCE:2.1 -->
<Limit name="measured-frame-rate-176x144" range="187-411" /> <!-- N=192 v98%=3.0 -->
</MediaCodec>
<MediaCodec name="OMX.google.vp8.decoder" type="video/x-vnd.on2.vp8" update="true">
<!-- measured 98%:432-1070 med:504/505 FLAKY(252 - 1070 < mx=1079.9) -->
<Limit name="measured-frame-rate-320x180" range="504-540" /> <!-- TWEAKED N=162 v98%=1.6 -->
<Limit name="measured-frame-rate-640x360" range="415-415" /> <!-- N=162 v98%=1.1 -->
<Limit name="measured-frame-rate-1280x720" range="95-95" /> <!-- N=162 v98%=1.1 -->
<Limit name="measured-frame-rate-1920x1080" range="37-37" /> <!-- N=162 v98%=1.1 -->
<Limit name="measured-frame-rate-320x180" range="579-754" /> <!-- N=164 v98%=1.8 (PPR1.180405.002-) -->
<Limit name="measured-frame-rate-640x360" range="402-402" /> <!-- N=236 v98%=1.0 -->
<Limit name="measured-frame-rate-1920x1080" range="36-36" /> <!-- N=220 v98%=1.0 -->
</MediaCodec>
<MediaCodec name="OMX.google.vp9.decoder" type="video/x-vnd.on2.vp9" update="true">
<Limit name="measured-frame-rate-320x180" range="468-470" /> <!-- N=162 v98%=1.4 -->
<Limit name="measured-frame-rate-640x360" range="377-379" /> <!-- N=162 v98%=1.1 -->
<Limit name="measured-frame-rate-1280x720" range="113-113" /> <!-- N=162 v98%=1.1 -->
<Limit name="measured-frame-rate-1920x1080" range="68-68" /> <!-- N=162 v98%=1.1 -->
<Limit name="measured-frame-rate-320x180" range="855-855" /> <!-- N=236 v98%=1.3 -->
<!-- measured 98%:219-421 med:334/333 FLAKY(mn=160.7 < 167 - 666) -->
<Limit name="measured-frame-rate-640x360" range="321-333" /> <!-- TWEAKED N=164 v98%=1.4 (PPR1.180405.002-) -->
<Limit name="measured-frame-rate-1280x720" range="121-121" /> <!-- N=219 v98%=1.1 -->
<Limit name="measured-frame-rate-1920x1080" range="67-67" /> <!-- N=236 v98%=1.1 -->
</MediaCodec>
</Decoders>
</MediaCodecs>

View File

@@ -66,6 +66,13 @@
<!-- Enable Night display, which requires HWC 2.0. -->
<bool name="config_nightDisplayAvailable">true</bool>
<!-- List supported color modes. -->
<integer-array name="config_availableColorModes">
<item>0</item> <!-- COLOR_MODE_NATURAL -->
<item>1</item> <!-- COLOR_MODE_BOOSTED -->
<item>2</item> <!-- COLOR_MODE_SATURATED -->
</integer-array>
<!-- Boolean indicating whether the HWC setColorTransform function can be performed efficiently
in hardware. -->
<bool name="config_setColorTransformAccelerated">true</bool>
@@ -229,7 +236,7 @@
<!-- If true, the doze component is not started until after the screen has been turned off
and the screen off animation has been performed. -->
<bool name="config_dozeAfterScreenOff">true</bool>
<bool name="config_dozeAfterScreenOffByDefault">true</bool>
<!-- Doze: should the TYPE_PICK_UP_GESTURE sensor be used as a pulse signal. -->
<bool name="config_dozePulsePickup">true</bool>
@@ -243,9 +250,6 @@
<!-- Whether the always on display mode is available. -->
<bool name="config_dozeAlwaysOnDisplayAvailable">true</bool>
<!-- Whether the display blanks itself when transition from a doze to a non-doze state -->
<bool name="config_displayBlanksAfterDoze">true</bool>
<!-- True if the display hardware only has brightness buckets rather than a full range of
backlight values -->
<bool name="config_displayBrightnessBucketsInDoze">true</bool>
@@ -298,18 +302,6 @@
rmem_min,rmem_def,rmem_max,wmem_min,wmem_def,wmem_max -->
<string name="config_wifi_tcp_buffers" translatable="false">524288,2097152,8388608,262144,524288,4194304</string>
<!-- Idle Receive current for wifi radio. 0 by default-->
<integer translatable="false" name="config_wifi_idle_receive_cur_ma">1</integer>
<!-- Rx current for wifi radio. 0 by default-->
<integer translatable="false" name="config_wifi_active_rx_cur_ma">100</integer>
<!-- Tx current for wifi radio. 0 by default-->
<integer translatable="false" name="config_wifi_tx_cur_ma">250</integer>
<!-- Operating volatage for wifi radio. 0 by default-->
<integer translatable="false" name="config_wifi_operating_voltage_mv">3800</integer>
<!-- Config SoftAP 2G channel list -->
<string translatable="false" name="config_wifi_framework_sap_2G_channel_list">6</string>
@@ -325,13 +317,13 @@
<!-- Default list of files pinned by the Pinner Service -->
<string-array translatable="false" name="config_defaultPinnerServiceFiles">
<item>"/system/framework/arm64/boot-framework.oat"</item>
<item>"/system/framework/arm64/boot-framework.vdex"</item>
<item>"/system/framework/boot-framework.vdex"</item>
<item>"/system/framework/oat/arm64/services.odex"</item>
<item>"/system/framework/oat/arm64/services.vdex"</item>
<item>"/system/framework/arm64/boot.oat"</item>
<item>"/system/framework/arm64/boot.vdex"</item>
<item>"/system/framework/boot.vdex"</item>
<item>"/system/framework/arm64/boot-core-libart.oat"</item>
<item>"/system/framework/arm64/boot-core-libart.vdex"</item>
<item>"/system/framework/boot-core-libart.vdex"</item>
</string-array>
<!-- Should the pinner service pin the Camera application? -->
@@ -347,5 +339,6 @@
<bool name="config_supportAudioSourceUnprocessed">true</bool>
<!-- Colon separated list of package names that should be granted DND access -->
<string name="config_defaultDndAccessPackages" translatable="false">com.google.android.GoogleCamera:com.google.intelligence.sense</string>
<string name="config_defaultDndAccessPackages" translatable="false">com.google.android.gms:com.google.android.GoogleCamera:com.google.intelligence.sense:com.google.android.settings.intelligence</string>
</resources>

View File

@@ -29,5 +29,4 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<resources>
<bool name="profile_supported_sap">true</bool>
<bool name="profile_supported_hearing_aid">true</bool>
</resources>

View File

@@ -21,4 +21,9 @@
<bool name="config_support_handover_from">true</bool>
<!-- Show enabled lte option for lte device -->
<bool name="config_enabled_lte" translatable="false">true</bool>
<!-- This device supports the AudioManager Telephony audio device and output onto this
device using {@link AudioDeviceInfo#TYPE_TELEPHONY}.
This is used to support carriers which generate a recording tone to the remote party
when a call recording app is in use. -->
<bool name="config_support_telephony_audio_device">true</bool>
</resources>

View File

@@ -1,2 +1,3 @@
disable_scan_offload=1
p2p_no_group_iface=1
p2p_go_vht=1

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<permissions>
<privapp-permissions package="com.qualcomm.qcrilmsgtunnel">
<permission name="android.permission.INTERACT_ACROSS_USERS"/>
</privapp-permissions>
<privapp-permissions package="com.quicinc.cne.CNEService">
<permission name="android.permission.INTERACT_ACROSS_USERS"/>
<permission name="android.permission.PACKET_KEEPALIVE_OFFLOAD"/>
</privapp-permissions>
</permissions>

View File

@@ -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,
}

View File

@@ -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 <fcntl.h>
@@ -28,11 +28,6 @@
#include <utils/Trace.h>
#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<HintManager> 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<std::mutex> lk(mLock);

View File

@@ -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 <mutex>
#include <thread>
#include <perfmgr/HintManager.h>
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<HintManager> const & hint_manager);
~InteractionHandler();
bool Init();
void Exit();
@@ -61,7 +65,7 @@ struct InteractionHandler {
std::unique_ptr<std::thread> mThread;
std::mutex mLock;
std::condition_variable mCond;
std::shared_ptr<HintManager> mHintManager;
};
#endif //INTERACTIONHANDLER_H

542
power-libperfmgr/Power.cpp Normal file
View File

@@ -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 <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/properties.h>
#include <android-base/strings.h>
#include <android-base/stringprintf.h>
#include <mutex>
#include <utils/Log.h>
#include <utils/Trace.h>
#include "Power.h"
#include "power-helper.h"
/* RPM runs at 19.2Mhz. Divide by 19200 for msec */
#define RPM_CLK 19200
extern struct stat_pair rpm_stat_map[];
namespace android {
namespace hardware {
namespace power {
namespace V1_2 {
namespace implementation {
using ::android::hardware::power::V1_0::Feature;
using ::android::hardware::power::V1_0::PowerStatePlatformSleepState;
using ::android::hardware::power::V1_0::Status;
using ::android::hardware::power::V1_1::PowerStateSubsystem;
using ::android::hardware::power::V1_1::PowerStateSubsystemSleepState;
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
Power::Power() :
mHintManager(HintManager::GetFromJSON("/vendor/etc/powerhint.json")),
mInteractionHandler(mHintManager),
mVRModeOn(false),
mSustainedPerfModeOn(false),
mEncoderModeOn(false) {
mInteractionHandler.Init();
std::string state = android::base::GetProperty(kPowerHalStateProp, "");
if (state == "VIDEO_ENCODE") {
ALOGI("Initialize with VIDEO_ENCODE on");
mHintManager->DoHint("VIDEO_ENCODE");
mEncoderModeOn = true;
} else if (state == "SUSTAINED_PERFORMANCE") {
ALOGI("Initialize with SUSTAINED_PERFORMANCE on");
mHintManager->DoHint("SUSTAINED_PERFORMANCE");
mSustainedPerfModeOn = true;
} else if (state == "VR_MODE") {
ALOGI("Initialize with VR_MODE on");
mHintManager->DoHint("VR_MODE");
mVRModeOn = true;
} else if (state == "VR_SUSTAINED_PERFORMANCE") {
ALOGI("Initialize with SUSTAINED_PERFORMANCE and VR_MODE on");
mHintManager->DoHint("VR_SUSTAINED_PERFORMANCE");
mSustainedPerfModeOn = true;
mVRModeOn = true;
} else {
ALOGI("Initialize PowerHAL");
}
state = android::base::GetProperty(kPowerHalAudioProp, "");
if (state == "LOW_LATENCY") {
ALOGI("Initialize with AUDIO_LOW_LATENCY on");
mHintManager->DoHint("AUDIO_LOW_LATENCY");
}
}
// Methods from ::android::hardware::power::V1_0::IPower follow.
Return<void> Power::setInteractive(bool /* interactive */) {
return Void();
}
Return<void> Power::powerHint(PowerHint_1_0 hint, int32_t data) {
if (!isSupportedGovernor()) {
return Void();
}
switch(hint) {
case PowerHint_1_0::INTERACTION:
if (mVRModeOn || mSustainedPerfModeOn) {
ALOGV("%s: ignoring due to other active perf hints", __func__);
} else {
mInteractionHandler.Acquire(data);
}
break;
case PowerHint_1_0::VIDEO_ENCODE:
if (mVRModeOn || mSustainedPerfModeOn) {
ALOGV("%s: ignoring due to other active perf hints", __func__);
break;
}
ATRACE_BEGIN("video_encode");
if (mVRModeOn || mSustainedPerfModeOn) {
ALOGV("%s: ignoring due to other active perf hints", __func__);
} else {
if (data) {
// Hint until canceled
ATRACE_INT("video_encode_lock", 1);
mHintManager->DoHint("VIDEO_ENCODE");
ALOGD("VIDEO_ENCODE ON");
if (!android::base::SetProperty(kPowerHalStateProp, "VIDEO_ENCODE")) {
ALOGE("%s: could not set powerHAL state property to VIDEO_ENCODE", __func__);
}
mEncoderModeOn = true;
} else {
ATRACE_INT("video_encode_lock", 0);
mHintManager->EndHint("VIDEO_ENCODE");
ALOGD("VIDEO_ENCODE OFF");
if (!android::base::SetProperty(kPowerHalStateProp, "")) {
ALOGE("%s: could not clear powerHAL state property", __func__);
}
mEncoderModeOn = false;
}
}
ATRACE_END();
break;
case PowerHint_1_0::SUSTAINED_PERFORMANCE:
if (data && !mSustainedPerfModeOn) {
ALOGD("SUSTAINED_PERFORMANCE ON");
if (!mVRModeOn) { // Sustained mode only.
mHintManager->DoHint("SUSTAINED_PERFORMANCE");
if (!android::base::SetProperty(kPowerHalStateProp, "SUSTAINED_PERFORMANCE")) {
ALOGE("%s: could not set powerHAL state property to SUSTAINED_PERFORMANCE", __func__);
}
} else { // Sustained + VR mode.
mHintManager->EndHint("VR_MODE");
mHintManager->DoHint("VR_SUSTAINED_PERFORMANCE");
if (!android::base::SetProperty(kPowerHalStateProp, "VR_SUSTAINED_PERFORMANCE")) {
ALOGE("%s: could not set powerHAL state property to VR_SUSTAINED_PERFORMANCE", __func__);
}
}
mSustainedPerfModeOn = true;
} else if (!data && mSustainedPerfModeOn) {
ALOGD("SUSTAINED_PERFORMANCE OFF");
mHintManager->EndHint("VR_SUSTAINED_PERFORMANCE");
mHintManager->EndHint("SUSTAINED_PERFORMANCE");
if (mVRModeOn) { // Switch back to VR Mode.
mHintManager->DoHint("VR_MODE");
if (!android::base::SetProperty(kPowerHalStateProp, "VR_MODE")) {
ALOGE("%s: could not set powerHAL state property to VR_MODE", __func__);
}
} else {
if (!android::base::SetProperty(kPowerHalStateProp, "")) {
ALOGE("%s: could not clear powerHAL state property", __func__);
}
}
mSustainedPerfModeOn = false;
}
break;
case PowerHint_1_0::VR_MODE:
if (data && !mVRModeOn) {
ALOGD("VR_MODE ON");
if (!mSustainedPerfModeOn) { // VR mode only.
mHintManager->DoHint("VR_MODE");
if (!android::base::SetProperty(kPowerHalStateProp, "VR_MODE")) {
ALOGE("%s: could not set powerHAL state property to VR_MODE", __func__);
}
} else { // Sustained + VR mode.
mHintManager->EndHint("SUSTAINED_PERFORMANCE");
mHintManager->DoHint("VR_SUSTAINED_PERFORMANCE");
if (!android::base::SetProperty(kPowerHalStateProp, "VR_SUSTAINED_PERFORMANCE")) {
ALOGE("%s: could not set powerHAL state property to VR_SUSTAINED_PERFORMANCE", __func__);
}
}
mVRModeOn = true;
} else if (!data && mVRModeOn) {
ALOGD("VR_MODE OFF");
mHintManager->EndHint("VR_SUSTAINED_PERFORMANCE");
mHintManager->EndHint("VR_MODE");
if (mSustainedPerfModeOn) { // Switch back to sustained Mode.
mHintManager->DoHint("SUSTAINED_PERFORMANCE");
if (!android::base::SetProperty(kPowerHalStateProp, "SUSTAINED_PERFORMANCE")) {
ALOGE("%s: could not set powerHAL state property to SUSTAINED_PERFORMANCE", __func__);
}
} else {
if (!android::base::SetProperty(kPowerHalStateProp, "")) {
ALOGE("%s: could not clear powerHAL state property", __func__);
}
}
mVRModeOn = false;
}
break;
case PowerHint_1_0::LAUNCH:
ATRACE_BEGIN("launch");
if (mVRModeOn || mSustainedPerfModeOn) {
ALOGV("%s: ignoring due to other active perf hints", __func__);
} else {
if (data) {
// Hint until canceled
ATRACE_INT("launch_lock", 1);
mHintManager->DoHint("LAUNCH");
ALOGD("LAUNCH ON");
} else {
ATRACE_INT("launch_lock", 0);
mHintManager->EndHint("LAUNCH");
ALOGD("LAUNCH OFF");
}
}
ATRACE_END();
break;
default:
break;
}
return Void();
}
Return<void> Power::setFeature(Feature /*feature*/, bool /*activate*/) {
//Nothing to do
return Void();
}
Return<void> Power::getPlatformLowPowerStats(getPlatformLowPowerStats_cb _hidl_cb) {
hidl_vec<PowerStatePlatformSleepState> states;
uint64_t stats[MAX_PLATFORM_STATS * MAX_RPM_PARAMS] = {0};
uint64_t *values;
struct PowerStatePlatformSleepState *state;
int ret;
states.resize(PLATFORM_SLEEP_MODES_COUNT);
ret = extract_platform_stats(stats);
if (ret != 0) {
states.resize(0);
goto done;
}
/* Update statistics for XO_shutdown */
state = &states[RPM_MODE_XO];
state->name = "XO_shutdown";
values = stats + (RPM_MODE_XO * MAX_RPM_PARAMS);
state->residencyInMsecSinceBoot = values[1];
state->totalTransitions = values[0];
state->supportedOnlyInSuspend = false;
state->voters.resize(XO_VOTERS);
for(size_t i = 0; i < XO_VOTERS; i++) {
int voter = static_cast<int>(i + XO_VOTERS_START);
state->voters[i].name = rpm_stat_map[voter].label;
values = stats + (voter * MAX_RPM_PARAMS);
state->voters[i].totalTimeInMsecVotedForSinceBoot = values[0] / RPM_CLK;
state->voters[i].totalNumberOfTimesVotedSinceBoot = values[1];
}
/* Update statistics for VMIN state */
state = &states[RPM_MODE_VMIN];
state->name = "VMIN";
values = stats + (RPM_MODE_VMIN * MAX_RPM_PARAMS);
state->residencyInMsecSinceBoot = values[1];
state->totalTransitions = values[0];
state->supportedOnlyInSuspend = false;
state->voters.resize(VMIN_VOTERS);
//Note: No filling of state voters since VMIN_VOTERS = 0
done:
_hidl_cb(states, Status::SUCCESS);
return Void();
}
static int get_wlan_low_power_stats(struct PowerStateSubsystem *subsystem) {
uint64_t stats[WLAN_POWER_PARAMS_COUNT] = {0};
struct PowerStateSubsystemSleepState *state;
subsystem->name = "wlan";
if (extract_wlan_stats(stats) != 0) {
subsystem->states.resize(0);
return -1;
}
subsystem->states.resize(WLAN_STATES_COUNT);
/* Update statistics for Active State */
state = &subsystem->states[WLAN_STATE_ACTIVE];
state->name = "Active";
state->residencyInMsecSinceBoot = stats[CUMULATIVE_TOTAL_ON_TIME_MS];
state->totalTransitions = stats[DEEP_SLEEP_ENTER_COUNTER];
state->lastEntryTimestampMs = 0; //FIXME need a new value from Qcom
state->supportedOnlyInSuspend = false;
/* Update statistics for Deep-Sleep state */
state = &subsystem->states[WLAN_STATE_DEEP_SLEEP];
state->name = "Deep-Sleep";
state->residencyInMsecSinceBoot = stats[CUMULATIVE_SLEEP_TIME_MS];
state->totalTransitions = stats[DEEP_SLEEP_ENTER_COUNTER];
state->lastEntryTimestampMs = stats[LAST_DEEP_SLEEP_ENTER_TSTAMP_MS];
state->supportedOnlyInSuspend = false;
return 0;
}
enum easel_state {
EASEL_OFF = 0,
EASEL_ON,
EASEL_SUSPENDED,
NUM_EASEL_STATES
};
// Get low power stats for easel subsystem
static int get_easel_low_power_stats(struct PowerStateSubsystem *subsystem) {
// This implementation is a workaround to provide minimal visibility into
// Easel state behavior until canonical low power stats are supported.
// It takes an "external observer" snapshot of the current Easel state every
// time it is called, and synthesizes an artificial sleep state that will
// behave similarly to real stats if Easel gets "wedged" in the "on" state.
static std::mutex statsLock;
static uint64_t totalOnSnapshotCount = 0;
static uint64_t totalNotOnSnapshotCount = 0;
unsigned long currentState;
struct PowerStateSubsystemSleepState *state;
subsystem->name = "Easel";
if (get_easel_state(&currentState) != 0) {
subsystem->states.resize(0);
return -1;
}
if (currentState >= NUM_EASEL_STATES) {
ALOGE("%s: unrecognized Easel state(%lu)", __func__, currentState);
return -1;
}
subsystem->states.resize(1);
// Since we are storing stats locally but can have multiple parallel
// callers, locking is required to ensure stats are not corrupted.
std::lock_guard<std::mutex> lk(statsLock);
// Update statistics for synthetic sleep state. We combine OFF and
// SUSPENDED to act as a composite "not on" state so the numbers will behave
// like a real sleep state.
if ((currentState == EASEL_OFF) || (currentState == EASEL_SUSPENDED)) {
totalNotOnSnapshotCount++;
} else {
totalOnSnapshotCount++;
}
// Update statistics for synthetic sleep state, where
// totalTransitions = cumulative count of Easel state0 (as seen by PowerHAL)
// residencyInMsecsSinceBoot = cumulative count of Easel state1 (as seen by
// PowerHAL)
// lastEntryTimestampMs = cumulative count of Easel state2 (as seen by
// PowerHAL)
state = &subsystem->states[0];
state->name = "SyntheticSleep";
state->totalTransitions = totalOnSnapshotCount;
state->residencyInMsecSinceBoot = totalNotOnSnapshotCount;
state->lastEntryTimestampMs = 0; // No added value for the workaround
state->supportedOnlyInSuspend = false;
return 0;
}
// Methods from ::android::hardware::power::V1_1::IPower follow.
Return<void> Power::getSubsystemLowPowerStats(getSubsystemLowPowerStats_cb _hidl_cb) {
hidl_vec<PowerStateSubsystem> subsystems;
subsystems.resize(SUBSYSTEM_COUNT);
// Get WLAN subsystem low power stats.
if (get_wlan_low_power_stats(&subsystems[SUBSYSTEM_WLAN]) != 0) {
ALOGE("%s: failed to process wlan stats", __func__);
}
// Get Easel subsystem low power stats.
if (get_easel_low_power_stats(&subsystems[SUBSYSTEM_EASEL]) != 0) {
ALOGE("%s: failed to process Easel stats", __func__);
}
_hidl_cb(subsystems, Status::SUCCESS);
return Void();
}
bool Power::isSupportedGovernor() {
std::string buf;
if (android::base::ReadFileToString("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor", &buf)) {
buf = android::base::Trim(buf);
}
// Only support EAS 1.2, legacy EAS
if (buf == "schedutil" || buf == "sched") {
return true;
} else {
LOG(ERROR) << "Governor not supported by powerHAL, skipping";
return false;
}
}
Return<void> Power::powerHintAsync(PowerHint_1_0 hint, int32_t data) {
// just call the normal power hint in this oneway function
return powerHint(hint, data);
}
// Methods from ::android::hardware::power::V1_2::IPower follow.
Return<void> Power::powerHintAsync_1_2(PowerHint_1_2 hint, int32_t data) {
if (!isSupportedGovernor()) {
return Void();
}
switch(hint) {
case PowerHint_1_2::AUDIO_LOW_LATENCY:
ATRACE_BEGIN("audio_low_latency");
if (data) {
// Hint until canceled
ATRACE_INT("audio_low_latency_lock", 1);
mHintManager->DoHint("AUDIO_LOW_LATENCY");
ALOGD("AUDIO LOW LATENCY ON");
if (!android::base::SetProperty(kPowerHalAudioProp, "LOW_LATENCY")) {
ALOGE("%s: could not set powerHAL audio state property to LOW_LATENCY", __func__);
}
} else {
ATRACE_INT("audio_low_latency_lock", 0);
mHintManager->EndHint("AUDIO_LOW_LATENCY");
ALOGD("AUDIO LOW LATENCY OFF");
if (!android::base::SetProperty(kPowerHalAudioProp, "")) {
ALOGE("%s: could not clear powerHAL audio state property", __func__);
}
}
ATRACE_END();
break;
case PowerHint_1_2::AUDIO_STREAMING:
ATRACE_BEGIN("audio_streaming");
if (data) {
// Hint until canceled
ATRACE_INT("audio_streaming_lock", 1);
mHintManager->DoHint("AUDIO_STREAMING");
ALOGD("AUDIO STREAMING ON");
} else {
ATRACE_INT("audio_streaming_lock", 0);
mHintManager->EndHint("AUDIO_STREAMING");
ALOGD("AUDIO STREAMING OFF");
}
ATRACE_END();
break;
case PowerHint_1_2::CAMERA_LAUNCH:
ATRACE_BEGIN("camera_launch");
if (data > 0) {
ATRACE_INT("camera_launch_lock", 1);
mHintManager->DoHint("CAMERA_LAUNCH", std::chrono::milliseconds(data));
ALOGD("CAMERA LAUNCH ON: %d MS, LAUNCH ON: 2500 MS", data);
// boosts 2.5s for launching
mHintManager->DoHint("LAUNCH", std::chrono::milliseconds(2500));
} else if (data == 0) {
ATRACE_INT("camera_launch_lock", 0);
mHintManager->EndHint("CAMERA_LAUNCH");
ALOGD("CAMERA LAUNCH OFF");
} else {
ALOGE("CAMERA LAUNCH INVALID DATA: %d", data);
}
ATRACE_END();
break;
case PowerHint_1_2::CAMERA_STREAMING:
ATRACE_BEGIN("camera_streaming");
if (data > 0) {
ATRACE_INT("camera_streaming_lock", 1);
mHintManager->DoHint("CAMERA_STREAMING", std::chrono::milliseconds(data));
ALOGD("CAMERA STREAMING ON: %d MS", data);
} else if (data == 0) {
ATRACE_INT("camera_streaming_lock", 0);
mHintManager->EndHint("CAMERA_STREAMING");
ALOGD("CAMERA STREAMING OFF");
} else {
ALOGE("CAMERA STREAMING INVALID DATA: %d", data);
}
ATRACE_END();
break;
case PowerHint_1_2::CAMERA_SHOT:
ATRACE_BEGIN("camera_shot");
if (data > 0) {
ATRACE_INT("camera_shot_lock", 1);
mHintManager->DoHint("CAMERA_SHOT", std::chrono::milliseconds(data));
ALOGD("CAMERA SHOT ON: %d MS", data);
} else if (data == 0) {
ATRACE_INT("camera_shot_lock", 0);
mHintManager->EndHint("CAMERA_SHOT");
ALOGD("CAMERA SHOT OFF");
} else {
ALOGE("CAMERA SHOT INVALID DATA: %d", data);
}
ATRACE_END();
break;
default:
return powerHint(static_cast<PowerHint_1_0>(hint), data);
}
return Void();
}
constexpr const char* boolToString(bool b) {
return b ? "true" : "false";
}
Return<void> Power::debug(const hidl_handle& handle, const hidl_vec<hidl_string>&) {
if (handle != nullptr && handle->numFds >= 1) {
int fd = handle->data[0];
std::string buf(android::base::StringPrintf("HintManager Running: %s\n"
"VRMode: %s\n"
"SustainedPerformanceMode: %s\n"
"VideoEncodeMode: %s\n",
boolToString(mHintManager->IsRunning()),
boolToString(mVRModeOn),
boolToString(mSustainedPerfModeOn),
boolToString(mEncoderModeOn)));
// Dump nodes through libperfmgr
mHintManager->DumpToFd(fd);
if (!android::base::WriteStringToFd(buf, fd)) {
PLOG(ERROR) << "Failed to dump state to fd";
}
fsync(fd);
}
return Void();
}
} // namespace implementation
} // namespace V1_2
} // namespace power
} // namespace hardware
} // namespace android

View File

@@ -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 <android/hardware/power/1.1/IPower.h>
#include <atomic>
#include <android/hardware/power/1.2/IPower.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
#include <hardware/power.h>
#include <perfmgr/HintManager.h>
#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<void> setInteractive(bool interactive) override;
Return<void> powerHint(PowerHint hint, int32_t data) override;
Return<void> setInteractive(bool /* interactive */) override;
Return<void> powerHint(PowerHint_1_0 hint, int32_t data) override;
Return<void> setFeature(Feature feature, bool activate) override;
Return<void> getPlatformLowPowerStats(getPlatformLowPowerStats_cb _hidl_cb) override;
// Methods from ::android::hardware::power::V1_1::IPower follow.
Return<void> getSubsystemLowPowerStats(getSubsystemLowPowerStats_cb _hidl_cb) override;
Return<void> powerHintAsync(PowerHint hint, int32_t data) override;
Return<void> powerHintAsync(PowerHint_1_0 hint, int32_t data) override;
// Methods from ::android::hardware::power::V1_2::IPower follow.
Return<void> powerHintAsync_1_2(PowerHint_1_2 hint, int32_t data) override;
// Methods from ::android::hidl::base::V1_0::IBase follow.
Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& args) override;
private:
InteractionHandler mInteractionHandler;
static bool isSupportedGovernor();
std::shared_ptr<HintManager> mHintManager;
InteractionHandler mInteractionHandler;
std::atomic<bool> mVRModeOn;
std::atomic<bool> mSustainedPerfModeOn;
std::atomic<bool> mEncoderModeOn;
};
} // namespace implementation
} // namespace V1_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

View File

@@ -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

View File

@@ -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 <errno.h>
#include <inttypes.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <dlfcn.h>
#include <stdlib.h>
#include <log/log.h>
#include "power-helper.h"
#ifndef RPM_SYSTEM_STAT
#define RPM_SYSTEM_STAT "/d/system_stats"
#endif
#ifndef WLAN_POWER_STAT
#define WLAN_POWER_STAT "/d/wlan0/power_stats"
#endif
#ifndef EASEL_STATE_FILE
#define EASEL_STATE_FILE "/sys/devices/virtual/misc/mnh_sm/state"
#endif
#define ARRAY_SIZE(x) (sizeof((x))/sizeof((x)[0]))
#define LINE_SIZE 128
const char *rpm_stat_params[MAX_RPM_PARAMS] = {
"count",
"actual last sleep(msec)",
};
const char *master_stat_params[MAX_RPM_PARAMS] = {
"Accumulated XO duration",
"XO Count",
};
struct stat_pair rpm_stat_map[] = {
{ RPM_MODE_XO, "RPM Mode:vlow", rpm_stat_params, ARRAY_SIZE(rpm_stat_params) },
{ RPM_MODE_VMIN, "RPM Mode:vmin", rpm_stat_params, ARRAY_SIZE(rpm_stat_params) },
{ VOTER_APSS, "APSS", master_stat_params, ARRAY_SIZE(master_stat_params) },
{ VOTER_MPSS, "MPSS", master_stat_params, ARRAY_SIZE(master_stat_params) },
{ VOTER_ADSP, "ADSP", master_stat_params, ARRAY_SIZE(master_stat_params) },
{ VOTER_SLPI, "SLPI", master_stat_params, ARRAY_SIZE(master_stat_params) },
};
const char *wlan_power_stat_params[] = {
"cumulative_sleep_time_ms",
"cumulative_total_on_time_ms",
"deep_sleep_enter_counter",
"last_deep_sleep_enter_tstamp_ms"
};
struct stat_pair wlan_stat_map[] = {
{ WLAN_POWER_DEBUG_STATS, "POWER DEBUG STATS", wlan_power_stat_params, ARRAY_SIZE(wlan_power_stat_params) },
};
static int parse_stats(const char **params, size_t params_size,
uint64_t *list, FILE *fp) {
ssize_t nread;
size_t len = LINE_SIZE;
char *line;
size_t params_read = 0;
size_t i;
line = malloc(len);
if (!line) {
ALOGE("%s: no memory to hold line", __func__);
return -ENOMEM;
}
while ((params_read < params_size) &&
(nread = getline(&line, &len, fp) > 0)) {
char *key = line + strspn(line, " \t");
char *value = strchr(key, ':');
if (!value || (value > (line + len)))
continue;
*value++ = '\0';
for (i = 0; i < params_size; i++) {
if (!strcmp(key, params[i])) {
list[i] = strtoull(value, NULL, 0);
params_read++;
break;
}
}
}
free(line);
return 0;
}
static int extract_stats(uint64_t *list, char *file,
struct stat_pair *map, size_t map_size) {
FILE *fp;
ssize_t read;
size_t len = LINE_SIZE;
char *line;
size_t i, stats_read = 0;
int ret = 0;
fp = fopen(file, "re");
if (fp == NULL) {
ALOGE("%s: failed to open: %s Error = %s", __func__, file, strerror(errno));
return -errno;
}
line = malloc(len);
if (!line) {
ALOGE("%s: no memory to hold line", __func__);
fclose(fp);
return -ENOMEM;
}
while ((stats_read < map_size) && (read = getline(&line, &len, fp) != -1)) {
size_t begin = strspn(line, " \t");
for (i = 0; i < map_size; i++) {
if (!strncmp(line + begin, map[i].label, strlen(map[i].label))) {
stats_read++;
break;
}
}
if (i == map_size)
continue;
ret = parse_stats(map[i].parameters, map[i].num_parameters,
&list[map[i].stat * MAX_RPM_PARAMS], fp);
if (ret < 0)
break;
}
free(line);
fclose(fp);
return ret;
}
int extract_platform_stats(uint64_t *list) {
return extract_stats(list, RPM_SYSTEM_STAT, rpm_stat_map, ARRAY_SIZE(rpm_stat_map));
}
int extract_wlan_stats(uint64_t *list) {
return extract_stats(list, WLAN_POWER_STAT, wlan_stat_map, ARRAY_SIZE(wlan_stat_map));
}
int get_easel_state(unsigned long *current_state) {
FILE *fp = NULL;
static const size_t EASEL_STATE_LINE_SIZE = 16;
char buffer[EASEL_STATE_LINE_SIZE];
char *parse_end = buffer;
unsigned long state;
if (current_state == NULL) {
ALOGD("%s: null current_state pointer from caller", __func__);
return -1;
}
fp = fopen(EASEL_STATE_FILE, "re");
if (fp == NULL) {
ALOGE("%s: failed to open: %s Error = %s", __func__, EASEL_STATE_FILE,
strerror(errno));
return -errno;
}
if (fgets(buffer, EASEL_STATE_LINE_SIZE, fp) == NULL) {
fclose(fp);
ALOGE("%s: failed to read: %s", __func__, EASEL_STATE_FILE);
return -1;
}
fclose(fp);
parse_end = buffer;
state = strtoul(buffer, &parse_end, 10);
if ((parse_end == buffer) || (state > 2)) {
ALOGE("%s: unrecognized format: %s '%s'", __func__, EASEL_STATE_FILE,
buffer);
return -1;
}
*current_state = state;
return 0;
}

View File

@@ -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
}

View File

@@ -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 <android/log.h>
#include <hidl/HidlTransportSupport.h>
#include <hardware/power.h>
#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<IPower> service = nullptr;
ALOGI("Power HAL Service 1.1 for Wahoo is starting.");
service = new Power();
android::sp<IPower> 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;
}

View File

@@ -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)

View File

@@ -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 <android/log.h>
#include <android-base/file.h>
#include <android-base/properties.h>
#include <android-base/strings.h>
#include <utils/Log.h>
#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<void> Power::setInteractive(bool interactive) {
if (!isSupportedGovernor()) {
return Void();
}
power_set_interactive(interactive ? 1 : 0);
return Void();
}
Return<void> 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<power_hint_t>(hint);
if (!isSupportedGovernor()) {
return Void();
}
if (h == POWER_HINT_INTERACTION) {
mInteractionHandler.Acquire(data);
return Void();
}
power_hint(h, data ? &data : NULL);
return Void();
}
Return<void> Power::setFeature(Feature /*feature*/, bool /*activate*/) {
//Nothing to do
return Void();
}
Return<void> Power::getPlatformLowPowerStats(getPlatformLowPowerStats_cb _hidl_cb) {
hidl_vec<PowerStatePlatformSleepState> states;
uint64_t stats[MAX_PLATFORM_STATS * MAX_RPM_PARAMS] = {0};
uint64_t *values;
struct PowerStatePlatformSleepState *state;
int ret;
states.resize(PLATFORM_SLEEP_MODES_COUNT);
ret = extract_platform_stats(stats);
if (ret != 0) {
states.resize(0);
goto done;
}
/* Update statistics for XO_shutdown */
state = &states[RPM_MODE_XO];
state->name = "XO_shutdown";
values = stats + (RPM_MODE_XO * MAX_RPM_PARAMS);
state->residencyInMsecSinceBoot = values[1];
state->totalTransitions = values[0];
state->supportedOnlyInSuspend = false;
state->voters.resize(XO_VOTERS);
for(size_t i = 0; i < XO_VOTERS; i++) {
int voter = static_cast<int>(i + XO_VOTERS_START);
state->voters[i].name = rpm_stat_map[voter].label;
values = stats + (voter * MAX_RPM_PARAMS);
state->voters[i].totalTimeInMsecVotedForSinceBoot = values[0] / RPM_CLK;
state->voters[i].totalNumberOfTimesVotedSinceBoot = values[1];
}
/* Update statistics for VMIN state */
state = &states[RPM_MODE_VMIN];
state->name = "VMIN";
values = stats + (RPM_MODE_VMIN * MAX_RPM_PARAMS);
state->residencyInMsecSinceBoot = values[1];
state->totalTransitions = values[0];
state->supportedOnlyInSuspend = false;
state->voters.resize(VMIN_VOTERS);
//Note: No filling of state voters since VMIN_VOTERS = 0
done:
_hidl_cb(states, Status::SUCCESS);
return Void();
}
static int get_wlan_low_power_stats(struct PowerStateSubsystem &subsystem) {
uint64_t stats[WLAN_POWER_PARAMS_COUNT] = {0};
struct PowerStateSubsystemSleepState *state;
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<void> Power::getSubsystemLowPowerStats(getSubsystemLowPowerStats_cb _hidl_cb) {
hidl_vec<PowerStateSubsystem> 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<void> 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

View File

@@ -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

View File

@@ -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 <utils/Log.h>
#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);
}

View File

@@ -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);

View File

@@ -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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "list.h"
#include <utils/Log.h>
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;
}

View File

@@ -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);

View File

@@ -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);

View File

@@ -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 <stdio.h>
#include <string.h>
#include <stdlib.h>
#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;
}

View File

@@ -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

View File

@@ -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 <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <dlfcn.h>
#include <stdlib.h>
#define ATRACE_TAG (ATRACE_TAG_POWER | ATRACE_TAG_HAL)
#define LOG_TAG "QCOM PowerHAL"
#include <utils/Log.h>
#include <cutils/trace.h>
#include <hardware/hardware.h>
#include <hardware/power.h>
#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 */
}

View File

@@ -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__))

View File

@@ -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 <errno.h>
#include <inttypes.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <dlfcn.h>
#include <stdlib.h>
#define LOG_TAG "QCOM PowerHAL"
#include <utils/Log.h>
#include <hardware/power.h>
#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));
}

View File

@@ -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 <unistd.h>
#include <log/log.h>
#include <libxml/parser.h>
#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;
}

View File

@@ -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__ */

View File

@@ -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 <dlfcn.h>
#include <fcntl.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "utils.h"
#include "list.h"
#include "hint-data.h"
#include "power-common.h"
#define LOG_TAG "QCOM PowerHAL"
#include <utils/Log.h>
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);
}
}
}

View File

@@ -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 <cutils/properties.h>
#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

453
powerhint.json Normal file
View File

@@ -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"
}
]
}

View File

@@ -39,7 +39,6 @@
<Resource opcode="0x40800100" value="0x0"/> <!-- L CPU - Cluster min freq uncapped -->
<Resource opcode="0x40804000" value="0x4E0"/> <!-- B CPU - Cluster max freq ~1.2 GHz -->
<Resource opcode="0x40804100" value="0x4E0"/> <!-- L CPU - Cluster max freq ~1.2 Ghz -->
<Resource opcode="0x4280C000" value="0xB4"/> <!-- GPU - min freq 180 Mhz -->
<Resource opcode="0x42810000" value="0x156"/> <!-- GPU - max freq 342 Mhz -->
<Resource opcode="0x42814000" value="0x0"/> <!-- GPUBW freq uncapped -->
</Hint>
@@ -69,12 +68,35 @@
<Resource opcode="0x41800000" value="0x33"/> <!-- CPUBW min freq 681 MHz -->
</Hint>
<Hint type="0x1B00"> <!--boost-->
<Resource opcode="0x40804000" value="0xFFF"/> <!-- B CPU - Cluster max freq ~ max -->
<Resource opcode="0x40804100" value="0xFFF"/> <!-- L CPU - Cluster max freq ~ max -->
<Resource opcode="0x40800000" value="0xFFF"/> <!-- B CPU - Cluster min freq ~ max -->
<Resource opcode="0x40800100" value="0xFFF"/> <!-- L CPU - Cluster min freq ~ max -->
<Resource opcode="0x4180C000" value="0x0"/> <!-- CPUBW disable hysteresis -->
<Resource opcode="0x40400000" value="0x1"/> <!-- POWER_COLLAPSE -->
<Resource opcode="0x41800000" value="0x8C"/> <!-- CPUBW min freq 1804 MHz -->
</Hint>
<Hint type="0x0B0A"> <!--CAMERA LAUNCH-->
<Resource opcode="0x40800000" value="0xFFF"/> <!-- B CPU - Cluster min freq ~ max -->
<Resource opcode="0x40800100" value="0xFFF"/> <!-- L CPU - Cluster min freq ~ max -->
<Resource opcode="0x40400000" value="0x1"/> <!-- POWER_COLLAPSE -->
</Hint>
<Hint type="0x0C0A"> <!--CAMERA STREAMING-->
<Resource opcode="0x40800000" value="0xFFF"/> <!-- B CPU - Cluster min freq ~ max -->
<Resource opcode="0x40800100" value="0xFFF"/> <!-- L CPU - Cluster min freq ~ max -->
<Resource opcode="0x40400000" value="0x1"/> <!-- POWER_COLLAPSE -->
</Hint>
<Hint type="0x0D0A"> <!--CAMERA SHOT-->
<Resource opcode="0x40800000" value="0xFFF"/> <!-- B CPU - Cluster min freq ~ max -->
<Resource opcode="0x40800100" value="0xFFF"/> <!-- L CPU - Cluster min freq ~ max -->
<Resource opcode="0x40400000" value="0x1"/> <!-- POWER_COLLAPSE -->
<Resource opcode="0x4180C000" value="0x0"/> <!-- CPUBW disable hysteresis -->
<Resource opcode="0x41800000" value="0x8C"/> <!-- CPUBW min freq 1804 MHz -->
</Hint>
<Hint type="0x0E0A"> <!--AUDIO STREAMING-->
<Resource opcode="0x40400000" value="0x1"/> <!-- POWER_COLLAPSE -->
<Resource opcode="0x40800000" value="0x579"/> <!-- B CPU - Cluster min freq ~1.4 Ghz -->
</Hint>
<Hint type="0x0F0A"> <!--AUDIO_LOW_LATENCY-->
<Resource opcode="0x40400000" value="0x1"/> <!-- POWER_COLLAPSE -->
</Hint>
</Powerhint>

View File

@@ -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-----

View File

@@ -0,0 +1,2 @@
[@WFCACTIVATION]
ALL : device/google/wahoo/sepolicy/private/certs/wfcactivation.x509.pem

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<policy>
<!--
* A signature is a hex encoded X.509 certificate or a tag defined in
keys.conf and is required for each signer tag.
* A signer tag may contain a seinfo tag and multiple package stanzas.
* A default tag is allowed that can contain policy for all apps not signed with a
previously listed cert. It may not contain any inner package stanzas.
* Each signer/default/package tag is allowed to contain one seinfo tag. This tag
represents additional info that each app can use in setting a SELinux security
context on the eventual process.
* When a package is installed the following logic is used to determine what seinfo
value, if any, is assigned.
- All signatures used to sign the app are checked first.
- If a signer stanza has inner package stanzas, those stanza will be checked
to try and match the package name of the app. If the package name matches
then that seinfo tag is used. If no inner package matches then the outer
seinfo tag is assigned.
- The default tag is consulted last if needed.
-->
<signer signature="@WFCACTIVATION" >
<seinfo value="wfcactivation" />
</signer>
</policy>

View File

@@ -0,0 +1 @@
allow platform_app qchook_service:service_manager find;

View File

@@ -1 +1,2 @@
allow radio uce_service:service_manager find;
add_service(radio, qchook_service)

View File

@@ -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

View File

@@ -1,2 +1,3 @@
type cne_service, service_manager_type;
type uce_service, service_manager_type;
type qchook_service, service_manager_type;

View File

@@ -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

View File

@@ -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;

View File

@@ -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)

View File

@@ -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;

View File

@@ -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

View File

@@ -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

2
sepolicy/vendor/charger.te vendored Normal file
View File

@@ -0,0 +1,2 @@
typeattribute charger system_writes_vendor_properties_violators;
set_prop(charger, public_vendor_system_prop)

12
sepolicy/vendor/con_monitor.te vendored Normal file
View File

@@ -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);

View File

@@ -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)

View File

@@ -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;

View File

@@ -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;

View File

@@ -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

View File

@@ -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

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

11
sepolicy/vendor/hal_health_default.te vendored Normal file
View File

@@ -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;

View File

@@ -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;

View File

@@ -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)

View File

@@ -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)

View File

@@ -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;

View File

@@ -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;

2
sepolicy/vendor/healthd.te vendored Normal file
View File

@@ -0,0 +1,2 @@
typeattribute healthd system_writes_vendor_properties_violators;
set_prop(healthd, public_vendor_system_prop)

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

Some files were not shown because too many files have changed in this diff Show More