1
mirror of https://github.com/topjohnwu/Magisk synced 2025-10-31 10:40:52 +01:00

Compare commits

..

64 Commits

Author SHA1 Message Date
topjohnwu
8e82113bce Release new canary build 2024-08-23 01:07:45 -07:00
vvb2060
f723ef153b zygisk_node: skip magisk32 if 64bit zygote only 2024-08-22 11:58:29 -07:00
topjohnwu
1dc723fb6d Attempt to reuse cache on Windows 2024-08-21 22:06:12 -07:00
topjohnwu
8f271c2575 Custom sccache support in CI 2024-08-21 16:51:30 -07:00
topjohnwu
7cf56b4406 Simplify ramdisk test 2024-08-21 16:46:37 -07:00
Wang Han
c2eb603957 Require GMS to be system app
Fixes https://github.com/topjohnwu/Magisk/issues/8279.
2024-08-20 10:36:14 -07:00
topjohnwu
e6bd2ff60f Fix stock image restore
Fix #8211
2024-08-20 02:23:20 -07:00
topjohnwu
5604074eba Fix module auto install
Fix #8208
2024-08-20 01:09:25 -07:00
topjohnwu
3f061c1a1e Update dependencies 2024-08-19 17:54:02 -07:00
LoveSy
55e78a7b1a BYD XDJA container support 2024-08-19 17:50:16 -07:00
vvb2060
000f1d6041 Revert "Don't support alternative binary paths"
This reverts commit 1eeb2a34a1.
2024-08-19 11:52:55 -07:00
vvb2060
2cbec20238 find_boot_image: test GKI 1.0 2024-08-19 03:05:24 -07:00
vvb2060
4b724c7257 find_boot_image: test previous kernels (<=4.19) 2024-08-19 03:05:24 -07:00
vvb2060
ab04c6ab39 find_boot_image: keep symlink 2024-08-19 03:05:24 -07:00
topjohnwu
821a6c6954 Only save gradle cache on asset build job 2024-08-18 21:42:28 -07:00
topjohnwu
5f27a62221 Use gradle version catalog 2024-08-18 13:12:23 -07:00
topjohnwu
c76cc4c6bd Update cuttlefish hostside tools 2024-08-16 15:58:29 -07:00
𝗦𝗵𝗟𝗲𝗿𝗣
52b75c53b6 Update TR Locales 2024-08-16 11:38:36 -07:00
topjohnwu
9db2e99086 Test 16k on Cuttlefish 2024-08-15 22:51:40 -07:00
LoveSy
e9e2ecf2dd load partition_map only once 2024-08-15 10:10:18 -07:00
LoveSy
9a9e617c35 Use find_if 2024-08-15 10:10:18 -07:00
LoveSy
3a0becc783 Use parse_impl for partition_map 2024-08-15 10:10:18 -07:00
ChsBuffer
1f974cb220 Use androidboot.partition_map as a fallback for matching partition names in the preinit finding. 2024-08-15 10:10:18 -07:00
LoveSy
1db80228e8 Move worker mount to magiskinit 2024-08-15 02:39:51 -07:00
LoveSy
838e1e254d Move devpts mount to magiskinit 2024-08-15 02:39:51 -07:00
topjohnwu
554eda8fe1 Switch to gmake on macOS 2024-08-15 02:37:59 -07:00
topjohnwu
2bdc047c4d Call sqlite3_free only on sqlite3 malloc-ed objects 2024-08-14 13:23:59 -07:00
topjohnwu
e64f59ce5b Make CI faster 2024-08-14 00:21:45 -07:00
topjohnwu
b8140ad4e6 Re-enable Windows CI 2024-08-13 21:12:06 -07:00
LoveSy
5a55483698 Set -fno-threadsafe-statics for crt0
Since crt0 has no pthread support, we don't need lock for statics.
2024-08-12 10:57:45 -07:00
vvb2060
2d341863f5 set MAGISKTMP 2024-08-12 02:05:58 -07:00
LoveSy
278046becb Fix wrong cxx_extern return value
This fix UB
2024-08-12 02:05:26 -07:00
topjohnwu
5c0497354f Temporarily disable Windows CI 2024-08-12 02:04:13 -07:00
topjohnwu
98c258df93 Update AGP 2024-08-11 04:30:01 -07:00
topjohnwu
c578cccfd5 Update to ONDK r27.4 2024-08-11 04:16:19 -07:00
Andrew Gunnerson
07835a3e0e util_functions.sh: Fix syntax error due to missing then
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2024-08-06 01:16:19 -07:00
topjohnwu
09131aca89 Fix find_boot_image
Close #8255
2024-08-05 11:24:30 -07:00
topjohnwu
9ce998a6df Fix arab strings 2024-08-04 01:54:28 -07:00
topjohnwu
ca36b42d79 Update release.sh 2024-08-03 01:55:03 -07:00
topjohnwu
37df39ec37 Address clippy warnings 2024-08-03 01:52:16 -07:00
topjohnwu
1701361a73 Update cargo dependencies 2024-08-03 01:49:14 -07:00
topjohnwu
4c14ae33f5 Properly configure Rust builds 2024-08-03 01:28:53 -07:00
topjohnwu
d4a9ef7b7f Cleanup build.py 2024-08-03 00:05:49 -07:00
topjohnwu
1539cfe888 Support setting custom ABI list
Also stop building riscv64 by default
2024-08-01 14:33:08 -07:00
topjohnwu
9093be1329 Run commands through shell on Windows 2024-07-31 17:21:18 -07:00
topjohnwu
606d076251 Build debug with thin lto 2024-07-31 17:00:01 -07:00
残页
46a34e19bc Check vendor boot ramdisk table size 2024-07-31 16:59:51 -07:00
topjohnwu
5ac7dc0b37 Support vendor boot unpack/repack
Fix #6460, close #6620
2024-07-30 04:00:12 -07:00
topjohnwu
3b27de3715 Output logs to files 2024-07-25 03:48:13 -07:00
topjohnwu
939bfac920 Make sure version is fetched correctly 2024-07-25 03:04:27 -07:00
muhammadbahaa2001
f601bf12d5 Updated Arabic 2024-07-25 03:03:49 -07:00
topjohnwu
0495468d02 Release new canary build 2024-07-24 23:13:21 -07:00
topjohnwu
300a2a242c Add release script 2024-07-24 23:10:57 -07:00
topjohnwu
33aebb5976 Stop embedding executables 2024-07-24 22:49:48 -07:00
pndwal
b3d6809c0b Update README.MD
Remove redundant Canary changelog link
2024-07-24 19:04:50 -07:00
LoveSy
461f7e9f89 Use metadata even if it is f2fs 2024-07-24 19:02:35 -07:00
LoveSy
9cc50b20d8 Correctly handle comments in sepolicy.rule 2024-07-24 19:02:25 -07:00
LoveSy
f488e9df8f Fix sepolicy rule path 2024-07-24 19:02:12 -07:00
LoveSy
0dc596e206 Update Chinese translation 2024-07-24 19:01:59 -07:00
topjohnwu
c3bf03190b Use K2 in kapt 2024-07-24 17:06:41 -07:00
topjohnwu
021ae891a9 Update dependencies 2024-07-24 16:53:15 -07:00
topjohnwu
9c03514eb1 Create :app:clean task 2024-07-24 16:46:47 -07:00
topjohnwu
eb74b266e1 Do not modify args
Close #8242
2024-07-24 16:37:22 -07:00
topjohnwu
80eb6ff25a Update README 2024-07-23 21:37:04 -07:00
71 changed files with 2026 additions and 1211 deletions

View File

@@ -1,4 +1,8 @@
name: Magisk Setup
inputs:
is-asset-build:
required: false
default: false
runs:
using: "composite"
steps:
@@ -13,32 +17,84 @@ runs:
with:
python-version: "3.x"
- name: Set up sccache
uses: hendrikmuhs/ccache-action@v1.2
- name: Install GNU make
if: runner.os == 'macOS'
shell: bash
run: |
brew install make
echo 'GNUMAKE=gmake' >> "$GITHUB_ENV"
- name: Cache sccache
uses: actions/cache@v4
with:
variant: sccache
key: ${{ runner.os }}-${{ github.sha }}
restore-keys: ${{ runner.os }}
max-size: 10000M
path: .sccache
key: sccache-${{ runner.os }}-${{ github.sha }}
restore-keys: sccache-${{ runner.os }}-
- name: Set up sccache
shell: bash
env:
SCCACHE_DIRECT: false
SCCACHE_DIR: ${{ github.workspace }}/.sccache
SCCACHE_CACHE_SIZE: 2G
SCCACHE_IDLE_TIMEOUT: 0
run: |
bash $GITHUB_ACTION_PATH/sccache.sh
sccache --start-server
sccache -z
- name: Show sccache stats
uses: gacts/run-and-post-run@v1
with:
run: sccache -s
post: sccache -s
- name: Set GRADLE_USER_HOME
shell: bash
run: echo "GRADLE_USER_HOME=$GITHUB_WORKSPACE/.gradle" >> "$GITHUB_ENV"
- name: Cache Gradle dependencies
uses: actions/cache@v4
if: inputs.is-asset-build == 'true'
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
!~/.gradle/caches/build-cache-*
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: ${{ runner.os }}-gradle-
.gradle/caches
.gradle/wrapper
!.gradle/caches/build-cache-*
key: gradle-cache-${{ hashFiles('gradle/**') }}
restore-keys: gradle-cache-
- name: Cache build cache
uses: actions/cache@v4
- name: Restore Gradle dependencies
uses: actions/cache/restore@v4
if: inputs.is-asset-build == 'false'
with:
path: |
~/.gradle/caches/build-cache-*
key: ${{ runner.os }}-build-cache-${{ github.sha }}
restore-keys: ${{ runner.os }}-build-cache-
.gradle/caches
.gradle/wrapper
!.gradle/caches/build-cache-*
key: gradle-cache-${{ hashFiles('gradle/**') }}
restore-keys: gradle-cache-
enableCrossOsArchive: true
- name: Cache Gradle build cache
uses: actions/cache@v4
if: inputs.is-asset-build == 'true'
with:
path: |
.gradle/caches/build-cache-*
key: gradle-build-cache-${{ github.sha }}
restore-keys: gradle-build-cache-
- name: Restore Gradle build cache
uses: actions/cache/restore@v4
if: inputs.is-asset-build == 'false'
with:
path: |
.gradle/caches/build-cache-*
key: gradle-build-cache-${{ github.sha }}
restore-keys: gradle-build-cache-
enableCrossOsArchive: true
- name: Set up NDK
run: python build.py -v ndk
shell: bash
run: python build.py -v ndk

25
.github/actions/setup/sccache.sh vendored Executable file
View File

@@ -0,0 +1,25 @@
#!/usr/bin/env bash
# Get latest sccache version
get_sccache_ver() {
curl -sL 'https://api.github.com/repos/mozilla/sccache/releases/latest' | jq -r .name
}
# $1=variant
# $2=install_dir
# $3=exe
install_from_gh() {
local ver=$(curl -sL 'https://api.github.com/repos/mozilla/sccache/releases/latest' | jq -r .name)
local url="https://github.com/mozilla/sccache/releases/download/${ver}/sccache-${ver}-$1.tar.gz"
local dest="$2/$3"
curl -L "$url" | tar xz -O --wildcards "*/$3" > $dest
chmod +x $dest
}
if [ $RUNNER_OS = "macOS" ]; then
brew install sccache
elif [ $RUNNER_OS = "Linux" ]; then
install_from_gh x86_64-unknown-linux-musl /usr/local/bin sccache
elif [ $RUNNER_OS = "Windows" ]; then
install_from_gh x86_64-pc-windows-msvc $USERPROFILE/.cargo/bin sccache.exe
fi

1
.github/ci.prop vendored Normal file
View File

@@ -0,0 +1 @@
abiList=arm64-v8a

View File

@@ -17,9 +17,7 @@ on:
jobs:
build:
name: Build Magisk artifacts
runs-on: ubuntu-latest
env:
SCCACHE_DIRECT: false
runs-on: macos-14
strategy:
fail-fast: false
steps:
@@ -27,10 +25,11 @@ jobs:
uses: actions/checkout@v4
with:
submodules: "recursive"
fetch-depth: 0
- name: Setup environment
uses: ./.github/actions/setup
with:
is-asset-build: true
- name: Build release
run: ./build.py -vr all
@@ -58,24 +57,21 @@ jobs:
test-build:
name: Test building on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
SCCACHE_DIRECT: false
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-14]
os: [windows-latest, ubuntu-latest]
steps:
- name: Check out
uses: actions/checkout@v4
with:
submodules: "recursive"
fetch-depth: 0
- name: Setup environment
uses: ./.github/actions/setup
- name: Build debug
run: python build.py -v all
- name: Test build
run: python build.py -v -c .github/ci.prop all
- name: Stop gradle daemon
run: ./gradlew --stop
@@ -96,8 +92,6 @@ jobs:
steps:
- name: Check out
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download build artifacts
uses: actions/download-artifact@v4
@@ -114,9 +108,18 @@ jobs:
- name: Run AVD test
timeout-minutes: 10
env:
AVD_TEST_VERBOSE: 1
AVD_TEST_LOG: 1
run: scripts/avd_test.sh ${{ matrix.version }} ${{ matrix.type }}
- name: Upload logs on error
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: "avd-logs-${{ matrix.version }}"
path: |
kernel.log
logcat.log
avd-test-32:
name: Test API ${{ matrix.version }} (x86)
runs-on: ubuntu-latest
@@ -129,8 +132,6 @@ jobs:
steps:
- name: Check out
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download build artifacts
uses: actions/download-artifact@v4
@@ -148,11 +149,20 @@ jobs:
timeout-minutes: 10
env:
FORCE_32_BIT: 1
AVD_TEST_VERBOSE: 1
AVD_TEST_LOG: 1
run: scripts/avd_test.sh ${{ matrix.version }}
- name: Upload logs on error
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: "avd32-logs-${{ matrix.version }}"
path: |
kernel.log
logcat.log
cf_test:
name: Test ${{ matrix.branch }} (${{ matrix.target }})
name: Test ${{ matrix.device }}
runs-on: ubuntu-24.04
needs: build
env:
@@ -162,13 +172,13 @@ jobs:
matrix:
include:
- branch: "aosp-main"
target: "aosp_cf_x86_64_phone-trunk_staging-userdebug"
device: "aosp_cf_x86_64_phone"
- branch: "aosp-main-throttled"
device: "aosp_cf_x86_64_phone_pgagnostic"
steps:
- name: Check out
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download build artifacts
uses: actions/download-artifact@v4
@@ -179,7 +189,7 @@ jobs:
- name: Setup Cuttlefish environment
run: |
scripts/cuttlefish.sh setup
scripts/cuttlefish.sh download ${{ matrix.branch }} ${{ matrix.target }}
scripts/cuttlefish.sh download ${{ matrix.branch }} ${{ matrix.device }}
- name: Run Cuttlefish test
timeout-minutes: 10
@@ -189,7 +199,7 @@ jobs:
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: "cvd-logs"
name: "cvd-logs-${{ matrix.device }}"
path: |
/home/runner/aosp_cf_phone/cuttlefish/instances/cvd-1/logs
/home/runner/aosp_cf_phone/cuttlefish/instances/cvd-1/cuttlefish_config.json

2
.gitignore vendored
View File

@@ -13,7 +13,7 @@ native/out
# Android Studio / Gradle
*.iml
.gradle
.idea
/local.properties
/.idea
/build
/captures

View File

@@ -22,8 +22,7 @@ Click the icon below to download Magisk apk.
[![](https://img.shields.io/badge/Magisk-v27.0-blue)](https://github.com/topjohnwu/Magisk/releases/tag/v27.0)
[![](https://img.shields.io/badge/Magisk%20Beta-v27.0-blue)](https://github.com/topjohnwu/Magisk/releases/tag/v27.0)
[![](https://img.shields.io/badge/Magisk-Canary-red)](https://raw.githubusercontent.com/topjohnwu/magisk-files/canary/app-release.apk)
[![](https://img.shields.io/badge/Magisk-Debug-red)](https://raw.githubusercontent.com/topjohnwu/magisk-files/canary/app-debug.apk)
[![](https://img.shields.io/badge/Magisk-Canary-red)](https://github.com/topjohnwu/Magisk/releases/tag/canary-27007)
## Useful Links
@@ -31,8 +30,6 @@ Click the icon below to download Magisk apk.
- [Building and Development](https://topjohnwu.github.io/Magisk/build.html)
- [Magisk Documentation](https://topjohnwu.github.io/Magisk/)
- [Zygisk module sample](https://github.com/topjohnwu/zygisk-module-sample)
- [Canary channel changelog](https://github.com/topjohnwu/magisk-files/blob/canary/notes.md)
## Bug Reports

View File

@@ -47,22 +47,21 @@ android {
dependencies {
implementation(project(":app:core"))
implementation("com.github.topjohnwu:indeterminate-checkbox:1.0.7")
implementation("dev.rikka.rikkax.layoutinflater:layoutinflater:1.3.0")
implementation("dev.rikka.rikkax.insets:insets:1.3.0")
implementation("dev.rikka.rikkax.recyclerview:recyclerview-ktx:1.3.2")
implementation(libs.indeterminate.checkbox)
implementation(libs.rikka.layoutinflater)
implementation(libs.rikka.insets)
implementation(libs.rikka.recyclerview)
val vNav = "2.7.7"
implementation("androidx.navigation:navigation-fragment-ktx:${vNav}")
implementation("androidx.navigation:navigation-ui-ktx:${vNav}")
implementation(libs.navigation.fragment.ktx)
implementation(libs.navigation.ui.ktx)
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
implementation("androidx.recyclerview:recyclerview:1.3.2")
implementation("androidx.transition:transition:1.5.0")
implementation("androidx.fragment:fragment-ktx:1.8.1")
implementation("androidx.appcompat:appcompat:1.7.0")
implementation("com.google.android.material:material:1.12.0")
implementation(libs.constraintlayout)
implementation(libs.swiperefreshlayout)
implementation(libs.recyclerview)
implementation(libs.transition)
implementation(libs.fragment.ktx)
implementation(libs.appcompat)
implementation(libs.material)
// Make sure kapt runs with a proper kotlin-stdlib
kapt(kotlin("stdlib"))

View File

@@ -1,5 +1,6 @@
package com.topjohnwu.magisk.dialog
import android.content.Context
import com.topjohnwu.magisk.core.R
import com.topjohnwu.magisk.core.di.ServiceLocator
import com.topjohnwu.magisk.core.download.DownloadEngine
@@ -7,6 +8,8 @@ import com.topjohnwu.magisk.core.download.Subject
import com.topjohnwu.magisk.core.model.module.OnlineModule
import com.topjohnwu.magisk.ui.flash.FlashFragment
import com.topjohnwu.magisk.view.MagiskDialog
import com.topjohnwu.magisk.view.Notifications
import kotlinx.parcelize.Parcelize
class OnlineModuleInstallDialog(private val item: OnlineModule) : MarkDownDialog() {
@@ -17,14 +20,21 @@ class OnlineModuleInstallDialog(private val item: OnlineModule) : MarkDownDialog
return if (str.length > 1000) str.substring(0, 1000) else str
}
@Parcelize
class Module(
override val module: OnlineModule,
override val autoLaunch: Boolean,
override val notifyId: Int = Notifications.nextId()
) : Subject.Module() {
override fun pendingIntent(context: Context) = FlashFragment.installIntent(context, file)
}
override fun build(dialog: MagiskDialog) {
super.build(dialog)
dialog.apply {
fun download(install: Boolean) {
val module = Subject.Module(item, install)
module.piCreator = FlashFragment::installIntent
DownloadEngine.startWithActivity(activity, module)
DownloadEngine.startWithActivity(activity, Module(item, install))
}
val title = context.getString(R.string.repo_install_title,

5
app/build.gradle.kts Normal file
View File

@@ -0,0 +1,5 @@
tasks.register("clean") {
subprojects.forEach {
dependsOn(":app:${it.name}:clean")
}
}

View File

@@ -30,39 +30,34 @@ android {
dependencies {
api(project(":app:shared"))
api("com.jakewharton.timber:timber:5.0.1")
api("io.noties.markwon:core:4.6.2")
implementation("org.bouncycastle:bcpkix-jdk18on:1.78.1")
implementation("org.apache.commons:commons-compress:1.26.2")
api(libs.timber)
api(libs.markwon.core)
implementation(libs.bcpkix)
implementation(libs.commons.compress)
val vLibsu = "6.0.0"
api("com.github.topjohnwu.libsu:core:${vLibsu}")
api("com.github.topjohnwu.libsu:service:${vLibsu}")
api("com.github.topjohnwu.libsu:nio:${vLibsu}")
api(libs.libsu.core)
api(libs.libsu.service)
api(libs.libsu.nio)
val vRetrofit = "2.11.0"
implementation("com.squareup.retrofit2:retrofit:${vRetrofit}")
implementation("com.squareup.retrofit2:converter-moshi:${vRetrofit}")
implementation("com.squareup.retrofit2:converter-scalars:${vRetrofit}")
implementation(libs.retrofit)
implementation(libs.retrofit.moshi)
implementation(libs.retrofit.scalars)
val vOkHttp = "4.12.0"
implementation("com.squareup.okhttp3:okhttp:${vOkHttp}")
implementation("com.squareup.okhttp3:logging-interceptor:${vOkHttp}")
implementation("com.squareup.okhttp3:okhttp-dnsoverhttps:${vOkHttp}")
implementation(libs.okhttp)
implementation(libs.okhttp.logging)
implementation(libs.okhttp.dnsoverhttps)
val vMoshi = "1.15.1"
implementation("com.squareup.moshi:moshi:${vMoshi}")
ksp("com.squareup.moshi:moshi-kotlin-codegen:${vMoshi}")
implementation(libs.moshi)
ksp(libs.moshi.codegen)
val vRoom = "2.6.1"
implementation("androidx.room:room-runtime:${vRoom}")
implementation("androidx.room:room-ktx:${vRoom}")
ksp("androidx.room:room-compiler:${vRoom}")
implementation(libs.room.runtime)
implementation(libs.room.ktx)
ksp(libs.room.compiler)
implementation("androidx.core:core-splashscreen:1.0.1")
implementation("androidx.core:core-ktx:1.13.1")
implementation("androidx.activity:activity:1.9.0")
implementation("androidx.collection:collection-ktx:1.4.1")
implementation("androidx.profileinstaller:profileinstaller:1.3.1")
implementation("androidx.lifecycle:lifecycle-process:2.8.3")
implementation(libs.core.splashscreen)
implementation(libs.core.ktx)
implementation(libs.activity)
implementation(libs.collection.ktx)
implementation(libs.profileinstaller)
implementation(libs.lifecycle.process)
}

View File

@@ -17,7 +17,7 @@ import kotlinx.parcelize.Parcelize
import java.io.File
import java.util.UUID
sealed class Subject : Parcelable {
abstract class Subject : Parcelable {
abstract val url: String
abstract val file: Uri
@@ -27,24 +27,13 @@ sealed class Subject : Parcelable {
open fun pendingIntent(context: Context): PendingIntent? = null
@Parcelize
class Module(
private val module: OnlineModule,
override val autoLaunch: Boolean,
override val notifyId: Int = Notifications.nextId()
) : Subject() {
override val url: String get() = module.zipUrl
override val title: String get() = module.downloadFilename
@IgnoredOnParcel
override val file by lazy {
abstract class Module : Subject() {
abstract val module: OnlineModule
final override val url: String get() = module.zipUrl
final override val title: String get() = module.downloadFilename
final override val file by lazy {
MediaStoreUtils.getFile(title).uri
}
@IgnoredOnParcel
var piCreator: ((Context, Uri) -> PendingIntent)? = null
override fun pendingIntent(context: Context) = piCreator?.invoke(context, file)
}
@Parcelize

View File

@@ -134,10 +134,12 @@ abstract class MagiskInstallImpl protected constructor(
val abi32 = Const.CPU_ABI_32
if (Process.is64Bit() && abi32 != null) {
val magisk32 = File(installDir, "magisk32")
val entry = zf.getEntry("lib/$abi32/libmagisk.so")
zf.getInputStream(entry).writeTo(magisk32)
magisk32.setExecutable(true)
if (entry != null) {
val magisk32 = File(installDir, "magisk32")
zf.getInputStream(entry).writeTo(magisk32)
magisk32.setExecutable(true)
}
}
}
} else {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -176,6 +176,8 @@
<string name="setting_add_shortcut_summary">在隐藏后难以识别名称和图标的情况下,添加快捷方式到桌面</string>
<string name="settings_doh_title">安全 DNSDoH</string>
<string name="settings_doh_description">解决某些地区的 DNS 污染问题</string>
<string name="settings_random_name_title">随机文件名</string>
<string name="settings_random_name_description">随机修补镜像和 tar 文件的文件名以防止检测</string>
<string name="multiuser_mode">多用户模式</string>
<string name="settings_owner_only">仅设备所有者</string>

View File

@@ -1,13 +1,22 @@
package com.topjohnwu.magisk;
import android.content.Context;
import android.content.pm.ApplicationInfo;
public class ProviderInstaller {
private static final String GMS_PACKAGE_NAME = "com.google.android.gms";
public static boolean install(Context context) {
try {
// Check if gms is a system app
ApplicationInfo appInfo = context.getPackageManager().getApplicationInfo(GMS_PACKAGE_NAME, 0);
if ((appInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
return false;
}
// Try installing new SSL provider from Google Play Service
Context gms = context.createPackageContext("com.google.android.gms",
Context gms = context.createPackageContext(GMS_PACKAGE_NAME,
Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY);
gms.getClassLoader()
.loadClass("com.google.android.gms.common.security.ProviderInstallerImpl")

View File

@@ -6,7 +6,7 @@ plugins {
lsparanoid {
seed = if (RAND_SEED != 0) RAND_SEED else null
includeDependencies = true
global = true
classFilter = { true }
}
android {

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="upgrade_msg">عليك الترقية ماجـيسك Manager لإكمال تهيئة التطبيق.هل اكمل؟</string>
<string name="no_internet_msg">يرجى الاتصال بالانترنيت! ترقية ماجـيسك مطلوب...</string>
<string name="upgrade_msg">عليك الترقية Magisk لإكمال تهيئة التطبيق. هل تريد التنزيل والتثبيت؟</string>
<string name="no_internet_msg">يرجى اللإتصال بالإنترنت! ترقية Magisk مطلوبة.</string>
<string name="dling">جارٍ التنزيل</string>
<string name="relaunch_app">يرجى إعادة تشغيل التطبيق يدوياً</string>
</resources>

661
build.py

File diff suppressed because it is too large Load Diff

View File

@@ -25,10 +25,10 @@ tasks.withType<KotlinCompile>().configureEach {
}
dependencies {
implementation(kotlin("gradle-plugin", "2.0.0"))
implementation("com.android.tools.build:gradle:8.5.1")
implementation("com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:2.0.0-1.0.23")
implementation("androidx.navigation:navigation-safe-args-gradle-plugin:2.7.7")
implementation("org.lsposed.lsparanoid:gradle-plugin:0.5.2")
implementation("org.eclipse.jgit:org.eclipse.jgit:6.10.0.202406032230-r")
implementation(kotlin("gradle-plugin", libs.versions.kotlin.get()))
implementation(libs.android.gradle.plugin)
implementation(libs.ksp.plugin)
implementation(libs.navigation.safe.args.plugin)
implementation(libs.lsparanoid.plugin)
implementation(libs.jgit)
}

View File

@@ -0,0 +1,7 @@
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}

View File

@@ -8,6 +8,8 @@ import java.util.Properties
private val props = Properties()
private var commitHash = ""
private val supportAbis = setOf("armeabi-v7a", "x86", "arm64-v8a", "x86_64", "riscv64")
private val defaultAbis = setOf("armeabi-v7a", "x86", "arm64-v8a", "x86_64")
object Config {
operator fun get(key: String): String? {
@@ -20,6 +22,10 @@ object Config {
val version: String get() = get("version") ?: commitHash
val versionCode: Int get() = get("magisk.versionCode")!!.toInt()
val stubVersion: String get() = get("magisk.stubVersion")!!
val abiList: Set<String> get() {
val abiList = get("abiList") ?: return defaultAbis
return abiList.split(Regex("\\s*,\\s*")).toSet() intersect supportAbis
}
}
class MagiskPlugin : Plugin<Project> {

View File

@@ -72,7 +72,7 @@ fun Project.setupCommon() {
compileSdkVersion(34)
buildToolsVersion = "34.0.0"
ndkPath = "$sdkDirectory/ndk/magisk"
ndkVersion = "27.0.11902837"
ndkVersion = "27.0.12077973"
defaultConfig {
minSdk = 23
@@ -121,18 +121,20 @@ const val BUSYBOX_ZIP_CHECKSUM =
fun Project.setupCoreLib() {
setupCommon()
val abiList = Config.abiList
val syncLibs by tasks.registering(Sync::class) {
into("src/main/jniLibs")
for (abi in arrayOf("armeabi-v7a", "x86", "arm64-v8a", "x86_64", "riscv64")) {
for (abi in abiList) {
into(abi) {
from(rootProject.file("native/out/$abi")) {
include("magiskboot", "magiskinit", "magiskpolicy", "magisk")
rename { "lib$it.so" }
include("magiskboot", "magiskinit", "magiskpolicy", "magisk", "libinit-ld.so")
rename { if (it.endsWith(".so")) it else "lib$it.so" }
}
}
}
onlyIf {
if (inputs.sourceFiles.files.size != 20)
if (inputs.sourceFiles.files.size != abiList.size * 5)
throw StopExecutionException("Please build binaries first! (./build.py binary)")
true
}
@@ -158,6 +160,7 @@ fun Project.setupCoreLib() {
}
}
from(zipTree(bb))
include(abiList.map { "$it/libbusybox.so" })
into("src/main/jniLibs")
}

View File

@@ -9,6 +9,10 @@ version=string
# Output path. Default: out
outdir=string
# List of ABIs to build, separated with ','
# Default: armeabi-v7a,x86,arm64-v8a,x86_64
abiList=[string]
#####################################################
# Signing configs for signing zips and APKs
# These 4 variables has to be either all set or not

View File

@@ -20,6 +20,9 @@ org.gradle.parallel=true
# Enable build cache
org.gradle.caching=true
# Use K2 in kapt
kapt.use.k2=true
# Android
android.useAndroidX=true
android.injected.testOnly=false
@@ -27,5 +30,5 @@ android.nonFinalResIds=false
# Magisk
magisk.stubVersion=40
magisk.versionCode=27005
magisk.ondkVersion=r27.2
magisk.versionCode=27007
magisk.ondkVersion=r27.4

65
gradle/libs.versions.toml Normal file
View File

@@ -0,0 +1,65 @@
[versions]
kotlin = "2.0.10"
android = "8.5.2"
ksp = "2.0.10-1.0.24"
rikka = "1.3.0"
navigation = "2.7.7"
libsu = "6.0.0"
moshi = "1.15.1"
okhttp = "4.12.0"
retrofit = "2.11.0"
room = "2.6.1"
[libraries]
bcpkix = { module = "org.bouncycastle:bcpkix-jdk18on", version = "1.78.1" }
commons-compress = { module = "org.apache.commons:commons-compress", version = "1.27.0" }
retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" }
retrofit-moshi = { module = "com.squareup.retrofit2:converter-moshi", version.ref = "retrofit" }
retrofit-scalars = { module = "com.squareup.retrofit2:converter-scalars", version.ref = "retrofit" }
markwon-core = { module = "io.noties.markwon:core", version = "4.6.2" }
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
okhttp-dnsoverhttps = { module = "com.squareup.okhttp3:okhttp-dnsoverhttps", version.ref = "okhttp" }
okhttp-logging = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "okhttp" }
moshi = { module = "com.squareup.moshi:moshi", version.ref = "moshi" }
moshi-codegen = { module = "com.squareup.moshi:moshi-kotlin-codegen", version.ref = "moshi" }
timber = { module = "com.jakewharton.timber:timber", version = "5.0.1" }
jgit = { module = "org.eclipse.jgit:org.eclipse.jgit", version = "6.10.0.202406032230-r" }
# AndroidX
activity = { module = "androidx.activity:activity", version = "1.9.1" }
appcompat = { module = "androidx.appcompat:appcompat", version = "1.7.0" }
core-ktx = { module = "androidx.core:core-ktx", version = "1.13.1" }
core-splashscreen = { module = "androidx.core:core-splashscreen", version = "1.0.1" }
constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version = "2.1.4" }
fragment-ktx = { module = "androidx.fragment:fragment-ktx", version = "1.8.2" }
navigation-fragment-ktx = { module = "androidx.navigation:navigation-fragment-ktx", version.ref = "navigation" }
navigation-ui-ktx = { module = "androidx.navigation:navigation-ui-ktx", version.ref = "navigation" }
profileinstaller = { module = "androidx.profileinstaller:profileinstaller", version = "1.3.1" }
recyclerview = { module = "androidx.recyclerview:recyclerview", version = "1.3.2" }
room-ktx = { module = "androidx.room:room-ktx", version.ref = "room" }
room-runtime = { module = "androidx.room:room-runtime", version.ref = "room" }
room-compiler = { module = "androidx.room:room-compiler", version.ref = "room" }
swiperefreshlayout = { module = "androidx.swiperefreshlayout:swiperefreshlayout", version = "1.1.0" }
transition = { module = "androidx.transition:transition", version = "1.5.1" }
collection-ktx = { module = "androidx.collection:collection-ktx", version = "1.4.3" }
lifecycle-process = { module = "androidx.lifecycle:lifecycle-process", version = "2.8.4" }
material = { module = "com.google.android.material:material", version = "1.12.0" }
# topjohnwu
indeterminate-checkbox = { module = "com.github.topjohnwu:indeterminate-checkbox", version = "1.0.7" }
libsu-core = { module = "com.github.topjohnwu.libsu:core", version.ref = "libsu" }
libsu-service = { module = "com.github.topjohnwu.libsu:service", version.ref = "libsu" }
libsu-nio = { module = "com.github.topjohnwu.libsu:nio", version.ref = "libsu" }
# Rikka
rikka-recyclerview = { module = "dev.rikka.rikkax.recyclerview:recyclerview-ktx", version = "1.3.2" }
rikka-layoutinflater = { module = "dev.rikka.rikkax.layoutinflater:layoutinflater", version.ref = "rikka" }
rikka-insets = { module = "dev.rikka.rikkax.insets:insets", version.ref = "rikka" }
# Build plugins
android-gradle-plugin = { module = "com.android.tools.build:gradle", version.ref = "android" }
ksp-plugin = { module = "com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin", version.ref = "ksp" }
navigation-safe-args-plugin = { module = "androidx.navigation:navigation-safe-args-gradle-plugin", version.ref = "navigation" }
lsparanoid-plugin = { module = "org.lsposed.lsparanoid:gradle-plugin", version = "0.6.0" }
[plugins]

View File

@@ -1,7 +1,10 @@
[build]
# Choose arm64 as the default target to make the IDE happy.
# Set arm64 as the default target
# The actual compilation will have the target overriden by command-line.
target = "aarch64-linux-android"
# Enable cross language LTO, and explicitly set dwarf-version for ThinLTO
rustflags = ["-Z", "dwarf-version=4", "-C", "linker-plugin-lto"]
target-dir = "../out/rust"
[unstable]
build-std = ["std", "panic_abort"]

View File

@@ -1,2 +0,0 @@
test.cpp
target/

View File

@@ -1,7 +1,5 @@
APP_BUILD_SCRIPT := src/Android.mk
APP_ABI := armeabi-v7a arm64-v8a x86 x86_64 riscv64
APP_CFLAGS := -Wall -Oz -fomit-frame-pointer -flto
APP_LDFLAGS := -flto -Wl,--icf=all
APP_CFLAGS := -Wall -Oz -fomit-frame-pointer
APP_CPPFLAGS := -std=c++23
APP_STL := none
APP_PLATFORM := android-23
@@ -9,11 +7,25 @@ APP_THIN_ARCHIVE := true
APP_STRIP_MODE := none
APP_SUPPORT_FLEXIBLE_PAGE_SIZES := true
ifdef MAGISK_DEBUG
NDK_APP_OUT := ./obj/debug
APP_CFLAGS += -flto=thin -gdwarf-4
APP_LDFLAGS += -flto=thin
else
NDK_APP_OUT := ./obj/release
APP_CFLAGS += -flto
APP_LDFLAGS += -flto -Wl,--icf=all
endif
ifdef B_CRT0
# Disable all security and debugging features
APP_CFLAGS += -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-stack-protector -U_FORTIFY_SOURCE
APP_CFLAGS += -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-stack-protector -fno-threadsafe-statics -U_FORTIFY_SOURCE
# Override output folder to make sure all dependencies are rebuilt with new CFLAGS
NDK_APP_OUT := ./obj/nolibc
NDK_APP_OUT := $(NDK_APP_OUT)-nolibc
endif

340
native/src/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -13,16 +13,16 @@ num-derive = "0.4"
thiserror = "1.0"
byteorder = "1"
size = "0.4"
sha1 = "0.11.0-pre.3"
sha2 = "=0.11.0-pre.3"
digest = "0.11.0-pre.8"
#p256 = "0.14"
#p384 = "0.14"
#p521 = "0.14"
rsa = "0.10.0-pre.1"
sha1 = "0.11.0-pre.4"
sha2 = "=0.11.0-pre.4"
digest = "0.11.0-pre.9"
p256 = "0.14.0-pre.1"
p384 = "0.14.0-pre.1"
p521 = "0.14.0-pre.1"
rsa = "0.10.0-pre.2"
#x509-cert = "0.3"
der = "0.8.0-pre.0"
bytemuck = "1.14"
der = "0.8.0-rc.0"
bytemuck = "1.16"
fdt = "0.1"
const_format = "0.2"
@@ -40,29 +40,17 @@ default-features = false
git = "https://github.com/tafia/quick-protobuf.git"
rev = "2f37d5a65504de7d716b5b28fd82219501a901a9"
[workspace.dependencies.p256]
git = "https://github.com/RustCrypto/elliptic-curves.git"
rev = "5d1c252c2defb5808f55329f3e2955ca72d7f8b5"
[workspace.dependencies.p384]
git = "https://github.com/RustCrypto/elliptic-curves.git"
rev = "5d1c252c2defb5808f55329f3e2955ca72d7f8b5"
[workspace.dependencies.p521]
git = "https://github.com/RustCrypto/elliptic-curves.git"
rev = "5d1c252c2defb5808f55329f3e2955ca72d7f8b5"
[workspace.dependencies.x509-cert]
git = "https://github.com/RustCrypto/formats.git"
rev = "809df65b20d61e88afb7f514b5cfdd3d1958a40f"
rev = "9c0e851c6db9c2c8a2601840d46375afde2663fb"
[profile.dev]
opt-level = "z"
lto = true
lto = "thin"
panic = "abort"
[profile.release]
opt-level = "z"
lto = true
lto = "fat"
codegen-units = 1
panic = "abort"

View File

@@ -7,7 +7,7 @@ LOCAL_MODULE := libbase
LOCAL_C_INCLUDES := \
src/include \
$(LOCAL_PATH)/include \
$(LOCAL_PATH)/../external/cxx-rs/include \
src/external/cxx-rs/include \
out/generated
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)
LOCAL_EXPORT_STATIC_LIBRARIES := libcxx

Some files were not shown because too many files have changed in this diff Show More