Skip to content

Commit 399e3e7

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 890c592 commit 399e3e7

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
@@ -466,6 +466,7 @@
466466
<string name="system_framework_bypass_force_downloadui">打开下载页面时不强制使用小米下载管理器</string>
467467
<string name="system_framework_bypass_force_downloadui_desc">解决 Google 快速分享查看下载内容跳转错误的问题</string>
468468
<string name="system_framework_fuck_subscreen_whiteList">解除背屏软件白名单</string>
469+
<string name="system_framework_fuck_subscreen_not_go_to_home">禁止背屏息屏/关闭的时候返回桌面</string>
469470
<!--核心破解-->
470471
<string name="system_framework_corepatch_tip">此列表下的功能需要在您了解此类功能后再选择性启用,部分选项存在一定危险性,请知悉\n常规选项的功能除总开关外均即时生效,扩展功能无论开关都需要重启才能生效</string>
471472
<string name="system_framework_corepatch_title">包管理服务</string>
@@ -1705,4 +1706,5 @@
17051706
<string name="custom_hook_mode">选择模式</string>
17061707
<string name="open_source">开源项目</string>
17071708
<string name="close_source">闭源项目</string>
1709+
<string name="subscreen">背屏</string>
17081710
</resources>

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,6 @@
496496
<string name="system_framework_quick_screenshot_desc">Disable screenshot delay</string>
497497
<string name="system_framework_disable_link_turbo_toast">Hide toast of mobile network used for acceleration</string>
498498
<string name="system_framework_allow_third_theme">Allow to use third-party themes</string>
499-
<string name="system_framework_fuck_subscreen_whiteList">Remove the subscreen app whitelist</string>
500499
<string name="system_framework_allow_disable_protected_package">Allows to disable protected apps</string>
501500
<string name="system_framework_disable_miui_watermark">Disable full screen watermark</string>
502501
<string name="system_framework_bypass_unknown_sources_restrictions">Allow all apps to install apps from unknown sources</string>
@@ -539,6 +538,8 @@
539538
<string name="system_framework_core_patch_allow_update_system_app_desc">Allow installation of system apps when updating system apps is disabled</string>
540539
<string name="system_framework_core_patch_unloss_fingerprint">Disable reset fingerprint</string>
541540
<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>
541+
<string name="system_framework_fuck_subscreen_whiteList">Remove the subscreen app whitelist</string>
542+
<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>
542543
<!--Browser-->
543544
<string name="browser">Browser</string>
544545
<string name="browser_debug_mode">Unlock developer options</string>
@@ -1744,4 +1745,5 @@
17441745
<string name="custom_hook_mode">Select mode</string>
17451746
<string name="open_source">Open source projects</string>
17461747
<string name="close_source">Close source projects</string>
1748+
<string name="subscreen">Sub Screen</string>
17471749
</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)