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

Commit b0d4560f 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 am: 7fd0c664

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



Change-Id: I4b056215620fdbb1f2d8ad015eeacb1f71aa8eee
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 13f71f84 7fd0c664
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));
    }
}