diff --git a/app/.gitignore b/app/.gitignore
index 03090c7b6..796b96d1c 100644
--- a/app/.gitignore
+++ b/app/.gitignore
@@ -1,11 +1 @@
-*.iml
-.gradle
-/local.properties
-.idea/
/build
-*.hprof
-.externalNativeBuild/
-*.apk
-src/*/assets
-src/*/jniLibs
-src/*/resources
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 2806f0e7a..2d6ff0998 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -6,6 +6,8 @@ plugins {
id("androidx.navigation.safeargs.kotlin")
}
+setupAppCommon()
+
kapt {
correctErrorTypes = true
useBuildCache = true
@@ -13,9 +15,6 @@ kapt {
javacOptions {
option("-Xmaxerrs", 1000)
}
- arguments {
- arg("room.incremental", "true")
- }
}
android {
@@ -26,10 +25,6 @@ android {
vectorDrawables.useSupportLibrary = true
versionName = Config.version
versionCode = Config.versionCode
- ndk {
- abiFilters += listOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64", "riscv64")
- debugSymbolLevel = "FULL"
- }
}
buildTypes {
@@ -42,67 +37,16 @@ android {
buildFeatures {
dataBinding = true
- aidl = true
}
-
- packaging {
- resources {
- excludes += "/META-INF/*"
- excludes += "/META-INF/versions/**"
- excludes += "/org/bouncycastle/**"
- excludes += "org/apache/commons/**"
- excludes += "/kotlin/**"
- excludes += "/kotlinx/**"
- excludes += "/okhttp3/**"
- excludes += "/*.txt"
- excludes += "/*.bin"
- excludes += "/*.json"
- }
- }
-}
-
-setupApp()
-
-configurations.all {
- exclude("org.jetbrains.kotlin", "kotlin-stdlib-jdk7")
- exclude("org.jetbrains.kotlin", "kotlin-stdlib-jdk8")
}
dependencies {
- implementation(project(":app:shared"))
+ implementation(project(":app:core"))
implementation("com.github.topjohnwu:indeterminate-checkbox:1.0.7")
- implementation("com.jakewharton.timber:timber:5.0.1")
- implementation("org.bouncycastle:bcpkix-jdk18on:1.78.1")
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("io.noties.markwon:core:4.6.2")
- implementation("org.apache.commons:commons-compress:1.26.2")
-
- val vLibsu = "6.0.0"
- implementation("com.github.topjohnwu.libsu:core:${vLibsu}")
- implementation("com.github.topjohnwu.libsu:service:${vLibsu}")
- implementation("com.github.topjohnwu.libsu:nio:${vLibsu}")
-
- 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}")
-
- 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}")
-
- val vMoshi = "1.15.1"
- implementation("com.squareup.moshi:moshi:${vMoshi}")
- kapt("com.squareup.moshi:moshi-kotlin-codegen:${vMoshi}")
-
- val vRoom = "2.6.1"
- implementation("androidx.room:room-runtime:${vRoom}")
- implementation("androidx.room:room-ktx:${vRoom}")
- kapt("androidx.room:room-compiler:${vRoom}")
val vNav = "2.7.7"
implementation("androidx.navigation:navigation-fragment-ktx:${vNav}")
@@ -110,12 +54,11 @@ dependencies {
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
- implementation("androidx.appcompat:appcompat:1.7.0")
implementation("androidx.recyclerview:recyclerview:1.3.2")
- implementation("androidx.fragment:fragment-ktx:1.8.0")
implementation("androidx.transition:transition:1.5.0")
- implementation("androidx.core:core-ktx:1.13.1")
implementation("androidx.core:core-splashscreen:1.0.1")
- implementation("androidx.profileinstaller:profileinstaller:1.3.1")
- implementation("com.google.android.material:material:1.12.0")
+ implementation("androidx.fragment:fragment-ktx:1.8.1")
+
+ // Make sure kapt runs with a proper kotlin-stdlib
+ kapt(kotlin("stdlib"))
}
diff --git a/app/core/.gitignore b/app/core/.gitignore
new file mode 100644
index 000000000..6caebc6aa
--- /dev/null
+++ b/app/core/.gitignore
@@ -0,0 +1,4 @@
+/build
+src/*/assets
+src/*/jniLibs
+src/*/resources
diff --git a/app/core/build.gradle.kts b/app/core/build.gradle.kts
new file mode 100644
index 000000000..c18a633d7
--- /dev/null
+++ b/app/core/build.gradle.kts
@@ -0,0 +1,73 @@
+plugins {
+ id("com.android.library")
+ kotlin("android")
+ kotlin("plugin.parcelize")
+ id("com.google.devtools.ksp")
+}
+
+setupCoreLib()
+
+ksp {
+ arg("room.generateKotlin", "true")
+}
+
+android {
+ namespace = "com.topjohnwu.magisk.core"
+
+ defaultConfig {
+ vectorDrawables.useSupportLibrary = true
+ buildConfigField("String", "APP_PACKAGE_NAME", "\"com.topjohnwu.magisk\"")
+ buildConfigField("int", "APP_VERSION_CODE", "${Config.versionCode}")
+ buildConfigField("String", "APP_VERSION_NAME", "\"${Config.version}\"")
+ buildConfigField("int", "STUB_VERSION", Config.stubVersion)
+ ndk {
+ abiFilters += listOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64", "riscv64")
+ debugSymbolLevel = "FULL"
+ }
+ }
+
+ buildFeatures {
+ aidl = true
+ buildConfig = true
+ }
+}
+
+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")
+
+ 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}")
+
+ 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}")
+
+ 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}")
+
+ val vMoshi = "1.15.1"
+ implementation("com.squareup.moshi:moshi:${vMoshi}")
+ ksp("com.squareup.moshi:moshi-kotlin-codegen:${vMoshi}")
+
+ val vRoom = "2.6.1"
+ implementation("androidx.room:room-runtime:${vRoom}")
+ implementation("androidx.room:room-ktx:${vRoom}")
+ ksp("androidx.room:room-compiler:${vRoom}")
+
+ api("androidx.appcompat:appcompat:1.7.0")
+ api("com.google.android.material:material:1.12.0")
+ implementation("androidx.core:core-ktx:1.13.1")
+ implementation("androidx.collection:collection-ktx:1.4.0")
+ implementation("androidx.profileinstaller:profileinstaller:1.3.1")
+ implementation("androidx.lifecycle:lifecycle-process:2.8.3")
+}
diff --git a/app/core/src/main/AndroidManifest.xml b/app/core/src/main/AndroidManifest.xml
new file mode 100644
index 000000000..fdcaa874b
--- /dev/null
+++ b/app/core/src/main/AndroidManifest.xml
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/aidl/com/topjohnwu/magisk/core/utils/IRootUtils.aidl b/app/core/src/main/aidl/com/topjohnwu/magisk/core/utils/IRootUtils.aidl
similarity index 100%
rename from app/src/main/aidl/com/topjohnwu/magisk/core/utils/IRootUtils.aidl
rename to app/core/src/main/aidl/com/topjohnwu/magisk/core/utils/IRootUtils.aidl
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/App.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/App.kt
similarity index 95%
rename from app/src/main/java/com/topjohnwu/magisk/core/App.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/App.kt
index faf0bfdaa..db2eef0a7 100644
--- a/app/src/main/java/com/topjohnwu/magisk/core/App.kt
+++ b/app/core/src/main/java/com/topjohnwu/magisk/core/App.kt
@@ -7,8 +7,8 @@ import android.content.res.Configuration
import android.os.Bundle
import android.system.Os
import androidx.profileinstaller.ProfileInstaller
-import com.topjohnwu.magisk.BuildConfig
import com.topjohnwu.magisk.StubApk
+import com.topjohnwu.magisk.core.base.UntrackedActivity
import com.topjohnwu.magisk.core.di.ServiceLocator
import com.topjohnwu.magisk.core.utils.NetworkObserver
import com.topjohnwu.magisk.core.utils.ProcessLifecycle
@@ -16,7 +16,6 @@ import com.topjohnwu.magisk.core.utils.RootUtils
import com.topjohnwu.magisk.core.utils.ShellInit
import com.topjohnwu.magisk.core.utils.refreshLocale
import com.topjohnwu.magisk.core.utils.setConfig
-import com.topjohnwu.magisk.ui.surequest.SuRequestActivity
import com.topjohnwu.magisk.view.Notifications
import com.topjohnwu.superuser.Shell
import com.topjohnwu.superuser.internal.UiThreadHandler
@@ -116,12 +115,12 @@ object ActivityTracker : Application.ActivityLifecycleCallbacks {
private var ref = WeakReference(null)
override fun onActivityResumed(activity: Activity) {
- if (activity is SuRequestActivity) return
+ if (activity is UntrackedActivity) return
ref = WeakReference(activity)
}
override fun onActivityPaused(activity: Activity) {
- if (activity is SuRequestActivity) return
+ if (activity is UntrackedActivity) return
ref.clear()
}
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/Config.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/Config.kt
similarity index 97%
rename from app/src/main/java/com/topjohnwu/magisk/core/Config.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/Config.kt
index 9bbbfd959..34edee4da 100644
--- a/app/src/main/java/com/topjohnwu/magisk/core/Config.kt
+++ b/app/core/src/main/java/com/topjohnwu/magisk/core/Config.kt
@@ -3,14 +3,12 @@ package com.topjohnwu.magisk.core
import android.annotation.SuppressLint
import androidx.appcompat.app.AppCompatDelegate
import androidx.core.content.edit
-import com.topjohnwu.magisk.BuildConfig
import com.topjohnwu.magisk.core.di.AppContext
import com.topjohnwu.magisk.core.di.ServiceLocator
import com.topjohnwu.magisk.core.ktx.writeTo
import com.topjohnwu.magisk.core.repository.DBConfig
import com.topjohnwu.magisk.core.repository.PreferenceConfig
import com.topjohnwu.magisk.core.utils.refreshLocale
-import com.topjohnwu.magisk.ui.theme.Theme
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.runBlocking
@@ -118,7 +116,7 @@ object Config : PreferenceConfig, DBConfig {
var safetyNotice by preference(Key.SAFETY, true)
var darkTheme by preference(Key.DARK_THEME, AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
- var themeOrdinal by preference(Key.THEME_ORDINAL, Theme.Piplup.ordinal)
+ var themeOrdinal by preference(Key.THEME_ORDINAL, 0)
private var checkUpdatePrefs by preference(Key.CHECK_UPDATES, true)
private var localePrefs by preference(Key.LOCALE, "")
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/Const.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/Const.kt
similarity index 93%
rename from app/src/main/java/com/topjohnwu/magisk/core/Const.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/Const.kt
index a8344db2e..4b071c86e 100644
--- a/app/src/main/java/com/topjohnwu/magisk/core/Const.kt
+++ b/app/core/src/main/java/com/topjohnwu/magisk/core/Const.kt
@@ -2,7 +2,6 @@ package com.topjohnwu.magisk.core
import android.os.Build
import android.os.Process
-import com.topjohnwu.magisk.BuildConfig
@Suppress("DEPRECATION")
object Const {
@@ -21,7 +20,7 @@ object Const {
// Misc
val USER_ID = Process.myUid() / 100000
- val APP_IS_CANARY get() = Version.isCanary(BuildConfig.VERSION_CODE)
+ val APP_IS_CANARY get() = Version.isCanary(BuildConfig.APP_VERSION_CODE)
object Version {
const val MIN_VERSION = "v22.0"
@@ -44,7 +43,7 @@ object Const {
const val SOURCE_CODE_URL = "https://github.com/topjohnwu/Magisk"
val CHANGELOG_URL = if (APP_IS_CANARY) Info.remote.magisk.note
- else "https://topjohnwu.github.io/Magisk/releases/${BuildConfig.VERSION_CODE}.md"
+ else "https://topjohnwu.github.io/Magisk/releases/${BuildConfig.APP_VERSION_CODE}.md"
const val GITHUB_RAW_URL = "https://raw.githubusercontent.com/"
const val GITHUB_API_URL = "https://api.github.com/"
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/Hacks.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/Hacks.kt
similarity index 98%
rename from app/src/main/java/com/topjohnwu/magisk/core/Hacks.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/Hacks.kt
index d62698e27..5992541f3 100644
--- a/app/src/main/java/com/topjohnwu/magisk/core/Hacks.kt
+++ b/app/core/src/main/java/com/topjohnwu/magisk/core/Hacks.kt
@@ -10,7 +10,6 @@ import android.content.res.AssetManager
import android.content.res.Configuration
import android.content.res.Resources
import android.util.DisplayMetrics
-import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.StubApk
import com.topjohnwu.magisk.core.di.AppContext
import com.topjohnwu.magisk.core.ktx.unwrap
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/Info.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/Info.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/Info.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/Info.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/JobService.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/JobService.kt
similarity index 96%
rename from app/src/main/java/com/topjohnwu/magisk/core/JobService.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/JobService.kt
index 789c1d160..1cb5b082c 100644
--- a/app/src/main/java/com/topjohnwu/magisk/core/JobService.kt
+++ b/app/core/src/main/java/com/topjohnwu/magisk/core/JobService.kt
@@ -8,7 +8,6 @@ import android.app.job.JobParameters
import android.app.job.JobScheduler
import android.content.Context
import androidx.core.content.getSystemService
-import com.topjohnwu.magisk.BuildConfig
import com.topjohnwu.magisk.core.base.BaseJobService
import com.topjohnwu.magisk.core.di.ServiceLocator
import com.topjohnwu.magisk.core.download.DownloadEngine
@@ -77,7 +76,7 @@ class JobService : BaseJobService() {
GlobalScope.launch(Dispatchers.IO) {
ServiceLocator.networkService.fetchUpdate()?.let {
Info.remote = it
- if (Info.env.isActive && BuildConfig.VERSION_CODE < it.magisk.versionCode)
+ if (Info.env.isActive && BuildConfig.APP_VERSION_CODE < it.magisk.versionCode)
Notifications.updateAvailable()
jobFinished(params, false)
}
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/Provider.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/Provider.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/Provider.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/Provider.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/Receiver.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/Receiver.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/Receiver.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/Receiver.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/Service.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/Service.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/Service.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/Service.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/base/BaseActivity.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/base/BaseActivity.kt
similarity index 98%
rename from app/src/main/java/com/topjohnwu/magisk/core/base/BaseActivity.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/base/BaseActivity.kt
index 70b5a53a0..b6c344b4a 100644
--- a/app/src/main/java/com/topjohnwu/magisk/core/base/BaseActivity.kt
+++ b/app/core/src/main/java/com/topjohnwu/magisk/core/base/BaseActivity.kt
@@ -16,7 +16,7 @@ import androidx.activity.result.ActivityResultCallback
import androidx.activity.result.contract.ActivityResultContracts.GetContent
import androidx.activity.result.contract.ActivityResultContracts.RequestPermission
import androidx.appcompat.app.AppCompatActivity
-import com.topjohnwu.magisk.R
+import com.topjohnwu.magisk.core.R
import com.topjohnwu.magisk.core.isRunningAsStub
import com.topjohnwu.magisk.core.ktx.reflectField
import com.topjohnwu.magisk.core.ktx.toast
@@ -30,6 +30,8 @@ interface ContentResultCallback: ActivityResultCallback, Parcelable {
override fun onActivityResult(result: Uri)
}
+interface UntrackedActivity
+
abstract class BaseActivity : AppCompatActivity() {
private var permissionCallback: ((Boolean) -> Unit)? = null
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/base/BaseJobService.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/base/BaseJobService.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/base/BaseJobService.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/base/BaseJobService.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/base/BaseProvider.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/base/BaseProvider.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/base/BaseProvider.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/base/BaseProvider.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/base/BaseReceiver.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/base/BaseReceiver.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/base/BaseReceiver.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/base/BaseReceiver.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/base/BaseService.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/base/BaseService.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/base/BaseService.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/base/BaseService.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/data/NetworkServices.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/data/NetworkServices.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/data/NetworkServices.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/data/NetworkServices.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/data/SuLogDao.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/data/SuLogDao.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/data/SuLogDao.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/data/SuLogDao.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/data/magiskdb/MagiskDB.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/data/magiskdb/MagiskDB.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/data/magiskdb/MagiskDB.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/data/magiskdb/MagiskDB.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/data/magiskdb/PolicyDao.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/data/magiskdb/PolicyDao.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/data/magiskdb/PolicyDao.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/data/magiskdb/PolicyDao.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/data/magiskdb/SettingsDao.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/data/magiskdb/SettingsDao.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/data/magiskdb/SettingsDao.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/data/magiskdb/SettingsDao.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/data/magiskdb/StringDao.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/data/magiskdb/StringDao.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/data/magiskdb/StringDao.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/data/magiskdb/StringDao.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/di/Networking.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/di/Networking.kt
similarity index 96%
rename from app/src/main/java/com/topjohnwu/magisk/core/di/Networking.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/di/Networking.kt
index 1cade82d6..a5f69ccfd 100644
--- a/app/src/main/java/com/topjohnwu/magisk/core/di/Networking.kt
+++ b/app/core/src/main/java/com/topjohnwu/magisk/core/di/Networking.kt
@@ -2,8 +2,8 @@ package com.topjohnwu.magisk.core.di
import android.content.Context
import com.squareup.moshi.Moshi
-import com.topjohnwu.magisk.BuildConfig
import com.topjohnwu.magisk.ProviderInstaller
+import com.topjohnwu.magisk.core.BuildConfig
import com.topjohnwu.magisk.core.Config
import com.topjohnwu.magisk.core.Info
import com.topjohnwu.magisk.core.utils.currentLocale
@@ -67,7 +67,7 @@ fun createOkHttpClient(context: Context): OkHttpClient {
builder.addInterceptor { chain ->
val request = chain.request().newBuilder()
- request.header("User-Agent", "Magisk/${BuildConfig.VERSION_CODE}")
+ request.header("User-Agent", "Magisk/${BuildConfig.APP_VERSION_CODE}")
request.header("Accept-Language", currentLocale.toLanguageTag())
chain.proceed(request.build())
}
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/di/ServiceLocator.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/di/ServiceLocator.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/di/ServiceLocator.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/di/ServiceLocator.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/download/DownloadEngine.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/download/DownloadEngine.kt
similarity index 99%
rename from app/src/main/java/com/topjohnwu/magisk/core/download/DownloadEngine.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/download/DownloadEngine.kt
index dd8cd6907..e67da1f10 100644
--- a/app/src/main/java/com/topjohnwu/magisk/core/download/DownloadEngine.kt
+++ b/app/core/src/main/java/com/topjohnwu/magisk/core/download/DownloadEngine.kt
@@ -15,11 +15,11 @@ import androidx.collection.isNotEmpty
import androidx.core.content.getSystemService
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.MutableLiveData
-import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.StubApk
import com.topjohnwu.magisk.core.ActivityTracker
import com.topjohnwu.magisk.core.Const
import com.topjohnwu.magisk.core.JobService
+import com.topjohnwu.magisk.core.R
import com.topjohnwu.magisk.core.base.BaseActivity
import com.topjohnwu.magisk.core.cmp
import com.topjohnwu.magisk.core.di.ServiceLocator
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/download/Subject.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/download/Subject.kt
similarity index 93%
rename from app/src/main/java/com/topjohnwu/magisk/core/download/Subject.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/download/Subject.kt
index 019762e6a..a7431b090 100644
--- a/app/src/main/java/com/topjohnwu/magisk/core/download/Subject.kt
+++ b/app/core/src/main/java/com/topjohnwu/magisk/core/download/Subject.kt
@@ -11,7 +11,6 @@ import com.topjohnwu.magisk.core.Info
import com.topjohnwu.magisk.core.model.MagiskJson
import com.topjohnwu.magisk.core.model.module.OnlineModule
import com.topjohnwu.magisk.core.utils.MediaStoreUtils
-import com.topjohnwu.magisk.ui.flash.FlashFragment
import com.topjohnwu.magisk.view.Notifications
import kotlinx.parcelize.IgnoredOnParcel
import kotlinx.parcelize.Parcelize
@@ -42,8 +41,10 @@ sealed class Subject : Parcelable {
MediaStoreUtils.getFile(title).uri
}
- override fun pendingIntent(context: Context) =
- FlashFragment.installIntent(context, file)
+ @IgnoredOnParcel
+ var piCreator: ((Context, Uri) -> PendingIntent)? = null
+
+ override fun pendingIntent(context: Context) = piCreator?.invoke(context, file)
}
@Parcelize
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/ktx/XAndroid.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/ktx/XAndroid.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/ktx/XAndroid.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/ktx/XAndroid.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/ktx/XJVM.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/ktx/XJVM.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/ktx/XJVM.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/ktx/XJVM.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/ktx/XSU.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/ktx/XSU.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/ktx/XSU.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/ktx/XSU.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/model/UpdateInfo.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/model/UpdateInfo.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/model/UpdateInfo.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/model/UpdateInfo.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/model/module/LocalModule.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/model/module/LocalModule.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/model/module/LocalModule.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/model/module/LocalModule.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/model/module/Module.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/model/module/Module.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/model/module/Module.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/model/module/Module.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/model/module/OnlineModule.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/model/module/OnlineModule.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/model/module/OnlineModule.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/model/module/OnlineModule.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/model/su/SuLog.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/model/su/SuLog.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/model/su/SuLog.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/model/su/SuLog.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/model/su/SuPolicy.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/model/su/SuPolicy.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/model/su/SuPolicy.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/model/su/SuPolicy.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/repository/DBConfig.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/repository/DBConfig.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/repository/DBConfig.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/repository/DBConfig.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/repository/LogRepository.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/repository/LogRepository.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/repository/LogRepository.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/repository/LogRepository.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/repository/NetworkService.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/repository/NetworkService.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/repository/NetworkService.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/repository/NetworkService.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/repository/PreferenceConfig.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/repository/PreferenceConfig.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/repository/PreferenceConfig.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/repository/PreferenceConfig.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/su/SuCallbackHandler.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/su/SuCallbackHandler.kt
similarity index 97%
rename from app/src/main/java/com/topjohnwu/magisk/core/su/SuCallbackHandler.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/su/SuCallbackHandler.kt
index cb034c3e4..7ef971a33 100644
--- a/app/src/main/java/com/topjohnwu/magisk/core/su/SuCallbackHandler.kt
+++ b/app/core/src/main/java/com/topjohnwu/magisk/core/su/SuCallbackHandler.kt
@@ -3,9 +3,9 @@ package com.topjohnwu.magisk.core.su
import android.content.Context
import android.os.Bundle
import android.widget.Toast
-import com.topjohnwu.magisk.BuildConfig
-import com.topjohnwu.magisk.R
+import com.topjohnwu.magisk.core.BuildConfig
import com.topjohnwu.magisk.core.Config
+import com.topjohnwu.magisk.core.R
import com.topjohnwu.magisk.core.di.ServiceLocator
import com.topjohnwu.magisk.core.ktx.getLabel
import com.topjohnwu.magisk.core.ktx.getPackageInfo
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/su/SuRequestHandler.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/su/SuRequestHandler.kt
similarity index 94%
rename from app/src/main/java/com/topjohnwu/magisk/core/su/SuRequestHandler.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/su/SuRequestHandler.kt
index afa090c9a..d3cd5bd3c 100644
--- a/app/src/main/java/com/topjohnwu/magisk/core/su/SuRequestHandler.kt
+++ b/app/core/src/main/java/com/topjohnwu/magisk/core/su/SuRequestHandler.kt
@@ -3,7 +3,7 @@ package com.topjohnwu.magisk.core.su
import android.content.Intent
import android.content.pm.PackageInfo
import android.content.pm.PackageManager
-import com.topjohnwu.magisk.BuildConfig
+import com.topjohnwu.magisk.core.BuildConfig
import com.topjohnwu.magisk.core.Config
import com.topjohnwu.magisk.core.data.magiskdb.PolicyDao
import com.topjohnwu.magisk.core.ktx.getPackageInfo
@@ -34,8 +34,8 @@ class SuRequestHandler(
return false
// Never allow com.topjohnwu.magisk (could be malware)
- if (pkgInfo.packageName == BuildConfig.APPLICATION_ID) {
- Shell.cmd("(pm uninstall ${BuildConfig.APPLICATION_ID} >/dev/null 2>&1)&").exec()
+ if (pkgInfo.packageName == BuildConfig.APP_PACKAGE_NAME) {
+ Shell.cmd("(pm uninstall ${BuildConfig.APP_PACKAGE_NAME} >/dev/null 2>&1)&").exec()
return false
}
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/su/TestHandler.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/su/TestHandler.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/su/TestHandler.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/su/TestHandler.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/tasks/FlashZip.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/tasks/FlashZip.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/tasks/FlashZip.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/tasks/FlashZip.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/tasks/HideAPK.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/tasks/HideAPK.kt
similarity index 95%
rename from app/src/main/java/com/topjohnwu/magisk/core/tasks/HideAPK.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/tasks/HideAPK.kt
index 3f1ef51bd..53bb1b21a 100644
--- a/app/src/main/java/com/topjohnwu/magisk/core/tasks/HideAPK.kt
+++ b/app/core/src/main/java/com/topjohnwu/magisk/core/tasks/HideAPK.kt
@@ -5,12 +5,12 @@ import android.content.Context
import android.content.Intent
import android.widget.Toast
import androidx.annotation.WorkerThread
-import com.topjohnwu.magisk.BuildConfig.APPLICATION_ID
-import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.StubApk
+import com.topjohnwu.magisk.core.BuildConfig.APP_PACKAGE_NAME
import com.topjohnwu.magisk.core.Config
import com.topjohnwu.magisk.core.Const
import com.topjohnwu.magisk.core.Provider
+import com.topjohnwu.magisk.core.R
import com.topjohnwu.magisk.core.ktx.await
import com.topjohnwu.magisk.core.ktx.copyAndClose
import com.topjohnwu.magisk.core.ktx.toast
@@ -135,8 +135,8 @@ object HideAPK {
if (!xml.patchStrings {
for (i in it.indices) {
val s = it[i]
- if (s.contains(APPLICATION_ID)) {
- it[i] = s.replace(APPLICATION_ID, pkg)
+ if (s.contains(APP_PACKAGE_NAME)) {
+ it[i] = s.replace(APP_PACKAGE_NAME, pkg)
} else if (s.contains(PLACEHOLDER)) {
it[i] = generator.next()
} else if (s == origLabel) {
@@ -236,12 +236,12 @@ object HideAPK {
activity.toast(R.string.failure, Toast.LENGTH_LONG)
}
val apk = StubApk.current(activity)
- val session = APKInstall.startSession(activity, APPLICATION_ID, onFailure) {
- launchApp(activity, APPLICATION_ID)
+ val session = APKInstall.startSession(activity, APP_PACKAGE_NAME, onFailure) {
+ launchApp(activity, APP_PACKAGE_NAME)
dialog.dismiss()
}
Config.suManager = ""
- val cmd = "adb_pm_install $apk $APPLICATION_ID"
+ val cmd = "adb_pm_install $apk $APP_PACKAGE_NAME"
if (Shell.cmd(cmd).await().isSuccess) return
val success = withContext(Dispatchers.IO) {
try {
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt
similarity index 98%
rename from app/src/main/java/com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt
index d7a11ace1..4111d8c67 100644
--- a/app/src/main/java/com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt
+++ b/app/core/src/main/java/com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt
@@ -9,13 +9,13 @@ import android.system.OsConstants.O_WRONLY
import android.widget.Toast
import androidx.annotation.WorkerThread
import androidx.core.os.postDelayed
-import com.topjohnwu.magisk.BuildConfig
-import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.StubApk
import com.topjohnwu.magisk.core.AppApkPath
+import com.topjohnwu.magisk.core.BuildConfig
import com.topjohnwu.magisk.core.Config
import com.topjohnwu.magisk.core.Const
import com.topjohnwu.magisk.core.Info
+import com.topjohnwu.magisk.core.R
import com.topjohnwu.magisk.core.di.ServiceLocator
import com.topjohnwu.magisk.core.isRunningAsStub
import com.topjohnwu.magisk.core.ktx.copyAll
@@ -75,7 +75,7 @@ abstract class MagiskInstallImpl protected constructor(
val alpha = "abcdefghijklmnopqrstuvwxyz"
val alphaNum = "$alpha${alpha.uppercase(Locale.ROOT)}0123456789"
val random = SecureRandom()
- StringBuilder("magisk_patched-${BuildConfig.VERSION_CODE}_").run {
+ StringBuilder("magisk_patched-${BuildConfig.APP_VERSION_CODE}_").run {
for (i in 1..5) {
append(alphaNum[random.nextInt(alphaNum.length)])
}
@@ -112,7 +112,7 @@ abstract class MagiskInstallImpl protected constructor(
private suspend fun extractFiles(): Boolean {
console.add("- Device platform: ${Const.CPU_ABI}")
- console.add("- Installing: ${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})")
+ console.add("- Installing: ${BuildConfig.APP_VERSION_NAME} (${BuildConfig.APP_VERSION_CODE})")
installDir = localFS.getFile(context.filesDir.parent, "install")
installDir.deleteRecursively()
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/utils/AXML.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/utils/AXML.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/utils/AXML.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/utils/AXML.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/utils/DummyList.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/utils/DummyList.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/utils/DummyList.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/utils/DummyList.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/utils/Keygen.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/utils/Keygen.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/utils/Keygen.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/utils/Keygen.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/utils/Locales.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/utils/Locales.kt
similarity index 98%
rename from app/src/main/java/com/topjohnwu/magisk/core/utils/Locales.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/utils/Locales.kt
index aac1c4f36..2af595dca 100644
--- a/app/src/main/java/com/topjohnwu/magisk/core/utils/Locales.kt
+++ b/app/core/src/main/java/com/topjohnwu/magisk/core/utils/Locales.kt
@@ -5,9 +5,9 @@ package com.topjohnwu.magisk.core.utils
import android.annotation.SuppressLint
import android.content.res.Configuration
import android.content.res.Resources
-import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.core.ActivityTracker
import com.topjohnwu.magisk.core.Config
+import com.topjohnwu.magisk.core.R
import com.topjohnwu.magisk.core.createNewResources
import com.topjohnwu.magisk.core.di.AppContext
import kotlinx.coroutines.Dispatchers
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/utils/MediaStoreUtils.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/utils/MediaStoreUtils.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/utils/MediaStoreUtils.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/utils/MediaStoreUtils.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/utils/NetworkObserver.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/utils/NetworkObserver.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/utils/NetworkObserver.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/utils/NetworkObserver.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/utils/ProcessLifecycle.java b/app/core/src/main/java/com/topjohnwu/magisk/core/utils/ProcessLifecycle.java
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/utils/ProcessLifecycle.java
rename to app/core/src/main/java/com/topjohnwu/magisk/core/utils/ProcessLifecycle.java
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/utils/ProgressInputStream.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/utils/ProgressInputStream.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/utils/ProgressInputStream.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/utils/ProgressInputStream.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/utils/RequestAuthentication.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/utils/RequestAuthentication.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/utils/RequestAuthentication.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/utils/RequestAuthentication.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/utils/RequestInstall.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/utils/RequestInstall.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/utils/RequestInstall.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/utils/RequestInstall.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/utils/RootUtils.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/utils/RootUtils.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/utils/RootUtils.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/utils/RootUtils.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/utils/ShellInit.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/utils/ShellInit.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/utils/ShellInit.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/utils/ShellInit.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/core/utils/ZipUtils.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/utils/ZipUtils.kt
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/core/utils/ZipUtils.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/core/utils/ZipUtils.kt
diff --git a/app/src/main/java/com/topjohnwu/magisk/signing/ApkSignerV2.java b/app/core/src/main/java/com/topjohnwu/magisk/signing/ApkSignerV2.java
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/signing/ApkSignerV2.java
rename to app/core/src/main/java/com/topjohnwu/magisk/signing/ApkSignerV2.java
diff --git a/app/src/main/java/com/topjohnwu/magisk/signing/ByteArrayStream.java b/app/core/src/main/java/com/topjohnwu/magisk/signing/ByteArrayStream.java
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/signing/ByteArrayStream.java
rename to app/core/src/main/java/com/topjohnwu/magisk/signing/ByteArrayStream.java
diff --git a/app/src/main/java/com/topjohnwu/magisk/signing/JarMap.java b/app/core/src/main/java/com/topjohnwu/magisk/signing/JarMap.java
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/signing/JarMap.java
rename to app/core/src/main/java/com/topjohnwu/magisk/signing/JarMap.java
diff --git a/app/src/main/java/com/topjohnwu/magisk/signing/SignApk.java b/app/core/src/main/java/com/topjohnwu/magisk/signing/SignApk.java
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/signing/SignApk.java
rename to app/core/src/main/java/com/topjohnwu/magisk/signing/SignApk.java
diff --git a/app/src/main/java/com/topjohnwu/magisk/signing/ZipUtils.java b/app/core/src/main/java/com/topjohnwu/magisk/signing/ZipUtils.java
similarity index 100%
rename from app/src/main/java/com/topjohnwu/magisk/signing/ZipUtils.java
rename to app/core/src/main/java/com/topjohnwu/magisk/signing/ZipUtils.java
diff --git a/app/src/main/java/com/topjohnwu/magisk/view/Notifications.kt b/app/core/src/main/java/com/topjohnwu/magisk/view/Notifications.kt
similarity index 99%
rename from app/src/main/java/com/topjohnwu/magisk/view/Notifications.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/view/Notifications.kt
index dad376991..bd60e340f 100644
--- a/app/src/main/java/com/topjohnwu/magisk/view/Notifications.kt
+++ b/app/core/src/main/java/com/topjohnwu/magisk/view/Notifications.kt
@@ -9,7 +9,7 @@ import android.os.Build
import android.os.Build.VERSION.SDK_INT
import androidx.core.content.getSystemService
import androidx.core.graphics.drawable.toIcon
-import com.topjohnwu.magisk.R
+import com.topjohnwu.magisk.core.R
import com.topjohnwu.magisk.core.di.AppContext
import com.topjohnwu.magisk.core.download.DownloadEngine
import com.topjohnwu.magisk.core.download.Subject
diff --git a/app/src/main/java/com/topjohnwu/magisk/view/Shortcuts.kt b/app/core/src/main/java/com/topjohnwu/magisk/view/Shortcuts.kt
similarity index 99%
rename from app/src/main/java/com/topjohnwu/magisk/view/Shortcuts.kt
rename to app/core/src/main/java/com/topjohnwu/magisk/view/Shortcuts.kt
index 2a8bac7a8..0c326f65a 100644
--- a/app/src/main/java/com/topjohnwu/magisk/view/Shortcuts.kt
+++ b/app/core/src/main/java/com/topjohnwu/magisk/view/Shortcuts.kt
@@ -11,9 +11,9 @@ import androidx.core.content.getSystemService
import androidx.core.content.pm.ShortcutInfoCompat
import androidx.core.content.pm.ShortcutManagerCompat
import androidx.core.graphics.drawable.IconCompat
-import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.core.Const
import com.topjohnwu.magisk.core.Info
+import com.topjohnwu.magisk.core.R
import com.topjohnwu.magisk.core.isRunningAsStub
import com.topjohnwu.magisk.core.ktx.getBitmap
diff --git a/app/src/main/res/drawable-v26/ic_launcher.xml b/app/core/src/main/res/drawable-v26/ic_launcher.xml
similarity index 100%
rename from app/src/main/res/drawable-v26/ic_launcher.xml
rename to app/core/src/main/res/drawable-v26/ic_launcher.xml
diff --git a/app/src/main/res/drawable-v26/sc_extension.xml b/app/core/src/main/res/drawable-v26/sc_extension.xml
similarity index 100%
rename from app/src/main/res/drawable-v26/sc_extension.xml
rename to app/core/src/main/res/drawable-v26/sc_extension.xml
diff --git a/app/src/main/res/drawable-v26/sc_superuser.xml b/app/core/src/main/res/drawable-v26/sc_superuser.xml
similarity index 100%
rename from app/src/main/res/drawable-v26/sc_superuser.xml
rename to app/core/src/main/res/drawable-v26/sc_superuser.xml
diff --git a/app/src/main/res/drawable/avd_bug_from_filled.xml b/app/core/src/main/res/drawable/avd_bug_from_filled.xml
similarity index 100%
rename from app/src/main/res/drawable/avd_bug_from_filled.xml
rename to app/core/src/main/res/drawable/avd_bug_from_filled.xml
diff --git a/app/src/main/res/drawable/avd_bug_to_filled.xml b/app/core/src/main/res/drawable/avd_bug_to_filled.xml
similarity index 100%
rename from app/src/main/res/drawable/avd_bug_to_filled.xml
rename to app/core/src/main/res/drawable/avd_bug_to_filled.xml
diff --git a/app/src/main/res/drawable/avd_circle_check_from_filled.xml b/app/core/src/main/res/drawable/avd_circle_check_from_filled.xml
similarity index 100%
rename from app/src/main/res/drawable/avd_circle_check_from_filled.xml
rename to app/core/src/main/res/drawable/avd_circle_check_from_filled.xml
diff --git a/app/src/main/res/drawable/avd_circle_check_to_filled.xml b/app/core/src/main/res/drawable/avd_circle_check_to_filled.xml
similarity index 100%
rename from app/src/main/res/drawable/avd_circle_check_to_filled.xml
rename to app/core/src/main/res/drawable/avd_circle_check_to_filled.xml
diff --git a/app/src/main/res/drawable/avd_delete_magisk.xml b/app/core/src/main/res/drawable/avd_delete_magisk.xml
similarity index 100%
rename from app/src/main/res/drawable/avd_delete_magisk.xml
rename to app/core/src/main/res/drawable/avd_delete_magisk.xml
diff --git a/app/src/main/res/drawable/avd_home_from_filled.xml b/app/core/src/main/res/drawable/avd_home_from_filled.xml
similarity index 100%
rename from app/src/main/res/drawable/avd_home_from_filled.xml
rename to app/core/src/main/res/drawable/avd_home_from_filled.xml
diff --git a/app/src/main/res/drawable/avd_home_to_filled.xml b/app/core/src/main/res/drawable/avd_home_to_filled.xml
similarity index 100%
rename from app/src/main/res/drawable/avd_home_to_filled.xml
rename to app/core/src/main/res/drawable/avd_home_to_filled.xml
diff --git a/app/src/main/res/drawable/avd_magisk_delete.xml b/app/core/src/main/res/drawable/avd_magisk_delete.xml
similarity index 100%
rename from app/src/main/res/drawable/avd_magisk_delete.xml
rename to app/core/src/main/res/drawable/avd_magisk_delete.xml
diff --git a/app/src/main/res/drawable/avd_module_from_filled.xml b/app/core/src/main/res/drawable/avd_module_from_filled.xml
similarity index 100%
rename from app/src/main/res/drawable/avd_module_from_filled.xml
rename to app/core/src/main/res/drawable/avd_module_from_filled.xml
diff --git a/app/src/main/res/drawable/avd_module_to_filled.xml b/app/core/src/main/res/drawable/avd_module_to_filled.xml
similarity index 100%
rename from app/src/main/res/drawable/avd_module_to_filled.xml
rename to app/core/src/main/res/drawable/avd_module_to_filled.xml
diff --git a/app/src/main/res/drawable/avd_settings_from_filled.xml b/app/core/src/main/res/drawable/avd_settings_from_filled.xml
similarity index 100%
rename from app/src/main/res/drawable/avd_settings_from_filled.xml
rename to app/core/src/main/res/drawable/avd_settings_from_filled.xml
diff --git a/app/src/main/res/drawable/avd_settings_to_filled.xml b/app/core/src/main/res/drawable/avd_settings_to_filled.xml
similarity index 100%
rename from app/src/main/res/drawable/avd_settings_to_filled.xml
rename to app/core/src/main/res/drawable/avd_settings_to_filled.xml
diff --git a/app/src/main/res/drawable/avd_superuser_from_filled.xml b/app/core/src/main/res/drawable/avd_superuser_from_filled.xml
similarity index 100%
rename from app/src/main/res/drawable/avd_superuser_from_filled.xml
rename to app/core/src/main/res/drawable/avd_superuser_from_filled.xml
diff --git a/app/src/main/res/drawable/avd_superuser_to_filled.xml b/app/core/src/main/res/drawable/avd_superuser_to_filled.xml
similarity index 100%
rename from app/src/main/res/drawable/avd_superuser_to_filled.xml
rename to app/core/src/main/res/drawable/avd_superuser_to_filled.xml
diff --git a/app/src/main/res/drawable/bg_line_bottom_rounded.xml b/app/core/src/main/res/drawable/bg_line_bottom_rounded.xml
similarity index 100%
rename from app/src/main/res/drawable/bg_line_bottom_rounded.xml
rename to app/core/src/main/res/drawable/bg_line_bottom_rounded.xml
diff --git a/app/src/main/res/drawable/bg_line_top_rounded.xml b/app/core/src/main/res/drawable/bg_line_top_rounded.xml
similarity index 100%
rename from app/src/main/res/drawable/bg_line_top_rounded.xml
rename to app/core/src/main/res/drawable/bg_line_top_rounded.xml
diff --git a/app/src/main/res/drawable/bg_selection_circle_green.xml b/app/core/src/main/res/drawable/bg_selection_circle_green.xml
similarity index 100%
rename from app/src/main/res/drawable/bg_selection_circle_green.xml
rename to app/core/src/main/res/drawable/bg_selection_circle_green.xml
diff --git a/app/src/main/res/drawable/ic_back_md2.xml b/app/core/src/main/res/drawable/ic_back_md2.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_back_md2.xml
rename to app/core/src/main/res/drawable/ic_back_md2.xml
diff --git a/app/src/main/res/drawable/ic_bug_filled_md2.xml b/app/core/src/main/res/drawable/ic_bug_filled_md2.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_bug_filled_md2.xml
rename to app/core/src/main/res/drawable/ic_bug_filled_md2.xml
diff --git a/app/src/main/res/drawable/ic_bug_md2.xml b/app/core/src/main/res/drawable/ic_bug_md2.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_bug_md2.xml
rename to app/core/src/main/res/drawable/ic_bug_md2.xml
diff --git a/app/src/main/res/drawable/ic_bug_outlined_md2.xml b/app/core/src/main/res/drawable/ic_bug_outlined_md2.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_bug_outlined_md2.xml
rename to app/core/src/main/res/drawable/ic_bug_outlined_md2.xml
diff --git a/app/src/main/res/drawable/ic_check_circle_checked_md2.xml b/app/core/src/main/res/drawable/ic_check_circle_checked_md2.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_check_circle_checked_md2.xml
rename to app/core/src/main/res/drawable/ic_check_circle_checked_md2.xml
diff --git a/app/src/main/res/drawable/ic_check_circle_md2.xml b/app/core/src/main/res/drawable/ic_check_circle_md2.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_check_circle_md2.xml
rename to app/core/src/main/res/drawable/ic_check_circle_md2.xml
diff --git a/app/src/main/res/drawable/ic_check_circle_unchecked_md2.xml b/app/core/src/main/res/drawable/ic_check_circle_unchecked_md2.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_check_circle_unchecked_md2.xml
rename to app/core/src/main/res/drawable/ic_check_circle_unchecked_md2.xml
diff --git a/app/src/main/res/drawable/ic_check_md2.xml b/app/core/src/main/res/drawable/ic_check_md2.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_check_md2.xml
rename to app/core/src/main/res/drawable/ic_check_md2.xml
diff --git a/app/src/main/res/drawable/ic_close_md2.xml b/app/core/src/main/res/drawable/ic_close_md2.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_close_md2.xml
rename to app/core/src/main/res/drawable/ic_close_md2.xml
diff --git a/app/src/main/res/drawable/ic_day.xml b/app/core/src/main/res/drawable/ic_day.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_day.xml
rename to app/core/src/main/res/drawable/ic_day.xml
diff --git a/app/src/main/res/drawable/ic_day_night.xml b/app/core/src/main/res/drawable/ic_day_night.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_day_night.xml
rename to app/core/src/main/res/drawable/ic_day_night.xml
diff --git a/app/src/main/res/drawable/ic_delete_md2.xml b/app/core/src/main/res/drawable/ic_delete_md2.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_delete_md2.xml
rename to app/core/src/main/res/drawable/ic_delete_md2.xml
diff --git a/app/src/main/res/drawable/ic_device.xml b/app/core/src/main/res/drawable/ic_device.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_device.xml
rename to app/core/src/main/res/drawable/ic_device.xml
diff --git a/app/src/main/res/drawable/ic_download_md2.xml b/app/core/src/main/res/drawable/ic_download_md2.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_download_md2.xml
rename to app/core/src/main/res/drawable/ic_download_md2.xml
diff --git a/app/src/main/res/drawable/ic_extension.xml b/app/core/src/main/res/drawable/ic_extension.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_extension.xml
rename to app/core/src/main/res/drawable/ic_extension.xml
diff --git a/app/src/main/res/drawable/ic_favorite.xml b/app/core/src/main/res/drawable/ic_favorite.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_favorite.xml
rename to app/core/src/main/res/drawable/ic_favorite.xml
diff --git a/app/src/main/res/drawable/ic_fingerprint.xml b/app/core/src/main/res/drawable/ic_fingerprint.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_fingerprint.xml
rename to app/core/src/main/res/drawable/ic_fingerprint.xml
diff --git a/app/src/main/res/drawable/ic_folder_list.xml b/app/core/src/main/res/drawable/ic_folder_list.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_folder_list.xml
rename to app/core/src/main/res/drawable/ic_folder_list.xml
diff --git a/app/src/main/res/drawable/ic_forth_md2.xml b/app/core/src/main/res/drawable/ic_forth_md2.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_forth_md2.xml
rename to app/core/src/main/res/drawable/ic_forth_md2.xml
diff --git a/app/src/main/res/drawable/ic_github.xml b/app/core/src/main/res/drawable/ic_github.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_github.xml
rename to app/core/src/main/res/drawable/ic_github.xml
diff --git a/app/src/main/res/drawable/ic_home_filled_md2.xml b/app/core/src/main/res/drawable/ic_home_filled_md2.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_home_filled_md2.xml
rename to app/core/src/main/res/drawable/ic_home_filled_md2.xml
diff --git a/app/src/main/res/drawable/ic_home_md2.xml b/app/core/src/main/res/drawable/ic_home_md2.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_home_md2.xml
rename to app/core/src/main/res/drawable/ic_home_md2.xml
diff --git a/app/src/main/res/drawable/ic_home_outlined_md2.xml b/app/core/src/main/res/drawable/ic_home_outlined_md2.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_home_outlined_md2.xml
rename to app/core/src/main/res/drawable/ic_home_outlined_md2.xml
diff --git a/app/src/main/res/drawable/ic_install.xml b/app/core/src/main/res/drawable/ic_install.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_install.xml
rename to app/core/src/main/res/drawable/ic_install.xml
diff --git a/app/src/main/res/drawable/ic_logo.xml b/app/core/src/main/res/drawable/ic_logo.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_logo.xml
rename to app/core/src/main/res/drawable/ic_logo.xml
diff --git a/app/src/main/res/drawable/ic_magisk.xml b/app/core/src/main/res/drawable/ic_magisk.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_magisk.xml
rename to app/core/src/main/res/drawable/ic_magisk.xml
diff --git a/app/src/main/res/drawable/ic_magisk_delete.xml b/app/core/src/main/res/drawable/ic_magisk_delete.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_magisk_delete.xml
rename to app/core/src/main/res/drawable/ic_magisk_delete.xml
diff --git a/app/src/main/res/drawable/ic_magisk_outline.xml b/app/core/src/main/res/drawable/ic_magisk_outline.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_magisk_outline.xml
rename to app/core/src/main/res/drawable/ic_magisk_outline.xml
diff --git a/app/src/main/res/drawable/ic_magisk_padded.xml b/app/core/src/main/res/drawable/ic_magisk_padded.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_magisk_padded.xml
rename to app/core/src/main/res/drawable/ic_magisk_padded.xml
diff --git a/app/src/main/res/drawable/ic_manager.xml b/app/core/src/main/res/drawable/ic_manager.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_manager.xml
rename to app/core/src/main/res/drawable/ic_manager.xml
diff --git a/app/src/main/res/drawable/ic_module_filled_md2.xml b/app/core/src/main/res/drawable/ic_module_filled_md2.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_module_filled_md2.xml
rename to app/core/src/main/res/drawable/ic_module_filled_md2.xml
diff --git a/app/src/main/res/drawable/ic_module_md2.xml b/app/core/src/main/res/drawable/ic_module_md2.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_module_md2.xml
rename to app/core/src/main/res/drawable/ic_module_md2.xml
diff --git a/app/src/main/res/drawable/ic_module_outlined_md2.xml b/app/core/src/main/res/drawable/ic_module_outlined_md2.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_module_outlined_md2.xml
rename to app/core/src/main/res/drawable/ic_module_outlined_md2.xml
diff --git a/app/src/main/res/drawable/ic_module_storage_md2.xml b/app/core/src/main/res/drawable/ic_module_storage_md2.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_module_storage_md2.xml
rename to app/core/src/main/res/drawable/ic_module_storage_md2.xml
diff --git a/app/src/main/res/drawable/ic_more.xml b/app/core/src/main/res/drawable/ic_more.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_more.xml
rename to app/core/src/main/res/drawable/ic_more.xml
diff --git a/app/src/main/res/drawable/ic_night.xml b/app/core/src/main/res/drawable/ic_night.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_night.xml
rename to app/core/src/main/res/drawable/ic_night.xml
diff --git a/app/src/main/res/drawable/ic_notifications_md2.xml b/app/core/src/main/res/drawable/ic_notifications_md2.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_notifications_md2.xml
rename to app/core/src/main/res/drawable/ic_notifications_md2.xml
diff --git a/app/src/main/res/drawable/ic_order_date.xml b/app/core/src/main/res/drawable/ic_order_date.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_order_date.xml
rename to app/core/src/main/res/drawable/ic_order_date.xml
diff --git a/app/src/main/res/drawable/ic_order_name.xml b/app/core/src/main/res/drawable/ic_order_name.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_order_name.xml
rename to app/core/src/main/res/drawable/ic_order_name.xml
diff --git a/app/src/main/res/drawable/ic_paint.xml b/app/core/src/main/res/drawable/ic_paint.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_paint.xml
rename to app/core/src/main/res/drawable/ic_paint.xml
diff --git a/app/src/main/res/drawable/ic_patreon.xml b/app/core/src/main/res/drawable/ic_patreon.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_patreon.xml
rename to app/core/src/main/res/drawable/ic_patreon.xml
diff --git a/app/src/main/res/drawable/ic_paypal.xml b/app/core/src/main/res/drawable/ic_paypal.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_paypal.xml
rename to app/core/src/main/res/drawable/ic_paypal.xml
diff --git a/app/src/main/res/drawable/ic_refresh_data_md2.xml b/app/core/src/main/res/drawable/ic_refresh_data_md2.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_refresh_data_md2.xml
rename to app/core/src/main/res/drawable/ic_refresh_data_md2.xml
diff --git a/app/src/main/res/drawable/ic_restart.xml b/app/core/src/main/res/drawable/ic_restart.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_restart.xml
rename to app/core/src/main/res/drawable/ic_restart.xml
diff --git a/app/src/main/res/drawable/ic_save_md2.xml b/app/core/src/main/res/drawable/ic_save_md2.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_save_md2.xml
rename to app/core/src/main/res/drawable/ic_save_md2.xml
diff --git a/app/src/main/res/drawable/ic_search_md2.xml b/app/core/src/main/res/drawable/ic_search_md2.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_search_md2.xml
rename to app/core/src/main/res/drawable/ic_search_md2.xml
diff --git a/app/src/main/res/drawable/ic_settings_filled_md2.xml b/app/core/src/main/res/drawable/ic_settings_filled_md2.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_settings_filled_md2.xml
rename to app/core/src/main/res/drawable/ic_settings_filled_md2.xml
diff --git a/app/src/main/res/drawable/ic_settings_md2.xml b/app/core/src/main/res/drawable/ic_settings_md2.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_settings_md2.xml
rename to app/core/src/main/res/drawable/ic_settings_md2.xml
diff --git a/app/src/main/res/drawable/ic_settings_outlined_md2.xml b/app/core/src/main/res/drawable/ic_settings_outlined_md2.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_settings_outlined_md2.xml
rename to app/core/src/main/res/drawable/ic_settings_outlined_md2.xml
diff --git a/app/src/main/res/drawable/ic_splash_activity.xml b/app/core/src/main/res/drawable/ic_splash_activity.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_splash_activity.xml
rename to app/core/src/main/res/drawable/ic_splash_activity.xml
diff --git a/app/src/main/res/drawable/ic_superuser.xml b/app/core/src/main/res/drawable/ic_superuser.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_superuser.xml
rename to app/core/src/main/res/drawable/ic_superuser.xml
diff --git a/app/src/main/res/drawable/ic_superuser_filled_md2.xml b/app/core/src/main/res/drawable/ic_superuser_filled_md2.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_superuser_filled_md2.xml
rename to app/core/src/main/res/drawable/ic_superuser_filled_md2.xml
diff --git a/app/src/main/res/drawable/ic_superuser_md2.xml b/app/core/src/main/res/drawable/ic_superuser_md2.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_superuser_md2.xml
rename to app/core/src/main/res/drawable/ic_superuser_md2.xml
diff --git a/app/src/main/res/drawable/ic_superuser_outlined_md2.xml b/app/core/src/main/res/drawable/ic_superuser_outlined_md2.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_superuser_outlined_md2.xml
rename to app/core/src/main/res/drawable/ic_superuser_outlined_md2.xml
diff --git a/app/src/main/res/drawable/ic_twitter.xml b/app/core/src/main/res/drawable/ic_twitter.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_twitter.xml
rename to app/core/src/main/res/drawable/ic_twitter.xml
diff --git a/app/src/main/res/drawable/ic_update_md2.xml b/app/core/src/main/res/drawable/ic_update_md2.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_update_md2.xml
rename to app/core/src/main/res/drawable/ic_update_md2.xml
diff --git a/app/src/main/res/drawable/sc_extension.xml b/app/core/src/main/res/drawable/sc_extension.xml
similarity index 100%
rename from app/src/main/res/drawable/sc_extension.xml
rename to app/core/src/main/res/drawable/sc_extension.xml
diff --git a/app/src/main/res/drawable/sc_superuser.xml b/app/core/src/main/res/drawable/sc_superuser.xml
similarity index 100%
rename from app/src/main/res/drawable/sc_superuser.xml
rename to app/core/src/main/res/drawable/sc_superuser.xml
diff --git a/app/src/main/res/values-ar/strings.xml b/app/core/src/main/res/values-ar/strings.xml
similarity index 100%
rename from app/src/main/res/values-ar/strings.xml
rename to app/core/src/main/res/values-ar/strings.xml
diff --git a/app/src/main/res/values-ast/strings.xml b/app/core/src/main/res/values-ast/strings.xml
similarity index 100%
rename from app/src/main/res/values-ast/strings.xml
rename to app/core/src/main/res/values-ast/strings.xml
diff --git a/app/src/main/res/values-az/strings.xml b/app/core/src/main/res/values-az/strings.xml
similarity index 100%
rename from app/src/main/res/values-az/strings.xml
rename to app/core/src/main/res/values-az/strings.xml
diff --git a/app/src/main/res/values-be/strings.xml b/app/core/src/main/res/values-be/strings.xml
similarity index 100%
rename from app/src/main/res/values-be/strings.xml
rename to app/core/src/main/res/values-be/strings.xml
diff --git a/app/src/main/res/values-bg/strings.xml b/app/core/src/main/res/values-bg/strings.xml
similarity index 100%
rename from app/src/main/res/values-bg/strings.xml
rename to app/core/src/main/res/values-bg/strings.xml
diff --git a/app/src/main/res/values-bn/strings.xml b/app/core/src/main/res/values-bn/strings.xml
similarity index 100%
rename from app/src/main/res/values-bn/strings.xml
rename to app/core/src/main/res/values-bn/strings.xml
diff --git a/app/src/main/res/values-ca/strings.xml b/app/core/src/main/res/values-ca/strings.xml
similarity index 100%
rename from app/src/main/res/values-ca/strings.xml
rename to app/core/src/main/res/values-ca/strings.xml
diff --git a/app/src/main/res/values-cs/strings.xml b/app/core/src/main/res/values-cs/strings.xml
similarity index 100%
rename from app/src/main/res/values-cs/strings.xml
rename to app/core/src/main/res/values-cs/strings.xml
diff --git a/app/src/main/res/values-de/strings.xml b/app/core/src/main/res/values-de/strings.xml
similarity index 100%
rename from app/src/main/res/values-de/strings.xml
rename to app/core/src/main/res/values-de/strings.xml
diff --git a/app/src/main/res/values-el/strings.xml b/app/core/src/main/res/values-el/strings.xml
similarity index 100%
rename from app/src/main/res/values-el/strings.xml
rename to app/core/src/main/res/values-el/strings.xml
diff --git a/app/src/main/res/values-es/strings.xml b/app/core/src/main/res/values-es/strings.xml
similarity index 100%
rename from app/src/main/res/values-es/strings.xml
rename to app/core/src/main/res/values-es/strings.xml
diff --git a/app/src/main/res/values-et/strings.xml b/app/core/src/main/res/values-et/strings.xml
similarity index 100%
rename from app/src/main/res/values-et/strings.xml
rename to app/core/src/main/res/values-et/strings.xml
diff --git a/app/src/main/res/values-fa/strings.xml b/app/core/src/main/res/values-fa/strings.xml
similarity index 100%
rename from app/src/main/res/values-fa/strings.xml
rename to app/core/src/main/res/values-fa/strings.xml
diff --git a/app/src/main/res/values-fr/strings.xml b/app/core/src/main/res/values-fr/strings.xml
similarity index 100%
rename from app/src/main/res/values-fr/strings.xml
rename to app/core/src/main/res/values-fr/strings.xml
diff --git a/app/src/main/res/values-hi/strings.xml b/app/core/src/main/res/values-hi/strings.xml
similarity index 100%
rename from app/src/main/res/values-hi/strings.xml
rename to app/core/src/main/res/values-hi/strings.xml
diff --git a/app/src/main/res/values-hr/strings.xml b/app/core/src/main/res/values-hr/strings.xml
similarity index 100%
rename from app/src/main/res/values-hr/strings.xml
rename to app/core/src/main/res/values-hr/strings.xml
diff --git a/app/src/main/res/values-hu/strings.xml b/app/core/src/main/res/values-hu/strings.xml
similarity index 100%
rename from app/src/main/res/values-hu/strings.xml
rename to app/core/src/main/res/values-hu/strings.xml
diff --git a/app/src/main/res/values-in/strings.xml b/app/core/src/main/res/values-in/strings.xml
similarity index 100%
rename from app/src/main/res/values-in/strings.xml
rename to app/core/src/main/res/values-in/strings.xml
diff --git a/app/src/main/res/values-it/strings.xml b/app/core/src/main/res/values-it/strings.xml
similarity index 100%
rename from app/src/main/res/values-it/strings.xml
rename to app/core/src/main/res/values-it/strings.xml
diff --git a/app/src/main/res/values-iw/strings.xml b/app/core/src/main/res/values-iw/strings.xml
similarity index 100%
rename from app/src/main/res/values-iw/strings.xml
rename to app/core/src/main/res/values-iw/strings.xml
diff --git a/app/src/main/res/values-ja/strings.xml b/app/core/src/main/res/values-ja/strings.xml
similarity index 100%
rename from app/src/main/res/values-ja/strings.xml
rename to app/core/src/main/res/values-ja/strings.xml
diff --git a/app/src/main/res/values-ka/strings.xml b/app/core/src/main/res/values-ka/strings.xml
similarity index 100%
rename from app/src/main/res/values-ka/strings.xml
rename to app/core/src/main/res/values-ka/strings.xml
diff --git a/app/src/main/res/values-kk/strings.xml b/app/core/src/main/res/values-kk/strings.xml
similarity index 100%
rename from app/src/main/res/values-kk/strings.xml
rename to app/core/src/main/res/values-kk/strings.xml
diff --git a/app/src/main/res/values-ko/strings.xml b/app/core/src/main/res/values-ko/strings.xml
similarity index 100%
rename from app/src/main/res/values-ko/strings.xml
rename to app/core/src/main/res/values-ko/strings.xml
diff --git a/app/src/main/res/values-lt/strings.xml b/app/core/src/main/res/values-lt/strings.xml
similarity index 100%
rename from app/src/main/res/values-lt/strings.xml
rename to app/core/src/main/res/values-lt/strings.xml
diff --git a/app/src/main/res/values-mk/strings.xml b/app/core/src/main/res/values-mk/strings.xml
similarity index 100%
rename from app/src/main/res/values-mk/strings.xml
rename to app/core/src/main/res/values-mk/strings.xml
diff --git a/app/src/main/res/values-ml/strings.xml b/app/core/src/main/res/values-ml/strings.xml
similarity index 100%
rename from app/src/main/res/values-ml/strings.xml
rename to app/core/src/main/res/values-ml/strings.xml
diff --git a/app/src/main/res/values-nb/strings.xml b/app/core/src/main/res/values-nb/strings.xml
similarity index 100%
rename from app/src/main/res/values-nb/strings.xml
rename to app/core/src/main/res/values-nb/strings.xml
diff --git a/app/src/main/res/values-night/colors.xml b/app/core/src/main/res/values-night/colors.xml
similarity index 100%
rename from app/src/main/res/values-night/colors.xml
rename to app/core/src/main/res/values-night/colors.xml
diff --git a/app/src/main/res/values-nl/strings.xml b/app/core/src/main/res/values-nl/strings.xml
similarity index 100%
rename from app/src/main/res/values-nl/strings.xml
rename to app/core/src/main/res/values-nl/strings.xml
diff --git a/app/src/main/res/values-pa/strings.xml b/app/core/src/main/res/values-pa/strings.xml
similarity index 100%
rename from app/src/main/res/values-pa/strings.xml
rename to app/core/src/main/res/values-pa/strings.xml
diff --git a/app/src/main/res/values-pl/strings.xml b/app/core/src/main/res/values-pl/strings.xml
similarity index 100%
rename from app/src/main/res/values-pl/strings.xml
rename to app/core/src/main/res/values-pl/strings.xml
diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/core/src/main/res/values-pt-rBR/strings.xml
similarity index 100%
rename from app/src/main/res/values-pt-rBR/strings.xml
rename to app/core/src/main/res/values-pt-rBR/strings.xml
diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/core/src/main/res/values-pt-rPT/strings.xml
similarity index 100%
rename from app/src/main/res/values-pt-rPT/strings.xml
rename to app/core/src/main/res/values-pt-rPT/strings.xml
diff --git a/app/src/main/res/values-ro/strings.xml b/app/core/src/main/res/values-ro/strings.xml
similarity index 100%
rename from app/src/main/res/values-ro/strings.xml
rename to app/core/src/main/res/values-ro/strings.xml
diff --git a/app/src/main/res/values-ru/strings.xml b/app/core/src/main/res/values-ru/strings.xml
similarity index 100%
rename from app/src/main/res/values-ru/strings.xml
rename to app/core/src/main/res/values-ru/strings.xml
diff --git a/app/src/main/res/values-sk/strings.xml b/app/core/src/main/res/values-sk/strings.xml
similarity index 100%
rename from app/src/main/res/values-sk/strings.xml
rename to app/core/src/main/res/values-sk/strings.xml
diff --git a/app/src/main/res/values-sq/strings.xml b/app/core/src/main/res/values-sq/strings.xml
similarity index 100%
rename from app/src/main/res/values-sq/strings.xml
rename to app/core/src/main/res/values-sq/strings.xml
diff --git a/app/src/main/res/values-sr/strings.xml b/app/core/src/main/res/values-sr/strings.xml
similarity index 100%
rename from app/src/main/res/values-sr/strings.xml
rename to app/core/src/main/res/values-sr/strings.xml
diff --git a/app/src/main/res/values-sv/strings.xml b/app/core/src/main/res/values-sv/strings.xml
similarity index 100%
rename from app/src/main/res/values-sv/strings.xml
rename to app/core/src/main/res/values-sv/strings.xml
diff --git a/app/src/main/res/values-sw/strings.xml b/app/core/src/main/res/values-sw/strings.xml
similarity index 100%
rename from app/src/main/res/values-sw/strings.xml
rename to app/core/src/main/res/values-sw/strings.xml
diff --git a/app/src/main/res/values-ta/strings.xml b/app/core/src/main/res/values-ta/strings.xml
similarity index 100%
rename from app/src/main/res/values-ta/strings.xml
rename to app/core/src/main/res/values-ta/strings.xml
diff --git a/app/src/main/res/values-th/strings.xml b/app/core/src/main/res/values-th/strings.xml
similarity index 100%
rename from app/src/main/res/values-th/strings.xml
rename to app/core/src/main/res/values-th/strings.xml
diff --git a/app/src/main/res/values-tr/strings.xml b/app/core/src/main/res/values-tr/strings.xml
similarity index 100%
rename from app/src/main/res/values-tr/strings.xml
rename to app/core/src/main/res/values-tr/strings.xml
diff --git a/app/src/main/res/values-uk/strings.xml b/app/core/src/main/res/values-uk/strings.xml
similarity index 100%
rename from app/src/main/res/values-uk/strings.xml
rename to app/core/src/main/res/values-uk/strings.xml
diff --git a/app/src/main/res/values-v34/resources.xml b/app/core/src/main/res/values-v34/resources.xml
similarity index 100%
rename from app/src/main/res/values-v34/resources.xml
rename to app/core/src/main/res/values-v34/resources.xml
diff --git a/app/src/main/res/values-vi/strings.xml b/app/core/src/main/res/values-vi/strings.xml
similarity index 100%
rename from app/src/main/res/values-vi/strings.xml
rename to app/core/src/main/res/values-vi/strings.xml
diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/core/src/main/res/values-zh-rCN/strings.xml
similarity index 100%
rename from app/src/main/res/values-zh-rCN/strings.xml
rename to app/core/src/main/res/values-zh-rCN/strings.xml
diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/core/src/main/res/values-zh-rTW/strings.xml
similarity index 100%
rename from app/src/main/res/values-zh-rTW/strings.xml
rename to app/core/src/main/res/values-zh-rTW/strings.xml
diff --git a/app/src/main/res/values/arrays.xml b/app/core/src/main/res/values/arrays.xml
similarity index 100%
rename from app/src/main/res/values/arrays.xml
rename to app/core/src/main/res/values/arrays.xml
diff --git a/app/src/main/res/values/colors.xml b/app/core/src/main/res/values/colors.xml
similarity index 100%
rename from app/src/main/res/values/colors.xml
rename to app/core/src/main/res/values/colors.xml
diff --git a/app/src/main/res/values/ids.xml b/app/core/src/main/res/values/ids.xml
similarity index 100%
rename from app/src/main/res/values/ids.xml
rename to app/core/src/main/res/values/ids.xml
diff --git a/app/src/main/res/values/resources.xml b/app/core/src/main/res/values/resources.xml
similarity index 100%
rename from app/src/main/res/values/resources.xml
rename to app/core/src/main/res/values/resources.xml
diff --git a/app/src/main/res/values/strings.xml b/app/core/src/main/res/values/strings.xml
similarity index 100%
rename from app/src/main/res/values/strings.xml
rename to app/core/src/main/res/values/strings.xml
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 9a2b15d41..bf89f2d1a 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -2,22 +2,7 @@
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/java/com/topjohnwu/magisk/dialog/EnvFixDialog.kt b/app/src/main/java/com/topjohnwu/magisk/dialog/EnvFixDialog.kt
index 21fb39efe..e48c310dd 100644
--- a/app/src/main/java/com/topjohnwu/magisk/dialog/EnvFixDialog.kt
+++ b/app/src/main/java/com/topjohnwu/magisk/dialog/EnvFixDialog.kt
@@ -1,8 +1,8 @@
package com.topjohnwu.magisk.dialog
import androidx.lifecycle.lifecycleScope
-import com.topjohnwu.magisk.BuildConfig
import com.topjohnwu.magisk.R
+import com.topjohnwu.magisk.core.BuildConfig
import com.topjohnwu.magisk.core.Info
import com.topjohnwu.magisk.core.base.BaseActivity
import com.topjohnwu.magisk.core.tasks.MagiskInstaller
@@ -40,8 +40,8 @@ class EnvFixDialog(private val vm: HomeViewModel, private val code: Int) : Dialo
}
if (code == 2 || // No rules block, module policy not loaded
- Info.env.versionCode != BuildConfig.VERSION_CODE ||
- Info.env.versionString != BuildConfig.VERSION_NAME) {
+ Info.env.versionCode != BuildConfig.APP_VERSION_CODE ||
+ Info.env.versionString != BuildConfig.APP_VERSION_NAME) {
dialog.setMessage(R.string.env_full_fix_msg)
dialog.setButton(MagiskDialog.ButtonType.POSITIVE) {
text = android.R.string.ok
diff --git a/app/src/main/java/com/topjohnwu/magisk/dialog/OnlineModuleInstallDialog.kt b/app/src/main/java/com/topjohnwu/magisk/dialog/OnlineModuleInstallDialog.kt
index 7d438e4dc..c41ccae0c 100644
--- a/app/src/main/java/com/topjohnwu/magisk/dialog/OnlineModuleInstallDialog.kt
+++ b/app/src/main/java/com/topjohnwu/magisk/dialog/OnlineModuleInstallDialog.kt
@@ -5,6 +5,7 @@ import com.topjohnwu.magisk.core.di.ServiceLocator
import com.topjohnwu.magisk.core.download.DownloadEngine
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
class OnlineModuleInstallDialog(private val item: OnlineModule) : MarkDownDialog() {
@@ -21,7 +22,9 @@ class OnlineModuleInstallDialog(private val item: OnlineModule) : MarkDownDialog
dialog.apply {
fun download(install: Boolean) {
- DownloadEngine.startWithActivity(activity, Subject.Module(item, install))
+ val module = Subject.Module(item, install)
+ module.piCreator = FlashFragment::installIntent
+ DownloadEngine.startWithActivity(activity, module)
}
val title = context.getString(R.string.repo_install_title,
diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/SplashActivity.kt b/app/src/main/java/com/topjohnwu/magisk/ui/SplashActivity.kt
index fa1073f1e..902a8cfe7 100644
--- a/app/src/main/java/com/topjohnwu/magisk/ui/SplashActivity.kt
+++ b/app/src/main/java/com/topjohnwu/magisk/ui/SplashActivity.kt
@@ -8,11 +8,11 @@ import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.databinding.ViewDataBinding
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.lifecycleScope
-import com.topjohnwu.magisk.BuildConfig
-import com.topjohnwu.magisk.BuildConfig.APPLICATION_ID
import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.StubApk
import com.topjohnwu.magisk.arch.NavigationActivity
+import com.topjohnwu.magisk.core.BuildConfig
+import com.topjohnwu.magisk.core.BuildConfig.APP_PACKAGE_NAME
import com.topjohnwu.magisk.core.Config
import com.topjohnwu.magisk.core.Const
import com.topjohnwu.magisk.core.Info
@@ -120,11 +120,11 @@ abstract class SplashActivity : NavigationActivity/dev/null 2>&1").exec()
+ packageManager.getApplicationInfo(APP_PACKAGE_NAME, 0)
+ Shell.cmd("(pm uninstall $APP_PACKAGE_NAME)& >/dev/null 2>&1").exec()
}
} else {
if (Config.suManager.isNotEmpty())
diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt
index fd3aae8ae..176c3523f 100644
--- a/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt
+++ b/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt
@@ -7,13 +7,13 @@ import android.widget.Toast
import androidx.core.net.toUri
import androidx.databinding.Bindable
import com.topjohnwu.magisk.BR
-import com.topjohnwu.magisk.BuildConfig
import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.arch.ActivityExecutor
import com.topjohnwu.magisk.arch.AsyncLoadViewModel
import com.topjohnwu.magisk.arch.ContextExecutor
import com.topjohnwu.magisk.arch.UIActivity
import com.topjohnwu.magisk.arch.ViewEvent
+import com.topjohnwu.magisk.core.BuildConfig
import com.topjohnwu.magisk.core.Config
import com.topjohnwu.magisk.core.Info
import com.topjohnwu.magisk.core.download.Subject
@@ -52,7 +52,7 @@ class HomeViewModel(
get() = when {
Info.isRooted && Info.env.isUnsupported -> State.OUTDATED
!Info.env.isActive -> State.INVALID
- Info.env.versionCode < BuildConfig.VERSION_CODE -> State.OUTDATED
+ Info.env.versionCode < BuildConfig.APP_VERSION_CODE -> State.OUTDATED
else -> State.UP_TO_DATE
}
@@ -73,7 +73,7 @@ class HomeViewModel(
set(value) = set(value, field, { field = it }, BR.managerRemoteVersion)
val managerInstalledVersion
- get() = "${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})" +
+ get() = "${BuildConfig.APP_VERSION_NAME} (${BuildConfig.APP_VERSION_CODE})" +
if (BuildConfig.DEBUG) " (D)" else ""
@get:Bindable
@@ -92,7 +92,7 @@ class HomeViewModel(
appState = State.LOADING
Info.getRemote(svc)?.apply {
appState = when {
- BuildConfig.VERSION_CODE < magisk.versionCode -> State.OUTDATED
+ BuildConfig.APP_VERSION_CODE < magisk.versionCode -> State.OUTDATED
else -> State.UP_TO_DATE
}
diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/install/InstallViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/ui/install/InstallViewModel.kt
index 2f91d1327..832cf806d 100644
--- a/app/src/main/java/com/topjohnwu/magisk/ui/install/InstallViewModel.kt
+++ b/app/src/main/java/com/topjohnwu/magisk/ui/install/InstallViewModel.kt
@@ -11,9 +11,9 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.topjohnwu.magisk.BR
-import com.topjohnwu.magisk.BuildConfig
import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.arch.BaseViewModel
+import com.topjohnwu.magisk.core.BuildConfig
import com.topjohnwu.magisk.core.Config
import com.topjohnwu.magisk.core.Const
import com.topjohnwu.magisk.core.Info
@@ -69,7 +69,7 @@ class InstallViewModel(svc: NetworkService, markwon: Markwon) : BaseViewModel()
init {
viewModelScope.launch(Dispatchers.IO) {
try {
- val file = File(AppContext.cacheDir, "${BuildConfig.VERSION_CODE}.md")
+ val file = File(AppContext.cacheDir, "${BuildConfig.APP_VERSION_CODE}.md")
val text = when {
file.exists() -> file.readText()
Const.Url.CHANGELOG_URL.isEmpty() -> ""
diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/log/LogViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/ui/log/LogViewModel.kt
index 9becc9337..fdb1edce1 100644
--- a/app/src/main/java/com/topjohnwu/magisk/ui/log/LogViewModel.kt
+++ b/app/src/main/java/com/topjohnwu/magisk/ui/log/LogViewModel.kt
@@ -4,9 +4,9 @@ import android.system.Os
import androidx.databinding.Bindable
import androidx.lifecycle.viewModelScope
import com.topjohnwu.magisk.BR
-import com.topjohnwu.magisk.BuildConfig
import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.arch.AsyncLoadViewModel
+import com.topjohnwu.magisk.core.BuildConfig
import com.topjohnwu.magisk.core.Info
import com.topjohnwu.magisk.core.ktx.timeFormatStandard
import com.topjohnwu.magisk.core.ktx.toTime
@@ -93,7 +93,7 @@ class LogViewModel(
if (Info.env.isActive) file.write(magiskLogRaw)
file.write("\n---Manager Logs---\n")
- file.write("${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})\n\n")
+ file.write("${BuildConfig.APP_VERSION_NAME} (${BuildConfig.APP_VERSION_CODE})\n\n")
ProcessBuilder("logcat", "-d").start()
.inputStream.reader().use { it.copyTo(file) }
}
diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsItems.kt b/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsItems.kt
index 57ec1c47e..9f9908fe3 100644
--- a/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsItems.kt
+++ b/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsItems.kt
@@ -7,8 +7,8 @@ import android.view.LayoutInflater
import android.view.View
import androidx.databinding.Bindable
import com.topjohnwu.magisk.BR
-import com.topjohnwu.magisk.BuildConfig
import com.topjohnwu.magisk.R
+import com.topjohnwu.magisk.core.BuildConfig
import com.topjohnwu.magisk.core.Config
import com.topjohnwu.magisk.core.Const
import com.topjohnwu.magisk.core.Info
diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsViewModel.kt
index ef2b75c47..255d318b8 100644
--- a/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsViewModel.kt
+++ b/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsViewModel.kt
@@ -6,9 +6,9 @@ import android.widget.Toast
import androidx.core.content.pm.ShortcutManagerCompat
import androidx.lifecycle.viewModelScope
import com.topjohnwu.magisk.BR
-import com.topjohnwu.magisk.BuildConfig
import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.arch.BaseViewModel
+import com.topjohnwu.magisk.core.BuildConfig
import com.topjohnwu.magisk.core.Const
import com.topjohnwu.magisk.core.Info
import com.topjohnwu.magisk.core.di.AppContext
@@ -38,7 +38,7 @@ class SettingsViewModel : BaseViewModel(), BaseSettingsItem.Handler {
private fun createItems(): List {
val context = AppContext
- val hidden = context.packageName != BuildConfig.APPLICATION_ID
+ val hidden = context.packageName != BuildConfig.APP_PACKAGE_NAME
// Customization
val list = mutableListOf(
diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/surequest/SuRequestActivity.kt b/app/src/main/java/com/topjohnwu/magisk/ui/surequest/SuRequestActivity.kt
index fc9213a36..9e04c0f53 100644
--- a/app/src/main/java/com/topjohnwu/magisk/ui/surequest/SuRequestActivity.kt
+++ b/app/src/main/java/com/topjohnwu/magisk/ui/surequest/SuRequestActivity.kt
@@ -11,6 +11,7 @@ import androidx.lifecycle.lifecycleScope
import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.arch.UIActivity
import com.topjohnwu.magisk.arch.viewModel
+import com.topjohnwu.magisk.core.base.UntrackedActivity
import com.topjohnwu.magisk.core.su.SuCallbackHandler
import com.topjohnwu.magisk.core.su.SuCallbackHandler.REQUEST
import com.topjohnwu.magisk.databinding.ActivityRequestBinding
@@ -19,7 +20,7 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
-open class SuRequestActivity : UIActivity() {
+open class SuRequestActivity : UIActivity(), UntrackedActivity {
override val layoutRes: Int = R.layout.activity_request
override val viewModel: SuRequestViewModel by viewModel()
diff --git a/app/src/main/res/layout/activity_main_md2.xml b/app/src/main/res/layout/activity_main_md2.xml
index a68be6f2d..83a16f750 100644
--- a/app/src/main/res/layout/activity_main_md2.xml
+++ b/app/src/main/res/layout/activity_main_md2.xml
@@ -3,16 +3,6 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/layout/fragment_settings_md2.xml b/app/src/main/res/layout/fragment_settings_md2.xml
index c06570d00..10aa02c89 100644
--- a/app/src/main/res/layout/fragment_settings_md2.xml
+++ b/app/src/main/res/layout/fragment_settings_md2.xml
@@ -5,8 +5,6 @@
-
-
diff --git a/app/src/main/res/layout/fragment_superuser_md2.xml b/app/src/main/res/layout/fragment_superuser_md2.xml
index 48de9a9fd..3f37482b2 100644
--- a/app/src/main/res/layout/fragment_superuser_md2.xml
+++ b/app/src/main/res/layout/fragment_superuser_md2.xml
@@ -5,8 +5,6 @@
-
-
diff --git a/app/src/main/res/layout/include_home_manager.xml b/app/src/main/res/layout/include_home_manager.xml
index f7ede865c..8acee96d3 100644
--- a/app/src/main/res/layout/include_home_manager.xml
+++ b/app/src/main/res/layout/include_home_manager.xml
@@ -5,8 +5,6 @@
-
-
-
-
diff --git a/build.py b/build.py
index 93579cc3e..ccc7adb15 100755
--- a/build.py
+++ b/build.py
@@ -490,7 +490,7 @@ def build_app(args):
# build process. Copy the stub APK into output directory.
build_type = "release" if args.release else "debug"
apk = f"stub-{build_type}.apk"
- source = Path("app", "src", build_type, "assets", "stub.apk")
+ source = Path("app", "core", "src", build_type, "assets", "stub.apk")
target = config["outdir"] / apk
cp(source, target)
@@ -526,7 +526,10 @@ def cleanup(args):
if "java" in args.target:
header("* Cleaning java")
- execv([gradlew, "app:clean", "app:shared:clean", "stub:clean"], env=find_jdk())
+ execv(
+ [gradlew, "app:clean", "app:core:clean", "app:shared:clean", "stub:clean"],
+ env=find_jdk(),
+ )
rm_rf(Path("app", "src", "debug"))
rm_rf(Path("app", "src", "release"))
diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts
index 3a328b5c9..1380e0ec2 100644
--- a/buildSrc/build.gradle.kts
+++ b/buildSrc/build.gradle.kts
@@ -18,6 +18,7 @@ gradlePlugin {
dependencies {
implementation(kotlin("gradle-plugin", "2.0.0"))
implementation("com.android.tools.build:gradle:8.5.0")
+ implementation("com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:2.0.0-1.0.22")
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.7.0.202309050840-r")
diff --git a/buildSrc/src/main/java/Setup.kt b/buildSrc/src/main/java/Setup.kt
index 06e1a712f..2930d6fa2 100644
--- a/buildSrc/src/main/java/Setup.kt
+++ b/buildSrc/src/main/java/Setup.kt
@@ -3,6 +3,7 @@ import com.android.build.api.artifact.SingleArtifact
import com.android.build.api.dsl.ApkSigningConfig
import com.android.build.api.variant.ApplicationAndroidComponentsExtension
import com.android.build.gradle.BaseExtension
+import com.android.build.gradle.LibraryExtension
import com.android.build.gradle.internal.dsl.BaseAppModuleExtension
import com.android.builder.internal.packaging.IncrementalPackager
import com.android.tools.build.apkzlib.sign.SigningExtension
@@ -25,6 +26,8 @@ import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.StopExecutionException
import org.gradle.api.tasks.Sync
import org.gradle.api.tasks.TaskAction
+import org.gradle.kotlin.dsl.assign
+import org.gradle.kotlin.dsl.exclude
import org.gradle.kotlin.dsl.filter
import org.gradle.kotlin.dsl.get
import org.gradle.kotlin.dsl.getValue
@@ -32,8 +35,8 @@ import org.gradle.kotlin.dsl.named
import org.gradle.kotlin.dsl.provideDelegate
import org.gradle.kotlin.dsl.register
import org.gradle.kotlin.dsl.registering
+import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension
-import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions
import java.io.ByteArrayOutputStream
import java.io.File
import java.security.KeyStore
@@ -51,19 +54,17 @@ private fun Project.androidBase(configure: Action) =
private fun Project.android(configure: Action) =
extensions.configure("android", configure)
-private fun BaseExtension.kotlinOptions(configure: Action) =
- (this as ExtensionAware).extensions.findByName("kotlinOptions")?.let {
- configure.execute(it as KotlinJvmOptions)
- }
-
private fun BaseExtension.kotlin(configure: Action) =
(this as ExtensionAware).extensions.findByName("kotlin")?.let {
configure.execute(it as KotlinAndroidProjectExtension)
}
-private val Project.android: BaseAppModuleExtension
+private val Project.androidApp: BaseAppModuleExtension
get() = extensions["android"] as BaseAppModuleExtension
+private val Project.androidLib: LibraryExtension
+ get() = extensions["android"] as LibraryExtension
+
private val Project.androidComponents
get() = extensions.getByType(ApplicationAndroidComponentsExtension::class.java)
@@ -76,7 +77,6 @@ fun Project.setupCommon() {
defaultConfig {
minSdk = 23
- targetSdk = 34
}
compileOptions {
@@ -84,14 +84,110 @@ fun Project.setupCommon() {
targetCompatibility = JavaVersion.VERSION_17
}
- kotlinOptions {
- jvmTarget = "17"
+ packagingOptions {
+ resources {
+ excludes += "/META-INF/*"
+ excludes += "/META-INF/versions/**"
+ excludes += "/org/bouncycastle/**"
+ excludes += "org/apache/commons/**"
+ excludes += "/kotlin/**"
+ excludes += "/kotlinx/**"
+ excludes += "/okhttp3/**"
+ excludes += "/*.txt"
+ excludes += "/*.bin"
+ excludes += "/*.json"
+ }
}
kotlin {
- jvmToolchain(17)
+ compilerOptions {
+ jvmTarget = JvmTarget.JVM_17
+ }
}
}
+
+ configurations.all {
+ exclude("org.jetbrains.kotlin", "kotlin-stdlib-jdk7")
+ exclude("org.jetbrains.kotlin", "kotlin-stdlib-jdk8")
+ }
+}
+
+fun Project.setupCoreLib() {
+ setupCommon()
+
+ val syncLibs by tasks.registering(Sync::class) {
+ into("src/main/jniLibs")
+ for (abi in arrayOf("armeabi-v7a", "x86", "arm64-v8a", "x86_64", "riscv64")) {
+ into(abi) {
+ from(rootProject.file("native/out/$abi")) {
+ include("busybox", "magiskboot", "magiskinit", "magiskpolicy", "magisk")
+ rename { "lib$it.so" }
+ }
+ }
+ }
+ onlyIf {
+ if (inputs.sourceFiles.files.size != 25)
+ throw StopExecutionException("Please build binaries first! (./build.py binary)")
+ true
+ }
+ }
+
+ val syncResources by tasks.registering(Sync::class) {
+ into("src/main/resources/META-INF/com/google/android")
+ from(rootProject.file("scripts/update_binary.sh")) {
+ rename { "update-binary" }
+ }
+ from(rootProject.file("scripts/flash_script.sh")) {
+ rename { "updater-script" }
+ }
+ }
+
+ androidLib.libraryVariants.all {
+ val variantCapped = name.replaceFirstChar { it.uppercase() }
+
+ tasks.getByPath("merge${variantCapped}JniLibFolders").dependsOn(syncLibs)
+ processJavaResourcesProvider.configure { dependsOn(syncResources) }
+
+ val stubTask = tasks.getByPath(":stub:comment$variantCapped")
+ val stubApk = stubTask.outputs.files.asFileTree.filter {
+ it.name.endsWith(".apk")
+ }
+
+ val syncAssets = tasks.register("sync${variantCapped}Assets", Sync::class) {
+ dependsOn(stubTask)
+ inputs.property("version", Config.version)
+ inputs.property("versionCode", Config.versionCode)
+ into("src/${this@all.name}/assets")
+ from(rootProject.file("scripts")) {
+ include("util_functions.sh", "boot_patch.sh", "addon.d.sh",
+ "app_functions.sh", "uninstaller.sh", "module_installer.sh")
+ }
+ from(rootProject.file("tools/bootctl"))
+ into("chromeos") {
+ from(rootProject.file("tools/futility"))
+ from(rootProject.file("tools/keys")) {
+ include("kernel_data_key.vbprivk", "kernel.keyblock")
+ }
+ }
+ from(stubApk) {
+ rename { "stub.apk" }
+ }
+ filesMatching("**/util_functions.sh") {
+ filter {
+ it.replace(
+ "#MAGISK_VERSION_STUB",
+ "MAGISK_VER='${Config.version}'\nMAGISK_VER_CODE=${Config.versionCode}"
+ )
+ }
+ filter("eol" to FixCrLfFilter.CrLf.newInstance("lf"))
+ }
+ }
+ mergeAssetsProvider.configure { dependsOn(syncAssets) }
+ }
+
+ tasks.named("clean") {
+ delete.addAll(listOf("src/main/jniLibs", "src/main/resources", "src/debug", "src/release"))
+ }
}
private fun ApkSigningConfig.getPrivateKey(): KeyStore.PrivateKeyEntry {
@@ -152,7 +248,7 @@ abstract class AddCommentTask: DefaultTask() {
}
}
-private fun Project.setupAppCommon() {
+fun Project.setupAppCommon() {
setupCommon()
android {
@@ -168,7 +264,7 @@ private fun Project.setupAppCommon() {
}
defaultConfig {
- buildConfigField("int", "STUB_VERSION", Config.stubVersion)
+ targetSdk = 34
}
buildTypes {
@@ -193,10 +289,6 @@ private fun Project.setupAppCommon() {
includeInApk = false
}
- buildFeatures {
- buildConfig = true
- }
-
packaging {
jniLibs {
useLegacyPackaging = true
@@ -212,7 +304,7 @@ private fun Project.setupAppCommon() {
val transformationRequest = variant.artifacts.use(commentTask)
.wiredWithDirectories(AddCommentTask::apkFolder, AddCommentTask::outFolder)
.toTransformMany(SingleArtifact.APK)
- val signingConfig = android.buildTypes.getByName(variant.buildType!!).signingConfig
+ val signingConfig = androidApp.buildTypes.getByName(variant.buildType!!).signingConfig
commentTask.configure {
this.transformationRequest.set(transformationRequest)
this.signingConfig.set(signingConfig)
@@ -224,80 +316,6 @@ private fun Project.setupAppCommon() {
}
}
-fun Project.setupApp() {
- setupAppCommon()
-
- val syncLibs by tasks.registering(Sync::class) {
- into("src/main/jniLibs")
- for (abi in arrayOf("armeabi-v7a", "x86", "arm64-v8a", "x86_64", "riscv64")) {
- into(abi) {
- from(rootProject.file("native/out/$abi")) {
- include("busybox", "magiskboot", "magiskinit", "magiskpolicy", "magisk")
- rename { "lib$it.so" }
- }
- }
- }
- onlyIf {
- if (inputs.sourceFiles.files.size != 25)
- throw StopExecutionException("Please build binaries first! (./build.py binary)")
- true
- }
- }
-
- val syncResources by tasks.registering(Sync::class) {
- into("src/main/resources/META-INF/com/google/android")
- from(rootProject.file("scripts/update_binary.sh")) {
- rename { "update-binary" }
- }
- from(rootProject.file("scripts/flash_script.sh")) {
- rename { "updater-script" }
- }
- }
-
- android.applicationVariants.all {
- val variantCapped = name.replaceFirstChar { it.uppercase() }
-
- tasks.getByPath("merge${variantCapped}JniLibFolders").dependsOn(syncLibs)
- processJavaResourcesProvider.configure { dependsOn(syncResources) }
-
- val stubTask = tasks.getByPath(":stub:comment$variantCapped")
- val stubApk = stubTask.outputs.files.asFileTree.filter {
- it.name.endsWith(".apk")
- }
-
- val syncAssets = tasks.register("sync${variantCapped}Assets", Sync::class) {
- dependsOn(stubTask)
- inputs.property("version", Config.version)
- inputs.property("versionCode", Config.versionCode)
- into("src/${this@all.name}/assets")
- from(rootProject.file("scripts")) {
- include("util_functions.sh", "boot_patch.sh", "addon.d.sh",
- "app_functions.sh", "uninstaller.sh", "module_installer.sh")
- }
- from(rootProject.file("tools/bootctl"))
- into("chromeos") {
- from(rootProject.file("tools/futility"))
- from(rootProject.file("tools/keys")) {
- include("kernel_data_key.vbprivk", "kernel.keyblock")
- }
- }
- from(stubApk) {
- rename { "stub.apk" }
- }
- filesMatching("**/util_functions.sh") {
- filter {
- it.replace(
- "#MAGISK_VERSION_STUB",
- "MAGISK_VER='${Config.version}'\nMAGISK_VER_CODE=${Config.versionCode}"
- )
- }
- filter("eol" to FixCrLfFilter.CrLf.newInstance("lf"))
- }
- }
- mergeAssetsProvider.configure { dependsOn(syncAssets) }
- }
-}
-
fun Project.setupStub() {
setupAppCommon()
@@ -318,13 +336,13 @@ fun Project.setupStub() {
.toTransform(SingleArtifact.MERGED_MANIFEST)
}
- android.applicationVariants.all {
+ androidApp.applicationVariants.all {
val variantCapped = name.replaceFirstChar { it.uppercase() }
val variantLowered = name.lowercase()
val outFactoryClassDir = layout.buildDirectory.file("generated/source/factory/${variantLowered}").get().asFile
val outAppClassDir = layout.buildDirectory.file("generated/source/app/${variantLowered}").get().asFile
val outResDir = layout.buildDirectory.dir("generated/source/res/${variantLowered}").get().asFile
- val aapt = File(android.sdkDirectory, "build-tools/${android.buildToolsVersion}/aapt2")
+ val aapt = File(androidApp.sdkDirectory, "build-tools/${androidApp.buildToolsVersion}/aapt2")
val apk = layout.buildDirectory.file("intermediates/processed_res/" +
"${variantLowered}/process${variantCapped}Resources/out/resources-${variantLowered}.ap_").get().asFile
diff --git a/gradle.properties b/gradle.properties
index 2dd51f0ef..9a9a9de3d 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -24,6 +24,7 @@ org.gradle.caching=true
android.useAndroidX=true
android.injected.testOnly=false
android.nonFinalResIds=false
+android.nonTransitiveRClass=false
# Magisk
magisk.stubVersion=39
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 774ef403e..f7af40c54 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -8,4 +8,4 @@ dependencyResolutionManagement {
}
}
rootProject.name = "Magisk"
-include(":app", ":app:shared", ":native", ":stub")
+include(":app", ":app:core", ":app:shared", ":native", ":stub")
diff --git a/stub/build.gradle.kts b/stub/build.gradle.kts
index 0a270f5e6..915152750 100644
--- a/stub/build.gradle.kts
+++ b/stub/build.gradle.kts
@@ -22,6 +22,7 @@ android {
versionCode = 1
versionName = "1.0"
buildConfigField("String", "APK_URL", url?.let { "\"$it\"" } ?: "null" )
+ buildConfigField("int", "STUB_VERSION", Config.stubVersion)
}
buildTypes {
@@ -31,6 +32,10 @@ android {
proguardFiles("proguard-rules.pro")
}
}
+
+ buildFeatures {
+ buildConfig = true
+ }
}
setupStub()