diff --git a/app/shared/src/main/java/com/topjohnwu/magisk/DynAPK.java b/app/shared/src/main/java/com/topjohnwu/magisk/StubApk.java similarity index 99% rename from app/shared/src/main/java/com/topjohnwu/magisk/DynAPK.java rename to app/shared/src/main/java/com/topjohnwu/magisk/StubApk.java index e05b6d1bb..d442c3889 100644 --- a/app/shared/src/main/java/com/topjohnwu/magisk/DynAPK.java +++ b/app/shared/src/main/java/com/topjohnwu/magisk/StubApk.java @@ -13,7 +13,7 @@ import java.util.Map; import io.michaelrocks.paranoid.Obfuscate; @Obfuscate -public class DynAPK { +public class StubApk { private static File dynDir; private static Method addAssetPath; diff --git a/app/src/main/java/com/topjohnwu/magisk/core/App.kt b/app/src/main/java/com/topjohnwu/magisk/core/App.kt index 3241b57a8..5c57ef80e 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/App.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/App.kt @@ -6,7 +6,7 @@ import android.app.Application import android.content.Context import android.content.res.Configuration import android.os.Bundle -import com.topjohnwu.magisk.DynAPK +import com.topjohnwu.magisk.StubApk import com.topjohnwu.magisk.core.utils.* import com.topjohnwu.magisk.di.ServiceLocator import com.topjohnwu.superuser.Shell @@ -19,7 +19,7 @@ import kotlin.system.exitProcess open class App() : Application() { constructor(o: Any) : this() { - val data = DynAPK.Data(o) + val data = StubApk.Data(o) // Add the root service name mapping data.classToComponent[RootRegistry::class.java.name] = data.rootService.name // Send back the actual root service class @@ -58,7 +58,7 @@ open class App() : Application() { refreshLocale() AppApkPath = if (isRunningAsStub) { - DynAPK.current(base).path + StubApk.current(base).path } else { base.packageResourcePath } diff --git a/app/src/main/java/com/topjohnwu/magisk/core/Hacks.kt b/app/src/main/java/com/topjohnwu/magisk/core/Hacks.kt index 9d8ec4a1a..b4506bd52 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/Hacks.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/Hacks.kt @@ -11,14 +11,14 @@ import android.content.res.AssetManager import android.content.res.Configuration import android.content.res.Resources import android.util.DisplayMetrics -import com.topjohnwu.magisk.DynAPK import com.topjohnwu.magisk.R +import com.topjohnwu.magisk.StubApk import com.topjohnwu.magisk.core.utils.syncLocale import com.topjohnwu.magisk.di.AppContext lateinit var AppApkPath: String -fun AssetManager.addAssetPath(path: String) = DynAPK.addAssetPath(this, path) +fun AssetManager.addAssetPath(path: String) = StubApk.addAssetPath(this, path) fun Context.wrap(): Context = if (this is PatchedContext) this else PatchedContext(this) diff --git a/app/src/main/java/com/topjohnwu/magisk/core/Info.kt b/app/src/main/java/com/topjohnwu/magisk/core/Info.kt index 8118969e1..5e1b18a97 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/Info.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/Info.kt @@ -2,7 +2,7 @@ package com.topjohnwu.magisk.core import android.os.Build import androidx.databinding.ObservableBoolean -import com.topjohnwu.magisk.DynAPK +import com.topjohnwu.magisk.StubApk import com.topjohnwu.magisk.core.model.UpdateInfo import com.topjohnwu.magisk.core.utils.net.NetworkObserver import com.topjohnwu.magisk.data.repository.NetworkService @@ -16,7 +16,7 @@ val isRunningAsStub get() = Info.stub != null object Info { - var stub: DynAPK.Data? = null + var stub: StubApk.Data? = null val EMPTY_REMOTE = UpdateInfo() var remote = EMPTY_REMOTE diff --git a/app/src/main/java/com/topjohnwu/magisk/core/download/ManagerHandler.kt b/app/src/main/java/com/topjohnwu/magisk/core/download/ManagerHandler.kt index 81b5744ab..831c3fc86 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/download/ManagerHandler.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/download/ManagerHandler.kt @@ -5,8 +5,8 @@ import android.app.PendingIntent import android.content.Intent import androidx.core.content.getSystemService import androidx.core.net.toFile -import com.topjohnwu.magisk.DynAPK import com.topjohnwu.magisk.R +import com.topjohnwu.magisk.StubApk import com.topjohnwu.magisk.core.ActivityTracker import com.topjohnwu.magisk.core.Info import com.topjohnwu.magisk.core.isRunningAsStub @@ -45,7 +45,7 @@ suspend fun DownloadService.handleAPK(subject: Subject.Manager, stream: InputStr if (isRunningAsStub) { val apk = subject.file.toFile() val id = subject.notifyId - write(DynAPK.update(this).outputStream()) + write(StubApk.update(this).outputStream()) if (Info.stub!!.version < subject.stub.versionCode) { // Also upgrade stub update(id) { diff --git a/app/src/main/java/com/topjohnwu/magisk/core/tasks/HideAPK.kt b/app/src/main/java/com/topjohnwu/magisk/core/tasks/HideAPK.kt index 39a18d2c3..0b41c5766 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/tasks/HideAPK.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/tasks/HideAPK.kt @@ -5,8 +5,8 @@ import android.content.Context import android.content.Intent import android.widget.Toast import com.topjohnwu.magisk.BuildConfig.APPLICATION_ID -import com.topjohnwu.magisk.DynAPK import com.topjohnwu.magisk.R +import com.topjohnwu.magisk.StubApk import com.topjohnwu.magisk.core.Config import com.topjohnwu.magisk.core.Const import com.topjohnwu.magisk.core.Info @@ -156,7 +156,7 @@ object HideAPK { setCancelable(false) show() } - val apk = DynAPK.current(activity) + val apk = StubApk.current(activity) val receiver = APKInstall.register(activity, APPLICATION_ID) { launchApp(activity, APPLICATION_ID) dialog.dismiss() diff --git a/app/src/main/java/com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt b/app/src/main/java/com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt index 2f9b84ac1..995be3f05 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt @@ -6,8 +6,8 @@ import android.widget.Toast import androidx.annotation.WorkerThread import androidx.core.os.postDelayed import com.topjohnwu.magisk.BuildConfig -import com.topjohnwu.magisk.DynAPK import com.topjohnwu.magisk.R +import com.topjohnwu.magisk.StubApk import com.topjohnwu.magisk.core.* import com.topjohnwu.magisk.core.utils.MediaStoreUtils import com.topjohnwu.magisk.core.utils.MediaStoreUtils.inputStream @@ -93,7 +93,7 @@ abstract class MagiskInstallImpl protected constructor( try { // Extract binaries if (isRunningAsStub) { - val zf = ZipFile(DynAPK.current(context)) + val zf = ZipFile(StubApk.current(context)) // Also extract magisk32 on non 64-bit only 64-bit devices val is32lib = Const.CPU_ABI_32?.let { diff --git a/app/src/main/java/com/topjohnwu/magisk/core/utils/ShellInit.kt b/app/src/main/java/com/topjohnwu/magisk/core/utils/ShellInit.kt index 866875e80..cfde6eb0c 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/utils/ShellInit.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/utils/ShellInit.kt @@ -1,8 +1,8 @@ package com.topjohnwu.magisk.core.utils import android.content.Context -import com.topjohnwu.magisk.DynAPK import com.topjohnwu.magisk.R +import com.topjohnwu.magisk.StubApk import com.topjohnwu.magisk.core.Config import com.topjohnwu.magisk.core.Const import com.topjohnwu.magisk.core.Info @@ -29,7 +29,7 @@ class ShellInit : Shell.Initializer() { if (isRunningAsStub) { if (!shell.isRoot) return true - val jar = JarFile(DynAPK.current(context)) + val jar = JarFile(StubApk.current(context)) val bb = jar.getJarEntry("lib/${Const.CPU_ABI}/libbusybox.so") localBB = context.deviceProtectedContext.cachedFile("busybox") localBB.delete() diff --git a/stub/src/main/java/com/topjohnwu/magisk/DelegateComponentFactory.java b/stub/src/main/java/com/topjohnwu/magisk/DelegateComponentFactory.java index 776ab3bd6..c2a3ad840 100644 --- a/stub/src/main/java/com/topjohnwu/magisk/DelegateComponentFactory.java +++ b/stub/src/main/java/com/topjohnwu/magisk/DelegateComponentFactory.java @@ -21,7 +21,7 @@ public class DelegateComponentFactory extends AppComponentFactory { @Override public ClassLoader instantiateClassLoader(ClassLoader cl, ApplicationInfo info) { - DynLoad.loadAPK(info); + DynLoad.loadApk(info); return new DelegateClassLoader(); } diff --git a/stub/src/main/java/com/topjohnwu/magisk/DownloadActivity.java b/stub/src/main/java/com/topjohnwu/magisk/DownloadActivity.java index 4ff28a288..4a64737de 100644 --- a/stub/src/main/java/com/topjohnwu/magisk/DownloadActivity.java +++ b/stub/src/main/java/com/topjohnwu/magisk/DownloadActivity.java @@ -115,7 +115,7 @@ public class DownloadActivity extends Activity { finish(); }; // Download and upgrade the app - File apk = dynLoad ? DynAPK.current(this) : new File(getCacheDir(), "manager.apk"); + File apk = dynLoad ? StubApk.current(this) : new File(getCacheDir(), "manager.apk"); request(apkLink).setExecutor(AsyncTask.THREAD_POOL_EXECUTOR).getAsFile(apk, file -> { if (dynLoad) { // TODO @@ -140,7 +140,7 @@ public class DownloadActivity extends Activity { try (is; out) { APKInstall.transfer(is, out); } - DynAPK.addAssetPath(getResources().getAssets(), apk.getPath()); + StubApk.addAssetPath(getResources().getAssets(), apk.getPath()); } catch (Exception ignored) { } } diff --git a/stub/src/main/java/com/topjohnwu/magisk/DynLoad.java b/stub/src/main/java/com/topjohnwu/magisk/DynLoad.java index ba7becee4..6e414a7c9 100644 --- a/stub/src/main/java/com/topjohnwu/magisk/DynLoad.java +++ b/stub/src/main/java/com/topjohnwu/magisk/DynLoad.java @@ -31,7 +31,7 @@ public class DynLoad { // The current active classloader static ClassLoader loader = new RedirectClassLoader(); static Object componentFactory; - static final DynAPK.Data apkData = createApkData(); + static final StubApk.Data apkData = createApkData(); private static boolean loadedApk = false; @@ -46,13 +46,13 @@ public class DynLoad { } // Dynamically load APK from internal or external storage - static void loadAPK(ApplicationInfo info) { + static void loadApk(ApplicationInfo info) { if (loadedApk) return; loadedApk = true; - File apk = DynAPK.current(info); - File update = DynAPK.update(info); + File apk = StubApk.current(info); + File update = StubApk.update(info); if (update.exists()) { // Rename from update @@ -98,8 +98,8 @@ public class DynLoad { // Dynamically load APK, inject ClassLoader into ContextImpl, then // create the non-stub Application instance from the loaded APK static Application createApp(Context context) { - File apk = DynAPK.current(context); - loadAPK(context.getApplicationInfo()); + File apk = StubApk.current(context); + loadApk(context.getApplicationInfo()); // Trigger folder creation context.getExternalFilesDir(null); @@ -193,8 +193,8 @@ public class DynLoad { } } - private static DynAPK.Data createApkData() { - var data = new DynAPK.Data(); + private static StubApk.Data createApkData() { + var data = new StubApk.Data(); data.setVersion(BuildConfig.STUB_VERSION); data.setClassToComponent(Mapping.inverseMap); data.setRootService(DelegateRootService.class);