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

Commit 8a54f49b authored by Rambo Wang's avatar Rambo Wang
Browse files

Expose DataFailCause as public API

API Council requests to add document for public API getLastCauseCode()
which return DataFailCause constants. DataFailCause constants are widely
used in system to report data connection failure code. But currently it
is system and hide API.

By opening DataFailCause, we can have better javadoc for both system and
public APIs. This also benefits applications that need to refer to the
consistent data connection failure code.

Bug: 147804257
Test: atest com.android.internal.telephony.dataconnection.DataFailCauseTest
Change-Id: I27bc1d88ba0e7b25fe8f032df1f4d14b805a68bf
parent e01d126a
Loading
Loading
Loading
Loading
+344 −0

File changed.

Preview size limit exceeded, changes collapsed.

+1 −341

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1
Original line number Diff line number Diff line
@@ -432,7 +432,7 @@ public class Annotation {
            DataFailCause.LIMITED_TO_IPV6,
            DataFailCause.VSNCP_TIMEOUT,
            DataFailCause.VSNCP_GEN_ERROR,
            DataFailCause.VSNCP_APN_UNATHORIZED,
            DataFailCause.VSNCP_APN_UNAUTHORIZED,
            DataFailCause.VSNCP_PDN_LIMIT_EXCEEDED,
            DataFailCause.VSNCP_NO_PDN_GATEWAY_ADDRESS,
            DataFailCause.VSNCP_PDN_GATEWAY_UNREACHABLE,
+16 −6
Original line number Diff line number Diff line
@@ -30,10 +30,8 @@ import java.util.Map;
import java.util.Set;

/**
 * Returned as the reason for a data connection failure as defined by modem and some local errors.
 * @hide
 * DataFailCause collects data connection failure causes code from different sources.
 */
@SystemApi
public final class DataFailCause {
    /** There is no failure */
    public static final int NONE = 0;
@@ -838,11 +836,22 @@ public final class DataFailCause {
     * no other specific error code available to report the failure.
     */
    public static final int VSNCP_GEN_ERROR = 0x8BD;
    /**
     * Data call bring up fails in the VSNCP phase due to a network rejection of the VSNCP
     * configuration request because the requested APN is unauthorized.
     *
     * @deprecated Use {@link #VSNCP_APN_UNAUTHORIZED} instead.
     *
     * @hide
     */
    @SystemApi
    @Deprecated
    public static final int VSNCP_APN_UNATHORIZED = 0x8BE; // NOTYPO
    /**
     * Data call bring up fails in the VSNCP phase due to a network rejection of the VSNCP
     * configuration request because the requested APN is unauthorized.
     */
    public static final int VSNCP_APN_UNATHORIZED = 0x8BE;
    public static final int VSNCP_APN_UNAUTHORIZED = 0x8BE;
    /**
     * Data call bring up fails in the VSNCP phase due to a network rejection of the VSNCP
     * configuration request because the PDN limit has been exceeded.
@@ -1318,6 +1327,7 @@ public final class DataFailCause {
        sFailCauseMap.put(VSNCP_TIMEOUT, "VSNCP_TIMEOUT");
        sFailCauseMap.put(VSNCP_GEN_ERROR, "VSNCP_GEN_ERROR");
        sFailCauseMap.put(VSNCP_APN_UNATHORIZED, "VSNCP_APN_UNATHORIZED");
        sFailCauseMap.put(VSNCP_APN_UNAUTHORIZED, "VSNCP_APN_UNAUTHORIZED");
        sFailCauseMap.put(VSNCP_PDN_LIMIT_EXCEEDED, "VSNCP_PDN_LIMIT_EXCEEDED");
        sFailCauseMap.put(VSNCP_NO_PDN_GATEWAY_ADDRESS, "VSNCP_NO_PDN_GATEWAY_ADDRESS");
        sFailCauseMap.put(VSNCP_PDN_GATEWAY_UNREACHABLE, "VSNCP_PDN_GATEWAY_UNREACHABLE");
@@ -1423,8 +1433,8 @@ public final class DataFailCause {
                if (configManager != null) {
                    PersistableBundle b = configManager.getConfigForSubId(subId);
                    if (b != null) {
                        String[] permanentFailureStrings = b.getStringArray(CarrierConfigManager.
                                KEY_CARRIER_DATA_CALL_PERMANENT_FAILURE_STRINGS);
                        String[] permanentFailureStrings = b.getStringArray(CarrierConfigManager
                                .KEY_CARRIER_DATA_CALL_PERMANENT_FAILURE_STRINGS);
                        if (permanentFailureStrings != null) {
                            permanentFailureSet = new HashSet<>();
                            for (Map.Entry<Integer, String> e : sFailCauseMap.entrySet()) {
+1 −2
Original line number Diff line number Diff line
@@ -257,8 +257,7 @@ public final class PreciseDataConnectionState implements Parcelable {
     * Return the cause code for the most recent change in {@link #getState}. In the event of an
     * error, this cause code will be non-zero.
     */
    // FIXME(b144774287): some of these cause codes should have a prescribed meaning.
    public int getLastCauseCode() {
    public @DataFailureCause int getLastCauseCode() {
        return mFailCause;
    }