From 693d825853c63c56c601afb481224694e9bd84d4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=BB=80=E6=BC=93=E4=B8=A8Sevtinge?=
<89193494+Sevtinge@users.noreply.github.com>
Date: Mon, 9 Dec 2024 01:13:48 +0800
Subject: [PATCH] feat: home - Optimized app launch delay
by @nakixii
---
.../module/app/Home/Pad/HomeT.java | 2 ++
.../module/app/Home/Pad/HomeU.java | 2 ++
.../module/app/Home/Pad/HomeV.java | 2 ++
.../module/app/Home/Phone/HomeT.java | 2 ++
.../module/app/Home/Phone/HomeU.java | 2 ++
.../module/app/Home/Phone/HomeV.java | 2 ++
.../hook/home/other/OptAppLaunchDelay.java | 35 +++++++++++++++++++
app/src/main/res/values-zh-rCN/strings.xml | 1 +
app/src/main/res/values/strings.xml | 1 +
app/src/main/res/xml/home_other.xml | 5 +++
10 files changed, 54 insertions(+)
create mode 100644 app/src/main/java/com/sevtinge/hyperceiler/module/hook/home/other/OptAppLaunchDelay.java
diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/app/Home/Pad/HomeT.java b/app/src/main/java/com/sevtinge/hyperceiler/module/app/Home/Pad/HomeT.java
index c657439e41..f2e5a5537e 100644
--- a/app/src/main/java/com/sevtinge/hyperceiler/module/app/Home/Pad/HomeT.java
+++ b/app/src/main/java/com/sevtinge/hyperceiler/module/app/Home/Pad/HomeT.java
@@ -86,6 +86,7 @@
import com.sevtinge.hyperceiler.module.hook.home.other.FreeformShortcutMenu;
import com.sevtinge.hyperceiler.module.hook.home.other.HomeMode;
import com.sevtinge.hyperceiler.module.hook.home.other.InfiniteScroll;
+import com.sevtinge.hyperceiler.module.hook.home.other.OptAppLaunchDelay;
import com.sevtinge.hyperceiler.module.hook.home.other.OverlapMode;
import com.sevtinge.hyperceiler.module.hook.home.other.ShortcutItemCount;
import com.sevtinge.hyperceiler.module.hook.home.other.ShowAllHideApp;
@@ -293,6 +294,7 @@ public void handleLoadPackage() {
// initHook(new AllowShareApk(), mPrefsMap.getBoolean("home_other_allow_share_apk"));
initHook(new HideReportText(), mPrefsMap.getBoolean("home_title_hide_report_text"));
initHook(new DisablePrestart(), mPrefsMap.getBoolean("home_other_disable_prestart"));
+ initHook(new OptAppLaunchDelay(), mPrefsMap.getBoolean("home_other_opt_app_launch_delay"));
// 实验性功能
initHook(BlurWhenShowShortcutMenu.INSTANCE, mPrefsMap.getBoolean("home_other_shortcut_background_blur"));
diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/app/Home/Pad/HomeU.java b/app/src/main/java/com/sevtinge/hyperceiler/module/app/Home/Pad/HomeU.java
index ba3a1007c8..9f4d9e3918 100644
--- a/app/src/main/java/com/sevtinge/hyperceiler/module/app/Home/Pad/HomeU.java
+++ b/app/src/main/java/com/sevtinge/hyperceiler/module/app/Home/Pad/HomeU.java
@@ -86,6 +86,7 @@
import com.sevtinge.hyperceiler.module.hook.home.other.FreeformShortcutMenu;
import com.sevtinge.hyperceiler.module.hook.home.other.HomeMode;
import com.sevtinge.hyperceiler.module.hook.home.other.InfiniteScroll;
+import com.sevtinge.hyperceiler.module.hook.home.other.OptAppLaunchDelay;
import com.sevtinge.hyperceiler.module.hook.home.other.OverlapMode;
import com.sevtinge.hyperceiler.module.hook.home.other.ShortcutItemCount;
import com.sevtinge.hyperceiler.module.hook.home.other.ShowAllHideApp;
@@ -293,6 +294,7 @@ public void handleLoadPackage() {
// initHook(new AllowShareApk(), mPrefsMap.getBoolean("home_other_allow_share_apk"));
initHook(new HideReportText(), mPrefsMap.getBoolean("home_title_hide_report_text"));
initHook(new DisablePrestart(), mPrefsMap.getBoolean("home_other_disable_prestart"));
+ initHook(new OptAppLaunchDelay(), mPrefsMap.getBoolean("home_other_opt_app_launch_delay"));
// 实验性功能
initHook(BlurWhenShowShortcutMenu.INSTANCE, mPrefsMap.getBoolean("home_other_shortcut_background_blur"));
diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/app/Home/Pad/HomeV.java b/app/src/main/java/com/sevtinge/hyperceiler/module/app/Home/Pad/HomeV.java
index 7d03703c63..56b187a133 100644
--- a/app/src/main/java/com/sevtinge/hyperceiler/module/app/Home/Pad/HomeV.java
+++ b/app/src/main/java/com/sevtinge/hyperceiler/module/app/Home/Pad/HomeV.java
@@ -86,6 +86,7 @@
import com.sevtinge.hyperceiler.module.hook.home.other.FreeformShortcutMenu;
import com.sevtinge.hyperceiler.module.hook.home.other.HomeMode;
import com.sevtinge.hyperceiler.module.hook.home.other.InfiniteScroll;
+import com.sevtinge.hyperceiler.module.hook.home.other.OptAppLaunchDelay;
import com.sevtinge.hyperceiler.module.hook.home.other.OverlapMode;
import com.sevtinge.hyperceiler.module.hook.home.other.ShortcutItemCount;
import com.sevtinge.hyperceiler.module.hook.home.other.ShowAllHideApp;
@@ -292,6 +293,7 @@ public void handleLoadPackage() {
// initHook(new AllowShareApk(), mPrefsMap.getBoolean("home_other_allow_share_apk"));
initHook(new HideReportText(), mPrefsMap.getBoolean("home_title_hide_report_text"));
initHook(new DisablePrestart(), mPrefsMap.getBoolean("home_other_disable_prestart"));
+ initHook(new OptAppLaunchDelay(), mPrefsMap.getBoolean("home_other_opt_app_launch_delay"));
// 实验性功能
initHook(BlurWhenShowShortcutMenu.INSTANCE, mPrefsMap.getBoolean("home_other_shortcut_background_blur"));
diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/app/Home/Phone/HomeT.java b/app/src/main/java/com/sevtinge/hyperceiler/module/app/Home/Phone/HomeT.java
index fa0d95dd03..65a2eb097f 100644
--- a/app/src/main/java/com/sevtinge/hyperceiler/module/app/Home/Phone/HomeT.java
+++ b/app/src/main/java/com/sevtinge/hyperceiler/module/app/Home/Phone/HomeT.java
@@ -84,6 +84,7 @@
import com.sevtinge.hyperceiler.module.hook.home.other.FreeformShortcutMenu;
import com.sevtinge.hyperceiler.module.hook.home.other.HomeMode;
import com.sevtinge.hyperceiler.module.hook.home.other.InfiniteScroll;
+import com.sevtinge.hyperceiler.module.hook.home.other.OptAppLaunchDelay;
import com.sevtinge.hyperceiler.module.hook.home.other.OverlapMode;
import com.sevtinge.hyperceiler.module.hook.home.other.ShortcutItemCount;
import com.sevtinge.hyperceiler.module.hook.home.other.ShowAllHideApp;
@@ -284,6 +285,7 @@ public void handleLoadPackage() {
// initHook(new AllowShareApk(), mPrefsMap.getBoolean("home_other_allow_share_apk"));
initHook(new HideReportText(), mPrefsMap.getBoolean("home_title_hide_report_text"));
initHook(new DisablePrestart(), mPrefsMap.getBoolean("home_other_disable_prestart"));
+ initHook(new OptAppLaunchDelay(), mPrefsMap.getBoolean("home_other_opt_app_launch_delay"));
// 实验性功能
initHook(BlurWhenShowShortcutMenu.INSTANCE, mPrefsMap.getBoolean("home_other_shortcut_background_blur"));
diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/app/Home/Phone/HomeU.java b/app/src/main/java/com/sevtinge/hyperceiler/module/app/Home/Phone/HomeU.java
index bd8a44f7f5..5647845220 100644
--- a/app/src/main/java/com/sevtinge/hyperceiler/module/app/Home/Phone/HomeU.java
+++ b/app/src/main/java/com/sevtinge/hyperceiler/module/app/Home/Phone/HomeU.java
@@ -87,6 +87,7 @@
import com.sevtinge.hyperceiler.module.hook.home.other.FreeformShortcutMenu;
import com.sevtinge.hyperceiler.module.hook.home.other.HomeMode;
import com.sevtinge.hyperceiler.module.hook.home.other.InfiniteScroll;
+import com.sevtinge.hyperceiler.module.hook.home.other.OptAppLaunchDelay;
import com.sevtinge.hyperceiler.module.hook.home.other.OverlapMode;
import com.sevtinge.hyperceiler.module.hook.home.other.ShortcutItemCount;
import com.sevtinge.hyperceiler.module.hook.home.other.ShowAllHideApp;
@@ -287,6 +288,7 @@ public void handleLoadPackage() {
// initHook(new AllowShareApk(), mPrefsMap.getBoolean("home_other_allow_share_apk"));
initHook(new HideReportText(), mPrefsMap.getBoolean("home_title_hide_report_text"));
initHook(new DisablePrestart(), mPrefsMap.getBoolean("home_other_disable_prestart"));
+ initHook(new OptAppLaunchDelay(), mPrefsMap.getBoolean("home_other_opt_app_launch_delay"));
// 实验性功能
initHook(BlurWhenShowShortcutMenu.INSTANCE, mPrefsMap.getBoolean("home_other_shortcut_background_blur"));
diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/app/Home/Phone/HomeV.java b/app/src/main/java/com/sevtinge/hyperceiler/module/app/Home/Phone/HomeV.java
index c40a2d804b..1efe332ae8 100644
--- a/app/src/main/java/com/sevtinge/hyperceiler/module/app/Home/Phone/HomeV.java
+++ b/app/src/main/java/com/sevtinge/hyperceiler/module/app/Home/Phone/HomeV.java
@@ -85,6 +85,7 @@
import com.sevtinge.hyperceiler.module.hook.home.other.FreeformShortcutMenu;
import com.sevtinge.hyperceiler.module.hook.home.other.HomeMode;
import com.sevtinge.hyperceiler.module.hook.home.other.InfiniteScroll;
+import com.sevtinge.hyperceiler.module.hook.home.other.OptAppLaunchDelay;
import com.sevtinge.hyperceiler.module.hook.home.other.OverlapMode;
import com.sevtinge.hyperceiler.module.hook.home.other.ShortcutItemCount;
import com.sevtinge.hyperceiler.module.hook.home.other.ShowAllHideApp;
@@ -286,6 +287,7 @@ public void handleLoadPackage() {
// initHook(new AllowShareApk(), mPrefsMap.getBoolean("home_other_allow_share_apk"));
initHook(new HideReportText(), mPrefsMap.getBoolean("home_title_hide_report_text"));
initHook(new DisablePrestart(), mPrefsMap.getBoolean("home_other_disable_prestart"));
+ initHook(new OptAppLaunchDelay(), mPrefsMap.getBoolean("home_other_opt_app_launch_delay"));
// 实验性功能
initHook(BlurWhenShowShortcutMenu.INSTANCE, mPrefsMap.getBoolean("home_other_shortcut_background_blur"));
diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/home/other/OptAppLaunchDelay.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/home/other/OptAppLaunchDelay.java
new file mode 100644
index 0000000000..3372f1801b
--- /dev/null
+++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/home/other/OptAppLaunchDelay.java
@@ -0,0 +1,35 @@
+/*
+ * 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 .
+ *
+ * Copyright (C) 2023-2024 HyperCeiler Contributions
+ */
+
+package com.sevtinge.hyperceiler.module.hook.home.other;
+
+import com.sevtinge.hyperceiler.module.base.BaseHook;
+
+// from nakixii
+public class OptAppLaunchDelay extends BaseHook {
+ @Override
+ public void init() throws NoSuchMethodException {
+ findAndHookMethod("com.android.systemui.shared.recents.utilities.WindowTransitionCallbackHelper", "executeFinishCallback", boolean.class, boolean.class, int.class, "android.window.WindowContainerTransaction", "com.android.systemui.shared.recents.utilities.ShellTransitionCallback", boolean.class, boolean.class, new MethodHook() {
+ @Override
+ protected void before(MethodHookParam param) throws Throwable {
+ param.args[5] = false;
+ }
+ });
+ }
+}
diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml
index 33365750a4..b66b7e832e 100644
--- a/app/src/main/res/values-zh-rCN/strings.xml
+++ b/app/src/main/res/values-zh-rCN/strings.xml
@@ -1518,6 +1518,7 @@
解锁桌面设置更多选项
解锁后的功能不一定可用,部分功能需要系统底层支持
禁用应用预加载
+ 优化应用启动延迟
模糊等级
完整模糊补充 (实验性)
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 90e4b4442c..d0b6d53ab0 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1488,6 +1488,7 @@
Unlock more options for Home screen settings
The unlocked features may not be available, and some features require support from the underlying system.
Disable app preload
+ Optimized app launch delay
Gallery Editor
Foundation
diff --git a/app/src/main/res/xml/home_other.xml b/app/src/main/res/xml/home_other.xml
index 318d7f1d95..39abaccffb 100644
--- a/app/src/main/res/xml/home_other.xml
+++ b/app/src/main/res/xml/home_other.xml
@@ -94,6 +94,11 @@
android:key="prefs_key_home_other_disable_prestart"
android:title="@string/home_other_disable_prestart" />
+
+