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
1 change: 1 addition & 0 deletions app/src/main/java/name/monwf/customiuizer/MainModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ private void handleLoadLauncher(final PackageLoadedParam lpparam) {
if (mPrefs.getBoolean("launcher_renameapps")) Launcher.RenameShortcutsHook(lpparam);
if (mPrefs.getBoolean("launcher_darkershadow")) Launcher.TitleShadowHook(lpparam);
if (mPrefs.getBoolean("controls_nonavbar")) Launcher.HideNavBarHook(lpparam);
if (mPrefs.getBoolean("launcher_disableprestart")) Launcher.DisablePrestartHook(lpparam);
if (mPrefs.getBoolean("launcher_infinitescroll")) Launcher.InfiniteScrollHook(lpparam);
if (mPrefs.getBoolean("launcher_hidetitles")) Launcher.HideTitlesHook(lpparam);
if (mPrefs.getBoolean("launcher_fixlaunch")) Launcher.FixAppInfoLaunchHook(lpparam);
Expand Down
28 changes: 28 additions & 0 deletions app/src/main/java/name/monwf/customiuizer/mods/Launcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import android.widget.TextView;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
Expand Down Expand Up @@ -604,6 +605,33 @@ public void run() {
});
}


public static void DisablePrestartHook(PackageLoadedParam lpparam) {
final Set<String> prop = new HashSet<>(Arrays.asList(
"persist.sys.usap_pool_enabled",
"persist.sys.dynamic_usap_enabled",
"persist.sys.prestart.proc",
"persist.sys.prestart.feedback.enable",
"persist.sys.launch_response_optimization.enable"
));

ModuleHelper.findAndHookMethod(
"com.miui.launcher.utils.SystemProperties",
lpparam.getClassLoader(),
"getBoolean",
String.class,
boolean.class,
new HookerClassHelper.MethodHook() {
@Override
protected void before(final io.github.libxposed.api.XposedInterface.BeforeHookCallback param) throws Throwable {
String key = (String) param.getArgs()[0];
if (key != null && prop.contains(key)) {
param.returnAndSkip(false);
}
}
}
);
}
public static void InfiniteScrollHook(PackageLoadedParam lpparam) {
ModuleHelper.findAndHookMethod("com.miui.home.launcher.ScreenView", lpparam.getClassLoader(), "getSnapToScreenIndex", int.class, int.class, int.class, new MethodHook() {
@Override
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,8 @@
<string name="launcher_gestures_shortcut">启动快捷方式</string>
<string name="launcher_gestures_activity">要启动的活动</string>
<string name="launcher_title">启动器</string>
<string name="launcher_disableprestart_title">禁用应用预加载</string>
<string name="launcher_disableprestart_summ">禁用应用预加载</string>
<string name="launcher_infinitescroll_title">无限滚动</string>
<string name="launcher_infinitescroll_summ">从末页跳到首页,反之亦然</string>
<string name="launcher_noclockhide_title">状态栏时钟始终显示</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,8 @@
<string name="launcher_gestures_shortcut">Shortcut to launch</string>
<string name="launcher_gestures_activity">Activity to launch</string>
<string name="launcher_title">Launcher</string>
<string name="launcher_disableprestart_title">Disable prestart</string>
<string name="launcher_disableprestart_summ">Disable prestart</string>
<string name="launcher_infinitescroll_title">Infinite scrolling</string>
<string name="launcher_infinitescroll_summ">Jump from the last page to the first one and vice versa</string>
<string name="launcher_noclockhide_title">No clock hide</string>
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/xml/prefs_launcher.xml
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,11 @@
android:key="pref_key_launcher_cat_other"
android:title="@string/system_mods_other">

<name.monwf.customiuizer.prefs.CheckBoxPreferenceEx
android:key="pref_key_launcher_disableprestart"
android:title="@string/launcher_disableprestart_title"
android:summary="@string/launcher_disableprestart_summ" />

<name.monwf.customiuizer.prefs.CheckBoxPreferenceEx
android:key="pref_key_launcher_infinitescroll"
android:title="@string/launcher_infinitescroll_title"
Expand Down