Formalize DisconnectCause API
As part of telecom mainline, formalize the hidden DisconnectCause
constructor (used by Telephony) into a system API. Additionally, the
telephony related debug info getters also need to be formalized:
getTelephonyDisconnectCause, getTelephonyPreciseDisconnectCause,
getImsReasonInfo.
Bug: 322518612
Bug: 311773409
Test: atest DataObjectUnitTests
Change-Id: Idb0c502bde5391012349a58358515c59fc3cb893
diff --git a/telecomm/java/android/telecom/DisconnectCause.java b/telecomm/java/android/telecom/DisconnectCause.java
index 331caa1..7ad26c9 100644
--- a/telecomm/java/android/telecom/DisconnectCause.java
+++ b/telecomm/java/android/telecom/DisconnectCause.java
@@ -16,7 +16,10 @@
package android.telecom;
+import android.annotation.FlaggedApi;
+import android.annotation.NonNull;
import android.annotation.Nullable;
+import android.annotation.SystemApi;
import android.media.ToneGenerator;
import android.os.Parcel;
import android.os.Parcelable;
@@ -25,6 +28,8 @@
import android.telephony.ims.ImsReasonInfo;
import android.text.TextUtils;
+import com.android.server.telecom.flags.Flags;
+
import java.util.Objects;
/**
@@ -169,7 +174,9 @@
}
/**
- * Creates a new DisconnectCause instance.
+ * Creates a new DisconnectCause instance. This is used by Telephony to pass in extra debug
+ * info to Telecom regarding the disconnect cause.
+ *
* @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.
@@ -180,7 +187,10 @@
* @param imsReasonInfo The relevant {@link ImsReasonInfo}, or {@code null} if not available.
* @hide
*/
- public DisconnectCause(int code, CharSequence label, CharSequence description, String reason,
+ @SystemApi
+ @FlaggedApi(Flags.FLAG_TELECOM_RESOLVE_HIDDEN_DEPENDENCIES)
+ public DisconnectCause(int code, @NonNull CharSequence label,
+ @NonNull CharSequence description, @NonNull String reason,
int toneToPlay, @Annotation.DisconnectCauses int telephonyDisconnectCause,
@Annotation.PreciseDisconnectCauses int telephonyPreciseDisconnectCause,
@Nullable ImsReasonInfo imsReasonInfo) {
@@ -241,28 +251,40 @@
}
/**
- * Returns the telephony {@link android.telephony.DisconnectCause} for the call.
+ * Returns the telephony {@link android.telephony.DisconnectCause} for the call. This is only
+ * used internally by Telecom for providing extra debug information from Telephony.
+ *
* @return The disconnect cause.
* @hide
*/
+ @SystemApi
+ @FlaggedApi(Flags.FLAG_TELECOM_RESOLVE_HIDDEN_DEPENDENCIES)
public @Annotation.DisconnectCauses int getTelephonyDisconnectCause() {
return mTelephonyDisconnectCause;
}
/**
- * Returns the telephony {@link android.telephony.PreciseDisconnectCause} for the call.
+ * Returns the telephony {@link android.telephony.PreciseDisconnectCause} for the call. This is
+ * only used internally by Telecom for providing extra debug information from Telephony.
+ *
* @return The precise disconnect cause.
* @hide
*/
+ @SystemApi
+ @FlaggedApi(Flags.FLAG_TELECOM_RESOLVE_HIDDEN_DEPENDENCIES)
public @Annotation.PreciseDisconnectCauses int getTelephonyPreciseDisconnectCause() {
return mTelephonyPreciseDisconnectCause;
}
/**
- * Returns the telephony {@link ImsReasonInfo} associated with the call disconnection.
+ * Returns the telephony {@link ImsReasonInfo} associated with the call disconnection. This is
+ * only used internally by Telecom for providing extra debug information from Telephony.
+ *
* @return The {@link ImsReasonInfo} or {@code null} if not known.
* @hide
*/
+ @SystemApi
+ @FlaggedApi(Flags.FLAG_TELECOM_RESOLVE_HIDDEN_DEPENDENCIES)
public @Nullable ImsReasonInfo getImsReasonInfo() {
return mImsReasonInfo;
}