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

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

Merge "Check for null extras in ImsPhoneConnection." am: 8a524b3b

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

Change-Id: I626366b435d2c73138c35aa8f98167b7fd103303
parents 511a4915 8a524b3b
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() {