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

Commit f65f0905 authored by sqian's avatar sqian Committed by Shuo Qian
Browse files

Carrier and User-defined call redirection interaction

a) place Carrier call redirection if the intent contains gateway.

b) Telecom should pop out the dialog to users only if: 1) there is
no available carrier redirection service, or 2) there is an available
carrier redirection service, but carrier one does not redirect the call,
and but tells Telecom to place the call unmodified.

Test: Treehugger; manual
Bug: 130193841
Change-Id: I3d44d4666786e7d7b3c7c2bc9bf8f4daa3d3924b
parent 3221273d
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -197,9 +197,11 @@ public class CallRedirectionProcessor implements CallRedirectionCallback {
                                .getGatewayInfoFromGatewayUri(mComponentName.getPackageName(),
                                        gatewayUri, mDestinationUri);
                        mPhoneAccountHandle = targetPhoneAccount;
                        // If carrier redirects call, we should skip to notify users about
                        // the user-defined call redirection service.
                        mUiAction = (confirmFirst && mServiceType.equals(SERVICE_TYPE_USER_DEFINED)
                                && mAllowInteractiveResponse)
                                ? UI_TYPE_USER_DEFINED_ASK_FOR_CONFIRM : mUiAction;
                                ? UI_TYPE_USER_DEFINED_ASK_FOR_CONFIRM : UI_TYPE_NO_ACTION;
                        Log.d(this, "Received redirectCall with [gatewayUri]"
                                + Log.pii(gatewayUri) + " [phoneAccountHandle]"
                                + mPhoneAccountHandle + "[confirmFirst]" + confirmFirst + " from "
@@ -324,11 +326,9 @@ public class CallRedirectionProcessor implements CallRedirectionCallback {
     * The entry to perform call redirection of the call from (@link CallsManager)
     */
    public void performCallRedirection() {
        // If the Gateway Info is set with intent, do not request more call redirection.
        // If the Gateway Info is set with intent, only request with carrier call redirection.
        if (mRedirectionGatewayInfo != null) {
            mCallsManager.onCallRedirectionComplete(mCall, mDestinationUri, mPhoneAccountHandle,
                    mRedirectionGatewayInfo, mSpeakerphoneOn, mVideoState, mShouldCancelCall,
                    mUiAction);
            performCarrierCallRedirection();
        } else {
            performUserDefinedCallRedirection();
        }
+6 −1
Original line number Diff line number Diff line
@@ -269,8 +269,13 @@ public class CallRedirectionProcessorTest extends TelecomTestCase {
        enableUserDefinedCallRedirectionService();
        enableCarrierCallRedirectionService();
        mProcessor.performCallRedirection();
        verify(mContext, times(0)).bindServiceAsUser(any(Intent.class),
        verify(mContext, times(1)).bindServiceAsUser(any(Intent.class),
                any(ServiceConnection.class), anyInt(), any(UserHandle.class));
        verify(mCallsManager, times(0)).onCallRedirectionComplete(eq(mCall), any(),
                eq(mPhoneAccountHandle), eq(null), eq(SPEAKER_PHONE_ON), eq(VIDEO_STATE),
                eq(false), eq(CallRedirectionProcessor.UI_TYPE_NO_ACTION));
        waitForHandlerActionDelayed(mProcessor.getHandler(), HANDLER_TIMEOUT_DELAY,
                CARRIER_SHORT_TIMEOUT_MS + CODE_EXECUTION_DELAY);
        verify(mCallsManager, times(1)).onCallRedirectionComplete(eq(mCall), eq(mHandle),
                eq(mPhoneAccountHandle), eq(mGatewayInfo), eq(SPEAKER_PHONE_ON), eq(VIDEO_STATE),
                eq(false), eq(CallRedirectionProcessor.UI_TYPE_NO_ACTION));