diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 4700ce52a129b..b469f00265a33 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -11729,11 +11729,18 @@ package android.telephony { method public int getCallDuration(); method public int getCodecType(); method public int getDownlinkCallQualityLevel(); + method public long getMaxPlayoutDelayMillis(); method public int getMaxRelativeJitter(); + method public long getMinPlayoutDelayMillis(); + method public int getNumDroppedRtpPackets(); + method public int getNumNoDataFrames(); + method public int getNumRtpDuplicatePackets(); method public int getNumRtpPacketsNotReceived(); method public int getNumRtpPacketsReceived(); method public int getNumRtpPacketsTransmitted(); method public int getNumRtpPacketsTransmittedLost(); + method public int getNumRtpSidPacketsRx(); + method public int getNumVoiceFrames(); method public int getUplinkCallQualityLevel(); method public boolean isIncomingSilenceDetectedAtCallSetup(); method public boolean isOutgoingSilenceDetectedAtCallSetup(); @@ -11748,6 +11755,32 @@ package android.telephony { field @NonNull public static final android.os.Parcelable.Creator CREATOR; } + public static final class CallQuality.Builder { + ctor public CallQuality.Builder(); + method @NonNull public android.telephony.CallQuality build(); + method @NonNull public android.telephony.CallQuality.Builder setAverageRelativeJitter(int); + method @NonNull public android.telephony.CallQuality.Builder setAverageRoundTripTime(int); + method @NonNull public android.telephony.CallQuality.Builder setCallDuration(int); + method @NonNull public android.telephony.CallQuality.Builder setCodecType(int); + method @NonNull public android.telephony.CallQuality.Builder setDownlinkCallQualityLevel(int); + method @NonNull public android.telephony.CallQuality.Builder setIncomingSilenceDetectedAtCallSetup(boolean); + method @NonNull public android.telephony.CallQuality.Builder setMaxPlayoutDelayMillis(long); + method @NonNull public android.telephony.CallQuality.Builder setMaxRelativeJitter(int); + method @NonNull public android.telephony.CallQuality.Builder setMinPlayoutDelayMillis(long); + method @NonNull public android.telephony.CallQuality.Builder setNumDroppedRtpPackets(int); + method @NonNull public android.telephony.CallQuality.Builder setNumNoDataFrames(int); + method @NonNull public android.telephony.CallQuality.Builder setNumRtpDuplicatePackets(int); + method @NonNull public android.telephony.CallQuality.Builder setNumRtpPacketsNotReceived(int); + method @NonNull public android.telephony.CallQuality.Builder setNumRtpPacketsReceived(int); + method @NonNull public android.telephony.CallQuality.Builder setNumRtpPacketsTransmitted(int); + method @NonNull public android.telephony.CallQuality.Builder setNumRtpPacketsTransmittedLost(int); + method @NonNull public android.telephony.CallQuality.Builder setNumRtpSidPacketsRx(int); + method @NonNull public android.telephony.CallQuality.Builder setNumVoiceFrames(int); + method @NonNull public android.telephony.CallQuality.Builder setOutgoingSilenceDetectedAtCallSetup(boolean); + method @NonNull public android.telephony.CallQuality.Builder setRtpInactivityDetected(boolean); + method @NonNull public android.telephony.CallQuality.Builder setUplinkCallQualityLevel(int); + } + public class CarrierConfigManager { method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getDefaultCarrierServicePackageName(); method @NonNull public static android.os.PersistableBundle getDefaultConfig(); diff --git a/telephony/java/android/telephony/CallQuality.java b/telephony/java/android/telephony/CallQuality.java index fa70c33965ed8..d77bf672347a5 100644 --- a/telephony/java/android/telephony/CallQuality.java +++ b/telephony/java/android/telephony/CallQuality.java @@ -81,6 +81,13 @@ public final class CallQuality implements Parcelable { private boolean mRtpInactivityDetected; private boolean mRxSilenceDetected; private boolean mTxSilenceDetected; + private int mNumVoiceFrames; + private int mNumNoDataFrames; + private int mNumDroppedRtpPackets; + private long mMinPlayoutDelayMillis; + private long mMaxPlayoutDelayMillis; + private int mNumRtpSidPacketsRx; + private int mNumRtpDuplicatePackets; /** @hide **/ public CallQuality(Parcel in) { @@ -98,6 +105,13 @@ public final class CallQuality implements Parcelable { mRtpInactivityDetected = in.readBoolean(); mRxSilenceDetected = in.readBoolean(); mTxSilenceDetected = in.readBoolean(); + mNumVoiceFrames = in.readInt(); + mNumNoDataFrames = in.readInt(); + mNumDroppedRtpPackets = in.readInt(); + mMinPlayoutDelayMillis = in.readLong(); + mMaxPlayoutDelayMillis = in.readLong(); + mNumRtpSidPacketsRx = in.readInt(); + mNumRtpDuplicatePackets = in.readInt(); } /** @hide **/ @@ -297,6 +311,59 @@ public final class CallQuality implements Parcelable { return mTxSilenceDetected; } + /** + * Returns the number of Voice frames sent by jitter buffer to audio + */ + public int getNumVoiceFrames() { + return mNumVoiceFrames; + } + + /** + * Returns the number of no-data frames sent by jitter buffer to audio + */ + public int getNumNoDataFrames() { + return mNumNoDataFrames; + } + + /** + * Returns the number of RTP voice packets dropped by jitter buffer + */ + public int getNumDroppedRtpPackets() { + return mNumDroppedRtpPackets; + } + + /** + * Returns the minimum playout delay in the reporting interval + * in milliseconds. + */ + public long getMinPlayoutDelayMillis() { + return mMinPlayoutDelayMillis; + } + + /** + * Returns the maximum playout delay in the reporting interval + * in milliseconds. + */ + public long getMaxPlayoutDelayMillis() { + return mMaxPlayoutDelayMillis; + } + + /** + * Returns the total number of RTP SID (Silence Insertion Descriptor) packets + * received by this device for an ongoing call + */ + public int getNumRtpSidPacketsRx() { + return mNumRtpSidPacketsRx; + } + + /** + * Returns the total number of RTP duplicate packets received by this device + * for an ongoing call + */ + public int getNumRtpDuplicatePackets() { + return mNumRtpDuplicatePackets; + } + /** * Returns the codec type. This value corresponds to the AUDIO_QUALITY_* constants in * {@link ImsStreamMediaProfile}. @@ -345,6 +412,13 @@ public final class CallQuality implements Parcelable { + " rtpInactivityDetected=" + mRtpInactivityDetected + " txSilenceDetected=" + mTxSilenceDetected + " rxSilenceDetected=" + mRxSilenceDetected + + " numVoiceFrames=" + mNumVoiceFrames + + " numNoDataFrames=" + mNumNoDataFrames + + " numDroppedRtpPackets=" + mNumDroppedRtpPackets + + " minPlayoutDelayMillis=" + mMinPlayoutDelayMillis + + " maxPlayoutDelayMillis=" + mMaxPlayoutDelayMillis + + " numRtpSidPacketsRx=" + mNumRtpSidPacketsRx + + " numRtpDuplicatePackets=" + mNumRtpDuplicatePackets + "}"; } @@ -364,7 +438,14 @@ public final class CallQuality implements Parcelable { mCodecType, mRtpInactivityDetected, mRxSilenceDetected, - mTxSilenceDetected); + mTxSilenceDetected, + mNumVoiceFrames, + mNumNoDataFrames, + mNumDroppedRtpPackets, + mMinPlayoutDelayMillis, + mMaxPlayoutDelayMillis, + mNumRtpSidPacketsRx, + mNumRtpDuplicatePackets); } @Override @@ -392,7 +473,14 @@ public final class CallQuality implements Parcelable { && mCodecType == s.mCodecType && mRtpInactivityDetected == s.mRtpInactivityDetected && mRxSilenceDetected == s.mRxSilenceDetected - && mTxSilenceDetected == s.mTxSilenceDetected); + && mTxSilenceDetected == s.mTxSilenceDetected + && mNumVoiceFrames == s.mNumVoiceFrames + && mNumNoDataFrames == s.mNumNoDataFrames + && mNumDroppedRtpPackets == s.mNumDroppedRtpPackets + && mMinPlayoutDelayMillis == s.mMinPlayoutDelayMillis + && mMaxPlayoutDelayMillis == s.mMaxPlayoutDelayMillis + && mNumRtpSidPacketsRx == s.mNumRtpSidPacketsRx + && mNumRtpDuplicatePackets == s.mNumRtpDuplicatePackets); } /** @@ -420,6 +508,13 @@ public final class CallQuality implements Parcelable { dest.writeBoolean(mRtpInactivityDetected); dest.writeBoolean(mRxSilenceDetected); dest.writeBoolean(mTxSilenceDetected); + dest.writeInt(mNumVoiceFrames); + dest.writeInt(mNumNoDataFrames); + dest.writeInt(mNumDroppedRtpPackets); + dest.writeLong(mMinPlayoutDelayMillis); + dest.writeLong(mMaxPlayoutDelayMillis); + dest.writeInt(mNumRtpSidPacketsRx); + dest.writeInt(mNumRtpDuplicatePackets); } public static final @android.annotation.NonNull Parcelable.Creator CREATOR = new Parcelable.Creator() { @@ -431,4 +526,322 @@ public final class CallQuality implements Parcelable { return new CallQuality[size]; } }; + + /** + * Provides a convenient way to set the fields of a {@link CallQuality} when creating a new + * instance. + * + *

The example below shows how you might create a new {@code CallQuality}: + * + *


+     *
+     * CallQuality callQuality = new CallQuality.Builder()
+     *     .setNumRtpPacketsTransmitted(150)
+     *     .setNumRtpPacketsReceived(200)
+     *     .build();
+     * 
+ */ + public static final class Builder { + + private int mDownlinkCallQualityLevel; + private int mUplinkCallQualityLevel; + private int mCallDuration; + private int mNumRtpPacketsTransmitted; + private int mNumRtpPacketsReceived; + private int mNumRtpPacketsTransmittedLost; + private int mNumRtpPacketsNotReceived; + private int mAverageRelativeJitter; + private int mMaxRelativeJitter; + private int mAverageRoundTripTime; + private int mCodecType; + private boolean mRtpInactivityDetected; + private boolean mRxSilenceDetected; + private boolean mTxSilenceDetected; + private int mNumVoiceFrames; + private int mNumNoDataFrames; + private int mNumDroppedRtpPackets; + private long mMinPlayoutDelayMillis; + private long mMaxPlayoutDelayMillis; + private int mNumRtpSidPacketsRx; + private int mNumRtpDuplicatePackets; + + /** + * Set the downlink call quality level for ongoing call. + * + * @param downlinkCallQualityLevel the Downlink call quality level + * @return The same instance of the builder. + */ + public @NonNull Builder setDownlinkCallQualityLevel( + @CallQualityLevel int downlinkCallQualityLevel) { + mDownlinkCallQualityLevel = downlinkCallQualityLevel; + return this; + } + + /** + * Set the uplink call quality level for ongoing call. + * + * @param uplinkCallQualityLevel the Uplink call quality level + * @return The same instance of the builder. + */ + public @NonNull Builder setUplinkCallQualityLevel( + @CallQualityLevel int uplinkCallQualityLevel) { + mUplinkCallQualityLevel = uplinkCallQualityLevel; + return this; + } + + /** + * Set the call duration in milliseconds. + * + * @param callDuration the call duration in milliseconds + * @return The same instance of the builder. + */ + public @NonNull Builder setCallDuration(int callDuration) { + mCallDuration = callDuration; + return this; + } + + /** + * Set the number of RTP packets sent for ongoing call. + * + * @param numRtpPacketsTransmitted RTP packets sent to network + * @return The same instance of the builder. + */ + public @NonNull Builder setNumRtpPacketsTransmitted(int numRtpPacketsTransmitted) { + mNumRtpPacketsTransmitted = numRtpPacketsTransmitted; + return this; + } + + /** + * Set the number of RTP packets received for ongoing call. + * + * @param numRtpPacketsReceived RTP packets received from network + * @return The same instance of the builder. + */ + public @NonNull Builder setNumRtpPacketsReceived(int numRtpPacketsReceived) { + mNumRtpPacketsReceived = numRtpPacketsReceived; + return this; + } + + /** + * Set the number of RTP packets which were lost in network and never + * transmitted. + * + * @param numRtpPacketsTransmittedLost RTP packets which were lost in network and never + * transmitted + * @return The same instance of the builder. + */ + public @NonNull Builder setNumRtpPacketsTransmittedLost(int numRtpPacketsTransmittedLost) { + mNumRtpPacketsTransmittedLost = numRtpPacketsTransmittedLost; + return this; + } + + /** + * Set the number of RTP packets which were lost in network and never received. + * + * @param numRtpPacketsNotReceived RTP packets which were lost in network and + * never received + * @return The same instance of the builder. + */ + public @NonNull Builder setNumRtpPacketsNotReceived(int numRtpPacketsNotReceived) { + mNumRtpPacketsNotReceived = numRtpPacketsNotReceived; + return this; + } + + /** + * Set the average relative jitter in milliseconds. + * + * @param averageRelativeJitter average relative jitter in milliseconds + * @return The same instance of the builder. + */ + public @NonNull Builder setAverageRelativeJitter(int averageRelativeJitter) { + mAverageRelativeJitter = averageRelativeJitter; + return this; + } + + /** + * Set the maximum relative jitter in milliseconds. + * + * @param maxRelativeJitter maximum relative jitter in milliseconds + * @return The same instance of the builder. + */ + public @NonNull Builder setMaxRelativeJitter(int maxRelativeJitter) { + mMaxRelativeJitter = maxRelativeJitter; + return this; + } + + /** + * Set the average round trip delay in milliseconds. + * + * @param averageRoundTripTime average round trip delay in milliseconds + * @return The same instance of the builder. + */ + public @NonNull Builder setAverageRoundTripTime(int averageRoundTripTime) { + mAverageRoundTripTime = averageRoundTripTime; + return this; + } + + /** + * Set the codec type used in the ongoing call. + * + * @param codecType the codec type. + * @return The same instance of the builder. + */ + public @NonNull Builder setCodecType(int codecType) { + mCodecType = codecType; + return this; + } + + /** + * Set to be True if no incoming RTP is received for a continuous + * duration of 4 seconds. + * + * @param rtpInactivityDetected True if no incoming RTP is received for + * a continuous duration of 4 seconds + * @return The same instance of the builder. + */ + public @NonNull Builder setRtpInactivityDetected(boolean rtpInactivityDetected) { + mRtpInactivityDetected = rtpInactivityDetected; + return this; + } + + /** + * Set to be True if only silence RTP packets are received for 20 seconds + * immediately after call is connected. + * + * @param rxSilenceDetected True if only silence RTP packets are received for 20 seconds + * immediately after call is connected + * @return The same instance of the builder. + */ + public @NonNull Builder setIncomingSilenceDetectedAtCallSetup(boolean rxSilenceDetected) { + mRxSilenceDetected = rxSilenceDetected; + return this; + } + + /** + * Set to be True if only silence RTP packets are sent for 20 seconds immediately + * after call is connected. + * + * @param txSilenceDetected True if only silence RTP packets are sent for + * 20 seconds immediately after call is connected. + * @return The same instance of the builder. + */ + public @NonNull Builder setOutgoingSilenceDetectedAtCallSetup(boolean txSilenceDetected) { + mTxSilenceDetected = txSilenceDetected; + return this; + } + + /** + * Set the number of voice frames sent by jitter buffer to audio. + * + * @param numVoiceFrames Voice frames sent by jitter buffer to audio. + * @return The same instance of the builder. + */ + public @NonNull Builder setNumVoiceFrames(int numVoiceFrames) { + mNumVoiceFrames = numVoiceFrames; + return this; + } + + /** + * Set the number of no-data frames sent by jitter buffer to audio. + * + * @param numNoDataFrames no-data frames sent by jitter buffer to audio + * @return The same instance of the builder. + */ + public @NonNull Builder setNumNoDataFrames(int numNoDataFrames) { + mNumNoDataFrames = numNoDataFrames; + return this; + } + + /** + * Set the number of RTP Voice packets dropped by jitter buffer. + * + * @param numDroppedRtpPackets number of RTP Voice packets dropped by jitter buffer + * @return The same instance of the builder. + */ + public @NonNull Builder setNumDroppedRtpPackets(int numDroppedRtpPackets) { + mNumDroppedRtpPackets = numDroppedRtpPackets; + return this; + } + + /** + * Set the minimum playout delay in the reporting interval in milliseconds. + * + * @param minPlayoutDelayMillis minimum playout delay in the reporting interval + * @return The same instance of the builder. + */ + public @NonNull Builder setMinPlayoutDelayMillis(long minPlayoutDelayMillis) { + mMinPlayoutDelayMillis = minPlayoutDelayMillis; + return this; + } + + /** + * Set the maximum Playout delay in the reporting interval in milliseconds. + * + * @param maxPlayoutDelayMillis maximum Playout delay in the reporting interval + * @return The same instance of the builder. + */ + public @NonNull Builder setMaxPlayoutDelayMillis(long maxPlayoutDelayMillis) { + mMaxPlayoutDelayMillis = maxPlayoutDelayMillis; + return this; + } + + /** + * Set the total number of RTP SID (Silence Insertion Descriptor) + * packets received by this device for an ongoing call. + * + * @param numRtpSidPacketsRx the total number of RTP SID packets received + * by this device for an ongoing call. + * @return The same instance of the builder. + */ + public @NonNull Builder setNumRtpSidPacketsRx(int numRtpSidPacketsRx) { + mNumRtpSidPacketsRx = numRtpSidPacketsRx; + return this; + } + + /** + * Set the total number of RTP duplicate packets received by this device + * for an ongoing call. + * + * @param numRtpDuplicatePackets the total number of RTP duplicate packets + * received by this device for an ongoing call + * @return The same instance of the builder. + */ + public @NonNull Builder setNumRtpDuplicatePackets(int numRtpDuplicatePackets) { + mNumRtpDuplicatePackets = numRtpDuplicatePackets; + return this; + } + + /** + * Build the CallQuality. + * + * @return the CallQuality object. + */ + public @NonNull CallQuality build() { + + CallQuality callQuality = new CallQuality(); + callQuality.mDownlinkCallQualityLevel = mDownlinkCallQualityLevel; + callQuality.mUplinkCallQualityLevel = mUplinkCallQualityLevel; + callQuality.mCallDuration = mCallDuration; + callQuality.mNumRtpPacketsTransmitted = mNumRtpPacketsTransmitted; + callQuality.mNumRtpPacketsReceived = mNumRtpPacketsReceived; + callQuality.mNumRtpPacketsTransmittedLost = mNumRtpPacketsTransmittedLost; + callQuality.mNumRtpPacketsNotReceived = mNumRtpPacketsNotReceived; + callQuality.mAverageRelativeJitter = mAverageRelativeJitter; + callQuality.mMaxRelativeJitter = mMaxRelativeJitter; + callQuality.mAverageRoundTripTime = mAverageRoundTripTime; + callQuality.mCodecType = mCodecType; + callQuality.mRtpInactivityDetected = mRtpInactivityDetected; + callQuality.mTxSilenceDetected = mTxSilenceDetected; + callQuality.mRxSilenceDetected = mRxSilenceDetected; + callQuality.mNumVoiceFrames = mNumVoiceFrames; + callQuality.mNumNoDataFrames = mNumNoDataFrames; + callQuality.mNumDroppedRtpPackets = mNumDroppedRtpPackets; + callQuality.mMinPlayoutDelayMillis = mMinPlayoutDelayMillis; + callQuality.mMaxPlayoutDelayMillis = mMaxPlayoutDelayMillis; + callQuality.mNumRtpSidPacketsRx = mNumRtpSidPacketsRx; + callQuality.mNumRtpDuplicatePackets = mNumRtpDuplicatePackets; + + return callQuality; + } + } }