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

Commit dafe17e6 authored by Hyunho Shin's avatar Hyunho Shin Committed by Hyunho
Browse files

Revert "Interworking between CallWaitingController and SsDomainController"

This reverts commit b91f7a2f.

Reason for revert: UT domain selection should go back to legacy.

Change-Id: I25a78174d5ff1f1c54fe8a9d8f0053668d0730b3
parent ddd03960
Loading
Loading
Loading
Loading
+0 −41
Original line number Diff line number Diff line
@@ -2282,24 +2282,6 @@ public class GsmCdmaPhone extends Phone {
        return false;
    }

    /**
     * Checks the availability of Ut directly without SsDomainController.
     * This is only applicable for the case that the terminal-based call waiting service
     * is handled by the IMS service alone without interworking with CallWaitingController.
     */
    private boolean useCallWaitingOverUt(Message onComplete) {
        Phone imsPhone = mImsPhone;
        if (imsPhone == null) {
            logd("useCallWaitingOverUt: called for GsmCdma");
            return false;
        }

        boolean isUtEnabled = imsPhone.isUtEnabled();
        Rlog.d(LOG_TAG, "useCallWaitingOverUt isUtEnabled= " + isUtEnabled
                + " isCsRetry(onComplete))= " + isCsRetry(onComplete));
        return isUtEnabled && !isCsRetry(onComplete);
    }

    /**
     * Returns whether CSFB is supported for supplementary services.
     */
@@ -2307,14 +2289,6 @@ public class GsmCdmaPhone extends Phone {
        return mSsDomainController.supportCsfb();
    }

    /**
     * Returns whether the carrier supports the terminal-based call waiting service
     * and Ims service handles it by itself.
     */
    private boolean getOemHandlesTerminalBasedCallWaiting() {
        return mSsDomainController.getOemHandlesTerminalBasedCallWaiting();
    }

    /**
     * Sends response indicating no nework is available for supplementary services.
     */
@@ -2674,13 +2648,6 @@ public class GsmCdmaPhone extends Phone {
                responseInvalidState(onComplete);
                return;
            }
        } else if (getOemHandlesTerminalBasedCallWaiting()) {
            // Ims service handles the terminal-based call waiting service by itself.
            // Use legacy implementation. Forward the request to Ims service if Ut is available.
            if (useCallWaitingOverUt(onComplete)) {
                imsPhone.getCallWaiting(onComplete);
                return;
            }
        }

        if (isPhoneTypeGsm()) {
@@ -2739,13 +2706,6 @@ public class GsmCdmaPhone extends Phone {
                responseInvalidState(onComplete);
                return;
            }
        } else if (getOemHandlesTerminalBasedCallWaiting()) {
            // Ims service handles the terminal-based call waiting service by itself.
            // Use legacy implementation. Forward the request to Ims service if Ut is available.
            if (useCallWaitingOverUt(onComplete)) {
                imsPhone.setCallWaiting(enable, onComplete);
                return;
            }
        }

        if (isPhoneTypeGsm()) {
@@ -2786,7 +2746,6 @@ public class GsmCdmaPhone extends Phone {
    @Override
    public void setTerminalBasedCallWaitingSupported(boolean supported) {
        mCallWaitingController.setTerminalBasedCallWaitingSupported(supported);
        mSsDomainController.setOemHandlesTerminalBasedCallWaiting(!supported);
    }

    @Override
+14 −49
Original line number Diff line number Diff line
@@ -127,6 +127,10 @@ public class SsDomainController {
    public static final String SS_COLP = "COLP";
    public static final String SS_COLR = "COLR";

    // Common instance indicating that Ut is available.
    public static final SuppServiceRoutingInfo SS_ROUTING_OVER_UT =
            new SuppServiceRoutingInfo(true, true, true);

    // Barring list of incoming numbers
    public static final String CB_FACILITY_BIL = "BIL";
    // Barring of all anonymous incoming number
@@ -170,9 +174,6 @@ public class SsDomainController {
    private Set<Integer> mUtAvailableRats = new HashSet<>();
    private boolean mWiFiAvailable = false;
    private boolean mIsMonitoringConnectivity = false;
    /** true if Ims service handles the terminal-based call waiting service by itself. */
    private boolean mOemHandlesTerminalBasedCallWaiting = false;
    private boolean mSupportsTerminalBasedCallWaiting = false;

    public SsDomainController(GsmCdmaPhone phone) {
        mPhone = phone;
@@ -203,16 +204,13 @@ public class SsDomainController {
        int[] utRats = b.getIntArray(
                CarrierConfigManager.ImsSs.KEY_XCAP_OVER_UT_SUPPORTED_RATS_INT_ARRAY);

        int[] tbServices = b.getIntArray(
                CarrierConfigManager.ImsSs.KEY_UT_TERMINAL_BASED_SERVICES_INT_ARRAY);

        updateSsOverUtConfig(supportsUt, supportsCsfb, requiresImsRegistration,
                availableWhenPsDataOff, availableWhenRoaming, services, utRats, tbServices);
                availableWhenPsDataOff, availableWhenRoaming, services, utRats);
    }

    private void updateSsOverUtConfig(boolean supportsUt, boolean supportsCsfb,
            boolean requiresImsRegistration, boolean availableWhenPsDataOff,
            boolean availableWhenRoaming, int[] services, int[] utRats, int[] tbServices) {
            boolean availableWhenRoaming, int[] services, int[] utRats) {

        mUtSupported = supportsUt;
        mCsfbSupported = supportsCsfb;
@@ -220,6 +218,7 @@ public class SsDomainController {
        mUtAvailableWhenPsDataOff = availableWhenPsDataOff;
        mUtAvailableWhenRoaming = availableWhenRoaming;


        mSupportsTerminalBasedCallWaiting = false;
        if (tbServices != null) {
            for (int tbService : tbServices) {
@@ -232,6 +231,7 @@ public class SsDomainController {
        logi("updateSsOverUtConfig terminal-based cw "
                + mSupportsTerminalBasedCallWaiting);


        mCbOverUtSupported.clear();
        mCfOverUtSupported.clear();
        mSsOverUtSupported.clear();
@@ -535,24 +535,9 @@ public class SsDomainController {
     * Only for ImsPhoneMmiCode.
     */
    public SuppServiceRoutingInfo getSuppServiceRoutingInfoForSs(String service) {
        if (SS_CW.equals(service) && getOemHandlesTerminalBasedCallWaiting()) {
            // Ims service handles the terminal based call waiting service by itself.
            // Use legacy implementation. Forward the request to Ims service if Ut is available.
            Phone imsPhone = mPhone.getImsPhone();
            boolean isUtEnabled = (imsPhone != null) && imsPhone.isUtEnabled();
            return new SuppServiceRoutingInfo(true, isUtEnabled, true);
        }
        return new SuppServiceRoutingInfo(useSsOverUt(service), isUtEnabled(), supportCsfb());
    }

    /**
     * Returns SuppServiceRoutingInfo instance for a service will be served by Ut interface.
     * Only for ImsPhoneMmiCode.
     */
    public SuppServiceRoutingInfo getSsRoutingOverUt() {
        return new SuppServiceRoutingInfo(true, isUtEnabled(), true);
    }

    /**
     * Set the carrier configuration for test.
     * Test purpose only.
@@ -560,37 +545,19 @@ public class SsDomainController {
    @VisibleForTesting
    public void updateCarrierConfigForTest(boolean supportsUt, boolean supportsCsfb,
            boolean requiresImsRegistration, boolean availableWhenPsDataOff,
            boolean availableWhenRoaming, int[] services, int[] utRats, int[] tbServices) {
        logi("updateCarrierConfigForTest supportsUt=" + supportsUt

            boolean availableWhenRoaming, int[] services, int[] utRats) {
        Rlog.i(LOG_TAG, "updateCarrierConfigForTest supportsUt=" + supportsUt

                +  ", csfb=" + supportsCsfb
                + ", reg=" + requiresImsRegistration
                + ", whenPsDataOff=" + availableWhenPsDataOff
                + ", whenRoaming=" + availableWhenRoaming
                + ", services=" + Arrays.toString(services)
                + ", rats=" + Arrays.toString(utRats)
                + ", tbServices=" + Arrays.toString(tbServices));
                + ", rats=" + Arrays.toString(utRats));

        updateSsOverUtConfig(supportsUt, supportsCsfb, requiresImsRegistration,
                availableWhenPsDataOff, availableWhenRoaming, services, utRats, tbServices);
    }

    /**
     * @param state true if Ims service handles the terminal-based call waiting service by itself.
     *              Otherwise, false.
     */
    public void setOemHandlesTerminalBasedCallWaiting(boolean state) {
        logi("setOemHandlesTerminalBasedCallWaiting " + state);
        mOemHandlesTerminalBasedCallWaiting = state;
    }

    /**
     * Returns whether the carrier supports the terminal-based call waiting service
     * and Ims service handles it by itself.
     */
    public boolean getOemHandlesTerminalBasedCallWaiting() {
        logi("getOemHandlesTerminalBasedCallWaiting "
                + mSupportsTerminalBasedCallWaiting + ", " + mOemHandlesTerminalBasedCallWaiting);
        return mSupportsTerminalBasedCallWaiting && mOemHandlesTerminalBasedCallWaiting;
                availableWhenPsDataOff, availableWhenRoaming, services, utRats);
    }

    /**
@@ -610,8 +577,6 @@ public class SsDomainController {
        pw.println(" mUtAvailableWhenRoaming=" + mUtAvailableWhenRoaming);
        pw.println(" mUtAvailableRats=" + mUtAvailableRats);
        pw.println(" mWiFiAvailable=" + mWiFiAvailable);
        pw.println(" mOemHandlesTerminalBasedCallWaiting=" + mOemHandlesTerminalBasedCallWaiting);
        pw.println(" mSupportsTerminalBasedCallWaiting=" + mSupportsTerminalBasedCallWaiting);
        pw.decreaseIndent();
    }

+4 −4
Original line number Diff line number Diff line
@@ -542,7 +542,7 @@ public final class ImsPhoneMmiCode extends Handler implements MmiCode {
                return controller.getSuppServiceRoutingInfoForCb(scToBarringFacility(sc));
            } else if (sc != null && sc.equals(SC_CFUT)) {
                // for backward compatibility, not specified by CarrierConfig
                return controller.getSsRoutingOverUt();
                return SsDomainController.SS_ROUTING_OVER_UT;
            } else if (sc != null && sc.equals(SC_CLIP)) {
                return controller.getSuppServiceRoutingInfoForSs(SS_CLIP);
            } else if (sc != null && sc.equals(SC_CLIR)) {
@@ -553,7 +553,7 @@ public final class ImsPhoneMmiCode extends Handler implements MmiCode {
                return controller.getSuppServiceRoutingInfoForSs(SS_COLR);
            } else if (sc != null && sc.equals(SC_CNAP)) {
                // for backward compatibility, not specified by CarrierConfig
                return controller.getSsRoutingOverUt();
                return SsDomainController.SS_ROUTING_OVER_UT;
            } else if (sc != null && sc.equals(SC_BS_MT)) {
                return controller.getSuppServiceRoutingInfoForCb(
                        SsDomainController.CB_FACILITY_BIL);
@@ -562,12 +562,12 @@ public final class ImsPhoneMmiCode extends Handler implements MmiCode {
                        SsDomainController.CB_FACILITY_ACR);
            } else if (sc != null && sc.equals(SC_PWD)) {
                // for backward compatibility, not specified by CarrierConfig
                return controller.getSsRoutingOverUt();
                return SsDomainController.SS_ROUTING_OVER_UT;
            } else if (sc != null && sc.equals(SC_WAIT)) {
                return controller.getSuppServiceRoutingInfoForSs(SS_CW);
            } else if (isPinPukCommand(sc)) {
                // for backward compatibility, not specified by CarrierConfig
                return controller.getSsRoutingOverUt();
                return SsDomainController.SS_ROUTING_OVER_UT;
            }
        }
        return null;
+0 −28
Original line number Diff line number Diff line
@@ -2229,32 +2229,4 @@ public class GsmCdmaPhoneTest extends TelephonyTest {
        mPhoneUT.setCallWaiting(false, CommandsInterface.SERVICE_CLASS_VOICE, null);
        verify(mImsPhone, times(1)).setCallWaiting(eq(false), any());
    }

    @Test
    @SmallTest
    public void testOemHandlesTerminalBasedCallWaiting() throws Exception {
        doReturn(true).when(mImsPhone).isUtEnabled();
        replaceInstance(Phone.class, "mImsPhone", mPhoneUT, mImsPhone);

        // Ut is disabled in config
        doReturn(false).when(mSsDomainController).useSsOverUt(anyString());
        doReturn(false).when(mSsDomainController).getOemHandlesTerminalBasedCallWaiting();

        replaceInstance(GsmCdmaPhone.class, "mSsDomainController", mPhoneUT, mSsDomainController);

        mPhoneUT.getCallWaiting(null);
        verify(mImsPhone, times(0)).getCallWaiting(any());

        mPhoneUT.setCallWaiting(false, CommandsInterface.SERVICE_CLASS_VOICE, null);
        verify(mImsPhone, times(0)).setCallWaiting(eq(false), any());

        // OEM handles the terminal-based call waiting service by itself.
        doReturn(true).when(mSsDomainController).getOemHandlesTerminalBasedCallWaiting();

        mPhoneUT.getCallWaiting(null);
        verify(mImsPhone, times(1)).getCallWaiting(any());

        mPhoneUT.setCallWaiting(false, CommandsInterface.SERVICE_CLASS_VOICE, null);
        verify(mImsPhone, times(1)).setCallWaiting(eq(false), any());
    }
}
+2 −25
Original line number Diff line number Diff line
@@ -430,29 +430,6 @@ public class SsDomainControllerTest extends TelephonyTest {
        assertFalse(mSdc.isUtEnabled());
    }

    @Test
    @SmallTest
    public void testOemHandlesTerminalBasedCallWaiting() {
        setUtEnabled();

        // Enable terminal-based call waiting
        mSdc.updateCarrierConfigForTest(true, true, false, true, true,
                new int[] {}, UT_OVER_ALL, new int[] { SUPPLEMENTARY_SERVICE_CW });
        String sc = mServices.get(SS_CW);

        mSdc.setOemHandlesTerminalBasedCallWaiting(false);
        SsDomainController.SuppServiceRoutingInfo ssCode =
                ImsPhoneMmiCode.getSuppServiceRoutingInfo("*#" + sc + "#", mSdc);
        assertNotNull(ssCode);
        assertFalse(ssCode.useSsOverUt());

        mSdc.setOemHandlesTerminalBasedCallWaiting(true);
        ssCode = ImsPhoneMmiCode.getSuppServiceRoutingInfo("*#" + sc + "#", mSdc);

        assertNotNull(ssCode);
        assertTrue(ssCode.useSsOverUt());
    }

    private void setUtEnabled() {
        doReturn(0).when(mImsPhone).getSubId();
        mSdc.updateWifiForUt(false);
@@ -489,10 +466,10 @@ public class SsDomainControllerTest extends TelephonyTest {
    private void updateCarrierConfig(boolean supportsCsfb, boolean requiresImsRegistration,
            boolean availableWhenPsDataOff, boolean availableWhenRoaming, int[] utRats) {
        mSdc.updateCarrierConfigForTest(true, supportsCsfb, requiresImsRegistration,
                availableWhenPsDataOff, availableWhenRoaming, null, utRats, null);
                availableWhenPsDataOff, availableWhenRoaming, null, utRats);
    }

    private void updateCarrierConfig(int[] services) {
        mSdc.updateCarrierConfigForTest(true, true, false, true, true, services, UT_OVER_ALL, null);
        mSdc.updateCarrierConfigForTest(true, true, false, true, true, services, UT_OVER_ALL);
    }
}