mirror of
https://github.com/topjohnwu/Magisk
synced 2025-11-17 13:53:26 +01:00
Compare commits
51 Commits
canary-270
...
canary-270
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e82113bce | ||
|
|
f723ef153b | ||
|
|
1dc723fb6d | ||
|
|
8f271c2575 | ||
|
|
7cf56b4406 | ||
|
|
c2eb603957 | ||
|
|
e6bd2ff60f | ||
|
|
5604074eba | ||
|
|
3f061c1a1e | ||
|
|
55e78a7b1a | ||
|
|
000f1d6041 | ||
|
|
2cbec20238 | ||
|
|
4b724c7257 | ||
|
|
ab04c6ab39 | ||
|
|
821a6c6954 | ||
|
|
5f27a62221 | ||
|
|
c76cc4c6bd | ||
|
|
52b75c53b6 | ||
|
|
9db2e99086 | ||
|
|
e9e2ecf2dd | ||
|
|
9a9e617c35 | ||
|
|
3a0becc783 | ||
|
|
1f974cb220 | ||
|
|
1db80228e8 | ||
|
|
838e1e254d | ||
|
|
554eda8fe1 | ||
|
|
2bdc047c4d | ||
|
|
e64f59ce5b | ||
|
|
b8140ad4e6 | ||
|
|
5a55483698 | ||
|
|
2d341863f5 | ||
|
|
278046becb | ||
|
|
5c0497354f | ||
|
|
98c258df93 | ||
|
|
c578cccfd5 | ||
|
|
07835a3e0e | ||
|
|
09131aca89 | ||
|
|
9ce998a6df | ||
|
|
ca36b42d79 | ||
|
|
37df39ec37 | ||
|
|
1701361a73 | ||
|
|
4c14ae33f5 | ||
|
|
d4a9ef7b7f | ||
|
|
1539cfe888 | ||
|
|
9093be1329 | ||
|
|
606d076251 | ||
|
|
46a34e19bc | ||
|
|
5ac7dc0b37 | ||
|
|
3b27de3715 | ||
|
|
939bfac920 | ||
|
|
f601bf12d5 |
90
.github/actions/setup/action.yml
vendored
90
.github/actions/setup/action.yml
vendored
@@ -1,4 +1,8 @@
|
|||||||
name: Magisk Setup
|
name: Magisk Setup
|
||||||
|
inputs:
|
||||||
|
is-asset-build:
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
@@ -13,32 +17,84 @@ runs:
|
|||||||
with:
|
with:
|
||||||
python-version: "3.x"
|
python-version: "3.x"
|
||||||
|
|
||||||
- name: Set up sccache
|
- name: Install GNU make
|
||||||
uses: hendrikmuhs/ccache-action@v1.2
|
if: runner.os == 'macOS'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
brew install make
|
||||||
|
echo 'GNUMAKE=gmake' >> "$GITHUB_ENV"
|
||||||
|
|
||||||
|
- name: Cache sccache
|
||||||
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
variant: sccache
|
path: .sccache
|
||||||
key: ${{ runner.os }}-${{ github.sha }}
|
key: sccache-${{ runner.os }}-${{ github.sha }}
|
||||||
restore-keys: ${{ runner.os }}
|
restore-keys: sccache-${{ runner.os }}-
|
||||||
max-size: 10000M
|
|
||||||
|
- 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
|
- name: Cache Gradle dependencies
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
|
if: inputs.is-asset-build == 'true'
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.gradle/caches
|
.gradle/caches
|
||||||
~/.gradle/wrapper
|
.gradle/wrapper
|
||||||
!~/.gradle/caches/build-cache-*
|
!.gradle/caches/build-cache-*
|
||||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
|
key: gradle-cache-${{ hashFiles('gradle/**') }}
|
||||||
restore-keys: ${{ runner.os }}-gradle-
|
restore-keys: gradle-cache-
|
||||||
|
|
||||||
- name: Cache build cache
|
- name: Restore Gradle dependencies
|
||||||
uses: actions/cache@v4
|
uses: actions/cache/restore@v4
|
||||||
|
if: inputs.is-asset-build == 'false'
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.gradle/caches/build-cache-*
|
.gradle/caches
|
||||||
key: ${{ runner.os }}-build-cache-${{ github.sha }}
|
.gradle/wrapper
|
||||||
restore-keys: ${{ runner.os }}-build-cache-
|
!.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
|
- name: Set up NDK
|
||||||
run: python build.py -v ndk
|
|
||||||
shell: bash
|
shell: bash
|
||||||
|
run: python build.py -v ndk
|
||||||
|
|||||||
25
.github/actions/setup/sccache.sh
vendored
Executable file
25
.github/actions/setup/sccache.sh
vendored
Executable 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
1
.github/ci.prop
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
abiList=arm64-v8a
|
||||||
54
.github/workflows/build.yml
vendored
54
.github/workflows/build.yml
vendored
@@ -17,9 +17,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build Magisk artifacts
|
name: Build Magisk artifacts
|
||||||
runs-on: ubuntu-latest
|
runs-on: macos-14
|
||||||
env:
|
|
||||||
SCCACHE_DIRECT: false
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
steps:
|
steps:
|
||||||
@@ -27,10 +25,11 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: "recursive"
|
submodules: "recursive"
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Setup environment
|
- name: Setup environment
|
||||||
uses: ./.github/actions/setup
|
uses: ./.github/actions/setup
|
||||||
|
with:
|
||||||
|
is-asset-build: true
|
||||||
|
|
||||||
- name: Build release
|
- name: Build release
|
||||||
run: ./build.py -vr all
|
run: ./build.py -vr all
|
||||||
@@ -58,24 +57,21 @@ jobs:
|
|||||||
test-build:
|
test-build:
|
||||||
name: Test building on ${{ matrix.os }}
|
name: Test building on ${{ matrix.os }}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
env:
|
|
||||||
SCCACHE_DIRECT: false
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [windows-latest, macos-14]
|
os: [windows-latest, ubuntu-latest]
|
||||||
steps:
|
steps:
|
||||||
- name: Check out
|
- name: Check out
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: "recursive"
|
submodules: "recursive"
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Setup environment
|
- name: Setup environment
|
||||||
uses: ./.github/actions/setup
|
uses: ./.github/actions/setup
|
||||||
|
|
||||||
- name: Build debug
|
- name: Test build
|
||||||
run: python build.py -v all
|
run: python build.py -v -c .github/ci.prop all
|
||||||
|
|
||||||
- name: Stop gradle daemon
|
- name: Stop gradle daemon
|
||||||
run: ./gradlew --stop
|
run: ./gradlew --stop
|
||||||
@@ -96,8 +92,6 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Check out
|
- name: Check out
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Download build artifacts
|
- name: Download build artifacts
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
@@ -114,9 +108,18 @@ jobs:
|
|||||||
- name: Run AVD test
|
- name: Run AVD test
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
env:
|
env:
|
||||||
AVD_TEST_VERBOSE: 1
|
AVD_TEST_LOG: 1
|
||||||
run: scripts/avd_test.sh ${{ matrix.version }} ${{ matrix.type }}
|
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:
|
avd-test-32:
|
||||||
name: Test API ${{ matrix.version }} (x86)
|
name: Test API ${{ matrix.version }} (x86)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -129,8 +132,6 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Check out
|
- name: Check out
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Download build artifacts
|
- name: Download build artifacts
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
@@ -148,11 +149,20 @@ jobs:
|
|||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
env:
|
env:
|
||||||
FORCE_32_BIT: 1
|
FORCE_32_BIT: 1
|
||||||
AVD_TEST_VERBOSE: 1
|
AVD_TEST_LOG: 1
|
||||||
run: scripts/avd_test.sh ${{ matrix.version }}
|
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:
|
cf_test:
|
||||||
name: Test ${{ matrix.branch }} (${{ matrix.target }})
|
name: Test ${{ matrix.device }}
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
needs: build
|
needs: build
|
||||||
env:
|
env:
|
||||||
@@ -162,13 +172,13 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- branch: "aosp-main"
|
- 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:
|
steps:
|
||||||
- name: Check out
|
- name: Check out
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Download build artifacts
|
- name: Download build artifacts
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
@@ -179,7 +189,7 @@ jobs:
|
|||||||
- name: Setup Cuttlefish environment
|
- name: Setup Cuttlefish environment
|
||||||
run: |
|
run: |
|
||||||
scripts/cuttlefish.sh setup
|
scripts/cuttlefish.sh setup
|
||||||
scripts/cuttlefish.sh download ${{ matrix.branch }} ${{ matrix.target }}
|
scripts/cuttlefish.sh download ${{ matrix.branch }} ${{ matrix.device }}
|
||||||
|
|
||||||
- name: Run Cuttlefish test
|
- name: Run Cuttlefish test
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
@@ -189,7 +199,7 @@ jobs:
|
|||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: "cvd-logs"
|
name: "cvd-logs-${{ matrix.device }}"
|
||||||
path: |
|
path: |
|
||||||
/home/runner/aosp_cf_phone/cuttlefish/instances/cvd-1/logs
|
/home/runner/aosp_cf_phone/cuttlefish/instances/cvd-1/logs
|
||||||
/home/runner/aosp_cf_phone/cuttlefish/instances/cvd-1/cuttlefish_config.json
|
/home/runner/aosp_cf_phone/cuttlefish/instances/cvd-1/cuttlefish_config.json
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -13,7 +13,7 @@ native/out
|
|||||||
# Android Studio / Gradle
|
# Android Studio / Gradle
|
||||||
*.iml
|
*.iml
|
||||||
.gradle
|
.gradle
|
||||||
|
.idea
|
||||||
/local.properties
|
/local.properties
|
||||||
/.idea
|
|
||||||
/build
|
/build
|
||||||
/captures
|
/captures
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ Click the icon below to download Magisk apk.
|
|||||||
|
|
||||||
[](https://github.com/topjohnwu/Magisk/releases/tag/v27.0)
|
[](https://github.com/topjohnwu/Magisk/releases/tag/v27.0)
|
||||||
[](https://github.com/topjohnwu/Magisk/releases/tag/v27.0)
|
[](https://github.com/topjohnwu/Magisk/releases/tag/v27.0)
|
||||||
[](https://github.com/topjohnwu/Magisk/releases/tag/canary-27006)
|
[](https://github.com/topjohnwu/Magisk/releases/tag/canary-27007)
|
||||||
|
|
||||||
## Useful Links
|
## Useful Links
|
||||||
|
|
||||||
|
|||||||
@@ -47,22 +47,21 @@ android {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation(project(":app:core"))
|
implementation(project(":app:core"))
|
||||||
|
|
||||||
implementation("com.github.topjohnwu:indeterminate-checkbox:1.0.7")
|
implementation(libs.indeterminate.checkbox)
|
||||||
implementation("dev.rikka.rikkax.layoutinflater:layoutinflater:1.3.0")
|
implementation(libs.rikka.layoutinflater)
|
||||||
implementation("dev.rikka.rikkax.insets:insets:1.3.0")
|
implementation(libs.rikka.insets)
|
||||||
implementation("dev.rikka.rikkax.recyclerview:recyclerview-ktx:1.3.2")
|
implementation(libs.rikka.recyclerview)
|
||||||
|
|
||||||
val vNav = "2.7.7"
|
implementation(libs.navigation.fragment.ktx)
|
||||||
implementation("androidx.navigation:navigation-fragment-ktx:${vNav}")
|
implementation(libs.navigation.ui.ktx)
|
||||||
implementation("androidx.navigation:navigation-ui-ktx:${vNav}")
|
|
||||||
|
|
||||||
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
|
implementation(libs.constraintlayout)
|
||||||
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
|
implementation(libs.swiperefreshlayout)
|
||||||
implementation("androidx.recyclerview:recyclerview:1.3.2")
|
implementation(libs.recyclerview)
|
||||||
implementation("androidx.transition:transition:1.5.1")
|
implementation(libs.transition)
|
||||||
implementation("androidx.fragment:fragment-ktx:1.8.2")
|
implementation(libs.fragment.ktx)
|
||||||
implementation("androidx.appcompat:appcompat:1.7.0")
|
implementation(libs.appcompat)
|
||||||
implementation("com.google.android.material:material:1.12.0")
|
implementation(libs.material)
|
||||||
|
|
||||||
// Make sure kapt runs with a proper kotlin-stdlib
|
// Make sure kapt runs with a proper kotlin-stdlib
|
||||||
kapt(kotlin("stdlib"))
|
kapt(kotlin("stdlib"))
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.topjohnwu.magisk.dialog
|
package com.topjohnwu.magisk.dialog
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import com.topjohnwu.magisk.core.R
|
import com.topjohnwu.magisk.core.R
|
||||||
import com.topjohnwu.magisk.core.di.ServiceLocator
|
import com.topjohnwu.magisk.core.di.ServiceLocator
|
||||||
import com.topjohnwu.magisk.core.download.DownloadEngine
|
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.core.model.module.OnlineModule
|
||||||
import com.topjohnwu.magisk.ui.flash.FlashFragment
|
import com.topjohnwu.magisk.ui.flash.FlashFragment
|
||||||
import com.topjohnwu.magisk.view.MagiskDialog
|
import com.topjohnwu.magisk.view.MagiskDialog
|
||||||
|
import com.topjohnwu.magisk.view.Notifications
|
||||||
|
import kotlinx.parcelize.Parcelize
|
||||||
|
|
||||||
class OnlineModuleInstallDialog(private val item: OnlineModule) : MarkDownDialog() {
|
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
|
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) {
|
override fun build(dialog: MagiskDialog) {
|
||||||
super.build(dialog)
|
super.build(dialog)
|
||||||
dialog.apply {
|
dialog.apply {
|
||||||
|
|
||||||
fun download(install: Boolean) {
|
fun download(install: Boolean) {
|
||||||
val module = Subject.Module(item, install)
|
DownloadEngine.startWithActivity(activity, Module(item, install))
|
||||||
module.piCreator = FlashFragment::installIntent
|
|
||||||
DownloadEngine.startWithActivity(activity, module)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val title = context.getString(R.string.repo_install_title,
|
val title = context.getString(R.string.repo_install_title,
|
||||||
|
|||||||
@@ -30,39 +30,34 @@ android {
|
|||||||
dependencies {
|
dependencies {
|
||||||
api(project(":app:shared"))
|
api(project(":app:shared"))
|
||||||
|
|
||||||
api("com.jakewharton.timber:timber:5.0.1")
|
api(libs.timber)
|
||||||
api("io.noties.markwon:core:4.6.2")
|
api(libs.markwon.core)
|
||||||
implementation("org.bouncycastle:bcpkix-jdk18on:1.78.1")
|
implementation(libs.bcpkix)
|
||||||
implementation("org.apache.commons:commons-compress:1.26.2")
|
implementation(libs.commons.compress)
|
||||||
|
|
||||||
val vLibsu = "6.0.0"
|
api(libs.libsu.core)
|
||||||
api("com.github.topjohnwu.libsu:core:${vLibsu}")
|
api(libs.libsu.service)
|
||||||
api("com.github.topjohnwu.libsu:service:${vLibsu}")
|
api(libs.libsu.nio)
|
||||||
api("com.github.topjohnwu.libsu:nio:${vLibsu}")
|
|
||||||
|
|
||||||
val vRetrofit = "2.11.0"
|
implementation(libs.retrofit)
|
||||||
implementation("com.squareup.retrofit2:retrofit:${vRetrofit}")
|
implementation(libs.retrofit.moshi)
|
||||||
implementation("com.squareup.retrofit2:converter-moshi:${vRetrofit}")
|
implementation(libs.retrofit.scalars)
|
||||||
implementation("com.squareup.retrofit2:converter-scalars:${vRetrofit}")
|
|
||||||
|
|
||||||
val vOkHttp = "4.12.0"
|
implementation(libs.okhttp)
|
||||||
implementation("com.squareup.okhttp3:okhttp:${vOkHttp}")
|
implementation(libs.okhttp.logging)
|
||||||
implementation("com.squareup.okhttp3:logging-interceptor:${vOkHttp}")
|
implementation(libs.okhttp.dnsoverhttps)
|
||||||
implementation("com.squareup.okhttp3:okhttp-dnsoverhttps:${vOkHttp}")
|
|
||||||
|
|
||||||
val vMoshi = "1.15.1"
|
implementation(libs.moshi)
|
||||||
implementation("com.squareup.moshi:moshi:${vMoshi}")
|
ksp(libs.moshi.codegen)
|
||||||
ksp("com.squareup.moshi:moshi-kotlin-codegen:${vMoshi}")
|
|
||||||
|
|
||||||
val vRoom = "2.6.1"
|
implementation(libs.room.runtime)
|
||||||
implementation("androidx.room:room-runtime:${vRoom}")
|
implementation(libs.room.ktx)
|
||||||
implementation("androidx.room:room-ktx:${vRoom}")
|
ksp(libs.room.compiler)
|
||||||
ksp("androidx.room:room-compiler:${vRoom}")
|
|
||||||
|
|
||||||
implementation("androidx.core:core-splashscreen:1.0.1")
|
implementation(libs.core.splashscreen)
|
||||||
implementation("androidx.core:core-ktx:1.13.1")
|
implementation(libs.core.ktx)
|
||||||
implementation("androidx.activity:activity:1.9.1")
|
implementation(libs.activity)
|
||||||
implementation("androidx.collection:collection-ktx:1.4.2")
|
implementation(libs.collection.ktx)
|
||||||
implementation("androidx.profileinstaller:profileinstaller:1.3.1")
|
implementation(libs.profileinstaller)
|
||||||
implementation("androidx.lifecycle:lifecycle-process:2.8.4")
|
implementation(libs.lifecycle.process)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import kotlinx.parcelize.Parcelize
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
|
||||||
sealed class Subject : Parcelable {
|
abstract class Subject : Parcelable {
|
||||||
|
|
||||||
abstract val url: String
|
abstract val url: String
|
||||||
abstract val file: Uri
|
abstract val file: Uri
|
||||||
@@ -27,24 +27,13 @@ sealed class Subject : Parcelable {
|
|||||||
|
|
||||||
open fun pendingIntent(context: Context): PendingIntent? = null
|
open fun pendingIntent(context: Context): PendingIntent? = null
|
||||||
|
|
||||||
@Parcelize
|
abstract class Module : Subject() {
|
||||||
class Module(
|
abstract val module: OnlineModule
|
||||||
private val module: OnlineModule,
|
final override val url: String get() = module.zipUrl
|
||||||
override val autoLaunch: Boolean,
|
final override val title: String get() = module.downloadFilename
|
||||||
override val notifyId: Int = Notifications.nextId()
|
final override val file by lazy {
|
||||||
) : Subject() {
|
|
||||||
override val url: String get() = module.zipUrl
|
|
||||||
override val title: String get() = module.downloadFilename
|
|
||||||
|
|
||||||
@IgnoredOnParcel
|
|
||||||
override val file by lazy {
|
|
||||||
MediaStoreUtils.getFile(title).uri
|
MediaStoreUtils.getFile(title).uri
|
||||||
}
|
}
|
||||||
|
|
||||||
@IgnoredOnParcel
|
|
||||||
var piCreator: ((Context, Uri) -> PendingIntent)? = null
|
|
||||||
|
|
||||||
override fun pendingIntent(context: Context) = piCreator?.invoke(context, file)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Parcelize
|
@Parcelize
|
||||||
|
|||||||
@@ -134,12 +134,14 @@ abstract class MagiskInstallImpl protected constructor(
|
|||||||
|
|
||||||
val abi32 = Const.CPU_ABI_32
|
val abi32 = Const.CPU_ABI_32
|
||||||
if (Process.is64Bit() && abi32 != null) {
|
if (Process.is64Bit() && abi32 != null) {
|
||||||
val magisk32 = File(installDir, "magisk32")
|
|
||||||
val entry = zf.getEntry("lib/$abi32/libmagisk.so")
|
val entry = zf.getEntry("lib/$abi32/libmagisk.so")
|
||||||
|
if (entry != null) {
|
||||||
|
val magisk32 = File(installDir, "magisk32")
|
||||||
zf.getInputStream(entry).writeTo(magisk32)
|
zf.getInputStream(entry).writeTo(magisk32)
|
||||||
magisk32.setExecutable(true)
|
magisk32.setExecutable(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
val info = context.applicationInfo
|
val info = context.applicationInfo
|
||||||
val libs = File(info.nativeLibraryDir).listFiles { _, name ->
|
val libs = File(info.nativeLibraryDir).listFiles { _, name ->
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,13 +1,22 @@
|
|||||||
package com.topjohnwu.magisk;
|
package com.topjohnwu.magisk;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.pm.ApplicationInfo;
|
||||||
|
|
||||||
public class ProviderInstaller {
|
public class ProviderInstaller {
|
||||||
|
|
||||||
|
private static final String GMS_PACKAGE_NAME = "com.google.android.gms";
|
||||||
|
|
||||||
public static boolean install(Context context) {
|
public static boolean install(Context context) {
|
||||||
try {
|
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
|
// 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);
|
Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY);
|
||||||
gms.getClassLoader()
|
gms.getClassLoader()
|
||||||
.loadClass("com.google.android.gms.common.security.ProviderInstallerImpl")
|
.loadClass("com.google.android.gms.common.security.ProviderInstallerImpl")
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<string name="upgrade_msg">عليك الترقية ماجـيسك Manager لإكمال تهيئة التطبيق.هل اكمل؟</string>
|
<string name="upgrade_msg">عليك الترقية Magisk لإكمال تهيئة التطبيق. هل تريد التنزيل والتثبيت؟</string>
|
||||||
<string name="no_internet_msg">يرجى الاتصال بالانترنيت! ترقية ماجـيسك مطلوب...</string>
|
<string name="no_internet_msg">يرجى اللإتصال بالإنترنت! ترقية Magisk مطلوبة.</string>
|
||||||
<string name="dling">جارٍ التنزيل</string>
|
<string name="dling">جارٍ التنزيل</string>
|
||||||
|
<string name="relaunch_app">يرجى إعادة تشغيل التطبيق يدوياً</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -25,10 +25,10 @@ tasks.withType<KotlinCompile>().configureEach {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("gradle-plugin", "2.0.0"))
|
implementation(kotlin("gradle-plugin", libs.versions.kotlin.get()))
|
||||||
implementation("com.android.tools.build:gradle:8.5.1")
|
implementation(libs.android.gradle.plugin)
|
||||||
implementation("com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:2.0.0-1.0.23")
|
implementation(libs.ksp.plugin)
|
||||||
implementation("androidx.navigation:navigation-safe-args-gradle-plugin:2.7.7")
|
implementation(libs.navigation.safe.args.plugin)
|
||||||
implementation("org.lsposed.lsparanoid:gradle-plugin:0.6.0")
|
implementation(libs.lsparanoid.plugin)
|
||||||
implementation("org.eclipse.jgit:org.eclipse.jgit:6.10.0.202406032230-r")
|
implementation(libs.jgit)
|
||||||
}
|
}
|
||||||
|
|||||||
7
buildSrc/settings.gradle.kts
Normal file
7
buildSrc/settings.gradle.kts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
dependencyResolutionManagement {
|
||||||
|
versionCatalogs {
|
||||||
|
create("libs") {
|
||||||
|
from(files("../gradle/libs.versions.toml"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,6 +8,8 @@ import java.util.Properties
|
|||||||
|
|
||||||
private val props = Properties()
|
private val props = Properties()
|
||||||
private var commitHash = ""
|
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 {
|
object Config {
|
||||||
operator fun get(key: String): String? {
|
operator fun get(key: String): String? {
|
||||||
@@ -20,6 +22,10 @@ object Config {
|
|||||||
val version: String get() = get("version") ?: commitHash
|
val version: String get() = get("version") ?: commitHash
|
||||||
val versionCode: Int get() = get("magisk.versionCode")!!.toInt()
|
val versionCode: Int get() = get("magisk.versionCode")!!.toInt()
|
||||||
val stubVersion: String get() = get("magisk.stubVersion")!!
|
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> {
|
class MagiskPlugin : Plugin<Project> {
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ fun Project.setupCommon() {
|
|||||||
compileSdkVersion(34)
|
compileSdkVersion(34)
|
||||||
buildToolsVersion = "34.0.0"
|
buildToolsVersion = "34.0.0"
|
||||||
ndkPath = "$sdkDirectory/ndk/magisk"
|
ndkPath = "$sdkDirectory/ndk/magisk"
|
||||||
ndkVersion = "27.0.11902837"
|
ndkVersion = "27.0.12077973"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdk = 23
|
minSdk = 23
|
||||||
@@ -121,9 +121,11 @@ const val BUSYBOX_ZIP_CHECKSUM =
|
|||||||
fun Project.setupCoreLib() {
|
fun Project.setupCoreLib() {
|
||||||
setupCommon()
|
setupCommon()
|
||||||
|
|
||||||
|
val abiList = Config.abiList
|
||||||
|
|
||||||
val syncLibs by tasks.registering(Sync::class) {
|
val syncLibs by tasks.registering(Sync::class) {
|
||||||
into("src/main/jniLibs")
|
into("src/main/jniLibs")
|
||||||
for (abi in arrayOf("armeabi-v7a", "x86", "arm64-v8a", "x86_64", "riscv64")) {
|
for (abi in abiList) {
|
||||||
into(abi) {
|
into(abi) {
|
||||||
from(rootProject.file("native/out/$abi")) {
|
from(rootProject.file("native/out/$abi")) {
|
||||||
include("magiskboot", "magiskinit", "magiskpolicy", "magisk", "libinit-ld.so")
|
include("magiskboot", "magiskinit", "magiskpolicy", "magisk", "libinit-ld.so")
|
||||||
@@ -132,7 +134,7 @@ fun Project.setupCoreLib() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
onlyIf {
|
onlyIf {
|
||||||
if (inputs.sourceFiles.files.size != 25)
|
if (inputs.sourceFiles.files.size != abiList.size * 5)
|
||||||
throw StopExecutionException("Please build binaries first! (./build.py binary)")
|
throw StopExecutionException("Please build binaries first! (./build.py binary)")
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
@@ -158,6 +160,7 @@ fun Project.setupCoreLib() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
from(zipTree(bb))
|
from(zipTree(bb))
|
||||||
|
include(abiList.map { "$it/libbusybox.so" })
|
||||||
into("src/main/jniLibs")
|
into("src/main/jniLibs")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,10 @@ version=string
|
|||||||
# Output path. Default: out
|
# Output path. Default: out
|
||||||
outdir=string
|
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
|
# Signing configs for signing zips and APKs
|
||||||
# These 4 variables has to be either all set or not
|
# These 4 variables has to be either all set or not
|
||||||
|
|||||||
@@ -30,5 +30,5 @@ android.nonFinalResIds=false
|
|||||||
|
|
||||||
# Magisk
|
# Magisk
|
||||||
magisk.stubVersion=40
|
magisk.stubVersion=40
|
||||||
magisk.versionCode=27006
|
magisk.versionCode=27007
|
||||||
magisk.ondkVersion=r27.2
|
magisk.ondkVersion=r27.4
|
||||||
|
|||||||
65
gradle/libs.versions.toml
Normal file
65
gradle/libs.versions.toml
Normal 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]
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
[build]
|
[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.
|
# The actual compilation will have the target overriden by command-line.
|
||||||
target = "aarch64-linux-android"
|
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]
|
[unstable]
|
||||||
build-std = ["std", "panic_abort"]
|
build-std = ["std", "panic_abort"]
|
||||||
|
|||||||
2
native/src/.gitignore
vendored
2
native/src/.gitignore
vendored
@@ -1,2 +0,0 @@
|
|||||||
test.cpp
|
|
||||||
target/
|
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
APP_BUILD_SCRIPT := src/Android.mk
|
APP_BUILD_SCRIPT := src/Android.mk
|
||||||
APP_ABI := armeabi-v7a arm64-v8a x86 x86_64 riscv64
|
APP_CFLAGS := -Wall -Oz -fomit-frame-pointer
|
||||||
APP_CFLAGS := -Wall -Oz -fomit-frame-pointer -flto
|
|
||||||
APP_LDFLAGS := -flto -Wl,--icf=all
|
|
||||||
APP_CPPFLAGS := -std=c++23
|
APP_CPPFLAGS := -std=c++23
|
||||||
APP_STL := none
|
APP_STL := none
|
||||||
APP_PLATFORM := android-23
|
APP_PLATFORM := android-23
|
||||||
@@ -9,11 +7,25 @@ APP_THIN_ARCHIVE := true
|
|||||||
APP_STRIP_MODE := none
|
APP_STRIP_MODE := none
|
||||||
APP_SUPPORT_FLEXIBLE_PAGE_SIZES := true
|
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
|
ifdef B_CRT0
|
||||||
|
|
||||||
# Disable all security and debugging features
|
# 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
|
# 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
|
endif
|
||||||
|
|||||||
340
native/src/Cargo.lock
generated
340
native/src/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -13,16 +13,16 @@ num-derive = "0.4"
|
|||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
byteorder = "1"
|
byteorder = "1"
|
||||||
size = "0.4"
|
size = "0.4"
|
||||||
sha1 = "0.11.0-pre.3"
|
sha1 = "0.11.0-pre.4"
|
||||||
sha2 = "=0.11.0-pre.3"
|
sha2 = "=0.11.0-pre.4"
|
||||||
digest = "0.11.0-pre.8"
|
digest = "0.11.0-pre.9"
|
||||||
#p256 = "0.14"
|
p256 = "0.14.0-pre.1"
|
||||||
#p384 = "0.14"
|
p384 = "0.14.0-pre.1"
|
||||||
#p521 = "0.14"
|
p521 = "0.14.0-pre.1"
|
||||||
rsa = "0.10.0-pre.1"
|
rsa = "0.10.0-pre.2"
|
||||||
#x509-cert = "0.3"
|
#x509-cert = "0.3"
|
||||||
der = "0.8.0-pre.0"
|
der = "0.8.0-rc.0"
|
||||||
bytemuck = "1.14"
|
bytemuck = "1.16"
|
||||||
fdt = "0.1"
|
fdt = "0.1"
|
||||||
const_format = "0.2"
|
const_format = "0.2"
|
||||||
|
|
||||||
@@ -40,29 +40,17 @@ default-features = false
|
|||||||
git = "https://github.com/tafia/quick-protobuf.git"
|
git = "https://github.com/tafia/quick-protobuf.git"
|
||||||
rev = "2f37d5a65504de7d716b5b28fd82219501a901a9"
|
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]
|
[workspace.dependencies.x509-cert]
|
||||||
git = "https://github.com/RustCrypto/formats.git"
|
git = "https://github.com/RustCrypto/formats.git"
|
||||||
rev = "809df65b20d61e88afb7f514b5cfdd3d1958a40f"
|
rev = "9c0e851c6db9c2c8a2601840d46375afde2663fb"
|
||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
opt-level = "z"
|
opt-level = "z"
|
||||||
lto = true
|
lto = "thin"
|
||||||
panic = "abort"
|
panic = "abort"
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
opt-level = "z"
|
opt-level = "z"
|
||||||
lto = true
|
lto = "fat"
|
||||||
codegen-units = 1
|
codegen-units = 1
|
||||||
panic = "abort"
|
panic = "abort"
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ impl StringExt for String {
|
|||||||
fn nul_terminate(&mut self) -> &mut [u8] {
|
fn nul_terminate(&mut self) -> &mut [u8] {
|
||||||
self.reserve(1);
|
self.reserve(1);
|
||||||
// SAFETY: the string is reserved to have enough capacity to fit in the null byte
|
// SAFETY: the string is reserved to have enough capacity to fit in the null byte
|
||||||
// SAFETY: the null byte is explicitly added outside of the string's length
|
// SAFETY: the null byte is explicitly added outside the string's length
|
||||||
unsafe {
|
unsafe {
|
||||||
let buf = slice::from_raw_parts_mut(self.as_mut_ptr(), self.len() + 1);
|
let buf = slice::from_raw_parts_mut(self.as_mut_ptr(), self.len() + 1);
|
||||||
*buf.get_unchecked_mut(self.len()) = b'\0';
|
*buf.get_unchecked_mut(self.len()) = b'\0';
|
||||||
@@ -122,7 +122,7 @@ impl StringExt for PathBuf {
|
|||||||
fn nul_terminate(&mut self) -> &mut [u8] {
|
fn nul_terminate(&mut self) -> &mut [u8] {
|
||||||
self.reserve(1);
|
self.reserve(1);
|
||||||
// SAFETY: the PathBuf is reserved to have enough capacity to fit in the null byte
|
// SAFETY: the PathBuf is reserved to have enough capacity to fit in the null byte
|
||||||
// SAFETY: the null byte is explicitly added outside of the PathBuf's length
|
// SAFETY: the null byte is explicitly added outside the PathBuf's length
|
||||||
unsafe {
|
unsafe {
|
||||||
let bytes: &mut [u8] = mem::transmute(self.as_mut_os_str().as_bytes());
|
let bytes: &mut [u8] = mem::transmute(self.as_mut_os_str().as_bytes());
|
||||||
let buf = slice::from_raw_parts_mut(bytes.as_mut_ptr(), bytes.len() + 1);
|
let buf = slice::from_raw_parts_mut(bytes.as_mut_ptr(), bytes.len() + 1);
|
||||||
@@ -314,7 +314,7 @@ impl Utf8CStr {
|
|||||||
CStr::from_bytes_with_nul(buf)?;
|
CStr::from_bytes_with_nul(buf)?;
|
||||||
str::from_utf8(buf)?;
|
str::from_utf8(buf)?;
|
||||||
// Both condition checked
|
// Both condition checked
|
||||||
unsafe { Ok(mem::transmute(buf)) }
|
unsafe { Ok(mem::transmute::<&mut [u8], &mut Utf8CStr>(buf)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_string(s: &mut String) -> &mut Utf8CStr {
|
pub fn from_string(s: &mut String) -> &mut Utf8CStr {
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ use std::io;
|
|||||||
use std::os::fd::{BorrowedFd, OwnedFd, RawFd};
|
use std::os::fd::{BorrowedFd, OwnedFd, RawFd};
|
||||||
|
|
||||||
use cfg_if::cfg_if;
|
use cfg_if::cfg_if;
|
||||||
use cxx::private::c_char;
|
use libc::{c_char, mode_t};
|
||||||
use libc::mode_t;
|
|
||||||
|
|
||||||
|
use crate::files::map_file_at;
|
||||||
pub(crate) use crate::xwrap::*;
|
pub(crate) use crate::xwrap::*;
|
||||||
use crate::{
|
use crate::{
|
||||||
clone_attr, cstr, fclone_attr, fd_path, map_fd, map_file, slice_from_ptr, CxxResultExt,
|
clone_attr, cstr, fclone_attr, fd_path, map_fd, map_file, slice_from_ptr, CxxResultExt,
|
||||||
@@ -61,6 +61,14 @@ pub(crate) fn map_file_for_cxx(path: &Utf8CStr, rw: bool) -> &'static mut [u8] {
|
|||||||
map_file(path, rw).log_cxx().unwrap_or(&mut [])
|
map_file(path, rw).log_cxx().unwrap_or(&mut [])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn map_file_at_for_cxx(fd: RawFd, path: &Utf8CStr, rw: bool) -> &'static mut [u8] {
|
||||||
|
unsafe {
|
||||||
|
map_file_at(BorrowedFd::borrow_raw(fd), path, rw)
|
||||||
|
.log_cxx()
|
||||||
|
.unwrap_or(&mut [])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) fn map_fd_for_cxx(fd: RawFd, sz: usize, rw: bool) -> &'static mut [u8] {
|
pub(crate) fn map_fd_for_cxx(fd: RawFd, sz: usize, rw: bool) -> &'static mut [u8] {
|
||||||
unsafe {
|
unsafe {
|
||||||
map_fd(BorrowedFd::borrow_raw(fd), sz, rw)
|
map_fd(BorrowedFd::borrow_raw(fd), sz, rw)
|
||||||
|
|||||||
@@ -117,6 +117,14 @@ mmap_data::mmap_data(const char *name, bool rw) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mmap_data::mmap_data(int dirfd, const char *name, bool rw) {
|
||||||
|
auto slice = rust::map_file_at(dirfd, name, rw);
|
||||||
|
if (!slice.empty()) {
|
||||||
|
_buf = slice.data();
|
||||||
|
_sz = slice.size();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mmap_data::mmap_data(int fd, size_t sz, bool rw) {
|
mmap_data::mmap_data(int fd, size_t sz, bool rw) {
|
||||||
auto slice = rust::map_fd(fd, sz, rw);
|
auto slice = rust::map_fd(fd, sz, rw);
|
||||||
if (!slice.empty()) {
|
if (!slice.empty()) {
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ struct mmap_data : public byte_data {
|
|||||||
ALLOW_MOVE_ONLY(mmap_data)
|
ALLOW_MOVE_ONLY(mmap_data)
|
||||||
|
|
||||||
explicit mmap_data(const char *name, bool rw = false);
|
explicit mmap_data(const char *name, bool rw = false);
|
||||||
|
mmap_data(int dirfd, const char *name, bool rw = false);
|
||||||
mmap_data(int fd, size_t sz, bool rw = false);
|
mmap_data(int fd, size_t sz, bool rw = false);
|
||||||
~mmap_data();
|
~mmap_data();
|
||||||
};
|
};
|
||||||
@@ -36,11 +37,11 @@ int mkdirs(const char *path, mode_t mode);
|
|||||||
ssize_t canonical_path(const char * __restrict__ path, char * __restrict__ buf, size_t bufsiz);
|
ssize_t canonical_path(const char * __restrict__ path, char * __restrict__ buf, size_t bufsiz);
|
||||||
bool rm_rf(const char *path);
|
bool rm_rf(const char *path);
|
||||||
bool frm_rf(int dirfd);
|
bool frm_rf(int dirfd);
|
||||||
void cp_afc(const char *src, const char *dest);
|
bool cp_afc(const char *src, const char *dest);
|
||||||
void mv_path(const char *src, const char *dest);
|
bool mv_path(const char *src, const char *dest);
|
||||||
void link_path(const char *src, const char *dest);
|
bool link_path(const char *src, const char *dest);
|
||||||
void clone_attr(const char *src, const char *dest);
|
bool clone_attr(const char *src, const char *dest);
|
||||||
void fclone_attr(int src, int dest);
|
bool fclone_attr(int src, int dest);
|
||||||
|
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user