Fix crash when trying to install/update extensions while shizuku isn't running (#2837)
(cherry picked from commit 4ce249c1a0ee9f3a20d91214fd09145e0924b2e4) # Conflicts: # CHANGELOG.md
This commit is contained in:
@@ -109,9 +109,9 @@ class ShizukuInstaller(private val service: Service) : Installer(service) {
|
|||||||
override fun processEntry(entry: Entry) {
|
override fun processEntry(entry: Entry) {
|
||||||
super.processEntry(entry)
|
super.processEntry(entry)
|
||||||
try {
|
try {
|
||||||
shellInterface?.install(
|
service.contentResolver.openAssetFileDescriptor(entry.uri, "r").use {
|
||||||
service.contentResolver.openAssetFileDescriptor(entry.uri, "r"),
|
shellInterface?.install(it)
|
||||||
)
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
logcat(LogPriority.ERROR, e) { "Failed to install extension ${entry.downloadId} ${entry.uri}" }
|
logcat(LogPriority.ERROR, e) { "Failed to install extension ${entry.downloadId} ${entry.uri}" }
|
||||||
continueQueue(InstallStep.Error)
|
continueQueue(InstallStep.Error)
|
||||||
@@ -124,7 +124,13 @@ class ShizukuInstaller(private val service: Service) : Installer(service) {
|
|||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
Shizuku.removeBinderDeadListener(shizukuDeadListener)
|
Shizuku.removeBinderDeadListener(shizukuDeadListener)
|
||||||
Shizuku.removeRequestPermissionResultListener(shizukuPermissionListener)
|
Shizuku.removeRequestPermissionResultListener(shizukuPermissionListener)
|
||||||
Shizuku.unbindUserService(shizukuArgs, connection, true)
|
if (Shizuku.pingBinder()) {
|
||||||
|
try {
|
||||||
|
Shizuku.unbindUserService(shizukuArgs, connection, true)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
logcat(LogPriority.WARN, e) { "Failed to unbind shizuku service" }
|
||||||
|
}
|
||||||
|
}
|
||||||
service.unregisterReceiver(receiver)
|
service.unregisterReceiver(receiver)
|
||||||
logcat { "ShizukuInstaller destroy" }
|
logcat { "ShizukuInstaller destroy" }
|
||||||
scope.cancel()
|
scope.cancel()
|
||||||
|
|||||||
Reference in New Issue
Block a user