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 @@ -1293,6 +1293,8 @@
<string name="home_other_freeform_shortcut_menu_desc">在快捷菜单中添加小窗菜单</string>
<string name="home_other_tasks_shortcut_menu">多开模式</string>
<string name="home_other_tasks_shortcut_menu_desc">在快捷菜单中添加多开菜单</string>
<string name="home_other_force_stop_shortcut_menu">强制停止应用</string>
<string name="home_other_force_stop_shortcut_menu_desc">在快捷菜单中添加强制停止应用菜单</string>
<string name="home_other_allow_share_apk">允许分享应用</string>
<string name="home_other_always_blur_launcher_wallpaper">始终模糊桌面壁纸</string>
<string name="home_other_icon_mono_chrome">图标背景色</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 @@ -1342,6 +1342,8 @@
<string name="home_other_freeform_shortcut_menu_desc">Add Freeform menu to the shortcut menu</string>
<string name="home_other_tasks_shortcut_menu">More tasks mode</string>
<string name="home_other_tasks_shortcut_menu_desc">Add More tasks mode to the shortcut menu</string>
<string name="home_other_force_stop_shortcut_menu">Force stop app</string>
<string name="home_other_force_stop_shortcut_menu_desc">Add Force stop app menu to the shortcut menu</string>
<string name="home_other_allow_share_apk">Allow share app</string>
<string name="home_other_always_blur_launcher_wallpaper">Always blur launcher wallpaper</string>
<string name="home_other_icon_mono_chrome">Icon background color</string>
Expand Down
6 changes: 6 additions & 0 deletions library/core/src/main/res/xml/home_other.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@
android:summary="@string/home_other_tasks_shortcut_menu_desc"
android:title="@string/home_other_tasks_shortcut_menu" />

<SwitchPreference
android:defaultValue="false"
android:key="prefs_key_home_other_force_stop_shortcut_menu"
android:summary="@string/home_other_force_stop_shortcut_menu_desc"
android:title="@string/home_other_force_stop_shortcut_menu" />

<SwitchPreference
android:defaultValue="false"
android:key="prefs_key_home_other_shortcut_background_blur"
Expand Down
6 changes: 6 additions & 0 deletions library/core/src/main/res/xml/home_other_new.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@
android:summary="@string/home_other_tasks_shortcut_menu_desc"
android:title="@string/home_other_tasks_shortcut_menu" />

<SwitchPreference
android:defaultValue="false"
android:key="prefs_key_home_other_force_stop_shortcut_menu"
android:summary="@string/home_other_force_stop_shortcut_menu_desc"
android:title="@string/home_other_force_stop_shortcut_menu" />

<SwitchPreference
android:defaultValue="false"
android:key="prefs_key_home_other_allow_share_apk"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public void onPackageLoaded() {
// 其他
initHook(new HomeMode(), PrefsBridge.getStringAsInt("home_other_home_mode", 0) > 0);
initHook(new InfiniteScroll(), PrefsBridge.getBoolean("home_other_infinite_scroll"));
initHook(new FreeformShortcutMenu(), PrefsBridge.getBoolean("home_other_tasks_shortcut_menu"));
initHook(new FreeformShortcutMenu(), PrefsBridge.getBoolean("home_other_tasks_shortcut_menu") || PrefsBridge.getBoolean("home_other_force_stop_shortcut_menu"));
initHook(new EnableIconMonoChrome(), PrefsBridge.getBoolean("home_other_icon_mono_chrome"));
initHook(new HomePortraitReverse(), PrefsBridge.getBoolean("home_other_portrait_reverse"));
initHook(AlwaysBlurWallpaper.INSTANCE, PrefsBridge.getBoolean("home_other_always_blur_launcher_wallpaper"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public void onPackageLoaded() {
// 其他
initHook(new HomeMode(), PrefsBridge.getStringAsInt("home_other_home_mode", 0) > 0);
initHook(new InfiniteScroll(), PrefsBridge.getBoolean("home_other_infinite_scroll"));
initHook(new FreeformShortcutMenu(), (PrefsBridge.getBoolean("home_other_freeform_shortcut_menu") || (PrefsBridge.getBoolean("home_other_tasks_shortcut_menu"))));
initHook(new FreeformShortcutMenu(), (PrefsBridge.getBoolean("home_other_freeform_shortcut_menu") || PrefsBridge.getBoolean("home_other_tasks_shortcut_menu") || PrefsBridge.getBoolean("home_other_force_stop_shortcut_menu")));
initHook(new EnableIconMonoChrome(), PrefsBridge.getBoolean("home_other_icon_mono_chrome"));
initHook(new HomePortraitReverse(), PrefsBridge.getBoolean("home_other_portrait_reverse"));
initHook(AlwaysBlurWallpaper.INSTANCE, PrefsBridge.getBoolean("home_other_always_blur_launcher_wallpaper"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public void onPackageLoaded() {
initHook(AlwaysShowMiuiWidget.INSTANCE, PrefsBridge.getBoolean("home_widget_show_miui_widget"));

// 其他
initHook(new FreeformShortcutMenu(), PrefsBridge.getBoolean("home_other_tasks_shortcut_menu"));
initHook(new FreeformShortcutMenu(), PrefsBridge.getBoolean("home_other_tasks_shortcut_menu") || PrefsBridge.getBoolean("home_other_force_stop_shortcut_menu"));
initHook(ShortcutItemCount.INSTANCE, PrefsBridge.getBoolean("home_other_shortcut_remove_restrictions"));

initHook(SetDeviceLevel.INSTANCE, PrefsBridge.getBoolean("home_other_high_models"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public void onPackageLoaded() {
initHook(AllowMoveAllWidgetToMinus.INSTANCE, PrefsBridge.getBoolean("home_widget_allow_moved_to_minus_one_screen"));

// 其他
initHook(new FreeformShortcutMenu(), (PrefsBridge.getBoolean("home_other_freeform_shortcut_menu") || (PrefsBridge.getBoolean("home_other_tasks_shortcut_menu"))));
initHook(new FreeformShortcutMenu(), (PrefsBridge.getBoolean("home_other_freeform_shortcut_menu") || PrefsBridge.getBoolean("home_other_tasks_shortcut_menu") || PrefsBridge.getBoolean("home_other_force_stop_shortcut_menu")));
initHook(new AllowShareApk(), PrefsBridge.getBoolean("home_other_allow_share_apk"));
initHook(ShortcutItemCount.INSTANCE, PrefsBridge.getBoolean("home_other_shortcut_remove_restrictions"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import static com.sevtinge.hyperceiler.libhook.utils.hookapi.tool.AppsTool.getModuleRes;
import static com.sevtinge.hyperceiler.libhook.utils.hookapi.tool.EzxHelpUtils.newInstance;


import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.ComponentName;
Expand Down Expand Up @@ -163,6 +164,9 @@ public Object intercept(XposedInterface.Chain chain) throws Throwable {
if (titleStr.contentEquals(modRes.getString(R.string.new_task))) {
return createFreeformClickListener(shortcut, true);
}
if (titleStr.contentEquals(modRes.getString(R.string.system_notifrowmenu_forceclose))) {
return createForceStopClickListener(shortcut);
}
return chain.proceed();
}
});
Expand Down Expand Up @@ -223,6 +227,14 @@ private void addCustomShortcuts() {
}
}

if (PrefsBridge.getBoolean("home_other_force_stop_shortcut_menu")) {
Object forceStop = createShortcutItem(
R.string.system_notifrowmenu_forceclose, "ic_forceclose12");
if (forceStop != null) {
newItems.add(forceStop);
}
}

if (existingItems != null) {
newItems.addAll(existingItems);
}
Expand Down Expand Up @@ -275,6 +287,29 @@ private View.OnClickListener createFreeformClickListener(Object shortcut, boolea
};
}

private View.OnClickListener createForceStopClickListener(Object shortcut) {
return view -> {
try {
ComponentName component = (ComponentName) callMethod(shortcut, "getComponentName");
if (component == null) {
return;
}
String packageName = component.getPackageName();
if (packageName == null || packageName.isEmpty()) {
return;
}
android.app.ActivityManager am = (android.app.ActivityManager)
view.getContext().getSystemService(Context.ACTIVITY_SERVICE);
callMethod(am, "forceStopPackage", packageName);
if (view.getContext() instanceof Activity) {
((Activity) view.getContext()).onBackPressed();
}
} catch (Throwable t) {
XposedLog.e(TAG, getPackageName(), "forceStopApp failed", t);
}
};
}

private Intent createFreeformIntent(ComponentName component, boolean isMultiTask) {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_MAIN);
Expand Down
Loading