Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions library/core/src/main/res/values-zh-rCN/strings_app.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1560,6 +1560,8 @@
<string name="security_center_battery_unlock_low_temp_ext_endurance">解锁低温超级续航</string>
<string name="secutity_center_battery_show_more_info">显示更多电池信息</string>
<string name="secutity_center_battery_show_more_info_desc">实验性功能,具体支持显示内容因设备而异</string>
<string name="secutity_center_battery_saver_enable_haptic_feedback">省电模式开启触摸反馈</string>
<string name="secutity_center_battery_saver_lock_fps">省电模式锁定当前帧率</string>
<string name="security_center_unlock_car_sickness">解锁晕车缓解</string>
<string name="security_center_unlock_car_sickness_desc">需要 \"弹幕通知\" 支持</string>
<string name="security_center_disable_offline_info_manager">禁用网络助手离线配置</string>
Expand Down
2 changes: 2 additions & 0 deletions library/core/src/main/res/values/strings_app.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1607,6 +1607,8 @@
<string name="security_center_battery_unlock_low_temp_ext_endurance">Unlock Cold endurance mode</string>
<string name="secutity_center_battery_show_more_info">Show more battery info</string>
<string name="secutity_center_battery_show_more_info_desc">Experimental feature. The additional battery information displayed may vary depending on the device.</string>
<string name="secutity_center_battery_saver_enable_haptic_feedback">Enable haptic feedback in battery saver</string>
<string name="secutity_center_battery_saver_lock_fps">Battery saver lock FPS</string>
<string name="security_center_unlock_car_sickness">Unlock Motion sickness relief</string>
<string name="security_center_unlock_car_sickness_desc">Needs \"Barrage\" support</string>
<string name="security_center_disable_offline_info_manager">Disable network assistant offline info</string>
Expand Down
10 changes: 10 additions & 0 deletions library/core/src/main/res/xml/security_center_battery.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,15 @@
android:key="prefs_key_security_center_unlock_smart_charge"
android:title="@string/security_center_unlock_smart_charge_title" />

<SwitchPreference
android:defaultValue="false"
android:key="secutity_center_battery_saver_enable_haptic_feedback"
android:title="@string/secutity_center_battery_saver_enable_haptic_feedback" />

<SwitchPreference
android:defaultValue="false"
android:key="secutity_center_battery_saver_lock_fps"
android:title="@string/secutity_center_battery_saver_lock_fps" />

</PreferenceCategory>
</PreferenceScreen>
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
import com.sevtinge.hyperceiler.libhook.rules.securitycenter.app.AppRestrict;
import com.sevtinge.hyperceiler.libhook.rules.securitycenter.app.OpenByDefaultSetting;
import com.sevtinge.hyperceiler.libhook.rules.securitycenter.battery.BatteryHealth;
import com.sevtinge.hyperceiler.libhook.rules.securitycenter.battery.BatterySaverEnableHapticFeedback;
import com.sevtinge.hyperceiler.libhook.rules.securitycenter.battery.BatterySaverLockFps;
import com.sevtinge.hyperceiler.libhook.rules.securitycenter.battery.MoreBatteryInfoNew;
import com.sevtinge.hyperceiler.libhook.rules.securitycenter.battery.PowerConsumptionRanking;
import com.sevtinge.hyperceiler.libhook.rules.securitycenter.battery.ScreenUsedTime;
Expand Down Expand Up @@ -100,6 +102,8 @@ public void onPackageLoaded() {
initHook(BatteryHealth.INSTANCE, PrefsBridge.getBoolean("security_center_show_battery_health"));
initHook(new UnlockLowTempExtEndurance(), PrefsBridge.getBoolean("security_center_battery_unlock_low_temp_ext_endurance"));
initHook(MoreBatteryInfoNew.INSTANCE, PrefsBridge.getBoolean("secutity_center_battery_show_more_info"));
initHook(BatterySaverEnableHapticFeedback.INSTANCE, PrefsBridge.getBoolean("secutity_center_battery_saver_enable_haptic_feedback"));
initHook(BatterySaverLockFps.INSTANCE, PrefsBridge.getBoolean("secutity_center_battery_saver_lock_fps"));

// 隐私保护
initHook(new AppLockPinScramble(), PrefsBridge.getBoolean("security_center_applock_pin_scramble"));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* This file is part of HyperCeiler.

* HyperCeiler is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License.

* 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 Affero General Public License for more details.

* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.

* Copyright (C) 2023-2026 HyperCeiler Contributions
*/
package com.sevtinge.hyperceiler.libhook.rules.securitycenter.battery

import com.sevtinge.hyperceiler.common.log.XposedLog
import com.sevtinge.hyperceiler.libhook.base.BaseHook
import io.github.lingqiqi5211.ezhooktool.xposed.dsl.createHook
import java.lang.reflect.Method
import java.lang.reflect.Modifier

object BatterySaverEnableHapticFeedback : BaseHook() {

Check notice on line 27 in library/libhook/src/main/java/com/sevtinge/hyperceiler/libhook/rules/securitycenter/battery/BatterySaverEnableHapticFeedback.kt

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

library/libhook/src/main/java/com/sevtinge/hyperceiler/libhook/rules/securitycenter/battery/BatterySaverEnableHapticFeedback.kt#L27

BatterySaverEnableHapticFeedback is missing required documentation.
override fun useDexKit() = true

override fun initDexKit(): Boolean {
hapticFeedbackMethodList
return true
}

private val hapticFeedbackMethodList by lazy<List<Method>> {
optionalMemberList("BatterySaverLockHapticFeedback") {
it.findMethod {
matcher {
declaredClass {
usingEqStrings("sys.haptic.motor", "power_center_haptic_feed_back_mode", "haptic_feedback_enabled")
}
usingEqStrings("power_center_haptic_feed_back_mode", "haptic_feedback_enabled")
modifiers = Modifier.PUBLIC
returnType = "void"
paramCount = 1
paramTypes("android.content.Context")
}
}
}
}

override fun init() {
hapticFeedbackMethodList.forEach {
it.createHook {
returnConstant(null)
}
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* This file is part of HyperCeiler.

* HyperCeiler is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License.

* 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 Affero General Public License for more details.

* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.

* Copyright (C) 2023-2026 HyperCeiler Contributions
*/
package com.sevtinge.hyperceiler.libhook.rules.securitycenter.battery

import com.sevtinge.hyperceiler.common.log.XposedLog
import com.sevtinge.hyperceiler.libhook.base.BaseHook
import io.github.lingqiqi5211.ezhooktool.xposed.dsl.createHook
import java.lang.reflect.Method
import java.lang.reflect.Modifier

object BatterySaverLockFps : BaseHook() {

Check notice on line 27 in library/libhook/src/main/java/com/sevtinge/hyperceiler/libhook/rules/securitycenter/battery/BatterySaverLockFps.kt

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

library/libhook/src/main/java/com/sevtinge/hyperceiler/libhook/rules/securitycenter/battery/BatterySaverLockFps.kt#L27

BatterySaverLockFps is missing required documentation.
override fun useDexKit() = true

override fun initDexKit(): Boolean {
lockFpsMethod
return true
}

private val lockFpsMethod by lazy<Method?> {
optionalMember("BatterySaverLockFps") {
it.findMethod {
matcher {
declaredClass {
usingEqStrings("LowFpsPowerMode", "user_refresh_rate", "miui_refresh_rate")
}
usingEqStrings("user_refresh_rate", "miui_refresh_rate")
modifiers = Modifier.PRIVATE
returnType = "void"
paramCount = 2
paramTypes("android.content.Context", "int")
}
}.singleOrNull()
}
}

override fun init() {
lockFpsMethod?.let {
it.createHook {
returnConstant(null)
}
}
}
}

Loading