mirror of
https://github.com/mihonapp/mihon.git
synced 2024-12-25 18:38:23 +01:00
Fix shizuku being buggy for multi user setups (#494)
* Fix #493 Fetch the current userid separately because shizuku always runs as the main user and would otherwise install and update for the main user * Update app/src/main/java/eu/kanade/tachiyomi/extension/installer/ShizukuInstaller.kt --------- Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com>
This commit is contained in:
parent
d0e64d3a66
commit
402e579a69
@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.extension.installer
|
||||
|
||||
import android.app.Service
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Process
|
||||
import eu.kanade.tachiyomi.extension.model.InstallStep
|
||||
import eu.kanade.tachiyomi.util.system.getUriSize
|
||||
import eu.kanade.tachiyomi.util.system.toast
|
||||
@ -49,7 +50,8 @@ class ShizukuInstaller(private val service: Service) : Installer(service) {
|
||||
try {
|
||||
val size = service.getUriSize(entry.uri) ?: throw IllegalStateException()
|
||||
service.contentResolver.openInputStream(entry.uri)!!.use {
|
||||
val createCommand = "pm install-create --user current -r -i ${service.packageName} -S $size"
|
||||
val userId = Process.myUserHandle().hashCode()
|
||||
val createCommand = "pm install-create --user $userId -r -i ${service.packageName} -S $size"
|
||||
val createResult = exec(createCommand)
|
||||
sessionId = SESSION_ID_REGEX.find(createResult.out)?.value
|
||||
?: throw RuntimeException("Failed to create install session")
|
||||
|
Loading…
Reference in New Issue
Block a user