From 91070b7d12472a1bf2a286a2a81307c3fc7a8f8e Mon Sep 17 00:00:00 2001 From: Tim Schneeberger Date: Tue, 1 Aug 2023 15:35:43 +0200 Subject: [PATCH] fix(root): Fixed crash on broken MIUI systems when attempting to install update APK --- .../flavor/updates/SessionInstallerService.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/root/java/me/timschneeberger/rootlessjamesdsp/flavor/updates/SessionInstallerService.kt b/app/src/root/java/me/timschneeberger/rootlessjamesdsp/flavor/updates/SessionInstallerService.kt index a442d78cd..f1c6e4c9c 100644 --- a/app/src/root/java/me/timschneeberger/rootlessjamesdsp/flavor/updates/SessionInstallerService.kt +++ b/app/src/root/java/me/timschneeberger/rootlessjamesdsp/flavor/updates/SessionInstallerService.kt @@ -1,6 +1,7 @@ package me.timschneeberger.rootlessjamesdsp.flavor.updates import android.app.Service +import android.content.ActivityNotFoundException import android.content.Intent import android.content.pm.PackageInstaller import android.os.IBinder @@ -27,7 +28,12 @@ class SessionInstallerService : Service() { it.putExtra(Intent.EXTRA_INSTALLER_PACKAGE_NAME, "com.android.vending") it.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) - startActivity(it) + try { + startActivity(it) + } + catch (ex: ActivityNotFoundException) { + toast(R.string.no_activity_found) + } } } else { notifyStatus(intent)