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

Commit 8a524b3b authored by Tyler Gunn's avatar Tyler Gunn Committed by Gerrit Code Review
Browse files

Merge "Check for null extras in ImsPhoneConnection."

parents 27ccf3d8 117564da
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -1211,6 +1211,9 @@ public class ImsPhoneConnection extends Connection implements
     * @param extras The ImsCallProfile extras.
     */
    private void updateImsCallRatFromExtras(Bundle extras) {
        if (extras == null) {
            return;
        }
        if (extras.containsKey(ImsCallProfile.EXTRA_CALL_NETWORK_TYPE)
                || extras.containsKey(ImsCallProfile.EXTRA_CALL_RAT_TYPE)
                || extras.containsKey(ImsCallProfile.EXTRA_CALL_RAT_TYPE_ALT)) {
@@ -1227,6 +1230,9 @@ public class ImsPhoneConnection extends Connection implements
    }

    private void updateEmergencyCallFromExtras(Bundle extras) {
        if (extras == null) {
            return;
        }
        if (extras.getBoolean(ImsCallProfile.EXTRA_EMERGENCY_CALL)) {
            setIsNetworkIdentifiedEmergencyCall(true);
        }
@@ -1255,7 +1261,9 @@ public class ImsPhoneConnection extends Connection implements
            updateImsCallRatFromExtras(extras);
            updateEmergencyCallFromExtras(extras);
            mExtras.clear();
            if (extras != null) {
                mExtras.putAll(extras);
            }
            setConnectionExtras(mExtras);
        }
        return changed;
+12 −0
Original line number Diff line number Diff line
@@ -92,6 +92,18 @@ public class ImsPhoneConnectionTest extends TelephonyTest {
        super.tearDown();
    }

    @Test
    @SmallTest
    public void testNullExtras() {
        mImsCallProfile.mCallExtras = null;
        try {
            mConnectionUT = new ImsPhoneConnection(mImsPhone, mImsCall, mImsCT, mForeGroundCall,
                    false);
        } catch (NullPointerException npe) {
            Assert.fail("Should not get NPE updating extras.");
        }
    }

    @Test
    @SmallTest
    public void testImsIncomingConnectionCorrectness() {