Suppress more DeadObjectException

This commit is contained in:
Mygod
2022-09-24 19:21:29 -04:00
parent 1ca61eb5a7
commit 28b1a1a0fc

View File

@@ -10,6 +10,7 @@ import android.content.pm.PackageManager
import android.net.ConnectivityManager
import android.net.Network
import android.os.Build
import android.os.DeadObjectException
import android.os.Handler
import androidx.annotation.RequiresApi
import androidx.core.os.ExecutorCompat
@@ -583,7 +584,11 @@ object TetheringManager {
@RequiresApi(30)
fun unregisterTetheringEventCallback(callback: TetheringEventCallback) {
val proxy = synchronized(callbackMap) { callbackMap.remove(callback) } ?: return
unregisterTetheringEventCallback(instance, proxy)
try {
unregisterTetheringEventCallback(instance, proxy)
} catch (e: InvocationTargetException) {
if (!e.targetException.let { it is IllegalStateException && it.cause is DeadObjectException }) throw e
}
}
/**