app: Fix DeadObjectException in IPackageManager access (#27)

This commit is contained in:
rhunk
2025-08-28 19:30:08 +05:30
committed by GitHub
parent a758694ceb
commit bcb4531904
@@ -7,6 +7,7 @@ package io.github.beakthoven.TrickyStoreOSS.core.config
import android.content.pm.IPackageManager
import android.os.FileObserver
import android.os.IInterface
import android.os.ServiceManager
import io.github.beakthoven.TrickyStoreOSS.CertificateHacker
import io.github.beakthoven.TrickyStoreOSS.core.logging.Logger
@@ -128,7 +129,7 @@ object Config {
private var iPm: IPackageManager? = null
fun getPm(): IPackageManager? {
if (iPm == null) {
if (iPm == null || (iPm as? IInterface)?.asBinder()?.pingBinder() != true) {
iPm = IPackageManager.Stub.asInterface(ServiceManager.getService("package"))
}
return iPm