aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/java/com/android/ims/MmTelFeatureConnection.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/java/com/android/ims/MmTelFeatureConnection.java b/src/java/com/android/ims/MmTelFeatureConnection.java
index ea7aad06..12f55ef6 100644
--- a/src/java/com/android/ims/MmTelFeatureConnection.java
+++ b/src/java/com/android/ims/MmTelFeatureConnection.java
@@ -431,8 +431,15 @@ public class MmTelFeatureConnection {
private IImsRegistration mRegistrationBinder;
private IImsConfig mConfigBinder;
- private IBinder.DeathRecipient mDeathRecipient = () -> {
+ private final IBinder.DeathRecipient mDeathRecipient = () -> {
Log.w(TAG, "DeathRecipient triggered, binder died.");
+ if (mContext != null && Looper.getMainLooper() != null) {
+ // Move this signal to the main thread, notifying ImsManager of the Binder
+ // death on another thread may lead to deadlocks.
+ mContext.getMainExecutor().execute(this::onRemovedOrDied);
+ return;
+ }
+ // No choice - execute on the current Binder thread.
onRemovedOrDied();
};