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

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

Wiring up RTP header extension and incoming DTMF APIs. am: cbe9d443 am:...

Wiring up RTP header extension and incoming DTMF APIs. am: cbe9d443 am: 6c50408b am: 3fb91a47 am: de5cec95

Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ims/+/1466217

Change-Id: Idc4939f5a75d7738304797fbab1a68bcc7da13db
parents 4379c427 de5cec95
Loading
Loading
Loading
Loading
+78 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.ims;

import android.annotation.NonNull;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.net.Uri;
@@ -35,6 +36,7 @@ import android.telephony.ims.ImsConferenceState;
import android.telephony.ims.ImsReasonInfo;
import android.telephony.ims.ImsStreamMediaProfile;
import android.telephony.ims.ImsSuppServiceNotification;
import android.telephony.ims.RtpHeaderExtension;
import android.text.TextUtils;
import android.util.Log;

@@ -47,9 +49,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;

@@ -501,6 +501,14 @@ public class ImsCall implements ICall {
        public void onCallSessionTransferFailed(ImsCall imsCall, ImsReasonInfo reasonInfo) {
        }

        /**
         * Reports a DTMF tone received from the network.
         * @param imsCall The IMS call the tone was received from.
         * @param digit The digit received.
         */
        public void onCallSessionDtmfReceived(ImsCall imsCall, char digit) {
        }

        /**
         * Called when the call quality has changed.
         *
@@ -509,6 +517,15 @@ public class ImsCall implements ICall {
         */
        public void onCallQualityChanged(ImsCall imsCall, CallQuality callQuality) {
        }

        /**
         * Called when RTP header extension data is received from the network.
         * @param imsCall The ImsCall the data was received on.
         * @param rtpHeaderExtensionData The RTP extension data received.
         */
        public void onCallSessionRtpHeaderExtensionsReceived(ImsCall imsCall,
                @NonNull Set<RtpHeaderExtension> rtpHeaderExtensionData) {
        }
    }

    // List of update operation for IMS call control
@@ -1796,6 +1813,30 @@ public class ImsCall implements ICall {
        }
    }

    /**
     * Requests that RTP header extensions are added to the next RTP packet sent by the IMS stack.
     * <p>
     * The {@link RtpHeaderExtension#getLocalIdentifier()} local identifiers specified here must match
     * agreed upon identifiers as indicated in
     * {@link ImsCallProfile#getAcceptedRtpHeaderExtensionTypes()} for the current
     * {@link #getCallProfile()}.
     * <p>
     * By specification, the RTP header extension is an unacknowledged transmission and there is no
     * guarantee that the header extension will be delivered by the network to the other end of the
     * call.
     * @param rtpHeaderExtensions The RTP header extension(s) to be included in the next RTP
     *                            packet.
     */
    public void sendRtpHeaderExtensions(@NonNull Set<RtpHeaderExtension> rtpHeaderExtensions) {
        logi("sendRtpHeaderExtensions; extensionsSent=" + rtpHeaderExtensions.size());
        synchronized(mLockObj) {
            if (mSession == null) {
                loge("sendRtpHeaderExtensions::no session");
            }
            mSession.sendRtpHeaderExtensions(rtpHeaderExtensions);
        }
    }

    public void setAnswerWithRtt() {
        mAnswerWithRtt = true;
    }
@@ -3347,6 +3388,23 @@ public class ImsCall implements ICall {
            }
        }

        @Override
        public void callSessionDtmfReceived(char digit) {
            ImsCall.Listener listener;

            synchronized(ImsCall.this) {
                listener = mListener;
            }

            if (listener != null) {
                try {
                    listener.onCallSessionDtmfReceived(ImsCall.this, digit);
                } catch (Throwable t) {
                    loge("callSessionDtmfReceived:: ", t);
                }
            }
        }

        @Override
        public void callQualityChanged(CallQuality callQuality) {
            ImsCall.Listener listener;
@@ -3363,6 +3421,24 @@ public class ImsCall implements ICall {
                }
            }
        }

        @Override
        public void callSessionRtpHeaderExtensionsReceived(
                @NonNull Set<RtpHeaderExtension> extensions) {
            ImsCall.Listener listener;

            synchronized (ImsCall.this) {
                listener = mListener;
            }

            if (listener != null) {
                try {
                    listener.onCallSessionRtpHeaderExtensionsReceived(ImsCall.this, extensions);
                } catch (Throwable t) {
                    loge("callSessionRtpHeaderExtensionsReceived:: ", t);
                }
            }
        }
    }

    /**