Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9c8d0832 authored by Brad Ebinger's avatar Brad Ebinger
Browse files

Move MmTelFeatureConnection DeathRecipient to the Main Thread

The DeathRecipient callback was being called on a binder, which
in some cases, caused the Framework to deadlock. Moved the
callback to the main thread.

Bug: 120151611
Test: install ImsTestApp test app, set as ImsService, kill app
Change-Id: I85d303a51dcc5fb5068b12a7c057f22def2473ee
parent 72d7bcb8
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -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();
    };