Fix extension installation with shizuku (#3630)
* Fix extension installation with shizuku * Changelog * Move changelog to end
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package eu.kanade.tachiyomi.extension.installer
|
||||
|
||||
import android.app.PendingIntent
|
||||
import android.app.Service
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.ComponentName
|
||||
@@ -39,6 +40,7 @@ class ShizukuInstaller(private val service: Service) : Installer(service) {
|
||||
.processNameSuffix("shizuku_service")
|
||||
.debuggable(BuildConfig.DEBUG)
|
||||
.daemon(false)
|
||||
.version(2)
|
||||
}
|
||||
|
||||
private val connection = object : ServiceConnection {
|
||||
@@ -53,6 +55,13 @@ class ShizukuInstaller(private val service: Service) : Installer(service) {
|
||||
}
|
||||
}
|
||||
|
||||
private val statusIntent = PendingIntent.getBroadcast(
|
||||
service.applicationContext,
|
||||
0,
|
||||
Intent(ACTION_INSTALL_RESULT).setPackage(BuildConfig.APPLICATION_ID),
|
||||
PendingIntent.FLAG_MUTABLE,
|
||||
)
|
||||
|
||||
private val receiver = object : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
val status = intent.getIntExtra(PackageInstaller.EXTRA_STATUS, Int.MIN_VALUE)
|
||||
@@ -110,7 +119,7 @@ class ShizukuInstaller(private val service: Service) : Installer(service) {
|
||||
super.processEntry(entry)
|
||||
try {
|
||||
service.contentResolver.openAssetFileDescriptor(entry.uri, "r").use {
|
||||
shellInterface?.install(it)
|
||||
shellInterface?.install(it, statusIntent.intentSender)
|
||||
}
|
||||
service.contentResolver.delete(entry.uri, null, null)
|
||||
} catch (e: Exception) {
|
||||
|
||||
Reference in New Issue
Block a user