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

Commit 1f700c40 authored by Grant Menke's avatar Grant Menke Committed by Automerger Merge Worker
Browse files

Ensure connection is unbound on call redirection timeout. am: 9733de49

parents 887be4a1 9733de49
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -133,6 +133,14 @@ public class CallRedirectionProcessor implements CallRedirectionCallback {
                            + mServiceType + " call redirection service");
                }
            }
            Log.i(this, "notifyTimeout: call redirection has timed out so "
                    + "unbinding the connection");
            if (mConnection != null) {
                // We still need to call unbind even if the service disconnected.
                mContext.unbindService(mConnection);
                mConnection = null;
            }
            mService = null;
        }

        private class CallRedirectionServiceConnection implements ServiceConnection {
+12 −0
Original line number Diff line number Diff line
@@ -221,6 +221,9 @@ public class CallRedirectionProcessorTest extends TelecomTestCase {
        verify(mCallsManager, times(1)).onCallRedirectionComplete(eq(mCall), any(),
                eq(mPhoneAccountHandle), eq(null), eq(SPEAKER_PHONE_ON), eq(VIDEO_STATE),
                eq(false), eq(CallRedirectionProcessor.UI_TYPE_NO_ACTION));
        // Verify service was unbound
        verify(mContext, times(1)).
                unbindService(any(ServiceConnection.class));
    }

    @Test
@@ -249,6 +252,9 @@ public class CallRedirectionProcessorTest extends TelecomTestCase {
        verify(mCallsManager, times(1)).onCallRedirectionComplete(eq(mCall), any(),
                eq(mPhoneAccountHandle), eq(null), eq(SPEAKER_PHONE_ON), eq(VIDEO_STATE),
                eq(true), eq(CallRedirectionProcessor.UI_TYPE_USER_DEFINED_TIMEOUT));
        // Verify service was unbound
        verify(mContext, times(1)).
                unbindService(any(ServiceConnection.class));
    }

    @Test
@@ -280,6 +286,9 @@ public class CallRedirectionProcessorTest extends TelecomTestCase {
        verify(mCallsManager, times(1)).onCallRedirectionComplete(eq(mCall), any(),
                eq(mPhoneAccountHandle), eq(null), eq(SPEAKER_PHONE_ON), eq(VIDEO_STATE),
                eq(true), eq(CallRedirectionProcessor.UI_TYPE_USER_DEFINED_TIMEOUT));
        // Verify service was unbound
        verify(mContext, times(1)).
                unbindService(any(ServiceConnection.class));

        // Wait for another carrier timeout time, but should not expect any carrier service request
        // is triggered.
@@ -289,6 +298,9 @@ public class CallRedirectionProcessorTest extends TelecomTestCase {
        verify(mCallsManager, times(1)).onCallRedirectionComplete(eq(mCall), any(),
                eq(mPhoneAccountHandle), eq(null), eq(SPEAKER_PHONE_ON), eq(VIDEO_STATE),
                eq(true), eq(CallRedirectionProcessor.UI_TYPE_USER_DEFINED_TIMEOUT));
        // Verify service was unbound
        verify(mContext, times(1)).
                unbindService(any(ServiceConnection.class));
    }

    @Test