Minor cleanup

This commit is contained in:
arkon
2022-11-27 17:05:04 -05:00
parent 5076ab3049
commit 3480b45098
14 changed files with 74 additions and 91 deletions

View File

@@ -20,7 +20,7 @@ import java.io.InputStream
class ShizukuInstaller(private val service: Service) : Installer(service) {
private val ioScope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
private val shizukuDeadListener = Shizuku.OnBinderDeadListener {
logcat { "Shizuku was killed prematurely" }
@@ -46,7 +46,7 @@ class ShizukuInstaller(private val service: Service) : Installer(service) {
@Suppress("BlockingMethodInNonBlockingContext")
override fun processEntry(entry: Entry) {
super.processEntry(entry)
ioScope.launch {
scope.launch {
var sessionId: String? = null
try {
val size = service.getUriSize(entry.uri) ?: throw IllegalStateException()
@@ -88,7 +88,7 @@ class ShizukuInstaller(private val service: Service) : Installer(service) {
override fun onDestroy() {
Shizuku.removeBinderDeadListener(shizukuDeadListener)
Shizuku.removeRequestPermissionResultListener(shizukuPermissionListener)
ioScope.cancel()
scope.cancel()
super.onDestroy()
}
@@ -116,7 +116,7 @@ class ShizukuInstaller(private val service: Service) : Installer(service) {
false
}
} else {
logcat(LogPriority.ERROR) { "Shizuku is not ready to use." }
logcat(LogPriority.ERROR) { "Shizuku is not ready to use" }
service.toast(R.string.ext_installer_shizuku_stopped)
service.stopSelf()
false