Skip to content

Commit 6716c9c

Browse files
committed
Modernize project
1 parent 7f865f6 commit 6716c9c

File tree

20 files changed

+155
-142
lines changed

20 files changed

+155
-142
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "libxposed-api"]
2+
path = libxposed-api
3+
url = https://github.com/libxposed/api

README.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
# Xposed 模块模板 (基于 libxposed)
1+
# Xposed Module Template (Based on libxposed)
22

3-
这是一个通用的 Xposed 模块模板,基于 [libxposed](https://github.com/libxposed/api) 构建。
3+
This is a general-purpose Xposed module template built on [libxposed](https://github.com/libxposed/api).
44

5-
## 如何使用
5+
## How to Use
66

7-
1. **修改包名**: `app/build.gradle` 中的 `namespace``applicationId` 修改为你自己的包名。
8-
2. **重命名包目录**: `app/src/main/java/com/example/module` 目录重命名为匹配你包名的目录结构。
9-
3. **更新模块入口**:
10-
- 修改 `MainModule.java` 以实现你的逻辑。
11-
- 更新 `app/src/main/resources/META-INF/xposed/java_init.list` 里的类名,确保它指向你的 `XposedModule` 实现类。
12-
4. **配置作用域**:
13-
- `app/src/main/resources/META-INF/xposed/scope.list` 中列出你想要 Hook 的应用包名(每行一个)。
14-
5. **设置编译参数**:
15-
- 根据需要修改 `app/build.gradle` 中的 `compileSdk``targetSdkVersion`
7+
1. **Modify Package Name**: Change `namespace` and `applicationId` in `app/build.gradle` to your own package name.
8+
2. **Rename Package Directory**: Rename the `app/src/main/java/com/example/module` directory to match your package structure.
9+
3. **Update Module Entry Point**:
10+
- Implement your logic in `MainModule.java`.
11+
- Update the class name in `app/src/main/resources/META-INF/xposed/java_init.list` to ensure it points to your `XposedModule` implementation class.
12+
4. **Configure Scope**:
13+
- List the package names of the apps you want to hook in `app/src/main/resources/META-INF/xposed/scope.list` (one per line).
14+
5. **Set Compilation Parameters**:
15+
- Modify `compileSdk` and `targetSdkVersion` in `app/build.gradle` as needed.
1616

17-
## 主要类介绍
17+
## Key Components
1818

19-
- `MainModule.java`: 模块的主入口,继承自 `XposedModule`
20-
- `java_init.list`: 告诉 libxposed 模块的入口类是谁。
21-
- `scope.list`: 定义模块生效的作用域(应用)。
22-
- `module.prop`: 模块的元数据信息。
19+
- `MainModule.java`: The main entry point of the module, inheriting from `XposedModule`.
20+
- `java_init.list`: Tells libxposed which class is the entry point for the module.
21+
- `scope.list`: Defines the scope (apps) where the module will be active.
22+
- `module.prop`: Contains metadata information for the module.
2323

24-
## 注意事项
24+
## Notes
2525

26-
- 本模板使用了 `libxposed` API,请参考其官方文档以了解更多高级用法。
27-
- 确保在开发过程中正确配置 `compileOnly` 依赖,以避免将 Xposed API 打包进你的 APK
26+
- This template uses the `libxposed` API. Please refer to its official documentation for more advanced usage.
27+
- Ensure that `compileOnly` dependencies are correctly configured during development to avoid bundling the Xposed API into your APK.

app/build.gradle

Lines changed: 0 additions & 40 deletions
This file was deleted.

app/build.gradle.kts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
plugins {
2+
id("com.android.application")
3+
}
4+
5+
android {
6+
namespace = "com.example.module"
7+
compileSdk = 36 // Can be modified as needed
8+
9+
defaultConfig {
10+
applicationId = "com.example.module"
11+
minSdk = 31
12+
versionCode = 1
13+
versionName = "1.0.0"
14+
}
15+
16+
lint {
17+
targetSdk = 36
18+
}
19+
20+
buildTypes {
21+
release {
22+
isMinifyEnabled = true
23+
proguardFiles(
24+
getDefaultProguardFile("proguard-android-optimize.txt"),
25+
"proguard-rules.pro",
26+
)
27+
}
28+
}
29+
30+
compileOptions {
31+
sourceCompatibility = JavaVersion.VERSION_21
32+
targetCompatibility = JavaVersion.VERSION_21
33+
}
34+
35+
lint {
36+
checkReleaseBuilds = false
37+
}
38+
39+
dependenciesInfo {
40+
includeInApk = false
41+
}
42+
}
43+
44+
dependencies {
45+
compileOnly("androidx.annotation:annotation:1.9.1")
46+
compileOnly("io.github.libxposed:api")
47+
compileOnly(project(":libxposed-compat"))
48+
}

app/src/main/java/com/example/module/MainModule.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
import io.github.libxposed.api.annotations.XposedHooker;
1111

1212
/**
13-
* 这是 Xposed 模块的入口类。
14-
* 客户化建议:
15-
* 1. 修改包名 `com.example.module` 为你自己的包名。
16-
* 2. `onSystemServerLoaded` `onPackageLoaded` 中添加你的 Hook 逻辑。
13+
* This is the entry point class for the Xposed module.
14+
* Customization suggestions:
15+
* 1. Change the package name `com.example.module` to your own.
16+
* 2. Add your Hook logic in `onSystemServerLoaded` or `onPackageLoaded`.
1717
*/
1818
@SuppressLint({"PrivateApi", "BlockedPrivateApi"})
1919
public class MainModule extends XposedModule {
@@ -25,8 +25,8 @@ public MainModule(XposedInterface base, ModuleLoadedParam param) {
2525
@Override
2626
public void onSystemServerLoaded(@NonNull SystemServerLoadedParam param) {
2727
super.onSystemServerLoaded(param);
28-
// 在这里添加针对 System Server 的 Hook 逻辑
29-
// 例如:
28+
// Add Hook logic for System Server here
29+
// For example:
3030
// try {
3131
// var classLoader = param.getClassLoader();
3232
// var clazz = classLoader.loadClass("com.android.server.wm.WindowManagerService");
@@ -39,25 +39,25 @@ public void onSystemServerLoaded(@NonNull SystemServerLoadedParam param) {
3939
@Override
4040
public void onPackageLoaded(@NonNull PackageLoadedParam param) {
4141
super.onPackageLoaded(param);
42-
// 在这里添加针对特定应用的 Hook 逻辑
42+
// Add Hook logic for specific applications here
4343
// if (param.getPackageName().equals("com.target.package")) {
4444
// // ...
4545
// }
4646
}
4747

4848
/**
49-
* 这是一个简单的 Hooker 示例。
49+
* This is a simple Hooker example.
5050
*/
5151
@XposedHooker
5252
private static class ExampleHooker implements Hooker {
5353
@BeforeInvocation
5454
public static void before(@NonNull BeforeHookCallback callback) {
55-
// 在方法执行前执行的逻辑
55+
// Logic to execute before method execution
5656
}
5757

5858
// @AfterInvocation
5959
// public static void after(@NonNull AfterHookCallback callback) {
60-
// // 在方法执行后执行的逻辑
60+
// // Logic to execute after method execution
6161
// }
6262
}
6363
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<resources>
22
<string name="app_name">Xposed Module Template</string>
3-
<string name="xposed_description">这是一个基于 libxposed 的 Xposed 模块模板。</string>
3+
<string name="xposed_description">This is an Xposed module template based on libxposed.</string>
44
</resources>
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# libxposed 模块属性
2-
# 最小 API 版本 (libxposed)
1+
# libxposed module properties
2+
# Minimum API version (libxposed)
33
minApiVersion=100
4-
# 目标 API 版本 (libxposed)
4+
# Target API version (libxposed)
55
targetApiVersion=100
6-
# 是否为静态作用域
7-
staticScope=true
6+
# Whether it is a static scope
7+
staticScope=true
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# 作用域列表,每行一个包名
2-
# 如果是系统模块,可以使用 'system'
1+
# Scope list, one package name per line
2+
# For system modules, you can use 'system'
33
system
4-
# 例如:
4+
# For example:
55
# com.android.systemui

build.gradle

Lines changed: 0 additions & 7 deletions
This file was deleted.

build.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
plugins {
2+
id("com.android.application") version "8.5.1" apply false
3+
}
4+
5+
tasks.register<Delete>("clean") {
6+
delete(rootProject.layout.buildDirectory)
7+
}

0 commit comments

Comments
 (0)