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

Commit 7fd0c664 authored by Tyler Gunn's avatar Tyler Gunn Committed by Automerger Merge Worker
Browse files

Merge "Remap no sim and no service call fail causes to valid telephony codes."...

Merge "Remap no sim and no service call fail causes to valid telephony codes." into tm-qpr-dev am: 07b0164f

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/19271313



Change-Id: I66f85b80f3aa851f4cfd92969c0c56bdc975dff4
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents b779816e 07b0164f
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -478,7 +478,7 @@ public class GsmCdmaConnection extends Connection {
     * @return the corresponding value from {@link DisconnectCause}
     */
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    int disconnectCauseFromCode(int causeCode) {
    public int disconnectCauseFromCode(int causeCode) {
        /**
         * See 22.001 Annex F.4 for mapping of cause codes
         * to local tones
@@ -565,6 +565,14 @@ public class GsmCdmaConnection extends Connection {
            case CallFailCause.RADIO_OFF:
                return DisconnectCause.POWER_OFF;

            case CallFailCause.NO_VALID_SIM:
                return DisconnectCause.ICC_ERROR;

            case CallFailCause.LOCAL_NETWORK_NO_SERVICE:
                // fallthrough
            case CallFailCause.LOCAL_SERVICE_UNAVAILABLE:
                return DisconnectCause.OUT_OF_SERVICE;

            case CallFailCause.ACCESS_CLASS_BLOCKED:
            case CallFailCause.ERROR_UNSPECIFIED:
            case CallFailCause.NORMAL_CLEARING:
+17 −0
Original line number Diff line number Diff line
@@ -295,4 +295,21 @@ public class GsmCdmaConnectionTest extends TelephonyTest {
        connection.update(mDC);
        assertNull(connection.getForwardedNumber());
    }

    /**
     * Verifies that the mappings for CallFailCause.NO_VALID_SIM,
     * CallFailCause.LOCAL_NETWORK_NO_SERVICE, and CallFailCause.LOCAL_SERVICE_UNAVAILABLE are as
     * expected.
     */
    @Test @SmallTest
    public void testNoSimNoServiceMapping() {
        connection = new GsmCdmaConnection(mPhone, "12345", mCT, null,
                new DialArgs.Builder().build());
        assertEquals(DisconnectCause.ICC_ERROR,
                connection.disconnectCauseFromCode(CallFailCause.NO_VALID_SIM));
        assertEquals(DisconnectCause.OUT_OF_SERVICE,
                connection.disconnectCauseFromCode(CallFailCause.LOCAL_NETWORK_NO_SERVICE));
        assertEquals(DisconnectCause.OUT_OF_SERVICE,
                connection.disconnectCauseFromCode(CallFailCause.LOCAL_SERVICE_UNAVAILABLE));
    }
}