This commit is contained in:
Vincent Vidal 2025-08-07 16:07:57 +02:00
commit 8710a52d67
123 changed files with 20007 additions and 0 deletions

9
Android.bp Normal file
View file

@ -0,0 +1,9 @@
soong_namespace {
}
install_symlink {
name: "nvcfg_mdota.ini_symlink",
vendor: true,
installed_location: "etc/mdota",
symlink_target: "/mnt/vendor/mdota",
}

8
AndroidProducts.mk Normal file
View file

@ -0,0 +1,8 @@
#
# Copyright (C) 2023 The LineageOS Project
#
# SPDX-License-Identifier: Apache-2.0
#
PRODUCT_MAKEFILES := \
$(LOCAL_DIR)/lineage_brax3.mk

212
BoardConfig.mk Normal file
View file

@ -0,0 +1,212 @@
DEVICE_PATH := device/brax/brax3
KEYS_PATH := vendor/lineage-priv/keys
TARGET_KERNEL_PATH := device/brax/brax3-kernel
BUILD_BROKEN_DUP_RULES := true
# A/B
AB_OTA_UPDATER := true
BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT := true
BOARD_USES_RECOVERY_AS_BOOT :=
TARGET_NO_RECOVERY := true
AB_OTA_PARTITIONS += \
boot \
dtbo \
init_boot \
odm_dlkm \
product \
system \
system_ext \
system_dlkm \
vbmeta \
vbmeta_system \
vbmeta_vendor \
vendor \
vendor_boot \
vendor_dlkm
# Architecture
TARGET_ARCH := arm64
TARGET_ARCH_VARIANT := armv8-2a
TARGET_CPU_VARIANT := cortex-a55
TARGET_CPU_ABI := arm64-v8a
TARGET_CPU_ABI2 :=
TARGET_CPU_SMP := true
TARGET_2ND_ARCH := arm
TARGET_2ND_ARCH_VARIANT := armv8-2a
TARGET_2ND_CPU_VARIANT := cortex-a55
TARGET_2ND_CPU_ABI := armeabi-v7a
TARGET_2ND_CPU_ABI2 := armeabi
# Bootloader
TARGET_BOOTLOADER_BOARD_NAME := k6835v1_64
# Display
TARGET_SCREEN_DENSITY := 280
# Kernel
TARGET_PREBUILT_KERNEL := $(TARGET_KERNEL_PATH)/kernel
BOARD_KERNEL_CMDLINE := \
bootopt=64S3,32N2,64N2
#BOARD_KERNEL_CMDLINE += \
androidboot.selinux=permissive
BOARD_KERNEL_BASE := 0x40000000
BOARD_KERNEL_OFFSET = 0
BOARD_RAMDISK_OFFSET = 0x26F00000
BOARD_TAGS_OFFSET = 0x07C80000
BOARD_KERNEL_DTB_OFFSET = 0x07C80000
BOARD_KERNEL_PAGESIZE := 4096
BOARD_BOOT_HEADER_VERSION = 4
BOARD_MKBOOTIMG_ARGS := \
--base $(BOARD_KERNEL_BASE) \
--kernel_offset $(BOARD_KERNEL_OFFSET) \
--ramdisk_offset $(BOARD_RAMDISK_OFFSET) \
--tags_offset $(BOARD_TAGS_OFFSET) \
--dtb_offset $(BOARD_KERNEL_DTB_OFFSET) \
--pagesize $(BOARD_KERNEL_PAGESIZE) \
--header_version $(BOARD_BOOT_HEADER_VERSION)
BOARD_RAMDISK_USE_LZ4 := true
# Kernel modules
BOARD_VENDOR_KERNEL_MODULES_LOAD := $(strip $(shell cat $(TARGET_KERNEL_PATH)/vendor_dlkm/modules.load))
BOARD_VENDOR_KERNEL_MODULES := $(wildcard $(TARGET_KERNEL_PATH)/vendor_dlkm/*.ko)
BOARD_VENDOR_RAMDISK_KERNEL_MODULES_LOAD := $(strip $(shell cat $(TARGET_KERNEL_PATH)/vendor_boot/modules.load))
BOARD_VENDOR_RAMDISK_KERNEL_MODULES := $(wildcard $(TARGET_KERNEL_PATH)/vendor_boot/*.ko)
# Device Tree
BOARD_INCLUDE_DTB_IN_BOOTIMG := true
TARGET_NEEDS_DTBOIMAGE := true
BOARD_PREBUILT_DTBIMAGE_DIR := $(TARGET_KERNEL_PATH)
BOARD_PREBUILT_DTBOIMAGE := $(BOARD_PREBUILT_DTBIMAGE_DIR)/dtbo.img
# Init Boot
BOARD_INIT_BOOT_HEADER_VERSION := 4
BOARD_MKBOOTIMG_INIT_ARGS += --header_version $(BOARD_INIT_BOOT_HEADER_VERSION)
# HIDL
DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE := \
$(DEVICE_PATH)/framework_compatibility_matrix.xml
DEVICE_MANIFEST_FILE += $(DEVICE_PATH)/manifest.xml
# Metadata
BOARD_USES_METADATA_PARTITION := true
# Partitions
BOARD_PRODUCTIMAGE_MINIMAL_PARTITION_RESERVED_SIZE := false
-include vendor/lineage/config/BoardConfigReservedSize.mk
BOARD_BOOTIMAGE_PARTITION_SIZE := 67108864
BOARD_DTBOIMG_PARTITION_SIZE := 8388608
BOARD_INIT_BOOT_IMAGE_PARTITION_SIZE := 8388608
BOARD_USERDATAIMAGE_PARTITION_SIZE := 238748139520
BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE := 67108864
BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE := erofs
BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE := erofs
BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE := erofs
BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE := erofs
BOARD_SYSTEM_DLKMIMAGE_FILE_SYSTEM_TYPE := erofs
BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := erofs
BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE := erofs
BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE := f2fs
BOARD_SUPER_PARTITION_GROUPS := mediatek_dynamic_partitions
BOARD_SUPER_PARTITION_SIZE := 9663676416
BOARD_MEDIATEK_DYNAMIC_PARTITIONS_PARTITION_LIST := odm_dlkm product system system_ext system_dlkm vendor vendor_dlkm
BOARD_MEDIATEK_DYNAMIC_PARTITIONS_SIZE := 9661579264
BOARD_FLASH_BLOCK_SIZE := 262144
TARGET_COPY_OUT_ODM := vendor/odm
TARGET_COPY_OUT_ODM_DLKM := odm_dlkm
TARGET_COPY_OUT_PRODUCT := product
TARGET_COPY_OUT_SYSTEM_DLKM := system_dlkm
TARGET_COPY_OUT_SYSTEM_EXT := system_ext
TARGET_COPY_OUT_VENDOR := vendor
TARGET_COPY_OUT_VENDOR_DLKM := vendor_dlkm
# Platform
TARGET_BOARD_PLATFORM := mt6835
# Recovery
TARGET_RECOVERY_FSTAB := $(DEVICE_PATH)/init/fstab.mt6835
TARGET_RECOVERY_PIXEL_FORMAT := RGBX_8888
TARGET_USERIMAGES_USE_EXT4 := true
TARGET_USERIMAGES_USE_F2FS := true
# RIL
ENABLE_VENDOR_RIL_SERVICE := true
# SELinux
BOARD_MTK_SEPOLICY_IS_LEGACY := true
include device/mediatek/sepolicy_vndr/SEPolicy.mk
BOARD_VENDOR_SEPOLICY_DIRS += $(DEVICE_PATH)/sepolicy/vendor
# SPL
VENDOR_SECURITY_PATCH := 2025-04-05
# Verified Boot
BOARD_AVB_ENABLE := true
#BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --flags 3
BOARD_MOVE_GSI_AVB_KEYS_TO_VENDOR_BOOT := true
BOARD_AVB_ALGORITHM := SHA256_RSA2048
ifneq (,$(wildcard $(KEYS_PATH)/brax3-oem.pem))
BOARD_AVB_KEY_PATH := $(KEYS_PATH)/brax3-oem.pem
else
BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --flags 3
BOARD_AVB_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem
endif
BOARD_AVB_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
ifneq (,$(wildcard $(KEYS_PATH)/brax3-boot.pem))
BOARD_AVB_BOOT_KEY_PATH := $(KEYS_PATH)/brax3-boot.pem
else
BOARD_AVB_BOOT_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem
endif
BOARD_AVB_BOOT_ALGORITHM := SHA256_RSA2048
BOARD_AVB_BOOT_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
BOARD_AVB_BOOT_ROLLBACK_INDEX_LOCATION := 3
BOARD_AVB_VBMETA_SYSTEM := system system_dlkm system_ext product
ifneq (,$(wildcard $(KEYS_PATH)/brax3-system.pem))
BOARD_AVB_VBMETA_SYSTEM_KEY_PATH := $(KEYS_PATH)/brax3-system.pem
else
BOARD_AVB_VBMETA_SYSTEM_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem
endif
BOARD_AVB_VBMETA_SYSTEM_ALGORITHM := SHA256_RSA2048
BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX_LOCATION := 2
BOARD_AVB_VBMETA_VENDOR := vendor vendor_dlkm odm_dlkm
ifneq (,$(wildcard $(KEYS_PATH)/brax3-vendor.pem))
BOARD_AVB_VBMETA_VENDOR_KEY_PATH := $(KEYS_PATH)/brax3-vendor.pem
else
BOARD_AVB_VBMETA_VENDOR_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem
endif
BOARD_AVB_VBMETA_VENDOR_ALGORITHM := SHA256_RSA2048
BOARD_AVB_VBMETA_VENDOR_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
BOARD_AVB_VBMETA_VENDOR_ROLLBACK_INDEX_LOCATION := 4
# Wi-Fi
WPA_SUPPLICANT_VERSION := VER_0_8_X
BOARD_HOSTAPD_DRIVER := NL80211
BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_mt66xx
BOARD_WPA_SUPPLICANT_DRIVER := NL80211
BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_mt66xx
WIFI_DRIVER_FW_PATH_PARAM := "/dev/wmtWifi"
WIFI_DRIVER_FW_PATH_STA:="STA"
WIFI_DRIVER_FW_PATH_AP:="AP"
WIFI_DRIVER_FW_PATH_P2P:="P2P"
WIFI_DRIVER_STATE_CTRL_PARAM := "/dev/wmtWifi"
WIFI_DRIVER_STATE_ON := "1"
WIFI_DRIVER_STATE_OFF := "0"
WIFI_HIDL_UNIFIED_SUPPLICANT_SERVICE_RC_ENTRY := true
BOARD_SHIPPING_API_LEVEL := 33
BOARD_VNDK_VERSION := current
TARGET_BRM_PLATFORM := mt6835
VEXT_BRM_PLATFORM := mt6835
# Include the proprietary files BoardConfig.
include vendor/brax/brax3/BoardConfigVendor.mk

2
compatibility_matrix.xml Normal file
View file

@ -0,0 +1,2 @@
<compatibility-matrix version="5.0" type="device" target-level="7">
</compatibility-matrix>

View file

@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8"?>
<audio_effects_conf version="2.0" xmlns="http://schemas.android.com/audio/audio_effects_conf/v2_0">
<!-- List of effect libraries to load.
Each library element must contain a "name" attribute and a "path" attribute giving the
name of a library .so file in /vendor/lib/soundfx on the target
If offloadable effects are present, the AOSP library libeffectproxy.so must be listed as
well as one library for the SW implementation and one library for the DSP implementation:
<library name="proxy" path="libeffectproxy.so"/>
<library name="some_fx_sw" path="lib_some_fx_sw.so"/>
<library name="some_fx_hw" path="lib_some_fx_hw.so"/>
If the audio HAL implements support for AOSP software audio pre-processing effects,
the following library must be added:
<library name="pre_processing" path="libaudiopreprocessing.so"/>
-->
<libraries>
<library name="bundle" path="libbundlewrapper.so"/>
<library name="reverb" path="libreverbwrapper.so"/>
<library name="visualizer" path="libvisualizer.so"/>
<library name="downmix" path="libdownmix.so"/>
<library name="loudness_enhancer" path="libldnhncr.so"/>
<library name="dynamics_processing" path="libdynproc.so"/>
<library name="pre_processing" path="libaudiopreprocessing.so"/>
</libraries>
<!-- list of effects to load.
Each "effect" element must contain a "name", "library" and a "uuid" attribute.
The value of the "library" element must correspond to the name of one library element in
the "libraries" element.
The "name" attribute is indicative, only the value of the "uuid" attribute designates
the effect.
The uuid is the implementation specific UUID as specified by the effect vendor. This is not
the generic effect type UUID.
Offloadable effects are described by an "effectProxy" element which contains one "libsw"
element containing the "uuid" and "library" for the SW implementation and one "libhw"
element containing the "uuid" and "library" for the DSP implementation.
The "uuid" value for the "effectProxy" element must be unique and will override the default
uuid in the AOSP proxy effect implementation.
If the audio HAL implements support for AOSP software audio pre-processing effects,
the following effects can be added:
<effect name="agc" library="pre_processing" uuid="aa8130e0-66fc-11e0-bad0-0002a5d5c51b"/>
<effect name="aec" library="pre_processing" uuid="bb392ec0-8d4d-11e0-a896-0002a5d5c51b"/>
<effect name="ns" library="pre_processing" uuid="c06c8400-8e06-11e0-9cb6-0002a5d5c51b"/>
-->
<effects>
<effect name="bassboost" library="bundle" uuid="8631f300-72e2-11df-b57e-0002a5d5c51b"/>
<effect name="virtualizer" library="bundle" uuid="1d4033c0-8557-11df-9f2d-0002a5d5c51b"/>
<effect name="equalizer" library="bundle" uuid="ce772f20-847d-11df-bb17-0002a5d5c51b"/>
<effect name="volume" library="bundle" uuid="119341a0-8469-11df-81f9-0002a5d5c51b"/>
<effect name="reverb_env_aux" library="reverb" uuid="4a387fc0-8ab3-11df-8bad-0002a5d5c51b"/>
<effect name="reverb_env_ins" library="reverb" uuid="c7a511a0-a3bb-11df-860e-0002a5d5c51b"/>
<effect name="reverb_pre_aux" library="reverb" uuid="f29a1400-a3bb-11df-8ddc-0002a5d5c51b"/>
<effect name="reverb_pre_ins" library="reverb" uuid="172cdf00-a3bc-11df-a72f-0002a5d5c51b"/>
<effect name="visualizer" library="visualizer" uuid="d069d9e0-8329-11df-9168-0002a5d5c51b"/>
<effect name="downmix" library="downmix" uuid="93f04452-e4fe-41cc-91f9-e475b6d1d69f"/>
<effect name="loudness_enhancer" library="loudness_enhancer" uuid="fa415329-2034-4bea-b5dc-5b381c8d1e2c"/>
<effect name="dynamics_processing" library="dynamics_processing" uuid="e0e6539b-1781-7261-676f-6d7573696340"/>
<effect name="agc" library="pre_processing" uuid="aa8130e0-66fc-11e0-bad0-0002a5d5c51b"/>
<effect name="aec" library="pre_processing" uuid="bb392ec0-8d4d-11e0-a896-0002a5d5c51b"/>
<effect name="ns" library="pre_processing" uuid="c06c8400-8e06-11e0-9cb6-0002a5d5c51b"/>
<!-- <effect name="aec" library="pre_processing" uuid="9f35ed76-0b66-4330-8f79-e39ca266dc7c"/> -->
<!-- <effect name="ns" library="pre_processing" uuid="300abe9f-dfc5-4340-9c4b-79ef1be4e651"/> -->
<!-- <effect name="agc" library="pre_processing" uuid="3387eb70-9896-4338-90f5-b2de883864c9"/> -->
</effects>
<!-- Audio pre processor configurations.
The pre processor configuration is described in a "preprocess" element and consists in a
list of elements each describing pre processor settings for a given use case or "stream".
Each stream element has a "type" attribute corresponding to the input source used.
Valid types are:
"mic", "camcorder", "voice_recognition", "voice_communication"
Each "stream" element contains a list of "apply" elements indicating one effect to apply.
The effect to apply is designated by its name in the "effects" elements.
-->
<preprocess>
<stream type="voice_communication">
<apply effect="aec"/>
<apply effect="ns"/>
<apply effect="agc"/>
</stream>
</preprocess>
<!-- Audio post processor configurations.
The post processor configuration is described in a "postprocess" element and consists in a
list of elements each describing post processor settings for a given use case or "stream".
Each stream element has a "type" attribute corresponding to the stream type used.
Valid types are:
"music", "ring", "alarm", "notification", "voice_call"
Each "stream" element contains a list of "apply" elements indicating one effect to apply.
The effect to apply is designated by its name in the "effects" elements.
<postprocess>
<stream type="music">
<apply effect="music_post_proc"/>
</stream>
<stream type="voice_call">
<apply effect="voice_post_proc"/>
</stream>
<stream type="notification">
<apply effect="notification_post_proc"/>
</stream>
</postprocess>
-->
</audio_effects_conf>

View file

@ -0,0 +1,320 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Copyright (C) 2015 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.
-->
<audioPolicyConfiguration version="7.0" xmlns:xi="http://www.w3.org/2001/XInclude">
<!-- version section contains a “version” tag in the form “major.minor” e.g version=”1.0” -->
<!-- Global configuration Decalaration -->
<globalConfiguration speaker_drc_enabled="false" call_screen_mode_supported="true"/>
<!-- Modules section:
There is one section per audio HW module present on the platform.
Each module section will contains two mandatory tags for audio HAL “halVersion” and “name”.
The module names are the same as in current .conf file:
“primary”, “A2DP”, “remote_submix”, “USB”
Each module will contain the following sections:
“devicePorts”: a list of device descriptors for all input and output devices accessible via this
module.
This contains both permanently attached devices and removable devices.
“mixPorts”: listing all output and input streams exposed by the audio HAL
“routes”: list of possible connections between input and output devices or between stream and
devices.
"route": is defined by an attribute:
-"type": <mux|mix> means all sources are mutual exclusive (mux) or can be mixed (mix)
-"sink": the sink involved in this route
-"sources": all the sources than can be connected to the sink via vis route
“attachedDevices”: permanently attached devices.
The attachedDevices section is a list of devices names. The names correspond to device names
defined in <devicePorts> section.
“defaultOutputDevice”: device to be used by default when no policy rule applies
-->
<modules>
<!-- Primary Audio HAL -->
<module name="primary" halVersion="3.0">
<attachedDevices>
<item>Speaker</item>
<item>Earpiece</item>
<item>Built-In Mic</item>
<item>Built-In Back Mic</item>
<item>FM Tuner In</item>
<item>Voice Call In</item>
<item>Echo Ref In</item>
<item>Telephony Tx</item>
</attachedDevices>
<defaultOutputDevice>Speaker</defaultOutputDevice>
<mixPorts>
<mixPort name="primary output" role="source" flags="AUDIO_OUTPUT_FLAG_PRIMARY">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="44100 48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="44100 48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="deep_buffer" role="source" flags="AUDIO_OUTPUT_FLAG_DEEP_BUFFER">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="44100 48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="44100 48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="fast" role="source" flags="AUDIO_OUTPUT_FLAG_FAST">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="44100 48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="44100 48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="voip_rx" role="source" flags="AUDIO_OUTPUT_FLAG_VOIP_RX">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="16000 48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="16000 48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="mmap_no_irq_out" role="source" flags="AUDIO_OUTPUT_FLAG_DIRECT AUDIO_OUTPUT_FLAG_MMAP_NOIRQ">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="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_32_BIT"
samplingRates="44100 48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="44100 48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="hdmi_mix_output" role="source">
</mixPort>
<mixPort name="primary input" role="sink" maxOpenCount="1" maxActiveCount="1">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000 16000 32000 44100 48000"
channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO"/>
</mixPort>
<mixPort name="mmap_no_irq_in" role="sink" flags="AUDIO_INPUT_FLAG_MMAP_NOIRQ">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000 16000 32000 44100 48000"
channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO"/>
</mixPort>
<mixPort name="voice tx" role="sink" maxOpenCount="1" maxActiveCount="1">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000 16000 32000 44100 48000"
channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO"/>
</mixPort>
<mixPort name="FM Tuner input" role="sink" maxOpenCount="1" maxActiveCount="1">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000 16000 32000 44100 48000"
channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO"/>
</mixPort>
<mixPort name="voip_tx" role="sink" flags="AUDIO_INPUT_FLAG_VOIP_TX" maxOpenCount="1" maxActiveCount="1">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000 16000 32000 44100 48000"
channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO"/>
</mixPort>
<mixPort name="fast input" role="sink" flags="AUDIO_INPUT_FLAG_FAST" maxOpenCount="1" maxActiveCount="1">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000 16000 32000 44100 48000"
channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO"/>
</mixPort>
<mixPort name="hifi_playback" role="source"/>
<mixPort name="hifi_input" role="sink"/>
</mixPorts>
<devicePorts>
<!-- Output devices declaration, i.e. Sink DEVICE PORT -->
<devicePort tagName="Earpiece" type="AUDIO_DEVICE_OUT_EARPIECE" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="44100 48000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="44100 48000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
</devicePort>
<devicePort tagName="Speaker" role="sink" type="AUDIO_DEVICE_OUT_SPEAKER">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="44100 48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="44100 48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</devicePort>
<devicePort tagName="Wired Headset" type="AUDIO_DEVICE_OUT_WIRED_HEADSET" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="44100 48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="44100 48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</devicePort>
<devicePort tagName="Wired Headphones" type="AUDIO_DEVICE_OUT_WIRED_HEADPHONE" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="44100 48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="44100 48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</devicePort>
<devicePort tagName="HDMI" type="AUDIO_DEVICE_OUT_AUX_DIGITAL" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="8000 11025 16000 22050 32000 44100 48000 64000 88200 96000 128000 176400 192000"
channelMasks="AUDIO_CHANNEL_OUT_7POINT1"/>
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000 11025 16000 22050 32000 44100 48000 64000 88200 96000 128000 176400 192000"
channelMasks="AUDIO_CHANNEL_OUT_7POINT1"/>
</devicePort>
<devicePort tagName="BT SCO" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000 16000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</devicePort>
<devicePort tagName="BT SCO Headset" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000 16000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</devicePort>
<devicePort tagName="BT SCO Car Kit" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000 16000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</devicePort>
<devicePort tagName="Analog Dock Headset" type="AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="44100 48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="44100 48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</devicePort>
<devicePort tagName="Digital Dock Headset" type="AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="44100 48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="44100 48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</devicePort>
<devicePort tagName="FM Tuner Out" type="AUDIO_DEVICE_OUT_FM" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="44100 48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="44100 48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</devicePort>
<devicePort tagName="Telephony Tx" type="AUDIO_DEVICE_OUT_TELEPHONY_TX" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="44100 48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="44100 48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</devicePort>
<devicePort tagName="USB Device Out" type="AUDIO_DEVICE_OUT_USB_DEVICE" role="sink">
</devicePort>
<devicePort tagName="USB Headset Out" type="AUDIO_DEVICE_OUT_USB_HEADSET" role="sink">
</devicePort>
<devicePort tagName="Built-In Mic" type="AUDIO_DEVICE_IN_BUILTIN_MIC" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000 16000 32000 44100 48000"
channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO"/>
</devicePort>
<devicePort tagName="Built-In Back Mic" type="AUDIO_DEVICE_IN_BACK_MIC" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000 16000 32000 44100 48000"
channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO"/>
</devicePort>
<devicePort tagName="Wired Headset Mic" type="AUDIO_DEVICE_IN_WIRED_HEADSET" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000 16000 32000 44100 48000"
channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO"/>
</devicePort>
<devicePort tagName="BT SCO Headset Mic" type="AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000 16000" channelMasks="AUDIO_CHANNEL_IN_STEREO"/>
</devicePort>
<devicePort tagName="AUX Digital In" type="AUDIO_DEVICE_IN_AUX_DIGITAL" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000 16000 32000 44100 48000"
channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO"/>
</devicePort>
<devicePort tagName="FM Tuner In" type="AUDIO_DEVICE_IN_FM_TUNER" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000 16000 32000 44100 48000"
channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO"/>
</devicePort>
<devicePort tagName="Echo Ref In" type="AUDIO_DEVICE_IN_ECHO_REFERENCE" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000 16000 32000 44100 48000"
channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO"/>
</devicePort>
<devicePort tagName="USB Device In" type="AUDIO_DEVICE_IN_USB_DEVICE" role="source">
</devicePort>
<devicePort tagName="USB Headset In" type="AUDIO_DEVICE_IN_USB_HEADSET" role="source">
</devicePort>
<devicePort tagName="Voice Call In" type="AUDIO_DEVICE_IN_VOICE_CALL" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000 16000 32000 44100 48000"
channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO"/>
<gains>
<gain name="gain_1" mode="AUDIO_GAIN_MODE_JOINT"
minValueMB="-8400"
maxValueMB="4000"
defaultValueMB="0"
stepValueMB="100"/>
</gains>
</devicePort>
</devicePorts>
<!-- route declaration, i.e. list all available sources for a given sink -->
<routes>
<route type="mix" sink="Earpiece"
sources="primary output,deep_buffer,voip_rx,mmap_no_irq_out,fast,Voice Call In"/>
<route type="mix" sink="Speaker"
sources="primary output,deep_buffer,mmap_no_irq_out,fast,FM Tuner In,voip_rx,Voice Call In"/>
<route type="mix" sink="Wired Headset"
sources="primary output,deep_buffer,mmap_no_irq_out,fast,FM Tuner In,voip_rx,Voice Call In"/>
<route type="mix" sink="Wired Headphones"
sources="primary output,deep_buffer,mmap_no_irq_out,fast,FM Tuner In,voip_rx,Voice Call In"/>
<route type="mix" sink="USB Device Out"
sources="primary output,deep_buffer,fast,FM Tuner In,voip_rx,Voice Call In,hifi_playback"/>
<route type="mix" sink="USB Headset Out"
sources="primary output,deep_buffer,fast,FM Tuner In,voip_rx,Voice Call In,hifi_playback"/>
<route type="mix" sink="BT SCO"
sources="primary output,deep_buffer,fast,voip_rx,Voice Call In"/>
<route type="mix" sink="BT SCO Headset"
sources="primary output,deep_buffer,fast,voip_rx,Voice Call In"/>
<route type="mix" sink="BT SCO Car Kit"
sources="primary output,deep_buffer,fast,voip_rx,Voice Call In"/>
<route type="mix" sink="Analog Dock Headset"
sources="primary output"/>
<route type="mix" sink="Digital Dock Headset"
sources="primary output"/>
<route type="mix" sink="FM Tuner Out"
sources="primary output"/>
<route type="mix" sink="HDMI"
sources="hdmi_mix_output"/>
<route type="mix" sink="Telephony Tx"
sources="Built-In Mic,Built-In Back Mic,Wired Headset Mic,BT SCO Headset Mic,USB Device In,USB Headset In,incall_music_uplink"/>
<route type="mix" sink="primary input"
sources="Built-In Mic,Built-In Back Mic,Wired Headset Mic,BT SCO Headset Mic,AUX Digital In,USB Device In,USB Headset In"/>
<route type="mix" sink="mmap_no_irq_in"
sources="Built-In Mic,Built-In Back Mic,Wired Headset Mic"/>
<route type="mix" sink="voice tx"
sources="Voice Call In"/>
<route type="mix" sink="FM Tuner input"
sources="FM Tuner In,Echo Ref In"/>
<route type="mix" sink="hifi_input"
sources="USB Device In,USB Headset In"/>
<route type="mix" sink="voip_tx"
sources="Built-In Mic,Built-In Back Mic,Wired Headset Mic,BT SCO Headset Mic,AUX Digital In,USB Device In,USB Headset In"/>
<route type="mix" sink="fast input"
sources="Built-In Mic,Built-In Back Mic,Wired Headset Mic,BT SCO Headset Mic,AUX Digital In,USB Device In,USB Headset In"/>
</routes>
</module>
<!-- BT Audio HAL -->
<xi:include href="bluetooth_audio_policy_configuration.xml"/>
<!-- Usb Audio HAL -->
<xi:include href="usb_audio_accessory_only_policy_configuration.xml"/>
<!-- Remote Submix Audio HAL -->
<xi:include href="r_submix_audio_policy_configuration.xml"/>
</modules>
<!-- End of Modules section -->
<!-- Volume section -->
<xi:include href="audio_policy_volumes.xml"/>
<xi:include href="default_volume_tables.xml"/>
<!-- End of Volume section -->
</audioPolicyConfiguration>

View file

@ -0,0 +1,161 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright (C) 2014 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.
-->
<MediaCodecs>
<Settings>
<!-- disable TV and telephony domains by default. These must be opted in by OEMs -->
<Domain name="telephony" enabled="false" />
<Domain name="tv" enabled="false" />
<Variant name="slow-cpu" enabled="false" />
</Settings>
<Decoders>
<MediaCodec name="c2.mtk.adpcm-ms.decoder" type="audio/x-adpcm-ms">
<Alias name="OMX.MTK.AUDIO.DECODER.ADPCM.MS" />
<Limit name="channel-count" max="8" />
</MediaCodec>
<MediaCodec name="c2.mtk.adpcm-dvi-ima.decoder" type="audio/x-adpcm-dvi-ima">
<Alias name="OMX.MTK.AUDIO.DECODER.ADPCM.DVI" />
<Limit name="channel-count" max="8" />
</MediaCodec>
<MediaCodec name="c2.mtk.ape.decoder" type="audio/ape">
<Alias name="OMX.MTK.AUDIO.DECODER.APE" />
<Limit name="channel-count" max="2" />
</MediaCodec>
<MediaCodec name="c2.mtk.alac.decoder" type="audio/alac">
<Alias name="OMX.MTK.AUDIO.DECODER.ALAC" />
<Limit name="channel-count" max="8" />
</MediaCodec>
<MediaCodec name="c2.mtk.wma.decoder" type="audio/x-ms-wma">
<Alias name="OMX.MTK.AUDIO.DECODER.WMA" />
<Limit name="channel-count" max="2" />
</MediaCodec>
<MediaCodec name="c2.mtk.mp3.decoder" type="audio/mpeg" rank="5">
<Alias name="OMX.MTK.AUDIO.DECODER.MP3" />
<Limit name="channel-count" max="2" />
<Limit name="sample-rate" ranges="8000,11025,12000,16000,22050,24000,32000,44100,48000" />
<Limit name="bitrate" range="8000-320000" />
</MediaCodec>
<MediaCodec name="c2.mtk.hevc.decoder" type="video/hevc" >
<Alias name="OMX.MTK.VIDEO.DECODER.HEVC" />
<Limit name="size" min="16x16" max="2560x1440" />
<Feature name="adaptive-playback"/>
<Limit name="concurrent-instances" max="15" />
<Limit name="performance-point-1920x1080" value="30" />
</MediaCodec>
<MediaCodec name="c2.mtk.hevc.decoder.secure" type="video/hevc" >
<Alias name="OMX.MTK.VIDEO.DECODER.HEVC.secure" />
<Limit name="size" min="16x16" max="2560x1440" />
<Quirk name="wants-NAL-fragments" />
<Feature name="secure-playback" required="true" />
<Feature name="adaptive-playback"/>
<Limit name="concurrent-instances" max="15" />
<Limit name="performance-point-1920x1080" value="30" />
</MediaCodec>
<MediaCodec name="c2.mtk.mpeg4.decoder" type="video/mp4v-es" >
<Alias name="OMX.MTK.VIDEO.DECODER.MPEG4" />
<Limit name="size" min="16x16" max="2048x1088" />
<Feature name="adaptive-playback"/>
<Limit name="concurrent-instances" max="15" />
<Limit name="performance-point-1920x1080" value="30" />
</MediaCodec>
<MediaCodec name="c2.mtk.h263.decoder" type="video/3gpp" >
<Alias name="OMX.MTK.VIDEO.DECODER.H263" />
<Limit name="size" min="128x96" max="1408x1152" />
<Feature name="adaptive-playback"/>
<Limit name="concurrent-instances" max="15" />
<Limit name="performance-point-1280x720" value="30" />
</MediaCodec>
<MediaCodec name="c2.mtk.avc.decoder" type="video/avc" >
<Alias name="OMX.MTK.VIDEO.DECODER.AVC" />
<Limit name="size" min="64x64" max="2560x1440" />
<Quirk name="wants-NAL-fragments" />
<Feature name="adaptive-playback"/>
<Limit name="concurrent-instances" max="15" />
<Limit name="performance-point-1920x1080" value="30" />
</MediaCodec>
<MediaCodec name="c2.mtk.avc.decoder.secure" type="video/avc" >
<Alias name="OMX.MTK.VIDEO.DECODER.AVC.secure" />
<Limit name="size" min="64x64" max="2560x1440" />
<Quirk name="wants-NAL-fragments" />
<Feature name="secure-playback" required="true" />
<Feature name="adaptive-playback"/>
<Limit name="concurrent-instances" max="15" />
<Limit name="performance-point-1920x1080" value="30" />
</MediaCodec>
<MediaCodec name="c2.mtk.heif.decoder" type="image/vnd.android.heic" >
<Alias name="OMX.MTK.VIDEO.DECODER.HEIF" />
<Limit name="size" min="16x16" max="16383x16383" />
<Feature name="adaptive-playback"/>
<Limit name="concurrent-instances" max="15" />
<Limit name="performance-point-3840x2160" value="30" />
</MediaCodec>
<MediaCodec name="c2.mtk.vp9.decoder" type="video/x-vnd.on2.vp9" >
<Alias name="OMX.MTK.VIDEO.DECODER.VP9" />
<Limit name="size" min="16x16" max="2560x1440" />
<Feature name="adaptive-playback"/>
<Limit name="concurrent-instances" max="15" />
<Limit name="performance-point-1920x1080" value="30" />
</MediaCodec>
<MediaCodec name="c2.mtk.vp9.decoder.secure" type="video/x-vnd.on2.vp9" >
<Alias name="OMX.MTK.VIDEO.DECODER.VP9.secure" />
<Limit name="size" min="16x16" max="2560x1440" />
<Quirk name="wants-NAL-fragments" />
<Feature name="secure-playback" required="true" />
<Feature name="adaptive-playback"/>
<Limit name="concurrent-instances" max="15" />
<Limit name="performance-point-1920x1080" value="30" />
</MediaCodec>
</Decoders>
<Encoders>
<MediaCodec name="c2.mtk.avc.encoder" type="video/avc" >
<Alias name="OMX.MTK.VIDEO.ENCODER.AVC" />
<Limit name="size" min="160x160" max="2560x1440" />
<Limit name="alignment" value="16x16" />
<Limit name="block-size" value="16x16" />
<Limit name="concurrent-instances" max="10" />
<Limit name="performance-point-1920x1080" value="30" />
</MediaCodec>
<MediaCodec name="c2.mtk.avc.encoder.secure" type="video/avc" >
<Limit name="size" min="160x128" max="1920x1088" />
<Limit name="alignment" value="16x16" />
<Limit name="block-size" value="16x16" />
<Limit name="concurrent-instances" max="10" />
<Limit name="performance-point-1920x1088" value="30" />
<Feature name="special-codec" required="true" />
</MediaCodec>
<MediaCodec name="c2.mtk.hevc.encoder" type="video/hevc" >
<Alias name="OMX.MTK.VIDEO.ENCODER.HEVC" />
<Limit name="size" min="160x128" max="2560x1440" />
<Limit name="alignment" value="16x16" />
<Limit name="block-size" value="16x16" />
<Limit name="quality" range="0-100" default="50" />
<Limit name="concurrent-instances" max="10" />
<Feature name="bitrate-modes" value="VBR,CBR,CQ" />
<Limit name="performance-point-1920x1080" value="30" />
</MediaCodec>
<MediaCodec name="c2.mtk.heif.encoder" type="image/vnd.android.heic" >
<Limit name="size" min="160x128" max="16383x16383" />
<Limit name="alignment" value="16x16" />
<Limit name="block-size" value="16x16" />
<Limit name="quality" range="0-100" default="50" />
<Quirk name="requires-allocate-on-input-ports" />
<Quirk name="requires-allocate-on-output-ports" />
<Limit name="concurrent-instances" max="2" />
<Feature name="bitrate-modes" value="VBR,CBR,CQ" />
<Limit name="performance-point-3840x2160" value="30" />
</MediaCodec>
</Encoders>
</MediaCodecs>

View file

@ -0,0 +1,131 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright (C) 2012 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.
-->
<!--
<!DOCTYPE MediaCodecs [
<!ELEMENT MediaCodecs (Decoders,Encoders)>
<!ELEMENT Decoders (MediaCodec*)>
<!ELEMENT Encoders (MediaCodec*)>
<!ELEMENT MediaCodec (Type*,Quirk*)>
<!ATTLIST MediaCodec name CDATA #REQUIRED>
<!ATTLIST MediaCodec type CDATA>
<!ELEMENT Type EMPTY>
<!ATTLIST Type name CDATA #REQUIRED>
<!ELEMENT Quirk EMPTY>
<!ATTLIST Quirk name CDATA #REQUIRED>
]>
There's a simple and a complex syntax to declare the availability of a
media codec:
A codec that properly follows the OpenMax spec and therefore doesn't have any
quirks and that only supports a single content type can be declared like so:
<MediaCodec name="OMX.foo.bar" type="something/interesting" />
If a codec has quirks OR supports multiple content types, the following syntax
can be used:
<MediaCodec name="OMX.foo.bar" >
<Type name="something/interesting" />
<Type name="something/else" />
...
<Quirk name="requires-allocate-on-input-ports" />
<Quirk name="requires-allocate-on-output-ports" />
<Quirk name="output-buffers-are-unreadable" />
</MediaCodec>
Only the three quirks included above are recognized at this point:
"requires-allocate-on-input-ports"
must be advertised if the component does not properly support specification
of input buffers using the OMX_UseBuffer(...) API but instead requires
OMX_AllocateBuffer to be used.
"requires-allocate-on-output-ports"
must be advertised if the component does not properly support specification
of output buffers using the OMX_UseBuffer(...) API but instead requires
OMX_AllocateBuffer to be used.
"output-buffers-are-unreadable"
must be advertised if the emitted output buffers of a decoder component
are not readable, i.e. use a custom format even though abusing one of
the official OMX colorspace constants.
Clients of such decoders will not be able to access the decoded data,
naturally making the component much less useful. The only use for
a component with this quirk is to render the output to the screen.
Audio decoders MUST NOT advertise this quirk.
Video decoders that advertise this quirk must be accompanied by a
corresponding color space converter for thumbnail extraction,
matching surfaceflinger support that can render the custom format to
a texture and possibly other code, so just DON'T USE THIS QUIRK.
2012/07/13 config for MTK OMX Media Codecs, created by Morris Yang (mtk03147)
-->
<MediaCodecs>
<Encoders>
<!-- MTK codec -->
<MediaCodec name="c2.mtk.mpeg4.encoder" type="video/mp4v-es" update="true">
<Limit name="measured-frame-rate-176x144" range="156-343" />
</MediaCodec>
<MediaCodec name="c2.mtk.h263.encoder" type="video/3gpp" update="true">
<Limit name="measured-frame-rate-176x144" range="79-174" />
</MediaCodec>
<MediaCodec name="c2.mtk.avc.encoder" type="video/avc" update="true">
<Limit name="measured-frame-rate-320x240" range="97-214" />
<Limit name="measured-frame-rate-720x480" range="62-137" />
<Limit name="measured-frame-rate-1280x720" range="40-88" />
<Limit name="measured-frame-rate-1920x1080" range="30-66" />
</MediaCodec>
<MediaCodec name="c2.mtk.hevc.encoder" type="video/hevc" update="true">
<Limit name="measured-frame-rate-320x240" range="97-214" />
<Limit name="measured-frame-rate-720x480" range="61-135" />
<Limit name="measured-frame-rate-1280x720" range="41-91" />
</MediaCodec>
</Encoders>
<Decoders>
<!-- MTK codec -->
<MediaCodec name="c2.mtk.mpeg4.decoder" type="video/mp4v-es" update="true">
<Limit name="measured-frame-rate-176x144" range="144-318" />
<Limit name="measured-frame-rate-480x360" range="118-260" />
<Limit name="measured-frame-rate-1280x720" range="61-134" />
</MediaCodec>
<MediaCodec name="c2.mtk.h263.decoder" type="video/3gpp" update="true">
<Limit name="measured-frame-rate-176x144" range="145-320" />
<Limit name="measured-frame-rate-352x288" range="130-286" />
</MediaCodec>
<MediaCodec name="c2.mtk.avc.decoder" type="video/avc" update="true">
<Limit name="measured-frame-rate-320x240" range="158-349" />
<Limit name="measured-frame-rate-720x480" range="156-343" />
<Limit name="measured-frame-rate-1280x720" range="111-244" />
<Limit name="measured-frame-rate-1920x1080" range="69-152" />
</MediaCodec>
<MediaCodec name="c2.mtk.hevc.decoder" type="video/hevc" update="true">
<Limit name="measured-frame-rate-352x288" range="181-398" />
<Limit name="measured-frame-rate-640x360" range="177-391" />
<Limit name="measured-frame-rate-720x480" range="169-372" />
<Limit name="measured-frame-rate-1280x720" range="128-282" />
<Limit name="measured-frame-rate-1920x1080" range="79-174" />
</MediaCodec>
<MediaCodec name="c2.mtk.vp9.decoder" type="video/x-vnd.on2.vp9" update="true">
<Limit name="measured-frame-rate-320x180" range="142-312" />
<Limit name="measured-frame-rate-640x360" range="120-265" />
<Limit name="measured-frame-rate-1280x720" range="76-167" />
<Limit name="measured-frame-rate-1920x1080" range="56-124" />
</MediaCodec>
</Decoders>
</MediaCodecs>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,90 @@
###############################################################################
# Debug options
NFC_DEBUG_ENABLED=0
###############################################################################
# File used for NFA storage
NFA_STORAGE="/data/nfc"
PRESERVE_STORAGE=0x01
###############################################################################
# When screen is turned off, specify the desired power state of the controller.
# 0: power-off-sleep state; DEFAULT
# 1: full-power state
# 2: screen-off card-emulation (CE4/CE3/CE1 modes are used)
SCREEN_OFF_POWER_STATE=1
###############################################################################
# Default poll duration (in ms)
# Default is 500ms if not set (see nfc_target.h)
#NFA_DM_DISC_DURATION_POLL=333
###############################################################################
# Force tag polling for the following technology(s).
# The bits are defined as tNFA_TECHNOLOGY_MASK in nfa_api.h.
# Default is NFA_TECHNOLOGY_MASK_A | NFA_TECHNOLOGY_MASK_B |
# NFA_TECHNOLOGY_MASK_F | NFA_TECHNOLOGY_MASK_ISO15693 |
# NFA_TECHNOLOGY_MASK_B_PRIME | NFA_TECHNOLOGY_MASK_KOVIO |
# NFA_TECHNOLOGY_MASK_A_ACTIVE | NFA_TECHNOLOGY_MASK_F_ACTIVE.
#
# Notable bits:
# NFA_TECHNOLOGY_MASK_A 0x01 /* NFC Technology A */
# NFA_TECHNOLOGY_MASK_B 0x02 /* NFC Technology B */
# NFA_TECHNOLOGY_MASK_F 0x04 /* NFC Technology F */
# NFA_TECHNOLOGY_MASK_ISO15693 0x08 /* Proprietary Technology */
# NFA_TECHNOLOGY_MASK_KOVIO 0x20 /* Proprietary Technology */
# NFA_TECHNOLOGY_MASK_A_ACTIVE 0x40 /* NFC Technology A active mode */
# NFA_TECHNOLOGY_MASK_F_ACTIVE 0x80 /* NFC Technology F active mode */
POLLING_TECH_MASK=0x2F
###############################################################################
# Force P2P to only listen for the following technology(s).
# The bits are defined as tNFA_TECHNOLOGY_MASK in nfa_api.h.
# Default is NFA_TECHNOLOGY_MASK_A | NFA_TECHNOLOGY_MASK_F |
# NFA_TECHNOLOGY_MASK_A_ACTIVE | NFA_TECHNOLOGY_MASK_F_ACTIVE
#
# Notable bits:
# NFA_TECHNOLOGY_MASK_A 0x01 /* NFC Technology A */
# NFA_TECHNOLOGY_MASK_F 0x04 /* NFC Technology F */
# NFA_TECHNOLOGY_MASK_A_ACTIVE 0x40 /* NFC Technology A active mode */
# NFA_TECHNOLOGY_MASK_F_ACTIVE 0x80 /* NFC Technology F active mode */
P2P_LISTEN_TECH_MASK=0x00
###############################################################################
# Force UICC to only listen to the following technology(s).
# The bits are defined as tNFA_TECHNOLOGY_MASK in nfa_api.h.
# Default is NFA_TECHNOLOGY_MASK_A | NFA_TECHNOLOGY_MASK_B | NFA_TECHNOLOGY_MASK_F
UICC_LISTEN_TECH_MASK=0x07
###############################################################################
# Override the stack default for NFA_EE_MAX_EE_SUPPORTED set in nfc_target.h.
# The value is set to 3 by default as it assumes we will discover 0xF2,
# 0xF3, and 0xF4. If a platform will exclude and SE, this value can be reduced
# so that the stack will not wait any longer than necessary.
# Maximum EE supported number
# NXP PN547C2 0x02
# NXP PN65T 0x03
# NXP PN548C2 0x02
# NXP PN66T 0x03
NFA_MAX_EE_SUPPORTED=0x02
###############################################################################
# AID for Empty Select command
# If specified, this AID will be substituted when an Empty SELECT command is
# detected. The first byte is the length of the AID. Maximum length is 16.
AID_FOR_EMPTY_SELECT={08:A0:00:00:01:51:00:00:00}
###############################################################################
# AID_MATCHING constants
# AID_MATCHING_EXACT_ONLY 0x00
# AID_MATCHING_EXACT_OR_PREFIX 0x01
# AID_MATCHING_PREFIX_ONLY 0x02
AID_MATCHING_MODE=0x01
###############################################################################
# NCI_RESET_TYPE options
# Default 0x00, reset configurations everytime.
# 0x01, reset configurations only once every boot.
# 0x02, keep configurations.
NCI_RESET_TYPE=0x00

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<permissions>
<privapp-permissions package="com.mediatek.ims">
<permission name="android.permission.READ_PRECISE_PHONE_STATE"/>
<permission name="android.permission.PACKET_KEEPALIVE_OFFLOAD"/>
<permission name="android.permission.CHANGE_WIFI_STATE"/>
<permission name="android.permission.NETWORK_SIGNAL_STRENGTH_WAKEUP"/>
<permission name="android.permission.MODIFY_PHONE_STATE"/>
<permission name="android.permission.UPDATE_DEVICE_STATS"/>
<permission name="android.permission.READ_PRIVILEGED_PHONE_STATE"/>
<permission name="android.permission.LOCATION_BYPASS"/>
</privapp-permissions>
</permissions>

402
configs/powerhint.json Normal file
View file

@ -0,0 +1,402 @@
{
"Nodes": [
{
"Name": "GPUMinFreq",
"Path": "/sys/devices/platform/soc/13000000.mali/devfreq/13000000.mali/min_freq",
"Values": [
"1100000000",
"1086000000",
"1072000000",
"1058000000",
"1045000000",
"1031000000",
"1017000000",
"1003000000",
"990000000",
"976000000",
"962000000",
"948000000",
"935000000",
"921000000",
"907000000",
"893000000",
"880000000",
"868000000",
"857000000",
"846000000",
"835000000",
"823000000",
"812000000",
"801000000",
"790000000",
"778000000",
"767000000",
"756000000",
"745000000",
"733000000",
"722000000",
"711000000",
"700000000",
"674000000",
"648000000",
"622000000",
"596000000",
"570000000",
"545000000",
"519000000",
"493000000",
"467000000",
"441000000",
"415000000",
"390000000"
],
"ResetOnInit": true
},
{
"Name": "CPULittleClusterMaxFreq",
"Path": "/sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq",
"Values": [
"-1",
"2000000",
"1900000",
"1800000",
"1700000",
"1600000",
"1500000",
"1450000",
"1400000",
"1350000",
"1300000",
"1250000",
"1200000",
"1150000",
"1100000",
"1050000",
"1000000",
"950000",
"900000",
"850000",
"800000",
"750000",
"700000",
"650000"
],
"DefaultIndex": 0,
"ResetOnInit": true
},
{
"Name": "CPULittleClusterMinFreq",
"Path": "/sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq",
"Values": [
"2000000",
"1900000",
"1800000",
"1700000",
"1600000",
"1500000",
"1450000",
"1400000",
"1350000",
"1300000",
"1250000",
"1200000",
"1150000",
"1100000",
"1050000",
"1000000",
"950000",
"900000",
"850000",
"800000",
"750000",
"700000",
"650000",
"-1"
],
"ResetOnInit": true
},
{
"Name": "CPUBigClusterMaxFreq",
"Path": "/sys/devices/system/cpu/cpufreq/policy6/scaling_max_freq",
"Values": [
"-1",
"2400000",
"2300000",
"2200000",
"2100000",
"2000000",
"1900000",
"1800000",
"1700000",
"1600000",
"1500000",
"1400000",
"1300000",
"1200000",
"1100000",
"1000000",
"900000",
"800000",
"700000"
],
"DefaultIndex": 0,
"ResetOnInit": true
},
{
"Name": "CPUBigClusterMinFreq",
"Path": "/sys/devices/system/cpu/cpufreq/policy6/scaling_min_freq",
"Values": [
"2400000",
"2300000",
"2200000",
"2100000",
"2000000",
"1900000",
"1800000",
"1700000",
"1600000",
"1500000",
"1400000",
"1300000",
"1200000",
"1100000",
"1000000",
"900000",
"800000",
"700000",
"-1"
],
"ResetOnInit": true
},
{
"Name": "GPUSchedMode",
"Path": "/sys/devices/platform/soc/13000000.mali/js_ctx_scheduling_mode",
"Values": [
"0",
"1"
],
"DefaultIndex": 0,
"ResetOnInit": true
},
{
"Name": "GPUSchedPeriod",
"Path": "/sys/devices/platform/soc/13000000.mali/js_scheduling_period",
"Values": [
"100",
"75",
"50",
"0"
],
"ResetOnInit": true,
"DefaultIndex": 0
},
{
"Name": "GPUDVFSInterval",
"Path": "/sys/devices/platform/soc/13000000.mali/dvfs_period",
"Values": [
"100",
"75",
"50"
],
"ResetOnInit": true,
"DefaultIndex": 0
},
{
"Name": "FGUclampMin",
"Path": "/dev/cpuctl/foreground/cpu.uclamp.min",
"Values": [
"100",
"0"
],
"ResetOnInit": true
},
{
"Name": "TAUclampMin",
"Path": "/dev/cpuctl/top-app/cpu.uclamp.min",
"Values": [
"100",
"10",
"0"
],
"ResetOnInit": true
},
{
"Name": "CDUclampMin",
"Path": "/dev/cpuctl/camera-daemon/cpu.uclamp.min",
"Values": [
"100",
"0"
],
"ResetOnInit": true
},
// {
// "Name": "SchedBoost",
// "Path": "/proc/perfmgr/boost_ctrl/eas_ctrl/sched_boost",
// "Values": [
// "1",
// "0"
// ],
// "ResetOnInit": true
// },
// {
// "Name": "DoubleTapToWakeEnable",
// "Path": "/sys/touchpanel/double_tap",
// "Values": [
// "1",
// "0"
// ]
// },
{
"Name": "PowerHALAudioState",
"Path": "vendor.powerhal.audio",
"Values": ["AUDIO_STREAMING_LOW_LATENCY", ""],
"Type": "Property"
},
{
"Name": "PowerHALRenderingState",
"Path": "vendor.powerhal.rendering",
"Values": ["EXPENSIVE_RENDERING", ""],
"Type": "Property"
}
],
"Actions": [
{
"PowerHint": "AUDIO_STREAMING_LOW_LATENCY",
"Node": "PowerHALAudioState",
"Duration": 0,
"Value": "AUDIO_STREAMING_LOW_LATENCY"
},
{
"PowerHint": "AUDIO_STREAMING_LOW_LATENCY",
"Node": "CPULittleClusterMinFreq",
"Duration": 0,
"Value": "900000"
},
{
"PowerHint": "AUDIO_STREAMING_LOW_LATENCY",
"Node": "CPUBigClusterMinFreq",
"Duration": 0,
"Value": "900000"
},
{
"PowerHint": "INTERACTION",
"Node": "CPULittleClusterMaxFreq",
"Duration": 0,
"Value": "-1"
},
{
"PowerHint": "INTERACTION",
"Node": "CPULittleClusterMinFreq",
"Duration": 0,
"Value": "1250000"
},
{
"PowerHint": "INTERACTION",
"Node": "CPUBigClusterMaxFreq",
"Duration": 0,
"Value": "-1"
},
{
"PowerHint": "INTERACTION",
"Node": "CPUBigClusterMinFreq",
"Duration": 0,
"Value": "1600000"
},
{
"PowerHint": "INTERACTION",
"Node": "TAUclampMin",
"Duration": 0,
"Value": "10"
},
{
"PowerHint": "LAUNCH",
"Node": "CPUBigClusterMaxFreq",
"Duration": 3000,
"Value": "-1"
},
{
"PowerHint": "LAUNCH",
"Node": "CPUBigClusterMinFreq",
"Duration": 3000,
"Value": "2400000"
},
{
"PowerHint": "LAUNCH",
"Node": "CPULittleClusterMaxFreq",
"Duration": 3000,
"Value": "-1"
},
{
"PowerHint": "LAUNCH",
"Node": "CPULittleClusterMinFreq",
"Duration": 3000,
"Value": "2000000"
},
{
"PowerHint": "LAUNCH",
"Node": "FGUclampMin",
"Duration": 3000,
"Value": "100"
},
{
"PowerHint": "LAUNCH",
"Node": "TAUclampMin",
"Duration": 3000,
"Value": "100"
},
// {
// "PowerHint": "LAUNCH",
// "Node": "DRAMOppMin",
// "Duration": 3000,
// "Value": "1"
// },
// {
// "PowerHint": "LAUNCH",
// "Node": "SchedBoost",
// "Duration": 3000,
// "Value": "1"
// },
{
"PowerHint": "CAMERA_LAUNCH",
"Node": "CDUclampMin",
"Duration": 1000,
"Value": "100"
},
{
"PowerHint": "EXPENSIVE_RENDERING",
"Node": "GPUMinFreq",
"Duration": 0,
"Value": "801000000"
},
{
"PowerHint": "EXPENSIVE_RENDERING",
"Node": "PowerHALRenderingState",
"Duration": 0,
"Value": "EXPENSIVE_RENDERING"
},
{
"PowerHint": "EXPENSIVE_RENDERING",
"Node": "GPUSchedPeriod",
"Duration": 0,
"Value": "100"
},
{
"PowerHint": "EXPENSIVE_RENDERING",
"Node": "GPUDVFSInterval",
"Duration": 0,
"Value": "75"
},
{
"PowerHint": "EXPENSIVE_RENDERING",
"Node": "GPUSchedMode",
"Duration": 0,
"Value": "1"
}
// {
// "PowerHint": "DOUBLE_TAP_TO_WAKE",
// "Node": "DoubleTapToWakeEnable",
// "Duration": 0,
// "Value": "1"
// }
]
}

28
configs/thermal.conf Normal file
View file

@ -0,0 +1,28 @@
[policy_type]
# If permanent= Yes, this policy is still valid after reboot
permanent= No
[LTF]
thermal_zone= soc_max
mode= enabled
[mtk-skin-control]
sensor= ap_ntc
max_target_tj= 85000
min_target_tj= 55000
trip_tpcb= 44000
target_tpcb= 48000
atc_mode= enable
[charger-cooler]
mode= enabled
sensor= ap_ntc
threshold= [44000, 45000, 46500, 56000]
hysteresis= [2000, 2000, 2000, 2000]
current= [1800, 1000, 500, 0]
[thermalhal-threshold]
type= SKIN
sensor= ap_ntc
level= [severe, critical, emergency, shutdown]
threshold= [52000, 56000, 58000, 80000]

View file

@ -0,0 +1,6 @@
p2p_no_group_iface=0
driver_param=use_p2p_group_interface=1
bss_expiration_scan_count=1
wowlan_triggers=disconnect
p2p_search_delay=50
p2p_go_he=1

View file

@ -0,0 +1,16 @@
ctrl_interface=wlan0
update_config=1
manufacturer=MediaTek Inc.
device_name=Wireless Client
model_name=MTK Wireless Model
model_number=1.0
serial_number=2.0
device_type=10-0050F204-5
os_version=01020300
config_methods=display push_button keypad
p2p_no_group_iface=1
driver_param=use_p2p_group_interface=1
hs20=1
pmf=1
wowlan_disconnect_on_deinit=1
sae_pwe=2

View file

@ -0,0 +1,5 @@
p2p_no_group_iface=1
driver_param=use_p2p_group_interface=1
wowlan_triggers=disconnect
p2p_disabled=1
bss_no_flush_when_down=1

327
device.mk Normal file
View file

@ -0,0 +1,327 @@
$(call inherit-product, $(SRC_TARGET_DIR)/product/virtual_ab_ota/launch_with_vendor_ramdisk.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/generic_ramdisk.mk)
SELINUX_IGNORE_NEVERALLOWS := true
# A/B
PRODUCT_PACKAGES += \
com.android.hardware.boot \
android.hardware.boot-service.default_recovery
PRODUCT_PACKAGES += \
create_pl_dev \
create_pl_dev.recovery
PRODUCT_PACKAGES += \
update_engine \
update_engine_sideload \
update_verifier
PRODUCT_PACKAGES_DEBUG += \
update_engine_client
AB_OTA_POSTINSTALL_CONFIG += \
RUN_POSTINSTALL_system=true \
POSTINSTALL_PATH_system=system/bin/otapreopt_script \
FILESYSTEM_TYPE_system=erofs \
POSTINSTALL_OPTIONAL_system=true
AB_OTA_POSTINSTALL_CONFIG += \
RUN_POSTINSTALL_vendor=true \
POSTINSTALL_PATH_vendor=bin/checkpoint_gc \
FILESYSTEM_TYPE_vendor=erofs \
POSTINSTALL_OPTIONAL_vendor=true
PRODUCT_PACKAGES += \
checkpoint_gc \
otapreopt_script
# Audio
PRODUCT_PACKAGES += \
android.hardware.audio@7.1-impl:32 \
android.hardware.audio.effect@7.0-impl:32 \
android.hardware.audio.service
PRODUCT_PACKAGES += \
audio.bluetooth.default:32 \
android.hardware.bluetooth.audio-impl:32
PRODUCT_COPY_FILES += \
$(call find-copy-subdir-files,*,$(LOCAL_PATH)/configs/audio,$(TARGET_COPY_OUT_VENDOR)/etc) \
$(call find-copy-subdir-files,*,$(LOCAL_PATH)/configs/media,$(TARGET_COPY_OUT_VENDOR)/etc)
PRODUCT_COPY_FILES += \
frameworks/av/services/audiopolicy/config/bluetooth_audio_policy_configuration_7_0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/bluetooth_audio_policy_configuration.xml \
frameworks/av/services/audiopolicy/config/r_submix_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/r_submix_audio_policy_configuration.xml
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.audio.low_latency.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.low_latency.xml \
frameworks/native/data/etc/android.software.midi.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.midi.xml
# Bluetooth
PRODUCT_COPY_FILES += \
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.bluetooth.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth.xml
# Boot animation
TARGET_SCREEN_HEIGHT := 1612
TARGET_SCREEN_WIDTH := 720
# Camera
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.camera.concurrent.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.concurrent.xml \
frameworks/native/data/etc/android.hardware.camera.flash-autofocus.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.flash-autofocus.xml \
frameworks/native/data/etc/android.hardware.camera.front.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.front.xml \
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
# Dalvik
$(call inherit-product, frameworks/native/build/phone-xhdpi-4096-dalvik-heap.mk)
# Display
PRODUCT_PACKAGES += \
android.hardware.memtrack-service.mediatek-mali
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.touchscreen.multitouch.jazzhand.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.touchscreen.multitouch.jazzhand.xml
# DRM
PRODUCT_PACKAGES += \
android.hardware.drm-service.clearkey
# Dynamic Partitions
PRODUCT_USE_DYNAMIC_PARTITIONS := true
PRODUCT_PACKAGES += \
fastbootd
# Fingerprint
PRODUCT_PACKAGES += \
android.hardware.biometrics.fingerprint@2.1-service
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.fingerprint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.fingerprint.xml
# FM Radio
PRODUCT_PACKAGES += \
libfmjni-mediatek \
FMRadio
# Gatekeeper
PRODUCT_PACKAGES += \
android.hardware.gatekeeper@1.0-impl \
android.hardware.gatekeeper@1.0-service
# GPS
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.location.gps.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.location.gps.xml
# Graphics
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.opengles.aep.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.opengles.aep.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-1.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.level.xml \
frameworks/native/data/etc/android.hardware.vulkan.version-1_3.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.version-1_3.xml \
frameworks/native/data/etc/android.software.opengles.deqp.level-2022-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.opengles.deqp.level.xml \
frameworks/native/data/etc/android.software.vulkan.deqp.level-2022-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.vulkan.deqp.level.xml
# Health
PRODUCT_PACKAGES += \
android.hardware.health-service.mediatek \
android.hardware.health-service.mediatek-recovery
# IMS
PRODUCT_BOOT_JARS_EXTRA += \
system_ext:mediatek-common \
system_ext:mediatek-framework \
system_ext:mediatek-ims-base \
system_ext:mediatek-ims-common \
system_ext:mediatek-telecom-common \
system_ext:mediatek-telephony-base \
system_ext:mediatek-telephony-common
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/configs/permissions/privapp-permissions-com.mediatek.ims.xml:$(TARGET_COPY_OUT_SYSTEM_EXT)/etc/permissions/privapp-permissions-com.mediatek.ims.xml
# Init
PRODUCT_PACKAGES += \
fstab.mt6835 \
fstab.mt6835.vendor_ramdisk \
init.mt6835.power.rc \
init.connectivity.common.rc \
init.connectivity.rc \
init_connectivity.rc \
init.modem.rc \
init.mt6835.rc \
init.mt6835.rc.vendor_ramdisk \
init.mt6835.usb.rc \
init.mtkgki.rc \
init.project.rc \
init.sensor_2_0.rc \
ueventd.mt6835.rc
PRODUCT_PACKAGES += \
init.cgroup.rc \
#PRODUCT_PACKAGES += \
init.mt6835.power.rc \
# Keymint
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.keystore.app_attest_key.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.keystore.app_attest_key.xml \
frameworks/native/data/etc/android.software.device_id_attestation.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.device_id_attestation.xml
# Light
PRODUCT_PACKAGES += \
android.hardware.light-service.lineage
# Lineage Health
PRODUCT_PACKAGES += \
vendor.lineage.health-service.default
$(call soong_config_set,lineage_health,charging_control_charging_path,/sys/devices/platform/charger/cmd_charge_disable)
$(call soong_config_set,lineage_health,charging_control_charging_enabled,0)
$(call soong_config_set,lineage_health,charging_control_charging_disabled,1)
# NFC
PRODUCT_PACKAGES += \
com.android.nfc_extras \
Tag
# PRODUCT_COPY_FILES += \
# $(call find-copy-subdir-files,*,$(LOCAL_PATH)/configs/nfc,$(TARGET_COPY_OUT_VENDOR)/etc)
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.nfc.hce.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.nfc.hce.xml \
frameworks/native/data/etc/android.hardware.nfc.hcef.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.nfc.hcef.xml \
frameworks/native/data/etc/android.hardware.nfc.uicc.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.nfc.uicc.xml \
frameworks/native/data/etc/android.hardware.nfc.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.nfc.xml
# Overlays
PRODUCT_PACKAGES += \
CarrierConfigResOverlay \
DialerResOverlay \
FrameworksResOverlay \
SettingsProviderResOverlay \
SettingsResOverlay \
SystemUIResOverlay \
TelephonyResOverlay \
TetheringResOverlay \
WifiResOverlay
DEVICE_PACKAGE_OVERLAYS += \
$(LOCAL_PATH)/overlay-lineage
# Power
PRODUCT_PACKAGES += \
android.hardware.power.stats-service.example
# Power
#PRODUCT_PACKAGES += \
android.hardware.power-service.lineage-libperfmgr \
vendor.mediatek.hardware.mtkpower@1.2-service.stub \
libmtkperf_client_vendor \
libmtkperf_client
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/configs/powerhint.json:$(TARGET_COPY_OUT_VENDOR)/etc/powerhint.json
# Properties
include $(LOCAL_PATH)/vendor_logtag.mk
# Recovery
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/init/init.recovery.mt6835.rc:$(TARGET_COPY_OUT_RECOVERY)/root/init.recovery.mt6835.rc
# Secure element
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.se.omapi.ese.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.se.omapi.ese.xml \
frameworks/native/data/etc/android.hardware.se.omapi.sd.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.se.omapi.sd.xml \
frameworks/native/data/etc/android.hardware.se.omapi.uicc.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.se.omapi.uicc.xml
# Sensors
PRODUCT_PACKAGES += \
android.hardware.sensors@2.0-subhal-impl-1.0:64 \
android.hardware.sensors@2.0-service.multihal
PRODUCT_COPY_FILES += \
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.compass.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.compass.xml \
frameworks/native/data/etc/android.hardware.sensor.light.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.light.xml \
frameworks/native/data/etc/android.hardware.sensor.proximity.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.proximity.xml \
frameworks/native/data/etc/android.hardware.sensor.stepcounter.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.stepcounter.xml \
frameworks/native/data/etc/android.hardware.sensor.stepdetector.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.stepdetector.xml
# Shipping API level
PRODUCT_SHIPPING_API_LEVEL := 33
# Soong namespaces
PRODUCT_SOONG_NAMESPACES += \
$(LOCAL_PATH) \
hardware/google/interfaces \
hardware/google/pixel \
hardware/lineage/interfaces/power-libperfmgr \
hardware/mediatek/libmtkperf_client \
hardware/mediatek
# Storage
$(call inherit-product, $(SRC_TARGET_DIR)/product/emulated_storage.mk)
# Symlinks
PRODUCT_PACKAGES += \
nvcfg_mdota.ini_symlink
# Telephony
PRODUCT_PACKAGES += \
OpenEUICC
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.telephony.cdma.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.telephony.cdma.xml \
frameworks/native/data/etc/android.hardware.telephony.euicc.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.telephony.euicc.xml \
frameworks/native/data/etc/android.hardware.telephony.gsm.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.telephony.gsm.xml \
frameworks/native/data/etc/android.hardware.telephony.ims.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.telephony.ims.xml
# Thermal
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/configs/thermal.conf:$(TARGET_COPY_OUT_VENDOR)/etc/thermal/thermal.conf
# USB
PRODUCT_PACKAGES += \
android.hardware.usb-service.mediatek
PRODUCT_COPY_FILES += \
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 \
# Vendor service manager
PRODUCT_PACKAGES += \
vndservicemanager
# Vibrator
PRODUCT_PACKAGES += \
android.hardware.vibrator-service.mediatek
# Verified Boot
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.software.verified_boot.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.verified_boot.xml
# Wi-Fi
PRODUCT_PACKAGES += \
wpa_supplicant \
hostapd \
libwifi-hal-wrapper \
android.hardware.wifi-service
PRODUCT_COPY_FILES += \
$(call find-copy-subdir-files,*,$(LOCAL_PATH)/configs/wifi/,$(TARGET_COPY_OUT_VENDOR)/etc/wifi)
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.passpoint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.passpoint.xml \
frameworks/native/data/etc/android.hardware.wifi.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.xml \
frameworks/native/data/etc/android.software.ipsec_tunnels.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.ipsec_tunnels.xml \
frameworks/native/data/etc/android.software.ipsec_tunnel_migration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.ipsec_tunnel_migration.xml
# Inherit from the proprietary files makefile.
$(call inherit-product, vendor/brax/brax3/brax3-vendor.mk)

144
extract-files.py Executable file
View file

@ -0,0 +1,144 @@
#!/usr/bin/env -S PYTHONPATH=../../../tools/extract-utils python3
#
# SPDX-FileCopyrightText: 2024 The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#
from extract_utils.fixups_blob import (
blob_fixup,
blob_fixups_user_type,
)
from extract_utils.fixups_lib import (
lib_fixup_remove,
lib_fixups,
lib_fixups_user_type,
)
from extract_utils.main import (
ExtractUtils,
ExtractUtilsModule,
)
namespace_imports = [
'hardware/mediatek',
'hardware/mediatek/libmtkperf_client',
'vendor/brax/brax3',
'hardware/mediatek',
]
def lib_fixup_vendor_suffix(lib: str, partition: str, *args, **kwargs):
return f'{lib}_{partition}' if partition == 'vendor' else None
lib_fixups: lib_fixups_user_type = {
**lib_fixups,
(
'android.hardware.security.keymint-V1-ndk',
'vendor.mediatek.hardware.videotelephony@1.0',
'vendor.mediatek.hardware.aee@1.0',
'vendor.mediatek.hardware.aee@1.1',
): lib_fixup_vendor_suffix,
(
'libsink',
): lib_fixup_remove,
}
blob_fixups: blob_fixups_user_type = {
(
'vendor/bin/hs20-osu-client',
'vendor/bin/hw/hostapd',
'vendor/bin/hw/wpa_supplicant',
):blob_fixup()
.replace_needed('libcrypto.so', 'libcrypto-v33.so'),
(
'system_ext/lib64/libcomutils.so',
'system_ext/lib64/libimsma_rtp.so',
'system_ext/lib64/libvcodec_cap.so',
'system_ext/lib64/libimsma_socketwrapper.so',
'system_ext/lib64/libsink.so',
'system_ext/lib64/libmtk_vt_service.so',
'system_ext/lib64/libimsma.so',
'system_ext/lib64/libsignal.so',
'vendor/lib64/libcamera2ndk_vendor.so',
'vendor/lib64/hw/sensors.mediatek.V2.0.so',
'vendor/lib64/libcodec2_mtk_c2store.so',
'vendor/lib64/libcodec2_mtk_vdec.so',
'vendor/lib64/libcodec2_mtk_venc.so',
'vendor/lib64/libcodec2_soft_common.so',
'vendor/lib64/libcodec2_soft_mtk_alacdec.so',
'vendor/lib64/libcodec2_soft_mtk_imaadpcmdec.so',
'vendor/lib64/libcodec2_soft_mtk_mp3dec.so',
'vendor/lib64/libcodec2_soft_mtk_msadpcmdec.so',
'vendor/lib64/libcodec2_vndk.so',
'vendor/lib64/libcodec2_vpp_AIMEMC_plugin.so',
'vendor/lib64/libcodec2_vpp_mi_plugin.so',
'vendor/lib64/libcodec2_vpp_qt_plugin.so',
'vendor/lib64/libcodec2_vpp_rs_plugin.so',
'vendor/lib/libstagefright_softomx.so',
'vendor/lib/libstagefright_softomx_plugin.so',
): blob_fixup()
.replace_needed('libstagefright_foundation.so', 'libstagefright_foundation-v33.so'),
'vendor/bin/hw/android.hardware.media.c2@1.2-mediatek-64b': blob_fixup()
.add_needed('libstagefright_foundation-v33.so'),
(
'vendor/lib64/android.hardware.bluetooth.audio-impl.so',
'vendor/lib64/libbluetooth_audio_session_aidl.so',
): blob_fixup()
.replace_needed('android.hardware.bluetooth.audio-V2-ndk', 'android.hardware.bluetooth.audio-V5-ndk'),
(
'vendor/lib/vendor.mediatek.hardware.bluetooth.audio-V1-ndk.so'
'vendor/lib64/vendor.mediatek.hardware.bluetooth.audio-V1-ndk.so'
): blob_fixup()
.replace_needed('android.media.audio.common-V1-ndk.so', 'android.media.audio.common-V4-ndk.so'),
(
'vendor/bin/mnld',
'vendor/lib64/hw/vendor.mediatek.hardware.pq@2.15-impl.so',
'vendor/lib64/libaalservice.so',
'vendor/lib64/libcam.utils.sensorprovider.so',
): blob_fixup()
.replace_needed('libsensorndkbridge.so', 'android.hardware.sensors@1.0-convert-shared.so'),
'vendor/lib64/libmtkcam_featurepolicy.so': blob_fixup()
.binary_regex_replace(b'\x34\xE8\x87\x40\xB9', b'\x34\x28\x02\x80\x52'),
'vendor/bin/hw/android.hardware.sensors-service.multihal': blob_fixup()
.replace_needed('android.hardware.sensors-V1-ndk.so', 'android.hardware.sensors-V2-ndk.so'),
(
'vendor/lib/vendor.mediatek.hardware.bluetooth.audio-V1-ndk.so',
'vendor/lib64/vendor.mediatek.hardware.bluetooth.audio-V1-ndk.so',
): blob_fixup()
.replace_needed('android.hardware.audio.common-V1-ndk.so', 'android.hardware.audio.common-V4-ndk.so')
.replace_needed('android.hardware.audio.common-V1.so', 'android.hardware.audio.common-V4.so'),
(
'vendor/lib64/vendor.mediatek.hardware.pq_aidl-V1-ndk.so',
): blob_fixup()
.replace_needed('android.hardware.graphics.common-V3-ndk.so', 'android.hardware.graphics.common-V6-ndk.so'),
'vendor/lib64/lib3a.ae.stat.so': blob_fixup()
.add_needed('liblog.so'),
'vendor/bin/hw/android.hardware.security.keymint@2.0-service.trustonic': blob_fixup()
.replace_needed('android.hardware.security.keymint-V2-ndk.so', 'android.hardware.security.keymint-V3-ndk.so')
.add_needed('android.hardware.security.rkp-V3-ndk.so'),
'system_ext/lib64/libsource.so': blob_fixup()
.add_needed('libui_shim.so')
.replace_needed('libstagefright_foundation.so', 'libstagefright_foundation-v33.so'),
(
'vendor/lib/libnvram.so',
'vendor/lib64/libnvram.so',
'vendor/lib64/libsysenv.so',
'vendor/bin/hw/android.hardware.usb-aidl-service.mediatekv1.0',
): blob_fixup()
.add_needed('libbase_shim.so'),
'vendor/lib64/hw/hwcomposer.mtk_common.so' : blob_fixup()
.add_needed('libprocessgroup_shim.so'),
} # fmt: skip
module = ExtractUtilsModule(
'brax3',
'brax',
blob_fixups=blob_fixups,
lib_fixups=lib_fixups,
namespace_imports=namespace_imports,
add_firmware_proprietary_file=True,
)
if __name__ == '__main__':
utils = ExtractUtils.device(module)
utils.run()

View file

@ -0,0 +1,909 @@
<!--
Copyright (C) 2024 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<compatibility-matrix version="4.0" type="framework">
<hal format="hidl" optional="true">
<name>android.hardware.radio</name>
<transport>hwbinder</transport>
<version>1.0-6</version>
<interface>
<name>IRadio</name>
<instance>em1</instance>
<instance>em2</instance>
<instance>em3</instance>
<instance>em4</instance>
<instance>imsAospSlot1</instance>
<instance>imsAospSlot2</instance>
<instance>imsAospSlot3</instance>
<instance>imsAospSlot4</instance>
<instance>se1</instance>
<instance>se2</instance>
<instance>se3</instance>
<instance>se4</instance>
<instance>slot4</instance>
</interface>
<interface>
<name>ISap</name>
<instance>slot2</instance>
<instance>slot3</instance>
<instance>slot4</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.radio.data</name>
<version>1</version>
<interface>
<name>IRadioData</name>
<instance>slot4</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.radio.messaging</name>
<version>1</version>
<interface>
<name>IRadioMessaging</name>
<instance>slot4</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.radio.modem</name>
<version>1</version>
<interface>
<name>IRadioModem</name>
<instance>slot4</instance>
<instance>imsSlot1</instance>
<instance>imsSlot2</instance>
<instance>imsSlot3</instance>
<instance>imsSlot4</instance>
<instance>se1</instance>
<instance>se2</instance>
<instance>se3</instance>
<instance>se4</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.radio.network</name>
<version>1</version>
<interface>
<name>IRadioNetwork</name>
<instance>slot4</instance>
<instance>imsSlot1</instance>
<instance>imsSlot2</instance>
<instance>imsSlot3</instance>
<instance>imsSlot4</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.radio.sim</name>
<version>1</version>
<interface>
<name>IRadioSim</name>
<instance>slot4</instance>
<instance>imsSlot1</instance>
<instance>imsSlot2</instance>
<instance>imsSlot3</instance>
<instance>imsSlot4</instance>
<instance>se1</instance>
<instance>se2</instance>
<instance>se3</instance>
<instance>se4</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.radio.voice</name>
<version>1</version>
<interface>
<name>IRadioVoice</name>
<instance>slot4</instance>
<instance>imsSlot1</instance>
<instance>imsSlot2</instance>
<instance>imsSlot3</instance>
<instance>imsSlot4</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.aee</name>
<transport>hwbinder</transport>
<version>1.0-1</version>
<interface>
<name>IAee</name>
<instance>AEE</instance>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.apmonitor</name>
<transport>hwbinder</transport>
<version>2.0</version>
<interface>
<name>IApmService</name>
<instance>apm_hidl_service</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.apuware.apusys</name>
<transport>hwbinder</transport>
<version>1.0</version>
<version>2.0</version>
<version>2.1</version>
<interface>
<name>INeuronApusys</name>
<instance>default</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>vendor.mediatek.hardware.apuware.apusys</name>
<version>1</version>
<interface>
<name>INeuronApusys</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.apuware.hmp</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IApuwareHmp</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.apuware.utils</name>
<transport>hwbinder</transport>
<version>1.0</version>
<version>2.0</version>
<interface>
<name>IApuwareUtils</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.apuware.xrp</name>
<transport>hwbinder</transport>
<version>1.0</version>
<version>2.0</version>
<interface>
<name>INeuronXrp</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.atci</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IAtcid</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.bluetooth.audio</name>
<transport>hwbinder</transport>
<version>2.1</version>
<version>2.2</version>
<interface>
<name>IBluetoothAudioProvidersFactory</name>
<instance>default</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>vendor.mediatek.hardware.bluetooth.audio</name>
<version>1</version>
<interface>
<name>IBluetoothAudioProviderFactory</name>
<instance>default</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>vendor.mediatek.hardware.camera.aovservice</name>
<version>1</version>
<interface>
<name>IAovService</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.camera.atms</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IATMs</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.camera.bgservice</name>
<transport>hwbinder</transport>
<version>1.0-1</version>
<interface>
<name>IBGService</name>
<instance>internal/0</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.camera.ccap</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>ICCAPControl</name>
<instance>internal/0</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.camera.isphal</name>
<transport>hwbinder</transport>
<version>1.0-1</version>
<interface>
<name>IISPModule</name>
<instance>internal/0</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.camera.postproc</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IPostDevice</name>
<instance>internal/0</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.clientapi</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IClientapi</name>
<instance>clientapi_hal_service</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.composer_ext</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IComposerExt</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.dfps</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IFpsPolicyService</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.dmc</name>
<transport>hwbinder</transport>
<version>1.0-2</version>
<interface>
<name>IDmcService</name>
<instance>dmc_hidl_service</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.dplanner</name>
<transport>hwbinder</transport>
<version>2.0</version>
<interface>
<name>IDPlanner</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.engineermode</name>
<transport>hwbinder</transport>
<version>1.0-3</version>
<interface>
<name>IEmd</name>
<instance>EmHidlServer</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>vendor.mediatek.hardware.engineermode</name>
<version>1</version>
<interface>
<name>IEmds</name>
<instance>default</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>vendor.mediatek.hardware.gnss.batching</name>
<version>1</version>
<interface>
<name>IMtkGnssBatching</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.gpu</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IGraphicExt</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.hdcpwifidisplay</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IHDCPWIFIDisplay</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.hdmi</name>
<transport>hwbinder</transport>
<version>1.0-4</version>
<interface>
<name>IMtkHdmiService</name>
<instance>default</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>vendor.mediatek.hardware.hdmi_aidl</name>
<version>1</version>
<interface>
<name>IMtkHdmiService_AIDL</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.imsa</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IImsa</name>
<instance>imsa</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.interfaces_tc1.mtkradioex_tc1</name>
<transport>hwbinder</transport>
<version>3.0</version>
<interface>
<name>IMtkRadioEx</name>
<instance>mtkAssist1</instance>
<instance>mtkAssist2</instance>
<instance>mtkEm1</instance>
<instance>mtkEm2</instance>
<instance>mtkSe1</instance>
<instance>mtkSe2</instance>
<instance>mtkSlot1</instance>
<instance>mtkSlot2</instance>
<instance>mtkCap1</instance>
<instance>mtkCap2</instance>
<instance>mtkSmartRatSwitch1</instance>
<instance>mtkSmartRatSwitch2</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.keyinstall</name>
<version>1.0</version>
<interface>
<name>IKeyinstall</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.keymanage</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IKeymanage</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.keymaster_attestation</name>
<transport>hwbinder</transport>
<version>1.0-1</version>
<interface>
<name>IKeymasterDevice</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.lbs</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>ILbs</name>
<instance>AgpsDebugInterface</instance>
<instance>AgpsInterface</instance>
<instance>mtk_agps2framework</instance>
<instance>mtk_agpsd2debugService</instance>
<instance>mtk_debugService2agpsd</instance>
<instance>mtk_debugService2mnld</instance>
<instance>mtk_framework2agps</instance>
<instance>mtk_lbs_log_v2s</instance>
<instance>mtk_lppe_socket_agps</instance>
<instance>mtk_lppe_socket_bt</instance>
<instance>mtk_lppe_socket_ipaddr</instance>
<instance>mtk_lppe_socket_lbs</instance>
<instance>mtk_lppe_socket_network</instance>
<instance>mtk_lppe_socket_sensor</instance>
<instance>mtk_lppe_socket_wlan</instance>
<instance>mtk_meta2mnld</instance>
<instance>mtk_mnld2debugService</instance>
<instance>mtk_mnld2mtklogger</instance>
<instance>mtk_mnld2nlputils</instance>
<instance>mtk_mtklogger2mnld</instance>
<instance>mtk_jam2mnl</instance>
<instance>mtk_mnl2jam</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.log</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>ILog</name>
<instance>ATMWiFiHidlServer</instance>
<instance>ConnsysFWHidlServer</instance>
<instance>MobileLogHidlServer</instance>
<instance>ModemLogHidlServer</instance>
<instance>LoggerHidlServer</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.mdmonitor</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IMDMonitorService</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.mmagent</name>
<transport>hwbinder</transport>
<version>1.0-1</version>
<interface>
<name>IMMAgent</name>
<instance>default</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>vendor.mediatek.hardware.mmlpq</name>
<version>2</version>
<interface>
<name>IMmlpq</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.mms</name>
<transport>hwbinder</transport>
<version>1.0-7</version>
<interface>
<name>IMms</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.mtkcodecservice</name>
<transport>hwbinder</transport>
<version>1.0-1</version>
<interface>
<name>IMtkCodecService</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.mtkpower</name>
<transport>hwbinder</transport>
<version>1.0-2</version>
<interface>
<name>IMtkPerf</name>
<instance>default</instance>
</interface>
<interface>
<name>IMtkPower</name>
<instance>default</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>vendor.mediatek.hardware.mtkpower_applist</name>
<version>1</version>
<interface>
<name>IMtkpower_applist</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.mtkradioex</name>
<transport>hwbinder</transport>
<version>2.0-5</version>
<interface>
<name>IMtkRadioEx</name>
<instance>imsSlot1</instance>
<instance>imsSlot2</instance>
<instance>imsSlot3</instance>
<instance>imsSlot4</instance>
<instance>mtkAssist1</instance>
<instance>mtkAssist2</instance>
<instance>mtkAssist3</instance>
<instance>mtkAssist4</instance>
<instance>mtkCap1</instance>
<instance>mtkCap2</instance>
<instance>mtkCap3</instance>
<instance>mtkCap4</instance>
<instance>mtkEm1</instance>
<instance>mtkEm2</instance>
<instance>mtkEm3</instance>
<instance>mtkEm4</instance>
<instance>mtkRcs1</instance>
<instance>mtkRcs2</instance>
<instance>mtkRcs3</instance>
<instance>mtkRcs4</instance>
<instance>mtkSe1</instance>
<instance>mtkSe2</instance>
<instance>mtkSe3</instance>
<instance>mtkSe4</instance>
<instance>mtkSlot1</instance>
<instance>mtkSlot2</instance>
<instance>mtkSlot3</instance>
<instance>mtkSlot4</instance>
<instance>mtkSmartRatSwitch1</instance>
<instance>mtkSmartRatSwitch2</instance>
<instance>mtkSmartRatSwitch3</instance>
<instance>mtkSmartRatSwitch4</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.mtkradioex</name>
<transport>hwbinder</transport>
<version>3.0</version>
<interface>
<name>IMtkRadioEx</name>
<instance>imsSlot1</instance>
<instance>imsSlot2</instance>
<instance>imsSlot3</instance>
<instance>imsSlot4</instance>
<instance>mtkAssist1</instance>
<instance>mtkAssist2</instance>
<instance>mtkAssist3</instance>
<instance>mtkAssist4</instance>
<instance>mtkCap1</instance>
<instance>mtkCap2</instance>
<instance>mtkCap3</instance>
<instance>mtkCap4</instance>
<instance>mtkEm1</instance>
<instance>mtkEm2</instance>
<instance>mtkEm3</instance>
<instance>mtkEm4</instance>
<instance>mtkRcs1</instance>
<instance>mtkRcs2</instance>
<instance>mtkRcs3</instance>
<instance>mtkRcs4</instance>
<instance>mtkSe1</instance>
<instance>mtkSe2</instance>
<instance>mtkSe3</instance>
<instance>mtkSe4</instance>
<instance>mtkSlot1</instance>
<instance>mtkSlot2</instance>
<instance>mtkSlot3</instance>
<instance>mtkSlot4</instance>
<instance>mtkSmartRatSwitch1</instance>
<instance>mtkSmartRatSwitch2</instance>
<instance>mtkSmartRatSwitch3</instance>
<instance>mtkSmartRatSwitch4</instance>
<instance>mtkRsu1</instance>
<instance>mtkRsu2</instance>
<instance>mtkRsu3</instance>
<instance>mtkRsu4</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>vendor.mediatek.hardware.mtkradioex.data</name>
<version>1</version>
<interface>
<name>IMtkRadioExData</name>
<instance>slot1</instance>
<instance>slot2</instance>
<instance>slot3</instance>
<instance>slot4</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>vendor.mediatek.hardware.mtkradioex.ims</name>
<version>1</version>
<interface>
<name>IMtkRadioExIms</name>
<instance>slot1</instance>
<instance>slot2</instance>
<instance>slot3</instance>
<instance>slot4</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>vendor.mediatek.hardware.mtkradioex.messaging</name>
<version>1</version>
<interface>
<name>IMtkRadioExMessaging</name>
<instance>slot1</instance>
<instance>slot2</instance>
<instance>slot3</instance>
<instance>slot4</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>vendor.mediatek.hardware.mtkradioex.modem</name>
<version>1</version>
<interface>
<name>IMtkRadioExModem</name>
<instance>slot1</instance>
<instance>slot2</instance>
<instance>slot3</instance>
<instance>slot4</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>vendor.mediatek.hardware.mtkradioex.network</name>
<version>1</version>
<interface>
<name>IMtkRadioExNetwork</name>
<instance>slot1</instance>
<instance>slot2</instance>
<instance>slot3</instance>
<instance>slot4</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>vendor.mediatek.hardware.mtkradioex.rcs</name>
<version>1</version>
<interface>
<name>IMtkRadioExRcs</name>
<instance>slot1</instance>
<instance>slot2</instance>
<instance>slot3</instance>
<instance>slot4</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>vendor.mediatek.hardware.mtkradioex.sim</name>
<version>1</version>
<interface>
<name>IMtkRadioExSim</name>
<instance>slot1</instance>
<instance>slot2</instance>
<instance>slot3</instance>
<instance>slot4</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>vendor.mediatek.hardware.mtkradioex.voice</name>
<version>1</version>
<interface>
<name>IMtkRadioExVoice</name>
<instance>slot1</instance>
<instance>slot2</instance>
<instance>slot3</instance>
<instance>slot4</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.netdagent</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>INetdagent</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.neuropilot.agent</name>
<transport>hwbinder</transport>
<version>1.0-2</version>
<interface>
<name>IAgent</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.nvram</name>
<transport>hwbinder</transport>
<version>1.0-1</version>
<interface>
<name>INvram</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.nwk_opt</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>INwkOpt</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.power</name>
<transport>hwbinder</transport>
<version>2.0-1</version>
<interface>
<name>IPower</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.pplagent</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IPplAgent</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.pq</name>
<transport>hwbinder</transport>
<version>2.0-15</version>
<interface>
<name>IPictureQuality</name>
<instance>default</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>vendor.mediatek.hardware.pq_aidl</name>
<version>1</version>
<interface>
<name>IPictureQuality_AIDL</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.presence</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IPresence</name>
<instance>presence_hal_service</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.radio_op</name>
<transport>hwbinder</transport>
<version>2.0</version>
<version>3.0</version>
<interface>
<name>IRadioOp</name>
<instance>slot1</instance>
<instance>slot2</instance>
<instance>slot3</instance>
<instance>slot4</instance>
<instance>OpImsRILd1</instance>
<instance>OpImsRILd2</instance>
<instance>OpImsRILd3</instance>
<instance>OpImsRILd4</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.rcs</name>
<transport>hwbinder</transport>
<version>2.0</version>
<interface>
<name>IRcs</name>
<instance>rcs_hal_service</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.thp</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>ITHP</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.touchll</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>ITouchll</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.videotelephony</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IVideoTelephony</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.vpu</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>Ivpu</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.wfo</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IWifiOffload</name>
<instance>wfo_hidl_service</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.wifi.supplicant</name>
<transport>hwbinder</transport>
<version>2.0</version>
<interface>
<name>ISupplicant</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.mediatek.hardware.wifi.supplicant</name>
<transport>hwbinder</transport>
<version>2.0-2</version>
<interface>
<name>ISupplicant</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.microtrust.hardware.soter</name>
<version>1.0</version>
<interface>
<name>ISoter</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.microtrust.hardware.thh</name>
<version>2.0</version>
<interface>
<name>IThhDevice</name>
<instance>default</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>vendor.nxp.nxpnfc_aidl</name>
<version>1</version>
<interface>
<name>INxpNfc</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.trustonic.tee</name>
<version>1.0-1</version>
<interface>
<name>ITee</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
<name>vendor.trustonic.tee.tui</name>
<version>1.0</version>
<interface>
<name>ITui</name>
<instance>default</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>vendor.lineage.health</name>
<version>1</version>
<interface>
<name>IChargingControl</name>
<instance>default</instance>
</interface>
</hal>
</compatibility-matrix>

96
init/Android.bp Normal file
View file

@ -0,0 +1,96 @@
//
// SPDX-FileCopyrightText: 2024 The LineageOS Project
// SPDX-License-Identifier: Apache-2.0
//
prebuilt_etc {
name: "fstab.mt6835",
src: "fstab.mt6835",
vendor: true,
vendor_ramdisk_available: true,
}
prebuilt_etc {
name: "init.cgroup.rc",
src: "init.cgroup.rc",
sub_dir: "init/hw",
vendor: true,
}
prebuilt_etc {
name: "init.mt6835.power.rc",
src: "init.mt6835.power.rc",
sub_dir: "init/hw",
vendor: true,
}
prebuilt_etc {
name: "init.connectivity.common.rc",
src: "init.connectivity.common.rc",
sub_dir: "init/hw",
vendor: true,
}
prebuilt_etc {
name: "init.connectivity.rc",
src: "init.connectivity.rc",
sub_dir: "init/hw",
vendor: true,
}
prebuilt_etc {
name: "init_connectivity.rc",
src: "init_connectivity.rc",
sub_dir: "init/hw",
vendor: true,
}
prebuilt_etc {
name: "init.modem.rc",
src: "init.modem.rc",
sub_dir: "init/hw",
vendor: true,
}
prebuilt_etc {
name: "init.mt6835.rc",
src: "init.mt6835.rc",
sub_dir: "init/hw",
vendor: true,
vendor_ramdisk_available: true,
}
prebuilt_etc {
name: "init.mt6835.usb.rc",
src: "init.mt6835.usb.rc",
sub_dir: "init/hw",
vendor: true,
}
prebuilt_etc {
name: "init.mtkgki.rc",
src: "init.mtkgki.rc",
sub_dir: "init/hw",
vendor: true,
}
prebuilt_etc {
name: "init.project.rc",
src: "init.project.rc",
sub_dir: "init/hw",
vendor: true,
}
prebuilt_etc {
name: "init.sensor_2_0.rc",
src: "init.sensor_2_0.rc",
sub_dir: "init/hw",
vendor: true,
}
prebuilt_etc {
name: "ueventd.mt6835.rc",
filename: "ueventd.rc",
src: "ueventd.rc",
vendor: true,
}

101
init/fstab.mt6835 Normal file
View file

@ -0,0 +1,101 @@
/dev/block/by-name/vbmeta /vbmeta emmc defaults slotselect,first_stage_mount
/dev/block/by-name/vbmeta_system /vbmeta_system emmc defaults first_stage_mount,nofail,slotselect,avb=vbmeta
/dev/block/by-name/vbmeta_vendor /vbmeta_vendor emmc defaults first_stage_mount,nofail,slotselect
system /system erofs ro wait,slotselect,logical,first_stage_mount,avb_keys=/avb/q-gsi.avbpubkey:/avb/r-gsi.avbpubkey:/avb/s-gsi.avbpubkey
system_dlkm /system_dlkm erofs ro wait,slotselect,logical,first_stage_mount
system_ext /system_ext erofs ro wait,slotselect,logical,first_stage_mount
product /product erofs ro wait,slotselect,logical,first_stage_mount
vendor /vendor erofs ro wait,slotselect,logical,first_stage_mount
vendor_dlkm /vendor_dlkm erofs ro wait,slotselect,logical,first_stage_mount
odm_dlkm /odm_dlkm erofs ro wait,slotselect,logical,first_stage_mount
/dev/block/by-name/boot /boot emmc defaults slotselect,first_stage_mount
/dev/block/by-name/init_boot /init_boot emmc defaults slotselect,first_stage_mount
/dev/block/by-name/vendor_boot /vendor_boot emmc defaults slotselect,first_stage_mount
/dev/block/by-name/dtbo /dtbo emmc defaults slotselect,first_stage_mount
/dev/block/by-name/metadata /metadata f2fs noatime,nosuid,nodev,discard wait,check,formattable,first_stage_mount
/dev/block/by-name/userdata /data f2fs noatime,nosuid,nodev,discard,noflush_merge,fsync_mode=nobarrier,reserve_root=134217,resgid=1065,inlinecrypt wait,check,formattable,quota,latemount,reservedsize=128m,checkpoint=fs,fileencryption=aes-256-xts:aes-256-cts:v2+inlinecrypt_optimized,keydirectory=/metadata/vold/metadata_encryption
/dev/block/by-name/protect1 /mnt/vendor/protect_f ext4 noatime,nosuid,nodev,noauto_da_alloc,commit=1,nodelalloc wait,check,formattable
/dev/block/by-name/protect2 /mnt/vendor/protect_s ext4 noatime,nosuid,nodev,noauto_da_alloc,commit=1,nodelalloc wait,check,formattable
/dev/block/by-name/nvdata /mnt/vendor/nvdata ext4 noatime,nosuid,nodev,noauto_da_alloc,commit=1,nodelalloc wait,check,formattable
/dev/block/by-name/nvcfg /mnt/vendor/nvcfg ext4 noatime,nosuid,nodev,noauto_da_alloc,commit=1,nodelalloc wait,check,formattable
/dev/block/by-name/persist /mnt/vendor/persist ext4 noatime,nosuid,nodev,noauto_da_alloc,commit=1,nodelalloc wait,check,formattable
/devices/platform/soc/11240000.mmc* auto auto defaults voldmanaged=sdcard1:auto,encryptable=userdata
/devices/platform/usb_xhci* auto vfat defaults voldmanaged=usbotg:auto
/devices/platform/soc/11201000.usb0/11200000.xhci* auto vfat defaults voldmanaged=usbotg:auto
/dev/block/by-name/frp /persistent emmc defaults defaults
/dev/block/by-name/nvram /nvram emmc defaults defaults
/dev/block/by-name/proinfo /proinfo emmc defaults defaults
/dev/block/by-name/lk1 /lk1 emmc defaults defaults
/dev/block/by-name/bootloader2 /bootloader2 emmc defaults defaults
/dev/block/by-name/para /para emmc defaults defaults
/dev/block/by-name/misc /misc emmc defaults defaults
/dev/block/by-name/logo /logo emmc defaults defaults
/dev/block/by-name/expdb /expdb emmc defaults defaults
/dev/block/by-name/seccfg /seccfg emmc defaults defaults
/dev/block/by-name/tee1 /tee1 emmc defaults defaults
/dev/block/by-name/tee2 /tee2 emmc defaults defaults
/dev/block/by-name/scp1 /scp1 emmc defaults defaults
/dev/block/by-name/scp2 /scp2 emmc defaults defaults
/dev/block/by-name/sspm1 /sspm1 emmc defaults defaults
/dev/block/by-name/sspm2 /sspm2 emmc defaults defaults
/dev/block/by-name/dpm1 /dpm1 emmc defaults defaults
/dev/block/by-name/dpm2 /dpm2 emmc defaults defaults
/dev/block/by-name/mcupm1 /mcupm1 emmc defaults defaults
/dev/block/by-name/mcupm2 /mcupm2 emmc defaults defaults
/dev/block/by-name/md1img /md1img emmc defaults defaults
/dev/block/by-name/md1dsp /md1dsp emmc defaults defaults
/dev/block/by-name/md1arm7 /md1arm7 emmc defaults defaults
/dev/block/by-name/md3img /md3img emmc defaults defaults
/dev/block/by-name/gz1 /gz1 emmc defaults defaults
/dev/block/by-name/gz2 /gz2 emmc defaults defaults
/dev/block/by-name/ccu /ccu emmc defaults defaults
/dev/block/by-name/vcp /vcp emmc defaults defaults
/dev/block/by-name/gpueb /gpueb emmc defaults defaults
/dev/block/by-name/mcf_ota /mcf_ota emmc defaults defaults
/dev/block/by-name/mvpu_algo1 /mvpu_algo1 emmc defaults defaults
/dev/block/by-name/mvpu_algo2 /mvpu_algo2 emmc defaults defaults
/dev/block/by-name/apusys1 /apusys1 emmc defaults defaults
/dev/block/by-name/apusys2 /apusys2 emmc defaults defaults
/dev/block/by-name/spmfw /spmfw emmc defaults defaults
/dev/block/by-name/pi_img /pi_img emmc defaults defaults
/dev/block/by-name/boot_para /boot_para emmc defaults defaults
/dev/block/by-name/odmdtbo /odmdtbo emmc defaults defaults
/dev/block/by-name/connsys_wifi /connsys_wifi emmc defaults defaults
/dev/block/by-name/connsys_bt /connsys_bt emmc defaults defaults
/dev/block/by-name/otp /otp emmc defaults defaults

48
init/init.cgroup.rc Normal file
View file

@ -0,0 +1,48 @@
on early-init
# boot perf. tune
write /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq 2000000
write /sys/devices/system/cpu/cpufreq/policy6/scaling_min_freq 2200000
write /sys/class/devfreq/mtk-dvfsrc-devfreq/userspace/set_freq 5500000000
on charger
write /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq 0
write /sys/devices/system/cpu/cpufreq/policy6/scaling_min_freq 0
write /sys/class/devfreq/mtk-dvfsrc-devfreq/userspace/set_freq 0
on post-fs-data
write /sys/devices/system/cpu/cpufreq/policy0/scaling_governor sugov_ext
write /sys/devices/system/cpu/cpufreq/policy6/scaling_governor sugov_ext
write /proc/sys/kernel/sched_pelt_multiplier 4
write /proc/sys/kernel/sched_util_clamp_min_rt_default 0
on boot
# boot perf. tune
write /dev/cpuctl/system/cpu.uclamp.min 100
write /dev/cpuctl/system/cpu.uclamp.latency_sensitive 1
write /dev/cpuctl/system-background/cpu.uclamp.min 100
write /dev/cpuctl/system-background/cpu.uclamp.latency_sensitive 1
write /dev/cpuctl/foreground/cpu.uclamp.min 100
write /dev/cpuctl/foreground/cpu.uclamp.latency_sensitive 1
write /dev/cpuctl/top-app/cpu.uclamp.min 100
write /dev/cpuctl/top-app/cpu.uclamp.latency_sensitive 1
write /dev/cpuctl/background/cpu.uclamp.min 100
write /dev/cpuctl/background/cpu.uclamp.latency_sensitive 1
on property:sys.boot_completed=1
write /proc/sys/kernel/sched_migration_cost_ns 200000
# restore boot perf. tune
write /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq 0
write /sys/devices/system/cpu/cpufreq/policy6/scaling_min_freq 0
write /sys/class/devfreq/mtk-dvfsrc-devfreq/userspace/set_freq 0
write /dev/cpuctl/system/cpu.uclamp.min 0
write /dev/cpuctl/system/cpu.uclamp.latency_sensitive 0
write /dev/cpuctl/system-background/cpu.uclamp.min 0
write /dev/cpuctl/system-background/cpu.uclamp.latency_sensitive 0
write /dev/cpuctl/foreground/cpu.uclamp.min 0
write /dev/cpuctl/foreground/cpu.uclamp.latency_sensitive 0
write /dev/cpuctl/top-app/cpu.uclamp.min 0
write /dev/cpuctl/top-app/cpu.uclamp.latency_sensitive 0
write /dev/cpuctl/background/cpu.uclamp.min 0
write /dev/cpuctl/background/cpu.uclamp.latency_sensitive 0

View file

@ -0,0 +1,83 @@
# MTK connectivity .rc configure
on post-fs-data
#
# Connectivity related device nodes & configuration (begin)
#
#/dev/ttyMT2 for Connectivity BT/FM/GPS usage
chmod 0660 /dev/ttyMT2
chown system system /dev/ttyMT2
#/dev/ttyMT1 for GPS 3337 usage
chmod 0660 /dev/ttyMT1
chown system system /dev/ttyMT1
# GPS
mkdir /data/vendor/gps 0770 gps system
mkdir /data/vendor/log 0770 gps system
mkdir /data/vendor/log/gps 0770 gps system
# GPS EMI
chmod 0660 /dev/gps_emi
# WiFi
mkdir /data/vendor/wifi 0770 wifi wifi
mkdir /data/vendor/wifi/wpa 0770 wifi wifi
mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi
# BT relayer mode used VCOM
chown bluetooth bluetooth /dev/ttyGS2
chmod 0660 /dev/ttyGS2
#
# Connectivity related device nodes & configuration (end)
#
on boot
#
# Connectivity related services (Begin)
#
# GPS
service mnld /vendor/bin/mnld
class main
user gps
capabilities WAKE_ALARM
group gps inet misc sdcard_rw sdcard_r media_rw system radio wakelock
socket mnld stream 660 gps system
# GPS Debug Process
service lbs_dbg /system/bin/lbs_dbg
class main
user shell
group log system gps inet misc sdcard_rw sdcard_r media_rw radio
socket lbs_dbg stream 660 gps system
on property:persist.vendor.em.dy.debug=1
stop lbs_dbg
#service BGW /vendor/bin/BGW
# user system
# group gps system radio
# class main
# Wlan
#service wpa_supplicant /vendor/bin/hw/wpa_supplicant \
# -g@android:wpa_wlan0
# interface android.hardware.wifi.supplicant@1.0::ISupplicant default
# interface android.hardware.wifi.supplicant@1.1::ISupplicant default
# interface android.hardware.wifi.supplicant@1.2::ISupplicant default
# interface android.hardware.wifi.supplicant@1.3::ISupplicant default
# socket wpa_wlan0 dgram 660 wifi wifi
# class main
# disabled
# oneshot
#
# Connectivity related services (End)
#

View file

@ -0,0 +1,4 @@
# MTK connectivity .rc configure
import /vendor/etc/init/hw/init_connectivity.rc
import /vendor/etc/init/hw/init.connectivity.common.rc

42
init/init.modem.rc Normal file
View file

@ -0,0 +1,42 @@
# Copyright (C) 2012 The Android Open Source Project
#
# IMPORTANT: Do not create world writable files or directories.
# This is a common source of Android security bugs.
#
on early-init
write /sys/class/net/ccmni0/queues/rx-0/rps_cpus "0D"
write /sys/class/net/ccmni1/queues/rx-0/rps_cpus "0D"
write /sys/class/net/ccmni2/queues/rx-0/rps_cpus "0D"
write /sys/class/net/ccmni3/queues/rx-0/rps_cpus "0D"
write /sys/class/net/ccmni4/queues/rx-0/rps_cpus "0D"
write /sys/class/net/ccmni5/queues/rx-0/rps_cpus "0D"
write /sys/class/net/ccmni6/queues/rx-0/rps_cpus "0D"
write /sys/class/net/ccmni7/queues/rx-0/rps_cpus "0D"
write /sys/class/net/ccmni9/queues/rx-0/rps_cpus "0D"
write /sys/class/net/ccmni10/queues/rx-0/rps_cpus "0D"
write /sys/class/net/ccmni11/queues/rx-0/rps_cpus "0D"
write /sys/class/net/ccmni12/queues/rx-0/rps_cpus "0D"
write /sys/class/net/ccmni13/queues/rx-0/rps_cpus "0D"
write /sys/class/net/ccmni14/queues/rx-0/rps_cpus "0D"
write /sys/class/net/ccmni15/queues/rx-0/rps_cpus "0D"
write /sys/class/net/ccmni16/queues/rx-0/rps_cpus "0D"
write /sys/class/net/ccmni17/queues/rx-0/rps_cpus "0D"
write /sys/class/net/ccmni18/queues/rx-0/rps_cpus "0D"
write /sys/class/net/ccmni19/queues/rx-0/rps_cpus "0D"
write /sys/class/net/ccmni20/queues/rx-0/rps_cpus "0D"
write /proc/sys/net/core/netdev_max_backlog 50000
write /proc/sys/net/ipv4/ipfrag_high_thresh 20971520
#setprop ro.vendor.net.upload.mark.default blocking #prize - del by liunao for antutu use network
on post-fs-data
write /proc/bootprof "post-fs-data: on modem start"
# Encrypt phone function
setprop vold.post_fs_data_done 1

60
init/init.mt6835.power.rc Normal file
View file

@ -0,0 +1,60 @@
on early-init
# boot perf. tune
write /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq 2000000
write /sys/devices/system/cpu/cpufreq/policy6/scaling_min_freq 2200000
write /sys/class/devfreq/mtk-dvfsrc-devfreq/userspace/set_freq 5500000000
on charger
write /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq 0
write /sys/devices/system/cpu/cpufreq/policy6/scaling_min_freq 0
write /sys/class/devfreq/mtk-dvfsrc-devfreq/userspace/set_freq 0
on post-fs-data
write /sys/devices/system/cpu/cpufreq/policy0/scaling_governor sugov_ext
write /sys/devices/system/cpu/cpufreq/policy6/scaling_governor sugov_ext
write /proc/sys/kernel/sched_pelt_multiplier 4
write /proc/sys/kernel/sched_util_clamp_min_rt_default 0
on boot
# boot perf. tune
write /dev/cpuctl/system/cpu.uclamp.min 100
write /dev/cpuctl/system/cpu.uclamp.latency_sensitive 1
write /dev/cpuctl/system-background/cpu.uclamp.min 100
write /dev/cpuctl/system-background/cpu.uclamp.latency_sensitive 1
write /dev/cpuctl/foreground/cpu.uclamp.min 100
write /dev/cpuctl/foreground/cpu.uclamp.latency_sensitive 1
write /dev/cpuctl/top-app/cpu.uclamp.min 100
write /dev/cpuctl/top-app/cpu.uclamp.latency_sensitive 1
write /dev/cpuctl/background/cpu.uclamp.min 100
write /dev/cpuctl/background/cpu.uclamp.latency_sensitive 1
on property:sys.boot_completed=1
write /proc/sys/kernel/sched_migration_cost_ns 200000
# restore boot perf. tune
write /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq 0
write /sys/devices/system/cpu/cpufreq/policy6/scaling_min_freq 0
write /sys/class/devfreq/mtk-dvfsrc-devfreq/userspace/set_freq 0
write /dev/cpuctl/system/cpu.uclamp.min 0
write /dev/cpuctl/system/cpu.uclamp.latency_sensitive 0
write /dev/cpuctl/system-background/cpu.uclamp.min 0
write /dev/cpuctl/system-background/cpu.uclamp.latency_sensitive 0
write /dev/cpuctl/foreground/cpu.uclamp.min 0
write /dev/cpuctl/foreground/cpu.uclamp.latency_sensitive 0
write /dev/cpuctl/top-app/cpu.uclamp.min 0
write /dev/cpuctl/top-app/cpu.uclamp.latency_sensitive 0
write /dev/cpuctl/background/cpu.uclamp.min 0
write /dev/cpuctl/background/cpu.uclamp.latency_sensitive 0
on init
# update cpus for cpuset cgroup
write /dev/cpuset/foreground/cpus 0-2,4-7
write /dev/cpuset/foreground/boost/cpus 0-7
write /dev/cpuset/background/cpus 0-2
write /dev/cpuset/system-background/cpus 0-3
write /dev/cpuset/top-app/cpus 0-7
on enable-low-power
# Enable PowerHAL hint processing
setprop vendor.powerhal.init 1

1173
init/init.mt6835.rc Normal file

File diff suppressed because it is too large Load diff

957
init/init.mt6835.usb.rc Normal file
View file

@ -0,0 +1,957 @@
import /system_ext/etc/init/hw/init.usb.rc
on early-init
on post-fs
setprop vendor.usb.vid "0x0E8D"
mkdir /dev/usb-ffs 0775 shell shell
mkdir /dev/usb-ffs/adb 0770 shell shell
mkdir /config/usb_gadget/g1 0770 shell shell
write /config/usb_gadget/g1/idVendor ${vendor.usb.vid}
write /config/usb_gadget/g1/bcdDevice 0x0223
write /config/usb_gadget/g1/bcdUSB 0x0200
write /config/usb_gadget/g1/os_desc/use 1
mkdir /config/usb_gadget/g1/strings/0x409 0770
write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno}
write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.manufacturer}
write /config/usb_gadget/g1/strings/0x409/product ${ro.product.model}
mkdir /config/usb_gadget/g1/functions/accessory.gs2
mkdir /config/usb_gadget/g1/functions/audio_source.gs3
mkdir /config/usb_gadget/g1/functions/ffs.adb
mkdir /config/usb_gadget/g1/functions/ffs.mtp
write /config/usb_gadget/g1/functions/ffs.mtp/os_desc/interface.MTP/compatible_id "MTP"
mkdir /config/usb_gadget/g1/functions/ffs.ptp
mkdir /config/usb_gadget/g1/functions/mtk_rndis.gs4
mkdir /config/usb_gadget/g1/functions/midi.gs5
mkdir /config/usb_gadget/g1/functions/acm.gs0
mkdir /config/usb_gadget/g1/functions/acm.gs1
mkdir /config/usb_gadget/g1/functions/acm.gs2
mkdir /config/usb_gadget/g1/functions/acm.gs3
mkdir /config/usb_gadget/g1/functions/mass_storage.usb0
mkdir /config/usb_gadget/g1/functions/hid.gs0
mkdir /config/usb_gadget/g1/configs/b.1 0770 shell shell
mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell
write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1
write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100"
write /config/usb_gadget/g1/configs/b.1/MaxPower 500
symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1
mount functionfs adb /dev/usb-ffs/adb rmode=0770,fmode=0660,uid=2000,gid=2000,no_disconnect=1
mkdir /dev/usb-ffs/mtp 0770 mtp mtp
mkdir /dev/usb-ffs/ptp 0770 mtp mtp
mount functionfs mtp /dev/usb-ffs/mtp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1
mount functionfs ptp /dev/usb-ffs/ptp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1
on post-fs-data
mkdir /config/usb_gadget/g1/functions/via_modem.gs0
mkdir /config/usb_gadget/g1/functions/via_ets.gs0
mkdir /config/usb_gadget/g1/functions/via_atc.gs0
on boot
setprop sys.usb.configfs 1
setprop sys.usb.controller "11201000.usb0"
setprop vendor.usb.controller "11201000.usb0"
setprop vendor.usb.acm_cnt 0
setprop vendor.usb.acm_port0 ""
setprop vendor.usb.acm_port1 ""
setprop vendor.usb.acm_enable 0
write /sys/class/android_usb/android0/f_mtp/cpu_mask 0x80
write /sys/module/usb_f_mtp/parameters/mtp_rx_cont 1
chmod 0664 /sys/class/android_usb/android0/iSerial
chown root system /sys/class/android_usb/android0/iSerial
chown radio system /sys/class/usb_rawbulk/data/enable
chmod 0660 /sys/class/usb_rawbulk/data/enable
chown radio system /sys/class/usb_rawbulk/ets/enable
chmod 0660 /sys/class/usb_rawbulk/ets/enable
chown radio system /sys/class/usb_rawbulk/atc/enable
chmod 0660 /sys/class/usb_rawbulk/atc/enable
chown radio system /sys/class/usb_rawbulk/pcv/enable
chmod 0660 /sys/class/usb_rawbulk/pcv/enable
chown radio system /sys/class/usb_rawbulk/gps/enable
chmod 0660 /sys/class/usb_rawbulk/gps/enable
chown system radio /dev/ttyGS0
chmod 0660 /dev/ttyGS0
chown system radio /dev/ttyGS1
chmod 0660 /dev/ttyGS1
chown system radio /dev/ttyGS2
chmod 0660 /dev/ttyGS2
chown system radio /dev/ttyGS3
chmod 0660 /dev/ttyGS3
# for usb otg sdcard hot plug detection
write /sys/module/block/parameters/events_dfl_poll_msecs 1000
# force on usb
# write /sys/class/udc/${sys.usb.controller}/device/mode 3
on charger
mkdir /dev/usb-ffs 0775 shell shell
mkdir /dev/usb-ffs/adb 0770 shell shell
mkdir /config/usb_gadget/g1 0770 shell shell
write /config/usb_gadget/g1/idVendor 0x0E8D
write /config/usb_gadget/g1/bcdDevice 0x0223
write /config/usb_gadget/g1/bcdUSB 0x0200
write /config/usb_gadget/g1/os_desc/use 1
mkdir /config/usb_gadget/g1/strings/0x409 0770
write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno}
write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.manufacturer}
write /config/usb_gadget/g1/strings/0x409/product ${ro.product.model}
mkdir /config/usb_gadget/g1/functions/ffs.adb
mkdir /config/usb_gadget/g1/functions/midi.gs5
mkdir /config/usb_gadget/g1/configs/b.1 0770 shell shell
mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell
write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1
write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100"
write /config/usb_gadget/g1/configs/b.1/MaxPower 500
symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1
mount functionfs adb /dev/usb-ffs/adb rmode=0770,fmode=0660,uid=2000,gid=2000,no_disconnect=1
setprop sys.usb.configfs 1
setprop sys.usb.controller "11201000.usb0"
setprop vendor.usb.controller "11201000.usb0"
# midi for kpoc
on property:ro.bootmode=charger && property:ro.debuggable=0
setprop sys.usb.config kpoc_midi
on property:ro.bootmode=charger && property:ro.debuggable=1 && property:ro.vendor.usb.kpoc_adb=0
setprop sys.usb.config kpoc_midi
on property:sys.usb.config=kpoc_midi && property:sys.usb.configfs=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "kpoc_midi"
write /config/usb_gadget/g1/idProduct 0x2046
symlink /config/usb_gadget/g1/functions/midi.gs5 /config/usb_gadget/g1/configs/b.1/f1
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
# adb for kpoc
on property:ro.bootmode=charger && property:ro.debuggable=1 && property:ro.vendor.usb.kpoc_adb=1
setprop sys.usb.config kpoc_adb
on property:sys.usb.config=kpoc_adb && property:sys.usb.configfs=1
start kpoc_adbd
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=kpoc_adb && property:sys.usb.configfs=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "kpoc_adb"
write /config/usb_gadget/g1/idProduct 0x201C
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
### more command at init.usb.configfs.rc ###
on property:sys.usb.config=none && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idVendor ${vendor.usb.vid}
rm /config/usb_gadget/g1/configs/b.1/f1
rm /config/usb_gadget/g1/configs/b.1/f2
rm /config/usb_gadget/g1/configs/b.1/f3
rm /config/usb_gadget/g1/configs/b.1/f4
rm /config/usb_gadget/g1/configs/b.1/f5
rmdir /config/usb_gadget/g1/functions/mtk_rndis.gs4
write /sys/class/udc/${vendor.usb.controller}/device/saving 0
### main function : adb ###
### start adbd at init.usb.configfs.rc ###
on property:sys.usb.config=adb && property:vendor.usb.acm_cnt=0 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x201C
on property:sys.usb.config=adb && property:vendor.usb.acm_cnt=1 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x2006
setprop vendor.usb.acm_port1 ""
on property:sys.usb.config=adb && property:vendor.usb.acm_cnt=2 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x2029
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=adb && \
property:vendor.usb.acm_enable=1 && property:sys.usb.configfs=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "adb_acm"
write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
write /sys/class/udc/${vendor.usb.controller}/device/saving 1
symlink /config/usb_gadget/g1/functions/mass_storage.usb0 /config/usb_gadget/g1/configs/b.1/f1
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port0} /config/usb_gadget/g1/configs/b.1/f3
symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port1} /config/usb_gadget/g1/configs/b.1/f4
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=adb && \
property:vendor.usb.acm_enable=0 && property:sys.usb.configfs=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "adb"
write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
setprop sys.usb.state ${sys.usb.config}
### main function : mtp ###
on property:sys.usb.config=mtp && property:vendor.usb.acm_cnt=0 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x2008
on property:sys.usb.config=mtp && property:vendor.usb.acm_cnt=1 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x2012
setprop vendor.usb.acm_port1 ""
on property:sys.usb.config=mtp && property:vendor.usb.acm_cnt=2 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x202A
on property:sys.usb.config=mtp && property:vendor.usb.acm_enable=1 && \
property:sys.usb.configfs=1 && property:vendor.usb.ffs.mtp.ready=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "mtp_acm"
write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
write /config/usb_gadget/g1/os_desc/use 1
write /sys/class/udc/${vendor.usb.controller}/device/saving 1
symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port0} /config/usb_gadget/g1/configs/b.1/f2
symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port1} /config/usb_gadget/g1/configs/b.1/f3
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=mtp && property:vendor.usb.acm_enable=0 && \
property:sys.usb.configfs=1 && property:vendor.usb.ffs.mtp.ready=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "mtp"
write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
write /config/usb_gadget/g1/os_desc/use 1
write /sys/class/udc/${vendor.usb.controller}/device/saving 2
symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
setprop sys.usb.state ${sys.usb.config}
### start adbd at init.usb.configfs.rc ###
on property:sys.usb.config=mtp,adb && property:vendor.usb.acm_cnt=0 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x201D
on property:sys.usb.config=mtp,adb && property:vendor.usb.acm_cnt=1 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x200A
setprop vendor.usb.acm_port1 ""
on property:sys.usb.config=mtp,adb && property:vendor.usb.acm_cnt=2 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x2026
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,adb && \
property:vendor.usb.acm_enable=1 && property:sys.usb.configfs=1 && property:vendor.usb.ffs.mtp.ready=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "mtp_adb_acm"
write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
write /config/usb_gadget/g1/os_desc/use 1
write /sys/class/udc/${vendor.usb.controller}/device/saving 1
symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port0} /config/usb_gadget/g1/configs/b.1/f3
symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port1} /config/usb_gadget/g1/configs/b.1/f4
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,adb && \
property:vendor.usb.acm_enable=0 && property:sys.usb.configfs=1 && property:vendor.usb.ffs.mtp.ready=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "mtp_adb"
write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
write /config/usb_gadget/g1/os_desc/use 1
symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
setprop sys.usb.state ${sys.usb.config}
### main function : ptp ###
on property:sys.usb.config=ptp && property:vendor.usb.acm_cnt=0 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x200B
on property:sys.usb.config=ptp && property:vendor.usb.acm_cnt=1 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x2013
setprop vendor.usb.acm_port1 ""
on property:sys.usb.config=ptp && property:vendor.usb.acm_cnt=2 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x202B
on property:sys.usb.config=ptp && property:vendor.usb.acm_enable=1 && \
property:sys.usb.configfs=1 && property:vendor.usb.ffs.ptp.ready=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ptp_acm"
write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
write /sys/class/udc/${vendor.usb.controller}/device/saving 1
symlink /config/usb_gadget/g1/functions/ffs.ptp /config/usb_gadget/g1/configs/b.1/f1
symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port0} /config/usb_gadget/g1/configs/b.1/f2
symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port1} /config/usb_gadget/g1/configs/b.1/f3
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=ptp && property:vendor.usb.acm_enable=0 && \
property:sys.usb.configfs=1 && property:vendor.usb.ffs.ptp.ready=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ptp"
write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
write /sys/class/udc/${vendor.usb.controller}/device/saving 2
symlink /config/usb_gadget/g1/functions/ffs.ptp /config/usb_gadget/g1/configs/b.1/f1
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
setprop sys.usb.state ${sys.usb.config}
### start adbd at init.usb.configfs.rc ###
on property:sys.usb.config=ptp,adb && property:vendor.usb.acm_cnt=0 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x200C
on property:sys.usb.config=ptp,adb && property:vendor.usb.acm_cnt=1 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x200D
setprop vendor.usb.acm_port1 ""
on property:sys.usb.config=ptp,adb && property:vendor.usb.acm_cnt=2 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x2027
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=ptp,adb && \
property:vendor.usb.acm_enable=1 && property:sys.usb.configfs=1 && property:vendor.usb.ffs.ptp.ready=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ptp_adb_acm"
write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
write /sys/class/udc/${vendor.usb.controller}/device/saving 1
symlink /config/usb_gadget/g1/functions/ffs.ptp /config/usb_gadget/g1/configs/b.1/f1
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port0} /config/usb_gadget/g1/configs/b.1/f3
symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port1} /config/usb_gadget/g1/configs/b.1/f4
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=ptp,adb && \
property:vendor.usb.acm_enable=0 && property:sys.usb.configfs=1 && property:vendor.usb.ffs.ptp.ready=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ptp_adb"
write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
symlink /config/usb_gadget/g1/functions/ffs.ptp /config/usb_gadget/g1/configs/b.1/f1
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
setprop sys.usb.state ${sys.usb.config}
### main function : rndis ###
on property:sys.usb.config=rndis && property:vendor.usb.acm_cnt=0 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x2004
on property:sys.usb.config=rndis && property:vendor.usb.acm_cnt=1 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x2011
setprop vendor.usb.acm_port1 ""
on property:sys.usb.config=rndis && property:vendor.usb.acm_cnt=2 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x202C
on property:sys.usb.config=rndis && property:vendor.usb.acm_enable=1 && \
property:sys.usb.configfs=1
mkdir /config/usb_gadget/g1/functions/mtk_rndis.gs4
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ums_acm"
write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
write /sys/class/udc/${vendor.usb.controller}/device/saving 1
symlink /config/usb_gadget/g1/functions/mtk_rndis.gs4 /config/usb_gadget/g1/configs/b.1/f1
symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port0} /config/usb_gadget/g1/configs/b.1/f2
symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port1} /config/usb_gadget/g1/configs/b.1/f3
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=rndis && property:vendor.usb.acm_enable=0 && \
property:sys.usb.configfs=1
mkdir /config/usb_gadget/g1/functions/mtk_rndis.gs4
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis"
write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
symlink /config/usb_gadget/g1/functions/mtk_rndis.gs4 /config/usb_gadget/g1/configs/b.1/f1
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=rndis,adb && property:vendor.usb.acm_cnt=0 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x2005
on property:sys.usb.config=rndis,adb && property:vendor.usb.acm_cnt=1 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x2010
setprop vendor.usb.acm_port1 ""
on property:sys.usb.config=rndis,adb && property:vendor.usb.acm_cnt=2 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x2028
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,adb && \
property:vendor.usb.acm_enable=1 && property:sys.usb.configfs=1
mkdir /config/usb_gadget/g1/functions/mtk_rndis.gs4
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_adb_acm"
write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
write /sys/class/udc/${vendor.usb.controller}/device/saving 1
symlink /config/usb_gadget/g1/functions/mtk_rndis.gs4 /config/usb_gadget/g1/configs/b.1/f1
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port0} /config/usb_gadget/g1/configs/b.1/f3
symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port1} /config/usb_gadget/g1/configs/b.1/f4
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,adb && \
property:vendor.usb.acm_enable=0 && property:sys.usb.configfs=1
mkdir /config/usb_gadget/g1/functions/mtk_rndis.gs4
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_adb"
write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
symlink /config/usb_gadget/g1/functions/mtk_rndis.gs4 /config/usb_gadget/g1/configs/b.1/f1
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
setprop sys.usb.state ${sys.usb.config}
### main function : midi ###
on property:sys.usb.config=midi && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x2046
on property:sys.usb.config=midi,adb && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x2048
### main function : accessory ###
on property:sys.usb.config=accessory && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idVendor 0x18d1
write /config/usb_gadget/g1/idProduct 0x2d00
on property:sys.usb.config=accessory,adb && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idVendor 0x18d1
write /config/usb_gadget/g1/idProduct 0x2d01
### main function : audio_source ###
on property:sys.usb.config=audio_source && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idVendor 0x18d1
write /config/usb_gadget/g1/idProduct 0x2d02
on property:sys.usb.config=audio_source,adb && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idVendor 0x18d1
write /config/usb_gadget/g1/idProduct 0x2d03
### main function : accessory,audio_source ###
on property:sys.usb.config=accessory,audio_source && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idVendor 0x18d1
write /config/usb_gadget/g1/idProduct 0x2d04
on property:sys.usb.config=accessory,audio_source,adb && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idVendor 0x18d1
write /config/usb_gadget/g1/idProduct 0x2d05
on property:sys.usb.config=via_bypass && property:vendor.usb.acm_cnt=0 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x2031
on property:sys.usb.config=via_bypass && property:vendor.usb.acm_cnt=1 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x2033
setprop vendor.usb.acm_port1 ""
##via_modem,via_ets,via_atc,acm
on property:sys.usb.config=via_bypass && property:vendor.usb.acm_enable=1 && \
property:sys.usb.configfs=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "via_bypass"
write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
write /sys/class/udc/${vendor.usb.controller}/device/saving 1
symlink /config/usb_gadget/g1/functions/via_modem.gs0 /config/usb_gadget/g1/configs/b.1/f1
symlink /config/usb_gadget/g1/functions/via_ets.gs0 /config/usb_gadget/g1/configs/b.1/f2
symlink /config/usb_gadget/g1/functions/via_atc.gs0 /config/usb_gadget/g1/configs/b.1/f3
symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port0} /config/usb_gadget/g1/configs/b.1/f4
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
setprop sys.usb.state ${sys.usb.config}
##via_modem,via_ets,via_atc,adb
on property:sys.usb.config=via_bypass && property:vendor.usb.acm_enable=0 && \
property:sys.usb.configfs=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "via_bypass"
write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
write /sys/class/udc/${vendor.usb.controller}/device/saving 1
symlink /config/usb_gadget/g1/functions/via_modem.gs0 /config/usb_gadget/g1/configs/b.1/f1
symlink /config/usb_gadget/g1/functions/via_ets.gs0 /config/usb_gadget/g1/configs/b.1/f2
symlink /config/usb_gadget/g1/functions/via_atc.gs0 /config/usb_gadget/g1/configs/b.1/f3
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=via_bypass,adb && property:vendor.usb.acm_cnt=0 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x2032
on property:sys.usb.config=via_bypass,adb && property:vendor.usb.acm_cnt=1 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x2034
setprop vendor.usb.acm_port1 ""
on property:sys.usb.config=via_bypass,adb && property:vendor.usb.acm_cnt=2 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x2050
on property:sys.usb.config=via_bypass,adb && property:sys.usb.configfs=1
start adbd
##via_modem,via_ets,via_atc,adb,acm
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=via_bypass,adb && \
property:vendor.usb.acm_enable=1 && property:vendor.usb.acm_cnt=1 && \
property:sys.usb.configfs=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_adb_acm"
write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
write /sys/class/udc/${vendor.usb.controller}/device/saving 1
symlink /config/usb_gadget/g1/functions/via_modem.gs0 /config/usb_gadget/g1/configs/b.1/f1
symlink /config/usb_gadget/g1/functions/via_ets.gs0 /config/usb_gadget/g1/configs/b.1/f2
symlink /config/usb_gadget/g1/functions/via_atc.gs0 /config/usb_gadget/g1/configs/b.1/f3
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f4
symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port0} /config/usb_gadget/g1/configs/b.1/f5
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
setprop sys.usb.state ${sys.usb.config}
##via_modem,acm,adb
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=via_bypass,adb && \
property:vendor.usb.acm_enable=1 && property:vendor.usb.acm_cnt=2 && \
property:sys.usb.configfs=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_adb_acm2"
write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
write /sys/class/udc/${vendor.usb.controller}/device/saving 1
symlink /config/usb_gadget/g1/functions/via_modem.gs0 /config/usb_gadget/g1/configs/b.1/f1
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port0} /config/usb_gadget/g1/configs/b.1/f3
symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port1} /config/usb_gadget/g1/configs/b.1/f4
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
setprop sys.usb.state ${sys.usb.config}
##via_modem,via_ets,via_atc,adb
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=via_bypass,adb && \
property:vendor.usb.acm_enable=0 && property:sys.usb.configfs=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_adb"
write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
write /sys/class/udc/${vendor.usb.controller}/device/saving 1
symlink /config/usb_gadget/g1/functions/via_modem.gs0 /config/usb_gadget/g1/configs/b.1/f1
symlink /config/usb_gadget/g1/functions/via_ets.gs0 /config/usb_gadget/g1/configs/b.1/f2
symlink /config/usb_gadget/g1/functions/via_atc.gs0 /config/usb_gadget/g1/configs/b.1/f3
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f4
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
setprop sys.usb.state ${sys.usb.config}
### main function : mass_storage ###
on property:sys.usb.config=mass_storage && property:vendor.usb.acm_cnt=0 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x2002
on property:sys.usb.config=mass_storage && property:vendor.usb.acm_cnt=1 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x200F
setprop vendor.usb.acm_port1 ""
on property:sys.usb.config=mass_storage && property:vendor.usb.acm_cnt=2 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x202D
on property:sys.usb.config=mass_storage && property:vendor.usb.acm_enable=1 && \
property:sys.usb.configfs=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ums_acm"
write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
write /sys/class/udc/${vendor.usb.controller}/device/saving 1
symlink /config/usb_gadget/g1/functions/mass_storage.usb0 /config/usb_gadget/g1/configs/b.1/f1
symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port0} /config/usb_gadget/g1/configs/b.1/f2
symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port1} /config/usb_gadget/g1/configs/b.1/f3
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=mass_storage && property:vendor.usb.acm_enable=0 && \
property:sys.usb.configfs=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ums"
write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
symlink /config/usb_gadget/g1/functions/mass_storage.usb0 /config/usb_gadget/g1/configs/b.1/f1
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=mass_storage,adb && property:vendor.usb.acm_cnt=0 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x2003
on property:sys.usb.config=mass_storage,adb && property:vendor.usb.acm_cnt=1 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x2006
setprop vendor.usb.acm_port1 ""
on property:sys.usb.config=mass_storage,adb && property:vendor.usb.acm_cnt=2 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x2029
on property:sys.usb.config=mass_storage,adb && property:sys.usb.configfs=1
start adbd
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mass_storage,adb && \
property:vendor.usb.acm_enable=1 && property:sys.usb.configfs=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ums_adb_acm"
write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
write /sys/class/udc/${vendor.usb.controller}/device/saving 1
symlink /config/usb_gadget/g1/functions/mass_storage.usb0 /config/usb_gadget/g1/configs/b.1/f1
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port0} /config/usb_gadget/g1/configs/b.1/f3
symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port1} /config/usb_gadget/g1/configs/b.1/f4
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mass_storage,adb && \
property:vendor.usb.acm_enable=0 && property:sys.usb.configfs=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ums_adb"
write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
symlink /config/usb_gadget/g1/functions/mass_storage.usb0 /config/usb_gadget/g1/configs/b.1/f1
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
setprop sys.usb.state ${sys.usb.config}
### main function : bicr ###
on property:sys.usb.config=bicr && property:vendor.usb.acm_cnt=0 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x2002
on property:sys.usb.config=bicr && property:vendor.usb.acm_cnt=1 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x200F
setprop vendor.usb.acm_port1 ""
on property:sys.usb.config=bicr && property:vendor.usb.acm_cnt=2 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x202D
on property:sys.usb.config=bicr && property:vendor.usb.acm_enable=1 && \
property:sys.usb.configfs=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ums_acm"
write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
write /sys/class/udc/${vendor.usb.controller}/device/saving 1
write /config/usb_gadget/g1/functions/mass_storage.usb0/lun.0/cdrom 1
write /config/usb_gadget/g1/functions/mass_storage.usb0/lun.0/file "/dev/block/loop0"
symlink /config/usb_gadget/g1/functions/mass_storage.usb0 /config/usb_gadget/g1/configs/b.1/f1
symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port0} /config/usb_gadget/g1/configs/b.1/f2
symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port1} /config/usb_gadget/g1/configs/b.1/f3
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=bicr && property:vendor.usb.acm_enable=0 && \
property:sys.usb.configfs=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ums"
write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
write /config/usb_gadget/g1/functions/mass_storage.usb0/lun.0/cdrom 1
write /config/usb_gadget/g1/functions/mass_storage.usb0/lun.0/file "/dev/block/loop0"
symlink /config/usb_gadget/g1/functions/mass_storage.usb0 /config/usb_gadget/g1/configs/b.1/f1
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=bicr,adb && property:vendor.usb.acm_cnt=0 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x2003
on property:sys.usb.config=bicr,adb && property:vendor.usb.acm_cnt=1 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x2006
setprop vendor.usb.acm_port1 ""
on property:sys.usb.config=bicr,adb && property:vendor.usb.acm_cnt=2 && \
property:sys.usb.configfs=1
setprop vendor.usb.pid 0x2029
on property:sys.usb.config=bicr,adb && property:sys.usb.configfs=1
start adbd
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=bicr,adb && \
property:vendor.usb.acm_enable=1 && property:sys.usb.configfs=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ums_adb_acm"
write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
write /sys/class/udc/${vendor.usb.controller}/device/saving 1
write /config/usb_gadget/g1/functions/mass_storage.usb0/lun.0/cdrom 1
write /config/usb_gadget/g1/functions/mass_storage.usb0/lun.0/file "/dev/block/loop0"
symlink /config/usb_gadget/g1/functions/mass_storage.usb0 /config/usb_gadget/g1/configs/b.1/f1
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port0} /config/usb_gadget/g1/configs/b.1/f3
symlink /config/usb_gadget/g1/functions/acm.gs${vendor.usb.acm_port1} /config/usb_gadget/g1/configs/b.1/f4
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=bicr,adb && \
property:vendor.usb.acm_enable=0 && property:sys.usb.configfs=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ums_adb"
write /config/usb_gadget/g1/idProduct ${vendor.usb.pid}
write /config/usb_gadget/g1/functions/mass_storage.usb0/lun.0/cdrom 1
write /config/usb_gadget/g1/functions/mass_storage.usb0/lun.0/file "/dev/block/loop0"
symlink /config/usb_gadget/g1/functions/mass_storage.usb0 /config/usb_gadget/g1/configs/b.1/f1
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
setprop sys.usb.state ${sys.usb.config}
### ACM APPEND SERIES ###
on property:persist.vendor.radio.port_index="0" && property:sys.boot_completed=1
setprop vendor.usb.acm_idx ""
setprop vendor.usb.acm_cnt 0
setprop vendor.usb.acm_enable 0
setprop sys.usb.config none
setprop sys.usb.config ${sys.usb.state}
on property:persist.vendor.radio.port_index="1" && property:sys.boot_completed=1
setprop sys.usb.config acm_gs0
on property:sys.usb.config=mass_storage,adb,acm
setprop sys.usb.config acm_gs0
on property:sys.usb.config=acm_gs0
setprop vendor.usb.acm_port0 0
setprop vendor.usb.acm_port1 ""
setprop vendor.usb.acm_cnt 1
setprop vendor.usb.acm_enable 1
setprop sys.usb.config none
setprop sys.usb.config ${sys.usb.state}
setprop vendor.usb.acm_idx "1"
on property:persist.vendor.radio.port_index="2" && property:sys.boot_completed=1
setprop sys.usb.config acm_gs1
on property:sys.usb.config=acm_gs1
setprop vendor.usb.acm_port0 1
setprop vendor.usb.acm_port1 ""
setprop vendor.usb.acm_cnt 1
setprop vendor.usb.acm_enable 1
setprop sys.usb.config none
setprop sys.usb.config ${sys.usb.state}
setprop vendor.usb.acm_idx "2"
on property:persist.vendor.radio.port_index="3" && property:sys.boot_completed=1
setprop sys.usb.config acm_gs2
on property:sys.usb.config=acm_third
setprop sys.usb.config acm_gs2
on property:sys.usb.config=acm_gs2
setprop vendor.usb.acm_port0 2
setprop vendor.usb.acm_port1 ""
setprop vendor.usb.acm_cnt 1
setprop vendor.usb.acm_enable 1
setprop sys.usb.config none
setprop sys.usb.config ${sys.usb.state}
setprop vendor.usb.acm_idx "3"
on property:persist.vendor.radio.port_index="4" && property:sys.boot_completed=1
setprop sys.usb.config acm_gs3
on property:sys.usb.config=gs3
setprop sys.usb.config acm_gs3
on property:sys.usb.config=mtp,gs3
setprop sys.usb.config acm_gs3
on property:sys.usb.config=acm_gs3
setprop vendor.usb.acm_port0 3
setprop vendor.usb.acm_port1 ""
setprop vendor.usb.acm_cnt 1
setprop vendor.usb.acm_enable 1
setprop sys.usb.config none
setprop sys.usb.config ${sys.usb.state}
setprop vendor.usb.acm_idx "4"
on property:sys.usb.config=mtp,gs0gs1
setprop sys.usb.config acm_gs0gs1
on property:sys.usb.config=gs0gs1
setprop sys.usb.config acm_gs0gs1
on property:sys.usb.config=rndis,gs0gs1
setprop sys.usb.config acm_gs0gs1
on property:sys.usb.config=rndis,adb,gs0gs1
setprop sys.usb.config acm_gs0gs1
on property:sys.usb.config=acm_gs0gs1
setprop vendor.usb.acm_port0 0
setprop vendor.usb.acm_port1 1
setprop vendor.usb.acm_cnt 2
setprop vendor.usb.acm_enable 1
setprop sys.usb.config none
setprop sys.usb.config ${sys.usb.state}
setprop vendor.usb.acm_idx "1,2"
on property:persist.vendor.radio.port_index="1,4" && property:sys.boot_completed=1
setprop sys.usb.config acm_gs0gs3
on property:sys.usb.config=gs3,dual_acm
setprop sys.usb.config acm_gs0gs3
on property:sys.usb.config=mtp,gs3,dual_acm
setprop sys.usb.config acm_gs0gs3
on property:sys.usb.config=mtp,gs0gs3
setprop sys.usb.config acm_gs0gs3
on property:sys.usb.config=gs0gs3
setprop sys.usb.config acm_gs0gs3
on property:sys.usb.config=rndis,gs0gs3
setprop sys.usb.config acm_gs0gs3
on property:sys.usb.config=rndis,adb,gs0gs3
setprop sys.usb.config acm_gs0gs3
on property:sys.usb.config=acm_gs0gs3
setprop vendor.usb.acm_port0 0
setprop vendor.usb.acm_port1 3
setprop vendor.usb.acm_cnt 2
setprop vendor.usb.acm_enable 1
setprop sys.usb.config none
setprop sys.usb.config ${sys.usb.state}
setprop vendor.usb.acm_idx "1,4"
on property:sys.usb.config=gs1gs3
setprop sys.usb.config acm_gs1gs3
on property:sys.usb.config=mtp,gs1gs3
setprop sys.usb.config acm_gs1gs3
on property:sys.usb.config=via_bypass,gs1gs3
setprop sys.usb.config acm_gs1gs3
on property:sys.usb.config=rndis,gs1gs3
setprop sys.usb.config acm_gs1gs3
on property:sys.usb.config=acm_gs1gs3
setprop vendor.usb.acm_port0 1
setprop vendor.usb.acm_port1 3
setprop vendor.usb.acm_cnt 2
setprop vendor.usb.acm_enable 1
setprop sys.usb.config none
setprop sys.usb.config ${sys.usb.state}
setprop vendor.usb.acm_idx "2,4"
# For ATM (Android Test Mode)
on property:vendor.usb.clear=1 && property:sys.usb.configfs=1
write /config/usb_gadget/g1/UDC "none"
write /config/usb_gadget/g1/bDeviceClass 0
write /config/usb_gadget/g1/bDeviceSubClass 0
write /config/usb_gadget/g1/bDeviceProtocol 0
rm /config/usb_gadget/g1/configs/b.1/f1
rm /config/usb_gadget/g1/configs/b.1/f2
rm /config/usb_gadget/g1/configs/b.1/f3
rm /config/usb_gadget/g1/configs/b.1/f4
rm /config/usb_gadget/g1/configs/b.1/f5
rmdir /config/usb_gadget/g1/functions/mtk_rndis.gs4
write /sys/class/udc/${vendor.usb.controller}/device/saving 0
setprop vendor.usb.clear 2
# has permission issue when read from ${sys.usb.ffs.ready}
on property:sys.usb.ffs.ready=0
setprop vendor.usb.ffs.ready 0
on property:sys.usb.ffs.ready=1
setprop vendor.usb.ffs.ready 1
on property:sys.usb.config=atm_gs0 && property:sys.usb.configfs=1
stop adbd
setprop vendor.usb.ffs.ready 0
setprop vendor.usb.clear 1
on property:vendor.usb.ffs.ready=0 && property:sys.usb.config=atm_gs0 && \
property:vendor.usb.clear=2 && property:sys.usb.configfs=1
start adbd
on property:vendor.usb.ffs.ready=1 && property:sys.usb.config=atm_gs0 && \
property:vendor.usb.clear=2 && property:sys.usb.configfs=1
setprop vendor.usb.acm_port0 0
setprop vendor.usb.acm_port1 ""
setprop vendor.usb.acm_cnt 1
setprop vendor.usb.acm_enable 1
write /sys/class/udc/${vendor.usb.controller}/device/saving 1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "atm_gs0"
write /config/usb_gadget/g1/idProduct 0x200A
symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
symlink /config/usb_gadget/g1/functions/acm.gs0 /config/usb_gadget/g1/configs/b.1/f3
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
#setprop sys.usb.state ${sys.usb.config}
setprop vendor.usb.pid 0x200A
#setprop vendor.usb.clear 0
setprop vendor.usb.acm_idx "1"
on property:sys.usb.config=atm_gs0gs3 && property:sys.usb.configfs=1
stop adbd
setprop vendor.usb.ffs.ready 0
setprop vendor.usb.clear 1
on property:vendor.usb.ffs.ready=0 && property:sys.usb.config=atm_gs0gs3 && \
property:vendor.usb.clear=2 && property:sys.usb.configfs=1
start adbd
on property:vendor.usb.ffs.ready=1 && property:sys.usb.config=atm_gs0gs3 && \
property:vendor.usb.clear=2 && property:sys.usb.configfs=1
setprop vendor.usb.acm_port0 0
setprop vendor.usb.acm_port1 3
setprop vendor.usb.acm_cnt 2
setprop vendor.usb.acm_enable 1
write /sys/class/udc/${vendor.usb.controller}/device/saving 1
write /config/usb_gadget/g1/idProduct 0x2026
symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
symlink /config/usb_gadget/g1/functions/acm.gs0 /config/usb_gadget/g1/configs/b.1/f3
symlink /config/usb_gadget/g1/functions/acm.gs3 /config/usb_gadget/g1/configs/b.1/f4
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
#setprop sys.usb.state ${sys.usb.config}
setprop vendor.usb.pid 0x2026
#setprop vendor.usb.clear 0
setprop vendor.usb.acm_idx "1,4"
### CHARGING ###
on property:sys.usb.config=cdp && property:sys.usb.configfs=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "mtp"
write /config/usb_gadget/g1/idProduct 0x2008
write /config/usb_gadget/g1/os_desc/use 1
symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
write /config/usb_gadget/g1/UDC ${vendor.usb.controller}
setprop sys.usb.state ${sys.usb.config}
setprop vendor.usb.pid 0x2008
on property:sys.usb.config=charging_yes
setprop vendor.usb.charging yes
setprop sys.usb.config none
setprop sys.usb.config ${sys.usb.state}
on property:sys.usb.config=charging_no
setprop sys.usb.config none
setprop sys.usb.config ${sys.usb.state}
setprop vendor.usb.charging no
on property:vendor.usb.charging=yes
write /sys/class/udc/${vendor.usb.controller}/device/mode 0
on property:vendor.usb.charging=no
write /sys/class/udc/${vendor.usb.controller}/device/mode 1
on property:vendor.usb.bicr=yes
write /sys/class/android_usb/android0/f_mass_storage/bicr 1
write /sys/class/android_usb/android0/f_mass_storage/lun/file "/dev/block/loop0"
on property:vendor.usb.bicr=no
write /sys/class/android_usb/android0/f_mass_storage/bicr 0
write /sys/class/android_usb/android0/f_mass_storage/lun/file "off"
on property:vendor.em.usb.set=term_sel
write /proc/mtk_usb/usb-phy0/u2_phy/term_sel ${vendor.em.usb.value}
on property:vendor.em.usb.set=vrt_sel
write /proc/mtk_usb/usb-phy0/u2_phy/vrt_sel ${vendor.em.usb.value}
on property:vendor.em.usb.set=phy_rev6
write /proc/mtk_usb/usb-phy0/u2_phy/phy_rev6 ${vendor.em.usb.value}
on property:vendor.em.usb.set=discth
write /proc/mtk_usb/usb-phy0/u2_phy/discth ${vendor.em.usb.value}
on property:vendor.em.usb.bypass.enable=0
write /sys/class/usb_rawbulk/gps/enable 1
on property:vendor.em.usb.bypass.enable=1
write /sys/class/usb_rawbulk/pcv/enable 1
on property:vendor.em.usb.bypass.enable=2
write /sys/class/usb_rawbulk/atc/enable 1
on property:vendor.em.usb.bypass.enable=3
write /sys/class/usb_rawbulk/ets/enable 1
on property:vendor.em.usb.bypass.enable=4
write /sys/class/usb_rawbulk/data/enable 1
on property:vendor.em.usb.bypass.disable=0
write /sys/class/usb_rawbulk/gps/enable 0
on property:vendor.em.usb.bypass.disable=1
write /sys/class/usb_rawbulk/pcv/enable 0
on property:vendor.em.usb.bypass.disable=2
write /sys/class/usb_rawbulk/atc/enable 0
on property:vendor.em.usb.bypass.disable=3
write /sys/class/usb_rawbulk/ets/enable 0
on property:vendor.em.usb.bypass.disable=4
write /sys/class/usb_rawbulk/data/enable 0
### vendor process start ###
on property:vendor.usb.config=*
setprop sys.usb.config ${vendor.usb.config}
### vendor process end ###
### test command start ###
on property:vendor.usb.test=*
setprop sys.usb.config none
setprop sys.usb.config ${vendor.usb.test}
### test command end ###
on property:vendor.usb.printk=*
write /proc/sys/kernel/printk ${vendor.usb.printk}
on property:persist.vendor.usb.printk=*
setprop vendor.usb.printk ${persist.vendor.usb.printk}
on property:vendor.usb.speed.mode=u3
write /sys/class/udc/${vendor.usb.controller}/device/max_speed super-speed
write /sys/class/udc/${vendor.usb.controller}/device/mode 0
write /sys/class/udc/${vendor.usb.controller}/device/mode 1
on property:vendor.usb.speed.mode=u2
write /sys/class/udc/${vendor.usb.controller}/device/max_speed high-speed
write /sys/class/udc/${vendor.usb.controller}/device/mode 0
write /sys/class/udc/${vendor.usb.controller}/device/mode 1
on property:persist.vendor.usb.speed.mode=u3
write /sys/class/udc/${vendor.usb.controller}/device/max_speed super-speed
write /sys/class/udc/${vendor.usb.controller}/device/mode 0
write /sys/class/udc/${vendor.usb.controller}/device/mode 1
on property:persist.vendor.usb.speed.mode=u2
write /sys/class/udc/${vendor.usb.controller}/device/max_speed high-speed
write /sys/class/udc/${vendor.usb.controller}/device/mode 0
write /sys/class/udc/${vendor.usb.controller}/device/mode 1
on property:vendor.usb.sib_enable=1
write /proc/mtk_usb/usb-phy0/u3_phy/sib 1
on property:vendor.usb.sib_enable=0
write /proc/mtk_usb/usb-phy0/u3_phy/sib 0
on property:vendor.usb.testmode=0
write /proc/mtk_usb/xhci0/testmode "0"
on property:vendor.usb.testmode=1
write /proc/mtk_usb/xhci0/testmode "test SE0 NAK"
on property:vendor.usb.testmode=2
write /proc/mtk_usb/xhci0/testmode "test J"
on property:vendor.usb.testmode=3
write /proc/mtk_usb/xhci0/testmode "test K"
on property:vendor.usb.testmode=4
write /proc/mtk_usb/xhci0/testmode "test packet"
on property:vendor.usb.device.wakeup=*
write ${vendor.usb.device.wakeup} "enabled"
### PLATFORM VARIANT, cat $rc_file | grep write | sort | grep -vE "android0|usb20_phy" | awk '{print $2}' | uniq ###

11
init/init.mtkgki.rc Normal file
View file

@ -0,0 +1,11 @@
service insmod_sh /vendor/bin/init.insmod.sh /vendor/etc/init.insmod.${ro.hardware}.cfg
class main
user root
group root system
disabled
oneshot
on early-init
setprop vendor.all.modules.ready 0
write /proc/bootprof "modprobe: Load_Module_START"
start insmod_sh

66
init/init.project.rc Normal file
View file

@ -0,0 +1,66 @@
import /vendor/etc/init/hw/init.mtkgki.rc
# MTK project .rc configure
on init
mkdir /mnt/media_rw/usbotg 0700 media_rw media_rw
mkdir /storage/usbotg 0700 root root
on post-fs-data
#Camera
chmod 0660 /dev/MAINAF
chown system camera /dev/MAINAF
chmod 0660 /dev/MAINAF2
chown system camera /dev/MAINAF2
chmod 0660 /dev/SUBAF
chown system camera /dev/SUBAF
chmod 0660 /dev/GAF001AF
chown system camera /dev/GAF001AF
chmod 0660 /dev/DW9714AF
chown system camera /dev/DW9714AF
chmod 0660 /dev/LC898212AF
chown system camera /dev/LC898212AF
chmod 0660 /dev/BU64745GWZAF
chown system camera /dev/BU64745GWZAF
#SMB
chown system system /proc/smb/ScreenComm
chmod 0660 /proc/smb/ScreenComm
chmod 0660 /dev/spm
chown system system /dev/spm
#fingerprint
chown system system /dev/spidev1.0
chmod 0666 /dev/focaltech_fp
chmod 0666 /dev/spidev1.0
on init
# Refer to http://source.android.com/devices/tech/storage/index.html
# It said, "Starting in Android 4.4, multiple external storage devices are surfaced to developers through
# Context.getExternalFilesDirs(), Context.getExternalCacheDirs(), and Context.getObbDirs().
# External storage devices surfaced through these APIs must be a semi-permanent part of the device (such as an SD card slot in a battery compartment).
# Developers expect data stored in these locations to be available over long periods of time."
# Therefore, if the target doesn't support sd hot-plugging (Ex: the SD card slot in a battery compartment), we need to export SECONDARY_STORAGE in 'boot' section
#
# export SECONDARY_STORAGE /storage/sdcard1
service fuse_usbotg /system/bin/sdcard -u 1023 -g 1023 -w 1023 -d /mnt/media_rw/usbotg /storage/usbotg
class late_start
user media_rw
disabled
# start mmstat
on property:sys.boot_completed=1
mkdir /sys/kernel/tracing/instances/mmstat 711
write /sys/kernel/tracing/instances/mmstat/tracing_on 0
write /sys/kernel/tracing/instances/mmstat/buffer_size_kb 16
write /sys/kernel/tracing/instances/mmstat/events/mmstat/enable 1
write /sys/kernel/tracing/instances/mmstat/tracing_on 1

View file

@ -0,0 +1,27 @@
import /init.recovery.project.rc
on init
setprop sys.usb.configfs 1
setprop sys.usb.controller "11201000.usb0"
on fs && property:ro.debuggable=0
# distinguish USB shoulde connect or not, i.e. CDP vs SDP
# set charging free due to it wait for USB activation
on post-fs
# Support A/B feature for EMMC and UFS boot region
symlink /dev/block/sda /dev/block/mmcblk0boot0
symlink /dev/block/sdb /dev/block/mmcblk0boot1
symlink /dev/block/mmcblk0boot0 /dev/block/by-name/preloader_a
symlink /dev/block/mmcblk0boot1 /dev/block/by-name/preloader_b
# Support A/B feature for combo emmc and ufs OTA update
symlink /dev/block/by-name/preloader_a /dev/block/by-name/preloader_emmc_a
symlink /dev/block/by-name/preloader_b /dev/block/by-name/preloader_emmc_b
symlink /dev/block/by-name/preloader_a /dev/block/by-name/preloader_ufs_a
symlink /dev/block/by-name/preloader_b /dev/block/by-name/preloader_ufs_b
exec u:r:update_engine:s0 root root -- /system/bin/mtk_plpath_utils
symlink /dev/block/mapper/pl_a /dev/block/by-name/preloader_raw_a
symlink /dev/block/mapper/pl_b /dev/block/by-name/preloader_raw_b

11
init/init.sensor_2_0.rc Normal file
View file

@ -0,0 +1,11 @@
# MTK platform .rc configure
on post-fs-data
# calibration
mkdir /data/vendor/sensor 0774 system system
# Sensor add by driver for hf_manager Permissions
chmod 0666 /dev/hf_manager
chown system system /dev/hf_manager
# drv modified by gongtaitao for send lcm param to light sensor 20221031 start
chmod 0666 /dev/pix_manager
chown system system /dev/pix_manager
# drv modified by gongtaitao for send lcm param to light sensor 20221031 end

46
init/init_connectivity.rc Normal file
View file

@ -0,0 +1,46 @@
# MTK connectivity .rc configure
on post-fs-data
mkdir /data/vendor/stp_dump 0755 system system
mkdir /data/vendor/connsyslog 0755 system system
on boot
# WMT
service wmt_loader /vendor/bin/wmt_loader
class early_hal
user system
group system
oneshot
service wmt_launcher /vendor/bin/wmt_launcher -p /vendor/firmware/ -o 1
class early_hal
user system
group system
on property:ro.build.type=eng
write /sys/kernel/debug/tracing/tracing_on 1
on property:persist.vendor.connsys.coredump.mode=1
start stp_dump
on property:persist.vendor.connsys.coredump.mode=2
start stp_dump
on property:persist.vendor.connsys.coredump.mode=0
stop stp_dump
on property:vendor.connsys.driver.ready=yes && property:persist.vendor.connsys.coredump.mode=*
write /proc/driver/wmt_user_proc "0x1 ${persist.vendor.connsys.coredump.mode}"
on property:vendor.connsys.driver.ready=yes && property:debug.vendor.connsys.suspend.alarm=*
write /proc/driver/wmt_user_proc "0x2 ${debug.vendor.connsys.suspend.alarm}"
on property:persist.vendor.em.dy.debug=1
setprop persist.vendor.connsys.coredump.mode 0
service stp_dump /vendor/bin/stp_dump3
user system
group system sdcard_rw misc
class core
disabled

209
init/ueventd.rc Normal file
View file

@ -0,0 +1,209 @@
#change partition permission
# eMMC only
/dev/block/mmcblk0 0660 root system
/dev/block/mmcblk0boot0 0660 root system
/dev/block/mmcblk0boot1 0660 root system
/dev/misc-sd 0660 root system
# UFS only
/dev/block/sda 0660 root system
/dev/block/sdb 0660 root system
/dev/block/sdc 0660 root system
# eMMC/UFS common
/dev/block/by-name/misc2 0660 root system
/dev/block/by-name/boot 0640 root system
/dev/block/by-name/recovery 0640 root system
/dev/block/by-name/secro 0640 root system
/dev/block/by-name/seccfg 0660 root system
/dev/block/by-name/proinfo 0660 root system
/dev/block/by-name/nvram 0660 root system
/dev/block/by-name/para 0660 root system
/dev/block/by-name/logo 0660 root system
/dev/block/by-name/frp 0660 root system
/dev/block/by-name/md1img 0640 root system
/dev/block/by-name/md1img_a 0640 root system
/dev/block/by-name/md1img_b 0640 root system
/dev/block/by-name/md1dsp 0660 root system
/dev/block/by-name/boot_para 0640 root system
# OTP
/dev/otp 0660 system system
/dev/block/by-name/otp 0660 root system
# Connectivity
/dev/stpwmt 0660 system system
/dev/wmtdetect 0660 system system
/dev/fw_log_wmt 0660 system system
/dev/conninfra_dev 0660 system system
/dev/conn_pwr_dev 0660 system system
# BT
/dev/stpbt 0660 bluetooth bluetooth
/dev/fw_log_bt 0660 bluetooth bluetooth
# GPS
/dev/gpsdl0 0660 gps gps
/dev/gpsdl1 0660 gps gps
/dev/stpgps 0660 gps gps
/dev/stpgps2 0660 gps gps
/dev/gps 0660 gps system
/dev/gps_emi 0660 gps gps
/dev/gps_pwr 0660 gps gps
/dev/fw_log_gps 0660 gps gps
# ANT
/dev/stpant 0660 system system
# WIFI
/dev/wmtWifi 0660 wifi wifi
/dev/fw_log_wifi 0660 wifi wifi
# FMRadio
/dev/fm 0660 media media
# NFC
/dev/st21nfc 0660 nfc radio
/dev/st54spi 0660 secure_element secure_element
# MTK BTIF driver
/dev/btif 0600 system system
# Trusty driver
/dev/trusty-ipc-dev0 0660 system system
/dev/nebula-ipc-dev0 0660 system system
# RPMB (for Trusty)
/dev/block/mmcblk0rpmb 0660 root system
# TrustonicTEE driver
/dev/mobicore 0600 system system
/dev/mobicore-user 0666 system system
/dev/t-base-tui 0666 system system
# teeperf driver
/dev/teeperf 0666 system system
#v4l2 device
/dev/video* 0660 camera system
/dev/media* 0660 camera system
/dev/v4l-subdev* 0660 camera system
#v4l2 codec
/dev/vcu 0660 camera system
#v4l2 camera
/dev/mtk_hcp 0660 camera system
# DRM node
/dev/dri/card0 0660 system system
# MDDP node
/dev/mddp 0660 system system
# cpu hotplug
/sys/devices/system/cpu/cpu* cpufreq/sugov_ext/down_rate_limit_us 0664 system system
/sys/devices/system/cpu/cpu* cpufreq/sugov_ext/up_rate_limit_us 0664 system system
# add the read write right of ttyUSB*
/dev/bus/usb/* 0660 root usb
/dev/ttyUSB0 0660 radio radio
/dev/ttyUSB1 0660 radio radio
/dev/ttyUSB2 0660 radio radio
/dev/ttyUSB3 0660 radio radio
/dev/ttyUSB4 0660 radio radio
# Anyone can read the logs, but if they're not in the "logs"
# group, then they'll only see log entries for their UID.
/dev/log/ksystem 0600 root log
/dev/ccci* 0660 radio radio
/dev/ttyC* 0660 radio radio
/sys/kernel/ccci modem_info 0644 radio radio
/sys/kernel/ccci md1_postfix 0644 radio radio
/sys/kernel/ccci md2_postfix 0644 radio radio
/dev/eemcs* 0660 radio radio
/dev/emd* 0660 radio radio
/dev/ccci_pcm_rx 0660 audio audio
/dev/ccci_pcm_tx 0660 audio audio
/dev/ccci_aud 0660 audio audio
/dev/ccci2_aud 0660 audio audio
/dev/ccci3_aud 0660 audio audio
/dev/ccci_raw_audio 0660 audio audio
/dev/ccci3_raw_audio 0660 audio audio
/dev/eemcs_aud 0660 audio audio
/dev/irtx 0660 system system
/dev/lirc* 0660 root system
/dev/ir-learning 0660 system system
# SGX device node
/dev/pvrsrvkm 0666 root root
/dev/pvr_sync 0666 root root
/sys/devices/platform/leds-mt65xx/leds/green delay_on 0664 system system
/sys/devices/platform/leds-mt65xx/leds/green delay_off 0664 system system
/sys/devices/platform/leds-mt65xx/leds/red delay_on 0664 system system
/sys/devices/platform/leds-mt65xx/leds/red delay_off 0664 system system
/sys/devices/platform/leds-mt65xx/leds/blue delay_on 0664 system system
/sys/devices/platform/leds-mt65xx/leds/blue delay_off 0664 system system
#drv add by shenwenbin for leds selinux 20231118 start
/sys/class/leds/red delay_on 0664 system system
/sys/class/leds/red delay_off 0664 system system
/sys/class/leds/green delay_on 0664 system system
/sys/class/leds/green delay_off 0664 system system
/sys/class/leds/blue delay_on 0664 system system
/sys/class/leds/blue delay_off 0664 system system
#drv add by shenwenbin for leds selinux 20231118 end
#GPIO
/dev/mtgpio 0600 radio root
# Camera
/dev/camera_eeprom* 0660 system camera
#FOR VIA MODEM
/dev/ttySDIO* 0660 radio sdcard_rw
/dev/ttyRB* 0660 radio radio
# Mali node
/dev/mali0 0666 system graphics
# Change ION driver permission
/dev/ion 0666 system graphics
# Change DMA_HEAP deice permission
# refs: /system/core/rootdir/uevent.rc
# /dev/dma_heap/system 0444 system system
/dev/dma_heap/mtk_mm 0444 system system
/dev/dma_heap/mtk_mm-uncached 0444 system system
/dev/dma_heap/mtk_svp_page-uncached 0444 system system
/dev/dma_heap/mtk_prot_page-uncached 0444 system system
/dev/dma_heap/mtk_svp_region 0444 system system
/dev/dma_heap/mtk_svp_region-aligned 0444 system system
/dev/dma_heap/mtk_prot_region 0444 system system
/dev/dma_heap/mtk_prot_region-aligned 0444 system system
/dev/dma_heap/mtk_2d_fr_region 0444 system system
/dev/dma_heap/mtk_2d_fr_region-aligned 0444 system system
/dev/dma_heap/mtk_wfd_region 0444 system system
/dev/dma_heap/mtk_wfd_region-aligned 0444 system system
/dev/dma_heap/mtk_wfd_page-uncached 0444 system system
#touch
/dev/touch 0660 root system
/dev/hotknot 0660 root system
#hang_detect
/dev/RT_Monitor 0660 system system
/dev/kick_powerkey 0660 system system
#MTK In-House TEE
/dev/ttyACM0 0660 radio radio
#sensor
/dev/hf_manager 0660 system system
#dynamic sensor
/dev/hidraw* 0660 system system
#charging control
/sys/devices/platform/charger cmd_charge_disable 0660 system system

42
libfmjni/Android.bp Normal file
View file

@ -0,0 +1,42 @@
//
// Copyright (C) 2014 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_library_shared {
name: "libfmjni-mediatek",
stem: "libfmjni",
overrides: ["libfmjni"],
srcs: [
"fmr_core.cpp",
"fmr_err.cpp",
"libfm_jni.cpp",
"common.cpp",
"custom.cpp",
],
header_libs: ["jni_headers"],
shared_libs: [
"libbase",
"libcutils",
"libdl",
"liblog",
"libmedia",
"libnativehelper",
],
}

185
libfmjni/NOTICE Normal file
View file

@ -0,0 +1,185 @@
This MediaTek software package contains software with the following notices and under the following licenses:
==============================================================================================================
Copyright (C) 2014 The Android Open Source Project
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS

25
libfmjni/README Normal file
View file

@ -0,0 +1,25 @@
Libraries of MTK FM feature, including FM power on/off,
seek, scan, tune...and some other basic functions.
WHAT IT DOES?
=============
Provide FM basic functions
HOW IT WAS BUILT?
==================
It needs the following libs from AOSP:
1. libcutils
2. libdl
and the following libs from MediaTek:
1. libmedia
HOW TO USE IT?
==============
Files in this directory is used to
generate libraries 'libfmjni'
These libraries are loaded when system up
All the source code of this library were written by MediaTek co..

968
libfmjni/common.cpp Executable file
View file

@ -0,0 +1,968 @@
/*
* Copyright (C) 2014 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 <cutils/properties.h>
#include "fmr.h"
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "FMLIB_COM"
#define UNUSED(x) (void)(x)
int COM_get_seek_space()
{
// FM radio seek space, 5:50KHZ; 1:100KHZ; 2:200KHZ
if (property_get_int32("persist.vendor.connsys.fm_50khz_support", 0) == 1)
return FM_SPACE_50K;
return FM_SPACE_DEFAULT;
}
int COM_open_dev(const char *pname, int *fd)
{
int ret = 0;
int tmp = -1;
FMR_ASSERT(pname);
FMR_ASSERT(fd);
LOGI("COM_open_dev start\n");
tmp = open(pname, O_RDWR);
if (tmp < 0) {
LOGE("Open %s failed, %s\n", pname, strerror(errno));
ret = -ERR_INVALID_FD;
}
*fd = tmp;
LOGI("%s, [fd=%d] [ret=%d]\n", __func__, *fd, ret);
return ret;
}
int COM_close_dev(int fd)
{
int ret = 0;
LOGI("COM_close_dev start\n");
ret = close(fd);
if (ret) {
LOGE("%s, failed\n", __func__);
}
LOGD("%s, [fd=%d] [ret=%d]\n", __func__, fd, ret);
return ret;
}
int COM_pwr_up(int fd, int band, int freq)
{
int ret = 0;
struct fm_tune_parm parm;
LOGI("%s, [freq=%d]\n", __func__, freq);
bzero(&parm, sizeof(struct fm_tune_parm));
parm.band = band;
parm.freq = freq;
parm.hilo = FM_AUTO_HILO_OFF;
parm.space = FM_SEEK_SPACE;
ret = ioctl(fd, FM_IOCTL_POWERUP, &parm);
if (ret) {
LOGE("%s, failed\n", __func__);
}
LOGD("%s, [fd=%d] [ret=%d]\n", __func__, fd, ret);
return ret;
}
int COM_pwr_down(int fd, int type)
{
int ret = 0;
LOGI("%s, [type=%d]\n", __func__, type);
ret = ioctl(fd, FM_IOCTL_POWERDOWN, &type);
if (ret) {
LOGE("%s, failed\n", __func__);
}
LOGD("%s, [fd=%d] [ret=%d]\n", __func__, fd, ret);
return ret;
}
int COM_get_chip_id(int fd, int *chipid)
{
int ret = 0;
uint16_t tmp = 0;
FMR_ASSERT(chipid);
ret = ioctl(fd, FM_IOCTL_GETCHIPID, &tmp);
*chipid = (int)tmp;
if (ret){
LOGE("%s, failed\n", __func__);
}
LOGD("%s, [fd=%d] [chipid=%x] [ret=%d]\n", __func__, fd, *chipid, ret);
return ret;
}
int COM_get_rssi(int fd, int *rssi)
{
int ret = 0;
FMR_ASSERT(rssi);
ret = ioctl(fd, FM_IOCTL_GETRSSI, rssi);
if(ret){
LOGE("%s, failed, [ret=%d]\n", __func__, ret);
}
LOGI("%s, [rssi=%d] [ret=%d]\n", __func__, *rssi, ret);
return ret;
}
/*0x20: space, 0x7E:~*/
#define ISVALID(c)((c)>=0x20 && (c)<=0x7E)
/*change any char which out of [0x20,0x7E]to space(0x20)*/
void COM_change_string(uint8_t *str, int len)
{
int i = 0;
for (i=0; i<len; i++) {
if (false == ISVALID(str[i])) {
str[i]= 0x20;
}
}
}
int COM_get_ps(int fd, RDSData_Struct *rds, uint8_t **ps, int *ps_len)
{
int ret = 0;
char tmp_ps[9] = {0};
UNUSED(fd);
FMR_ASSERT(rds);
FMR_ASSERT(ps);
FMR_ASSERT(ps_len);
if (rds->event_status&RDS_EVENT_PROGRAMNAME) {
LOGD("%s, Success,[event_status=%d]\n", __func__, rds->event_status);
*ps = &rds->PS_Data.PS[3][0];
*ps_len = sizeof(rds->PS_Data.PS[3]);
COM_change_string(*ps, *ps_len);
memcpy(tmp_ps, *ps, 8);
LOGI("PS=%s\n", tmp_ps);
} else {
LOGE("%s, Failed,[event_status=%d]\n", __func__, rds->event_status);
*ps = NULL;
*ps_len = 0;
ret = -ERR_RDS_NO_DATA;
}
return ret;
}
int COM_get_rt(int fd, RDSData_Struct *rds, uint8_t **rt, int *rt_len)
{
int ret = 0;
char tmp_rt[65] = { 0 };
UNUSED(fd);
FMR_ASSERT(rds);
FMR_ASSERT(rt);
FMR_ASSERT(rt_len);
if (rds->event_status&RDS_EVENT_LAST_RADIOTEXT) {
LOGD("%s, Success,[event_status=%d]\n", __func__, rds->event_status);
*rt = &rds->RT_Data.TextData[3][0];
*rt_len = rds->RT_Data.TextLength;
COM_change_string(*rt, *rt_len);
memcpy(tmp_rt, *rt, 64);
LOGI("RT=%s\n", tmp_rt);
} else {
LOGE("%s, Failed,[event_status=%d]\n", __func__, rds->event_status);
*rt = NULL;
*rt_len = 0;
ret = -ERR_RDS_NO_DATA;
}
return ret;
}
int COM_get_pi(int fd, RDSData_Struct *rds, uint16_t *pi)
{
int ret = 0;
UNUSED(fd);
FMR_ASSERT(rds);
FMR_ASSERT(pi);
if (rds->event_status & RDS_EVENT_PI_CODE) {
LOGD("%s, Success,[event_status=%d] [PI=%d]\n", __func__, rds->event_status, rds->PI);
*pi = rds->PI;
} else {
LOGI("%s, Failed, there's no pi,[event_status=%d]\n", __func__, rds->event_status);
*pi = -1;
ret = -ERR_RDS_NO_DATA;
}
return ret;
}
int COM_get_ecc(int fd, RDSData_Struct *rds, uint8_t *ecc)
{
int ret = 0;
UNUSED(fd);
FMR_ASSERT(rds);
FMR_ASSERT(ecc);
if (rds->event_status & RDS_EVENT_ECC_CODE) {
LOGD("%s, Success,[event_status=%d] [ECC=%d]\n", __func__,
rds->event_status, rds->Extend_Country_Code);
*ecc = rds->Extend_Country_Code;
} else {
LOGI("%s, Failed, there's no ECC,[event_status=%d]\n", __func__, rds->event_status);
*ecc = -1;
ret = -ERR_RDS_NO_DATA;
}
return ret;
}
int COM_get_pty(int fd, RDSData_Struct *rds, uint8_t *pty)
{
int ret = 0;
UNUSED(fd);
FMR_ASSERT(rds);
FMR_ASSERT(pty);
if(rds->event_status&RDS_EVENT_PTY_CODE){
LOGD("%s, Success,[event_status=%d] [PTY=%d]\n", __func__, rds->event_status, rds->PTY);
*pty = rds->PTY;
}else{
LOGI("%s, Success, there's no pty,[event_status=%d]\n", __func__, rds->event_status);
*pty = -1;
ret = -ERR_RDS_NO_DATA;
}
return ret;
}
int COM_tune(int fd, int freq, int band)
{
int ret = 0;
struct fm_tune_parm parm;
bzero(&parm, sizeof(struct fm_tune_parm));
parm.band = band;
parm.freq = freq;
parm.hilo = FM_AUTO_HILO_OFF;
parm.space = FM_SEEK_SPACE;
ret = ioctl(fd, FM_IOCTL_TUNE, &parm);
if (ret) {
LOGE("%s, failed\n", __func__);
}
LOGD("%s, [fd=%d] [freq=%d] [ret=%d]\n", __func__, fd, freq, ret);
return ret;
}
int COM_seek(int fd, int *freq, int band, int dir, int lev)
{
int ret = 0;
struct fm_seek_parm parm;
bzero(&parm, sizeof(struct fm_tune_parm));
parm.band = band;
parm.freq = *freq;
parm.hilo = FM_AUTO_HILO_OFF;
parm.space = FM_SEEK_SPACE;
if (dir == 1) {
parm.seekdir = FM_SEEK_UP;
} else if (dir == 0) {
parm.seekdir = FM_SEEK_DOWN;
}
parm.seekth = lev;
ret = ioctl(fd, FM_IOCTL_SEEK, &parm);
if (ret == 0) {
*freq = parm.freq;
}
LOGD("%s, [fd=%d] [ret=%d]\n", __func__, fd, ret);
return ret;
}
int COM_set_mute(int fd, int mute)
{
int ret = 0;
int tmp = mute;
LOGD("%s, start \n", __func__);
ret = ioctl(fd, FM_IOCTL_MUTE, &tmp);
if (ret) {
LOGE("%s, failed\n", __func__);
}
LOGD("%s, [fd=%d] [ret=%d]\n", __func__, fd, ret);
return ret;
}
int COM_is_fm_pwrup(int fd, int *pwrup)
{
int ret = 0;
ret = ioctl(fd, FM_IOCTL_IS_FM_POWERED_UP, pwrup);
if (ret) {
LOGE("%s, failed\n", __func__);
}
LOGD("%s, [fd=%d] [ret=%d]\n", __func__, fd, ret);
return ret;
}
/******************************************
* Inquiry if RDS is support in driver.
* Parameter:
* None
*supt Value:
* 1: support
* 0: NOT support
* -1: error
******************************************/
int COM_is_rdsrx_support(int fd, int *supt)
{
int ret = 0;
int support = -1;
if (fd < 0) {
LOGE("FM isRDSsupport fail, g_fm_fd = %d\n", fd);
*supt = -1;
ret = -ERR_INVALID_FD;
return ret;
}
ret = ioctl(fd, FM_IOCTL_RDS_SUPPORT, &support);
if (ret) {
LOGE("FM FM_IOCTL_RDS_SUPPORT fail, errno = %d\n", errno);
//don't support
*supt = 0;
return ret;
}
LOGI("isRDSsupport Success,[support=%d]\n", support);
*supt = support;
return ret;
}
int COM_pre_search(int fd)
{
fm_s32 ret = 0;
ret = ioctl(fd, FM_IOCTL_PRE_SEARCH, 0);
LOGD("COM_pre_search:%d\n",ret);
return ret;
}
int COM_restore_search(int fd)
{
fm_s32 ret = 0;
ret = ioctl(fd, FM_IOCTL_RESTORE_SEARCH, 0);
LOGD("COM_restore_search:%d\n",ret);
return ret;
}
/*soft mute tune function, usually for sw scan implement or CQI log tool*/
int COM_Soft_Mute_Tune(int fd, fm_softmute_tune_t *para)
{
fm_s32 ret = 0;
//fm_s32 RSSI = 0, PAMD = 0,MR = 0, ATDC = 0;
//fm_u32 PRX = 0;
//fm_u16 softmuteGainLvl = 0;
fm_softmute_tune_t value;
value.freq = para->freq;
ret = ioctl(fd, FM_IOCTL_SOFT_MUTE_TUNE, &value);
if (ret) {
LOGE("FM soft mute tune faild:%d\n",ret);
return ret;
}
#if 0
LOGD("Raw data of soft mute tune[%d]: RSSI:[%x]PAMD:[%x]MR:[%x]ATDC:[%x]PRX:[%x]SMG:[%x]",para->freq,value.RSSI,value.PAMD,value.MR,value.ATDC,value.PRX,value.SMG);
RSSI = ((value.RSSI & 0x03FF) >= 512) ? ((value.RSSI & 0x03FF) - 1024) : (value.RSSI & 0x03FF);
PAMD = ((value.PAMD & 0xFF) >= 128) ? ((value.PAMD & 0x00FF) - 256) : (value.PAMD & 0x00FF);
MR = ((value.MR & 0x01FF) >= 256) ? ((value.MR & 0x01FF) - 512) : (value.MR & 0x01FF);
ATDC =((value.ATDC & 0x0FFF) >= 2048) ? ((value.ATDC & 0x0FFF) - 4096) : (value.ATDC & 0x0FFF);
if (ATDC < 0) {
ATDC = (~(ATDC)) - 1;//Get abs value of ATDC
}
PRX = (value.PRX & 0x00FF);
softmuteGainLvl = value.SMG;
//check if the channel is valid according to each CQIs
if ((RSSI >= RSSI_TH)
&& (PAMD <= PAMD_TH)
&& (ATDC <= ATDC_TH)
&& (MR >= MR_TH)
&& (PRX >= PRX_TH)
&& (softmuteGainLvl <= softMuteGainTH)) {
para->valid = fm_true;
} else {
para->valid = fm_false;
}
#endif
para->valid = value.valid;
para->rssi = value.rssi;
//LOGI("soft mute tune[%d] valid[%d]: RSSI:[%d]PAMD:[%d]MR:[%d]ATDC:[%d]PRX:[%d]SMG:[%d]",para->freq,para->valid,RSSI,PAMD,MR,ATDC,PRX,softmuteGainLvl);
return 0;
}
int COM_get_cqi(int fd, int num, char *buf, int buf_len)
{
int ret;
struct fm_cqi_req cqi_req;
//check buf
num = (num > CQI_CH_NUM_MAX) ? CQI_CH_NUM_MAX : num;
num = (num < CQI_CH_NUM_MIN) ? CQI_CH_NUM_MIN : num;
cqi_req.ch_num = (uint16_t)num;
cqi_req.buf_size = cqi_req.ch_num * sizeof(struct fm_cqi);
if (!buf || (buf_len < cqi_req.buf_size)) {
LOGE("get cqi, invalid buf\n");
return -1;
}
cqi_req.cqi_buf = buf;
//get cqi from driver
ret = ioctl(fd, FM_IOCTL_CQI_GET, &cqi_req);
if (ret < 0) {
LOGE("get cqi, failed %d\n", ret);
return -1;
}
return 0;
}
int COM_turn_on_off_rds(int fd, int onoff)
{
int ret = 0;
uint16_t rds_on = -1;
LOGD("Rdsset start\n");
if (onoff == FMR_RDS_ON) {
rds_on = 1;
ret = ioctl(fd, FM_IOCTL_RDS_ONOFF, &rds_on);
if (ret) {
LOGE("FM_IOCTL_RDS_ON failed\n");
return ret;
}
LOGD("Rdsset Success,[rds_on=%d]\n", rds_on);
} else {
rds_on = 0;
ret = ioctl(fd, FM_IOCTL_RDS_ONOFF, &rds_on);
if (ret) {
LOGE("FM_IOCTL_RDS_OFF failed\n");
return ret;
}
LOGD("Rdsset Success,[rds_on=%d]\n", rds_on);
}
return ret;
}
int COM_read_rds_data(int fd, RDSData_Struct *rds, uint16_t *rds_status)
{
int ret = 0;
uint16_t event_status;
//char tmp_ps[9] = {0};
//char tmp_rt[65] = { 0 };
FMR_ASSERT(rds);
FMR_ASSERT(rds_status);
if (read(fd, rds, sizeof(RDSData_Struct)) == sizeof(RDSData_Struct)) {
event_status = rds->event_status;
//memcpy(tmp_ps, &rds->PS_Data.PS[3][0], 8);
//memcpy(tmp_rt, &rds->RT_Data.TextData[3][0], 64);
LOGI("event_status = 0x%x\n", event_status);
//memset(tmp_ps, 0, 9);
//memset(tmp_rt, 0, 65);
*rds_status = event_status;
return ret;
} else {
//LOGE("readrds get no event\n");
ret = -ERR_RDS_NO_DATA;
}
return ret;
}
static int COM_get_af_pi(int fd, uint16_t *pi)
{
int ret;
struct rds_raw_data rrd;
uint16_t pi1, pi2;
FMR_ASSERT(pi);
memset(&rrd, 0, sizeof(rrd));
ret = ioctl(fd, FM_IOCTL_RDS_GET_LOG, &rrd);
if (ret) {
LOGE("COM_get_af_pi fail(%d)\n", ret);
*pi = 0;
return ret;
}
if (rrd.len == 0) {
LOGE("COM_get_af_pi fail, RDS log empty!\n");
*pi = 0;
return -1;
}
pi1 = rrd.data[4];
pi1 |= (rrd.data[5] << 8);
LOGI("data[4]=%02x,data[5]=%02x,pi1=%04x\n", rrd.data[4], rrd.data[5], pi1);
pi2 = rrd.data[16];
pi2 |= (rrd.data[17] << 8);
LOGI("data[16]=%02x,data[17]=%02x,pi2=%04x\n", rrd.data[16], rrd.data[17], pi2);
if (pi1 == pi2) {
LOGI("got af pi!!!\n");
*pi = pi1;
} else {
LOGE("af pi check fail\n");
*pi = 0;
return -1;
}
return 0;
}
int COM_active_af(int fd, RDSData_Struct *rds, CUST_cfg_ds *cfg_data, uint16_t orig_pi, uint16_t cur_freq, uint16_t *ret_freq)
{
int ret = 0;
int i = 0, j = 0;
struct fm_tune_parm parm;
struct fm_softmute_tune_t smt_parm;
uint16_t set_freq = 0, sw_freq = 0, org_freq = 0;
uint16_t PAMD_Value = 0, AF_PAMD_LBound = 0, AF_PAMD_HBound = 0;
uint16_t PAMD_Level[25];
uint16_t PI[25];
uint16_t PAMD_DB_TBL[5] = {// 5dB, 10dB, 15dB, 20dB, 25dB,
// 13, 17, 21, 25, 29};
8, 12, 15, 18, 20};
AF_Info af_list_backup;
AF_Info af_list;
FMR_ASSERT(rds);
FMR_ASSERT(cfg_data);
sw_freq = cur_freq; //current freq
org_freq = cur_freq;
parm.band = cfg_data->band;
parm.freq = sw_freq;
parm.hilo = FM_AUTO_HILO_OFF;
parm.space = FM_SPACE_DEFAULT;
if (!(rds->event_status & RDS_EVENT_AF)) {
LOGE("activeAF failed\n");
*ret_freq = 0;
ret = -ERR_RDS_NO_DATA;
return ret;
}
memset(&af_list_backup, 0, sizeof(af_list_backup));
memcpy(&af_list_backup, &rds->AF_Data, sizeof(AF_Info));
memset(&af_list, 0, sizeof(af_list));
AF_PAMD_LBound = PAMD_DB_TBL[0]; //5dB
AF_PAMD_HBound = PAMD_DB_TBL[1]; //15dB
ioctl(fd, FM_IOCTL_GETCURPAMD, &PAMD_Value);
for (i = 0; i < 3 && (PAMD_Value < AF_PAMD_LBound); i++) {
usleep(10 * 1000);
ioctl(fd, FM_IOCTL_GETCURPAMD, &PAMD_Value);
LOGI("check PAMD %d time(s), PAMD =%d", i+1, PAMD_Value);
}
LOGI("current_freq=%d, PAMD_Value=%d, orig_pi=%d\n", cur_freq, PAMD_Value, orig_pi);
/* Start to detect AF channels when orignal channel turn weak */
if (PAMD_Value < AF_PAMD_LBound) {
/* Make sure rds->AF_Data.AF_Num is valid */
af_list_backup.AF_Num = af_list_backup.AF_Num > 25 ? 25 : af_list_backup.AF_Num;
/* Precheck af list*/
for (i = 0, j = 0; i < af_list_backup.AF_Num; i++) {
set_freq = af_list_backup.AF[1][i];
if(set_freq < cfg_data->low_band || set_freq > cfg_data->high_band) {
/*band check fail*/
LOGI("AF[1][%d]:freq %d out of bandwidth[%d,%d], skip!\n",
i, af_list_backup.AF[1][i], cfg_data->low_band, cfg_data->high_band);
continue;
}
/* Using Com_Soft_Mute_Tune to query valid channel*/
memset(&smt_parm, 0, sizeof(fm_softmute_tune_t));
smt_parm.freq = set_freq;
COM_Soft_Mute_Tune(fd, &smt_parm);
LOGE("af list pre-check:freq %d, valid:%d\n", smt_parm.freq, smt_parm.valid);
if(smt_parm.valid == 1) {
/* Update valid AF channel to af_list*/
af_list.AF[1][j] = af_list_backup.AF[1][i];
j++;
af_list.AF_Num++;
}
}
/*AF switch process*/
for (i = 0; i < af_list.AF_Num; i++) {
set_freq = af_list.AF[1][i];
LOGI("set_freq[%d] = %d, org_freq = %d\n", i, set_freq, org_freq);
if (set_freq != org_freq) {
// Set mute to check every af channels
COM_set_mute(fd, 1);
parm.freq = set_freq;
ioctl(fd, FM_IOCTL_TUNE, &parm);
usleep(20 * 1000);
ioctl(fd, FM_IOCTL_GETCURPAMD, &PAMD_Level[i]);
/* If signal is not good enough, skip */
if (PAMD_Level[i] < AF_PAMD_HBound) {
LOGI("PAMD_Level[%d] =%d < AF_PAMD_HBound, continue", i, PAMD_Level[i]);
continue;
}
for (j = 0 ; j < 5; j++ ) {
usleep(200 * 1000);
/* Query pi to 5 times */
if (COM_get_af_pi(fd, &PI[i])) {
if (j == 4)
LOGE("get af pi fail\n");
continue;
} else
break;
}
if (orig_pi != PI[i]) {
LOGI("pi not match, current pi(%04x), orig pi(%04x)\n", PI[i], orig_pi);
continue;
}
LOGI("next_freq=%d, PAMD_Level[%d]=%d\n", parm.freq, i, PAMD_Level[i]);
/* To get largest PAMD */
/* This is a trade-off*/
/* If want to get a better quality AF channel, do as follows, it will spend longer to do AF switch*/
/* If want to mute shorter, just use one fixed PAMD_VALUE, don't need to compare */
if (PAMD_Level[i] > AF_PAMD_HBound) {
LOGI("PAMD_Level[%d] =%d > AF_PAMD_HBound, af switch", i, PAMD_Level[i]);
sw_freq = set_freq;
PAMD_Value = PAMD_Level[i];
break;
}
}
}
LOGI("AF deside tune to freq: %d, PAMD_Level: %d\n", sw_freq, PAMD_Value);
if ((PAMD_Value > AF_PAMD_HBound)&&(sw_freq != 0)) { /* Tune to AF channel */
parm.freq = sw_freq;
ioctl(fd, FM_IOCTL_TUNE, &parm);
cur_freq = parm.freq;
} else { /* Tune to orignal channel */
parm.freq = org_freq;
ioctl(fd, FM_IOCTL_TUNE, &parm);
cur_freq = parm.freq;
}
/* Unmute when finish AF switch */
COM_set_mute(fd, 0);
} else {
LOGD("RDS_EVENT_AF old freq:%d\n", org_freq);
}
*ret_freq = cur_freq;
return ret;
}
int COM_active_ta(int fd, RDSData_Struct *rds, int band, uint16_t cur_freq, uint16_t *backup_freq, uint16_t *ret_freq)
{
int ret = 0;
FMR_ASSERT(rds);
FMR_ASSERT(backup_freq);
FMR_ASSERT(ret_freq);
if(rds->event_status&RDS_EVENT_TAON){
uint16_t rds_on = 0;
struct fm_tune_parm parm;
uint16_t PAMD_Level[25];
uint16_t PAMD_DB_TBL[5] = {13, 17, 21, 25, 29};
uint16_t set_freq, sw_freq, org_freq, PAMD_Value, TA_PAMD_Threshold;
int i = 0;
rds_on = 0;
ioctl(fd, FM_IOCTL_RDS_ONOFF, &rds_on);
TA_PAMD_Threshold = PAMD_DB_TBL[2]; //15dB
sw_freq = cur_freq;
org_freq = cur_freq;
*backup_freq = org_freq;
parm.band = band;
parm.freq = sw_freq;
parm.hilo = FM_AUTO_HILO_OFF;
parm.space = COM_get_seek_space();
ioctl(fd, FM_IOCTL_GETCURPAMD, &PAMD_Value);
//make sure rds->AF_Data.AF_Num is valid
rds->AFON_Data.AF_Num = (rds->AFON_Data.AF_Num > 25)? 25 : rds->AFON_Data.AF_Num;
for(i=0; i< rds->AFON_Data.AF_Num; i++){
set_freq = rds->AFON_Data.AF[1][i];
LOGI("set_freq=0x%02x,org_freq=0x%02x\n", set_freq, org_freq);
if(set_freq != org_freq){
parm.freq = sw_freq;
ioctl(fd, FM_IOCTL_TUNE, &parm);
ioctl(fd, FM_IOCTL_GETCURPAMD, &PAMD_Level[i]);
if(PAMD_Level[i] > PAMD_Value){
PAMD_Value = PAMD_Level[i];
sw_freq = set_freq;
}
}
}
if((PAMD_Value > TA_PAMD_Threshold)&&(sw_freq != 0)){
rds->Switch_TP= 1;
parm.freq = sw_freq;
ioctl(fd, FM_IOCTL_TUNE, &parm);
cur_freq = parm.freq;
}else{
parm.freq = org_freq;
ioctl(fd, FM_IOCTL_TUNE, &parm);
cur_freq = parm.freq;
}
rds_on = 1;
ioctl(fd, FM_IOCTL_RDS_ONOFF, &rds_on);
}
*ret_freq = cur_freq;
return ret;
}
int COM_deactive_ta(int fd, RDSData_Struct *rds, int band, uint16_t cur_freq, uint16_t *backup_freq, uint16_t *ret_freq)
{
int ret = 0;
UNUSED(band);
FMR_ASSERT(rds);
FMR_ASSERT(backup_freq);
FMR_ASSERT(ret_freq);
if(rds->event_status&RDS_EVENT_TAON_OFF){
uint16_t rds_on = 0;
struct fm_tune_parm parm;
parm.band = FM_RAIDO_BAND;
parm.freq = *backup_freq;
parm.hilo = FM_AUTO_HILO_OFF;
parm.space = COM_get_seek_space();
ioctl(fd, FM_IOCTL_RDS_ONOFF, &rds_on);
ioctl(fd, FM_IOCTL_TUNE, &parm);
cur_freq = parm.freq;
rds_on = 1;
ioctl(fd, FM_IOCTL_RDS_ONOFF, &rds_on);
}
*ret_freq = cur_freq;
return ret;
}
int COM_ana_switch(int fd, int antenna)
{
int ret = 0;
ret = ioctl(fd, FM_IOCTL_ANA_SWITCH, &antenna);
if (ret < 0) {
LOGE("%s: fail, ret = %d\n", __func__, ret);
}
LOGD("%s: [ret = %d]\n", __func__, ret);
return ret;
}
int COM_get_badratio(int fd, int *badratio)
{
int ret = 0;
uint16_t tmp = 0;
ret = ioctl(fd, FM_IOCTL_GETBLERRATIO, &tmp);
*badratio = (int)tmp;
if (ret){
LOGE("%s, failed\n", __func__);
}
LOGD("%s, [fd=%d] [ret=%d]\n", __func__, fd, ret);
return ret;
}
int COM_get_stereomono(int fd, int *stemono)
{
int ret = 0;
uint16_t tmp = 0;
ret = ioctl(fd, FM_IOCTL_GETMONOSTERO, &tmp);
*stemono = (int)tmp;
if (ret){
LOGE("%s, failed\n", __func__);
}
LOGD("%s, [fd=%d] [ret=%d]\n", __func__, fd, ret);
return ret;
}
int COM_set_stereomono(int fd, int stemono)
{
int ret = 0;
ret = ioctl(fd, FM_IOCTL_SETMONOSTERO, &stemono);
if (ret){
LOGE("%s, failed\n", __func__);
}
LOGD("%s, [fd=%d] [ret=%d]\n", __func__, fd, ret);
return ret;
}
int COM_get_caparray(int fd, int *caparray)
{
int ret = 0;
int tmp = 0;
LOGD("%s, [fd=%d]\n", __func__, fd);
ret = ioctl(fd, FM_IOCTL_GETCAPARRAY, &tmp);
if (ret){
LOGE("%s, failed\n", __func__);
}
*caparray = tmp;
LOGD("%s, [fd=%d] [ret=%d]\n", __func__, fd, ret);
return ret;
}
int COM_get_hw_info(int fd, struct fm_hw_info *info)
{
int ret = 0;
ret = ioctl(fd, FM_IOCTL_GET_HW_INFO, info);
if(ret){
LOGE("%s, failed\n", __func__);
}
LOGD("%s, [fd=%d] [ret=%d]\n", __func__, fd, ret);
return ret;
}
/* COM_is_dese_chan -- check if gived channel is a de-sense channel or not
* @fd - fd of "dev/fm"
* @freq - gived channel
* return value: 0, not a dese chan; 1, a dese chan; else error NO.
*/
int COM_is_dese_chan(int fd, int freq)
{
int ret = 0;
int tmp = freq;
ret = ioctl(fd, FM_IOCTL_IS_DESE_CHAN, &freq);
if (ret < 0) {
LOGE("%s, failed,ret=%d\n", __func__,ret);
return ret;
} else {
LOGD("[fd=%d] %d --> dese=%d\n", fd, tmp, freq);
return freq;
}
}
/* COM_desense_check -- check if gived channel is a de-sense channel or not
* @fd - fd of "dev/fm"
* @freq - gived channel
* @rssi-freq's rssi
* return value: 0, is desense channel and rssi is less than threshold; 1, not desense channel or it is but rssi is more than threshold.
*/
int COM_desense_check(int fd, int freq, int rssi)
{
int ret = 0;
fm_desense_check_t parm;
parm.freq = freq;
parm.rssi = rssi;
ret = ioctl(fd, FM_IOCTL_DESENSE_CHECK, &parm);
if (ret < 0) {
LOGE("%s, failed,ret=%d\n", __func__,ret);
return ret;
} else {
LOGD("[fd=%d] %d --> dese=%d\n", fd,freq,ret);
return ret;
}
}
/*
th_idx:
threshold type: 0, RSSI. 1,desense RSSI. 2,SMG.
th_val: threshold value*/
int COM_set_search_threshold(int fd, int th_idx,int th_val)
{
int ret = 0;
fm_search_threshold_t th_parm;
th_parm.th_type = th_idx;
th_parm.th_val = th_val;
ret = ioctl(fd, FM_IOCTL_SET_SEARCH_THRESHOLD, &th_parm);
if (ret < 0)
{
LOGE("%s, failed,ret=%d\n", __func__,ret);
}
return ret;
}
int COM_full_cqi_logger(int fd, fm_full_cqi_log_t *log_parm)
{
int ret = 0;
ret = ioctl(fd, FM_IOCTL_FULL_CQI_LOG, log_parm);
if (ret < 0)
{
LOGE("%s, failed,ret=%d\n", __func__,ret);
}
return ret;
}
void FM_interface_init(struct fm_cbk_tbl *cbk_tbl)
{
//Basic functions.
cbk_tbl->open_dev = COM_open_dev;
cbk_tbl->close_dev = COM_close_dev;
cbk_tbl->pwr_up = COM_pwr_up;
cbk_tbl->pwr_down = COM_pwr_down;
cbk_tbl->tune = COM_tune;
cbk_tbl->set_mute = COM_set_mute;
cbk_tbl->is_rdsrx_support = COM_is_rdsrx_support;
cbk_tbl->turn_on_off_rds = COM_turn_on_off_rds;
cbk_tbl->get_chip_id = COM_get_chip_id;
//For RDS RX.
cbk_tbl->read_rds_data = COM_read_rds_data;
cbk_tbl->get_pi = COM_get_pi;
cbk_tbl->get_ps = COM_get_ps;
cbk_tbl->get_ecc = COM_get_ecc;
cbk_tbl->get_pty = COM_get_pty;
cbk_tbl->get_rssi = COM_get_rssi;
cbk_tbl->get_rt = COM_get_rt;
cbk_tbl->active_af = COM_active_af;
cbk_tbl->active_ta = COM_active_ta;
cbk_tbl->deactive_ta = COM_deactive_ta;
//FM short antenna
cbk_tbl->ana_switch = COM_ana_switch;
cbk_tbl->desense_check = COM_desense_check;
//RX EM mode use
cbk_tbl->get_badratio = COM_get_badratio;
cbk_tbl->get_stereomono = COM_get_stereomono;
cbk_tbl->set_stereomono = COM_set_stereomono;
cbk_tbl->get_caparray = COM_get_caparray;
cbk_tbl->get_cqi = COM_get_cqi;
cbk_tbl->is_dese_chan = COM_is_dese_chan;
cbk_tbl->desense_check = COM_desense_check;
cbk_tbl->get_hw_info = COM_get_hw_info;
//soft mute tune
cbk_tbl->soft_mute_tune = COM_Soft_Mute_Tune;
cbk_tbl->pre_search = COM_pre_search;
cbk_tbl->restore_search = COM_restore_search;
//EM
cbk_tbl->set_search_threshold = COM_set_search_threshold;
cbk_tbl->full_cqi_logger = COM_full_cqi_logger;
return;
}

263
libfmjni/custom.cpp Normal file
View file

@ -0,0 +1,263 @@
/* Copyright Statement:
*
* This software/firmware and related documentation ("MediaTek Software") are
* protected under relevant copyright laws. The information contained herein is
* confidential and proprietary to MediaTek Inc. and/or its licensors. Without
* the prior written permission of MediaTek inc. and/or its licensors, any
* reproduction, modification, use or disclosure of MediaTek Software, and
* information contained herein, in whole or in part, shall be strictly
* prohibited.
*
* MediaTek Inc. (C) 2010. All rights reserved.
*
* BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
* ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
* WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
* NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
* RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
* INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
* TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
* RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
* OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
* SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
* RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
* STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
* ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
* RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
* MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
* CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* The following software/firmware and/or related documentation ("MediaTek
* Software") have been modified by MediaTek Inc. All revisions are subject to
* any receiver's applicable license agreements with MediaTek Inc.
*/
#define MTK_LOG_ENABLE 1
#include <sys/types.h>
#include <stdbool.h>
#include <string.h>
#include <cutils/properties.h>
#include <cutils/log.h>
#include "fmr.h"
#include "fmlib_cust.h"
#undef LOGV
#define LOGV(...) ALOGV(__VA_ARGS__)
#undef LOGD
#define LOGD(...) ALOGD(__VA_ARGS__)
#undef LOGI
#define LOGI(...) ALOGI(__VA_ARGS__)
#undef LOGW
#define LOGW(...) ALOGW(__VA_ARGS__)
#undef LOGE
#define LOGE(...) ALOGE(__VA_ARGS__)
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "FMLIB_CUST"
#define MT6620_FM_FAKE_CHANNEL \
{ \
{10400, -40, -1}, \
{9100, -40, -1}, \
{9600, -40, -1}, \
{9220, -80, -1}, \
{0, 0, 0} \
}
#define MT6628_FM_FAKE_CHANNEL \
{ \
{0, 0, 0} \
}
#define MT6627_FM_FAKE_CHANNEL \
{ \
{9600, -107, -1}, \
{10400, -107, -1}, \
{10750, -224, -1}, \
{0, 0, 0} \
}
#define MT6580_FM_FAKE_CHANNEL \
{ \
{9600, -107, -1}, \
{9570, -258, -1}, \
{9580, -258, -1}, \
{9590, -258, -1}, \
{10400, -107, -1}, \
{0, 0, 0} \
}
#define MT6630_FM_FAKE_CHANNEL \
{ \
{9600,-107,-1}, \
{10400,-107,-1}, \
{0, 0, 0} \
}
#define MT6631_FM_FAKE_CHANNEL \
{ \
{9210, -205, -1}, \
{9600, -152, -1}, \
{10400, -152, -1}, \
{10750, -205, -1}, \
{0, 0, 0} \
}
#define MT6632_FM_FAKE_CHANNEL \
{ \
{9600, -107, -1}, \
{10400, -107, -1}, \
{0, 0, 0} \
}
static struct fm_fake_channel mt6620_fake_ch[] = MT6620_FM_FAKE_CHANNEL;
static struct fm_fake_channel mt6627_fake_ch[] = MT6627_FM_FAKE_CHANNEL;
static struct fm_fake_channel mt6628_fake_ch[] = MT6628_FM_FAKE_CHANNEL;
static struct fm_fake_channel mt6580_fake_ch[] = MT6580_FM_FAKE_CHANNEL;
static struct fm_fake_channel mt6630_fake_ch[] = MT6630_FM_FAKE_CHANNEL;
static struct fm_fake_channel mt6631_fake_ch[] = MT6631_FM_FAKE_CHANNEL;
static struct fm_fake_channel mt6632_fake_ch[] = MT6632_FM_FAKE_CHANNEL;
static struct fm_fake_channel_t fake_ch_info = {0, 0};
void CUST_update_cfg(struct CUST_cfg_ds *cfg, int chipid)
{
struct fm_fake_channel *fake_ch = NULL;
LOGI("update connsys chipid=0x%x\n", chipid);
switch (chipid)
{
case FM_CHIP_MT6580:
cfg->chip = FM_CHIP_MT6580;
fake_ch = mt6580_fake_ch;
break;
case FM_CHIP_MT6620:
cfg->chip = FM_CHIP_MT6620;
fake_ch = mt6620_fake_ch;
break;
case FM_CHIP_MT6627:
cfg->chip = FM_CHIP_MT6627;
fake_ch = mt6627_fake_ch;
break;
case FM_CHIP_MT6628:
cfg->chip = FM_CHIP_MT6628;
fake_ch = mt6628_fake_ch;
break;
case FM_CHIP_MT6630:
cfg->chip = FM_CHIP_MT6630;
fake_ch = mt6630_fake_ch;
break;
case FM_CHIP_MT6631:
cfg->chip = FM_CHIP_MT6631;
fake_ch = mt6631_fake_ch;
break;
case FM_CHIP_MT6632:
cfg->chip = FM_CHIP_MT6632;
fake_ch = mt6632_fake_ch;
break;
case FM_CHIP_MT6635:
cfg->chip = FM_CHIP_MT6635;
fake_ch = mt6631_fake_ch;
break;
default:
LOGE("not support chipid=0x%x\n", chipid);
break;
}
cfg->band = FM_RAIDO_BAND; // 1, UE; 2, JAPAN; 3, JAPANW
cfg->low_band = FM_FREQ_MIN * 10;
cfg->high_band = FM_FREQ_MAX * 10;
if (property_get_int32("persist.vendor.connsys.fm_50khz_support", 0) == 1) {
cfg->seek_space = 5; // FM radio seek space, 5:50KHZ; 1:100KHZ; 2:200KHZ
} else {
cfg->seek_space = 1;
}
cfg->max_scan_num = FM_MAX_CHL_SIZE;
cfg->seek_lev = FM_SEEKTH_LEVEL_DEFAULT;
cfg->scan_sort = FM_SCAN_SORT_SELECT;
if (property_get_int32("persist.vendor.connsys.fm_short_antenna_support", 0) == 1) {
cfg->short_ana_sup = fm_false;
} else {
cfg->short_ana_sup = fm_true;
}
cfg->rssi_th_l2 = FM_CHIP_DESE_RSSI_TH;
cfg->rssi_th_l2 = (cfg->rssi_th_l2 > -72) ? -72 : cfg->rssi_th_l2;
cfg->rssi_th_l2 = (cfg->rssi_th_l2 < -102) ? -102 : cfg->rssi_th_l2;
if (fake_ch) {
fake_ch_info.chan = fake_ch;
fake_ch_info.size = 0;
while (fake_ch[fake_ch_info.size].freq > 0) {
fake_ch_info.size++;
}
}
cfg->fake_chan = &fake_ch_info;
}
int CUST_get_cfg(struct CUST_cfg_ds *cfg)
{
char val[PROPERTY_VALUE_MAX] = {0};
int chipid = FM_CHIP_UNSUPPORTED;
if (property_get("persist.vendor.connsys.fm_chipid", val, NULL)) {
if (strcmp(val, "soc") == 0) {
chipid = FM_CHIP_MT6580;
} else if (strcmp(val, "mt6620") == 0) {
chipid = FM_CHIP_MT6620;
} else if (strcmp(val, "mt6627") == 0) {
chipid = FM_CHIP_MT6627;
} else if (strcmp(val, "mt6628") == 0) {
chipid = FM_CHIP_MT6628;
} else if (strcmp(val, "mt6630") == 0) {
chipid = FM_CHIP_MT6630;
} else if (strcmp(val, "mt6631") == 0) {
chipid = FM_CHIP_MT6631;
} else if (strcmp(val, "mt6632") == 0) {
chipid = FM_CHIP_MT6632;
} else if ((strcmp(val, "mt6635") == 0)
|| (strcmp(val, "connac2x") == 0)) {
chipid = FM_CHIP_MT6635;
}
}
if (chipid == FM_CHIP_UNSUPPORTED) {
if (property_get("vendor.connsys.fm.adie.chipid", val, NULL)) {
if (strcmp(val, "0x6631") == 0) {
chipid = FM_CHIP_MT6631;
} else if ((strcmp(val, "0x6635") == 0)
|| (strcmp(val, "0x6637") == 0)) {
chipid = FM_CHIP_MT6635;
} else {
LOGE("not support chipid=%s\n", val);
}
} else if (property_get("vendor.connsys.adie.chipid", val, NULL)) {
if (strcmp(val, "0x6631") == 0) {
chipid = FM_CHIP_MT6631;
} else if ((strcmp(val, "0x6635") == 0)
|| (strcmp(val, "0x6637") == 0)) {
chipid = FM_CHIP_MT6635;
} else {
LOGE("not support chipid=%s\n", val);
}
} else {
LOGE("get vendor.connsys.fm.adie.chipid fail\n");
}
}
CUST_update_cfg(cfg, chipid);
return 0;
}

547
libfmjni/fm.h Executable file
View file

@ -0,0 +1,547 @@
/*
* Copyright (C) 2014 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 __FM_H__
#define __FM_H__
#include <linux/ioctl.h>
#include <linux/time.h>
typedef signed char fm_s8;
typedef signed short fm_s16;
typedef signed int fm_s32;
typedef signed long long fm_s64;
typedef unsigned char fm_u8;
typedef unsigned short fm_u16;
typedef unsigned int fm_u32;
typedef unsigned long long fm_u64;
typedef enum fm_bool {
fm_false = 0,
fm_true = 1
} fm_bool;
// scan sort algorithm
enum {
FM_SCAN_SORT_NON = 0,
FM_SCAN_SORT_UP,
FM_SCAN_SORT_DOWN,
FM_SCAN_SORT_MAX
};
// scan methods
enum {
FM_SCAN_SEL_HW = 0, // select hardware scan, advantage: fast
FM_SCAN_SEL_SW, // select software scan, advantage: more accurate
FM_SCAN_SEL_MAX
};
//*****************************************************************************************
//***********************************FM config for customer *******************************
//*****************************************************************************************
#define FMR_RSSI_TH_LONG 0x0301 // FM radio long antenna RSSI threshold(11.375dBuV)
#define FMR_RSSI_TH_SHORT 0x02E0 // FM radio short antenna RSSI threshold(-1dBuV)
#define FMR_CQI_TH 0x00E9 // FM radio Channel quality indicator threshold(0x0000~0x00FF)
#define FMR_SEEK_SPACE 1 // FM radio seek space,1:100KHZ; 2:200KHZ
#define FMR_SCAN_CH_SIZE 40 // FM radio scan max channel size
#define FMR_BAND 1 // FM radio band, 1:87.5MHz~108.0MHz; 2:76.0MHz~90.0MHz;
// 3:76.0MHz~108.0MHz; 4:special
#define FMR_BAND_FREQ_L 875 // FM radio special band low freq(Default 87.5MHz)
#define FMR_BAND_FREQ_H 1080 // FM radio special band high freq(Default 108.0MHz)
#define FM_SCAN_SORT_SELECT FM_SCAN_SORT_NON
#define FM_SCAN_SELECT FM_SCAN_SEL_HW
#define FM_SCAN_SOFT_MUTE_GAIN_TH 3 // soft-mute threshold when software scan, rang: 0~3,
// 0 means better audio quality but less channel
#define FM_CHIP_DESE_RSSI_TH (-102) // rang: -102 ~ -72
//*****************************************************************************************
//***********************************FM config for engineer *******************************
//*****************************************************************************************
#define FMR_MR_TH 0x01BD // FM radio MR threshold
#define ADDR_SCAN_TH 0xE0 // scan thrshold register
#define ADDR_CQI_TH 0xE1 // scan CQI register
//*****************************************************************************************
#define FM_NAME "fm"
#define FM_DEVICE_NAME "/dev/fm"
// errno
#define FM_SUCCESS 0
#define FM_FAILED 1
#define FM_EPARM 2
#define FM_BADSTATUS 3
#define FM_TUNE_FAILED 4
#define FM_SEEK_FAILED 5
#define FM_BUSY 6
#define FM_SCAN_FAILED 7
// band
#define FM_BAND_UNKNOWN 0
#define FM_BAND_UE 1 // US/Europe band 87.5MHz ~ 108MHz (DEFAULT)
#define FM_BAND_JAPAN 2 // Japan band 76MHz ~ 90MHz
#define FM_BAND_JAPANW 3 // Japan wideband 76MHZ ~ 108MHz
#define FM_BAND_SPECIAL 4 // special band between 76MHZ and 108MHz
#define FM_BAND_DEFAULT FM_BAND_UE
#define FM_UE_FREQ_MIN 875
#define FM_UE_FREQ_MAX 1080
#define FM_JP_FREQ_MIN 760
#define FM_JP_FREQ_MAX 1080
#define FM_FREQ_MIN FMR_BAND_FREQ_L
#define FM_FREQ_MAX FMR_BAND_FREQ_H
#define FM_RAIDO_BAND FM_BAND_UE
// space
#define FM_SPACE_UNKNOWN 0
#define FM_SPACE_100K 1
#define FM_SPACE_200K 2
#define FM_SPACE_50K 5
#define FM_SPACE_DEFAULT FM_SPACE_100K
#define FM_SEEK_SPACE FMR_SEEK_SPACE
// max scan channel num
#define FM_MAX_CHL_SIZE FMR_SCAN_CH_SIZE
// auto HiLo
#define FM_AUTO_HILO_OFF 0
#define FM_AUTO_HILO_ON 1
// seek direction
#define FM_SEEK_UP 0
#define FM_SEEK_DOWN 1
// seek threshold
#define FM_SEEKTH_LEVEL_DEFAULT 4
struct fm_tune_parm {
uint8_t err;
uint8_t band;
uint8_t space;
uint8_t hilo;
uint8_t deemphasis;
uint16_t freq;
};
struct fm_seek_parm {
uint8_t err;
uint8_t band;
uint8_t space;
uint8_t hilo;
uint8_t seekdir;
uint8_t seekth;
uint16_t freq;
};
struct fm_scan_parm {
uint8_t err;
uint8_t band;
uint8_t space;
uint8_t hilo;
uint16_t freq;
uint16_t ScanTBL[16];
uint16_t ScanTBLSize;
};
struct fm_ch_rssi {
uint16_t freq;
int rssi;
};
enum fm_scan_cmd_t {
FM_SCAN_CMD_INIT = 0,
FM_SCAN_CMD_START,
FM_SCAN_CMD_GET_NUM,
FM_SCAN_CMD_GET_CH,
FM_SCAN_CMD_GET_RSSI,
FM_SCAN_CMD_GET_CH_RSSI,
FM_SCAN_CMD_MAX
};
struct fm_scan_t {
enum fm_scan_cmd_t cmd;
int ret; // 0, success; else error code
uint16_t lower; // lower band, Eg, 7600 -> 76.0Mhz
uint16_t upper; // upper band, Eg, 10800 -> 108.0Mhz
int space; // 5: 50KHz, 10: 100Khz, 20: 200Khz
int num; // valid channel number
void *priv;
int sr_size; // scan result buffer size in bytes
union {
uint16_t *ch_buf; // channel buffer
int *rssi_buf; // rssi buffer
struct fm_ch_rssi *ch_rssi_buf; //channel and RSSI buffer
} sr;
};
struct fm_seek_t {
int ret; // 0, success; else error code
uint16_t freq;
uint16_t lower; // lower band, Eg, 7600 -> 76.0Mhz
uint16_t upper; // upper band, Eg, 10800 -> 108.0Mhz
int space; // 5: 50KHz, 10: 100Khz, 20: 200Khz
int dir; // 0: up; 1: down
int th; // seek threshold in dbm(Eg, -95dbm)
void *priv;
};
struct fm_tune_t {
int ret; // 0, success; else error code
uint16_t freq;
uint16_t lower; // lower band, Eg, 7600 -> 76.0Mhz
uint16_t upper; // upper band, Eg, 10800 -> 108.0Mhz
int space; // 5: 50KHz, 10: 100Khz, 20: 200Khz
void *priv;
};
struct fm_softmute_tune_t {
fm_s32 rssi; // RSSI of current channel
fm_u16 freq; // current frequency
fm_bool valid; // current channel is valid(true) or not(false)
};
struct fm_rssi_req {
uint16_t num;
uint16_t read_cnt;
struct fm_ch_rssi cr[16*16];
};
struct fm_hw_info {
int chip_id;
int eco_ver;
int rom_ver;
int patch_ver;
int reserve;
};
struct fm_search_threshold_t {
fm_s32 th_type;// 0, RSSI. 1,desense RSSI. 2,SMG.
fm_s32 th_val; //threshold value
fm_s32 reserve;
};
#define NEED_DEF_RDS 1
#if NEED_DEF_RDS
//For RDS feature
typedef struct {
uint8_t TP;
uint8_t TA;
uint8_t Music;
uint8_t Stereo;
uint8_t Artificial_Head;
uint8_t Compressed;
uint8_t Dynamic_PTY;
uint8_t Text_AB;
uint32_t flag_status;
} RDSFlag_Struct;
typedef struct {
uint16_t Month;
uint16_t Day;
uint16_t Year;
uint16_t Hour;
uint16_t Minute;
uint8_t Local_Time_offset_signbit;
uint8_t Local_Time_offset_half_hour;
} CT_Struct;
typedef struct {
int16_t AF_Num;
int16_t AF[2][25];
uint8_t Addr_Cnt;
uint8_t isMethod_A;
uint8_t isAFNum_Get;
} AF_Info;
typedef struct {
uint8_t PS[4][8];
uint8_t Addr_Cnt;
} PS_Info;
typedef struct {
uint8_t TextData[4][64];
uint8_t GetLength;
uint8_t isRTDisplay;
uint8_t TextLength;
uint8_t isTypeA;
uint8_t BufCnt;
uint16_t Addr_Cnt;
} RT_Info;
struct rds_raw_data {
int dirty; // indicate if the data changed or not
int len; // the data len form chip
uint8_t data[148];
};
struct rds_group_cnt {
unsigned int total;
unsigned int groupA[16]; // RDS groupA counter
unsigned int groupB[16]; // RDS groupB counter
};
enum rds_group_cnt_opcode {
RDS_GROUP_CNT_READ = 0,
RDS_GROUP_CNT_WRITE,
RDS_GROUP_CNT_RESET,
RDS_GROUP_CNT_MAX
};
struct rds_group_cnt_req {
int err;
enum rds_group_cnt_opcode op;
struct rds_group_cnt gc;
};
typedef struct {
CT_Struct CT;
RDSFlag_Struct RDSFlag;
uint16_t PI;
uint8_t Switch_TP;
uint8_t PTY;
AF_Info AF_Data;
AF_Info AFON_Data;
uint8_t Radio_Page_Code;
uint16_t Program_Item_Number_Code;
uint8_t Extend_Country_Code;
uint16_t Language_Code;
PS_Info PS_Data;
uint8_t PS_ON[8];
RT_Info RT_Data;
uint16_t event_status;
struct rds_group_cnt gc;
} RDSData_Struct;
//valid Rds Flag for notify
typedef enum {
RDS_FLAG_IS_TP = 0x0001, // Program is a traffic program
RDS_FLAG_IS_TA = 0x0002, // Program currently broadcasts a traffic ann.
RDS_FLAG_IS_MUSIC = 0x0004, // Program currently broadcasts music
RDS_FLAG_IS_STEREO = 0x0008, // Program is transmitted in stereo
RDS_FLAG_IS_ARTIFICIAL_HEAD = 0x0010, // Program is an artificial head recording
RDS_FLAG_IS_COMPRESSED = 0x0020, // Program content is compressed
RDS_FLAG_IS_DYNAMIC_PTY = 0x0040, // Program type can change
RDS_FLAG_TEXT_AB = 0x0080 // If this flag changes state, a new radio text string begins
} RdsFlag;
typedef enum {
RDS_EVENT_FLAGS = 0x0001, // One of the RDS flags has changed state
RDS_EVENT_PI_CODE = 0x0002, // The program identification code has changed
RDS_EVENT_PTY_CODE = 0x0004, // The program type code has changed
RDS_EVENT_PROGRAMNAME = 0x0008, // The program name has changed
RDS_EVENT_UTCDATETIME = 0x0010, // A new UTC date/time is available
RDS_EVENT_LOCDATETIME = 0x0020, // A new local date/time is available
RDS_EVENT_LAST_RADIOTEXT = 0x0040, // A radio text string was completed
RDS_EVENT_AF = 0x0080, // Current Channel RF signal strength too weak, need do AF switch
RDS_EVENT_AF_LIST = 0x0100, // An alternative frequency list is ready
RDS_EVENT_AFON_LIST = 0x0200, // An alternative frequency list is ready
RDS_EVENT_TAON = 0x0400, // Other Network traffic announcement start
RDS_EVENT_TAON_OFF = 0x0800, // Other Network traffic announcement finished.
RDS_EVENT_ECC_CODE = 0x1000, /* ECC code */
RDS_EVENT_RDS = 0x2000, // RDS Interrupt had arrived durint timer period
RDS_EVENT_NO_RDS = 0x4000, // RDS Interrupt not arrived durint timer period
RDS_EVENT_RDS_TIMER = 0x8000 // Timer for RDS Bler Check. ---- BLER block error rate
} RdsEvent;
#endif
typedef enum {
FM_I2S_ON = 0,
FM_I2S_OFF,
FM_I2S_STATE_ERR
} fm_i2s_state_e;
typedef enum {
FM_I2S_MASTER = 0,
FM_I2S_SLAVE,
FM_I2S_MODE_ERR
} fm_i2s_mode_e;
typedef enum {
FM_I2S_32K = 0,
FM_I2S_44K,
FM_I2S_48K,
FM_I2S_SR_ERR
} fm_i2s_sample_e;
struct fm_i2s_setting {
int onoff;
int mode;
int sample;
};
typedef enum {
FM_RX = 0,
FM_TX = 1
} FM_PWR_T;
typedef struct fm_i2s_info {
int status; /* 0:FM_I2S_ON, 1:FM_I2S_OFF,2:error */
int mode; /* 0:FM_I2S_MASTER, 1:FM_I2S_SLAVE,2:error */
int rate; /* 0:FM_I2S_32K:32000,1:FM_I2S_44K:44100,2:FM_I2S_48K:48000,3:error */
} fm_i2s_info_t;
typedef enum {
FM_AUD_ANALOG = 0,
FM_AUD_I2S = 1,
FM_AUD_MRGIF = 2,
FM_AUD_ERR
} fm_audio_path_e;
typedef enum {
FM_I2S_PAD_CONN = 0,
FM_I2S_PAD_IO = 1,
FM_I2S_PAD_ERR
} fm_i2s_pad_sel_e;
typedef struct fm_audio_info {
fm_audio_path_e aud_path;
fm_i2s_info_t i2s_info;
fm_i2s_pad_sel_e i2s_pad;
} fm_audio_info_t;
struct fm_cqi {
int ch;
int rssi;
int reserve;
};
struct fm_cqi_req {
uint16_t ch_num;
int buf_size;
char *cqi_buf;
};
typedef struct {
int freq;
int rssi;
} fm_desense_check_t;
typedef struct {
uint16_t lower; // lower band, Eg, 7600 -> 76.0Mhz
uint16_t upper; // upper band, Eg, 10800 -> 108.0Mhz
int space; // 0x1: 50KHz, 0x2: 100Khz, 0x4: 200Khz
int cycle; // repeat times
} fm_full_cqi_log_t;
// ********** ***********FM IOCTL define start *******************************
#define FM_IOC_MAGIC 0xf5
#define FM_IOCTL_POWERUP _IOWR(FM_IOC_MAGIC, 0, struct fm_tune_parm*)
#define FM_IOCTL_POWERDOWN _IOWR(FM_IOC_MAGIC, 1, int32_t*)
#define FM_IOCTL_TUNE _IOWR(FM_IOC_MAGIC, 2, struct fm_tune_parm*)
#define FM_IOCTL_SEEK _IOWR(FM_IOC_MAGIC, 3, struct fm_seek_parm*)
#define FM_IOCTL_SETVOL _IOWR(FM_IOC_MAGIC, 4, uint32_t*)
#define FM_IOCTL_GETVOL _IOWR(FM_IOC_MAGIC, 5, uint32_t*)
#define FM_IOCTL_MUTE _IOWR(FM_IOC_MAGIC, 6, uint32_t*)
#define FM_IOCTL_GETRSSI _IOWR(FM_IOC_MAGIC, 7, int32_t*)
#define FM_IOCTL_SCAN _IOWR(FM_IOC_MAGIC, 8, struct fm_scan_parm*)
#define FM_IOCTL_STOP_SCAN _IO(FM_IOC_MAGIC, 9)
//IOCTL and struct for test
#define FM_IOCTL_GETCHIPID _IOWR(FM_IOC_MAGIC, 10, uint16_t*)
#define FM_IOCTL_EM_TEST _IOWR(FM_IOC_MAGIC, 11, struct fm_em_parm*)
#define FM_IOCTL_RW_REG _IOWR(FM_IOC_MAGIC, 12, struct fm_ctl_parm*)
#define FM_IOCTL_GETMONOSTERO _IOWR(FM_IOC_MAGIC, 13, uint16_t*)
#define FM_IOCTL_GETCURPAMD _IOWR(FM_IOC_MAGIC, 14, uint16_t*)
#define FM_IOCTL_GETGOODBCNT _IOWR(FM_IOC_MAGIC, 15, uint16_t*)
#define FM_IOCTL_GETBADBNT _IOWR(FM_IOC_MAGIC, 16, uint16_t*)
#define FM_IOCTL_GETBLERRATIO _IOWR(FM_IOC_MAGIC, 17, uint16_t*)
//IOCTL for RDS
#define FM_IOCTL_RDS_ONOFF _IOWR(FM_IOC_MAGIC, 18, uint16_t*)
#define FM_IOCTL_RDS_SUPPORT _IOWR(FM_IOC_MAGIC, 19, int32_t*)
#define FM_IOCTL_RDS_SIM_DATA _IOWR(FM_IOC_MAGIC, 23, uint32_t*)
#define FM_IOCTL_IS_FM_POWERED_UP _IOWR(FM_IOC_MAGIC, 24, uint32_t*)
//IOCTL for FM over BT
#define FM_IOCTL_OVER_BT_ENABLE _IOWR(FM_IOC_MAGIC, 29, int32_t*)
//IOCTL for FM ANTENNA SWITCH
#define FM_IOCTL_ANA_SWITCH _IOWR(FM_IOC_MAGIC, 30, int32_t*)
#define FM_IOCTL_GETCAPARRAY _IOWR(FM_IOC_MAGIC, 31, int32_t*)
//IOCTL for FM I2S Setting
#define FM_IOCTL_I2S_SETTING _IOWR(FM_IOC_MAGIC, 33, struct fm_i2s_setting*)
#define FM_IOCTL_RDS_GROUPCNT _IOWR(FM_IOC_MAGIC, 34, struct rds_group_cnt_req*)
#define FM_IOCTL_RDS_GET_LOG _IOWR(FM_IOC_MAGIC, 35, struct rds_raw_data*)
#define FM_IOCTL_SCAN_GETRSSI _IOWR(FM_IOC_MAGIC, 36, struct fm_rssi_req*)
#define FM_IOCTL_SETMONOSTERO _IOWR(FM_IOC_MAGIC, 37, int32_t)
#define FM_IOCTL_RDS_BC_RST _IOWR(FM_IOC_MAGIC, 38, int32_t*)
#define FM_IOCTL_CQI_GET _IOWR(FM_IOC_MAGIC, 39, struct fm_cqi_req*)
#define FM_IOCTL_GET_HW_INFO _IOWR(FM_IOC_MAGIC, 40, struct fm_hw_info*)
#define FM_IOCTL_GET_I2S_INFO _IOWR(FM_IOC_MAGIC, 41, fm_i2s_info_t*)
#define FM_IOCTL_IS_DESE_CHAN _IOWR(FM_IOC_MAGIC, 42, int32_t*)
#define FM_IOCTL_TOP_RDWR _IOWR(FM_IOC_MAGIC, 43, struct fm_top_rw_parm*)
#define FM_IOCTL_HOST_RDWR _IOWR(FM_IOC_MAGIC, 44, struct fm_host_rw_parm*)
#define FM_IOCTL_PRE_SEARCH _IOWR(FM_IOC_MAGIC, 45,int32_t)
#define FM_IOCTL_RESTORE_SEARCH _IOWR(FM_IOC_MAGIC, 46,int32_t)
#define FM_IOCTL_SET_SEARCH_THRESHOLD _IOWR(FM_IOC_MAGIC, 47, fm_search_threshold_t*)
#define FM_IOCTL_GET_AUDIO_INFO _IOWR(FM_IOC_MAGIC, 48, fm_audio_info_t*)
#define FM_IOCTL_SCAN_NEW _IOWR(FM_IOC_MAGIC, 60, struct fm_scan_t*)
#define FM_IOCTL_SEEK_NEW _IOWR(FM_IOC_MAGIC, 61, struct fm_seek_t*)
#define FM_IOCTL_TUNE_NEW _IOWR(FM_IOC_MAGIC, 62, struct fm_tune_t*)
#define FM_IOCTL_SOFT_MUTE_TUNE _IOWR(FM_IOC_MAGIC, 63, struct fm_softmute_tune_t*)/*for soft mute tune*/
#define FM_IOCTL_DESENSE_CHECK _IOWR(FM_IOC_MAGIC, 64, fm_desense_check_t*)
//IOCTL for EM
#define FM_IOCTL_FULL_CQI_LOG _IOWR(FM_IOC_MAGIC, 70, fm_full_cqi_log_t *)
#define FM_IOCTL_DUMP_REG _IO(FM_IOC_MAGIC, 0xFF)
// ********** ***********FM IOCTL define end *******************************
enum group_idx {
mono = 0,
stereo,
RSSI_threshold,
HCC_Enable,
PAMD_threshold,
Softmute_Enable,
De_emphasis,
HL_Side,
Demod_BW,
Dynamic_Limiter,
Softmute_Rate,
AFC_Enable,
Softmute_Level,
Analog_Volume,
GROUP_TOTAL_NUMS
};
enum item_idx {
Sblend_OFF = 0,
Sblend_ON,
ITEM_TOTAL_NUMS
};
struct fm_ctl_parm {
uint8_t err;
uint8_t addr;
uint16_t val;
uint16_t rw_flag; // 0:write, 1:read
};
struct fm_em_parm {
uint16_t group_idx;
uint16_t item_idx;
uint32_t item_value;
};
#endif // __FM_H__

66
libfmjni/fmlib_cust.h Normal file
View file

@ -0,0 +1,66 @@
/* Copyright Statement:
*
* This software/firmware and related documentation ("MediaTek Software") are
* protected under relevant copyright laws. The information contained herein is
* confidential and proprietary to MediaTek Inc. and/or its licensors. Without
* the prior written permission of MediaTek inc. and/or its licensors, any
* reproduction, modification, use or disclosure of MediaTek Software, and
* information contained herein, in whole or in part, shall be strictly
* prohibited.
*
* MediaTek Inc. (C) 2010. All rights reserved.
*
* BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
* ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
* WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
* NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
* RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
* INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
* TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
* RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
* OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
* SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
* RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
* STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
* ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
* RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
* MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
* CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* The following software/firmware and/or related documentation ("MediaTek
* Software") have been modified by MediaTek Inc. All revisions are subject to
* any receiver's applicable license agreements with MediaTek Inc.
*/
#ifndef __FMLIB_CUST_H__
#define __FMLIB_CUST_H__
#define FM_CHIP_MT6616 0x6616
#define FM_CHIP_MT6620 0x6620
#define FM_CHIP_MT6626 0x6626
#define FM_CHIP_MT6628 0x6628
#define FM_CHIP_MT6627 0x6627
#define FM_CHIP_MT6580 0x6580
#define FM_CHIP_MT6630 0x6630
#define FM_CHIP_MT6631 0x6631
#define FM_CHIP_MT6632 0x6632
#define FM_CHIP_MT6635 0x6635
#define FM_CHIP_UNSUPPORTED -1
#define FM_JNI_SCAN_SPACE_50K 5
#define FM_JNI_SCAN_SPACE_100K 1
#define FM_JNI_SCAN_SPACE_200K 2
/*implement fm scan by soft mute tune
change to 0 will scan by orginal way*/
#define FMR_SOFT_MUTE_TUEN_SCAN 1
#define FMR_NOISE_FLOORT_DETECT 1
#define RSSI_TH -296
#define FM_SEVERE_RSSI_TH -107 // 67dBuV
#define FM_NOISE_FLOOR_OFFSET 10
#endif // __FMLIB_CUST_H__

276
libfmjni/fmr.h Executable file
View file

@ -0,0 +1,276 @@
/*
* Copyright (C) 2014 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 __FMR_H__
#define __FMR_H__
#include <jni.h>
#include <utils/Log.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <termios.h>
#include <pthread.h>
#include <signal.h>
#include <errno.h>
#include <dlfcn.h>
#include "fm.h"
#include "fmlib_cust.h"
#undef LOGV
#define LOGV(...) ALOGV(__VA_ARGS__)
#undef LOGD
#define LOGD(...) ALOGD(__VA_ARGS__)
#undef LOGI
#define LOGI(...) ALOGI(__VA_ARGS__)
#undef LOGW
#define LOGW(...) ALOGW(__VA_ARGS__)
#undef LOGE
#define LOGE(...) ALOGE(__VA_ARGS__)
#define FM_DEV_NAME "/dev/fm"
#define FM_RDS_PS_LEN 8
struct fm_fake_channel
{
int freq;
int rssi_th;
int reserve;
};
struct fm_fake_channel_t
{
int size;
struct fm_fake_channel *chan;
};
struct CUST_cfg_ds
{
int16_t chip;
int32_t band;
int32_t low_band;
int32_t high_band;
int32_t seek_space;
int32_t max_scan_num;
int32_t seek_lev;
int32_t scan_sort;
int32_t short_ana_sup;
int32_t rssi_th_l2;
struct fm_fake_channel_t *fake_chan;
};
struct fm_cbk_tbl {
//Basic functions.
int (*open_dev)(const char *pname, int *fd);
int (*close_dev)(int fd);
int (*pwr_up)(int fd, int band, int freq);
int (*pwr_down)(int fd, int type);
int (*seek)(int fd, int *freq, int band, int dir, int lev);
int (*scan)(int fd, uint16_t *tbl, int *num, int band, int sort);
int (*fastget_rssi)(int fd, struct fm_rssi_req *rssi_req);
int (*get_cqi)(int fd, int num, char *buf, int buf_len);
int (*stop_scan)(int fd);
int (*tune)(int fd, int freq, int band);
int (*set_mute)(int fd, int mute);
int (*is_fm_pwrup)(int fd, int *pwrup);
int (*is_rdsrx_support)(int fd, int *supt);
int (*turn_on_off_rds)(int fd, int onoff);
int (*get_chip_id)(int fd, int *chipid);
//FOR RDS RX.
int (*read_rds_data)(int fd, RDSData_Struct *rds, uint16_t *rds_status);
int (*get_pi)(int fd, RDSData_Struct *rds, uint16_t *pi);
int (*get_ecc)(int fd, RDSData_Struct *rds, uint8_t *ecc);
int (*get_ps)(int fd, RDSData_Struct *rds, uint8_t **ps, int *ps_len);
int (*get_pty)(int fd, RDSData_Struct *rds, uint8_t *pty);
int (*get_rssi)(int fd, int *rssi);
int (*get_rt)(int fd, RDSData_Struct *rds, uint8_t **rt, int *rt_len);
int (*active_af)(int fd, RDSData_Struct *rds, CUST_cfg_ds *cfg, uint16_t orig_pi, uint16_t cur_freq, uint16_t *ret_freq);
int (*active_ta)(int fd, RDSData_Struct *rds, int band, uint16_t cur_freq, uint16_t *backup_freq, uint16_t *ret_freq);
int (*deactive_ta)(int fd, RDSData_Struct *rds, int band, uint16_t cur_freq, uint16_t *backup_freq, uint16_t *ret_freq);
//FM long/short antenna switch
int (*ana_switch)(int fd, int antenna);
//For FM RX EM mode
int (*get_badratio)(int fd, int *badratio);
int (*get_stereomono)(int fd, int *stemono);
int (*set_stereomono)(int fd, int stemono);
int (*get_caparray)(int fd, int *caparray);
int (*get_hw_info)(int fd, struct fm_hw_info *info);
int (*is_dese_chan)(int fd, int freq);
int (*soft_mute_tune)(int fd, fm_softmute_tune_t *para);
int (*desense_check)(int fd, int freq, int rssi);
int (*set_search_threshold)(int fd, int th_idx,int th_val);
int (*full_cqi_logger)(int fd,fm_full_cqi_log_t *log_parm);
/*New search*/
int (*pre_search)(int fd);
int (*restore_search)(int fd);
};
typedef int (*CUST_func_type)(struct CUST_cfg_ds *);
typedef void (*init_func_type)(struct fm_cbk_tbl *);
struct fmr_ds {
int fd;
int err;
uint16_t cur_freq;
uint16_t backup_freq;
void *priv;
void *custom_handler;
struct CUST_cfg_ds cfg_data;
struct fm_cbk_tbl tbl;
CUST_func_type get_cfg;
void *init_handler;
init_func_type init_func;
RDSData_Struct rds;
struct fm_hw_info hw_info;
fm_bool scan_stop;
};
enum fmr_err_em {
ERR_SUCCESS = 1000, // kernel error begin at here
ERR_INVALID_BUF,
ERR_INVALID_PARA,
ERR_STP,
ERR_GET_MUTEX,
ERR_FW_NORES,
ERR_RDS_CRC,
ERR_INVALID_FD, // native error begin at here
ERR_UNSUPPORT_CHIP,
ERR_LD_LIB,
ERR_FIND_CUST_FNUC,
ERR_UNINIT,
ERR_NO_MORE_IDX,
ERR_RDS_NO_DATA,
ERR_UNSUPT_SHORTANA,
ERR_MAX
};
enum fmr_rds_onoff {
FMR_RDS_ON,
FMR_RDS_OFF,
FMR_MAX
};
typedef enum {
FM_LONG_ANA = 0,
FM_SHORT_ANA
} fm_antenna_type;
#define CQI_CH_NUM_MAX 255
#define CQI_CH_NUM_MIN 0
/****************** Function declaration ******************/
//fmr_err.cpp
char *FMR_strerr();
void FMR_seterr(int err);
//fmr_core.cpp
int FMR_init(void);
int FMR_get_cfgs(int idx);
int FMR_open_dev(int idx);
int FMR_close_dev(int idx);
int FMR_pwr_up(int idx, int freq);
int FMR_pwr_down(int idx, int type);
int FMR_seek(int idx, int start_freq, int dir, int *ret_freq);
int FMR_scan(int idx, uint16_t *tbl, int *num);
int FMR_stop_scan(int idx);
int FMR_tune(int idx, int freq);
int FMR_set_mute(int idx, int mute);
int FMR_is_fm_pwrup(int idx, int *pwrup);
int FMR_is_rdsrx_support(int idx, int *supt);
int FMR_turn_on_off_rds(int idx, int onoff);
int FMR_get_chip_id(int idx, int *chipid);
int FMR_read_rds_data(int idx, uint16_t *rds_status);
int FMR_get_pi(int idx, uint16_t *pi);
int FMR_get_ecc(int idx, uint8_t *ecc);
int FMR_get_ps(int idx, uint8_t **ps, int *ps_len);
int FMR_get_pty(int idx, uint8_t *pty);
int FMR_get_rssi(int idx, int *rssi);
int FMR_get_rt(int idx, uint8_t **rt, int *rt_len);
int FMR_active_af(int idx, uint16_t orig_pi, uint16_t *ret_freq);
int FMR_active_ta(int idx, uint16_t *ret_freq);
int FMR_deactive_ta(int idx, uint16_t *ret_freq);
int FMR_ana_switch(int idx, int antenna);
int FMR_get_badratio(int idx, int *badratio);
int FMR_get_stereomono(int idx, int *stemono);
int FMR_set_stereomono(int idx, int stemono);
int FMR_get_caparray(int idx, int *caparray);
int FMR_get_hw_info(int idx, int **info, int *info_len);
int FMR_Pre_Search(int idx);
int FMR_Restore_Search(int idx);
int FMR_EMSetTH(int idx, int th_idx, int th_val);
int FMR_EM_CQI_logger(int idx,uint16_t cycle);
void FM_interface_init(struct fm_cbk_tbl *cbk_tbl);
//common part
int COM_open_dev(const char *pname, int *fd);
int COM_close_dev(int fd);
int COM_pwr_up(int fd, int band, int freq);
int COM_pwr_down(int fd, int type);
int COM_seek(int fd, int *freq, int band, int dir, int lev);
int COM_Soft_Mute_Tune(int fd, fm_softmute_tune_t *para);
int COM_fastget_rssi(int fd, struct fm_rssi_req *rssi_req);
int COM_get_cqi(int fd, int num, char *buf, int buf_len);
int COM_stop_scan(int fd);
int COM_tune(int fd, int freq, int band);
int COM_set_mute(int fd, int mute);
int COM_is_fm_pwrup(int fd, int *pwrup);
int COM_is_rdsrx_support(int fd, int *supt);
int COM_turn_on_off_rds(int fd, int onoff);
int COM_get_chip_id(int fd, int *chipid);
int COM_read_rds_data(int fd, RDSData_Struct *rds, uint16_t *rds_status);
int COM_get_pi(int fd, RDSData_Struct *rds, uint16_t *pi);
int COM_get_ps(int fd, RDSData_Struct *rds, uint8_t **ps, int *ps_len);
int COM_get_pty(int fd, RDSData_Struct *rds, uint8_t *pty);
int COM_get_rssi(int fd, int *rssi);
int COM_get_rt(int fd, RDSData_Struct *rds, uint8_t **rt, int *rt_len);
int COM_active_af(int fd, RDSData_Struct *rds, CUST_cfg_ds *cfg, uint16_t orig_pi, uint16_t cur_freq, uint16_t *ret_freq);
int COM_active_ta(int fd, RDSData_Struct *rds, int band, uint16_t cur_freq, uint16_t *backup_freq, uint16_t *ret_freq);
int COM_deactive_ta(int fd, RDSData_Struct *rds, int band, uint16_t cur_freq, uint16_t *backup_freq, uint16_t *ret_freq);
int COM_ana_switch(int fd, int antenna);
int COM_get_badratio(int fd, int *badratio);
int COM_get_stereomono(int fd, int *stemono);
int COM_set_stereomono(int fd, int stemono);
int COM_get_caparray(int fd, int *caparray);
int COM_get_hw_info(int fd, struct fm_hw_info *info);
int COM_is_dese_chan(int fd, int freq);
int COM_desense_check(int fd, int freq, int rssi);
int COM_pre_search(int fd);
int COM_restore_search(int fd);
int COM_set_search_threshold(int fd, int th_idx,int th_val);
int COM_full_cqi_logger(int fd, fm_full_cqi_log_t *log_parm);
void CUST_update_cfg(struct CUST_cfg_ds *cfg, int chipid);
int CUST_get_cfg(struct CUST_cfg_ds *cfg);
#define FMR_ASSERT(a) { \
if ((a) == NULL) { \
LOGE("%s,invalid buf\n", __func__);\
return -ERR_INVALID_BUF; \
} \
}
#endif

1264
libfmjni/fmr_core.cpp Executable file

File diff suppressed because it is too large Load diff

45
libfmjni/fmr_err.cpp Executable file
View file

@ -0,0 +1,45 @@
/*
* Copyright (C) 2014 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 "fmr.h"
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "FMLIB_ERR"
#define FMR_ERR_BASE -0x100
static int fmr_err = 0;
static char tmp[20] = {0};
char *FMR_strerr()
{
int ret = 0;
ret = sprintf(tmp, "%d", fmr_err);
if (ret < 0) {
LOGE("%s sprintf fail\n", __func__);
}
return tmp;
}
void FMR_seterr(int err)
{
fmr_err = err;
}

806
libfmjni/libfm_jni.cpp Executable file
View file

@ -0,0 +1,806 @@
/*
* Copyright (C) 2014 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 <jni.h>
#include "fmr.h"
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "FMLIB_JNI"
#define FM_AF_THRESHOLD -80
#define UNUSED(x) (void)(x)
static int g_idx = -1;
extern struct fmr_ds fmr_data;
static short g_CurrentRDS_PI;
jboolean openDev(JNIEnv *env, jobject thiz)
{
int ret = 0;
UNUSED(env);
UNUSED(thiz);
ret = FMR_open_dev(g_idx); // if success, then ret = 0; else ret < 0
LOGD("%s, [ret=%d]\n", __func__, ret);
return ret?JNI_FALSE:JNI_TRUE;
}
jboolean closeDev(JNIEnv *env, jobject thiz)
{
int ret = 0;
UNUSED(env);
UNUSED(thiz);
ret = FMR_close_dev(g_idx);
LOGD("%s, [ret=%d]\n", __func__, ret);
return ret?JNI_FALSE:JNI_TRUE;
}
jboolean powerUp(JNIEnv *env, jobject thiz, jfloat freq)
{
int ret = 0;
int tmp_freq;
UNUSED(env);
UNUSED(thiz);
LOGI("%s, [freq=%d]\n", __func__, (int)freq);
/* fix jfloat precision issue */
tmp_freq = (int)((float)freq * 100 + 0.5); //Eg, 87.5 * 100 --> 8750
ret = FMR_pwr_up(g_idx, tmp_freq);
LOGD("%s, [ret=%d]\n", __func__, ret);
return ret?JNI_FALSE:JNI_TRUE;
}
jboolean powerDown(JNIEnv *env, jobject thiz, jint type)
{
int ret = 0;
UNUSED(env);
UNUSED(thiz);
ret = FMR_pwr_down(g_idx, type);
LOGD("%s, [ret=%d]\n", __func__, ret);
return ret?JNI_FALSE:JNI_TRUE;
}
jint readRssi(JNIEnv *env, jobject thiz) //jint = int
{
int ret = 0;
int rssi = -1;
UNUSED(env);
UNUSED(thiz);
ret = FMR_get_rssi(g_idx, &rssi);
LOGD("%s, [ret=%d]\n", __func__, ret);
return rssi;
}
jboolean tune(JNIEnv *env, jobject thiz, jfloat freq)
{
int ret = 0;
int tmp_freq;
UNUSED(env);
UNUSED(thiz);
/* fix jfloat precision issue */
tmp_freq = (int)((float)freq * 100 + 0.5); //Eg, 87.5 * 100 --> 8750
ret = FMR_tune(g_idx, tmp_freq);
if (!ret) /* clean global pi*/
g_CurrentRDS_PI = 0;
LOGD("%s, [ret=%d]\n", __func__, ret);
return ret?JNI_FALSE:JNI_TRUE;
}
jfloat seek(JNIEnv *env, jobject thiz, jfloat freq, jboolean isUp) //jboolean isUp;
{
int ret = 0;
int tmp_freq;
int ret_freq;
float val;
UNUSED(env);
UNUSED(thiz);
/* fix jfloat precision issue */
tmp_freq = (int)((float)freq * 100 + 0.5); //Eg, 87.5 * 100 --> 8750
ret = FMR_set_mute(g_idx, 1);
if (ret) {
LOGE("%s, error, [ret=%d]\n", __func__, ret);
}
LOGD("%s, [mute] [ret=%d]\n", __func__, ret);
ret = FMR_seek(g_idx, tmp_freq, (int)isUp, &ret_freq);
if (ret) {
ret_freq = tmp_freq; //seek error, so use original freq
}
LOGD("%s, [freq=%d] [ret=%d]\n", __func__, ret_freq, ret);
val = (float)ret_freq/100; //Eg, 8755 / 100 --> 87.55
return val;
}
jshortArray autoScan(JNIEnv *env, jobject thiz)
{
#define FM_SCAN_CH_SIZE_MAX 200
int ret = 0;
jshortArray scanChlarray;
int chl_cnt = FM_SCAN_CH_SIZE_MAX;
uint16_t ScanTBL[FM_SCAN_CH_SIZE_MAX];
UNUSED(thiz);
LOGI("%s, [tbl=%p]\n", __func__, ScanTBL);
FMR_Pre_Search(g_idx);
ret = FMR_scan(g_idx, ScanTBL, &chl_cnt);
if (ret < 0) {
LOGE("scan failed!\n");
scanChlarray = NULL;
goto out;
}
if (chl_cnt > 0) {
scanChlarray = env->NewShortArray(chl_cnt);
env->SetShortArrayRegion(scanChlarray, 0, chl_cnt, (const jshort*)&ScanTBL[0]);
} else {
LOGE("cnt error, [cnt=%d]\n", chl_cnt);
scanChlarray = NULL;
}
FMR_Restore_Search(g_idx);
if (fmr_data.scan_stop == fm_true) {
ret = FMR_tune(g_idx, fmr_data.cur_freq);
LOGI("scan stop!!! tune ret=%d",ret);
scanChlarray = NULL;
ret = -1;
}
out:
LOGD("%s, [cnt=%d] [ret=%d]\n", __func__, chl_cnt, ret);
return scanChlarray;
}
jboolean emsetth(JNIEnv *env, jobject thiz, jint index, jint value)
{
int ret = 0;
UNUSED(env);
UNUSED(thiz);
ret = FMR_EMSetTH(g_idx, index, value);
LOGD("emsetth ret %d\n", ret);
return (ret < 0) ? JNI_FALSE : JNI_TRUE;
}
jshortArray emcmd(JNIEnv *env, jobject thiz, jshortArray val)
{
jshortArray eventarray = NULL;
uint16_t eventtbl[20]={0};
uint16_t* cmdtbl=NULL;
UNUSED(thiz);
cmdtbl = (uint16_t*) env->GetShortArrayElements(val, NULL);
if(cmdtbl == NULL)
{
LOGE("%s:get cmdtbl error\n", __func__);
goto out;
}
LOGI("EM cmd:=%x %x %x %x %x",cmdtbl[0],cmdtbl[1],cmdtbl[2],cmdtbl[3],cmdtbl[4]);
if(!cmdtbl[0]) //LANT
{
}
else //SANT
{
}
switch(cmdtbl[1])
{
case 0x02: //CQI log tool
{
FMR_EM_CQI_logger(g_idx, cmdtbl[2]);
}
break;
default:
break;
}
eventarray = env->NewShortArray(20);
env->SetShortArrayRegion(eventarray, 0, 20, (const jshort*)&eventtbl[0]);
//LOGD("emsetth ret %d\n", ret);
out:
return eventarray;
}
jshort readRds(JNIEnv *env, jobject thiz)
{
int ret = 0;
int rssi = -1;
uint16_t rds_status = 0;
uint16_t pi = 0;
UNUSED(env);
UNUSED(thiz);
ret = FMR_read_rds_data(g_idx, &rds_status);
if (ret) {
rds_status = 0; // There's no event or some error happened
} else {
if (rds_status & RDS_EVENT_PI_CODE) {
ret = FMR_get_pi(0, &pi);
if (!ret) {
ret = FMR_get_rssi(g_idx, &rssi);
if (rssi > FM_AF_THRESHOLD)
g_CurrentRDS_PI = pi;
}
LOGE("get pi(0x%04x) \n", pi);
}
}
return rds_status;
}
jshort getPI(JNIEnv *env, jobject thiz)
{
int ret = 0;
uint16_t pi = 0;
UNUSED(env);
UNUSED(thiz);
ret = FMR_get_pi(g_idx, &pi);
if(ret){
LOGE("%s, error, [ret=%d]\n", __func__, ret);
pi = -1; //there's some error happened
}
return pi;
}
jbyte getECC(JNIEnv *env, jobject thiz)
{
int ret = 0;
uint8_t ecc = 0;
UNUSED(env);
UNUSED(thiz);
ret = FMR_get_ecc(g_idx, &ecc);
if(ret){
LOGE("%s, error, [ret=%d]\n", __func__, ret);
ecc = -1; //there's some error happened
}
return ecc;
}
jbyte getPTY(JNIEnv *env, jobject thiz)
{
int ret = 0;
uint8_t pty = 0;
UNUSED(env);
UNUSED(thiz);
ret = FMR_get_pty(g_idx, &pty);
if(ret){
LOGE("%s, error, [ret=%d]\n", __func__, ret);
pty = -1; //there's some error happened
}
return pty;
}
jbyteArray getPs(JNIEnv *env, jobject thiz)
{
int ret = 0;
jbyteArray PSname;
uint8_t *ps = NULL;
int ps_len = 0;
UNUSED(thiz);
ret = FMR_get_ps(g_idx, &ps, &ps_len);
if (ret) {
LOGE("%s, error, [ret=%d]\n", __func__, ret);
return NULL;
}
PSname = env->NewByteArray(ps_len);
env->SetByteArrayRegion(PSname, 0, ps_len, (const jbyte*)ps);
LOGD("%s, [ret=%d]\n", __func__, ret);
return PSname;
}
jbyteArray getLrText(JNIEnv *env, jobject thiz)
{
int ret = 0;
jbyteArray LastRadioText;
uint8_t *rt = NULL;
int rt_len = 0;
UNUSED(thiz);
ret = FMR_get_rt(g_idx, &rt, &rt_len);
if (ret) {
LOGE("%s, error, [ret=%d]\n", __func__, ret);
return NULL;
}
LastRadioText = env->NewByteArray(rt_len);
env->SetByteArrayRegion(LastRadioText, 0, rt_len, (const jbyte*)rt);
LOGD("%s, [ret=%d]\n", __func__, ret);
return LastRadioText;
}
jshort activeAf(JNIEnv *env, jobject thiz)
{
int ret = 0;
jshort ret_freq = 0;
UNUSED(env);
UNUSED(thiz);
ret = FMR_active_af(g_idx, g_CurrentRDS_PI, (uint16_t*)&ret_freq);
if (ret) {
LOGE("%s, error, [ret=%d]\n", __func__, ret);
return 0;
}
LOGD("%s, [ret=%d], ret_freq=%d\n", __func__, ret, ret_freq);
return ret_freq;
}
jshortArray getAFList(JNIEnv *env, jobject thiz)
{
int ret = 0;
jshortArray AFList;
char *af = NULL;
int af_len = 0;
UNUSED(thiz);
//ret = FMR_get_af(g_idx, &af, &af_len); // If need, we should implemate this API
if (ret) {
LOGE("%s, error, [ret=%d]\n", __func__, ret);
return NULL;
}
AFList = env->NewShortArray(af_len);
env->SetShortArrayRegion(AFList, 0, af_len, (const jshort*)af);
LOGD("%s, [ret=%d]\n", __func__, ret);
return AFList;
}
jshort activeTA(JNIEnv *env, jobject thiz)
{
int ret = 0;
jshort ret_freq = 0;
UNUSED(env);
UNUSED(thiz);
ret = FMR_active_ta(g_idx, (uint16_t*)&ret_freq);
if(ret){
LOGE("%s, error, [ret=%d]\n", __func__, ret);
return 0;
}
LOGD("%s, [ret=%d], ret_freq=%d\n", __func__, ret, ret_freq);
return ret_freq;
}
jshort deactiveTA(JNIEnv *env, jobject thiz)
{
int ret = 0;
jshort ret_freq = 0;
UNUSED(env);
UNUSED(thiz);
ret = FMR_deactive_ta(g_idx, (uint16_t*)&ret_freq);
if(ret){
LOGE("%s, error, [ret=%d]\n", __func__, ret);
return 0;
}
LOGD("%s, [ret=%d], ret_freq=%d\n", __func__, ret, ret_freq);
return ret_freq;
}
jint setRds(JNIEnv *env, jobject thiz, jboolean rdson)
{
int ret = 0;
int onoff = -1;
UNUSED(env);
UNUSED(thiz);
if (rdson == JNI_TRUE) {
onoff = FMR_RDS_ON;
} else {
onoff = FMR_RDS_OFF;
}
ret = FMR_turn_on_off_rds(g_idx, onoff);
if (ret) {
LOGE("%s, error, [ret=%d]\n", __func__, ret);
}
LOGD("%s, [onoff=%d] [ret=%d]\n", __func__, onoff, ret);
return ret?JNI_FALSE:JNI_TRUE;
}
jboolean stopScan(JNIEnv *env, jobject thiz)
{
int ret = 0;
UNUSED(env);
UNUSED(thiz);
ret = FMR_stop_scan(g_idx);
if (ret) {
LOGE("%s, error, [ret=%d]\n", __func__, ret);
}
LOGD("%s, [ret=%d]\n", __func__, ret);
return ret?JNI_FALSE:JNI_TRUE;
}
jint setMute(JNIEnv *env, jobject thiz, jboolean mute)
{
int ret = 0;
UNUSED(env);
UNUSED(thiz);
ret = FMR_set_mute(g_idx, (int)mute);
if (ret) {
LOGE("%s, error, [ret=%d]\n", __func__, ret);
}
LOGD("%s, [mute=%d] [ret=%d]\n", __func__, (int)mute, ret);
return ret?JNI_FALSE:JNI_TRUE;
}
/******************************************
* Used to get chip ID.
*Parameter:
* None
*Return value
* 1000: chip AR1000
* 6616: chip mt6616
* -1: error
******************************************/
jint getchipid(JNIEnv *env, jobject thiz)
{
int ret = 0;
int chipid = -1;
UNUSED(env);
UNUSED(thiz);
ret = FMR_get_chip_id(g_idx, &chipid);
if(ret){
LOGE("%s, error, [ret=%d]\n", __func__, ret);
}
LOGD("%s, [chipid=%x] [ret=%d]\n", __func__, chipid, ret);
return chipid;
}
/******************************************
* Inquiry if RDS is support in driver.
* Parameter:
* None
*Return Value:
* 1: support
* 0: NOT support
* -1: error
******************************************/
jint isRdsSupport(JNIEnv *env, jobject thiz)
{
int ret = 0;
int supt = -1;
UNUSED(env);
UNUSED(thiz);
ret = FMR_is_rdsrx_support(g_idx, &supt);
if (ret) {
LOGE("%s, error, [ret=%d]\n", __func__, ret);
}
LOGD("%s, [supt=%d] [ret=%d]\n", __func__, supt, ret);
return supt;
}
/******************************************
* Inquiry if FM is powered up.
* Parameter:
* None
*Return Value:
* 1: Powered up
* 0: Did NOT powered up
******************************************/
jint isFMPoweredUp(JNIEnv *env, jobject thiz)
{
int ret = 0;
int pwrup = -1;
UNUSED(env);
UNUSED(thiz);
ret = FMR_is_fm_pwrup(g_idx, &pwrup);
if(ret){
LOGE("%s, error, [ret=%d]\n", __func__, ret);
}
LOGD("%s, [pwrup=%d] [ret=%d]\n", __func__, pwrup, ret);
return pwrup;
}
/******************************************
* SwitchAntenna
* Parameter:
* antenna:
0 : switch to long antenna
1: switch to short antenna
*Return Value:
* 0: Success
* 1: Failed
* 2: Not support
******************************************/
jint switchAntenna(JNIEnv *env, jobject thiz, jint antenna)
{
int ret = 0;
jint jret = 0;
int ana = -1;
UNUSED(env);
UNUSED(thiz);
if (0 == antenna) {
ana = FM_LONG_ANA;
} else if (1 == antenna) {
ana = FM_SHORT_ANA;
} else {
LOGE("%s:fail, para error\n", __func__);
jret = JNI_FALSE;
goto out;
}
ret = FMR_ana_switch(g_idx, ana);
if (ret == -ERR_UNSUPT_SHORTANA) {
LOGW("Not support switchAntenna\n");
jret = 2;
} else if (ret) {
LOGE("switchAntenna(), error\n");
jret = 1;
} else {
jret = 0;
}
out:
LOGD("%s: [antenna=%d] [ret=%d]\n", __func__, ana, ret);
return jret;
}
/******************************************
* Inquiry if FM is stereoMono.
* Parameter:
* None
*Return Value:
* JNI_TRUE: stereo
* JNI_FALSE: mono
******************************************/
jboolean stereoMono(JNIEnv *env, jobject thiz)
{
int ret = 0;
int stemono = -1;
UNUSED(env);
UNUSED(thiz);
ret = FMR_get_stereomono(g_idx, &stemono);
if(ret){
LOGE("%s, error, [ret=%d]\n", __func__, ret);
}
LOGD("%s, [stemono=%d] [ret=%d]\n", __func__, stemono, ret);
return stemono?JNI_TRUE:JNI_FALSE;
}
/******************************************
* Force set to stero/mono mode.
* Parameter:
* type: JNI_TRUE, mono; JNI_FALSE, stero
*Return Value:
* JNI_TRUE: success
* JNI_FALSE: failed
******************************************/
jboolean setStereoMono(JNIEnv *env, jobject thiz, jboolean type)
{
int ret = 0;
UNUSED(env);
UNUSED(thiz);
ret = FMR_set_stereomono(g_idx, ((type == JNI_TRUE) ? 1 : 0));
if(ret){
LOGE("%s, error, [ret=%d]\n", __func__, ret);
}
LOGD("%s,[ret=%d]\n", __func__, ret);
return (ret==0) ? JNI_TRUE : JNI_FALSE;
}
/******************************************
* Read cap array of short antenna.
* Parameter:
* None
*Return Value:
* CapArray
******************************************/
jshort readCapArray(JNIEnv *env, jobject thiz)
{
int ret = 0;
int caparray = -1;
UNUSED(env);
UNUSED(thiz);
ret = FMR_get_caparray(g_idx, &caparray);
if(ret){
LOGE("%s, error, [ret=%d]\n", __func__, ret);
}
LOGD("%s, [caparray=%d] [ret=%d]\n", __func__, caparray, ret);
return (jshort)caparray;
}
/******************************************
* Read cap array of short antenna.
* Parameter:
* None
*Return Value:
* CapArray : 0~100
******************************************/
jshort readRdsBler(JNIEnv *env, jobject thiz)
{
int ret = 0;
int badratio = -1;
UNUSED(env);
UNUSED(thiz);
ret = FMR_get_badratio(g_idx, &badratio);
if(ret){
LOGE("%s, error, [ret=%d]\n", __func__, ret);
}
if(badratio > 100){
badratio = 100;
LOGW("badratio value error, give a max value!");
}else if(badratio < 0){
badratio = 0;
LOGW("badratio value error, give a min value!");
}
LOGD("%s, [badratio=%d] [ret=%d]\n", __func__, badratio, ret);
return (jshort)badratio;
}
jintArray getHardwareVersion(JNIEnv *env, jobject thiz)
{
int ret = 0;
jintArray hw_info;
int *info = NULL;
int info_len = 0;
UNUSED(thiz);
ret = FMR_get_hw_info(g_idx, &info, &info_len);
if(ret < 0){
LOGE("%s, error, [ret=%d]\n", __func__, ret);
return NULL;
}
hw_info = env->NewIntArray(info_len);
env->SetIntArrayRegion(hw_info, 0, info_len, (const jint*)info);
LOGD("%s, [ret=%d]\n", __func__, ret);
return hw_info;
}
static const char *classPathNameRx = "com/android/fmradio/FmNative";
static JNINativeMethod methodsRx[] = {
{"openDev", "()Z", (void*)openDev},
{"closeDev", "()Z", (void*)closeDev},
{"powerUp", "(F)Z", (void*)powerUp},
{"powerDown", "(I)Z", (void*)powerDown},
{"tune", "(F)Z", (void*)tune},
{"seek", "(FZ)F", (void*)seek},
{"autoScan", "()[S", (void*)autoScan},
{"stopScan", "()Z", (void*)stopScan},
{"setRds", "(Z)I", (void*)setRds},
{"readRds", "()S", (void*)readRds},
{"getPs", "()[B", (void*)getPs},
{"getLrText", "()[B", (void*)getLrText},
{"activeAf", "()S", (void*)activeAf},
{"setMute", "(Z)I", (void*)setMute},
{"isRdsSupport", "()I", (void*)isRdsSupport},
{"switchAntenna", "(I)I", (void*)switchAntenna},
{"readRssi", "()I", (void*)readRssi},
{"stereoMono", "()Z", (void*)stereoMono},
{"setStereoMono", "(Z)Z", (void*)setStereoMono},
{"readCapArray", "()S", (void*)readCapArray},
{"readRdsBler", "()S", (void*)readRdsBler},
{"emcmd","([S)[S",(void*)emcmd},
{"emsetth","(II)Z",(void*)emsetth},
{"getHardwareVersion", "()[I", (void*)getHardwareVersion},
};
/*
* Register several native methods for one class.
*/
static jint registerNativeMethods(JNIEnv* env, const char* className,
JNINativeMethod* gMethods, int numMethods)
{
jclass clazz;
clazz = env->FindClass(className);
if (env->ExceptionCheck()) {
env->ExceptionDescribe();
env->ExceptionClear();
}
if (clazz == NULL) {
LOGE("Native registration unable to find class '%s'", className);
return JNI_FALSE;
}
if (env->RegisterNatives(clazz, gMethods, numMethods) < 0) {
LOGE("RegisterNatives failed for '%s'", className);
return JNI_FALSE;
}
LOGD("%s, success\n", __func__);
return JNI_TRUE;
}
/*
* Register native methods for all classes we know about.
*
* returns JNI_TRUE on success.
*/
static jint registerNatives(JNIEnv* env)
{
jint ret = JNI_FALSE;
if (registerNativeMethods(env, classPathNameRx,methodsRx,
sizeof(methodsRx) / sizeof(methodsRx[0]))) {
ret = JNI_TRUE;
}
LOGD("%s, done\n", __func__);
return ret;
}
// ----------------------------------------------------------------------------
/*
* This is called by the VM when the shared library is first loaded.
*/
typedef union {
JNIEnv* env;
void* venv;
} UnionJNIEnvToVoid;
jint JNI_OnLoad(JavaVM* vm, void* reserved)
{
UnionJNIEnvToVoid uenv;
uenv.venv = NULL;
jint result = -1;
JNIEnv* env = NULL;
UNUSED(reserved);
LOGI("JNI_OnLoad");
if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_4) != JNI_OK) {
LOGE("ERROR: GetEnv failed");
goto fail;
}
env = uenv.env;
if (registerNatives(env) != JNI_TRUE) {
LOGE("ERROR: registerNatives failed");
goto fail;
}
if ((g_idx = FMR_init()) < 0) {
goto fail;
}
result = JNI_VERSION_1_4;
fail:
return result;
}

10
lineage.dependencies Normal file
View file

@ -0,0 +1,10 @@
[
{
"repository": "android_device_mediatek_sepolicy_vndr",
"target_path": "device/mediatek/sepolicy_vndr"
},
{
"repository": "android_hardware_mediatek",
"target_path": "hardware/mediatek"
}
]

28
lineage_brax3.mk Normal file
View file

@ -0,0 +1,28 @@
#
# Copyright (C) 2021-2025 The LineageOS Project
#
# SPDX-License-Identifier: Apache-2.0
#
# Inherit from those products. Most specific first.
$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit_only.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base_telephony.mk)
# Inherit from brax3 device
$(call inherit-product, device/brax/brax3/device.mk)
# Inherit some common Lineage stuff.
$(call inherit-product, vendor/lineage/config/common_full_phone.mk)
PRODUCT_NAME := lineage_brax3
PRODUCT_DEVICE := brax3
PRODUCT_MANUFACTURER := BraX
PRODUCT_BRAND := BraX
PRODUCT_MODEL := BraX3
PRODUCT_BUILD_PROP_OVERRIDES += \
BuildFingerprint=brax/brax3/k6835v1_64:15/AP4A.250205.002/:user/release-keys \
DeviceName=BraX3 \
DeviceProduct=BraX3 \
SystemDevice=k6835v1_64 \
SystemName=BraX3

220
manifest.xml Normal file
View file

@ -0,0 +1,220 @@
<manifest version="8.0" type="device" target-level="5">
<hal format="hidl">
<name>android.hardware.audio</name>
<transport>hwbinder</transport>
<fqname>@7.1::IDevicesFactory/default</fqname>
</hal>
<hal format="hidl">
<name>android.hardware.audio.effect</name>
<transport>hwbinder</transport>
<fqname>@7.0::IEffectsFactory/default</fqname>
</hal>
<hal format="hidl">
<name>android.hardware.bluetooth</name>
<transport>hwbinder</transport>
<fqname>@1.1::IBluetoothHci/default</fqname>
</hal>
<hal format="hidl">
<name>android.hardware.camera.provider</name>
<transport>hwbinder</transport>
<fqname>@2.6::ICameraProvider/internal/0</fqname>
</hal>
<hal format="hidl">
<name>android.hardware.gatekeeper</name>
<transport>hwbinder</transport>
<fqname>@1.0::IGatekeeper/default</fqname>
</hal>
<hal format="hidl">
<name>android.hardware.graphics.allocator</name>
<transport>hwbinder</transport>
<fqname>@4.0::IAllocator/default</fqname>
</hal>
<hal format="hidl">
<name>android.hardware.graphics.composer</name>
<transport>hwbinder</transport>
<fqname>@2.1::IComposer/default</fqname>
</hal>
<hal format="hidl">
<name>android.hardware.graphics.mapper</name>
<transport arch="32+64">passthrough</transport>
<fqname>@4.0::IMapper/default</fqname>
</hal>
<hal format="hidl">
<name>android.hardware.radio</name>
<transport>hwbinder</transport>
<fqname>@1.2::ISap/slot1</fqname>
<fqname>@1.2::ISap/slot2</fqname>
</hal>
<hal format="aidl">
<name>android.hardware.radio.config</name>
<fqname>IRadioConfig/default</fqname>
</hal>
<hal format="aidl">
<name>android.hardware.radio.data</name>
<fqname>IRadioData/slot1</fqname>
<fqname>IRadioData/slot2</fqname>
</hal>
<hal format="aidl">
<name>android.hardware.radio.messaging</name>
<fqname>IRadioMessaging/slot1</fqname>
<fqname>IRadioMessaging/slot2</fqname>
</hal>
<hal format="aidl">
<name>android.hardware.radio.modem</name>
<fqname>IRadioModem/imsSlot1</fqname>
<fqname>IRadioModem/imsSlot2</fqname>
<fqname>IRadioModem/se1</fqname>
<fqname>IRadioModem/se2</fqname>
<fqname>IRadioModem/slot1</fqname>
<fqname>IRadioModem/slot2</fqname>
</hal>
<hal format="aidl">
<name>android.hardware.radio.network</name>
<fqname>IRadioNetwork/imsSlot1</fqname>
<fqname>IRadioNetwork/imsSlot2</fqname>
<fqname>IRadioNetwork/slot1</fqname>
<fqname>IRadioNetwork/slot2</fqname>
</hal>
<hal format="aidl">
<name>android.hardware.radio.sim</name>
<fqname>IRadioSim/imsSlot1</fqname>
<fqname>IRadioSim/imsSlot2</fqname>
<fqname>IRadioSim/se1</fqname>
<fqname>IRadioSim/se2</fqname>
<fqname>IRadioSim/slot1</fqname>
<fqname>IRadioSim/slot2</fqname>
</hal>
<hal format="aidl">
<name>android.hardware.radio.voice</name>
<fqname>IRadioVoice/imsSlot1</fqname>
<fqname>IRadioVoice/imsSlot2</fqname>
<fqname>IRadioVoice/slot1</fqname>
<fqname>IRadioVoice/slot2</fqname>
</hal>
<hal format="hidl">
<name>android.hardware.secure_element</name>
<transport>hwbinder</transport>
<fqname>@1.2::ISecureElement/SIM1</fqname>
<fqname>@1.2::ISecureElement/SIM2</fqname>
</hal>
<hal format="hidl">
<name>android.hardware.tetheroffload.config</name>
<transport>hwbinder</transport>
<fqname>@1.0::IOffloadConfig/default</fqname>
</hal>
<hal format="hidl">
<name>android.hardware.tetheroffload.control</name>
<transport>hwbinder</transport>
<fqname>@1.1::IOffloadControl/default</fqname>
</hal>
<hal format="hidl">
<name>android.hardware.thermal</name>
<transport>hwbinder</transport>
<fqname>@1.0::IThermal/default</fqname>
<fqname>@2.0::IThermal/default</fqname>
</hal>
<hal format="hidl">
<name>vendor.mediatek.hardware.camera.atms</name>
<transport>hwbinder</transport>
<fqname>@1.0::IATMs/default</fqname>
</hal>
<hal format="hidl">
<name>vendor.mediatek.hardware.camera.bgservice</name>
<transport>hwbinder</transport>
<fqname>@1.1::IBGService/internal/0</fqname>
</hal>
<hal format="hidl">
<name>vendor.mediatek.hardware.camera.isphal</name>
<transport>hwbinder</transport>
<fqname>@1.1::IISPModule/internal/0</fqname>
</hal>
<hal format="hidl">
<name>vendor.mediatek.hardware.composer_ext</name>
<transport>hwbinder</transport>
<fqname>@1.0::IComposerExt/default</fqname>
</hal>
<hal format="hidl">
<name>vendor.mediatek.hardware.dmc</name>
<transport>hwbinder</transport>
<fqname>@1.2::IDmcService/dmc_hidl_service</fqname>
</hal>
<hal format="aidl">
<name>vendor.mediatek.hardware.gnss.batching</name>
<fqname>IMtkGnssBatching/default</fqname>
</hal>
<hal format="hidl">
<name>vendor.mediatek.hardware.mmagent</name>
<transport>hwbinder</transport>
<fqname>@1.1::IMMAgent/default</fqname>
</hal>
<hal format="hidl">
<name>vendor.mediatek.hardware.mms</name>
<transport>hwbinder</transport>
<fqname>@1.7::IMms/default</fqname>
</hal>
<hal format="hidl">
<name>vendor.mediatek.hardware.mtkpower</name>
<transport>hwbinder</transport>
<fqname>@1.2::IMtkPerf/default</fqname>
<fqname>@1.2::IMtkPower/default</fqname>
</hal>
<hal format="aidl">
<name>vendor.mediatek.hardware.mtkradioex.data</name>
<fqname>IMtkRadioExData/slot1</fqname>
<fqname>IMtkRadioExData/slot2</fqname>
</hal>
<hal format="aidl">
<name>vendor.mediatek.hardware.mtkradioex.ims</name>
<fqname>IMtkRadioExIms/slot1</fqname>
<fqname>IMtkRadioExIms/slot2</fqname>
</hal>
<hal format="aidl">
<name>vendor.mediatek.hardware.mtkradioex.messaging</name>
<fqname>IMtkRadioExMessaging/slot1</fqname>
<fqname>IMtkRadioExMessaging/slot2</fqname>
</hal>
<hal format="aidl">
<name>vendor.mediatek.hardware.mtkradioex.modem</name>
<fqname>IMtkRadioExModem/slot1</fqname>
<fqname>IMtkRadioExModem/slot2</fqname>
</hal>
<hal format="aidl">
<name>vendor.mediatek.hardware.mtkradioex.network</name>
<fqname>IMtkRadioExNetwork/slot1</fqname>
<fqname>IMtkRadioExNetwork/slot2</fqname>
</hal>
<hal format="aidl">
<name>vendor.mediatek.hardware.mtkradioex.rcs</name>
<fqname>IMtkRadioExRcs/slot1</fqname>
<fqname>IMtkRadioExRcs/slot2</fqname>
</hal>
<hal format="aidl">
<name>vendor.mediatek.hardware.mtkradioex.sim</name>
<fqname>IMtkRadioExSim/slot1</fqname>
<fqname>IMtkRadioExSim/slot2</fqname>
</hal>
<hal format="aidl">
<name>vendor.mediatek.hardware.mtkradioex.voice</name>
<fqname>IMtkRadioExVoice/slot1</fqname>
<fqname>IMtkRadioExVoice/slot2</fqname>
</hal>
<hal format="hidl">
<name>vendor.mediatek.hardware.netdagent</name>
<transport>hwbinder</transport>
<fqname>@1.0::INetdagent/default</fqname>
</hal>
<hal format="hidl">
<name>vendor.mediatek.hardware.nvram</name>
<transport>hwbinder</transport>
<fqname>@1.1::INvram/default</fqname>
</hal>
<hal format="aidl">
<name>vendor.mediatek.hardware.pq_aidl</name>
<fqname>IPictureQuality_AIDL/default</fqname>
</hal>
<hal format="hidl">
<name>vendor.mediatek.hardware.videotelephony</name>
<transport>hwbinder</transport>
<fqname>@1.0::IVideoTelephony/default</fqname>
</hal>
</manifest>

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2022 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<!-- Enable auxiliary cameras selector. -->
<bool name="config_enableAuxCameras">true</bool>
</resources>

View file

@ -0,0 +1,10 @@
//
// Copyright (C) 2022 The LineageOS Project
// SPDX-License-Identifier: Apache-2.0
//
runtime_resource_overlay {
name: "CarrierConfigResOverlay",
aaptflags: ["--keep-raw-values"],
vendor: true,
}

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2022 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.carrierconfig.overlay">
<overlay
android:isStatic="true"
android:priority="200"
android:targetPackage="com.android.carrierconfig" />
</manifest>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,9 @@
//
// Copyright (C) 2022 The LineageOS Project
// SPDX-License-Identifier: Apache-2.0
//
runtime_resource_overlay {
name: "DialerResOverlay",
vendor: true,
}

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2022 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.dialer.overlay">
<overlay
android:isStatic="true"
android:priority="1"
android:targetPackage="com.android.dialer" />
</manifest>

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2016 The CyanogenMod Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<bool name="call_recording_enabled">true</bool>
<integer name="call_recording_audio_source">4</integer>
</resources>

View file

@ -0,0 +1,10 @@
//
// Copyright (C) 2022 The LineageOS Project
// SPDX-License-Identifier: Apache-2.0
//
runtime_resource_overlay {
name: "FrameworksResOverlay",
vendor: true,
resource_dirs: ["res", "power/res"]
}

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2022 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.overlay.target">
<overlay
android:isStatic="true"
android:priority="250"
android:targetPackage="android" />
</manifest>

View file

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
**
** Copyright 2022, 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.
*/
-->
<irq-device-map>
<!-- This file maps devices (chips) that can send interrupts to the main processor (and bring it
out of sleep) to logical subsystems in userspace code. Since each Android device can have
a differently designed chipset, this mapping is expected to be empty by default and should
be overridden by device-specific configs.
This mapping helps the system to meaningfully attribute CPU wakeups to logical work that
happened on the device and the app activity that caused it. The devices are referred to by
their names as defined in the kernel. Currently, defined subsystems are:
- Alarm: Use this to denote wakeup alarms requested by apps via the AlarmManager API.
- Wifi: Use this to denote network traffic that uses the wifi transport.
- Sound_trigger: Use this to denote sound phrase detection, like the ones supported by
SoundTriggerManager.
- Sensor: Use this to denote wakeups due to sensor events.
- Cellular_data: Use this to denote network traffic on the cellular transport.
The overlay should use tags <device> and <subsystem> to describe this mapping in the
following way:
<irq-device-map>
<device name="device_name_1">
<subsystem>Subsystem1</subsystem>
<subsystem>Subsystem2</subsystem>
:
:
</device>
<device name="device_name_2">
:
</device>
:
</irq-device-map>
The tag <device> should have a "name" attribute specifying the kernel name of the device.
Each <device> tag can then enclose multiple <subsystem> tags. Each <subsystem> tag should
enclose the name of the logical subsystems (one of the ones defined above) as text.
Undefined subsystem names will be ignored by the framework.
-->
<device name="alarmtimer.0.auto">
<subsystem>Alarm</subsystem>
</device>
</irq-device-map>

View file

@ -0,0 +1,232 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
**
** Copyright 2009, 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.
*/
-->
<device name="Android">
<!-- Most values are the incremental current used by a feature,
in mA (measured at nominal voltage).
The default values are deliberately incorrect dummy values.
OEM's must measure and provide actual values before
shipping a device.
Example real-world values are given in comments, but they
are totally dependent on the platform and can vary
significantly, so should be measured on the shipping platform
with a power meter. -->
<item name="ambient.on">0.1</item> <!-- ~100mA -->
<item name="screen.on">60</item> <!-- ~100mA -->
<item name="screen.full">199</item> <!-- ~100mA -->
<item name="bluetooth.active">32.8</item> <!-- Bluetooth data transfer, ~10mA -->
<item name="bluetooth.on">1.68</item> <!-- Bluetooth on & connectable, but not connected, ~0.1mA -->
<item name="wifi.on">0.4</item> <!-- ~3mA -->
<item name="wifi.active">225.85</item> <!-- WIFI data transfer, ~200mA -->
<item name="wifi.scan">21.5</item> <!-- WIFI network scanning, ~100mA -->
<item name="audio">15.3</item> <!-- ~10mA -->
<item name="video">63.1</item> <!-- ~50mA -->
<item name="camera.flashlight">123</item> <!-- Avg. power for camera flash, ~160mA -->
<item name="camera.avg">410</item> <!-- Avg. power use of camera in standard usecases, ~550mA -->
<item name="gps.on">29</item> <!-- ~50mA -->
<!-- Radio related values. For modems without energy reporting support in firmware, use
radio.active, radio.scanning, and radio.on. -->
<item name="radio.active">90</item> <!-- ~200mA -->
<item name="radio.scanning">116.3</item> <!-- cellular radio scanning for signal, ~10mA -->
<!-- Current consumed by the radio at different signal strengths, when paging -->
<array name="radio.on"> <!-- Strength 0 to BINS-1 -->
<value>4</value> <!-- ~2mA -->
<value>4</value> <!-- ~1mA -->
</array>
<!-- A list of heterogeneous CPU clusters, where the value for each cluster represents the
number of CPU cores for that cluster.
Ex:
<array name="cpu.clusters.cores">
<value>4</value> // cluster 0 has cpu0, cpu1, cpu2, cpu3
<value>2</value> // cluster 1 has cpu4, cpu5
</array> -->
<array name="cpu.clusters.cores">
<value>4</value> <!-- cluster 0 has 4 cores -->
<value>4</value> <!-- cluster 1 has 4 cores -->
</array>
<!-- Different CPU speeds for cluster 0 as reported in
/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state.
There must be one of these for each cluster, labeled:
cpu.speeds.cluster0, cpu.speeds.cluster1, etc... -->
<array name="cpu.speeds.cluster0">
<value>400000</value> <!-- 400 MHz CPU speed -->
</array>
<!-- Current at each CPU speed for cluster 0, as per 'cpu.speeds.cluster0'.
Like cpu.speeds.cluster0, there must be one of these present for
each heterogeneous CPU cluster. -->
<array name="cpu.active.cluster0">
<value>0.1</value> <!-- ~100mA -->
</array>
<!-- Current when CPU is idle -->
<item name="cpu.idle">3.7</item>
<!-- Power consumption when CPU is suspended -->
<item name="cpu.suspend">5</item>
<!-- Additional power consumption by CPU excluding cluster and core when running -->
<item name="cpu.active">2.55</item>.
<!-- Additional power consumption by CPU cluster0 itself when running excluding cores in it -->
<item name="cpu.cluster_power.cluster0">2.11</item>
<!-- Additional power consumption by CPU cluster1 itself when running excluding cores in it -->
<item name="cpu.cluster_power.cluster1">2.22</item>
<!-- Different CPU speeds as reported in
/sys/devices/system/cpu/cpu0/cpufreq/stats/scaling_available_frequencies -->
<array name="cpu.core_speeds.cluster0">
<value>900000</value>
<value>979000</value>
<value>1085000</value>
<value>1218000</value>
<value>1351000</value>
<value>1484000</value>
<value>1617000</value>
<value>1750000</value>
<value>1814000</value>
<value>1879000</value>
<value>1944000</value>
<value>2009000</value>
<value>2074000</value>
<value>2139000</value>
<value>2215000</value>
<value>2301000</value>
</array>
<!-- Different CPU speeds as reported in
/sys/devices/system/cpu/cpu4/cpufreq/stats/scaling_available_frequencies -->
<array name="cpu.core_speeds.cluster1">
<value>400000</value>
<value>501000</value>
<value>542000</value>
<value>643000</value>
<value>745000</value>
<value>846000</value>
<value>948000</value>
<value>1050000</value>
<value>1138000</value>
<value>1226000</value>
<value>1314000</value>
<value>1402000</value>
<value>1491000</value>
<value>1579000</value>
<value>1682000</value>
<value>1800000</value>
</array>
<!-- Additional power used by a CPU from cluster 0 when running at different
speeds. Currently this measurement also includes cluster cost. -->
<array name="cpu.core_power.cluster0">
<value>74</value>
<value>77</value>
<value>81</value>
<value>85</value>
<value>89</value>
<value>92</value>
<value>94</value>
<value>97</value>
<value>100</value>
<value>104</value>
<value>107</value>
<value>109</value>
<value>113</value>
<value>116</value>
<value>121</value>
<value>125</value>
</array>
<!-- Additional power used by a CPU from cluster 1 when running at different
speeds. Currently this measurement also includes cluster cost. -->
<array name="cpu.core_power.cluster1">
<value>29</value>
<value>32</value>
<value>38</value>
<value>47</value>
<value>57</value>
<value>69</value>
<value>74</value>
<value>77</value>
<value>81</value>
<value>85</value>
<value>89</value>
<value>92</value>
<value>94</value>
<value>97</value>
<value>100</value>
<value>104</value>
</array>
<!-- Memory bandwidth power values in mA at the rail. There must be one value
for each bucket defined in the device tree. -->
<array name="memory.bandwidths">
<value>22.7</value> <!-- mA for bucket: 100mb/s-1.5 GB/s memory bandwidth -->
</array>
<!-- This is the battery capacity in mAh (measured at nominal voltage) -->
<!-- prize modlfy by wuliang Do not configure here. PRIZE_BATTERY_CAPACITY config PrizeConfig begin -->
<item name="battery.capacity">1000</item>
<!-- prize modlfy by wuliang Do not configure here. PRIZE_BATTERY_CAPACITY config PrizeConfig end -->
<!-- Wifi related values. -->
<!-- Idle Receive current for wifi radio in mA. 0 by default-->
<item name="wifi.controller.idle">0</item>
<!-- Rx current for wifi radio in mA. 0 by default-->
<item name="wifi.controller.rx">0</item>
<!-- Tx current for wifi radio in mA. 0 by default-->
<item name="wifi.controller.tx">0</item>
<!-- Current at each of the wifi Tx levels in mA. The number of tx levels varies per device
and is available only of wifi chipsets which support the tx level reporting. Use
wifi.tx for other chipsets. none by default -->
<array name="wifi.controller.tx_levels"> <!-- mA -->
</array>
<!-- Operating volatage for wifi radio in mV. 0 by default-->
<item name="wifi.controller.voltage">0</item>
<array name="wifi.batchedscan"> <!-- mA -->
<value>.0002</value> <!-- 1-8/hr -->
<value>.002</value> <!-- 9-64/hr -->
<value>.02</value> <!-- 65-512/hr -->
<value>.2</value> <!-- 513-4,096/hr -->
<value>2</value> <!-- 4097-/hr -->
</array>
<!-- Cellular modem related values. Default is 0.-->
<item name="modem.controller.sleep">0</item>
<item name="modem.controller.idle">0</item>
<item name="modem.controller.rx">0</item>
<array name="modem.controller.tx"> <!-- Strength 0 to 4 -->
<value>0</value>
<value>0</value>
<value>0</value>
<value>0</value>
<value>0</value>
</array>
<item name="modem.controller.voltage">0</item>
<!-- GPS related values. Default is 0.-->
<array name="gps.signalqualitybased"> <!-- Strength 0 to 1 -->
<value>0</value>
<value>0</value>
</array>
<item name="gps.voltage">0</item>
</device>

View file

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2022 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<!-- Device-specific array of SIM slot indexes which are are embedded eUICCs.
e.g. If a device has two physical slots with indexes 0, 1, and slot 1 is an
eUICC, then the value of this array should be:
<integer-array name="non_removable_euicc_slots">
<item>1</item>
</integer-array>
If a device has three physical slots and slot 1 and 2 are eUICCs, then the value of
this array should be:
<integer-array name="non_removable_euicc_slots">
<item>1</item>
<item>2</item>
</integer-array>
This is used to differentiate between removable eUICCs and built in eUICCs, and should
be set by OEMs for devices which use eUICCs. -->
<integer-array name="non_removable_euicc_slots">
<item>1</item>
</integer-array>
</resources>

View file

@ -0,0 +1,285 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2022 The Linux Foundation
SPDX-License-Identifier: BSD-3-Clause
-->
<resources>
<!-- <array name="config_availableColorModes"> -->
<!-- <!-\- ColorDisplayManager.COLOR_MODE_NATURAL -\-> -->
<!-- <item>0</item> -->
<!-- <!-\- ColorDisplayManager.COLOR_MODE_BOOSTED -\-> -->
<!-- <item>1</item> -->
<!-- <!-\- ColorDisplayManager.COLOR_MODE_SATURATED -\-> -->
<!-- <item>2</item> -->
<!-- <!-\- ColorDisplayManager.COLOR_MODE_AUTOMATIC -\-> -->
<!-- <item>3</item> -->
<!-- </array> -->
<!-- <!-\- Boolean indicating whether the HWC setColorTransform function can be performed efficiently -->
<!-- in hardware. -\-> -->
<!-- <bool name="config_setColorTransformAccelerated">true</bool> -->
<string name="config_displayLightSensorType">android.sensor.light</string>
<!-- Flag indicating whether we should enable the automatic brightness.
Software implementation will be used if config_hardware_auto_brightness_available is not set -->
<bool name="config_automatic_brightness_available">true</bool>
<!-- Maximum screen brightness allowed by the power manager.
-2 is invalid so setting will resort to int value specified above.
Set this to 1.0 for maximum brightness range.
The user is forbidden from setting the brightness above this level. -->
<item name="config_screenBrightnessSettingMaximumFloat" format="float" type="dimen">1.0</item>
<integer-array name="config_autoBrightnessLevels">
<item>128</item>
<item>256</item>
<item>384</item>
<item>512</item>
<item>640</item>
<item>768</item>
<item>896</item>
<item>1024</item>
<item>2048</item>
<item>4096</item>
<item>6144</item>
<item>8192</item>
<item>10240</item>
<item>12288</item>
<item>14336</item>
<item>16384</item>
<item>18432</item>
</integer-array>
<integer-array name="config_autoBrightnessLcdBacklightValues">
<item>8</item>
<item>64</item>
<item>98</item>
<item>104</item>
<item>110</item>
<item>116</item>
<item>122</item>
<item>128</item>
<item>134</item>
<item>182</item>
<item>255</item>
<item>255</item>
<item>255</item>
<item>255</item>
<item>255</item>
<item>255</item>
<item>255</item>
<item>255</item>
</integer-array>
<!-- Stability requirements in milliseconds for accepting a new brightness level. This is used
for debouncing the light sensor. Different constants are used to debounce the light sensor
when adapting to brighter or darker environments. This parameter controls how quickly
brightness changes occur in response to an observed change in light level that exceeds the
hysteresis threshold. -->
<integer name="config_autoBrightnessBrighteningLightDebounce">1000</integer>
<integer name="config_autoBrightnessDarkeningLightDebounce">1000</integer>
<!-- Fast brightness animation ramp rate in brightness units per second-->
<integer name="config_brightness_ramp_rate_fast">500</integer>
<!-- Slow brightness animation ramp rate in brightness units per second-->
<integer name="config_brightness_ramp_rate_slow">270</integer>
<!-- The default refresh rate for a given device. Change this value to set a higher default
refresh rate. If the hardware composer on the device supports display modes with a higher
refresh rate than the default value specified here, the framework may use those higher
refresh rate modes if an app chooses one by setting preferredDisplayModeId or calling
setFrameRate().
If a non-zero value is set for config_defaultPeakRefreshRate, then
config_defaultRefreshRate may be set to 0, in which case the value set for
config_defaultPeakRefreshRate will act as the default frame rate. -->
<integer name="config_defaultPeakRefreshRate">90</integer>
<!-- The default refresh rate for a given device. Change this value to set a higher default
refresh rate. If the hardware composer on the device supports display modes with a higher
refresh rate than the default value specified here, the framework may use those higher
refresh rate modes if an app chooses one by setting preferredDisplayModeId or calling
setFrameRate().
If a non-zero value is set for config_defaultPeakRefreshRate, then
config_defaultRefreshRate may be set to 0, in which case the value set for
config_defaultPeakRefreshRate will act as the default frame rate. -->
<integer name="config_defaultRefreshRate">0</integer>
<!-- Default strength, in percentage, of bright color reduction when activated. -->
<integer name="config_reduceBrightColorsStrengthDefault">40</integer>
<!-- Minimum strength, in percentage, supported by bright color reduction. -->
<integer name="config_reduceBrightColorsStrengthMax">50</integer>
<!-- The bounding path of the cutout region of the main built-in display.
Must either be empty if there is no cutout region, or a string that is parsable by
{@link android.util.PathParser}.
The path is assumed to be specified in display coordinates with pixel units and in
the display's native orientation, with the origin of the coordinate system at the
center top of the display.
To facilitate writing device-independent emulation overlays, the marker `@dp` can be
appended after the path string to interpret coordinates in dp instead of px units.
Note that a physical cutout should be configured in pixels for the best results.
-->
<string translatable="false" name="config_mainBuiltInDisplayCutout">
M 0,0
L -46, 0
L -10, 26
L 10, 26
L 46, 0
Z
@dp
</string>
<string translatable="false" name="config_mainBuiltInDisplayCutoutRectApproximation">@string/config_mainBuiltInDisplayCutout</string>
<!-- Whether the display cutout region of the main built-in display should be forced to
black in software (to avoid aliasing or emulate a cutout that is not physically existent).
-->
<bool name="config_fillMainBuiltInDisplayCutout">false</bool>
<!-- Indicate whether to allow the device to suspend when the screen is off
due to the proximity sensor. This resource should only be set to true
if the sensor HAL correctly handles the proximity sensor as a wake-up source.
Otherwise, the device may fail to wake out of suspend reliably.
The default is false. -->
<bool name="config_suspendWhenScreenOffDueToProximity">true</bool>
<!-- List of biometric sensors on the device, in decreasing strength. Consumed by AuthService
when registering authenticators with BiometricService. Format must be ID:Modality:Strength,
where: IDs are unique per device, Modality as defined in BiometricAuthenticator.java,
and Strength as defined in Authenticators.java -->
<string-array name="config_biometric_sensors" translatable="false" >
<item>0:2:15</item> <!-- ID0:Fingerprint:Strong -->
</string-array>
<!-- 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_dozeAfterScreenOffByDefault">true</bool>
<!-- Control whether the always on display mode is available. This should only be enabled on
devices where the display has been tuned to be power efficient in DOZE and/or DOZE_SUSPEND
states. -->
<bool name="config_dozeAlwaysOnDisplayAvailable">true</bool>
<!-- ComponentName of a dream to show whenever the system would otherwise have
gone to sleep. When the PowerManager is asked to go to sleep, it will instead
try to start this dream if possible. The dream should typically call startDozing()
to put the display into a low power state and allow the application processor
to be suspended. When the dream ends, the system will go to sleep as usual.
Specify the component name or an empty string if none.
Note that doze dreams are not subject to the same start conditions as ordinary dreams.
Doze dreams will run whenever the power manager is in a dozing state. -->
<string name="config_dozeComponent" translatable="false">com.android.systemui/com.android.systemui.doze.DozeService</string>
<!-- Screen brightness used to dim the screen while dozing in a very low power state.
May be less than the minimum allowed brightness setting
that can be set by the user. -->
<integer name="config_screenBrightnessDoze">17</integer>
<!-- Whether a software navigation bar should be shown. NOTE: in the future this may be
autodetected from the Configuration. -->
<bool name="config_showNavigationBar">true</bool>
<!-- Whether device supports double tap to wake -->
<bool name="config_supportDoubleTapWake">false</bool>
<!-- Whether this device is supporting the camera toggle -->
<bool name="config_supportsCamToggle">false</bool>
<!-- Whether this device is supporting the software microphone toggle -->
<bool name="config_supportsMicToggle">true</bool>
<!-- Whether UI for multi user should be shown -->
<bool name="config_enableMultiUserUI">true</bool>
<!-- When true use the linux /dev/input/event subsystem to detect the switch changes
on the headphone/microphone jack. When false use the older uevent framework. -->
<bool name="config_useDevInputEventForAudioJack">true</bool>
<!-- Boolean indicating USSD over IMS is allowed.
If it is not supported due to modem limitations, USSD send over the CS pipe instead.-->
<bool name="config_allow_ussd_over_ims">true</bool>
<!-- Flag specifying whether WFC over IMS is available on device -->
<bool name="config_device_wfc_ims_available">true</bool>
<!-- Flag specifying whether WFC over IMS should be available for carrier: independent of
carrier provisioning. If false: hard disabled. If true: then depends on carrier
provisioning, availability etc -->
<bool name="config_carrier_wfc_ims_available">true</bool>
<!-- Flag specifying whether VoLTE is available on device -->
<bool name="config_device_volte_available">true</bool>
<!-- Flag specifying whether VoLTE should be available for carrier: independent of
carrier provisioning. If false: hard disabled. If true: then depends on carrier
provisioning, availability etc -->
<bool name="config_carrier_volte_available">true</bool>
<!-- Flag specifying whether VoLTE TTY is supported -->
<bool name="config_carrier_volte_tty_supported">true</bool>
<!-- Flag specifying whether VT is available on device -->
<bool name="config_device_vt_available">true</bool>
<!-- Default list of files pinned by the Pinner Service -->
<string-array translatable="false" name="config_defaultPinnerServiceFiles">
<item>"/system/framework/framework.jar"</item>
<item>"/system/framework/services.jar"</item>
<item>"/apex/com.android.art/javalib/core-oj.jar"</item>
<item>"/apex/com.android.art/javalib/core-libart.jar"</item>
<item>"/system_ext/priv-app/SystemUI/SystemUI.apk"</item>
<item>"/system/bin/surfaceflinger"</item>
</string-array>
<!-- Should the pinner service pin the Home application? -->
<bool name="config_pinnerHomeApp">true</bool>
<!-- Number of physical SIM slots on the device. This includes both eSIM and pSIM slots, and
is not necessarily the same as the number of phones/logical modems supported by the device.
For example, a multi-sim device can have 2 phones/logical modems, but 3 physical slots,
or a single SIM device can have 1 phones/logical modems, but 2 physical slots (one eSIM
and one pSIM) -->
<integer name="config_num_physical_slots">1</integer>
<!-- Set to true to add links to Cell Broadcast app from Settings and MMS app. -->
<bool name="config_cellBroadcastAppLinks">true</bool>
<!-- Is the device capable of hot swapping an UICC Card -->
<bool name="config_hotswapCapable">true</bool>
<!-- Whether WiFi display is supported by this device.
There are many prerequisites for this feature to work correctly.
Here are a few of them:
* The WiFi radio must support WiFi P2P.
* The WiFi radio must support concurrent connections to the WiFi display and
to an access point.
* The Audio Server audio_policy_configuration.xml file must specify a rule for
the "r_submix" remote submix module. This module is used to record and stream system
audio output to the WiFi display encoder in the media server.
* The remote submix module "audio.r_submix.default" must be installed on the device.
* The device must be provisioned with HDCP keys (for protected content).
-->
<bool name="config_enableWifiDisplay">true</bool>
<!-- An array of arrays of side fingerprint sensor properties relative to each display.
Note: this value is temporary and is expected to be queried directly
from the HAL in the future. -->
<array name="config_sfps_sensor_props">
<item>@array/config_sfps_sensor_props_0</item>
</array>
<array name="config_sfps_sensor_props_0">
<item>local:4627039422300187648</item> <!--item>displayId</item-->
<item>760</item> <!--item>sensorLocationX</item-->
<item>660</item> <!--item>sensorLocationY</item-->
<item>100</item> <!--item>sensorRadius</item-->
</array>
<!-- Indicates whether device has a power button fingerprint sensor. -->
<bool name="config_is_powerbutton_fps">true</bool>
</resources>

View file

@ -0,0 +1,9 @@
//
// Copyright (C) 2022 The LineageOS Project
// SPDX-License-Identifier: Apache-2.0
//
runtime_resource_overlay {
name: "SettingsProviderResOverlay",
vendor: true,
}

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2022 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.providers.settings.overlay">
<overlay
android:isStatic="true"
android:priority="350"
android:targetPackage="com.android.providers.settings" />
</manifest>

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2022-2023 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<!-- Default for Settings.Global.DEVICE_NAME $1=MODEL-->
<string name="def_device_name_simple" translatable="false">BraX3</string>
</resources>

View file

@ -0,0 +1,9 @@
//
// Copyright (C) 2022 The LineageOS Project
// SPDX-License-Identifier: Apache-2.0
//
runtime_resource_overlay {
name: "SettingsResOverlay",
vendor: true,
}

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2022 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.settings.overlay">
<overlay
android:isStatic="true"
android:priority="1"
android:targetPackage="com.android.settings" />
</manifest>

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2016 The CyanogenMod Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<!-- Whether to show Smooth Display feature in Settings Options -->
<bool name="config_show_smooth_display">true</bool>
</resources>

View file

@ -0,0 +1,9 @@
//
// Copyright (C) 2022 The LineageOS Project
// SPDX-License-Identifier: Apache-2.0
//
runtime_resource_overlay {
name: "SystemUIResOverlay",
vendor: true,
}

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2022 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.systemui.overlay">
<overlay
android:isStatic="true"
android:priority="250"
android:targetPackage="com.android.systemui" />
</manifest>

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2022 The Linux Foundation
SPDX-License-Identifier: BSD-3-Clause
-->
<resources>
<dimen name="status_bar_padding_start">12dp</dimen>
<dimen name="lock_icon_padding">30px</dimen>
</resources>

View file

@ -0,0 +1,9 @@
//
// Copyright (C) 2022 The LineageOS Project
// SPDX-License-Identifier: Apache-2.0
//
runtime_resource_overlay {
name: "TelephonyResOverlay",
vendor: true,
}

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2022 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.phone.overlay">
<overlay
android:isStatic="true"
android:priority="1"
android:targetPackage="com.android.phone" />
</manifest>

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2022 The Linux Foundation
SPDX-License-Identifier: BSD-3-Clause
-->
<resources>
<!-- String indicating the package name of the device ImsService implementation for MMTEL. -->
<string name="config_ims_mmtel_package">com.mediatek.ims</string>
<!-- String indicating the package name of the device ImsService implementation for RCS. -->
<string name="config_ims_rcs_package">com.mediatek.ims</string>
</resources>

View file

@ -0,0 +1,9 @@
//
// Copyright (C) 2022 The LineageOS Project
// SPDX-License-Identifier: Apache-2.0
//
runtime_resource_overlay {
name: "TetheringResOverlay",
vendor: true,
}

View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2022 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.networkstack.tethering.overlay">
<overlay
android:isStatic="true"
android:priority="250"
android:targetName="TetheringConfig"
android:targetPackage="com.android.networkstack.tethering" />
</manifest>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array translatable="false" name="config_tether_usb_regexs">
<item>"usb\\d"</item>
<item>"rndis\\d"</item>
</string-array>
<string-array translatable="false" name="config_tether_wifi_regexs">
<item>"softap\\d"</item>
<item>"ap\\d"</item>
<item>"ap_br_ap\\d"</item>
</string-array>
</resources>

View file

@ -0,0 +1,9 @@
//
// Copyright (C) 2022 The LineageOS Project
// SPDX-License-Identifier: Apache-2.0
//
runtime_resource_overlay {
name: "WifiResOverlay",
vendor: true,
}

View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2022 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.wifi.resources.overlay">
<overlay
android:isStatic="true"
android:targetName="WifiCustomization"
android:priority="0"
android:targetPackage="com.android.wifi.resources" />
</manifest>

View file

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2016 The CyanogenMod Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<!-- Indicates that 11ax mode is supported on this device
Note that if this flag is set to true, then 11ax is assumed to be supported.
However, if it is left to the default value of false, the 11ax support will
be checked via NL80211 interface -->
<!-- <bool name="config_wifi11axSupportOverride">true</bool> -->
<!-- Wifi driver supports IEEE80211AX for softap -->
<!-- <bool translatable="false" name="config_wifiSoftapIeee80211axSupported">true</bool> -->
<!-- boolean indicating whether the WiFi chipset has 5GHz band support.
Note: This config is replacing the config_wifi_dual_band_support
since more bands may now be supported (such as 6GHz), the naming dual_band
is no longer indicative, and a separate config now exists for each band -->
<bool translatable="false" name ="config_wifi5ghzSupport">true</bool>
<bool translatable="false" name ="config_wifiSoftap5ghzSupport">true</bool>
<!-- Wifi driver supports WPA3 Simultaneous Authentication of Equals (WPA3-SAE) for softap -->
<bool translatable="false" name="config_wifi_softap_sae_supported">true</bool>
<!-- Indicates that SAE Hash-to-Element is supported on this device -->
<bool translatable="false" name="config_wifiSaeH2eSupported">true</bool>
<!-- Wifi driver supports IEEE80211AX for softap -->
<!-- <bool translatable="false" name="config_wifiSoftapIeee80211axSupported">true</bool> -->
<!-- Boolean indicating whether the wifi chipset supports background scanning mechanism.
This mechanism allows the host to remain in suspend state and the dongle to actively
scan and wake the host when a configured SSID is detected by the dongle. This chipset
capability can provide power savings when wifi needs to be always kept on. -->
<bool translatable="false" name="config_wifi_background_scan_support">true</bool>
<!-- Indicates that connected MAC randomization is supported on this device -->
<bool translatable="false" name="config_wifi_connected_mac_randomization_supported">true</bool>
<!-- Boolean indicating whether 802.11r Fast BSS Transition is enabled on this platform -->
<bool translatable="false" name="config_wifi_fast_bss_transition_enabled">true</bool>
<!-- Indicates that p2p MAC randomization is supported on this device -->
<bool translatable="false" name="config_wifi_p2p_mac_randomization_supported">true</bool>
<!-- Indicates that AP mode MAC randomization is supported on this device -->
<bool translatable="false" name="config_wifi_ap_mac_randomization_supported">true</bool>
<!-- Wifi driver supports Automatic channel selection (ACS) for softap -->
<bool translatable="false" name="config_wifi_softap_acs_supported">true</bool>
<!-- Wifi driver supports IEEE80211AC for softap -->
<bool translatable="false" name="config_wifi_softap_ieee80211ac_supported">true</bool>
<!-- integer indicating additional disconnect delay (in ms) after IMS onLost() indication is received -->
<integer translatable="false" name="config_wifiDelayDisconnectOnImsLostMs">1000</integer>
<!-- List of allowed channels in 2GHz band for softap. If the device doesn't want to restrict
channels this should be empty. Values is a comma separated channel string and/or channel
range string like '1-6,11'. -->
<string translatable="false" name="config_wifiSoftap2gChannelList">1-13</string>
<!-- List of allowed channels in 5GHz band for softap. If the device doesn't want to restrict
channels this should be empty. Values is a comma separated channel string and/or channel
range string like '36-48,149'. -->
<string translatable="false" name="config_wifiSoftap5gChannelList">36,38,40,42,44,46,48,149,153,157,161,165</string>
<!-- Configure wifi tcp buffersizes in the form:
rmem_min,rmem_def,rmem_max,wmem_min,wmem_def,wmem_max -->
<string translatable="false" name="config_wifi_tcp_buffers">1730560,3461120,6922240,524288,1048576,4525824</string>
<!-- Debug for load build. DO NOT CHECKIN! -->
<!-- Indicate whether the verbose logging is always on -->
<!-- 0: verbose logging controlled by user
1: verbose logging on by default for userdebug
2: verbose logging on by default for all builds -->
<integer translatable="false" name="config_wifiVerboseLoggingAlwaysOnLevel">1</integer>
<!-- boolean indicating whether the Easy Connect (DPP) AKM is supported -->
<bool translatable="false" name ="config_wifiDppAkmSupported">true</bool>
</resources>

1368
proprietary-files.txt Normal file

File diff suppressed because it is too large Load diff

14
proprietary-firmware.txt Normal file
View file

@ -0,0 +1,14 @@
connsys_bt.img;AB
dpm.img;AB
gz.img;AB
lk.img;AB
logo.img;AB
mcf_ota.img;AB
mcupm.img;AB
md1img.img;AB
pi_img.img;AB
scp.img;AB
spmfw.img;AB
sspm.img;AB
tee.img;AB
vcp.img

1
sepolicy/vendor/cameraserver.te vendored Normal file
View file

@ -0,0 +1 @@
get_prop(cameraserver, vendor_persist_camera_prop)

1
sepolicy/vendor/ccci_mdinit.te vendored Normal file
View file

@ -0,0 +1 @@
allow ccci_mdinit mcf_ota_file:dir r_dir_perms;

1
sepolicy/vendor/ccci_rpcd.te vendored Normal file
View file

@ -0,0 +1 @@
allow ccci_rpcd para_block_device:blk_file rw_file_perms_no_map;

4
sepolicy/vendor/device.te vendored Normal file
View file

@ -0,0 +1,4 @@
type connsys_bt_block_device, dev_type;
type connsys_wifi_block_device, dev_type;
type connsys_gnss_block_device, dev_type;
type init_boot_block_device, dev_type;

5
sepolicy/vendor/file.te vendored Normal file
View file

@ -0,0 +1,5 @@
type proc_powerhal_cpu_ctrl, fs_type, proc_type;
type proc_touch_boost, fs_type, proc_type;
type proc_core_ctl, fs_type, proc_type;
type sysfs_thermal_efuse, fs_type, sysfs_type;
type sysfs_charging_control, fs_type, sysfs_type;

29
sepolicy/vendor/file_contexts vendored Normal file
View file

@ -0,0 +1,29 @@
/dev/focaltech_fp u:object_r:ff_device:s0
/data/vendor/focaltech(/.*)? u:object_r:ff_data_file:s0
/vendor/bin/hw/vendor\.focaltech\.hardware\.biometrics\.fingerprint@1\.0-service u:object_r:hal_fingerprint_default_exec:s0
/vendor/bin/hw/android\.hardware\.security\.keymint@2\.0-service\.trustonic u:object_r:hal_keymint_default_exec:s0
/vendor/bin/hw/android\.hardware\.usb-aidl-service\.mediatekv1\.0 u:object_r:mtk_hal_usb_exec:s0
/vendor/bin/hw/android\.hardware\.usb\.gadget-service\.mediatekv1\.1 u:object_r:mtk_hal_usb_exec:s0
/vendor/bin/hw/android\.hardware\.drm-service\.widevine u:object_r:hal_drm_widevine_exec:s0
/vendor/bin/hw/vendor\.mediatek\.hardware\.pq_aidl-service u:object_r:mtk_hal_pq_exec:s0
/vendor/lib64/vendor\.mediatek\.hardware\.pq_aidl-V[0-9]+-ndk\.so u:object_r:same_process_hal_file:s0
/vendor/lib64/vendor\.mediatek\.hardware\.pq@[0-9]+\.[0-9]+\.so u:object_r:same_process_hal_file:s0
/vendor/lib64/vendor\.mediatek\.hardware\.mmagent@[0-9]\.[0-9]\.so u:object_r:same_process_hal_file:s0
/vendor/lib(64)?/arm\.graphics-V[0-9]+-ndk\.so u:object_r:same_process_hal_file:s0
/vendor/lib(64)?/mt[0-9]+[a-z]*/arm\.graphics-V[0-9]+-ndk\.so u:object_r:same_process_hal_file:s0
/vendor/lib64/libaedv\.so u:object_r:same_process_hal_file:s0
/vendor/lib64/libpqsharememory\.so u:object_r:same_process_hal_file:s0
/vendor/lib64/libpqtuning\.so u:object_r:same_process_hal_file:s0
/vendor/lib64/libpqhdrmetaparser\.so u:object_r:same_process_hal_file:s0
/dev/ttyCMIPC5 u:object_r:gsm0710muxd_device:s0
/(vendor|system/vendor)/bin/touch_boost u:object_r:touch_boost_exec:s0
/dev/block/by-name/connsys_bt(_[ab])? u:object_r:connsys_bt_block_device:s0
/dev/block/by-name/connsys_wifi(_[ab])? u:object_r:connsys_wifi_block_device:s0
/dev/block/by-name/connsys_gnss(_[ab])? u:object_r:connsys_gnss_block_device:s0
/dev/block/by-name/init_boot(_[ab])? u:object_r:init_boot_block_device:s0
# SEC NFC
/(vendor|system/vendor)/bin/hw/android\.hardware\.nfc@1\.2-service.sec u:object_r:hal_nfc_default_exec:s0
/dev/sec-nfc u:object_r:nfc_device:s0

1
sepolicy/vendor/fsck.te vendored Normal file
View file

@ -0,0 +1 @@
allow fsck_untrusted sysfs_devices_block:dir search;

2
sepolicy/vendor/fuelgauged_nvram.te vendored Normal file
View file

@ -0,0 +1,2 @@
allow fuelgauged_nvram sysfs_dt_firmware_android:dir r_dir_perms;
allow fuelgauged_nvram sysfs_dt_firmware_android:file r_file_perms;

62
sepolicy/vendor/genfs_contexts vendored Normal file
View file

@ -0,0 +1,62 @@
genfscon sysfs /devices/platform/soc/soc:regulator-vibrator/leds/vibrator u:object_r:sysfs_vibrator:s0
genfscon sysfs /devices/platform/soc/1c804000.spmi/spmi-0/0-04/mt6377-gauge/power_supply/ u:object_r:sysfs_batteryinfo:s0
genfscon sysfs /devices/platform/soc/11b21000.i2c/i2c-5/5-006b/power_supply u:object_r:sysfs_batteryinfo:s0
genfscon proc /powerhal_cpu_ctrl u:object_r:proc_powerhal_cpu_ctrl:s0
genfscon proc /touch_boost u:object_r:proc_touch_boost:s0
genfscon proc /cpumgr/core_ioctl u:object_r:proc_core_ctl:s0
genfscon sysfs /devices/platform/efuse@11e80000/mtk-devinfo0/nvmem u:object_r:sysfs_thermal_efuse:s0
genfscon sysfs /devices/platform/soc/11c10000.efuse/mtk-devinfo0/nvmem u:object_r:sysfs_thermal_efuse:s0
genfscon sysfs /devices/platform/extcon_usb u:object_r:sysfs_extcon:s0
genfscon sysfs /devices/platform/soc/18000000.wifi/net/wlan0/type u:object_r:sysfs_net:s0
genfscon sysfs /devices/platform/soc/18000000.wifi/net/wlan0/wireless u:object_r:sysfs_net:s0
genfscon sysfs /devices/platform/charger/cmd_charge_disable u:object_r:sysfs_charging_control:s0
genfscon sysfs /devices/platform/charger/power_supply/mtk-mst-hvdiv-chg/power/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/charger/power_supply/mtk-slv-hvdiv-chg/power/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/charger/power_supply/mtk-slave-charger/power/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/charger/power_supply/mtk-master-charger/power/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/charger/power_supply/mtk-slv-div-chg/power/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/charger/power_supply/usb/power/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/charger/power_supply/mtk-mst-div-chg/power/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/11002000.serial/tty/ttyS1/power/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/11201000.usb0/power/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/11013000.spi3/spi_master/spi3/spi3.0/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/1c804000.spmi/spmi-0/0-03/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/1c804000.spmi/spmi-0/0-03/power/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/1c804000.spmi/spmi-0/0-04/mt6377-rtc/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/1c804000.spmi/spmi-0/0-04/mt6377-rtc/power/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/1c804000.spmi/spmi-0/0-04/mt6377-rtc/rtc/rtc0/alarmtimer.0.auto/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/1c804000.spmi/spmi-0/0-04/mt6377-rtc/rtc/rtc0/alarmtimer.0.auto/power/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/1c804000.spmi/spmi-0/0-04/mt6377-gauge/power_supply/mtk-gauge/power/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/1c804000.spmi/spmi-0/0-04/mt6377-gauge/power_supply/battery/power/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/1c804000.spmi/spmi-0/0-04/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/1c804000.spmi/spmi-0/0-04/power/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/11b20000.i2c/i2c-3/3-0027/wakeup/wakeup37 u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/11b21000.i2c/i2c-5/5-006b/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/11b21000.i2c/i2c-5/5-006b/power/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/11b21000.i2c/i2c-5/5-006b/power_supply/primary_chg/power/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/11b21000.i2c/i2c-5/5-0060/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/11001000.serial/tty/ttyS0/power/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/11db1000.i2c/i2c-6/6-0058/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/11db1000.i2c/i2c-6/6-0058/power/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/18002000.consys/power/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/1f000000.mdp/wakeup/wakeup40 u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/focaltech_fp/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/charger/power_supply/mtk-mst-hvdiv-chg/wakeup20 u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/charger/power_supply/mtk-slv-hvdiv-chg/wakeup21 u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/charger/power_supply/mtk-slave-charger/wakeup17 u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/charger/power_supply/mtk-master-charger/wakeup16 u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/charger/power_supply/mtk-slv-div-chg/wakeup19 u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/charger/power_supply/usb/wakeup22 u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/charger/power_supply/mtk-mst-div-chg/wakeup18 u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/1f000000.mdp/wakeup/wakeup39 u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/11013000.spi3/spi_master/spi3/spi3.0/wakeup/wakeup37 u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/1c804000.spmi/spmi-0/0-04/mt6377-rtc/wakeup/wakeup13 u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/1c804000.spmi/spmi-0/0-04/mt6377-rtc/rtc/rtc0/alarmtimer.0.auto/wakeup/wakeup14 u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/1c804000.spmi/spmi-0/0-04/mt6377-gauge/power_supply/mtk-gauge/wakeup35 u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/1c804000.spmi/spmi-0/0-04/mt6377-gauge/power_supply/battery/wakeup34 u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/11b21000.i2c/i2c-5/5-006b/wakeup/wakeup24 u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/11b21000.i2c/i2c-5/5-006b/power_supply/primary_chg/wakeup23 u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/11b21000.i2c/i2c-5/5-0060/wakeup/wakeup26 u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/11b21000.i2c/i2c-5/5-0060/wakeup/wakeup25 u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/trusty/wakeup/wakeup38 u:object_r:sysfs_wakeup:s0

View file

@ -0,0 +1,34 @@
# ------------------- focaltech fingerprint begin -------------------
type ff_service, vndservice_manager_type;
type ff_hwservice, hwservice_manager_type;
type ff_device, dev_type;
type ff_data_file, file_type, data_file_type;
vndbinder_use(hal_fingerprint_default)
hwbinder_use(hal_fingerprint_default)
allow hal_fingerprint_default ff_device:chr_file rw_file_perms;
allow hal_fingerprint_default self:netlink_kobject_uevent_socket { create setopt bind read };
allow hal_fingerprint_default ff_data_file:dir create_dir_perms;
allow hal_fingerprint_default ff_data_file:file create_file_perms;
allow hal_fingerprint_default ff_service:service_manager { add };
#allow hal_fingerprint_default power_service:service_manager { find };
#allow hal_fingerprint_default shell_exec:file rx_file_perms;
allow hal_fingerprint_default ff_hwservice:hwservice_manager { add };
allow hal_fingerprint_default ff_hwservice:hwservice_manager { find };
allow hal_fingerprint_default sysfs_leds:dir { search };
allow hal_fingerprint_default sysfs_leds:lnk_file { read };
allow hal_fingerprint_default sysfs_leds:file rw_file_perms;
#allow hal_fingerprint_default sysfs:file w_file_perms;
allow system_app hal_fingerprint_default:binder call;
allow hal_fingerprint_default ff_service:service_manager { find };
allow hal_fingerprint_default hal_fingerprint_default:binder { call };
#allow hal_fingerprint_default vendor_dmabuf_qseecom_heap_device:chr_file { ioctl read getattr lock map open watch watch_reads };
#allow hal_fingerprint_default vendor_dmabuf_qseecom_ta_heap_device:chr_file { ioctl read getattr lock map open watch watch_reads };
allow hal_fingerprint_default tee_device:chr_file { ioctl read getattr lock map open watch watch_reads };
# ------------------- focaltech fingerprint end ---------------------

View file

@ -0,0 +1 @@
allow hal_graphics_allocator_client hal_graphics_allocator_default_tmpfs:file rw_file_perms;

View file

@ -0,0 +1 @@
typeattribute hal_graphics_allocator_default_tmpfs mlstrustedobject;

View file

@ -0,0 +1,4 @@
get_prop(hal_graphics_composer_default, vendor_mtk_hwc_dsi_switch_prop)
allow hal_graphics_composer_default sysfs_leds:file rw_file_perms;
allow hal_graphics_composer_default sysfs_leds:dir r_dir_perms;
allow hal_graphics_composer_default dmabuf_system_secure_heap_device:chr_file r_file_perms_no_map;

View file

@ -0,0 +1 @@
allow hal_lineage_health_default sysfs_charging_control:file rw_file_perms;

1
sepolicy/vendor/hal_mtk_pq.te vendored Normal file
View file

@ -0,0 +1 @@
hal_attribute_service(hal_mtk_pq, mtk_hal_pq_service)

2
sepolicy/vendor/hwservice_contexts vendored Normal file
View file

@ -0,0 +1,2 @@
vendor.focaltech.hardware.biometrics.fingerprint::IFocalFingerprint u:object_r:ff_hwservice:s0
android.hardware.nfc::INfc u:object_r:hal_nfc_hwservice:s0

1
sepolicy/vendor/init.te vendored Normal file
View file

@ -0,0 +1 @@
allow init init_boot_block_device:lnk_file { relabelto };

2
sepolicy/vendor/ioctl_defines vendored Normal file
View file

@ -0,0 +1,2 @@
define(`PERFMGR_TOUCH_BOOST_GET_CMD', `0x6701')
define(`CORE_CTL_SET_LIMIT_CPUS', `0x6704')

2
sepolicy/vendor/mediaswcodec.te vendored Normal file
View file

@ -0,0 +1,2 @@
dontaudit mediaswcodec vendor_file:dir read;
get_prop(mediaserver, vendor_mtk_c2_vdec_fmt_prop)

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