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

Commit 0352dc37 authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Fix issue where verstat is not propagated to Telecom.

The VERSTAT was not being passed along from the ImsService up through
to Telecom.

Test: Modify telephony stack to pass positive verification status; verify
through logs that Telecom has correct status.
Test: Wrote new unit tests to verify passing of verstat through the
Telephony stack.
Fixes: 152217000

Change-Id: Idf788c9862fca29f0a7ea02da832bb44a39e7d76
parent 5eec2486
Loading
Loading
Loading
Loading
+20 −0
Original line number Original line Diff line number Diff line
@@ -185,6 +185,10 @@ public abstract class Connection {
    protected int mCnapNamePresentation  = PhoneConstants.PRESENTATION_ALLOWED;
    protected int mCnapNamePresentation  = PhoneConstants.PRESENTATION_ALLOWED;
    @UnsupportedAppUsage
    @UnsupportedAppUsage
    protected String mAddress;     // MAY BE NULL!!!
    protected String mAddress;     // MAY BE NULL!!!
    // The VERSTAT number verification status; defaults to not verified.
    protected @android.telecom.Connection.VerificationStatus int mNumberVerificationStatus =
            android.telecom.Connection.VERIFICATION_STATUS_NOT_VERIFIED;

    @UnsupportedAppUsage
    @UnsupportedAppUsage
    protected String mDialString;          // outgoing calls only
    protected String mDialString;          // outgoing calls only
    protected String[] mParticipantsToDial;// outgoing calls only
    protected String[] mParticipantsToDial;// outgoing calls only
@@ -1405,4 +1409,20 @@ public abstract class Connection {
    public int getAudioCodec() {
    public int getAudioCodec() {
        return mAudioCodec;
        return mAudioCodec;
    }
    }

    /**
     * @return The number verification status; only applicable for IMS calls.
     */
    public @android.telecom.Connection.VerificationStatus int getNumberVerificationStatus() {
        return mNumberVerificationStatus;
    }

    /**
     * Sets the number verification status.
     * @param verificationStatus The new verification status
     */
    public void setNumberVerificationStatus(
            @android.telecom.Connection.VerificationStatus int verificationStatus) {
        mNumberVerificationStatus = verificationStatus;
    }
}
}
+22 −0
Original line number Original line Diff line number Diff line
@@ -195,6 +195,8 @@ public class ImsPhoneConnection extends Connection implements
                    imsCall.getCallProfile().getCallExtraInt(ImsCallProfile.EXTRA_OIR));
                    imsCall.getCallProfile().getCallExtraInt(ImsCallProfile.EXTRA_OIR));
            mCnapNamePresentation = ImsCallProfile.OIRToPresentation(
            mCnapNamePresentation = ImsCallProfile.OIRToPresentation(
                    imsCall.getCallProfile().getCallExtraInt(ImsCallProfile.EXTRA_CNAP));
                    imsCall.getCallProfile().getCallExtraInt(ImsCallProfile.EXTRA_CNAP));
            setNumberVerificationStatus(toTelecomVerificationStatus(
                    imsCall.getCallProfile().getCallerNumberVerificationStatus()));
            updateMediaCapabilities(imsCall);
            updateMediaCapabilities(imsCall);
        } else {
        } else {
            mNumberPresentation = PhoneConstants.PRESENTATION_UNKNOWN;
            mNumberPresentation = PhoneConstants.PRESENTATION_UNKNOWN;
@@ -1493,4 +1495,24 @@ public class ImsPhoneConnection extends Connection implements
                + "; updating local video availability.");
                + "; updating local video availability.");
        updateMediaCapabilities(getImsCall());
        updateMediaCapabilities(getImsCall());
    }
    }

    /**
     * Converts an {@link ImsCallProfile} verification status to a
     * {@link android.telecom.Connection} verification status.
     * @param verificationStatus The {@link ImsCallProfile} verification status.
     * @return The telecom verification status.
     */
    public static @android.telecom.Connection.VerificationStatus int toTelecomVerificationStatus(
            @ImsCallProfile.VerificationStatus int verificationStatus) {
        switch (verificationStatus) {
            case ImsCallProfile.VERIFICATION_STATUS_PASSED:
                return android.telecom.Connection.VERIFICATION_STATUS_PASSED;
            case ImsCallProfile.VERIFICATION_STATUS_FAILED:
                return android.telecom.Connection.VERIFICATION_STATUS_FAILED;
            case ImsCallProfile.VERIFICATION_STATUS_NOT_VERIFIED:
                // fall through on purpose
            default:
                return android.telecom.Connection.VERIFICATION_STATUS_NOT_VERIFIED;
        }
    }
}
}
+2 −0
Original line number Original line Diff line number Diff line
@@ -399,6 +399,8 @@ public abstract class TelephonyTest {


        mPhones = new Phone[] {mPhone};
        mPhones = new Phone[] {mPhone};
        mImsCallProfile = new ImsCallProfile();
        mImsCallProfile = new ImsCallProfile();
        mImsCallProfile.setCallerNumberVerificationStatus(
                ImsCallProfile.VERIFICATION_STATUS_PASSED);
        mSimulatedCommands = new SimulatedCommands();
        mSimulatedCommands = new SimulatedCommands();
        mContextFixture = new ContextFixture();
        mContextFixture = new ContextFixture();
        mContext = mContextFixture.getTestDouble();
        mContext = mContextFixture.getTestDouble();
+4 −0
Original line number Original line Diff line number Diff line
@@ -328,6 +328,8 @@ public class ImsPhoneCallTrackerTest extends TelephonyTest {
    @Test
    @Test
    @SmallTest
    @SmallTest
    public void testImsMTCall() {
    public void testImsMTCall() {
        mImsCallProfile.setCallerNumberVerificationStatus(
                ImsCallProfile.VERIFICATION_STATUS_PASSED);
        assertEquals(PhoneConstants.State.IDLE, mCTUT.getState());
        assertEquals(PhoneConstants.State.IDLE, mCTUT.getState());
        assertFalse(mCTUT.mRingingCall.isRinging());
        assertFalse(mCTUT.mRingingCall.isRinging());
        // mock a MT call
        // mock a MT call
@@ -340,6 +342,8 @@ public class ImsPhoneCallTrackerTest extends TelephonyTest {
        ImsPhoneConnection connection =
        ImsPhoneConnection connection =
                (ImsPhoneConnection) mCTUT.mRingingCall.getConnections().get(0);
                (ImsPhoneConnection) mCTUT.mRingingCall.getConnections().get(0);
        connection.addListener(mImsPhoneConnectionListener);
        connection.addListener(mImsPhoneConnectionListener);
        assertEquals(android.telecom.Connection.VERIFICATION_STATUS_PASSED,
                connection.getNumberVerificationStatus());
    }
    }


    @Test
    @Test
+19 −1
Original line number Original line Diff line number Diff line
@@ -94,7 +94,7 @@ public class ImsPhoneConnectionTest extends TelephonyTest {


    @Test
    @Test
    @SmallTest
    @SmallTest
    public void testImsConnectionSanity() {
    public void testImsIncomingConnectionCorrectness() {
        logd("Testing initial state of MT ImsPhoneConnection");
        logd("Testing initial state of MT ImsPhoneConnection");
        mConnectionUT = new ImsPhoneConnection(mImsPhone, mImsCall, mImsCT, mForeGroundCall, false);
        mConnectionUT = new ImsPhoneConnection(mImsPhone, mImsCall, mImsCT, mForeGroundCall, false);


@@ -107,6 +107,8 @@ public class ImsPhoneConnectionTest extends TelephonyTest {
        assertNull(mConnectionUT.getOrigDialString());
        assertNull(mConnectionUT.getOrigDialString());
        assertFalse(mConnectionUT.isMultiparty());
        assertFalse(mConnectionUT.isMultiparty());
        assertFalse(mConnectionUT.isConferenceHost());
        assertFalse(mConnectionUT.isConferenceHost());
        assertEquals(android.telecom.Connection.VERIFICATION_STATUS_PASSED,
                mConnectionUT.getNumberVerificationStatus());
        verify(mForeGroundCall, times(1)).attach((Connection) any(),
        verify(mForeGroundCall, times(1)).attach((Connection) any(),
                eq(ImsPhoneCall.State.INCOMING));
                eq(ImsPhoneCall.State.INCOMING));


@@ -373,4 +375,20 @@ public class ImsPhoneConnectionTest extends TelephonyTest {
        mConnectionUT.updateAddressDisplay(mImsCall);
        mConnectionUT.updateAddressDisplay(mImsCall);
        assertEquals(inputAddress, mConnectionUT.getAddress());
        assertEquals(inputAddress, mConnectionUT.getAddress());
    }
    }

    @Test
    @SmallTest
    public void testConvertVerificationStatus() {
        assertEquals(android.telecom.Connection.VERIFICATION_STATUS_FAILED,
                ImsPhoneConnection.toTelecomVerificationStatus(
                        ImsCallProfile.VERIFICATION_STATUS_FAILED));
        assertEquals(android.telecom.Connection.VERIFICATION_STATUS_PASSED,
                ImsPhoneConnection.toTelecomVerificationStatus(
                        ImsCallProfile.VERIFICATION_STATUS_PASSED));
        assertEquals(android.telecom.Connection.VERIFICATION_STATUS_NOT_VERIFIED,
                ImsPhoneConnection.toTelecomVerificationStatus(
                        ImsCallProfile.VERIFICATION_STATUS_NOT_VERIFIED));
        assertEquals(android.telecom.Connection.VERIFICATION_STATUS_NOT_VERIFIED,
                ImsPhoneConnection.toTelecomVerificationStatus(90210));
    }
}
}