Loading telecomm/java/android/telecom/CallDiagnosticService.java +34 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,8 @@ import android.os.Handler; import android.os.HandlerExecutor; import android.os.IBinder; import android.os.RemoteException; import android.telephony.Annotation; import android.telephony.ims.ImsReasonInfo; import android.util.ArrayMap; import com.android.internal.telecom.ICallDiagnosticService; Loading Loading @@ -105,6 +107,12 @@ public abstract class CallDiagnosticService extends Service { throws RemoteException { handleBluetoothCallQualityReport(qualityReport); } @Override public void notifyCallDisconnected(@NonNull String callId, @NonNull DisconnectCause disconnectCause) throws RemoteException { handleCallDisconnected(callId, disconnectCause); } } /** Loading Loading @@ -328,6 +336,32 @@ public abstract class CallDiagnosticService extends Service { } } /** * Handles a request from the Telecom framework to get a disconnect message from the * {@link CallDiagnosticService}. * @param callId The ID of the call. * @param disconnectCause The telecom disconnect cause. */ private void handleCallDisconnected(@NonNull String callId, @NonNull DisconnectCause disconnectCause) { Log.i(this, "handleCallDisconnected: call=%s; cause=%s", callId, disconnectCause); DiagnosticCall diagnosticCall = mDiagnosticCallByTelecomCallId.get(callId); CharSequence message; if (disconnectCause.getImsReasonInfo() != null) { message = diagnosticCall.onCallDisconnected(disconnectCause.getImsReasonInfo()); } else { message = diagnosticCall.onCallDisconnected( disconnectCause.getTelephonyDisconnectCause(), disconnectCause.getTelephonyPreciseDisconnectCause()); } try { mAdapter.overrideDisconnectMessage(callId, message); } catch (RemoteException e) { Log.w(this, "handleCallDisconnected: call=%s; cause=%s; %s", callId, disconnectCause, e); } } /** * Handles an incoming bluetooth call quality report from Telecom. Notifies via * {@link CallDiagnosticService#onBluetoothCallQualityReportReceived( Loading telecomm/java/android/telecom/DisconnectCause.java +84 −5 Original line number Diff line number Diff line Loading @@ -16,9 +16,13 @@ package android.telecom; import android.annotation.Nullable; import android.media.ToneGenerator; import android.os.Parcel; import android.os.Parcelable; import android.telephony.Annotation; import android.telephony.PreciseDisconnectCause; import android.telephony.ims.ImsReasonInfo; import android.text.TextUtils; import java.util.Objects; Loading Loading @@ -112,6 +116,9 @@ public final class DisconnectCause implements Parcelable { private CharSequence mDisconnectDescription; private String mDisconnectReason; private int mToneToPlay; private int mTelephonyDisconnectCause; private int mTelephonyPreciseDisconnectCause; private ImsReasonInfo mImsReasonInfo; /** * Creates a new DisconnectCause. Loading Loading @@ -155,11 +162,36 @@ public final class DisconnectCause implements Parcelable { */ public DisconnectCause(int code, CharSequence label, CharSequence description, String reason, int toneToPlay) { this(code, label, description, reason, toneToPlay, android.telephony.DisconnectCause.ERROR_UNSPECIFIED, PreciseDisconnectCause.ERROR_UNSPECIFIED, null /* imsReasonInfo */); } /** * Creates a new DisconnectCause instance. * @param code The code for the disconnect cause. * @param label The localized label to show to the user to explain the disconnect. * @param description The localized description to show to the user to explain the disconnect. * @param reason The reason for the disconnect. * @param toneToPlay The tone to play on disconnect, as defined in {@link ToneGenerator}. * @param telephonyDisconnectCause The Telephony disconnect cause. * @param telephonyPreciseDisconnectCause The Telephony precise disconnect cause. * @param imsReasonInfo The relevant {@link ImsReasonInfo}, or {@code null} if not available. * @hide */ public DisconnectCause(int code, CharSequence label, CharSequence description, String reason, int toneToPlay, @Annotation.DisconnectCauses int telephonyDisconnectCause, @Annotation.PreciseDisconnectCauses int telephonyPreciseDisconnectCause, @Nullable ImsReasonInfo imsReasonInfo) { mDisconnectCode = code; mDisconnectLabel = label; mDisconnectDescription = description; mDisconnectReason = reason; mToneToPlay = toneToPlay; mTelephonyDisconnectCause = telephonyDisconnectCause; mTelephonyPreciseDisconnectCause = telephonyPreciseDisconnectCause; mImsReasonInfo = imsReasonInfo; } /** Loading Loading @@ -208,6 +240,33 @@ public final class DisconnectCause implements Parcelable { return mDisconnectReason; } /** * Returns the telephony {@link android.telephony.DisconnectCause} for the call. * @return The disconnect cause. * @hide */ public @Annotation.DisconnectCauses int getTelephonyDisconnectCause() { return mTelephonyDisconnectCause; } /** * Returns the telephony {@link android.telephony.PreciseDisconnectCause} for the call. * @return The precise disconnect cause. * @hide */ public @Annotation.PreciseDisconnectCauses int getTelephonyPreciseDisconnectCause() { return mTelephonyPreciseDisconnectCause; } /** * Returns the telephony {@link ImsReasonInfo} associated with the call disconnection. * @return The {@link ImsReasonInfo} or {@code null} if not known. * @hide */ public @Nullable ImsReasonInfo getImsReasonInfo() { return mImsReasonInfo; } /** * Returns the tone to play when disconnected. * Loading @@ -217,7 +276,8 @@ public final class DisconnectCause implements Parcelable { return mToneToPlay; } public static final @android.annotation.NonNull Creator<DisconnectCause> CREATOR = new Creator<DisconnectCause>() { public static final @android.annotation.NonNull Creator<DisconnectCause> CREATOR = new Creator<DisconnectCause>() { @Override public DisconnectCause createFromParcel(Parcel source) { int code = source.readInt(); Loading @@ -225,7 +285,11 @@ public final class DisconnectCause implements Parcelable { CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source); String reason = source.readString(); int tone = source.readInt(); return new DisconnectCause(code, label, description, reason, tone); int telephonyDisconnectCause = source.readInt(); int telephonyPreciseDisconnectCause = source.readInt(); ImsReasonInfo imsReasonInfo = source.readParcelable(null); return new DisconnectCause(code, label, description, reason, tone, telephonyDisconnectCause, telephonyPreciseDisconnectCause, imsReasonInfo); } @Override Loading @@ -241,6 +305,9 @@ public final class DisconnectCause implements Parcelable { TextUtils.writeToParcel(mDisconnectDescription, destination, flags); destination.writeString(mDisconnectReason); destination.writeInt(mToneToPlay); destination.writeInt(mTelephonyDisconnectCause); destination.writeInt(mTelephonyPreciseDisconnectCause); destination.writeParcelable(mImsReasonInfo, 0); } @Override Loading @@ -254,7 +321,10 @@ public final class DisconnectCause implements Parcelable { + Objects.hashCode(mDisconnectLabel) + Objects.hashCode(mDisconnectDescription) + Objects.hashCode(mDisconnectReason) + Objects.hashCode(mToneToPlay); + Objects.hashCode(mToneToPlay) + Objects.hashCode(mTelephonyDisconnectCause) + Objects.hashCode(mTelephonyPreciseDisconnectCause) + Objects.hashCode(mImsReasonInfo); } @Override Loading @@ -265,7 +335,11 @@ public final class DisconnectCause implements Parcelable { && Objects.equals(mDisconnectLabel, d.getLabel()) && Objects.equals(mDisconnectDescription, d.getDescription()) && Objects.equals(mDisconnectReason, d.getReason()) && Objects.equals(mToneToPlay, d.getTone()); && Objects.equals(mToneToPlay, d.getTone()) && Objects.equals(mTelephonyDisconnectCause, d.getTelephonyDisconnectCause()) && Objects.equals(mTelephonyPreciseDisconnectCause, d.getTelephonyPreciseDisconnectCause()) && Objects.equals(mImsReasonInfo, d.getImsReasonInfo()); } return false; } Loading Loading @@ -325,6 +399,11 @@ public final class DisconnectCause implements Parcelable { + " Label: (" + label + ")" + " Description: (" + description + ")" + " Reason: (" + reason + ")" + " Tone: (" + mToneToPlay + ") ]"; + " Tone: (" + mToneToPlay + ") " + " TelephonyCause: " + mTelephonyDisconnectCause + "/" + mTelephonyPreciseDisconnectCause + " ImsReasonInfo: " + mImsReasonInfo + "]"; } } telecomm/java/com/android/internal/telecom/ICallDiagnosticService.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.internal.telecom; import android.telecom.BluetoothCallQualityReport; import android.telecom.CallAudioState; import android.telecom.DisconnectCause; import android.telecom.ParcelableCall; import com.android.internal.telecom.ICallDiagnosticServiceAdapter; Loading @@ -34,4 +35,5 @@ oneway interface ICallDiagnosticService { void removeDiagnosticCall(in String callId); void receiveDeviceToDeviceMessage(in String callId, int message, int value); void receiveBluetoothCallQualityReport(in BluetoothCallQualityReport qualityReport); void notifyCallDisconnected(in String callId, in DisconnectCause disconnectCause); } Loading
telecomm/java/android/telecom/CallDiagnosticService.java +34 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,8 @@ import android.os.Handler; import android.os.HandlerExecutor; import android.os.IBinder; import android.os.RemoteException; import android.telephony.Annotation; import android.telephony.ims.ImsReasonInfo; import android.util.ArrayMap; import com.android.internal.telecom.ICallDiagnosticService; Loading Loading @@ -105,6 +107,12 @@ public abstract class CallDiagnosticService extends Service { throws RemoteException { handleBluetoothCallQualityReport(qualityReport); } @Override public void notifyCallDisconnected(@NonNull String callId, @NonNull DisconnectCause disconnectCause) throws RemoteException { handleCallDisconnected(callId, disconnectCause); } } /** Loading Loading @@ -328,6 +336,32 @@ public abstract class CallDiagnosticService extends Service { } } /** * Handles a request from the Telecom framework to get a disconnect message from the * {@link CallDiagnosticService}. * @param callId The ID of the call. * @param disconnectCause The telecom disconnect cause. */ private void handleCallDisconnected(@NonNull String callId, @NonNull DisconnectCause disconnectCause) { Log.i(this, "handleCallDisconnected: call=%s; cause=%s", callId, disconnectCause); DiagnosticCall diagnosticCall = mDiagnosticCallByTelecomCallId.get(callId); CharSequence message; if (disconnectCause.getImsReasonInfo() != null) { message = diagnosticCall.onCallDisconnected(disconnectCause.getImsReasonInfo()); } else { message = diagnosticCall.onCallDisconnected( disconnectCause.getTelephonyDisconnectCause(), disconnectCause.getTelephonyPreciseDisconnectCause()); } try { mAdapter.overrideDisconnectMessage(callId, message); } catch (RemoteException e) { Log.w(this, "handleCallDisconnected: call=%s; cause=%s; %s", callId, disconnectCause, e); } } /** * Handles an incoming bluetooth call quality report from Telecom. Notifies via * {@link CallDiagnosticService#onBluetoothCallQualityReportReceived( Loading
telecomm/java/android/telecom/DisconnectCause.java +84 −5 Original line number Diff line number Diff line Loading @@ -16,9 +16,13 @@ package android.telecom; import android.annotation.Nullable; import android.media.ToneGenerator; import android.os.Parcel; import android.os.Parcelable; import android.telephony.Annotation; import android.telephony.PreciseDisconnectCause; import android.telephony.ims.ImsReasonInfo; import android.text.TextUtils; import java.util.Objects; Loading Loading @@ -112,6 +116,9 @@ public final class DisconnectCause implements Parcelable { private CharSequence mDisconnectDescription; private String mDisconnectReason; private int mToneToPlay; private int mTelephonyDisconnectCause; private int mTelephonyPreciseDisconnectCause; private ImsReasonInfo mImsReasonInfo; /** * Creates a new DisconnectCause. Loading Loading @@ -155,11 +162,36 @@ public final class DisconnectCause implements Parcelable { */ public DisconnectCause(int code, CharSequence label, CharSequence description, String reason, int toneToPlay) { this(code, label, description, reason, toneToPlay, android.telephony.DisconnectCause.ERROR_UNSPECIFIED, PreciseDisconnectCause.ERROR_UNSPECIFIED, null /* imsReasonInfo */); } /** * Creates a new DisconnectCause instance. * @param code The code for the disconnect cause. * @param label The localized label to show to the user to explain the disconnect. * @param description The localized description to show to the user to explain the disconnect. * @param reason The reason for the disconnect. * @param toneToPlay The tone to play on disconnect, as defined in {@link ToneGenerator}. * @param telephonyDisconnectCause The Telephony disconnect cause. * @param telephonyPreciseDisconnectCause The Telephony precise disconnect cause. * @param imsReasonInfo The relevant {@link ImsReasonInfo}, or {@code null} if not available. * @hide */ public DisconnectCause(int code, CharSequence label, CharSequence description, String reason, int toneToPlay, @Annotation.DisconnectCauses int telephonyDisconnectCause, @Annotation.PreciseDisconnectCauses int telephonyPreciseDisconnectCause, @Nullable ImsReasonInfo imsReasonInfo) { mDisconnectCode = code; mDisconnectLabel = label; mDisconnectDescription = description; mDisconnectReason = reason; mToneToPlay = toneToPlay; mTelephonyDisconnectCause = telephonyDisconnectCause; mTelephonyPreciseDisconnectCause = telephonyPreciseDisconnectCause; mImsReasonInfo = imsReasonInfo; } /** Loading Loading @@ -208,6 +240,33 @@ public final class DisconnectCause implements Parcelable { return mDisconnectReason; } /** * Returns the telephony {@link android.telephony.DisconnectCause} for the call. * @return The disconnect cause. * @hide */ public @Annotation.DisconnectCauses int getTelephonyDisconnectCause() { return mTelephonyDisconnectCause; } /** * Returns the telephony {@link android.telephony.PreciseDisconnectCause} for the call. * @return The precise disconnect cause. * @hide */ public @Annotation.PreciseDisconnectCauses int getTelephonyPreciseDisconnectCause() { return mTelephonyPreciseDisconnectCause; } /** * Returns the telephony {@link ImsReasonInfo} associated with the call disconnection. * @return The {@link ImsReasonInfo} or {@code null} if not known. * @hide */ public @Nullable ImsReasonInfo getImsReasonInfo() { return mImsReasonInfo; } /** * Returns the tone to play when disconnected. * Loading @@ -217,7 +276,8 @@ public final class DisconnectCause implements Parcelable { return mToneToPlay; } public static final @android.annotation.NonNull Creator<DisconnectCause> CREATOR = new Creator<DisconnectCause>() { public static final @android.annotation.NonNull Creator<DisconnectCause> CREATOR = new Creator<DisconnectCause>() { @Override public DisconnectCause createFromParcel(Parcel source) { int code = source.readInt(); Loading @@ -225,7 +285,11 @@ public final class DisconnectCause implements Parcelable { CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source); String reason = source.readString(); int tone = source.readInt(); return new DisconnectCause(code, label, description, reason, tone); int telephonyDisconnectCause = source.readInt(); int telephonyPreciseDisconnectCause = source.readInt(); ImsReasonInfo imsReasonInfo = source.readParcelable(null); return new DisconnectCause(code, label, description, reason, tone, telephonyDisconnectCause, telephonyPreciseDisconnectCause, imsReasonInfo); } @Override Loading @@ -241,6 +305,9 @@ public final class DisconnectCause implements Parcelable { TextUtils.writeToParcel(mDisconnectDescription, destination, flags); destination.writeString(mDisconnectReason); destination.writeInt(mToneToPlay); destination.writeInt(mTelephonyDisconnectCause); destination.writeInt(mTelephonyPreciseDisconnectCause); destination.writeParcelable(mImsReasonInfo, 0); } @Override Loading @@ -254,7 +321,10 @@ public final class DisconnectCause implements Parcelable { + Objects.hashCode(mDisconnectLabel) + Objects.hashCode(mDisconnectDescription) + Objects.hashCode(mDisconnectReason) + Objects.hashCode(mToneToPlay); + Objects.hashCode(mToneToPlay) + Objects.hashCode(mTelephonyDisconnectCause) + Objects.hashCode(mTelephonyPreciseDisconnectCause) + Objects.hashCode(mImsReasonInfo); } @Override Loading @@ -265,7 +335,11 @@ public final class DisconnectCause implements Parcelable { && Objects.equals(mDisconnectLabel, d.getLabel()) && Objects.equals(mDisconnectDescription, d.getDescription()) && Objects.equals(mDisconnectReason, d.getReason()) && Objects.equals(mToneToPlay, d.getTone()); && Objects.equals(mToneToPlay, d.getTone()) && Objects.equals(mTelephonyDisconnectCause, d.getTelephonyDisconnectCause()) && Objects.equals(mTelephonyPreciseDisconnectCause, d.getTelephonyPreciseDisconnectCause()) && Objects.equals(mImsReasonInfo, d.getImsReasonInfo()); } return false; } Loading Loading @@ -325,6 +399,11 @@ public final class DisconnectCause implements Parcelable { + " Label: (" + label + ")" + " Description: (" + description + ")" + " Reason: (" + reason + ")" + " Tone: (" + mToneToPlay + ") ]"; + " Tone: (" + mToneToPlay + ") " + " TelephonyCause: " + mTelephonyDisconnectCause + "/" + mTelephonyPreciseDisconnectCause + " ImsReasonInfo: " + mImsReasonInfo + "]"; } }
telecomm/java/com/android/internal/telecom/ICallDiagnosticService.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.internal.telecom; import android.telecom.BluetoothCallQualityReport; import android.telecom.CallAudioState; import android.telecom.DisconnectCause; import android.telecom.ParcelableCall; import com.android.internal.telecom.ICallDiagnosticServiceAdapter; Loading @@ -34,4 +35,5 @@ oneway interface ICallDiagnosticService { void removeDiagnosticCall(in String callId); void receiveDeviceToDeviceMessage(in String callId, int message, int value); void receiveBluetoothCallQualityReport(in BluetoothCallQualityReport qualityReport); void notifyCallDisconnected(in String callId, in DisconnectCause disconnectCause); }