Skip to content

Commit

Permalink
init: replaceCursor
Browse files Browse the repository at this point in the history
  • Loading branch information
Young-Lord committed Jan 27, 2024
1 parent d81dc8f commit aedf0fa
Show file tree
Hide file tree
Showing 34 changed files with 734 additions and 1,062 deletions.
67 changes: 28 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,63 +1,52 @@
# Hide App from Recent Task List
# Replace Cursor

Simple module to hide any app from recent task list.
Replace mouse cursor with a custom one.

Designed in pure Kotlin & Jetpack Compose & Material Design 3. Can be a template for any Xposed module with a application selection list.
自定义包括鼠标指针、触控点在内的各种图片资源。

## How to use
Note: You can use Magisk + [RRO](https://source.android.com/docs/core/runtime/rros) for better experience.
See `magisk` folder for more information.
(be aware of SELinux context, btw.)

> Tested on: Android 10 (AOSP), Android 11 (MIUI 12), Android 13 (AOSP), Android 13 (MIUI 14), Android 14 (AOSP); may work on [10 <= Android <= 14](http://aospxref.com/android-10.0.0_r47/xref/frameworks/base/services/core/java/com/android/server/wm/RecentTasks.java#1272)
## How to use / 用法

> Tested on: None
1. Select `System framework` (package name may be `android` or `system` or empty, [see this](https://github.com/LSPosed/LSPosed/releases/tag/v1.9.1)) in module scope and activate the module
2. Force stop module
3. Select the apps you want to hide from recent app list in module settings (if package list not shown, you can manually import / export settings to edit config)
4. Reboot (you MUST reboot when you modify the list, or changes will not be applied until next reboot)
5. If you need multi-user support, install this module only in main user, and use [Shizuku](https://shizuku.rikka.app/download/) to get app info from other users.
3. Add resources to change. Please make sure that image sizes are bigger than hotspot (cursor left-top corner / touch point), otherwise nothing will show.
4. Reboot (you MUST reboot when you modify anything, or changes will not be applied until next reboot)
5. Reverse engineer `/system/framework/framework-res.apk` to find out the resource ID of the cursor you want to replace.

## Module Scope
For MiPad users, install [MaxMiPad](https://github.com/Xposed-Modules-Repo/com.yifeplayte.maxmipadinput/releases/latest) and enable `No Magic Pointer`.

- android

## Project URL
## Common resources / 常用资源

Home URL: <https://github.com/Young-Lord/hideRecent>
From MIUI 13, Android 12.

Xposed Modules Repo URL: <https://github.com/Xposed-Modules-Repo/moe.lyniko.hiderecent>
| Resource ID | Desciption | HotSpot |
|--------------------|----------------------------------------------------------------|----------|
| pointer_spot_touch | Touch point | (22, 22) |
| pointer_arrow | Mouse Pointer (Arrow) | (5, 5) |
| pointer_hand | Mouse Pointer (Hand, for example when hover on sth. clickable) | (9, 4) |

## Technical Details
Mouse-related resource-id may have a `_large` suffix, used when `Accessibility` -> `Large mouse pointer`(`大号鼠标指针`) is enabled.

UI: Material Design 3 + Jetpack Compose + Kotlin.

Hook: Hook `com.android.server.wm.RecentTasks.isVisibleRecentTask(com.android.server.wm.Task)`, `(callMethod(param.args[0], "getBaseIntent") as Intent).component?.packageName` is package name.
## Module Scope

## HELP ME IT DOESNT WORK!!!
- android

Please open a issue [here](https://github.com/Young-Lord/hideRecent/issues). Provide your Android version, `/system/framework/framework.jar` and all `/system/framework/framework{a number here}.jar` if exist.
## Project URL

I am not intended to support Android < 10, but anyone is free to [send a PR](https://github.com/Young-Lord/hideRecent/pulls) for Android < 10 support.
Home URL: <https://github.com/Young-Lord/replaceCursor>

PR for refactoring is also appreciated.
Xposed Modules Repo URL: <https://github.com/Xposed-Modules-Repo/moe.lyniko.replacecursor>

## License

Apache-2.0 License or MIT License are all OK.

## Thanks

<https://stackoverflow.com/questions/57266451/get-list-of-apps-of-all-users>

<https://github.com/LibChecker/LibChecker/pull/821/files> (Apache-2.0 license)

~~Original code from: <https://github.com/cokkeijigen/setAppFull>~~ refactored.

[rootAVD](https://gitlab.com/newbit/rootAVD)

## Why?

出于隐私或便捷原因,有些时候我们总是想隐藏一些应用。

CrDroid 内置了这个功能,这是好的,然而并不是所有人都在用 CrDroid。

而且,国内的 ROM 的“最近任务列表”里划掉一个卡片,就等于杀死这个应用,这太蠢了!你也不想你的 Clash For Android 编辑完配置就挂了吧?

Thanox 等一些应用也有这个功能,但只为了这个功能氪金并装一个闭源应用,怎么看都很怪。于是我买了 Thanox 订阅,然后写完这个模块后又卖了。
- <https://github.com/thesandipv/pointer_replacer> (doesn't work for me)
- <https://github.com/hujiayucc/R-Pointer> (per-app configuration)
11 changes: 4 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ plugins {
}

android {
namespace 'moe.lyniko.hiderecent'
namespace 'moe.lyniko.replacecursor'
compileSdk 34

defaultConfig {
applicationId "moe.lyniko.hiderecent"
applicationId "moe.lyniko.replacecursor"
minSdk 29
targetSdk 34
versionCode 202
Expand Down Expand Up @@ -51,17 +51,14 @@ android {
dependencies {
// module stuff
compileOnly 'de.robv.android.xposed:api:82'
implementation 'org.lsposed.hiddenapibypass:hiddenapibypass:4.3'
def shizuku_version = '13.1.5'
implementation "dev.rikka.shizuku:api:$shizuku_version"
implementation "dev.rikka.shizuku:provider:$shizuku_version"
implementation 'com.google.code.gson:gson:2.8.9'
implementation 'me.zhanghai.compose.preference:library:1.0.0'

// ui stuff
implementation "com.google.accompanist:accompanist-drawablepainter:0.28.0"
implementation "androidx.navigation:navigation-compose:2.7.6"
implementation 'androidx.core:core-ktx:1.12.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.2'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.7.0'
implementation 'androidx.activity:activity-compose:1.8.2'
implementation platform('androidx.compose:compose-bom:2022.10.00')
implementation 'androidx.compose.ui:ui'
Expand Down
33 changes: 33 additions & 0 deletions app/magisk/META-INF/com/google/android/update-binary
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/sbin/sh

#################
# Initialization
#################

umask 022

# echo before loading util_functions
ui_print() { echo "$1"; }

require_new_magisk() {
ui_print "*******************************"
ui_print " Please install Magisk v20.4+! "
ui_print "*******************************"
exit 1
}

#########################
# Load util_functions.sh
#########################

OUTFD=$2
ZIPFILE=$3

mount /data 2>/dev/null

[ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk
. /data/adb/magisk/util_functions.sh
[ $MAGISK_VER_CODE -lt 20400 ] && require_new_magisk

install_module
exit 0
1 change: 1 addition & 0 deletions app/magisk/META-INF/com/google/android/updater-script
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#MAGISK
5 changes: 5 additions & 0 deletions app/magisk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Example Magisk module for replacing cursor.

Modified by LY at <https://github.com/Xposed-Modules-Repo/moe.lyniko.replacecursor>

Change SELinux context: `su -c chcon u:object_r:vendor_overlay_file:s0 /data/adb/modules/pointer_replacer_rro/system/vendor/overlay/allusive_rro_sign.apk`
6 changes: 6 additions & 0 deletions app/magisk/module.prop
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
id=pointer_replacer_rro
name=Pointer Replacer RRO
version=v2.0
versionCode=2
author=thesandipv
description=Magisk Implementation of Pointer Replacer RRO, from https://github.com/sandipv22/pointer_replacer/
2 changes: 1 addition & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-keep class moe.lyniko.hiderecent.MainHook
-keep class moe.lyniko.replacecursor.MainHook
# -keep class rikka.shizuku.SystemServiceHelper
# -keep class android.** { *; }
11 changes: 5 additions & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.HideRecentTask"
android:name="moe.lyniko.hiderecent.MyApplication"
android:name="moe.lyniko.replacecursor.MyApplication"
tools:targetApi="31">
<meta-data
android:name="xposedmodule"
Expand All @@ -40,12 +40,11 @@
</intent-filter>
</activity>
<provider
android:name="rikka.shizuku.ShizukuProvider"
android:authorities="${applicationId}.shizuku"
android:multiprocess="false"
android:enabled="true"
android:name="moe.lyniko.replacecursor.ImageProvider"
android:authorities="moe.lyniko.replacecursor.ImageProvider"
android:exported="true"
android:permission="android.permission.INTERACT_ACROSS_USERS_FULL" />
android:enabled="true"
android:directBootAware="true" />
</application>

</manifest>
2 changes: 1 addition & 1 deletion app/src/main/assets/xposed_init
Original file line number Diff line number Diff line change
@@ -1 +1 @@
moe.lyniko.hiderecent.MainHook
moe.lyniko.replacecursor.MainHook
108 changes: 0 additions & 108 deletions app/src/main/java/moe/lyniko/hiderecent/MainActivity.kt

This file was deleted.

54 changes: 0 additions & 54 deletions app/src/main/java/moe/lyniko/hiderecent/MainHook.kt

This file was deleted.

Loading

0 comments on commit aedf0fa

Please sign in to comment.