mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-24 21:37:39 +00:00
Remove unnecessary App usage
This commit is contained in:
parent
010e4de4e1
commit
223913c30a
@ -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"
|
||||
)
|
||||
) }
|
||||
}
|
||||
|
||||
}
|
@ -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<Context>().packageName
|
||||
|
||||
val PackageInfo.processes
|
||||
get() = activities?.processNames.orEmpty() +
|
||||
|
@ -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<String>
|
||||
) {
|
||||
|
||||
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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user