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

Commit 1c0d3f2b authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Protect against NPE during RTT call sessions" am: 6e6efb17 am: 75c062d8

parents db98f1ab 75c062d8
Loading
Loading
Loading
Loading
+22 −12
Original line number Diff line number Diff line
@@ -1166,17 +1166,24 @@ public class ImsPhoneConnection extends Connection implements
     */
    public void startRtt(android.telecom.Connection.RttTextStream textStream) {
        ImsCall imsCall = getImsCall();
        if (imsCall != null) {
            getImsCall().sendRttModifyRequest(true);
            setCurrentRttTextStream(textStream);
        if (imsCall == null) {
            Rlog.w(LOG_TAG, "startRtt failed, imsCall is null");
            return;
        }
        imsCall.sendRttModifyRequest(true);
        setCurrentRttTextStream(textStream);
    }

    /**
     * Terminate the current RTT session.
     */
    public void stopRtt() {
        getImsCall().sendRttModifyRequest(false);
        ImsCall imsCall = getImsCall();
        if (imsCall == null) {
            Rlog.w(LOG_TAG, "stopRtt failed, imsCall is null");
            return;
        }
        imsCall.sendRttModifyRequest(false);
    }

    /**
@@ -1188,8 +1195,10 @@ public class ImsPhoneConnection extends Connection implements
    public void sendRttModifyResponse(android.telecom.Connection.RttTextStream textStream) {
        boolean accept = textStream != null;
        ImsCall imsCall = getImsCall();

        if (imsCall != null) {
        if (imsCall == null) {
            Rlog.w(LOG_TAG, "sendRttModifyResponse failed, imsCall is null");
            return;
        }
        imsCall.sendRttModifyResponse(accept);
        if (accept) {
            setCurrentRttTextStream(textStream);
@@ -1197,7 +1206,6 @@ public class ImsPhoneConnection extends Connection implements
            Rlog.e(LOG_TAG, "sendRttModifyResponse: foreground call has no connections");
        }
    }
    }

    public void onRttMessageReceived(String message) {
        synchronized (this) {
@@ -1276,6 +1284,8 @@ public class ImsPhoneConnection extends Connection implements
                    ImsCall imsCall = getImsCall();
                    if (imsCall != null) {
                        imsCall.sendRttMessage(message);
                    } else {
                        Rlog.w(LOG_TAG, "createRttTextHandler: imsCall is null");
                    }
                });
        mRttTextHandler.initialize(mRttTextStream);