Skip to content

Commit a8565c1

Browse files
初次提交
1 parent 03f74ff commit a8565c1

108 files changed

Lines changed: 1080 additions & 8203 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 24 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,43 @@
11
<div align="center">
2-
<a href="https://github.com/bmax121/APatch/releases/latest"><img src="https://images.weserv.nl/?url=https://raw.githubusercontent.com/bmax121/APatch/main/app/src/main/ic_launcher-playstore.png&mask=circle" style="width: 128px;" alt="logo"></a>
2+
<a href="https://github.com/matsuzaka-yuki/APatch-Ultra/releases/latest"><img src="logo.png" style="width: 128px;" alt="logo"></a>
33

4-
<h1 align="center">APatch</h1>
4+
<h1 align="center">APatch Ultra</h1>
55

6-
[![Latest Release](https://img.shields.io/github/v/release/bmax121/APatch?label=Release&logo=github)](https://github.com/bmax121/APatch/releases/latest)
7-
[![Nightly Release](https://img.shields.io/badge/Nightly%20release-gray?logo=hackthebox&logoColor=fff)](https://nightly.link/bmax121/APatch/workflows/build/main/APatch)
8-
[![Weblate](https://img.shields.io/badge/Localization-Weblate-teal?logo=weblate)](https://hosted.weblate.org/engage/APatch)
9-
[![Channel](https://img.shields.io/badge/Follow-Telegram-blue.svg?logo=telegram)](https://t.me/APatchGroup)
6+
[![Latest Release](https://img.shields.io/github/v/release/matsuzaka-yuki/APatch-Ultra?label=Release&logo=github)](https://github.com/matsuzaka-yuki/APatch-Ultra/releases/latest)
7+
[![Channel](https://img.shields.io/badge/Follow-Telegram-blue.svg?logo=telegram)](https://t.me/APatchUltra)
108
[![GitHub License](https://img.shields.io/github/license/bmax121/APatch?logo=gnu)](/LICENSE)
119

1210
</div>
1311

14-
The patching of Android kernel and Android system.
12+
**语言 / Language:** [中文](README.md) | [English](README_EN.md)
1513

16-
- A new kernel-based root solution for Android devices.
17-
- APM: Support for modules similar to Magisk.
18-
- KPM: Support for modules that allow you to inject any code into the kernel (Provides kernel function `inline-hook` and `syscall-table-hook`).
19-
- APatch relies on [KernelPatch](https://github.com/bmax121/KernelPatch/).
20-
- The APatch UI and the APModule source code have been derived and modified from [KernelSU](https://github.com/tiann/KernelSU).
14+
**APatch Ultra** 是基于 [APatch](https://github.com/bmax121/APatch) 开发的增强版本,提供了更强大的功能和更好的用户体验。
2115

22-
[<img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png"
23-
alt="Get it on F-Droid"
24-
height="80">](https://f-droid.org/packages/me.bmax.apatch/)
16+
## 主要特性
2517

26-
Or download the latest APK from the [Releases Section](https://github.com/bmax121/APatch/releases/latest).
18+
- 基于内核的Android设备Root解决方案
19+
- APM:支持类似Magisk的模块系统
20+
- KPM:支持将任何代码注入内核的模块(提供内核函数`inline-hook``syscall-table-hook`
21+
- 移除了自动更新功能,提供更稳定的用户体验
22+
- 更好的自定义系统,支持自定义壁纸
2723

28-
## Supported Versions
24+
## 下载安装
2925

30-
- Only supports the ARM64 architecture.
31-
- Only supports Android kernel versions 3.18 - 6.12
26+
[发布页面](https://github.com/matsuzaka-yuki/APatch-Ultra/releases/latest) 下载最新的APK。
3227

33-
Support for Samsung devices with security protection: Planned
28+
## 系统要求
3429

35-
## Requirement
30+
- 支持ARM64架构
31+
- 支持Android内核版本 3.18 - 6.6
3632

37-
Kernel configs:
33+
## 开源信息
3834

39-
- `CONFIG_KALLSYMS=y` and `CONFIG_KALLSYMS_ALL=y`
35+
本项目基于以下开源项目:
4036

41-
- `CONFIG_KALLSYMS=y` and `CONFIG_KALLSYMS_ALL=n`: Initial support
37+
- [KernelPatch](https://github.com/bmax121/KernelPatch/) - 核心组件
38+
- [Magisk](https://github.com/topjohnwu/Magisk) - magiskboot和magiskpolicy
39+
- [KernelSU](https://github.com/tiann/KernelSU) - 应用UI和类似Magisk的模块支持
4240

43-
## Security Alert
41+
## 许可证
4442

45-
The **SuperKey** has higher privileges than root access.
46-
Weak or compromised keys can lead to unauthorized control of your device.
47-
It is critical to use robust keys and safeguard them from exposure to maintain the security of your device.
48-
49-
## Translation
50-
51-
To help translate APatch or improve existing translations, please use [Weblate](https://hosted.weblate.org/engage/apatch/). PR of APatch translation is no longer accepted, because it will conflict with Weblate.
52-
53-
<div align="center">
54-
55-
[![Translation Status](https://hosted.weblate.org/widget/APatch/open-graph.png)](https://hosted.weblate.org/engage/APatch/)
56-
57-
</div>
58-
59-
## Get Help
60-
61-
### Usage
62-
63-
For usage, please refer to [our official documentation](https://apatch.dev).
64-
It's worth noting that the documentation is currently not quite complete, and the content may change at any time.
65-
Furthermore, we need more volunteers to [contribute to the documentation](https://github.com/AndroidPatch/APatchDocs) in other languages.
66-
67-
### Updates
68-
69-
- Telegram Channel: [@APatchUpdates](https://t.me/APatchChannel)
70-
71-
### Discussions
72-
73-
- Telegram Group: [@APatchDiscussions(EN/CN)](https://t.me/Apatch_discuss)
74-
- Telegram Group: [中文](https://t.me/APatch_CN_Group)
75-
76-
### More Information
77-
78-
- [Documents](docs/)
79-
80-
## Credits
81-
82-
- [KernelPatch](https://github.com/bmax121/KernelPatch/): The core.
83-
- [Magisk](https://github.com/topjohnwu/Magisk): magiskboot and magiskpolicy.
84-
- [KernelSU](https://github.com/tiann/KernelSU): App UI, and Magisk module like support.
85-
86-
## License
87-
88-
APatch is licensed under the GNU General Public License v3 [GPL-3](http://www.gnu.org/copyleft/gpl.html).
43+
APatch Ultra 遵循 GNU General Public License v3 [GPL-3](http://www.gnu.org/copyleft/gpl.html) 许可证开源。

README_EN.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<div align="center">
2+
<a href="https://github.com/matsuzaka-yuki/APatch-Ultra/releases/latest"><img src="logo.png" style="width: 128px;" alt="logo"></a>
3+
4+
<h1 align="center">APatch Ultra</h1>
5+
6+
[![Latest Release](https://img.shields.io/github/v/release/matsuzaka-yuki/APatch-Ultra?label=Release&logo=github)](https://github.com/matsuzaka-yuki/APatch-Ultra/releases/latest)
7+
[![Channel](https://img.shields.io/badge/Follow-Telegram-blue.svg?logo=telegram)](https://t.me/APatchUltra)
8+
[![GitHub License](https://img.shields.io/github/license/matsuzaka-yuki/APatch-Ultra?logo=gnu)](/LICENSE)
9+
10+
</div>
11+
12+
**Language / 语言:** [English](README_EN.md) | [中文](README.md)
13+
14+
**APatch Ultra** is an enhanced version based on [APatch](https://github.com/bmax121/APatch), providing more powerful features and a better user experience.
15+
16+
## Key Features
17+
18+
- A kernel-based root solution for Android devices
19+
- APM: Support for modules similar to Magisk
20+
- KPM: Support for modules that allow you to inject any code into the kernel (Provides kernel function `inline-hook` and `syscall-table-hook`)
21+
- Removed auto-update functionality for a more stable user experience
22+
- Better custom system support, including custom wallpapers
23+
24+
## Download & Install
25+
26+
Download the latest APK from the [Releases Section](https://github.com/matsuzaka-yuki/APatch-Ultra/releases/latest).
27+
28+
## System Requirements
29+
30+
- Supports the ARM64 architecture
31+
- Supports Android kernel versions 3.18 - 6.6
32+
33+
## Open Source Credits
34+
35+
This project is based on the following open source projects:
36+
37+
- [KernelPatch](https://github.com/bmax121/KernelPatch/) - The core
38+
- [Magisk](https://github.com/topjohnwu/Magisk) - magiskboot and magiskpolicy
39+
- [KernelSU](https://github.com/tiann/KernelSU) - App UI, and Magisk module like support
40+
41+
## License
42+
43+
APatch Ultra is licensed under the GNU General Public License v3 [GPL-3](http://www.gnu.org/copyleft/gpl.html).

apatch_log.txt

92 Bytes
Binary file not shown.

apd/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fn get_git_version() -> Result<(u32, String), std::io::Error> {
1515
.trim()
1616
.parse()
1717
.map_err(|_| std::io::Error::new(std::io::ErrorKind::Other, "Failed to parse git count"))?;
18-
let version_code = 10000 + 200 + version_code; // For historical reasons
18+
let version_code = std::cmp::max(10000 + 200 + version_code, 10762); // For historical reasons and ensure minimum version
1919

2020
let version_name = String::from_utf8(
2121
Command::new("git")

apd/src/sepolicy.rs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fn parse_single_word(input: &str) -> IResult<&str, &str> {
1919
take_while1(is_sepolicy_char).parse(input)
2020
}
2121

22-
fn parse_bracket_objs(input: &str) -> IResult<&str, SeObject> {
22+
fn parse_bracket_objs(input: &str) -> IResult<&str, SeObject<'_>> {
2323
let (input, (_, words, _)) = (
2424
tag("{"),
2525
take_while_m_n(1, 100, |c: char| is_sepolicy_char(c) || c.is_whitespace()),
@@ -29,25 +29,25 @@ fn parse_bracket_objs(input: &str) -> IResult<&str, SeObject> {
2929
Ok((input, words.split_whitespace().collect()))
3030
}
3131

32-
fn parse_single_obj(input: &str) -> IResult<&str, SeObject> {
32+
fn parse_single_obj(input: &str) -> IResult<&str, SeObject<'_>> {
3333
let (input, word) = take_while1(is_sepolicy_char).parse(input)?;
3434
Ok((input, vec![word]))
3535
}
3636

37-
fn parse_star(input: &str) -> IResult<&str, SeObject> {
37+
fn parse_star(input: &str) -> IResult<&str, SeObject<'_>> {
3838
let (input, _) = tag("*").parse(input)?;
3939
Ok((input, vec!["*"]))
4040
}
4141

4242
// 1. a single sepolicy word
4343
// 2. { obj1 obj2 obj3 ...}
4444
// 3. *
45-
fn parse_seobj(input: &str) -> IResult<&str, SeObject> {
45+
fn parse_seobj(input: &str) -> IResult<&str, SeObject<'_>> {
4646
let (input, strs) = alt((parse_single_obj, parse_bracket_objs, parse_star)).parse(input)?;
4747
Ok((input, strs))
4848
}
4949

50-
fn parse_seobj_no_star(input: &str) -> IResult<&str, SeObject> {
50+
fn parse_seobj_no_star(input: &str) -> IResult<&str, SeObject<'_>> {
5151
let (input, strs) = alt((parse_single_obj, parse_bracket_objs)).parse(input)?;
5252
Ok((input, strs))
5353
}
@@ -379,7 +379,7 @@ const CMD_GENFSCON: u32 = 9;
379379
#[derive(Debug, Default)]
380380
enum PolicyObject {
381381
All, // for "*", stand for all objects, and is NULL in ffi
382-
One([u8; SEPOLICY_MAX_LEN]),
382+
One(#[allow(dead_code)] [u8; SEPOLICY_MAX_LEN]), // Field is used in to_c_ptr function
383383
#[default]
384384
None,
385385
}
@@ -406,13 +406,13 @@ impl TryFrom<&str> for PolicyObject {
406406
struct AtomicStatement {
407407
cmd: u32,
408408
subcmd: u32,
409-
sepol1: PolicyObject,
410-
sepol2: PolicyObject,
411-
sepol3: PolicyObject,
412-
sepol4: PolicyObject,
413-
sepol5: PolicyObject,
414-
sepol6: PolicyObject,
415-
sepol7: PolicyObject,
409+
#[allow(dead_code)] sepol1: PolicyObject, // Used in FfiPolicy conversion
410+
#[allow(dead_code)] sepol2: PolicyObject, // Used in FfiPolicy conversion
411+
#[allow(dead_code)] sepol3: PolicyObject, // Used in FfiPolicy conversion
412+
#[allow(dead_code)] sepol4: PolicyObject, // Used in FfiPolicy conversion
413+
#[allow(dead_code)] sepol5: PolicyObject, // Used in FfiPolicy conversion
414+
#[allow(dead_code)] sepol6: PolicyObject, // Used in FfiPolicy conversion
415+
#[allow(dead_code)] sepol7: PolicyObject, // Used in FfiPolicy conversion
416416
}
417417

418418
impl<'a> TryFrom<&'a NormalPerm<'a>> for Vec<AtomicStatement> {
@@ -656,6 +656,7 @@ impl<'a> TryFrom<&'a PolicyStatement<'a>> for Vec<AtomicStatement> {
656656

657657
#[derive(Debug)]
658658
#[repr(C)]
659+
#[allow(dead_code)] // Used for FFI interface
659660
struct FfiPolicy {
660661
cmd: u32,
661662
subcmd: u32,
@@ -668,6 +669,7 @@ struct FfiPolicy {
668669
sepol7: *const ffi::c_char,
669670
}
670671

672+
#[allow(dead_code)] // Used in FfiPolicy conversion
671673
fn to_c_ptr(pol: &PolicyObject) -> *const ffi::c_char {
672674
match pol {
673675
PolicyObject::None | PolicyObject::All => std::ptr::null(),

app/keystore.jks

2.65 KB
Binary file not shown.

app/proguard-rules.pro

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@
1414
# Keep ini4j Service Provider Interface
1515
-keep,allowobfuscation,allowoptimization public class org.ini4j.spi.*
1616

17+
# Keep native methods and JNI classes
18+
-keep class me.bmax.apatch.Natives {
19+
*;
20+
}
21+
22+
-keepclasseswithmembernames class * {
23+
native <methods>;
24+
}
25+
26+
-keep class me.bmax.apatch.Natives$Profile { *; }
27+
-keep class me.bmax.apatch.Natives$KPMCtlRes { *; }
28+
1729
# Kotlin
1830
-assumenosideeffects class kotlin.jvm.internal.Intrinsics {
1931
public static void check*(...);

app/src/main/AndroidManifest.xml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@
33
xmlns:tools="http://schemas.android.com/tools">
44

55
<uses-permission android:name="android.permission.INTERNET" />
6-
<uses-permission
7-
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
8-
android:maxSdkVersion="29" />
9-
<uses-permission
10-
android:name="android.permission.READ_EXTERNAL_STORAGE"
11-
android:maxSdkVersion="32" />
6+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
7+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
8+
<!-- 用于访问外部存储上的媒体文件 -->
9+
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
1210
<uses-permission
1311
android:name="android.permission.QUERY_ALL_PACKAGES"
1412
tools:ignore="QueryAllPackagesPermission" />
@@ -20,7 +18,7 @@
2018
android:enableOnBackInvokedCallback="true"
2119
android:fullBackupContent="@xml/backup_rules"
2220
android:icon="@mipmap/ic_launcher"
23-
android:label="APatch"
21+
android:label="APatch Ultra"
2422
android:networkSecurityConfig="@xml/network_security_config"
2523
android:requestLegacyExternalStorage="true"
2624
android:supportsRtl="true"

app/src/main/cpp/apjni.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,13 +254,13 @@ JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void * /*reserved*/) {
254254
JNIEnv* env{};
255255
if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK) [[unlikely]] {
256256
LOGE("Get JNIEnv error!");
257-
return JNI_FALSE;
257+
return -1;
258258
}
259259

260260
auto clazz = JNI_FindClass(env, "me/bmax/apatch/Natives");
261261
if (clazz.get() == nullptr) [[unlikely]] {
262262
LOGE("Failed to find Natives class");
263-
return JNI_FALSE;
263+
return -1;
264264
}
265265

266266
const static JNINativeMethod gMethods[] = {
@@ -286,7 +286,7 @@ JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void * /*reserved*/) {
286286

287287
if (JNI_RegisterNatives(env, clazz, gMethods, sizeof(gMethods) / sizeof(gMethods[0])) < 0) [[unlikely]] {
288288
LOGE("Failed to register native methods");
289-
return JNI_FALSE;
289+
return -1;
290290
}
291291

292292
LOGI("JNI_OnLoad Done!");

0 commit comments

Comments
 (0)