sm8350-common: Initialize for Evolution X 10.x

* Update tree from https://github.com/kamikaonashi/android_device_xiaomi_sm8350-common
* Add HBM and DC Dimming support
* Add High touch polling support
* Add V4A support
* Add ZRAM control support
* Nuke XiaomiDolby

Revert "sm8350-common: dolby: Add profiles overlay for moto dolby"

This reverts commit a1e4e28e15.

Revert "sm8350-common: dolby: Update dax-default from moto"

This reverts commit bffcbea950.

Revert "sm8350-common: Switch dolby soundfx to libswdap"

This reverts commit 3dd36f1308.

Revert "sm8350-common: audio: Add dolby to audio effects"

This reverts commit f4593b53a5.

Revert "sm8350-common: audio: Apply NLSound 4.0 optimization for dolby"

This reverts commit 5bed45484c.

Revert "sm8350-common: audio: Forcefully disable volume leveler"

This reverts commit a521c14614.

Revert "sm8350-common: Build XiaomiDolby"

This reverts commit 0cf702da8d.

Revert "sm8350-common: Import Dolby audio blobs and sepolicy"

This reverts commit 73b8f5a29a.

Co-authored-by: Joey Huab <joey@evolution-x.org>
This commit is contained in:
kamikaonashi
2020-09-15 07:09:48 +07:00
committed by Joey Huab
parent 88bc7dfd06
commit ac7150df4c
93 changed files with 3424 additions and 2132 deletions

View File

@@ -6,6 +6,9 @@
soong_namespace {
imports: [
"hardware/xiaomi",
"hardware/google/interfaces",
"hardware/google/pixel",
"hardware/lineage/interfaces/power-libperfmgr",
],
}

View File

@@ -6,9 +6,7 @@
COMMON_PATH := device/xiaomi/sm8350-common
# Ignore overriding commands errors
BUILD_BROKEN_DUP_RULES := true
BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES := true
BOARD_VENDOR := xiaomi
# A/B
AB_OTA_PARTITIONS += \
@@ -37,11 +35,18 @@ TARGET_2ND_CPU_ABI := armeabi-v7a
TARGET_2ND_CPU_ABI2 := armeabi
TARGET_2ND_CPU_VARIANT := cortex-a76
# ART
ART_BUILD_TARGET_NDEBUG := true
ART_BUILD_TARGET_DEBUG := false
ART_BUILD_HOST_NDEBUG := true
ART_BUILD_HOST_DEBUG := false
# Audio
AUDIO_FEATURE_ENABLED_EXTENDED_COMPRESS_FORMAT := true
AUDIO_FEATURE_ENABLED_GKI := true
AUDIO_FEATURE_ENABLED_PROXY_DEVICE := true
BOARD_SUPPORTS_SOUND_TRIGGER := true
TARGET_INCLUDE_VIPERFX := true
TARGET_PROVIDES_AUDIO_EXTNS := true
# Bootloader
@@ -70,7 +75,9 @@ DEVICE_MATRIX_FILE := hardware/qcom-caf/common/compatibility_matrix.xml
DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE := \
hardware/qcom-caf/common/vendor_framework_compatibility_matrix.xml \
hardware/xiaomi/vintf/xiaomi_framework_compatibility_matrix.xml \
vendor/lineage/config/device_framework_matrix.xml
vendor/lineage/config/device_framework_matrix.xml \
$(COMMON_PATH)/hidl/vendor_framework_compatibility_matrix.xml \
$(COMMON_PATH)/hidl/xiaomi_framework_compatibility_matrix.xml
DEVICE_MANIFEST_FILE := \
$(COMMON_PATH)/hidl/manifest_lahaina.xml \
@@ -141,6 +148,7 @@ TARGET_BOARD_PLATFORM := lahaina
# Power
TARGET_POWERHAL_MODE_EXT := $(COMMON_PATH)/power/power-mode.cpp
TARGET_POWER_LIBPERFMGR_MODE_EXTENSION_LIB := //$(COMMON_PATH):libperfmgr-ext-xiaomi
# PowerShare
TARGET_POWERSHARE_PATH := /sys/class/qcom-battery/reverse_chg_mode
@@ -169,11 +177,13 @@ ENABLE_VENDOR_RIL_SERVICE := true
VENDOR_SECURITY_PATCH := $(PLATFORM_SECURITY_PATCH)
# Sepolicy
include device/lineage/sepolicy/libperfmgr/sepolicy.mk
include device/qcom/sepolicy_vndr/SEPolicy.mk
SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS += $(COMMON_PATH)/sepolicy/private
SYSTEM_EXT_PUBLIC_SEPOLICY_DIRS += $(COMMON_PATH)/sepolicy/public
BOARD_VENDOR_SEPOLICY_DIRS += $(COMMON_PATH)/sepolicy/vendor
SELINUX_IGNORE_NEVERALLOWS := true
# Verified Boot
BOARD_AVB_ENABLE := true

View File

@@ -41,15 +41,6 @@
<library name="volume_listener" path="libvolumelistener.so"/>
<library name="audiosphere" path="libasphere.so"/>
<library name="shoebox" path="libshoebox.so"/>
<!--DOLBY DAP-->
<library name="dap" path="libswdap.so"/>
<!--DOLBY END-->
<!--DOLBY GAME-->
<library name="gamedap" path="libswgamedap.so"/>
<!--DOLBY END-->
<!--DOLBY VQE-->
<library name="vqe" path="libswvqe.so"/>
<!--DOLBY END-->
</libraries>
<effects>
<effectProxy name="bassboost" library="proxy" uuid="14804144-a5ee-4d24-aa88-0002a5d5c51b">
@@ -86,6 +77,7 @@
<libhw library="visualizer_hw" uuid="7a8044a0-1a71-11e3-a184-0002a5d5c51b"/>
</effectProxy>
<effect name="downmix" library="downmix" uuid="93f04452-e4fe-41cc-91f9-e475b6d1d69f"/>
<effect name="hw_acc" library="offload_bundle" uuid="7d1580bd-297f-4683-9239-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="aec" library="audio_pre_processing" uuid="0f8d0d2a-59e5-45fe-b6e4-248c8a799109"/>
@@ -97,15 +89,6 @@
<effect name="notification_helper" library="volume_listener" uuid="0b776dde-0590-11e5-81ba-0025b32654a0"/>
<effect name="audiosphere" library="audiosphere" uuid="184e62ab-2d19-4364-9d1b-c0a40733866c"/>
<effect name="shoebox" library="shoebox" uuid="1eab784c-1a36-4b2a-b7fc-e34c44cab89e"/>
<!--DOLBY DAP-->
<effect name="dap" library="dap" uuid="9d4921da-8225-4f29-aefa-39537a04bcaa"/>
<!--DOLBY END-->
<!--DOLBY GAME-->
<effect name="gamedap" library="gamedap" uuid="3783c334-d3a0-4d13-874f-0032e5fb80e2"/>
<!--DOLBY END-->
<!--DOLBY VQE-->
<effect name="vqe" library="vqe" uuid="64a0f614-7fa4-48b8-b081-d59dc954616f"/>
<!--DOLBY END-->
</effects>
<postprocess>
<stream type="music">

View File

@@ -1,5 +1,5 @@
#
# Copyright (C) 2020 The LineageOS Project
# Copyright (C) 2024 The LineageOS Project
#
# SPDX-License-Identifier: Apache-2.0
#
@@ -44,9 +44,6 @@ PRODUCT_PACKAGES += \
android.hardware.audio@6.0-impl \
android.hardware.audio.effect@6.0-impl \
android.hardware.audio.service \
android.hardware.soundtrigger@2.0-impl \
android.hardware.soundtrigger@2.1-impl \
android.hardware.soundtrigger@2.2-impl \
android.hardware.soundtrigger@2.3-impl
PRODUCT_COPY_FILES += \
@@ -77,10 +74,6 @@ PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.audio.pro.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.pro.xml \
frameworks/native/data/etc/android.software.midi.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.midi.xml
# Audio configs (Dolby Atmos)
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/configs/audio/dax-default.xml:$(TARGET_COPY_OUT_VENDOR)/etc/dolby/dax-default.xml \
# A/B
AB_OTA_POSTINSTALL_CONFIG += \
RUN_POSTINSTALL_system=true \
@@ -141,7 +134,6 @@ PRODUCT_SET_DEBUGFS_RESTRICTIONS := true
# Device-specific settings
PRODUCT_PACKAGES += \
DSPVolumeSynchronizer \
XiaomiDolby \
XiaomiParts
# Display
@@ -154,6 +146,9 @@ PRODUCT_PACKAGES += \
vendor.qti.hardware.display.composer-service.xml \
vendor.qti.hardware.memtrack-service
PRODUCT_PACKAGES += \
android.hardware.graphics.allocator@3.0
PRODUCT_COPY_FILES += \
hardware/qcom-caf/sm8350/display/config/snapdragon_color_libs_config.xml:$(TARGET_COPY_OUT_VENDOR)/etc/snapdragon_color_libs_config.xml
@@ -337,15 +332,13 @@ PRODUCT_USE_DYNAMIC_PARTITIONS := true
# Power
PRODUCT_PACKAGES += \
android.hardware.power-service-qti
android.hardware.power-service.lineage-libperfmgr \
libqti-perfd-client
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/configs/task_profiles.json:$(TARGET_COPY_OUT_VENDOR)/etc/task_profiles.json \
$(LOCAL_PATH)/configs/powerhint.json:$(TARGET_COPY_OUT_VENDOR)/etc/powerhint.json
PRODUCT_COPY_FILES += \
vendor/qcom/opensource/power/config/lahaina/powerhint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/powerhint.xml
# QTI
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/configs/qti_whitelist.xml:$(TARGET_COPY_OUT_SYSTEM)/etc/sysconfig/qti_whitelist.xml \
@@ -381,6 +374,10 @@ PRODUCT_COPY_FILES += \
# Soong namespaces
PRODUCT_SOONG_NAMESPACES += \
$(LOCAL_PATH) \
hardware/google/interfaces \
hardware/google/pixel \
hardware/lineage/interfaces/power-libperfmgr \
hardware/qcom-caf/common/libqti-perfd-client \
hardware/xiaomi
# Telephony

File diff suppressed because it is too large Load Diff

View File

@@ -38,8 +38,13 @@ lib_fixups: lib_fixups_user_type = {
(
'com.qualcomm.qti.dpm.api@1.0',
'libmmosal',
'vendor.qti.diaghal@1.0',
'vendor.qti.hardware.wifidisplaysession@1.0',
'vendor.qti.imsrtpservice@3.0',
'vendor.xiaomi.hardware.misys@1.0',
'vendor.xiaomi.hardware.misys@2.0',
'vendor.xiaomi.hardware.misys@3.0',
'vendor.xiaomi.hardware.misys@4.0',
): lib_fixup_vendor_suffix,
}

View File

@@ -57,9 +57,6 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<hal format="hidl">
<name>android.hardware.soundtrigger</name>
<transport>hwbinder</transport>
<version>2.0</version>
<version>2.1</version>
<version>2.2</version>
<version>2.3</version>
<interface>
<name>ISoundTriggerHw</name>

View File

@@ -0,0 +1,125 @@
<!-- Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of The Linux Foundation nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<compatibility-matrix version="1.0" type="framework">
<hal format="aidl" optional="true">
<name>android.hardware.biometrics.fingerprint</name>
<version>4</version>
<interface>
<name>IFingerprint</name>
<instance>default</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.bluetooth.audio</name>
<version>4</version>
<interface>
<name>IBluetoothAudioProviderFactory</name>
<instance>default</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.drm</name>
<version>1</version>
<interface>
<name>IDrmFactory</name>
<instance>clearkey</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.health</name>
<version>3</version>
<interface>
<name>IHealth</name>
<instance>default</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.ir</name>
<version>1</version>
<interface>
<name>IConsumerIr</name>
<instance>default</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.power</name>
<version>5</version>
<interface>
<name>IPower</name>
<instance>default</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.sensors</name>
<version>2</version>
<interface>
<name>ISensors</name>
<instance>default</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.thermal</name>
<version>1</version>
<interface>
<name>IThermal</name>
<instance>default</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.usb</name>
<version>1</version>
<interface>
<name>IUsb</name>
<instance>default</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.wifi</name>
<version>1-2</version>
<interface>
<name>IWifi</name>
<instance>default</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.wifi.hostapd</name>
<version>2</version>
<interface>
<name>IHostapd</name>
<instance>default</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.wifi.supplicant</name>
<version>3</version>
<interface>
<name>ISupplicant</name>
<instance>default</instance>
</interface>
</hal>
</compatibility-matrix>

View File

@@ -0,0 +1,14 @@
<compatibility-matrix version="1.0" type="framework">
<hal format="hidl" optional="true">
<name>vendor.xiaomi.hardware.misys</name>
<transport>hwbinder</transport>
<version>1.0</version>
<version>2.0</version>
<version>3.0</version>
<version>4.0</version>
<interface>
<name>IMiSys</name>
<instance>default</instance>
</interface>
</hal>
</compatibility-matrix>

View File

@@ -1,10 +0,0 @@
[
{
"repository": "android_kernel_xiaomi_sm8350",
"target_path": "kernel/xiaomi/sm8350"
},
{
"repository": "android_hardware_xiaomi",
"target_path": "hardware/xiaomi"
}
]

View File

@@ -22,5 +22,6 @@
<item>restart_systemui</item>
<item>restart_recovery</item>
<item>restart_bootloader</item>
<item>restart_fastboot</item>
</string-array>
</resources>

View File

@@ -21,12 +21,6 @@
<!-- The restoring is handled by modem if it is true-->
<bool name="skip_restoring_network_selection">true</bool>
<!-- M user agent string -->
<string name="config_mms_user_agent">Android-Mms/2.0</string>
<!-- MMS user agent prolfile url -->
<string name="config_mms_user_agent_profile_url">http://www.google.com/oha/rdf/ua-profile-kila.xml</string>
<!-- This string array should be overridden by the device to present a list of network
attributes. This is used by the connectivity manager to decide which networks can coexist
based on the hardware -->
@@ -126,6 +120,11 @@
<!-- Flag specifying whether VoLTE is available on device -->
<bool name="config_device_vt_available">true</bool>
<!-- Flag specifying whether VT 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_vt_available">true</bool>
<!-- Flag specifying whether WFC over IMS is available on device -->
<bool name="config_device_wfc_ims_available">true</bool>
@@ -139,6 +138,11 @@
provisioning, availability etc -->
<bool name="config_carrier_wfc_ims_available">true</bool>
<!-- When true, indicates that the vendor's IMS implementation requires a workaround when
sending a request to enable or disable the camera while the video session is also
paused. -->
<bool name="config_useVideoPauseWorkaround">true</bool>
<!-- IWLAN data service package name to bind to by default. If none is specified in an overlay, an
empty string is passed in -->
<string name="config_wlan_data_service_package">vendor.qti.iwlan</string>
@@ -206,6 +210,9 @@
<!-- Should the pinner service pin the Home application? -->
<bool name="config_pinnerHomeApp">true</bool>
<!-- True if camera app should be pinned via Pinner Service -->
<bool name="config_pinnerCameraApp">false</bool>
<!-- Enable doze mode
ComponentName of a dream to show whenever the system would otherwise have gone to sleep. -->
<string translatable="false" name="config_dozeComponent">com.android.systemui/com.android.systemui.doze.DozeService</string>
@@ -289,4 +296,25 @@
<!-- Path to fast charging status file to detect whether an oem fast charger is active -->
<string name="config_oemFastChargerStatusPath" translatable="false">/sys/class/qcom-battery/fastchg_mode</string>
<!-- Control whether the pickup gesture is enabled by default. This value will be used
during initialization when the setting is still null. -->
<bool name="config_dozePickupGestureEnabled">false</bool>
<!-- Determines whether the shell features all run on another thread. -->
<bool name="config_enableShellMainThread">true</bool>
<!-- SQLite -->
<string name="db_default_journal_mode">MEMORY</string>
<string name="db_default_sync_mode">OFF</string>
<string name="db_wal_sync_mode">OFF</string>
<!-- Smart 5G -->
<bool name="config_supportSmart5G">true</bool>
<!-- Whether the device supports Smart Pixels -->
<bool name="config_supportSmartPixels">true</bool>
<!-- PowerOffAlarmService -->
<bool name="config_powerOffAlarmEnabled">true</bool>
</resources>

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/**
* 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.
*/
-->
<resources>
<!-- Set the automatic brightness mode on by default -->
<bool name="def_screen_brightness_automatic_mode">true</bool>
<!-- Speed up the animations -->
<fraction name="def_window_animation_scale">80%</fraction>
<fraction name="def_window_transition_scale">80%</fraction>
</resources>

View File

@@ -57,4 +57,13 @@
<!-- Preferred max refresh rate at keyguard, if supported by the display. -->
<integer name="config_keyguardMaxRefreshRate">60</integer>
<!-- Preferred max refresh rate at AOD & Ambient Display, if supported by the display. -->
<integer name="config_aodMaxRefreshRate">60</integer>
<!-- If not zero, limits the internal screen recorder's framerate to the set value. -->
<integer name="config_screenRecorderMaxFramerate">120</integer>
<!-- The CPU temperature divider, if needed -->
<integer name="config_cpuTempDivider" translatable="false">1000</integer>
</resources>

View File

@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2023-24 Paranoid Android
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<!-- Dolby Atmos -->
<string-array name="dolby_profile_entries">
<item>@string/dolby_profile_dynamic</item>
<item>@string/dolby_profile_video</item>
<item>@string/dolby_profile_music</item>
<item>@string/dolby_profile_game</item>
<item>@string/dolby_profile_voice</item>
</string-array>
<string-array name="dolby_profile_values">
<item>0</item>
<item>1</item>
<item>2</item>
<item>8</item>
<item>9</item>
</string-array>
</resources>

View File

@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2023-24 Paranoid Android
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<!-- Dolby profiles -->
<string name="dolby_profile_dynamic">Dynamic</string>
<string name="dolby_profile_video">Movie/Video</string>
<string name="dolby_profile_music">Music</string>
<string name="dolby_profile_game">Game</string>
<string name="dolby_profile_voice">Voice</string>
</resources>

View File

@@ -35,7 +35,7 @@
here. If this settings supports only 2 levels, for example, then the default intensity
should be either LOW (1) or HIGH (3).
-->
<integer name="config_vibration_supported_intensity_levels">2</integer>
<integer name="config_vibration_supported_intensity_levels">3</integer>
<!-- Max network scan search time in seconds -->
<integer name="config_network_scan_helper_max_search_time_sec">254</integer>
@@ -48,4 +48,13 @@
<!-- Whether to show min refresh rate in display settings -->
<bool name="config_show_min_refresh_rate_switch">true</bool>
<!-- Whether to show double tap ambient settings -->
<bool name="config_supports_double_tap_ambient" translatable="false">true</bool>
<!-- Whether to show volume steps settings -->
<bool name="config_supports_volume_steps" translatable="false">true</bool>
<!-- Whether to show vendor security patch level -->
<bool name="config_show_vendor_patch_level" translatable="false">false</bool>
</resources>

View File

@@ -19,4 +19,42 @@
<!-- String indicating the package name of the device ImsService implementation for RCS. -->
<string name="config_ims_rcs_package" translatable="false">org.codeaurora.ims</string>
<!-- Dynamic routing of emergency calls: trying normal routing if it's available.
Otherwise, emergency routing. -->
<bool name="dynamic_routing_emergency_enabled">true</bool>
<!-- Array of countries that the dynamic routing is supported.
Values should be ISO3166 country codes in lowercase. -->
<string-array name="config_countries_dynamic_routing_emergency_enabled"
translatable="false">
<item>in</item>
<item>il</item>
<item>tw</item>
<item>sg</item>
<item>ch</item>
<item>sk</item>
<item>pl</item>
<item>si</item>
<item>ba</item>
</string-array>
<!-- Array of emergency numbers for dynamic routing.
Values are the tuples of Country ISO, MNC, and numbers. -->
<string-array name="config_dynamic_routing_emergency_numbers"
translatable="false">
<item>in,,101,102,103,108</item>
<item>il,,101,102</item>
<item>tw,,110,119</item>
<item>sg,,995</item>
<item>ch,,1414</item>
<item>gp,,115,119,191,196,197,116000,116111,116117</item>
<item>sk,,159</item>
<item>pl,01,984,985,997,998,999</item>
<item>pl,06,984,985,997,998,999</item>
<item>pl,,986,987,989,991,992,993,994,995,996</item>
<item>re,,115,119,191,196,197,116000,116111,116117</item>
<item>si,,113</item>
<item>ba,,122,123,124</item>
</string-array>
</resources>

View File

@@ -73,6 +73,60 @@
android:permission="ThermalService">
</service>
<activity
android:name=".zram.ZramActivity"
android:label="@string/zram_size_title">
<intent-filter>
<action android:name="com.android.settings.action.IA_SETTINGS" />
</intent-filter>
<meta-data
android:name="com.android.settings.category"
android:value="com.android.settings.category.ia.battery" />
<meta-data
android:name="com.android.settings.summary"
android:resource="@string/zram_summary" />
</activity>
<activity
android:name=".power.PowerLimitActivity"
android:label="@string/power_limit_title">
<intent-filter>
<action android:name="com.android.settings.action.IA_SETTINGS" />
</intent-filter>
<meta-data
android:name="com.android.settings.category"
android:value="com.android.settings.category.ia.battery" />
<meta-data
android:name="com.android.settings.summary"
android:resource="@string/power_limit_summary" />
</activity>
<activity
android:name=".touchsampling.TouchSamplingSettingsActivity"
android:label="@string/htsr_enable_title"
android:theme="@style/Theme.SubSettingsBase"
android:exported="false">
<intent-filter>
<action android:name="com.android.settings.action.IA_SETTINGS" />
</intent-filter>
<meta-data
android:name="com.android.settings.category"
android:value="com.android.settings.category.ia.display" />
<meta-data
android:name="com.android.settings.summary"
android:resource="@string/htsr_enable_summary" />
</activity>
<service
android:name=".touchsampling.TouchSamplingTileService"
android:icon="@drawable/ic_htsr"
android:label="@string/htsr_enable_title"
android:exported="true"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE" />
</intent-filter>
</service>
<activity
android:name=".speaker.ClearSpeakerActivity"
android:label="@string/clear_speaker_title">
@@ -108,6 +162,63 @@
android:permission="RefreshService">
</service>
<service
android:name=".display.DcDimmingTileService"
android:exported="true"
android:icon="@drawable/ic_dc_tile"
android:label="@string/dc_dimming_enable_title"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
<intent-filter>
<action
android:name="android.service.quicksettings.action.QS_TILE"/>
</intent-filter>
</service>
<activity
android:name=".display.DcDimmingSettingsActivity"
android:label="@string/dc_dimming_enable_title"
android:exported="true"
android:theme="@style/Theme.SubSettingsBase">
<intent-filter>
<action android:name="com.android.settings.action.IA_SETTINGS" />
</intent-filter>
<meta-data
android:name="com.android.settings.category"
android:value="com.android.settings.category.ia.display" />
<meta-data
android:name="com.android.settings.summary"
android:resource="@string/dc_dimming_enable_summary" />
</activity>
<activity
android:name=".hbm.HBMActivity"
android:label="@string/hbm_fragment_title"
android:exported="false"
android:theme="@style/Theme.SubSettingsBase">
<intent-filter>
<action android:name="com.android.settings.action.IA_SETTINGS" />
</intent-filter>
<meta-data
android:name="com.android.settings.category"
android:value="com.android.settings.category.ia.display" />
<meta-data
android:name="com.android.settings.summary"
android:resource="@string/hbm_fragment_summary" />
</activity>
<activity
android:name=".hbm.HBMFragment" />
<service
android:name=".hbm.AutoHBMService"
android:exported="false" />
<service
android:name=".hbm.HBMModeTileService"
android:icon="@drawable/ic_hbm_tile"
android:label="@string/hbm_mode_title"
android:exported="true"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE" />
</intent-filter>
</service>
<service
android:name=".thermal.ThermalTileService"
android:icon="@drawable/ic_thermal"

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018-2021 crDroid Android 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24.0dp"
android:height="24.0dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0" >
<path
android:fillColor="?android:attr/colorControlNormal"
android:pathData="M19,13H5V11H19V13Z" />
</vector>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018-2021 crDroid Android 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24.0dp"
android:height="24.0dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0" >
<path
android:fillColor="?android:attr/colorControlNormal"
android:pathData="M38.0,26.0L26.0,26.0l0.0,12.0l-4.0,0.0L22.0,26.0L10.0,26.0l0.0,-4.0l12.0,0.0L22.0,10.0l4.0,0.0l0.0,12.0l12.0,0.0l0.0,4.0z" />
</vector>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018-2021 crDroid Android 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24.0dp"
android:height="24.0dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0" >
<path
android:fillColor="?android:attr/colorControlNormal"
android:pathData="M12.5,8C9.85,8 7.45,9 5.6,10.6L2,7V16H11L7.38,12.38C8.77,11.22 10.54,10.5 12.5,10.5C16.04,10.5 19.05,12.81 20.1,16L22.47,15.22C21.08,11.03 17.15,8 12.5,8Z" />
</vector>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#fff" android:pathData="M14,8.5A1.5,1.5 0 0,0 12.5,10A1.5,1.5 0 0,0 14,11.5A1.5,1.5 0 0,0 15.5,10A1.5,1.5 0 0,0 14,8.5M14,12.5A1.5,1.5 0 0,0 12.5,14A1.5,1.5 0 0,0 14,15.5A1.5,1.5 0 0,0 15.5,14A1.5,1.5 0 0,0 14,12.5M10,17A1,1 0 0,0 9,18A1,1 0 0,0 10,19A1,1 0 0,0 11,18A1,1 0 0,0 10,17M10,8.5A1.5,1.5 0 0,0 8.5,10A1.5,1.5 0 0,0 10,11.5A1.5,1.5 0 0,0 11.5,10A1.5,1.5 0 0,0 10,8.5M14,20.5A0.5,0.5 0 0,0 13.5,21A0.5,0.5 0 0,0 14,21.5A0.5,0.5 0 0,0 14.5,21A0.5,0.5 0 0,0 14,20.5M14,17A1,1 0 0,0 13,18A1,1 0 0,0 14,19A1,1 0 0,0 15,18A1,1 0 0,0 14,17M21,13.5A0.5,0.5 0 0,0 20.5,14A0.5,0.5 0 0,0 21,14.5A0.5,0.5 0 0,0 21.5,14A0.5,0.5 0 0,0 21,13.5M18,5A1,1 0 0,0 17,6A1,1 0 0,0 18,7A1,1 0 0,0 19,6A1,1 0 0,0 18,5M18,9A1,1 0 0,0 17,10A1,1 0 0,0 18,11A1,1 0 0,0 19,10A1,1 0 0,0 18,9M18,17A1,1 0 0,0 17,18A1,1 0 0,0 18,19A1,1 0 0,0 19,18A1,1 0 0,0 18,17M18,13A1,1 0 0,0 17,14A1,1 0 0,0 18,15A1,1 0 0,0 19,14A1,1 0 0,0 18,13M10,12.5A1.5,1.5 0 0,0 8.5,14A1.5,1.5 0 0,0 10,15.5A1.5,1.5 0 0,0 11.5,14A1.5,1.5 0 0,0 10,12.5M10,7A1,1 0 0,0 11,6A1,1 0 0,0 10,5A1,1 0 0,0 9,6A1,1 0 0,0 10,7M10,3.5A0.5,0.5 0 0,0 10.5,3A0.5,0.5 0 0,0 10,2.5A0.5,0.5 0 0,0 9.5,3A0.5,0.5 0 0,0 10,3.5M10,20.5A0.5,0.5 0 0,0 9.5,21A0.5,0.5 0 0,0 10,21.5A0.5,0.5 0 0,0 10.5,21A0.5,0.5 0 0,0 10,20.5M3,13.5A0.5,0.5 0 0,0 2.5,14A0.5,0.5 0 0,0 3,14.5A0.5,0.5 0 0,0 3.5,14A0.5,0.5 0 0,0 3,13.5M14,3.5A0.5,0.5 0 0,0 14.5,3A0.5,0.5 0 0,0 14,2.5A0.5,0.5 0 0,0 13.5,3A0.5,0.5 0 0,0 14,3.5M14,7A1,1 0 0,0 15,6A1,1 0 0,0 14,5A1,1 0 0,0 13,6A1,1 0 0,0 14,7M21,10.5A0.5,0.5 0 0,0 21.5,10A0.5,0.5 0 0,0 21,9.5A0.5,0.5 0 0,0 20.5,10A0.5,0.5 0 0,0 21,10.5M6,5A1,1 0 0,0 5,6A1,1 0 0,0 6,7A1,1 0 0,0 7,6A1,1 0 0,0 6,5M3,9.5A0.5,0.5 0 0,0 2.5,10A0.5,0.5 0 0,0 3,10.5A0.5,0.5 0 0,0 3.5,10A0.5,0.5 0 0,0 3,9.5M6,9A1,1 0 0,0 5,10A1,1 0 0,0 6,11A1,1 0 0,0 7,10A1,1 0 0,0 6,9M6,17A1,1 0 0,0 5,18A1,1 0 0,0 6,19A1,1 0 0,0 7,18A1,1 0 0,0 6,17M6,13A1,1 0 0,0 5,14A1,1 0 0,0 6,15A1,1 0 0,0 7,14A1,1 0 0,0 6,13Z" />
</vector>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:tint="?android:attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#000" android:pathData="M23.5,17L18.5,22L15,18.5L16.5,17L18.5,19L22,15.5L23.5,17M12,9A3,3 0 0,1 15,12A3,3 0 0,1 12,15A3,3 0 0,1 9,12A3,3 0 0,1 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.75,12.65 22.44,13.26 22.08,13.85C21.5,13.5 20.86,13.25 20.18,13.12L20.82,12C19.17,8.64 15.76,6.5 12,6.5C8.24,6.5 4.83,8.64 3.18,12C4.83,15.36 8.24,17.5 12,17.5L13.21,17.43C13.07,17.93 13,18.46 13,19V19.46L12,19.5C7,19.5 2.73,16.39 1,12C2.73,7.61 7,4.5 12,4.5Z" />
</vector>

View File

@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="#000"
android:pathData="M11,4V1H13V4ZM11,23V20H13V23ZM20,13V11H23V13ZM1,13V11H4V13ZM18.7,6.7 L17.3,5.3 19.05,3.5 20.5,4.95ZM4.95,20.5 L3.5,19.05 5.3,17.3 6.7,18.7ZM19.05,20.5 L17.3,18.7 18.7,17.3 20.5,19.05ZM5.3,6.7 L3.5,4.95 4.95,3.5 6.7,5.3ZM12,18Q9.5,18 7.75,16.25Q6,14.5 6,12Q6,9.5 7.75,7.75Q9.5,6 12,6Q14.5,6 16.25,7.75Q18,9.5 18,12Q18,14.5 16.25,16.25Q14.5,18 12,18ZM12,16Q13.675,16 14.838,14.837Q16,13.675 16,12Q16,10.325 14.838,9.162Q13.675,8 12,8Q10.325,8 9.163,9.162Q8,10.325 8,12Q8,13.675 9.163,14.837Q10.325,16 12,16ZM12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Z"/>
</vector>

View File

@@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="#000"
android:pathData="M20.22,10l-4.15,0.01c-0.16,-0.01 -0.31,0.02 -0.45,0.08l-0.59,0.26L13.2,6.25c-0.56,-1.26 -2.04,-1.83 -3.3,-1.27s-1.83,2.04 -1.27,3.3l3.3,7.45l-1.87,0.39c-0.19,0.05 -0.99,0.27 -1.36,1.21L8,19.19l6.78,2.67c0.49,0.19 1.05,0.18 1.53,-0.04l5.99,-2.65c0.89,-0.4 1.37,-1.38 1.13,-2.32l-1.36,-5.34C21.85,10.65 21.1,10.04 20.22,10zM21.49,17.34L15.5,20l-4.92,-1.96l4.18,-0.88l-4.3,-9.7c-0.11,-0.25 0,-0.55 0.25,-0.66c0.25,-0.11 0.55,0 0.66,0.25l2.5,5.65l1.61,-0.71L20.13,12L21.49,17.34zM2.06,5.56L1,4.5L4.5,1L8,4.5L6.94,5.56L5.32,3.94C5.11,4.76 5,5.62 5,6.5c0,2.42 0.82,4.65 2.2,6.43L6.13,14C4.49,11.95 3.5,9.34 3.5,6.5c0,-0.92 0.1,-1.82 0.3,-2.68L2.06,5.56z"/>
</vector>

View File

@@ -0,0 +1,11 @@
<!-- drawable/ic_info_outline.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="#000"
android:pathData="M11,17h2v-6h-2v6zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM11,9h2L13,7h-2v2z" />
</vector>

View File

@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017-2021 crDroid Android 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.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:gravity="center_vertical"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:background="?android:attr/activatedBackgroundIndicator"
android:clipToPadding="false">
<include layout="@layout/settingslib_icon_frame"/>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingTop="16dp"
android:paddingBottom="16dp">
<TextView
android:id="@android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceListItem"
android:ellipsize="marquee" />
<TextView
android:id="@android:id/summary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@android:id/title"
android:layout_alignStart="@android:id/title"
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
android:textColor="?android:attr/textColorSecondary"
android:maxLines="10"
android:ellipsize="end" />
<RelativeLayout
android:id="@+id/value_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@android:id/summary"
android:layout_alignStart="@android:id/title" >
<TextView
android:id="@+id/value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
android:textColor="?android:attr/textColorSecondary"
android:maxLines="1"
android:ellipsize="end" />
<ImageView
android:id="@+id/reset"
android:src="@drawable/ic_custom_seekbar_reset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_toEndOf="@id/value"
android:layout_centerVertical="true" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/seekbar_frame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/value_frame"
android:layout_alignStart="@android:id/title" >
<ImageView
android:id="@+id/minus"
android:src="@drawable/ic_custom_seekbar_minus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true" />
<ImageView
android:id="@+id/plus"
android:src="@drawable/ic_custom_seekbar_plus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true" />
<LinearLayout
android:id="@+id/seekbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_toEndOf="@id/minus"
android:layout_toStartOf="@id/plus"
android:layout_centerVertical="true" />
</RelativeLayout>
</RelativeLayout>
<!-- Preference should place its actual preference widget here. -->
<LinearLayout android:id="@android:id/widget_frame"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="end|center_vertical"
android:paddingStart="16dp"
android:orientation="vertical" />
</LinearLayout>

View File

@@ -25,4 +25,31 @@
<item>1</item>
<item>2</item>
</string-array>
<string-array name="zram_size_entries">
<item>Disabled</item>
<item>2GB</item>
<item>4GB</item>
<item>8GB</item>
<item>Dynamic (default)</item>
</string-array>
<string-array name="zram_size_values">
<item>0</item>
<item>2</item>
<item>4</item>
<item>8</item>
<item>-1</item>
</string-array>
<string-array name="zram_compression_entries">
<item>lz4 (default)</item>
<item>lzo</item>
<item>lzo-rle</item>
<item>zstd</item>
</string-array>
<string-array name="zram_compression_values">
<item>lz4</item>
<item>lzo</item>
<item>lzo-rle</item>
<item>zstd</item>
</string-array>
</resources>

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2016-2021 crDroid Android 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.
-->
<resources>
<!-- Base attributes available to CustomSeekBarPreference. -->
<declare-styleable name="CustomSeekBarPreference">
<attr name="defaultValueText" format="string" />
<attr name="interval" format="integer" />
<attr name="showSign" format="boolean" />
<attr name="units" format="string|reference" />
<attr name="continuousUpdates" format="boolean" />
</declare-styleable>
</resources>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="custom_seekbar_value">Value: <xliff:g id="v">%s</xliff:g></string>
<string name="custom_seekbar_default_value">by default</string>
<string name="custom_seekbar_default_value_to_set">Default value: <xliff:g id="v">%s</xliff:g>\nLong tap to set</string>
<string name="custom_seekbar_default_value_is_set">Default value is set</string>
</resources>

View File

@@ -48,5 +48,51 @@
<string name="clear_speaker_title">Clear speaker</string>
<string name="clear_speaker_summary">Play a 30-second audio to clear the speaker</string>
<string name="clear_speaker_description">Run this feature once or twice if you find that your speaker is lightly blocked by dust. Set media volume to maximum.\n\nIf the speaker is blocked heavily, run this feature 2-5 times while shaking your device with the speaker facing downwards.</string>
<!-- HBM settings -->
<string name="hbm_fragment_title">High brightness mode</string>
<string name="hbm_fragment_summary">Settings for HBM</string>
<string name="hbm_mode_title">HBM</string>
<string name="hbm_mode_summary">Enable peak luminance</string>
<string name="auto_hbm_title">Automatic HBM</string>
<string name="auto_hbm_summary">Enable peak luminance based on sunlight</string>
<string name="auto_hbm_threshold_title"></string>
<string name="auto_hbm_threshold_summary">threshold (lux)</string>
<string name="hbm_disable_time_title"></string>
<string name="hbm_disable_time_summary">disable delay (seconds)</string>
<string name="hbm_mode_warning">Long time usage of High brightness mode may damage your display</string>
<!-- DC dimming settings -->
<string name="dc_dimming_enable_title">DC Dimming</string>
<string name="dc_dimming_enable_summary">Reduces eye strain in low light conditions</string>
<string name="dc_dimming_enable_summary_not_supported">DC Dimming is currently not supported by the kernel</string>
<!-- High Touch Polling -->
<string name="htsr_title">Touch Responsiveness</string>
<string name="htsr_enable_title">Increase Touch Responsiveness</string>
<string name="htsr_enable_summary">Increases touch polling rate to decrease latency</string>
<string name="htsr_enable_summary_not_supported">Increase Touch Responsiveness is currently not supported by the kernel</string>
<!-- Zram Settings -->
<string name="zram_size_title">ZRAM size</string>
<string name="zram_size_summary">Configure ZRAM swap size</string>
<string name="zram_disabled">Disabled</string>
<string name="zram_size_dynamic">Dynamic (default)</string>
<string name="zram_size_2gb">2GB</string>
<string name="zram_size_4gb">4GB</string>
<string name="zram_size_8gb">8GB</string>
<string name="zram_summary">Choose which ZRAM settings to apply</string>
<string name="zram_change_applied">ZRAM setting saved (will apply after reboot)</string>
<string name="zram_reboot_recommended">For changes to take effect, please reboot your device</string>
<string name="zram_compression_title">Compression algorithm</string>
<string name="zram_compression_summary">Choose ZRAM compression algorithm</string>
<string name="swappiness_title">Swappiness</string>
<string name="swappiness_summary">Adjust how aggressively the kernel swaps memory pages (default: 60)</string>
<string name="swappiness_value">%1$d</string>
<string name="zram_change_failed">Failed to apply ZRAM settings</string>
<string name="advanced_settings">Advanced settings</string>
<!-- Power Limit -->
<string name="power_limit_title">CPU/GPU Frequency Limiter</string>
<string name="power_limit_summary">Reduce CPU and GPU frequencies for better battery life</string>
</resources>

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The CyanogenMod Project
2018-2019 The LineageOS 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.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/dc_dimming_enable_title">
<SwitchPreference
android:key="dc_dimming_enable"
android:defaultValue="false"
android:icon="@drawable/ic_dcdimming"
android:title="@string/dc_dimming_enable_title"
android:summary="@string/dc_dimming_enable_summary" />
</PreferenceScreen>

View File

@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2021 The Evolution X Project
Copyright (C) 2018-2021 crDroid Android 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.
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/org.lineageos.settings.HBMFragment"
android.title="@string/hbm_fragment_title">
<PreferenceCategory>
<SwitchPreference
android:key="hbm"
android:title="@string/hbm_mode_title"
android:summary="@string/hbm_mode_summary"
android:defaultValue="false" />
<SwitchPreference
android:key="auto_hbm"
android:title="@string/auto_hbm_title"
android:summary="@string/auto_hbm_summary" />
<org.lineageos.settings.hbm.AutoHBMThresholdPreference
android:key="auto_hbm_threshold"
android:title="@string/auto_hbm_threshold_title"
android:summary="@string/auto_hbm_threshold_summary" />
<org.lineageos.settings.hbm.AutoHBMTimePreference
android:key="hbm_disable_time"
android:title="@string/hbm_disable_time_title"
android:summary="@string/hbm_disable_time_summary" />
<Preference
android:icon="@drawable/ic_info_outline"
android:summary="@string/hbm_mode_warning"
android:persistent="false" />
</PreferenceCategory>
</PreferenceScreen>

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The CyanogenMod Project
2018-2019 The LineageOS 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.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/htsr_title">
<SwitchPreferenceCompat
android:defaultValue="false"
android:key="htsr_enable"
android:summary="@string/htsr_enable_summary"
android:title="@string/htsr_enable_title" />
</PreferenceScreen>

View File

@@ -0,0 +1,7 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<SwitchPreference
android:key="power_limit_pref"
android:title="@string/power_limit_title"
android:summary="@string/power_limit_summary"
android:defaultValue="false" />
</PreferenceScreen>

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:title="@string/zram_size_title">
<ListPreference
android:key="zram_size"
android:title="@string/zram_size_title"
android:summary="@string/zram_size_summary"
android:entries="@array/zram_size_entries"
android:entryValues="@array/zram_size_values"
android:defaultValue="-1" />
<ListPreference
android:key="zram_compression"
android:title="@string/zram_compression_title"
android:summary="@string/zram_compression_summary"
android:entries="@array/zram_compression_entries"
android:entryValues="@array/zram_compression_values"
android:defaultValue="lz4" />
<PreferenceCategory android:title="@string/advanced_settings">
<org.lineageos.settings.zram.CustomSeekBarPreference
android:key="swappiness"
android:title="@string/swappiness_title"
android:summary="@string/swappiness_summary"
android:defaultValue="60"
custom:interval="1"
custom:showSign="false"
custom:units="" />
</PreferenceCategory>
</PreferenceScreen>

View File

@@ -21,21 +21,39 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.content.SharedPreferences;
import android.os.SystemProperties;
import androidx.preference.PreferenceManager;
import org.lineageos.settings.doze.DozeUtils;
import org.lineageos.settings.thermal.ThermalUtils;
import org.lineageos.settings.refreshrate.RefreshUtils;
import org.lineageos.settings.utils.FileUtils;
public class BootCompletedReceiver extends BroadcastReceiver {
private static final boolean DEBUG = false;
private static final String TAG = "XiaomiParts";
private static final String DC_DIMMING_ENABLE_KEY = "dc_dimming_enable";
private static final String DC_DIMMING_NODE = "/sys/devices/platform/soc/soc:qcom,dsi-display-primary/dimlayer_exposure";
private static final String HTSR_ENABLE_KEY = "htsr_enable";
private static final String HTSR_FILE = "/sys/devices/virtual/touch/touch_dev/bump_sample_rate";
@Override
public void onReceive(final Context context, Intent intent) {
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
if (DEBUG)
Log.d(TAG, "Received boot completed intent");
DozeUtils.onBootCompleted(context);
ThermalUtils.startService(context);
RefreshUtils.startService(context);
RefreshUtils.startService(context);
// Touch Sampling
boolean HTSREnabled = sharedPrefs.getBoolean(HTSR_ENABLE_KEY, false);
FileUtils.writeLine(HTSR_FILE, HTSREnabled ? "1" : "0");
// DC Dimming
FileUtils.enableService(context);
boolean dcDimmingEnabled = sharedPrefs.getBoolean(DC_DIMMING_ENABLE_KEY, false);
FileUtils.writeLine(DC_DIMMING_NODE, dcDimmingEnabled ? "1" : "0");
}
}

View File

@@ -0,0 +1,34 @@
/*
* Copyright (C) 2015-2016 The CyanogenMod Project
* 2017,2021-2022 The LineageOS 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.
*/
package org.lineageos.settings.display;
import android.os.Bundle;
import com.android.settingslib.collapsingtoolbar.CollapsingToolbarBaseActivity;
public class DcDimmingSettingsActivity extends CollapsingToolbarBaseActivity {
private static final String TAG_DCDIMMING = "dcdimming";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getFragmentManager().beginTransaction().replace(com.android.settingslib.collapsingtoolbar.R.id.content_frame,
new DcDimmingSettingsFragment(), TAG_DCDIMMING).commit();
}
}

View File

@@ -0,0 +1,102 @@
/*
* Copyright (C) 2018 The LineageOS 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.
*/
package org.lineageos.settings.display;
import android.content.Context;
import android.os.Bundle;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.BroadcastReceiver;
import android.content.IntentFilter;
import androidx.preference.Preference;
import androidx.preference.Preference.OnPreferenceChangeListener;
import androidx.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import androidx.preference.SwitchPreference;
import android.provider.Settings;
import org.lineageos.settings.R;
import org.lineageos.settings.utils.FileUtils;
import java.io.File;
public class DcDimmingSettingsFragment extends PreferenceFragment implements
OnPreferenceChangeListener {
private SwitchPreference mDcDimmingPreference;
private static final String DC_DIMMING_ENABLE_KEY = "dc_dimming_enable";
private static final String DC_DIMMING_NODE = "/sys/devices/platform/soc/soc:qcom,dsi-display-primary/dimlayer_exposure";
private static final String HBM = "/sys/devices/platform/soc/soc:qcom,dsi-display-primary/hbm";
private static final String HBM_KEY = "hbm";
private File hbmFile;
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
setPreferencesFromResource(R.xml.dcdimming_settings, rootKey);
mDcDimmingPreference = findPreference(DC_DIMMING_ENABLE_KEY);
if (FileUtils.fileExists(DC_DIMMING_NODE)) {
mDcDimmingPreference.setEnabled(true);
mDcDimmingPreference.setOnPreferenceChangeListener(this);
} else {
mDcDimmingPreference.setSummary(R.string.dc_dimming_enable_summary_not_supported);
mDcDimmingPreference.setEnabled(false);
}
hbmFile = new File(HBM);
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (DC_DIMMING_ENABLE_KEY.equals(preference.getKey())) {
boolean enabled = (boolean) newValue;
FileUtils.writeLine(DC_DIMMING_NODE, enabled ? "1" : "0");
if (enabled) {
disableHBM();
}
updateHBMPreference(!enabled);
}
return true;
}
private void disableHBM() {
// Disable HBM mode
FileUtils.writeLine(HBM, "0");
// Make HBM mode path read-only
hbmFile.setReadOnly();
// Update HBM mode UI tile
updateHBMUI(false);
}
private void updateHBMUI(boolean enabled) {
Intent intent = new Intent("org.lineageos.settings.hbm.UPDATE_TILE");
intent.putExtra("enabled", enabled);
getActivity().sendBroadcast(intent);
// Update HBM preference UI
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(getContext());
sharedPrefs.edit().putBoolean(HBM_KEY, enabled).apply();
updateHBMPreference(enabled);
}
private void updateHBMPreference(boolean enabled) {
// Update HBM preference UI
if (mDcDimmingPreference != null) {
mDcDimmingPreference.setChecked(enabled);
}
}
}

View File

@@ -0,0 +1,125 @@
/*
* Copyright (C) 2018 The OmniROM Project
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package org.lineageos.settings.display;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.BroadcastReceiver;
import android.content.IntentFilter;
import android.service.quicksettings.Tile;
import android.service.quicksettings.TileService;
import androidx.preference.PreferenceManager;
import android.provider.Settings;
import org.lineageos.settings.utils.FileUtils;
import java.io.File;
public class DcDimmingTileService extends TileService {
public static final String DC_DIMMING_ENABLE_KEY = "dc_dimming_enable";
private static final String DC_DIMMING_NODE = "/sys/devices/platform/soc/soc:qcom,dsi-display-primary/dimlayer_exposure";
private static final String HBM = "/sys/devices/platform/soc/soc:qcom,dsi-display-primary/hbm";
private static final String HBM_KEY = "hbm";
private File hbmFile;
private BroadcastReceiver screenStateReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) {
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
Editor editor = sharedPrefs.edit();
editor.putBoolean(DC_DIMMING_ENABLE_KEY, false);
editor.apply();
updateUI(false);
disableHBM();
}
}
};
private void updateUI(boolean enabled) {
final Tile tile = getQsTile();
tile.setState(enabled ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
tile.updateTile();
}
private void disableHBM() {
// Disable HBM mode
FileUtils.writeLine(HBM, "0");
// Make HBM mode path read-only
hbmFile.setReadOnly();
// Update HBM mode UI tile
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
Editor editor = sharedPrefs.edit();
editor.putBoolean(HBM_KEY, false);
editor.apply();
updateHBMUI(false);
}
private void updateHBMUI(boolean enabled) {
Intent intent = new Intent("org.lineageos.settings.hbm.UPDATE_TILE");
intent.putExtra("enabled", enabled);
sendBroadcast(intent);
}
@Override
public void onCreate() {
super.onCreate();
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_SCREEN_OFF);
registerReceiver(screenStateReceiver, filter);
hbmFile = new File(HBM);
}
@Override
public void onDestroy() {
super.onDestroy();
unregisterReceiver(screenStateReceiver);
}
@Override
public void onStartListening() {
super.onStartListening();
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
updateUI(sharedPrefs.getBoolean(DC_DIMMING_ENABLE_KEY, false));
}
@Override
public void onStopListening() {
super.onStopListening();
}
@Override
public void onClick() {
super.onClick();
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
final boolean enabled = !(sharedPrefs.getBoolean(DC_DIMMING_ENABLE_KEY, false));
FileUtils.writeLine(DC_DIMMING_NODE, enabled ? "1" : "0");
if (enabled) {
disableHBM();
} else {
hbmFile.setWritable(true);
}
sharedPrefs.edit().putBoolean(DC_DIMMING_ENABLE_KEY, enabled).apply();
updateUI(enabled);
}
}

View File

@@ -0,0 +1,165 @@
package org.lineageos.settings.hbm;
import android.app.KeyguardManager;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.IBinder;
import android.os.PowerManager;
import android.provider.Settings;
import androidx.preference.PreferenceManager;
import org.lineageos.settings.utils.FileUtils;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
public class AutoHBMService extends Service {
private static final String HBM = "/sys/devices/platform/soc/soc:qcom,dsi-display-primary/hbm_enabled";
private static final String BACKLIGHT = "/sys/class/backlight/panel0-backlight/brightness";
private static boolean mAutoHBMActive = false;
private ExecutorService mExecutorService;
private SensorManager mSensorManager;
private Sensor mLightSensor;
private SharedPreferences mSharedPrefs;
private boolean dcDimmingEnabled;
private int mStoredBrightness = -1;
public void activateLightSensorRead() {
submit(() -> {
mSensorManager = (SensorManager) getApplicationContext().getSystemService(Context.SENSOR_SERVICE);
mLightSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_LIGHT);
mSensorManager.registerListener(mSensorEventListener, mLightSensor, SensorManager.SENSOR_DELAY_NORMAL);
});
}
public void deactivateLightSensorRead() {
submit(() -> {
mSensorManager.unregisterListener(mSensorEventListener);
mAutoHBMActive = false;
enableHBM(false);
});
}
private void enableHBM(boolean enable) {
if (enable) {
// Store current brightness before enabling HBM
if (mStoredBrightness == -1) {
mStoredBrightness = Settings.System.getInt(getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS, 255);
}
FileUtils.writeLine(HBM, "1");
FileUtils.writeLine(BACKLIGHT, "2047");
Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, 255);
} else {
FileUtils.writeLine(HBM, "0");
// Restore brightness when disabling HBM
if (mStoredBrightness != -1) {
FileUtils.writeLine(BACKLIGHT, String.valueOf(mStoredBrightness));
Settings.System.putInt(getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS, mStoredBrightness);
mStoredBrightness = -1;
}
}
}
private boolean isCurrentlyEnabled() {
return FileUtils.getFileValueAsBoolean(HBM, false);
}
private SensorEventListener mSensorEventListener = new SensorEventListener() {
@Override
public void onSensorChanged(SensorEvent event) {
float lux = event.values[0];
KeyguardManager km =
(KeyguardManager) getSystemService(getApplicationContext().KEYGUARD_SERVICE);
boolean keyguardShowing = km.inKeyguardRestrictedInputMode();
float luxThreshold = Float.parseFloat(mSharedPrefs.getString(HBMFragment.KEY_AUTO_HBM_THRESHOLD, "20000"));
long timeToDisableHBM = Long.parseLong(mSharedPrefs.getString(HBMFragment.KEY_HBM_DISABLE_TIME, "1"));
if (lux > luxThreshold) {
if ((!mAutoHBMActive || !isCurrentlyEnabled()) && !keyguardShowing && !dcDimmingEnabled) {
mAutoHBMActive = true;
enableHBM(true);
}
}
if (lux < luxThreshold) {
if (mAutoHBMActive) {
mExecutorService.submit(() -> {
try {
Thread.sleep(timeToDisableHBM * 1000);
} catch (InterruptedException ignored) {
}
if (lux < luxThreshold) {
mAutoHBMActive = false;
enableHBM(false);
}
});
}
}
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
// do nothing
}
};
private BroadcastReceiver mScreenStateReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (Intent.ACTION_SCREEN_ON.equals(intent.getAction())) {
activateLightSensorRead();
} else if (Intent.ACTION_SCREEN_OFF.equals(intent.getAction())) {
deactivateLightSensorRead();
}
}
};
@Override
public void onCreate() {
mExecutorService = Executors.newSingleThreadExecutor();
IntentFilter screenStateFilter = new IntentFilter(Intent.ACTION_SCREEN_ON);
screenStateFilter.addAction(Intent.ACTION_SCREEN_OFF);
registerReceiver(mScreenStateReceiver, screenStateFilter);
mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
if (pm.isInteractive()) {
activateLightSensorRead();
}
}
private Future<?> submit(Runnable runnable) {
return mExecutorService.submit(runnable);
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
return START_STICKY;
}
@Override
public void onDestroy() {
super.onDestroy();
unregisterReceiver(mScreenStateReceiver);
deactivateLightSensorRead();
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
}

View File

@@ -0,0 +1,55 @@
/*
* Copyright (C) 2016 The OmniROM Project
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package org.lineageos.settings.hbm;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.AttributeSet;
import androidx.preference.PreferenceManager;
import androidx.preference.PreferenceViewHolder;
public class AutoHBMThresholdPreference extends CustomSeekBarPreference {
private static int mMinVal = 0;
private static int mMaxVal = 60000;
private static int mDefVal = 20000;
public AutoHBMThresholdPreference(Context context, AttributeSet attrs) {
super(context, attrs);
mInterval = 1000;
mShowSign = false;
mUnits = "";
mContinuousUpdates = false;
mMinValue = mMinVal;
mMaxValue = mMaxVal;
mDefaultValueExists = true;
mDefaultValue = mDefVal;
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(getContext());
mValue = Integer.parseInt(sharedPrefs.getString(HBMFragment.KEY_AUTO_HBM_THRESHOLD, "20000"));
setPersistent(false);
}
@Override
protected void changeValue(int newValue) {
SharedPreferences.Editor prefChange = PreferenceManager.getDefaultSharedPreferences(getContext()).edit();
prefChange.putString(HBMFragment.KEY_AUTO_HBM_THRESHOLD, String.valueOf(newValue)).commit();
}
}

View File

@@ -0,0 +1,46 @@
/*
* Copyright (C) 2016 The OmniROM Project
2023 The Evolution X Project
* SPDX-License-Identifier: GPL-2.0-or-later
*/
package org.lineageos.settings.hbm;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.AttributeSet;
import android.util.Log;
import androidx.preference.Preference;
import androidx.preference.PreferenceManager;
import androidx.preference.PreferenceViewHolder;
public class AutoHBMTimePreference extends CustomSeekBarPreference {
private static int mMinVal = 1;
private static int mMaxVal = 10;
private static int mDefVal = 1;
public AutoHBMTimePreference(Context context, AttributeSet attrs) {
super(context, attrs);
mInterval = 1;
mShowSign = false;
mUnits = "";
mContinuousUpdates = false;
mMinValue = mMinVal;
mMaxValue = mMaxVal;
mDefaultValueExists = true;
mDefaultValue = mDefVal;
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(getContext());
mValue = Integer.parseInt(sharedPrefs.getString(HBMFragment.KEY_HBM_DISABLE_TIME, "1"));
setPersistent(false);
}
@Override
protected void changeValue(int newValue) {
SharedPreferences.Editor prefChange = PreferenceManager.getDefaultSharedPreferences(getContext()).edit();
prefChange.putString(HBMFragment.KEY_HBM_DISABLE_TIME, String.valueOf(newValue)).commit();
}
}

View File

@@ -0,0 +1,367 @@
/*
* Copyright (C) 2016-2021 crDroid Android 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.
*/
package org.lineageos.settings.hbm;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.PorterDuff;
import androidx.core.content.res.TypedArrayUtils;
import androidx.preference.*;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.ImageView;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.Toast;
import org.lineageos.settings.R;
public class CustomSeekBarPreference extends Preference implements SeekBar.OnSeekBarChangeListener {
protected final String TAG = getClass().getName();
private static final String SETTINGS_NS = "http://schemas.android.com/apk/res/com.android.settings";
protected static final String ANDROIDNS = "http://schemas.android.com/apk/res/android";
protected int mInterval = 1;
protected boolean mShowSign = false;
protected String mUnits = "";
protected boolean mContinuousUpdates = false;
protected int mMinValue = 0;
protected int mMaxValue = 100;
protected boolean mDefaultValueExists = false;
protected int mDefaultValue;
protected boolean mDefaultValueTextExists = false;
protected String mDefaultValueText;
protected int mValue;
protected TextView mValueTextView;
protected ImageView mResetImageView;
protected ImageView mMinusImageView;
protected ImageView mPlusImageView;
protected SeekBar mSeekBar;
protected boolean mTrackingTouch = false;
protected int mTrackingValue;
public CustomSeekBarPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CustomSeekBarPreference);
try {
mShowSign = a.getBoolean(R.styleable.CustomSeekBarPreference_showSign, mShowSign);
String units = a.getString(R.styleable.CustomSeekBarPreference_units);
if (units != null)
mUnits = " " + units;
mContinuousUpdates = a.getBoolean(R.styleable.CustomSeekBarPreference_continuousUpdates, mContinuousUpdates);
String defaultValueText = a.getString(R.styleable.CustomSeekBarPreference_defaultValueText);
mDefaultValueTextExists = defaultValueText != null && !defaultValueText.isEmpty();
if (mDefaultValueTextExists) {
mDefaultValueText = defaultValueText;
}
} finally {
a.recycle();
}
try {
String newInterval = attrs.getAttributeValue(SETTINGS_NS, "interval");
if (newInterval != null)
mInterval = Integer.parseInt(newInterval);
} catch (Exception e) {
Log.e(TAG, "Invalid interval value", e);
}
mMinValue = attrs.getAttributeIntValue(SETTINGS_NS, "min", mMinValue);
mMaxValue = attrs.getAttributeIntValue(ANDROIDNS, "max", mMaxValue);
if (mMaxValue < mMinValue)
mMaxValue = mMinValue;
String defaultValue = attrs.getAttributeValue(ANDROIDNS, "defaultValue");
mDefaultValueExists = defaultValue != null && !defaultValue.isEmpty();
if (mDefaultValueExists) {
mDefaultValue = getLimitedValue(Integer.parseInt(defaultValue));
mValue = mDefaultValue;
} else {
mValue = mMinValue;
}
mSeekBar = new SeekBar(context, attrs);
setLayoutResource(R.layout.preference_custom_seekbar);
}
public CustomSeekBarPreference(Context context, AttributeSet attrs, int defStyleAttr) {
this(context, attrs, defStyleAttr, 0);
}
public CustomSeekBarPreference(Context context, AttributeSet attrs) {
this(context, attrs, TypedArrayUtils.getAttr(context,
androidx.preference.R.attr.preferenceStyle,
android.R.attr.preferenceStyle));
}
public CustomSeekBarPreference(Context context) {
this(context, null);
}
@Override
public void onDependencyChanged(Preference dependency, boolean disableDependent) {
super.onDependencyChanged(dependency, disableDependent);
this.setShouldDisableView(true);
if (mSeekBar != null)
mSeekBar.setEnabled(!disableDependent);
if (mResetImageView != null)
mResetImageView.setEnabled(!disableDependent);
if (mPlusImageView != null)
mPlusImageView.setEnabled(!disableDependent);
if (mMinusImageView != null)
mMinusImageView.setEnabled(!disableDependent);
}
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
super.onBindViewHolder(holder);
try
{
// move our seekbar to the new view we've been given
ViewParent oldContainer = mSeekBar.getParent();
ViewGroup newContainer = (ViewGroup) holder.findViewById(R.id.seekbar);
if (oldContainer != newContainer) {
// remove the seekbar from the old view
if (oldContainer != null) {
((ViewGroup) oldContainer).removeView(mSeekBar);
}
// remove the existing seekbar (there may not be one) and add ours
newContainer.removeAllViews();
newContainer.addView(mSeekBar, ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
}
} catch (Exception ex) {
Log.e(TAG, "Error binding view: " + ex.toString());
}
mSeekBar.setMax(getSeekValue(mMaxValue));
mSeekBar.setProgress(getSeekValue(mValue));
mSeekBar.setEnabled(isEnabled());
mValueTextView = (TextView) holder.findViewById(R.id.value);
mResetImageView = (ImageView) holder.findViewById(R.id.reset);
mMinusImageView = (ImageView) holder.findViewById(R.id.minus);
mPlusImageView = (ImageView) holder.findViewById(R.id.plus);
updateValueViews();
mSeekBar.setOnSeekBarChangeListener(this);
mResetImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(getContext(), getContext().getString(R.string.custom_seekbar_default_value_to_set, getTextValue(mDefaultValue)),
Toast.LENGTH_LONG).show();
}
});
mResetImageView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
setValue(mDefaultValue, true);
return true;
}
});
mMinusImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
setValue(mValue - mInterval, true);
}
});
mMinusImageView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
setValue(mMaxValue - mMinValue > mInterval * 2 && mMaxValue + mMinValue < mValue * 2 ? Math.floorDiv(mMaxValue + mMinValue, 2) : mMinValue, true);
return true;
}
});
mPlusImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
setValue(mValue + mInterval, true);
}
});
mPlusImageView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
setValue(mMaxValue - mMinValue > mInterval * 2 && mMaxValue + mMinValue > mValue * 2 ? -1 * Math.floorDiv(-1 * (mMaxValue + mMinValue), 2) : mMaxValue, true);
return true;
}
});
}
protected int getLimitedValue(int v) {
return v < mMinValue ? mMinValue : (v > mMaxValue ? mMaxValue : v);
}
protected int getSeekValue(int v) {
return 0 - Math.floorDiv(mMinValue - v, mInterval);
}
protected String getTextValue(int v) {
if (mDefaultValueTextExists && mDefaultValueExists && v == mDefaultValue) {
return mDefaultValueText;
}
return (mShowSign && v > 0 ? "+" : "") + String.valueOf(v) + mUnits;
}
protected void updateValueViews() {
if (mValueTextView != null) {
if (!mTrackingTouch || mContinuousUpdates) {
if (mDefaultValueTextExists && mDefaultValueExists && mValue == mDefaultValue) {
mValueTextView.setText(mDefaultValueText + " (" +
getContext().getString(R.string.custom_seekbar_default_value) + ")");
} else {
mValueTextView.setText(getContext().getString(R.string.custom_seekbar_value, getTextValue(mValue)) +
(mDefaultValueExists && mValue == mDefaultValue ? " (" +
getContext().getString(R.string.custom_seekbar_default_value) + ")" : ""));
}
} else {
if (mDefaultValueTextExists && mDefaultValueExists && mTrackingValue == mDefaultValue) {
mValueTextView.setText("[" + mDefaultValueText + "]");
} else {
mValueTextView.setText(getContext().getString(R.string.custom_seekbar_value, "[" + getTextValue(mTrackingValue) + "]"));
}
}
}
if (mResetImageView != null) {
if (!mDefaultValueExists || mValue == mDefaultValue || mTrackingTouch)
mResetImageView.setVisibility(View.INVISIBLE);
else
mResetImageView.setVisibility(View.VISIBLE);
}
if (mMinusImageView != null) {
if (mValue == mMinValue || mTrackingTouch) {
mMinusImageView.setClickable(false);
mMinusImageView.setColorFilter(getContext().getColor(R.color.disabled_text_color),
PorterDuff.Mode.MULTIPLY);
} else {
mMinusImageView.setClickable(true);
mMinusImageView.clearColorFilter();
}
}
if (mPlusImageView != null) {
if (mValue == mMaxValue || mTrackingTouch) {
mPlusImageView.setClickable(false);
mPlusImageView.setColorFilter(getContext().getColor(R.color.disabled_text_color), PorterDuff.Mode.MULTIPLY);
} else {
mPlusImageView.setClickable(true);
mPlusImageView.clearColorFilter();
}
}
}
protected void changeValue(int newValue) {
// for subclasses
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
int newValue = getLimitedValue(mMinValue + (progress * mInterval));
if (mTrackingTouch && !mContinuousUpdates) {
mTrackingValue = newValue;
updateValueViews();
} else if (mValue != newValue) {
// change rejected, revert to the previous value
if (!callChangeListener(newValue)) {
mSeekBar.setProgress(getSeekValue(mValue));
return;
}
// change accepted, store it
changeValue(newValue);
persistInt(newValue);
mValue = newValue;
updateValueViews();
}
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
mTrackingValue = mValue;
mTrackingTouch = true;
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
mTrackingTouch = false;
if (!mContinuousUpdates)
onProgressChanged(mSeekBar, getSeekValue(mTrackingValue), false);
notifyChanged();
}
@Override
protected void onSetInitialValue(boolean restoreValue, Object defaultValue) {
if (restoreValue)
mValue = getPersistedInt(mValue);
}
@Override
public void setDefaultValue(Object defaultValue) {
if (defaultValue instanceof Integer)
setDefaultValue((Integer) defaultValue, mSeekBar != null);
else
setDefaultValue(defaultValue == null ? (String) null : defaultValue.toString(), mSeekBar != null);
}
public void setDefaultValue(int newValue, boolean update) {
newValue = getLimitedValue(newValue);
if (!mDefaultValueExists || mDefaultValue != newValue) {
mDefaultValueExists = true;
mDefaultValue = newValue;
if (update)
updateValueViews();
}
}
public void setDefaultValue(String newValue, boolean update) {
if (mDefaultValueExists && (newValue == null || newValue.isEmpty())) {
mDefaultValueExists = false;
if (update)
updateValueViews();
} else if (newValue != null && !newValue.isEmpty()) {
setDefaultValue(Integer.parseInt(newValue), update);
}
}
public void setValue(int newValue) {
mValue = getLimitedValue(newValue);
if (mSeekBar != null) mSeekBar.setProgress(getSeekValue(mValue));
}
public void setValue(int newValue, boolean update) {
newValue = getLimitedValue(newValue);
if (mValue != newValue) {
if (update)
mSeekBar.setProgress(getSeekValue(newValue));
else
mValue = newValue;
}
}
public int getValue() {
return mValue;
}
public void refresh(int newValue) {
// this will ...
setValue(newValue, mSeekBar != null);
}
}

View File

@@ -0,0 +1,45 @@
/*
* Copyright (C) 2017 The OmniROM Project
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package org.lineageos.settings.hbm;
import android.app.Fragment;
import android.os.Bundle;
import androidx.preference.PreferenceFragment;
import androidx.preference.PreferenceManager;
import com.android.settingslib.collapsingtoolbar.CollapsingToolbarBaseActivity;
public class HBMActivity extends CollapsingToolbarBaseActivity {
private HBMFragment mHBMFragment;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Fragment fragment = getFragmentManager().findFragmentById(com.android.settingslib.collapsingtoolbar.R.id.content_frame);
if (fragment == null) {
mHBMFragment = new HBMFragment();
getFragmentManager().beginTransaction()
.add(com.android.settingslib.collapsingtoolbar.R.id.content_frame, mHBMFragment)
.commit();
} else {
mHBMFragment = (HBMFragment) fragment;
}
}
}

View File

@@ -0,0 +1,80 @@
/*
* Copyright (C) 2016 The OmniROM Project
* Copyright (C) 2018-2021 crDroid Android Project
* Copyright (C) 2019-2022 Evolution X Project
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package org.lineageos.settings.hbm;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.os.Bundle;
import android.util.Log;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceFragment;
import androidx.preference.PreferenceManager;
import androidx.preference.TwoStatePreference;
import org.lineageos.settings.utils.FileUtils;
import org.lineageos.settings.R;
public class HBMFragment extends PreferenceFragment
implements Preference.OnPreferenceChangeListener {
private static final String TAG = HBMFragment.class.getSimpleName();
public static final String KEY_HBM_SWITCH = "hbm";
public static final String KEY_AUTO_HBM_SWITCH = "auto_hbm";
public static final String KEY_AUTO_HBM_THRESHOLD = "auto_hbm_threshold";
public static final String KEY_HBM_DISABLE_TIME = "hbm_disable_time";
private static TwoStatePreference mHBMModeSwitch;
private static TwoStatePreference mAutoHBMSwitch;
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this.getContext());
addPreferencesFromResource(R.xml.hbm_settings);
// HBM
mHBMModeSwitch = (TwoStatePreference) findPreference(KEY_HBM_SWITCH);
mHBMModeSwitch.setOnPreferenceChangeListener(new HBMModeSwitch(getContext()));
// AutoHBM
mAutoHBMSwitch = (TwoStatePreference) findPreference(KEY_AUTO_HBM_SWITCH);
mAutoHBMSwitch.setOnPreferenceChangeListener(this);
mAutoHBMSwitch.setChecked(PreferenceManager.getDefaultSharedPreferences(getContext()).getBoolean(HBMFragment.KEY_AUTO_HBM_SWITCH, false));
}
public static boolean isAUTOHBMEnabled(Context context) {
return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(HBMFragment.KEY_AUTO_HBM_SWITCH, false);
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (preference == mAutoHBMSwitch) {
Boolean enabled = (Boolean) newValue;
SharedPreferences.Editor prefChange = PreferenceManager.getDefaultSharedPreferences(getContext()).edit();
prefChange.putBoolean(KEY_AUTO_HBM_SWITCH, enabled).commit();
FileUtils.enableService(getContext());
return true;
}
return false;
}
}

View File

@@ -0,0 +1,77 @@
/*
* Copyright (C) 2016 The OmniROM Project
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package org.lineageos.settings.hbm;
import android.provider.Settings;
import android.content.Context;
import android.content.SharedPreferences;
import androidx.preference.Preference;
import androidx.preference.Preference.OnPreferenceChangeListener;
import androidx.preference.PreferenceManager;
import org.lineageos.settings.utils.FileUtils;
import org.lineageos.settings.display.*;
public class HBMModeSwitch implements OnPreferenceChangeListener {
private static final String HBM = "/sys/devices/platform/soc/soc:qcom,dsi-display-primary/hbm_enabled";
private static final String BACKLIGHT = "/sys/class/backlight/panel0-backlight/brightness";
private Context mContext;
public HBMModeSwitch(Context context) {
mContext = context;
}
public static String getHBM() {
if (FileUtils.isFileWritable(HBM)) {
return HBM;
}
return null;
}
public static String getBACKLIGHT() {
if (FileUtils.isFileWritable(BACKLIGHT)) {
return BACKLIGHT;
}
return null;
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
Boolean enabled = (Boolean) newValue;
boolean dcDimmingEnabled = PreferenceManager.getDefaultSharedPreferences(mContext).getBoolean(DcDimmingTileService.DC_DIMMING_ENABLE_KEY, false);
if (dcDimmingEnabled) {
return false;
}
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
if (enabled) {
// Save current brightness level
int currentBrightness = Settings.System.getInt(mContext.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, 128);
sharedPrefs.edit().putInt("last_brightness", currentBrightness).apply();
FileUtils.writeLine(getHBM(), "1");
FileUtils.writeLine(getBACKLIGHT(), "2047");
Settings.System.putInt(mContext.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, 255);
} else {
FileUtils.writeLine(getHBM(), "0");
// Restore last brightness level
int lastBrightness = sharedPrefs.getInt("last_brightness", 128);
Settings.System.putInt(mContext.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, lastBrightness);
}
return true;
}
}

View File

@@ -0,0 +1,110 @@
/*
* Copyright (C) 2018 The OmniROM Project
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package org.lineageos.settings.hbm;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.BroadcastReceiver;
import android.service.quicksettings.Tile;
import android.service.quicksettings.TileService;
import androidx.preference.PreferenceManager;
import android.provider.Settings;
import org.lineageos.settings.utils.FileUtils;
import org.lineageos.settings.display.*;
public class HBMModeTileService extends TileService {
private static final String HBM = "/sys/devices/platform/soc/soc:qcom,dsi-display-primary/hbm_enabled";
private static final String HBM_KEY = "hbm";
private static final String BACKLIGHT = "/sys/class/backlight/panel0-backlight/brightness";
private BroadcastReceiver screenStateReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) {
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
sharedPrefs.edit().putBoolean(HBM_KEY, false).commit();
updateUI(false);
}
}
};
private void updateUI(boolean enabled) {
final Tile tile = getQsTile();
tile.setState(enabled ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
tile.updateTile();
}
@Override
public void onCreate() {
super.onCreate();
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_SCREEN_OFF);
registerReceiver(screenStateReceiver, filter);
}
@Override
public void onDestroy() {
super.onDestroy();
unregisterReceiver(screenStateReceiver);
}
@Override
public void onStartListening() {
super.onStartListening();
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
updateUI(sharedPrefs.getBoolean(HBM_KEY, false));
}
@Override
public void onStopListening() {
super.onStopListening();
}
@Override
public void onClick() {
super.onClick();
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
final boolean dcDimmingEnabled = sharedPrefs.getBoolean(DcDimmingTileService.DC_DIMMING_ENABLE_KEY, false);
if (dcDimmingEnabled) {
return;
}
final boolean enabled = !(sharedPrefs.getBoolean(HBM_KEY, false));
if (enabled) {
// Save current brightness level
int currentBrightness = Settings.System.getInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, 128);
sharedPrefs.edit().putInt("last_brightness", currentBrightness).apply();
FileUtils.writeLine(HBM, "1");
FileUtils.writeLine(BACKLIGHT, "2047");
Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, 255);
} else {
FileUtils.writeLine(HBM, "0");
// Restore last brightness level
int lastBrightness = sharedPrefs.getInt("last_brightness", 128);
Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, lastBrightness);
}
sharedPrefs.edit().putBoolean(HBM_KEY, enabled).commit();
updateUI(enabled);
}
}

View File

@@ -0,0 +1,33 @@
/*
* Copyright (C) 2015-2016 The CyanogenMod Project
* 2017,2021-2025 The LineageOS 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.
*/
package org.lineageos.settings.power;
import android.os.Bundle;
import com.android.settingslib.collapsingtoolbar.CollapsingToolbarBaseActivity;
public class PowerLimitActivity extends CollapsingToolbarBaseActivity {
private static final String TAG_POWER_LIMIT = "powerlimit";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getFragmentManager().beginTransaction().replace(
com.android.settingslib.collapsingtoolbar.R.id.content_frame,
new PowerLimitFragment(), TAG_POWER_LIMIT).commit();
}
}

View File

@@ -0,0 +1,74 @@
/*
* Copyright (C) 2015-2016 The CyanogenMod Project
* 2017,2021-2025 The LineageOS 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.
*/
package org.lineageos.settings.power;
import android.os.Bundle;
import android.util.Log;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragment;
import androidx.preference.SwitchPreference;
import org.lineageos.settings.R;
public class PowerLimitFragment extends PreferenceFragment implements
Preference.OnPreferenceChangeListener {
private static final String TAG = "PowerLimitFragment";
private static final String PREF_POWER_LIMIT = "power_limit_pref";
private static final String NODE_PATH = "/sys/kernel/cpu_power_toggle/limit_mode";
private SwitchPreference mPowerLimitPref;
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
addPreferencesFromResource(R.xml.power_limit_settings);
mPowerLimitPref = (SwitchPreference) findPreference(PREF_POWER_LIMIT);
mPowerLimitPref.setOnPreferenceChangeListener(this);
mPowerLimitPref.setChecked(isCurrentlyLimited());
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (preference == mPowerLimitPref) {
boolean enabled = (Boolean) newValue;
return writeNode(enabled ? "1" : "0");
}
return false;
}
private boolean writeNode(String value) {
try (FileWriter fw = new FileWriter(NODE_PATH)) {
fw.write(value);
return true;
} catch (IOException e) {
Log.e(TAG, "Failed to write node", e);
return false;
}
}
private boolean isCurrentlyLimited() {
try {
return "1".equals(new java.util.Scanner(new File(NODE_PATH)).useDelimiter("\\A").next().trim());
} catch (Exception e) {
return false;
}
}
}

View File

@@ -0,0 +1,34 @@
/*
* Copyright (C) 2015-2016 The CyanogenMod Project
* 2017,2021-2022 The LineageOS 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.
*/
package org.lineageos.settings.touchsampling;
import android.os.Bundle;
import com.android.settingslib.collapsingtoolbar.CollapsingToolbarBaseActivity;
public class TouchSamplingSettingsActivity extends CollapsingToolbarBaseActivity {
private static final String TAG_HTSR = "touchsampling";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getFragmentManager().beginTransaction().replace(com.android.settingslib.collapsingtoolbar.R.id.content_frame,
new TouchSamplingSettingsFragment(), TAG_HTSR).commit();
}
}

View File

@@ -0,0 +1,56 @@
/*
* Copyright (C) 2018 The LineageOS 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.
*/
package org.lineageos.settings.touchsampling;
import android.content.Context;
import android.os.Bundle;
import androidx.preference.Preference;
import androidx.preference.Preference.OnPreferenceChangeListener;
import androidx.preference.PreferenceFragment;
import androidx.preference.SwitchPreferenceCompat;
import org.lineageos.settings.R;
import org.lineageos.settings.utils.FileUtils;
public class TouchSamplingSettingsFragment extends PreferenceFragment implements
OnPreferenceChangeListener {
private SwitchPreferenceCompat mTouchSamplingPreference;
private static final String HTSR_ENABLE_KEY = "htsr_enable";
private static final String HTSR_FILE = "/sys/devices/virtual/touch/touch_dev/bump_sample_rate";
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
addPreferencesFromResource(R.xml.htsr_settings);
mTouchSamplingPreference = (SwitchPreferenceCompat) findPreference(HTSR_ENABLE_KEY);
if (FileUtils.fileExists(HTSR_FILE)) {
mTouchSamplingPreference.setEnabled(true);
mTouchSamplingPreference.setOnPreferenceChangeListener(this);
} else {
mTouchSamplingPreference.setSummary(R.string.htsr_enable_summary_not_supported);
mTouchSamplingPreference.setEnabled(false);
}
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (HTSR_ENABLE_KEY.equals(preference.getKey())) {
FileUtils.writeLine(HTSR_FILE, (Boolean) newValue ? "1" : "0");
}
return true;
}
}

View File

@@ -0,0 +1,62 @@
/*
* Copyright (C) 2024 The LineageOS 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.
*/
package org.lineageos.settings.touchsampling;
import android.content.SharedPreferences;
import android.service.quicksettings.Tile;
import android.service.quicksettings.TileService;
import androidx.preference.PreferenceManager;
import org.lineageos.settings.utils.FileUtils;
public class TouchSamplingTileService extends TileService {
private static final String HTSR_ENABLE_KEY = "htsr_enable";
private static final String HTSR_FILE = "/sys/devices/virtual/touch/touch_dev/bump_sample_rate";
private void updateUI(boolean enabled) {
final Tile tile = getQsTile();
if (FileUtils.fileExists(HTSR_FILE)) {
tile.setState(enabled ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
} else {
tile.setState(Tile.STATE_UNAVAILABLE);
}
tile.updateTile();
}
@Override
public void onStartListening() {
super.onStartListening();
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
updateUI(sharedPrefs.getBoolean(HTSR_ENABLE_KEY, false));
}
@Override
public void onStopListening() {
super.onStopListening();
}
@Override
public void onClick() {
super.onClick();
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
final boolean enabled = !(sharedPrefs.getBoolean(HTSR_ENABLE_KEY, false));
FileUtils.writeLine(HTSR_FILE, enabled ? "1" : "0");
sharedPrefs.edit().putBoolean(HTSR_ENABLE_KEY, enabled).commit();
updateUI(enabled);
}
}

View File

@@ -18,6 +18,10 @@ package org.lineageos.settings.utils;
import android.util.Log;
import android.content.Context;
import android.content.Intent;
import android.os.UserHandle;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
@@ -26,6 +30,9 @@ import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import org.lineageos.settings.hbm.HBMFragment;
import org.lineageos.settings.hbm.AutoHBMService;
public final class FileUtils {
private static final String TAG = "FileUtils";
@@ -156,5 +163,38 @@ public final class FileUtils {
Log.e(TAG, "NullPointerException trying to rename " + srcPath + " to " + dstPath, e);
}
return ok;
}
public static boolean getFileValueAsBoolean(String filename, boolean defValue) {
String fileValue = readOneLine(filename);
if(fileValue!=null){
return (fileValue.equals("0")?false:true);
}
return defValue;
}
public static String getFileValue(String filename, String defValue) {
String fileValue = readOneLine(filename);
if(fileValue!=null){
return fileValue;
}
return defValue;
}
private static boolean mServiceEnabled = false;
private static void startService(Context context) {
context.startServiceAsUser(new Intent(context, AutoHBMService.class),
UserHandle.CURRENT);
mServiceEnabled = true;
}
private static void stopService(Context context) {
mServiceEnabled = false;
context.stopServiceAsUser(new Intent(context, AutoHBMService.class),
UserHandle.CURRENT);
}
public static void enableService(Context context) {
if (HBMFragment.isAUTOHBMEnabled(context) && !mServiceEnabled) {
startService(context);
} else if (!HBMFragment.isAUTOHBMEnabled(context) && mServiceEnabled) {
stopService(context);
}
}
}

View File

@@ -0,0 +1,367 @@
/*
* Copyright (C) 2016-2021 crDroid Android 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.
*/
package org.lineageos.settings.zram;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.PorterDuff;
import androidx.core.content.res.TypedArrayUtils;
import androidx.preference.*;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.ImageView;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.Toast;
import org.lineageos.settings.R;
public class CustomSeekBarPreference extends Preference implements SeekBar.OnSeekBarChangeListener {
protected final String TAG = getClass().getName();
private static final String SETTINGS_NS = "http://schemas.android.com/apk/res/com.android.settings";
protected static final String ANDROIDNS = "http://schemas.android.com/apk/res/android";
protected int mInterval = 1;
protected boolean mShowSign = false;
protected String mUnits = "";
protected boolean mContinuousUpdates = false;
protected int mMinValue = 0;
protected int mMaxValue = 100;
protected boolean mDefaultValueExists = false;
protected int mDefaultValue;
protected boolean mDefaultValueTextExists = false;
protected String mDefaultValueText;
protected int mValue;
protected TextView mValueTextView;
protected ImageView mResetImageView;
protected ImageView mMinusImageView;
protected ImageView mPlusImageView;
protected SeekBar mSeekBar;
protected boolean mTrackingTouch = false;
protected int mTrackingValue;
public CustomSeekBarPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CustomSeekBarPreference);
try {
mShowSign = a.getBoolean(R.styleable.CustomSeekBarPreference_showSign, mShowSign);
String units = a.getString(R.styleable.CustomSeekBarPreference_units);
if (units != null)
mUnits = " " + units;
mContinuousUpdates = a.getBoolean(R.styleable.CustomSeekBarPreference_continuousUpdates, mContinuousUpdates);
String defaultValueText = a.getString(R.styleable.CustomSeekBarPreference_defaultValueText);
mDefaultValueTextExists = defaultValueText != null && !defaultValueText.isEmpty();
if (mDefaultValueTextExists) {
mDefaultValueText = defaultValueText;
}
} finally {
a.recycle();
}
try {
String newInterval = attrs.getAttributeValue(SETTINGS_NS, "interval");
if (newInterval != null)
mInterval = Integer.parseInt(newInterval);
} catch (Exception e) {
Log.e(TAG, "Invalid interval value", e);
}
mMinValue = attrs.getAttributeIntValue(SETTINGS_NS, "min", mMinValue);
mMaxValue = attrs.getAttributeIntValue(ANDROIDNS, "max", mMaxValue);
if (mMaxValue < mMinValue)
mMaxValue = mMinValue;
String defaultValue = attrs.getAttributeValue(ANDROIDNS, "defaultValue");
mDefaultValueExists = defaultValue != null && !defaultValue.isEmpty();
if (mDefaultValueExists) {
mDefaultValue = getLimitedValue(Integer.parseInt(defaultValue));
mValue = mDefaultValue;
} else {
mValue = mMinValue;
}
mSeekBar = new SeekBar(context, attrs);
setLayoutResource(R.layout.preference_custom_seekbar);
}
public CustomSeekBarPreference(Context context, AttributeSet attrs, int defStyleAttr) {
this(context, attrs, defStyleAttr, 0);
}
public CustomSeekBarPreference(Context context, AttributeSet attrs) {
this(context, attrs, TypedArrayUtils.getAttr(context,
androidx.preference.R.attr.preferenceStyle,
android.R.attr.preferenceStyle));
}
public CustomSeekBarPreference(Context context) {
this(context, null);
}
@Override
public void onDependencyChanged(Preference dependency, boolean disableDependent) {
super.onDependencyChanged(dependency, disableDependent);
this.setShouldDisableView(true);
if (mSeekBar != null)
mSeekBar.setEnabled(!disableDependent);
if (mResetImageView != null)
mResetImageView.setEnabled(!disableDependent);
if (mPlusImageView != null)
mPlusImageView.setEnabled(!disableDependent);
if (mMinusImageView != null)
mMinusImageView.setEnabled(!disableDependent);
}
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
super.onBindViewHolder(holder);
try
{
// move our seekbar to the new view we've been given
ViewParent oldContainer = mSeekBar.getParent();
ViewGroup newContainer = (ViewGroup) holder.findViewById(R.id.seekbar);
if (oldContainer != newContainer) {
// remove the seekbar from the old view
if (oldContainer != null) {
((ViewGroup) oldContainer).removeView(mSeekBar);
}
// remove the existing seekbar (there may not be one) and add ours
newContainer.removeAllViews();
newContainer.addView(mSeekBar, ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
}
} catch (Exception ex) {
Log.e(TAG, "Error binding view: " + ex.toString());
}
mSeekBar.setMax(getSeekValue(mMaxValue));
mSeekBar.setProgress(getSeekValue(mValue));
mSeekBar.setEnabled(isEnabled());
mValueTextView = (TextView) holder.findViewById(R.id.value);
mResetImageView = (ImageView) holder.findViewById(R.id.reset);
mMinusImageView = (ImageView) holder.findViewById(R.id.minus);
mPlusImageView = (ImageView) holder.findViewById(R.id.plus);
updateValueViews();
mSeekBar.setOnSeekBarChangeListener(this);
mResetImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(getContext(), getContext().getString(R.string.custom_seekbar_default_value_to_set, getTextValue(mDefaultValue)),
Toast.LENGTH_LONG).show();
}
});
mResetImageView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
setValue(mDefaultValue, true);
return true;
}
});
mMinusImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
setValue(mValue - mInterval, true);
}
});
mMinusImageView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
setValue(mMaxValue - mMinValue > mInterval * 2 && mMaxValue + mMinValue < mValue * 2 ? Math.floorDiv(mMaxValue + mMinValue, 2) : mMinValue, true);
return true;
}
});
mPlusImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
setValue(mValue + mInterval, true);
}
});
mPlusImageView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
setValue(mMaxValue - mMinValue > mInterval * 2 && mMaxValue + mMinValue > mValue * 2 ? -1 * Math.floorDiv(-1 * (mMaxValue + mMinValue), 2) : mMaxValue, true);
return true;
}
});
}
protected int getLimitedValue(int v) {
return v < mMinValue ? mMinValue : (v > mMaxValue ? mMaxValue : v);
}
protected int getSeekValue(int v) {
return 0 - Math.floorDiv(mMinValue - v, mInterval);
}
protected String getTextValue(int v) {
if (mDefaultValueTextExists && mDefaultValueExists && v == mDefaultValue) {
return mDefaultValueText;
}
return (mShowSign && v > 0 ? "+" : "") + String.valueOf(v) + mUnits;
}
protected void updateValueViews() {
if (mValueTextView != null) {
if (!mTrackingTouch || mContinuousUpdates) {
if (mDefaultValueTextExists && mDefaultValueExists && mValue == mDefaultValue) {
mValueTextView.setText(mDefaultValueText + " (" +
getContext().getString(R.string.custom_seekbar_default_value) + ")");
} else {
mValueTextView.setText(getContext().getString(R.string.custom_seekbar_value, getTextValue(mValue)) +
(mDefaultValueExists && mValue == mDefaultValue ? " (" +
getContext().getString(R.string.custom_seekbar_default_value) + ")" : ""));
}
} else {
if (mDefaultValueTextExists && mDefaultValueExists && mTrackingValue == mDefaultValue) {
mValueTextView.setText("[" + mDefaultValueText + "]");
} else {
mValueTextView.setText(getContext().getString(R.string.custom_seekbar_value, "[" + getTextValue(mTrackingValue) + "]"));
}
}
}
if (mResetImageView != null) {
if (!mDefaultValueExists || mValue == mDefaultValue || mTrackingTouch)
mResetImageView.setVisibility(View.INVISIBLE);
else
mResetImageView.setVisibility(View.VISIBLE);
}
if (mMinusImageView != null) {
if (mValue == mMinValue || mTrackingTouch) {
mMinusImageView.setClickable(false);
mMinusImageView.setColorFilter(getContext().getColor(R.color.disabled_text_color),
PorterDuff.Mode.MULTIPLY);
} else {
mMinusImageView.setClickable(true);
mMinusImageView.clearColorFilter();
}
}
if (mPlusImageView != null) {
if (mValue == mMaxValue || mTrackingTouch) {
mPlusImageView.setClickable(false);
mPlusImageView.setColorFilter(getContext().getColor(R.color.disabled_text_color), PorterDuff.Mode.MULTIPLY);
} else {
mPlusImageView.setClickable(true);
mPlusImageView.clearColorFilter();
}
}
}
protected void changeValue(int newValue) {
// for subclasses
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
int newValue = getLimitedValue(mMinValue + (progress * mInterval));
if (mTrackingTouch && !mContinuousUpdates) {
mTrackingValue = newValue;
updateValueViews();
} else if (mValue != newValue) {
// change rejected, revert to the previous value
if (!callChangeListener(newValue)) {
mSeekBar.setProgress(getSeekValue(mValue));
return;
}
// change accepted, store it
changeValue(newValue);
persistInt(newValue);
mValue = newValue;
updateValueViews();
}
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
mTrackingValue = mValue;
mTrackingTouch = true;
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
mTrackingTouch = false;
if (!mContinuousUpdates)
onProgressChanged(mSeekBar, getSeekValue(mTrackingValue), false);
notifyChanged();
}
@Override
protected void onSetInitialValue(boolean restoreValue, Object defaultValue) {
if (restoreValue)
mValue = getPersistedInt(mValue);
}
@Override
public void setDefaultValue(Object defaultValue) {
if (defaultValue instanceof Integer)
setDefaultValue((Integer) defaultValue, mSeekBar != null);
else
setDefaultValue(defaultValue == null ? (String) null : defaultValue.toString(), mSeekBar != null);
}
public void setDefaultValue(int newValue, boolean update) {
newValue = getLimitedValue(newValue);
if (!mDefaultValueExists || mDefaultValue != newValue) {
mDefaultValueExists = true;
mDefaultValue = newValue;
if (update)
updateValueViews();
}
}
public void setDefaultValue(String newValue, boolean update) {
if (mDefaultValueExists && (newValue == null || newValue.isEmpty())) {
mDefaultValueExists = false;
if (update)
updateValueViews();
} else if (newValue != null && !newValue.isEmpty()) {
setDefaultValue(Integer.parseInt(newValue), update);
}
}
public void setValue(int newValue) {
mValue = getLimitedValue(newValue);
if (mSeekBar != null) mSeekBar.setProgress(getSeekValue(mValue));
}
public void setValue(int newValue, boolean update) {
newValue = getLimitedValue(newValue);
if (mValue != newValue) {
if (update)
mSeekBar.setProgress(getSeekValue(newValue));
else
mValue = newValue;
}
}
public int getValue() {
return mValue;
}
public void refresh(int newValue) {
// this will ...
setValue(newValue, mSeekBar != null);
}
}

View File

@@ -0,0 +1,42 @@
/*
* Copyright (C) 2025 The LineageOS 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.
*/
package org.lineageos.settings.zram;
import android.os.Bundle;
import android.view.MenuItem;
import com.android.settingslib.collapsingtoolbar.CollapsingToolbarBaseActivity;
public class ZramActivity extends CollapsingToolbarBaseActivity {
private static final String TAG_ZRAM = "zram";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getFragmentManager().beginTransaction().replace(
com.android.settingslib.collapsingtoolbar.R.id.content_frame,
new ZramSettingsFragment(), TAG_ZRAM).commit();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
onBackPressed();
return true;
}
return false;
}
}

View File

@@ -0,0 +1,125 @@
/*
* Copyright (C) 2025 The LineageOS 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.
*/
package org.lineageos.settings.zram;
import android.app.AlertDialog;
import android.content.Context;
import android.os.Bundle;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragment;
import org.lineageos.settings.R;
import org.lineageos.settings.zram.CustomSeekBarPreference;
public class ZramSettingsFragment extends PreferenceFragment
implements Preference.OnPreferenceChangeListener {
private static final String KEY_ZRAM_SIZE = "zram_size";
private static final String KEY_ZRAM_COMPRESSION = "zram_compression";
private static final String KEY_SWAPPINESS = "swappiness";
private ListPreference mZramSizePreference;
private ListPreference mZramCompressionPreference;
private CustomSeekBarPreference mSwappinessPreference;
private ZramUtils mZramUtils;
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
setPreferencesFromResource(R.xml.zram_settings, rootKey);
mZramUtils = new ZramUtils(getActivity());
// Initialize ZRAM size preference
mZramSizePreference = (ListPreference) findPreference(KEY_ZRAM_SIZE);
if (mZramSizePreference != null) {
int currentSize = mZramUtils.getCurrentZramSize();
mZramSizePreference.setValue(String.valueOf(currentSize));
updateSummary(currentSize);
mZramSizePreference.setOnPreferenceChangeListener(this);
}
// Initialize compression algorithm preference
mZramCompressionPreference = (ListPreference) findPreference(KEY_ZRAM_COMPRESSION);
if (mZramCompressionPreference != null) {
String currentComp = mZramUtils.getCurrentCompression();
mZramCompressionPreference.setValue(currentComp);
mZramCompressionPreference.setSummary(currentComp);
mZramCompressionPreference.setOnPreferenceChangeListener(this);
}
// Initialize swappiness preference
CustomSeekBarPreference swappinessPref = (CustomSeekBarPreference) findPreference(KEY_SWAPPINESS);
if (swappinessPref != null) {
int currentSwappiness = mZramUtils.getCurrentSwappiness();
swappinessPref.setValue(currentSwappiness);
swappinessPref.setOnPreferenceChangeListener(this);
updateSwappinessSummary(currentSwappiness);
}
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (KEY_ZRAM_SIZE.equals(preference.getKey())) {
try {
int value = Integer.parseInt((String) newValue);
mZramUtils.setZramSize(value);
updateSummary(value);
new AlertDialog.Builder(getActivity())
.setMessage(R.string.zram_reboot_recommended)
.setPositiveButton(android.R.string.ok, null)
.show();
return true;
} catch (NumberFormatException e) {
return false;
}
} else if (KEY_ZRAM_COMPRESSION.equals(preference.getKey())) {
String algorithm = (String) newValue;
mZramUtils.setCompressionAlgorithm(algorithm);
mZramCompressionPreference.setSummary(algorithm);
new AlertDialog.Builder(getActivity())
.setMessage(R.string.zram_reboot_recommended)
.setPositiveButton(android.R.string.ok, null)
.show();
return true;
} else if (KEY_SWAPPINESS.equals(preference.getKey())) {
int value = (Integer) newValue;
mZramUtils.setSwappiness(value);
updateSwappinessSummary(value);
return true;
}
return false;
}
private void updateSummary(int value) {
String summary;
switch (value) {
case 0: summary = getString(R.string.zram_disabled); break;
case 2: summary = getString(R.string.zram_size_2gb); break;
case 4: summary = getString(R.string.zram_size_4gb); break;
case 8: summary = getString(R.string.zram_size_8gb); break;
default: summary = getString(R.string.zram_size_dynamic);
}
mZramSizePreference.setSummary(summary);
}
private void updateSwappinessSummary(int value) {
if (mSwappinessPreference != null) {
mSwappinessPreference.setSummary(getString(R.string.swappiness_value, value));
}
}
}

View File

@@ -0,0 +1,166 @@
/*
* Copyright (C) 2025 The LineageOS 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.
*/
/*
* Copyright (C) 2025 The LineageOS 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.
*/
package org.lineageos.settings.zram;
import android.content.Context;
import android.os.SystemProperties;
import android.util.Log;
import android.widget.Toast;
import androidx.preference.PreferenceManager;
import android.content.SharedPreferences;
import org.lineageos.settings.R;
import java.io.FileWriter;
import java.io.IOException;
public class ZramUtils {
private static final String TAG = "ZramUtils";
private static final String ZRAM_PROP = "persist.vendor.zram.size";
private static final String ZRAM_COMP_PROP = "persist.vendor.zram.comp_algorithm";
private static final String SWAPPINESS_PROP = "persist.vendor.vm.swappiness";
private static final String PREF_ZRAM_SIZE = "zram_size";
private static final String PREF_ZRAM_COMP = "zram_compression";
private static final String PREF_SWAPPINESS = "swappiness";
private final Context mContext;
private final SharedPreferences mSharedPrefs;
public ZramUtils(Context context) {
mContext = context;
mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
}
public int getCurrentZramSize() {
// Try system property first
String propValue = SystemProperties.get(ZRAM_PROP, "-1");
if (!propValue.equals("-1")) {
try {
return Integer.parseInt(propValue);
} catch (NumberFormatException e) {
Log.e(TAG, "Invalid ZRAM size in property: " + propValue);
}
}
// Fall back to SharedPreferences
try {
return Integer.parseInt(mSharedPrefs.getString(PREF_ZRAM_SIZE, "-1"));
} catch (Exception e) {
return -1; // Default to dynamic size
}
}
public void setZramSize(int size) {
// Validate input
if (size != 0 && size != 2 && size != 4 && size != 8 && size != -1) {
Log.w(TAG, "Invalid ZRAM size: " + size);
return;
}
// Store in SharedPreferences as String
mSharedPrefs.edit()
.putString(PREF_ZRAM_SIZE, String.valueOf(size))
.apply();
// Set system property
SystemProperties.set(ZRAM_PROP, String.valueOf(size));
Toast.makeText(mContext, R.string.zram_change_applied, Toast.LENGTH_SHORT).show();
}
public String getCurrentCompression() {
String propValue = SystemProperties.get(ZRAM_COMP_PROP, "lz4");
if (!propValue.isEmpty()) {
return propValue;
}
return mSharedPrefs.getString(PREF_ZRAM_COMP, "lz4");
}
public int getCurrentSwappiness() {
String propValue = SystemProperties.get(SWAPPINESS_PROP, "60");
try {
return Integer.parseInt(propValue);
} catch (NumberFormatException e) {
return mSharedPrefs.getInt(PREF_SWAPPINESS, 60);
}
}
public void setCompressionAlgorithm(String algorithm) {
if (!algorithm.equals("lz4") && !algorithm.equals("lzo") &&
!algorithm.equals("lzo-rle") && !algorithm.equals("zstd")) {
Log.w(TAG, "Invalid compression algorithm: " + algorithm);
return;
}
mSharedPrefs.edit()
.putString(PREF_ZRAM_COMP, algorithm)
.apply();
SystemProperties.set(ZRAM_COMP_PROP, algorithm);
}
public void setSwappiness(int value) {
if (value < 0 || value > 100) {
Log.w(TAG, "Invalid swappiness value: " + value);
return;
}
// Store in SharedPreferences
mSharedPrefs.edit()
.putInt(PREF_SWAPPINESS, value)
.apply();
// Set system property
SystemProperties.set(SWAPPINESS_PROP, String.valueOf(value));
// Apply immediately
try {
FileWriter writer = new FileWriter("/proc/sys/vm/swappiness");
writer.write(String.valueOf(value));
writer.close();
} catch (IOException e) {
Log.e(TAG, "Failed to write to swappiness", e);
}
Toast.makeText(mContext, R.string.zram_change_applied, Toast.LENGTH_SHORT).show();
}
private boolean writeToFile(String path, String value) {
try (FileWriter writer = new FileWriter(path)) {
writer.write(value);
return true;
} catch (IOException e) {
Log.e(TAG, "Failed to write to " + path, e);
return false;
}
}
}

13
power/Android.bp Normal file
View File

@@ -0,0 +1,13 @@
cc_library_static {
name: "libperfmgr-ext-xiaomi",
defaults: [
"android.hardware.power-ndk_shared",
],
vendor: true,
srcs: [
"power-mode.cpp",
],
shared_libs: [
"libbase",
],
}

View File

@@ -19,10 +19,11 @@
#define TOUCH_IOC_SETMODE TOUCH_MAGIC + SET_CUR_VALUE
namespace aidl {
namespace android {
namespace google {
namespace hardware {
namespace power {
namespace impl {
namespace pixel {
using ::aidl::android::hardware::power::Mode;
@@ -53,5 +54,6 @@ bool setDeviceSpecificMode(Mode type, bool enabled) {
} // namespace impl
} // namespace power
} // namespace hardware
} // namespace android
} // namespace google
} // namespace aidl
} // namespace pixel

View File

@@ -124,6 +124,12 @@ vendor/bin/hw/vendor.qti.hardware.capabilityconfigstore@1.0-service
vendor/etc/init/vendor.qti.hardware.capabilityconfigstore@1.0-service.rc
vendor/lib64/hw/vendor.qti.hardware.capabilityconfigstore@1.0-impl.so
# Diag
vendor/bin/diag-router
vendor/etc/init/vendor.qti.diag.rc
vendor/etc/vintf/manifest/vendor.qti.diag.hal.service.xml
vendor/lib64/vendor.qti.diaghal@1.0.so;MODULE_SUFFIX=_vendor
# Display - from sunstone V816.0.8.0.UMQMIXM
vendor/etc/display/DPU660.xml|b26dd73e361546d89bf3d7082a471703dc6ac2cb
vendor/etc/display/DPU670.xml|e5131a60ceff29ca5eb561eec7eddadef1d0486f
@@ -246,6 +252,7 @@ vendor/lib64/libizat_client_api.so
vendor/lib64/libizat_core.so
vendor/lib64/liblbs_core.so
vendor/lib64/libloc_api_v02.so
vendor/lib64/libloc_api_wds.so|3d50102465e513df54d7354a41c4211fba870755
vendor/lib64/libloc_socket.so
vendor/lib64/liblocationservice.so
vendor/lib64/liblocationservice_glue.so
@@ -406,24 +413,6 @@ vendor/lib/libqcodec2_utils.so
vendor/lib/libqcodec2_v4l2codec.so
vendor/lib64/libmmosal.so;MODULE_SUFFIX=_vendor
# Media (Dolby)
vendor/bin/hw/vendor.dolby.hardware.dms@2.0-service
vendor/etc/init/vendor.dolby.hardware.dms@2.0-service.rc
vendor/etc/media_codecs_dolby_audio.xml
vendor/etc/vintf/manifest/manifest_vendor.dolby.hardware.dms.xml
vendor/lib/libdapparamstorage.so
vendor/lib/libdeccfg.so
vendor/lib/libstagefright_soft_ac4dec.so
vendor/lib/libstagefright_soft_ddpdec.so
vendor/lib/soundfx/libswdap.so|810d0e266e4a77f06cba72fe8bdde2e1ede4f9f9
vendor/lib/soundfx/libswgamedap.so
vendor/lib/soundfx/libswvqe.so
vendor/lib/vendor.dolby.hardware.dms@2.0.so
vendor/lib64/libdapparamstorage.so
vendor/lib64/libdlbdsservice.so
vendor/lib64/vendor.dolby.hardware.dms@2.0-impl.so
vendor/lib64/vendor.dolby.hardware.dms@2.0.so
# Mlipay
vendor/bin/mlipayd@1.1
vendor/etc/init/vendor.xiaomi.hardware.mlipay@1.1-service.rc
@@ -466,13 +455,15 @@ vendor/lib/hw/vendor.xiaomi.hardware.misys@1.0-impl.so
vendor/lib/hw/vendor.xiaomi.hardware.misys@2.0-impl.so
vendor/lib/hw/vendor.xiaomi.hardware.misys@3.0-impl.so
vendor/lib/hw/vendor.xiaomi.hardware.misys@4.0-impl.so
vendor/lib/libcheckpid.so
vendor/lib/liblogwrap_vendor.so
vendor/lib/libmicuttlefish_fs.so
vendor/lib/libmicuttlefish_utils.so
vendor/lib/libmivsock_utils.so
vendor/lib/vendor.xiaomi.hardware.misys@1.0.so
vendor/lib/vendor.xiaomi.hardware.misys@2.0.so
vendor/lib/vendor.xiaomi.hardware.misys@3.0.so
vendor/lib/vendor.xiaomi.hardware.misys@4.0.so
vendor/lib/vendor.xiaomi.hardware.misys@1.0.so;MODULE_SUFFIX=_vendor
vendor/lib/vendor.xiaomi.hardware.misys@2.0.so;MODULE_SUFFIX=_vendor
vendor/lib/vendor.xiaomi.hardware.misys@3.0.so;MODULE_SUFFIX=_vendor
vendor/lib/vendor.xiaomi.hardware.misys@4.0.so;MODULE_SUFFIX=_vendor
vendor/lib64/hw/vendor.xiaomi.hardware.misys@1.0-impl.so
vendor/lib64/hw/vendor.xiaomi.hardware.misys@2.0-impl.so
vendor/lib64/hw/vendor.xiaomi.hardware.misys@3.0-impl.so
@@ -482,10 +473,10 @@ vendor/lib64/liblogwrap_vendor.so
vendor/lib64/libmicuttlefish_fs.so
vendor/lib64/libmicuttlefish_utils.so
vendor/lib64/libmivsock_utils.so
vendor/lib64/vendor.xiaomi.hardware.misys@1.0.so
vendor/lib64/vendor.xiaomi.hardware.misys@2.0.so
vendor/lib64/vendor.xiaomi.hardware.misys@3.0.so
vendor/lib64/vendor.xiaomi.hardware.misys@4.0.so
vendor/lib64/vendor.xiaomi.hardware.misys@1.0.so;MODULE_SUFFIX=_vendor
vendor/lib64/vendor.xiaomi.hardware.misys@2.0.so;MODULE_SUFFIX=_vendor
vendor/lib64/vendor.xiaomi.hardware.misys@3.0.so;MODULE_SUFFIX=_vendor
vendor/lib64/vendor.xiaomi.hardware.misys@4.0.so;MODULE_SUFFIX=_vendor
# Neural networks
vendor/bin/hw/android.hardware.neuralnetworks@1.3-service-qti

View File

@@ -31,74 +31,65 @@
#=============================================================================
function configure_zram_parameters() {
MemTotalStr=`cat /proc/meminfo | grep MemTotal`
MemTotal=${MemTotalStr:16:8}
local zramSizeGB=$(getprop persist.vendor.zram.size)
local zramComp=$(getprop persist.vendor.zram.comp_algorithm)
local swappiness=$(getprop persist.vendor.vm.swappiness)
low_ram=`getprop ro.config.low_ram`
# Set swappiness
echo ${swappiness:-60} > /proc/sys/vm/swappiness
# Zram disk - 75% for Go and < 2GB devices .
# For >2GB Non-Go devices, size = 50% of RAM size. Limit the size to 4GB.
# And enable lz4 zram compression for Go targets.
case "$zramSizeGB" in
0)
zRamSizeMB=0
echo "ZRAM disabled by user choice."
return
;;
2)
zRamSizeMB=2048
;;
4)
zRamSizeMB=4096
;;
8)
zRamSizeMB=8192
;;
*)
# Default dynamic calculation
MemTotalStr=$(grep MemTotal /proc/meminfo)
MemTotal=${MemTotalStr:16:8}
let RamSizeGB="( $MemTotal / 1048576 ) + 1"
if [ $RamSizeGB -le 2 ]; then
let zRamSizeMB="( $RamSizeGB * 1024 ) * 3 / 4"
else
let zRamSizeMB="( $RamSizeGB * 1024 ) / 2"
fi
[ $zRamSizeMB -gt 4096 ] && zRamSizeMB=4096
;;
esac
let RamSizeGB="( $MemTotal / 1048576 ) + 1"
diskSizeUnit=M
if [ $RamSizeGB -le 2 ]; then
let zRamSizeMB="( $RamSizeGB * 1024 ) * 3 / 4"
else
let zRamSizeMB="( $RamSizeGB * 1024 ) / 2"
fi
if [ -f /sys/block/zram0/disksize ]; then
# Set compression algorithm
if [ -n "$zramComp" ] && grep -q "$zramComp" /sys/block/zram0/comp_algorithm; then
echo "$zramComp" > /sys/block/zram0/comp_algorithm
else
echo "lz4" > /sys/block/zram0/comp_algorithm
fi
# use MB avoid 32 bit overflow
if [ $zRamSizeMB -gt 4096 ]; then
let zRamSizeMB=4096
fi
if [ -f /sys/block/zram0/use_dedup ]; then
echo 1 > /sys/block/zram0/use_dedup
fi
echo "${zRamSizeMB}M" > /sys/block/zram0/disksize
if [ "$low_ram" == "true" ]; then
echo lz4 > /sys/block/zram0/comp_algorithm
fi
if [ -e /sys/kernel/slab/zs_handle ]; then
echo 0 > /sys/kernel/slab/zs_handle/store_user
fi
if [ -e /sys/kernel/slab/zspage ]; then
echo 0 > /sys/kernel/slab/zspage/store_user
fi
if [ -f /sys/block/zram0/disksize ]; then
if [ -f /sys/block/zram0/use_dedup ]; then
echo 1 > /sys/block/zram0/use_dedup
fi
echo "$zRamSizeMB""$diskSizeUnit" > /sys/block/zram0/disksize
# ZRAM may use more memory than it saves if SLAB_STORE_USER
# debug option is enabled.
if [ -e /sys/kernel/slab/zs_handle ]; then
echo 0 > /sys/kernel/slab/zs_handle/store_user
fi
if [ -e /sys/kernel/slab/zspage ]; then
echo 0 > /sys/kernel/slab/zspage/store_user
fi
mkswap /dev/block/zram0
swapon /dev/block/zram0 -p 32758
fi
}
function configure_read_ahead_kb_values() {
MemTotalStr=`cat /proc/meminfo | grep MemTotal`
MemTotal=${MemTotalStr:16:8}
dmpts=$(ls /sys/block/*/queue/read_ahead_kb | grep -e dm -e mmc)
# Set 128 for <= 3GB &
# set 512 for >= 4GB targets.
if [ $MemTotal -le 3145728 ]; then
ra_kb=128
else
ra_kb=512
fi
if [ -f /sys/block/mmcblk0/bdi/read_ahead_kb ]; then
echo $ra_kb > /sys/block/mmcblk0/bdi/read_ahead_kb
fi
if [ -f /sys/block/mmcblk0rpmb/bdi/read_ahead_kb ]; then
echo $ra_kb > /sys/block/mmcblk0rpmb/bdi/read_ahead_kb
fi
for dm in $dmpts; do
echo $ra_kb > $dm
done
mkswap /dev/block/zram0
swapon /dev/block/zram0 -p 32758
fi
}
function configure_memory_parameters() {
@@ -123,7 +114,6 @@ function configure_memory_parameters() {
configure_zram_parameters
configure_read_ahead_kb_values
echo 100 > /proc/sys/vm/swappiness
echo 1 > /proc/sys/vm/watermark_scale_factor
# add memory limit to camera cgroup

View File

@@ -199,7 +199,7 @@ echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/pl
# configure input boost settings
echo "0:1324800" > /sys/devices/system/cpu/cpu_boost/input_boost_freq
echo 120 > /sys/devices/system/cpu/cpu_boost/input_boost_ms
echo 200 > /sys/devices/system/cpu/cpu_boost/input_boost_ms
# configure governor settings for gold cluster
echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy4/scaling_governor

View File

@@ -35,19 +35,17 @@
# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
system /system ext4 ro,barrier=1,discard wait,slotselect,avb=vbmeta_system,logical,first_stage_mount,avb_keys=/avb/q-gsi.avbpubkey:/avb/r-gsi.avbpubkey:/avb/s-gsi.avbpubkey
system_ext /system_ext ext4 ro,barrier=1,discard wait,slotselect,avb,logical,first_stage_mount
product /product ext4 ro,barrier=1,discard wait,slotselect,avb,logical,first_stage_mount
vendor /vendor ext4 ro,barrier=1,discard wait,slotselect,avb=vbmeta,logical,first_stage_mount
vendor_dlkm /vendor_dlkm ext4 ro,barrier=1,discard wait,slotselect,avb,logical,first_stage_mount
odm /odm ext4 ro,barrier=1,discard wait,slotselect,avb,logical,first_stage_mount
/dev/block/by-name/metadata /metadata ext4 noatime,nosuid,nodev,discard wait,check,formattable,first_stage_mount
system /system ext4 noatime,ro,barrier=1,discard wait,slotselect,avb=vbmeta_system,logical,first_stage_mount,avb_keys=/avb/q-gsi.avbpubkey:/avb/r-gsi.avbpubkey:/avb/s-gsi.avbpubkey
system_ext /system_ext ext4 noatime,ro,barrier=1,discard wait,slotselect,avb,logical,first_stage_mount
product /product ext4 noatime,ro,barrier=1,discard wait,slotselect,avb,logical,first_stage_mount
vendor /vendor ext4 noatime,ro,barrier=1,discard wait,slotselect,avb=vbmeta,logical,first_stage_mount
vendor_dlkm /vendor_dlkm ext4 noatime,ro,barrier=1,discard wait,slotselect,avb,logical,first_stage_mount
odm /odm ext4 noatime,ro,barrier=1,discard wait,slotselect,avb,logical,first_stage_mount
/dev/block/by-name/metadata /metadata ext4 noatime,nosuid,nodev,discard,data=journal,commit=1 wait,check,formattable,first_stage_mount,metadata_csum
/dev/block/bootdevice/by-name/persist /mnt/vendor/persist ext4 noatime,nosuid,nodev,barrier=1 wait
/dev/block/bootdevice/by-name/userdata /data f2fs noatime,nosuid,nodev,discard,inlinecrypt,reserve_root=32768,resgid=1065,fsync_mode=nobarrier latemount,wait,check,formattable,fileencryption=aes-256-xts:aes-256-cts:v2+inlinecrypt_optimized+wrappedkey_v0,keydirectory=/metadata/vold/metadata_encryption,metadata_encryption=aes-256-xts:wrappedkey_v0,quota,reservedsize=128M,sysfs_path=/sys/devices/platform/soc/1d84000.ufshc,checkpoint=fs
/dev/block/bootdevice/by-name/misc /misc emmc defaults defaults
/devices/platform/soc/8804000.sdhci/mmc_host* /storage/sdcard1 vfat nosuid,nodev wait,voldmanaged=sdcard1:auto,encryptable=footer
/devices/platform/soc/1da4000.ufshc_card/host* /storage/sdcard1 vfat nosuid,nodev wait,voldmanaged=sdcard1:auto,encryptable=footer
/devices/platform/soc/*.ssusb/*.dwc3/xhci-hcd.*.auto* /storage/usbotg vfat nosuid,nodev wait,voldmanaged=usbotg:auto
/devices/platform/soc/*.ssusb/*.dwc3/xhci-hcd.*.auto* auto auto defaults voldmanaged=usbotg:auto
/dev/block/bootdevice/by-name/modem /vendor/firmware_mnt vfat ro,shortname=lower,uid=1000,gid=1000,dmask=227,fmask=337,context=u:object_r:firmware_file:s0 wait,slotselect
/dev/block/bootdevice/by-name/dsp /vendor/dsp ext4 ro,nosuid,nodev,barrier=1 wait,slotselect
/dev/block/bootdevice/by-name/bluetooth /vendor/bt_firmware vfat ro,shortname=lower,uid=1002,gid=3002,dmask=227,fmask=337,context=u:object_r:bt_firmware_file:s0 wait,slotselect

View File

@@ -26,4 +26,4 @@ on charger
chmod 0664 /sys/class/qcom-battery/authentic
chmod 0664 /sys/class/qcom-battery/verify_slave_flag
chmod 0664 /sys/class/qcom-battery/slave_authentic
chmod 0664 /sys/class/qcom-battery/is_old_hw
chmod 0664 /sys/class/qcom-battery/is_old_hw

View File

@@ -82,6 +82,7 @@ on boot
mkdir /dev/socket/qmux_radio 0770 radio radio
chmod 2770 /dev/socket/qmux_radio
mkdir /mnt/vendor/persist/alarm 0770 system system
mkdir /mnt/vendor/persist/time 0770 system system
mkdir /mnt/vendor/persist/secnvm 0770 system system
mkdir /mnt/vendor/persist/iar_db 0770 system system
@@ -220,8 +221,20 @@ on post-fs-data
mkdir /data/vendor/vpp 0770 media media
setprop vold.post_fs_data_done 1
# Allow system to modify exposure dim layer state
chown system system /sys/devices/platform/soc/soc:qcom,dsi-display-primary/dimlayer_exposure
chmod 0660 /sys/devices/platform/soc/soc:qcom,dsi-display-primary/dimlayer_exposure
# Allow system to modify hbm state
chown system system /sys/devices/platform/soc/soc:qcom,dsi-display-primary/hbm_enabled
chmod 0660 /sys/devices/platform/soc/soc:qcom,dsi-display-primary/hbm_enabled
# Allow systemto modify High Touch Sampling Rate
chown system system /sys/devices/virtual/touch/touch_dev/bump_sample_rate
chmod 0660 /sys/devices/virtual/touch/touch_dev/bump_sample_rate
on property:sys.boot_completed=1
setprop vendor.post_boot.parsed 1
# Enable UFS clock scaling back
write /sys/bus/platform/devices/1d84000.ufshc/clkscale_enable 1
# Enable UFS auto_hibern8 back
@@ -236,9 +249,31 @@ on property:sys.boot_completed=1
# Reinit lmkd to reconfigure lmkd properties
setprop lmkd.reinit 1
# STOP EATING MY BATTERY AFTER 100H OF UPTIME FUCK YOU
# Power hal
chown system system /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us
chown system system /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us
chown system system /sys/devices/system/cpu/cpu4/cpufreq/schedutil/up_rate_limit_us
chown system system /sys/devices/system/cpu/cpu4/cpufreq/schedutil/down_rate_limit_us
chown system system /sys/devices/system/cpu/cpu7/cpufreq/schedutil/up_rate_limit_us
chown system system /sys/devices/system/cpu/cpu7/cpufreq/schedutil/down_rate_limit_us
chmod 0664 /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us
chmod 0664 /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us
chmod 0664 /sys/devices/system/cpu/cpu4/cpufreq/schedutil/up_rate_limit_us
chmod 0664 /sys/devices/system/cpu/cpu4/cpufreq/schedutil/down_rate_limit_us
chmod 0664 /sys/devices/system/cpu/cpu7/cpufreq/schedutil/up_rate_limit_us
chmod 0664 /sys/devices/system/cpu/cpu7/cpufreq/schedutil/down_rate_limit_us
# Disable native stats collection service
stop statsd
# Allow system to modify swappiness
chown system system /proc/sys/vm/swappiness
chmod 0660 /proc/sys/vm/swappiness
# CPU Freq node
chown system system /sys/kernel/cpu_power_toggle/limit_mode
chmod 0660 /sys/kernel/cpu_power_toggle/limit_mode
service vendor.qrtr-ns /vendor/bin/qrtr-ns -f
class core
user vendor_qrtr

View File

@@ -120,6 +120,23 @@ on early-boot
start vendor.sensors
on boot
chown system system /dev/cpuset/cgroup.procs
chown system system /dev/cpuset/foreground/cgroup.procs
chown system system /dev/cpuset/background/cgroup.procs
chown system system /dev/cpuset/system-background/cgroup.procs
chown system system /dev/cpuset/top-app/cgroup.procs
chmod 0666 /dev/cpuset/foreground/cgroup.procs
chmod 0666 /dev/cpuset/background/cgroup.procs
chmod 0666 /dev/cpuset/system-background/cgroup.procs
chmod 0666 /dev/cpuset/top-app/cgroup.procs
chmod 0666 /dev/cpuset/cgroup.procs
chown system system /dev/stune/background/cgroup.procs
chown system system /dev/stune/top-app/cgroup.procs
chmod 0666 /dev/stune/background/cgroup.procs
chmod 0666 /dev/stune/top-app/cgroup.procs
chown system system /sys/class/thermal/thermal_message/sconfig
chown system system /sys/class/thermal/thermal_message/balance_mode
chown system system /sys/class/thermal/thermal_message/charger_temp
@@ -155,6 +172,10 @@ on boot
chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/finger_irq
chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/power_cfg
on property:sys.boot_completed=1
# Enable PowerHAL hint processing
setprop vendor.powerhal.init 1
on init && property:ro.boot.mode=charger
mount_all /vendor/etc/charger_fstab.qcom --early
write /sys/kernel/boot_adsp/boot 1

View File

@@ -76,7 +76,7 @@ firmware_directories /vendor/firmware_mnt/image/
# qvr
/dev/qvr_external_sensor_ioctl 0660 system system
/dev/bus/usb/* 0660 root usb
/dev/hidraw* 0660 root usb
/dev/hidraw* 0660 system system
# wlan
/sys/devices/platform/soc/1c00000.qcom,pcie/pci0000:00/0000:00:00.0/0000:01:00.0/net/wlan*/queues/rx-* rps_cpus 0660 system system
@@ -129,6 +129,9 @@ firmware_directories /vendor/firmware_mnt/image/
/sys/devices/platform/soc/ae00000.qcom,mdss_mdp power/control 0664 system graphics
# KGSL
/sys/class/kgsl/kgsl-3d0 perfcounter 0660 root shell
# socinfo
/sys/devices/soc0 serial_number 0000 root root

View File

@@ -10,8 +10,3 @@ attribute vendor_hal_camerapostproc_xiaomi_server;
attribute vendor_hal_citsensorservice_xiaomi;
attribute vendor_hal_citsensorservice_xiaomi_client;
attribute vendor_hal_citsensorservice_xiaomi_server;
# HALs
attribute hal_dms;
attribute hal_dms_client;
attribute hal_dms_server;

7
sepolicy/vendor/file.te vendored Normal file
View File

@@ -0,0 +1,7 @@
type sysfs_htsr, sysfs_type, fs_type;
# Power HAL
type vendor_sysfs_msm_subsys, fs_type, sysfs_type;
# CPU
type vendor_sysfs_cpupower, fs_type, sysfs_type;

View File

@@ -27,10 +27,6 @@
# (e.g. Google Camera App)
/mnt/vendor/dsp/fastrpc_shell_3 u:object_r:public_adsprpcd_file:s0
# Dolby
/data/vendor/dolby(/.*)? u:object_r:vendor_data_file:s0
/vendor/bin/hw/vendor\.dolby\.hardware\.dms@2\.0-service u:object_r:hal_dms_default_exec:s0
# Fingerprint
/data/vendor/fpc(/.*)? u:object_r:fingerprint_vendor_data_file:s0
/data/vendor/fpdump(/.*)? u:object_r:fingerprint_vendor_data_file:s0
@@ -43,6 +39,9 @@
/sys/devices/virtual/touch/tp_dev/fod_status u:object_r:vendor_sysfs_udfps:s0
/vendor/bin/hw/android\.hardware\.biometrics\.fingerprint-service\.xiaomi u:object_r:hal_fingerprint_default_exec:s0
# HTSR
/sys/devices/virtual/touch/touch_dev/bump_sample_rate u:object_r:sysfs_htsr:s0
# IR
/dev/lirc[0-9]+ u:object_r:lirc_device:s0
/vendor/bin/hw/android\.hardware\.ir-service\.xiaomi u:object_r:hal_ir_default_exec:s0
@@ -61,6 +60,7 @@
# Power
/dev/xiaomi-touch u:object_r:vendor_touchfeature_device:s0
/vendor/bin/hw/android\.hardware\.power-service\.lineage-libperfmgr u:object_r:hal_power_default_exec:s0
# Sensors
/sys/bus/iio/devices u:object_r:vendor_sysfs_iio:s0
@@ -77,3 +77,9 @@
/data/vendor/mac_addr(/.*)? u:object_r:vendor_wifi_vendor_data_file:s0
/data/vendor/wlan_logs(/.*)? u:object_r:vendor_wifi_vendor_data_file:s0
/vendor/bin/nv_mac u:object_r:vendor_wcnss_service_exec:s0
# ZRAM
/sys/block/zram0/comp_algorithm u:object_r:sysfs_zram:s0
# CPU Power
/sys/kernel/cpu_power_toggle/limit_mode u:object_r:vendor_sysfs_cpupower:s0

View File

@@ -4,6 +4,9 @@ genfscon sysfs /devices/platform/soc/soc:qcom,dsi-display-primary
# Fingerprint
genfscon sysfs /devices/platform/soc/soc:fingerprint_fpc u:object_r:vendor_sysfs_fingerprint:s0
# Graphics
genfscon sysfs /devices/platform/soc/ae00000.qcom,mdss_mdp/drm/card0/sde-crtc- u:object_r:vendor_sysfs_sde_crtc:s0
# USB
genfscon sysfs /devices/platform/soc/soc:qcom,pmic_glink/soc:qcom,pmic_glink:qcom,ucsi/typec u:object_r:vendor_sysfs_usb_c:s0
@@ -18,12 +21,13 @@ genfscon sysfs /devices/platform/soc/5c00000.qcom,ssc/subsys7/wakeup u:object_r:
genfscon sysfs /devices/platform/soc/5c00000.qcom,ssc/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/890000.qcom,qup_uart/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/984000.i2c/i2c-0/0-0028/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/998000.i2c/i2c-0/0-005a/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/884000.i2c/i2c-3/3-0028/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/988000.spi/spi_master/spi0/spi0.0/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/98900000.qcom,turing/subsys4/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/98900000.qcom,turing/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/990000.i2c/i2c-2/2-0028/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/990000.i2c/i2c-2/2-005a/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/998000.i2c/i2c-0/0-005a/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/a300000.qcom,turing/subsys7/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/a84000.i2c/i2c-3/3-0028/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/a84000.i2c/i2c-3/3-005a/wakeup u:object_r:sysfs_wakeup:s0
@@ -50,8 +54,22 @@ genfscon sysfs /devices/platform/soc/soc:qcom,kgsl-hyp/subsys4/wakeup u:object_r
genfscon sysfs /devices/platform/soc/soc:qcom,trustedvm@d0800000/subsys1/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/soc:qcom,trustedvm@d0800000/subsys2/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/3700000.qcom,lpass/subsys6/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/soc/2c00000.qcom,kgsl-3d0 u:object_r:vendor_sysfs_msm_subsys:s0
genfscon sysfs /devices/platform/soc/soc:qcom,cpu-cpu-llcc-bw u:object_r:vendor_sysfs_msm_subsys:s0
genfscon sysfs /devices/platform/soc/soc:qcom,cpu-llcc-ddr-bw u:object_r:vendor_sysfs_msm_subsys:s0
genfscon sysfs /devices/platform/soc/soc:qcom,dsi-display u:object_r:vendor_sysfs_graphics:s0
genfscon sysfs /devices/platform/soc/soc:qcom,gpubw u:object_r:vendor_sysfs_msm_subsys:s0
genfscon sysfs /devices/platform/soc/soc:qcom,gpubw/devfreq u:object_r:vendor_sysfs_msm_subsys:s0
# Display dim layer Exposure
genfscon sysfs /devices/platform/soc/soc:qcom,dsi-display-primary/dimlayer_exposure u:object_r:vendor_sysfs_graphics:s0
# Display HBM
genfscon sysfs /sys/devices/platform/soc/soc:qcom,dsi-display-primary/hbm_enabled u:object_r:vendor_sysfs_graphics:s0
# Torch control
genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm8350c@2:qcom,flash_led@ee00/leds/led:torch_0/brightness u:object_r:sysfs_torch:s0
genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm8350c@2:qcom,flash_led@ee00/leds/led:torch_0/max_brightness u:object_r:sysfs_torch:s0
genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm8350c@2:qcom,flash_led@ee00/leds/led:switch_2/brightness u:object_r:sysfs_torch:s0
# Cpu Power
genfscon sysfs /sys/kernel/cpu_power_toggle/limit_mode u:object_r:vendor_sysfs_cpupower:s0

View File

@@ -5,7 +5,3 @@ set_prop(hal_audio_default, vendor_audio_prop)
allow hal_audio_default audio_socket:sock_file rw_file_perms;
allow hal_audio_default sound_device:chr_file rw_file_perms;
# Dolby
allow hal_audio_default hal_dms_hwservice:hwservice_manager find;
binder_call(hal_audio_default, hal_dms_default)

View File

@@ -1,6 +0,0 @@
# HwBinder IPC from client to server, and callbacks
binder_call(hal_dms_client, hal_dms_server)
binder_call(hal_dms_server, hal_dms_client)
add_hwservice(hal_dms_server, hal_dms_hwservice)
allow hal_dms_client hal_dms_hwservice:hwservice_manager find;

View File

@@ -1,10 +0,0 @@
type hal_dms_default, domain;
hal_server_domain(hal_dms_default, hal_dms)
type hal_dms_default_exec, exec_type, vendor_file_type, file_type;
init_daemon_domain(hal_dms_default)
allow hal_dms_default vendor_data_file:file { rw_file_perms create unlink };
allow hal_dms_default vendor_data_file:dir { rw_file_perms add_name remove_name };
allow hal_dms_default mediacodec:binder call;
binder_call(hal_dms_default, hal_audio_default)
binder_call(hal_dms_default, platform_app)

1
sepolicy/vendor/hal_power.te vendored Normal file
View File

@@ -0,0 +1 @@
rw_dir_file(hal_power_default, proc)

View File

@@ -1,3 +1,46 @@
type vendor_touchfeature_device, dev_type;
type vendor_sysfs_sde_crtc, fs_type, sysfs_type;
allow hal_power_default vendor_touchfeature_device:chr_file rw_file_perms;
# Allow Power HAL to read and write to sde-crtc-*
allow hal_power_default vendor_sysfs_sde_crtc:file rw_file_perms;
allow hal_power_default vendor_sysfs_sde_crtc:dir r_dir_perms;
allow hal_power_default vendor_sysfs_kgsl:lnk_file rw_file_perms;
allow hal_power_default {
vendor_sysfs_devfreq
vendor_sysfs_msm_subsys
}:dir search;
allow hal_power_default {
input_device
vendor_latency_device
}:chr_file rw_file_perms;
allow hal_power_default {
cgroup
proc
sysfs_devices_system_cpu
vendor_sysfs_graphics
vendor_sysfs_devfreq
vendor_sysfs_kgsl
vendor_sysfs_scsi_host
}:{
file
lnk_file
} rw_file_perms;
allow hal_power_default {
cgroup
input_device
vendor_sysfs_devfreq
}:dir r_dir_perms;
# Rule for hal_power_default to access graphics composer process
unix_socket_connect(hal_power_default, vendor_pps, hal_graphics_composer_default);
# To get/set powerhal state propert
set_prop(hal_power_default, vendor_power_prop)

View File

@@ -1,2 +0,0 @@
# Dolby
type hal_dms_hwservice, hwservice_manager_type;

View File

@@ -2,9 +2,6 @@
vendor.xiaomi.hardware.cameraperf::IMiCameraPerfService u:object_r:vendor_hal_cameraperf_hwservice:s0
vendor.xiaomi.hardware.campostproc::IMiPostProcService u:object_r:vendor_hal_camerapostproc_xiaomi_hwservice:s0
# Dolby
vendor.dolby.hardware.dms::IDms u:object_r:hal_dms_hwservice:s0
# Fingerprint
vendor.xiaomi.hardware.dtool::IDtool u:object_r:vendor_hal_fingerprint_hwservice_xiaomi:s0
vendor.xiaomi.hardware.fx.tunnel::IMiFxTunnel u:object_r:vendor_hal_fingerprint_hwservice_xiaomi:s0

View File

@@ -1,5 +0,0 @@
allow mediacodec hal_dms_hwservice:hwservice_manager find;
binder_call(mediacodec, hal_dms_default)
allow mediacodec hal_dms_default:binder { call transfer };
allow mediacodec hal_dms_server:binder { call transfer };

View File

@@ -1,5 +1,5 @@
# Aware
vendor_restricted_prop(vendor_aware_available_prop);
# Fastcharge
vendor_internal_prop(vendor_fastcharge_prop);
# ZRAM
vendor_internal_prop(vendor_zram_prop);

View File

@@ -1,14 +1,14 @@
# Camera
persist.camera. u:object_r:vendor_camera_prop:s0
persist.vendor.aiie_capture_log.debug u:object_r:vendor_camera_prop:s0
persist.vendor.camera u:object_r:vendor_camera_prop:s0
persist.vendor.low.cutoff u:object_r:vendor_camera_prop:s0
vendor.camera. u:object_r:vendor_camera_prop:s0
vendor.camera.sensor. u:object_r:vendor_camera_sensor_prop:s0
vendor.camera.sensor.logsystem u:object_r:vendor_camera_prop:s0
ro.boot.camera. u:object_r:vendor_camera_prop:s0
vendor.camera.sensor. u:object_r:vendor_camera_sensor_prop:s0
persist.vendor.aiie_capture_log.debug u:object_r:vendor_camera_prop:s0
ro.boot.camera. u:object_r:vendor_camera_prop:s0
ro.boot.camera.config u:object_r:vendor_camera_sensor_prop:s0
ro.vendor.audio.us.proximity u:object_r:vendor_camera_prop:s0
persist.vendor.low.cutoff u:object_r:vendor_camera_prop:s0
ro.vendor.audio.us.proximity u:object_r:vendor_camera_prop:s0
# Fastcharge HAL
persist.vendor.sec.fastchg_enabled u:object_r:vendor_fastcharge_prop:s0
@@ -23,5 +23,7 @@ ro.hardware.fp.udfps u:object_r:vendor_fp_prop:s0
persist.vendor.sys.pay. u:object_r:vendor_mlipay_prop:s0
persist.vendor.sys.provision.status u:object_r:vendor_mlipay_prop:s0
# Aware
ro.vendor.aware_available u:object_r:vendor_aware_available_prop:s0
# ZRAM
persist.vendor.zram.size u:object_r:vendor_zram_prop:s0
persist.vendor.zram.comp_algorithm u:object_r:vendor_zram_prop:s0
persist.vendor.vm.swappiness u:object_r:vendor_zram_prop:s0

View File

@@ -1,11 +1,14 @@
# Aware
get_prop(system_app, vendor_aware_available_prop);
allow system_app proc_pagetypeinfo:file r_file_perms;
# Parts
allow system_app sysfs_thermal:file write;
# DC Dimming and HBM
allow system_app vendor_sysfs_graphics:dir search;
allow system_app vendor_sysfs_graphics:file { getattr open write };
# HTSR
allow system_app sysfs_htsr:file { read write open setattr getattr };
allow system_app sysfs_htsr:dir { search open read };
# Incremental
get_prop(system_app, incremental_prop)
# allow apps like settings to check the file signature of an apk installed on
@@ -16,3 +19,12 @@ allowxperm system_app apk_data_file:file ioctl {
INCFS_IOCTL_GET_BLOCK_COUNT
INCFS_IOCTL_GET_FILLED_BLOCKS
};
# Allow system_app to set ZRAM property
set_prop(system_app, vendor_zram_prop)
get_prop(system_app, vendor_zram_prop)
set_prop(system_app, vendor_default_prop)
get_prop(system_app, vendor_default_prop)
# Allow system_app to toggle CPU Power
allow system_app vendor_sysfs_cpupower:file { getattr open read write };

View File

@@ -0,0 +1,2 @@
allow vendor_hal_perf_default hal_graphics_composer_default:dir search;
allow vendor_hal_perf_default hal_graphics_composer_default:file { open read };

1
sepolicy/vendor/vendor_init.te vendored Normal file
View File

@@ -0,0 +1 @@
set_prop(vendor_init, vendor_zram_prop);

View File

@@ -0,0 +1 @@
get_prop(vendor_qti_init_shell, vendor_zram_prop)

View File

@@ -4,6 +4,13 @@ vendor.bluetooth.soc=hastings
# CNE
persist.vendor.cne.feature=1
# Disable Skia tracing by default
debug.hwui.skia_atrace_enabled=false
# Deep Sleep
pm.sleep_mode=1
vendor.post_boot.parsed=1s
# Graphics
debug.sf.disable_backpressure=1
debug.sf.enable_hwc_vds=1
@@ -13,6 +20,9 @@ persist.dbg.volte_avail_ovr=1
persist.dbg.vt_avail_ovr=1
persist.dbg.wfc_avail_ovr=1
# Logs
persist.log.tag.minksocket=S
# Media
media.aac_51_output_enabled=true
media.stagefright.enable-aac=true

View File

@@ -1,2 +1,4 @@
# DPM
persist.vendor.dpm.feature=11
# Dalvik
dalvik.vm.dex2oat64.enabled=true

View File

@@ -151,6 +151,9 @@ ro.hardware.camera=xiaomi
# Chipset
ro.soc.manufacturer=QTI
# FS-verity
ro.apk_verity.mode=2
# Crypto
ro.crypto.dm_default_key.options_format.version=2
ro.crypto.volume.metadata.method=dm-default-key
@@ -175,22 +178,21 @@ debug.egl.hw=0
debug.mdpcomp.logs=0
debug.sf.disable_client_composition_cache=1
debug.sf.enable_advanced_sf_phase_offset=1
debug.sf.enable_gl_backpressure=1
debug.sf.enable_gl_backpressure=0
debug.sf.high_fps_early_gl_phase_offset_ns=-4000000
debug.sf.high_fps_early_phase_offset_ns=-4000000
debug.sf.high_fps_late_app_phase_offset_ns=1000000
debug.sf.high_fps_late_sf_phase_offset_ns=-4000000
debug.sf.hw=0
debug.sf.latch_unsignaled=1
debug.sf.set_idle_timer_ms=3000
persist.sys.sf.color_mode=9
debug.sf.set_idle_timer_ms=1100
persist.sys.sf.color_mode=0
debug.sf.enable_egl_image_tracker=1
persist.sys.sf.color_saturation=1.0
persist.sys.sf.native_mode=2
persist.sys.sf.native_mode=0
ro.hardware.egl=adreno
ro.hardware.vulkan=adreno
ro.opengles.version=196610
ro.surface_flinger.enable_frame_rate_override=false
ro.surface_flinger.force_hwc_copy_for_virtual_displays=true
ro.surface_flinger.game_default_frame_rate_override=120
ro.surface_flinger.has_HDR_display=true
ro.surface_flinger.has_wide_color_display=true
@@ -260,8 +262,10 @@ ro.telephony.default_network=33,33
ro.vendor.radio.5g=3
ro.vendor.use_data_netmgrd=true
telephony.lteOnCdmaDevice=1
ro.telephony.block_binder_thread_on_incoming_calls=false
# Sensors
persist.vendor.sensors.debug.hal=0
persist.vendor.sensors.allow_non_default_discovery=true
persist.vendor.sensors.on_change_sample_period=true
persist.vendor.sensors.sync_request=true

View File

@@ -32,7 +32,7 @@ gEnableTxBFin20MHz=1
gEnableTxSUBeamformer=1
gRrmEnable=1
gEnablefwprint=0
gEnablefwlog=1
gEnablefwlog=0
gVhtAmpduLenExponent=7
gVhtMpduLen=2
isP2pDeviceAddrAdministrated=0
@@ -143,8 +143,10 @@ gStaKeepAlivePeriod = 30
etsi13_srd_chan_in_master_mode=7
#####Roaming
# Sets RSSI preference for 5GHz over 2.4GHz AP
gSelect5GHzMargin=5
# TheCrazyLex@PA Prefer connecting to 5Ghz AP
# even if its RSSI is lower by 3dBm than the 2.4Ghz AP
gRoamPrefer5GHz=1
gSelect5GHzMargin=3
# Candidate AP minimum RSSI for beacon miss roam trigger
# Code default is -70
@@ -201,14 +203,15 @@ gindoor_channel_support=1
#Enable max link speed
gReportMaxLinkSpeed=2
# Disable rx wakelock
rx_wakelock_timeout=0
# Skip tpe consideration
skip_tpe_consideration=1
gEnableNanSupport=1
genable_nan_datapath=1
nan_separate_iface_support=1
gEnableSelfRecovery=1
#####################################Xiaomi ADD: END
END

View File

@@ -4,7 +4,3 @@ persistent_reconnect=1
bss_max_count=400
p2p_go_he=1
p2p_6ghz_disable=1
p2p_chan_list_dfs_disable=0
p2p_chan_list_only_sta_dfs_enable=0
p2p_pref_list_dfs_disable=0
p2p_go_dfs_disable=0

View File

@@ -6,9 +6,3 @@ bss_max_count=400
interworking=1
config_methods=virtual_display virtual_push_button keypad
driver_param="no_rrm=1"
p2p_chan_list_dfs_disable=0
p2p_chan_list_only_sta_dfs_enable=0
p2p_pref_list_dfs_disable=0
p2p_go_dfs_disable=0
wowlan_disconnect_on_deinit=1
bss_no_flush_when_down=1