writeTo has closed InputStream
This commit is contained in:
parent
4ea5f34bf3
commit
96405c26d0
@ -37,7 +37,7 @@ suspend fun BaseDownloader.handleAPK(subject: Subject.Manager) {
|
|||||||
if (Info.stubChk.version < subject.stub.versionCode) {
|
if (Info.stubChk.version < subject.stub.versionCode) {
|
||||||
notifyHide(id)
|
notifyHide(id)
|
||||||
// Also upgrade stub
|
// Also upgrade stub
|
||||||
service.fetchFile(subject.stub.link).byteStream().use { it.writeTo(apk) }
|
service.fetchFile(subject.stub.link).byteStream().writeTo(apk)
|
||||||
patch(apk)
|
patch(apk)
|
||||||
} else {
|
} else {
|
||||||
// Simply relaunch the app
|
// Simply relaunch the app
|
||||||
|
@ -94,9 +94,7 @@ object HideAPK {
|
|||||||
val src = if (!isRunningAsStub && SDK_INT >= 28) {
|
val src = if (!isRunningAsStub && SDK_INT >= 28) {
|
||||||
val stub = File(context.cacheDir, "stub.apk")
|
val stub = File(context.cacheDir, "stub.apk")
|
||||||
try {
|
try {
|
||||||
svc.fetchFile(Info.remote.stub.link).byteStream().use {
|
svc.fetchFile(Info.remote.stub.link).byteStream().writeTo(stub)
|
||||||
it.writeTo(stub)
|
|
||||||
}
|
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
Timber.e(e)
|
Timber.e(e)
|
||||||
return false
|
return false
|
||||||
@ -150,9 +148,7 @@ object HideAPK {
|
|||||||
} else {
|
} else {
|
||||||
File(context.cacheDir, "manager.apk").also { apk ->
|
File(context.cacheDir, "manager.apk").also { apk ->
|
||||||
try {
|
try {
|
||||||
svc.fetchFile(Info.remote.app.link).byteStream().use {
|
svc.fetchFile(Info.remote.app.link).byteStream().writeTo(apk)
|
||||||
it.writeTo(apk)
|
|
||||||
}
|
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
Timber.e(e)
|
Timber.e(e)
|
||||||
return false
|
return false
|
||||||
|
@ -140,14 +140,14 @@ abstract class MagiskInstallImpl protected constructor(
|
|||||||
// Extract scripts
|
// Extract scripts
|
||||||
for (script in listOf("util_functions.sh", "boot_patch.sh", "addon.d.sh")) {
|
for (script in listOf("util_functions.sh", "boot_patch.sh", "addon.d.sh")) {
|
||||||
val dest = File(binDir, script)
|
val dest = File(binDir, script)
|
||||||
context.assets.open(script).use { it.writeTo(dest) }
|
context.assets.open(script).writeTo(dest)
|
||||||
}
|
}
|
||||||
// Extract chromeos tools
|
// Extract chromeos tools
|
||||||
File(binDir, "chromeos").mkdir()
|
File(binDir, "chromeos").mkdir()
|
||||||
for (file in listOf("futility", "kernel_data_key.vbprivk", "kernel.keyblock")) {
|
for (file in listOf("futility", "kernel_data_key.vbprivk", "kernel.keyblock")) {
|
||||||
val name = "chromeos/$file"
|
val name = "chromeos/$file"
|
||||||
val dest = File(binDir, name)
|
val dest = File(binDir, name)
|
||||||
context.assets.open(name).use { it.writeTo(dest) }
|
context.assets.open(name).writeTo(dest)
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
console.add("! Unable to extract files")
|
console.add("! Unable to extract files")
|
||||||
|
Loading…
Reference in New Issue
Block a user