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

Commit 75c062d8 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

parents bc9ac741 6e6efb17
Loading
Loading
Loading
Loading
+22 −12
Original line number Diff line number Diff line
@@ -1167,17 +1167,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);
    }

    /**
@@ -1189,8 +1196,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);
@@ -1198,7 +1207,6 @@ public class ImsPhoneConnection extends Connection implements
            Rlog.e(LOG_TAG, "sendRttModifyResponse: foreground call has no connections");
        }
    }
    }

    public void onRttMessageReceived(String message) {
        synchronized (this) {
@@ -1277,6 +1285,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);