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

Commit 73465fca 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 22575e1f
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -185,6 +185,10 @@ public abstract class Connection {
    protected int mCnapNamePresentation  = PhoneConstants.PRESENTATION_ALLOWED;
    @UnsupportedAppUsage
    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
    protected String mDialString;          // outgoing calls only
    protected String[] mParticipantsToDial;// outgoing calls only
@@ -1405,4 +1409,20 @@ public abstract class Connection {
    public int getAudioCodec() {
        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 Diff line number Diff line
@@ -195,6 +195,8 @@ public class ImsPhoneConnection extends Connection implements
                    imsCall.getCallProfile().getCallExtraInt(ImsCallProfile.EXTRA_OIR));
            mCnapNamePresentation = ImsCallProfile.OIRToPresentation(
                    imsCall.getCallProfile().getCallExtraInt(ImsCallProfile.EXTRA_CNAP));
            setNumberVerificationStatus(toTelecomVerificationStatus(
                    imsCall.getCallProfile().getCallerNumberVerificationStatus()));
            updateMediaCapabilities(imsCall);
        } else {
            mNumberPresentation = PhoneConstants.PRESENTATION_UNKNOWN;
@@ -1482,4 +1484,24 @@ public class ImsPhoneConnection extends Connection implements
                + "; updating local video availability.");
        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 Diff line number Diff line
@@ -393,6 +393,8 @@ public abstract class TelephonyTest {

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

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

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

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

@@ -373,4 +375,20 @@ public class ImsPhoneConnectionTest extends TelephonyTest {
        mConnectionUT.updateAddressDisplay(mImsCall);
        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));
    }
}