diff --git a/app/src/main/java/com/topjohnwu/magisk/data/repository/MagiskRepository.kt b/app/src/main/java/com/topjohnwu/magisk/data/repository/MagiskRepository.kt index fe3805ad4..4ab4ec0c6 100644 --- a/app/src/main/java/com/topjohnwu/magisk/data/repository/MagiskRepository.kt +++ b/app/src/main/java/com/topjohnwu/magisk/data/repository/MagiskRepository.kt @@ -1,12 +1,11 @@ package com.topjohnwu.magisk.data.repository import android.content.pm.PackageManager -import com.topjohnwu.magisk.App import com.topjohnwu.magisk.Config import com.topjohnwu.magisk.Info import com.topjohnwu.magisk.data.database.base.su import com.topjohnwu.magisk.data.network.GithubRawServices -import com.topjohnwu.magisk.extensions.inject +import com.topjohnwu.magisk.extensions.packageName import com.topjohnwu.magisk.extensions.toSingle import com.topjohnwu.magisk.model.entity.HideAppInfo import com.topjohnwu.magisk.model.entity.HideTarget @@ -63,8 +62,8 @@ class MagiskRepository( private val Boolean.state get() = if (this) "add" else "rm" companion object { - private val blacklist = listOf( - let { val app: App by inject(); app }.packageName, + private val blacklist by lazy { listOf( + packageName, "android", "com.android.chrome", "com.chrome.beta", @@ -72,7 +71,7 @@ class MagiskRepository( "com.chrome.canary", "com.android.webview", "com.google.android.webview" - ) + ) } } } \ No newline at end of file diff --git a/app/src/main/java/com/topjohnwu/magisk/extensions/XAndroid.kt b/app/src/main/java/com/topjohnwu/magisk/extensions/XAndroid.kt index c6f6a675e..2432c5fc2 100644 --- a/app/src/main/java/com/topjohnwu/magisk/extensions/XAndroid.kt +++ b/app/src/main/java/com/topjohnwu/magisk/extensions/XAndroid.kt @@ -10,16 +10,11 @@ import android.content.pm.PackageManager.* import android.database.Cursor import android.net.Uri import android.provider.OpenableColumns -import com.topjohnwu.magisk.App import com.topjohnwu.magisk.utils.FileProvider import java.io.File import java.io.FileNotFoundException -val packageName: String - get() { - val app: App by inject() - return app.packageName - } +val packageName: String get() = get().packageName val PackageInfo.processes get() = activities?.processNames.orEmpty() + diff --git a/app/src/main/java/com/topjohnwu/magisk/tasks/FlashZip.kt b/app/src/main/java/com/topjohnwu/magisk/tasks/FlashZip.kt index 62951f1f3..3ae10b1a3 100644 --- a/app/src/main/java/com/topjohnwu/magisk/tasks/FlashZip.kt +++ b/app/src/main/java/com/topjohnwu/magisk/tasks/FlashZip.kt @@ -1,8 +1,8 @@ package com.topjohnwu.magisk.tasks +import android.content.Context import android.net.Uri import com.skoumal.teanity.extensions.subscribeK -import com.topjohnwu.magisk.App import com.topjohnwu.magisk.Const import com.topjohnwu.magisk.extensions.fileName import com.topjohnwu.magisk.extensions.inject @@ -20,8 +20,8 @@ abstract class FlashZip( private val logs: MutableList ) { - private val app: App by inject() - private val installFolder = File(app.cacheDir, "flash").apply { + private val context: Context by inject() + private val installFolder = File(context.cacheDir, "flash").apply { if (!exists()) mkdirs() } private val tmpFile: File = File(installFolder, "install.zip") @@ -43,7 +43,7 @@ abstract class FlashZip( console.add("- Copying zip to temp directory") runCatching { - app.readUri(mUri).use { input -> + context.readUri(mUri).use { input -> tmpFile.outputStream().use { out -> input.copyTo(out) } } }.getOrElse {