Skip to content

Commit 9658135

Browse files
committed
feat: 新增背屏禁止返回桌面功能并优化设置布局
- **新增功能**: 在 `FuckSubScreenWhiteList` 中新增 Hook 逻辑,支持禁止背屏在息屏或关闭时自动返回桌面。 - **界面优化**: 在 `framework_display.xml` 中新增“背屏”设置分类(PreferenceCategory),并将背屏白名单与新功能选项归类。 - **资源更新**: 补充了中英文对应的字符串资源 `system_framework_fuck_subscreen_not_go_to_home` 及 `subscreen`。 Signed-off-by: ghhccghk <2137610394@qq.com>
1 parent 34bd011 commit 9658135

4 files changed

Lines changed: 32 additions & 5 deletions

File tree

library/core/src/main/res/values-zh-rCN/strings_app.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@
437437
<string name="system_framework_bypass_force_downloadui">打开下载页面时不强制使用小米下载管理器</string>
438438
<string name="system_framework_bypass_force_downloadui_desc">解决 Google 快速分享查看下载内容跳转错误的问题</string>
439439
<string name="system_framework_fuck_subscreen_whiteList">解除背屏软件白名单</string>
440+
<string name="system_framework_fuck_subscreen_not_go_to_home">禁止背屏息屏/关闭的时候返回桌面</string>
440441
<!--核心破解-->
441442
<string name="system_framework_corepatch_tip">此列表下的功能需要在您了解此类功能后再选择性启用,部分选项存在一定危险性,请知悉\n常规选项的功能除总开关外均即时生效,扩展功能无论开关都需要重启才能生效</string>
442443
<string name="system_framework_corepatch_title">包管理服务</string>
@@ -1649,4 +1650,5 @@
16491650
<string name="custom_hook_mode">选择模式</string>
16501651
<string name="open_source">开源项目</string>
16511652
<string name="close_source">闭源项目</string>
1653+
<string name="subscreen">背屏</string>
16521654
</resources>

library/core/src/main/res/values/strings_app.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,6 @@
484484
<string name="system_framework_quick_screenshot_desc">Disable screenshot delay</string>
485485
<string name="system_framework_disable_link_turbo_toast">Hide toast of mobile network used for acceleration</string>
486486
<string name="system_framework_allow_third_theme">Allow to use third-party themes</string>
487-
<string name="system_framework_fuck_subscreen_whiteList">Remove the subscreen app whitelist</string>
488487
<string name="system_framework_allow_disable_protected_package">Allows to disable protected apps</string>
489488
<string name="system_framework_disable_miui_watermark">Disable full screen watermark</string>
490489
<string name="system_framework_bypass_unknown_sources_restrictions">Allow all apps to install apps from unknown sources</string>
@@ -525,6 +524,8 @@
525524
<string name="system_framework_core_patch_allow_update_system_app_desc">Allow installation of system apps when updating system apps is disabled</string>
526525
<string name="system_framework_core_patch_unloss_fingerprint">Disable reset fingerprint</string>
527526
<string name="system_framework_core_patch_unloss_fingerprint_desc">May help resolve the issue of fingerprints resetting after reboot when certain package management services are enabled. Intended only for devices affected by this problem.</string>
527+
<string name="system_framework_fuck_subscreen_whiteList">Remove the subscreen app whitelist</string>
528+
<string name="system_framework_fuck_subscreen_not_go_to_home">Prohibit returning to the home screen when the screen is facing down, idle, or turned off</string>
528529
<!--Browser-->
529530
<string name="browser">Browser</string>
530531
<string name="browser_debug_mode">Unlock developer options</string>
@@ -1705,4 +1706,5 @@
17051706
<string name="custom_hook_mode">Select mode</string>
17061707
<string name="open_source">Open source projects</string>
17071708
<string name="close_source">Close source projects</string>
1709+
<string name="subscreen">Sub Screen</string>
17081710
</resources>

library/core/src/main/res/xml/framework_display.xml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,19 @@
4949
android:title="@string/system_framework_enhance_recents_visibility"
5050
android:key="prefs_key_system_framework_enhance_recents_visibility" />
5151

52-
<SwitchPreference
53-
android:defaultValue="false"
54-
android:key="prefs_key_system_framework_fuck_subscreen_whiteList"
55-
android:title="@string/system_framework_fuck_subscreen_whiteList" />
52+
53+
<PreferenceCategory android:title="@string/subscreen">
54+
<SwitchPreference
55+
android:defaultValue="false"
56+
android:key="prefs_key_system_framework_fuck_subscreen_whiteList"
57+
android:title="@string/system_framework_fuck_subscreen_whiteList" />
58+
59+
<SwitchPreference
60+
android:defaultValue="false"
61+
android:key="prefs_key_system_framework_fuck_subscreen_not_go_to_home"
62+
android:title="@string/system_framework_fuck_subscreen_not_go_to_home" />
63+
64+
</PreferenceCategory>
5665

5766

5867
</PreferenceCategory>

library/libhook/src/main/java/com/sevtinge/hyperceiler/libhook/rules/systemframework/display/FuckSubScreenWhiteList.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
package com.sevtinge.hyperceiler.libhook.rules.systemframework.display
22

3+
import com.sevtinge.hyperceiler.common.utils.PrefsBridge
34
import com.sevtinge.hyperceiler.libhook.base.BaseHook
45
import com.sevtinge.hyperceiler.libhook.utils.hookapi.tool.hookAllMethods
56

7+
/** 绕过背屏白名单*/
68
object FuckSubScreenWhiteList : BaseHook() {
9+
710
override fun init() {
811
val asI = findClass("com.android.server.wm.ActivityStarterImpl")
912
asI.hookAllMethods("isShouldShowOnRearDisplay") {
@@ -16,6 +19,17 @@ object FuckSubScreenWhiteList : BaseHook() {
1619
returnConstant(true)
1720
}
1821
}
22+
/** 禁止锁屏返回桌面 */
23+
val notGotoHome = PrefsBridge.getBoolean("system_framework_fuck_subscreen_not_go_to_home")
24+
25+
if (notGotoHome) {
26+
asI.hookAllMethods("handlerTransitionFinished") {
27+
before { param ->
28+
param.args[4] = false
29+
}
30+
}
31+
32+
}
1933

2034
}
2135
}

0 commit comments

Comments
 (0)