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

Commit f7f229bc authored by Chen Xu's avatar Chen Xu Committed by android-build-merger
Browse files

Merge "precisedataState refactor part 3"

am: 2351fa8b

Change-Id: I7e2df1c9acf50db730e576213c27fe22dcddc502
parents ec0c47f5 2351fa8b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -43107,6 +43107,7 @@ package android.telephony {
    field public static final int DATA_CONNECTING = 1; // 0x1
    field public static final int DATA_DISCONNECTED = 0; // 0x0
    field public static final int DATA_SUSPENDED = 3; // 0x3
    field public static final int DATA_UNKNOWN = -1; // 0xffffffff
    field public static final java.lang.String EXTRA_CALL_VOICEMAIL_INTENT = "android.telephony.extra.CALL_VOICEMAIL_INTENT";
    field public static final java.lang.String EXTRA_CARRIER_ID = "android.telephony.extra.CARRIER_ID";
    field public static final java.lang.String EXTRA_CARRIER_NAME = "android.telephony.extra.CARRIER_NAME";
+93 −0
Original line number Diff line number Diff line
@@ -5061,6 +5061,87 @@ package android.telephony {
    field public static final java.lang.String KEY_CARRIER_SETUP_APP_STRING = "carrier_setup_app_string";
  }

  public final class DataFailCause {
    field public static final int ACTIVATION_REJECT_GGSN = 30; // 0x1e
    field public static final int ACTIVATION_REJECT_UNSPECIFIED = 31; // 0x1f
    field public static final int ACTIVE_PDP_CONTEXT_MAX_NUMBER_REACHED = 65; // 0x41
    field public static final int APN_TYPE_CONFLICT = 112; // 0x70
    field public static final int AUTH_FAILURE_ON_EMERGENCY_CALL = 122; // 0x7a
    field public static final int COMPANION_IFACE_IN_USE = 118; // 0x76
    field public static final int CONDITIONAL_IE_ERROR = 100; // 0x64
    field public static final int EMERGENCY_IFACE_ONLY = 116; // 0x74
    field public static final int EMM_ACCESS_BARRED = 115; // 0x73
    field public static final int EMM_ACCESS_BARRED_INFINITE_RETRY = 121; // 0x79
    field public static final int ERROR_UNSPECIFIED = 65535; // 0xffff
    field public static final int ESM_INFO_NOT_RECEIVED = 53; // 0x35
    field public static final int FEATURE_NOT_SUPP = 40; // 0x28
    field public static final int FILTER_SEMANTIC_ERROR = 44; // 0x2c
    field public static final int FILTER_SYTAX_ERROR = 45; // 0x2d
    field public static final int GPRS_REGISTRATION_FAIL = -2; // 0xfffffffe
    field public static final int IFACE_AND_POL_FAMILY_MISMATCH = 120; // 0x78
    field public static final int IFACE_MISMATCH = 117; // 0x75
    field public static final int INSUFFICIENT_RESOURCES = 26; // 0x1a
    field public static final int INTERNAL_CALL_PREEMPT_BY_HIGH_PRIO_APN = 114; // 0x72
    field public static final int INVALID_MANDATORY_INFO = 96; // 0x60
    field public static final int INVALID_PCSCF_ADDR = 113; // 0x71
    field public static final int INVALID_TRANSACTION_ID = 81; // 0x51
    field public static final int IP_ADDRESS_MISMATCH = 119; // 0x77
    field public static final int LLC_SNDCP = 25; // 0x19
    field public static final int LOST_CONNECTION = 65540; // 0x10004
    field public static final int MESSAGE_INCORRECT_SEMANTIC = 95; // 0x5f
    field public static final int MESSAGE_TYPE_UNSUPPORTED = 97; // 0x61
    field public static final int MISSING_UNKNOWN_APN = 27; // 0x1b
    field public static final int MSG_AND_PROTOCOL_STATE_UNCOMPATIBLE = 101; // 0x65
    field public static final int MSG_TYPE_NONCOMPATIBLE_STATE = 98; // 0x62
    field public static final int MULTI_CONN_TO_SAME_PDN_NOT_ALLOWED = 55; // 0x37
    field public static final int NAS_SIGNALLING = 14; // 0xe
    field public static final int NETWORK_FAILURE = 38; // 0x26
    field public static final int NONE = 0; // 0x0
    field public static final int NSAPI_IN_USE = 35; // 0x23
    field public static final int OEM_DCFAILCAUSE_1 = 4097; // 0x1001
    field public static final int OEM_DCFAILCAUSE_10 = 4106; // 0x100a
    field public static final int OEM_DCFAILCAUSE_11 = 4107; // 0x100b
    field public static final int OEM_DCFAILCAUSE_12 = 4108; // 0x100c
    field public static final int OEM_DCFAILCAUSE_13 = 4109; // 0x100d
    field public static final int OEM_DCFAILCAUSE_14 = 4110; // 0x100e
    field public static final int OEM_DCFAILCAUSE_15 = 4111; // 0x100f
    field public static final int OEM_DCFAILCAUSE_2 = 4098; // 0x1002
    field public static final int OEM_DCFAILCAUSE_3 = 4099; // 0x1003
    field public static final int OEM_DCFAILCAUSE_4 = 4100; // 0x1004
    field public static final int OEM_DCFAILCAUSE_5 = 4101; // 0x1005
    field public static final int OEM_DCFAILCAUSE_6 = 4102; // 0x1006
    field public static final int OEM_DCFAILCAUSE_7 = 4103; // 0x1007
    field public static final int OEM_DCFAILCAUSE_8 = 4104; // 0x1008
    field public static final int OEM_DCFAILCAUSE_9 = 4105; // 0x1009
    field public static final int ONLY_IPV4_ALLOWED = 50; // 0x32
    field public static final int ONLY_IPV6_ALLOWED = 51; // 0x33
    field public static final int ONLY_SINGLE_BEARER_ALLOWED = 52; // 0x34
    field public static final int OPERATOR_BARRED = 8; // 0x8
    field public static final int PDN_CONN_DOES_NOT_EXIST = 54; // 0x36
    field public static final int PDP_WITHOUT_ACTIVE_TFT = 46; // 0x2e
    field public static final int PREF_RADIO_TECH_CHANGED = -4; // 0xfffffffc
    field public static final int PROTOCOL_ERRORS = 111; // 0x6f
    field public static final int QOS_NOT_ACCEPTED = 37; // 0x25
    field public static final int RADIO_NOT_AVAILABLE = 65537; // 0x10001
    field public static final int RADIO_POWER_OFF = -5; // 0xfffffffb
    field public static final int REGISTRATION_FAIL = -1; // 0xffffffff
    field public static final int REGULAR_DEACTIVATION = 36; // 0x24
    field public static final int SERVICE_OPTION_NOT_SUBSCRIBED = 33; // 0x21
    field public static final int SERVICE_OPTION_NOT_SUPPORTED = 32; // 0x20
    field public static final int SERVICE_OPTION_OUT_OF_ORDER = 34; // 0x22
    field public static final int SIGNAL_LOST = -3; // 0xfffffffd
    field public static final int TETHERED_CALL_ACTIVE = -6; // 0xfffffffa
    field public static final int TFT_SEMANTIC_ERROR = 41; // 0x29
    field public static final int TFT_SYTAX_ERROR = 42; // 0x2a
    field public static final int UMTS_REACTIVATION_REQ = 39; // 0x27
    field public static final int UNKNOWN = 65536; // 0x10000
    field public static final int UNKNOWN_INFO_ELEMENT = 99; // 0x63
    field public static final int UNKNOWN_PDP_ADDRESS_TYPE = 28; // 0x1c
    field public static final int UNKNOWN_PDP_CONTEXT = 43; // 0x2b
    field public static final int UNSUPPORTED_APN_IN_CURRENT_PLMN = 66; // 0x42
    field public static final int USER_AUTHENTICATION = 29; // 0x1d
  }

  public class DisconnectCause {
    field public static final int ALREADY_DIALING = 72; // 0x48
    field public static final int ANSWERED_ELSEWHERE = 52; // 0x34
@@ -5228,11 +5309,13 @@ package android.telephony {
  public class PhoneStateListener {
    method public void onCallDisconnectCauseChanged(int, int);
    method public void onPreciseCallStateChanged(android.telephony.PreciseCallState);
    method public void onPreciseDataConnectionStateChanged(android.telephony.PreciseDataConnectionState);
    method public void onRadioPowerStateChanged(int);
    method public void onSrvccStateChanged(int);
    method public void onVoiceActivationStateChanged(int);
    field public static final int LISTEN_CALL_DISCONNECT_CAUSES = 33554432; // 0x2000000
    field public static final int LISTEN_PRECISE_CALL_STATE = 2048; // 0x800
    field public static final int LISTEN_PRECISE_DATA_CONNECTION_STATE = 4096; // 0x1000
    field public static final int LISTEN_RADIO_POWER_STATE_CHANGED = 8388608; // 0x800000
    field public static final int LISTEN_SRVCC_STATE_CHANGED = 16384; // 0x4000
    field public static final int LISTEN_VOICE_ACTIVATION_STATE = 131072; // 0x20000
@@ -5257,6 +5340,16 @@ package android.telephony {
    field public static final int PRECISE_CALL_STATE_WAITING = 6; // 0x6
  }

  public final class PreciseDataConnectionState implements android.os.Parcelable {
    method public int describeContents();
    method public java.lang.String getDataConnectionApn();
    method public int getDataConnectionApnTypeBitMask();
    method public int getDataConnectionFailCause();
    method public int getDataConnectionState();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.telephony.PreciseDataConnectionState> CREATOR;
  }

  public class PreciseDisconnectCause {
    field public static final int ACCESS_CLASS_BLOCKED = 260; // 0x104
    field public static final int ACCESS_INFORMATION_DISCARDED = 43; // 0x2b
+15 −10
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import android.os.RemoteException;
import android.os.UserHandle;
import android.telephony.CellInfo;
import android.telephony.CellLocation;
import android.telephony.DataFailCause;
import android.telephony.DisconnectCause;
import android.telephony.LocationAccessPolicy;
import android.telephony.PhoneCapability;
@@ -47,6 +48,7 @@ import android.telephony.ServiceState;
import android.telephony.SignalStrength;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.telephony.data.ApnSetting;
import android.telephony.emergency.EmergencyNumber;
import android.util.LocalLog;
import android.util.StatsLog;
@@ -1366,7 +1368,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
                    mDataConnectionNetworkType[phoneId] = networkType;
                }
                mPreciseDataConnectionState = new PreciseDataConnectionState(state, networkType,
                        apnType, apn, linkProperties, "");
                        ApnSetting.getApnTypesBitmaskFromString(apnType), apn,
                        linkProperties, DataFailCause.NONE);
                for (Record r : mRecords) {
                    if (r.matchPhoneStateListenerEvent(
                            PhoneStateListener.LISTEN_PRECISE_DATA_CONNECTION_STATE)) {
@@ -1384,7 +1387,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
        broadcastDataConnectionStateChanged(state, isDataAllowed, apn, apnType, linkProperties,
                networkCapabilities, roaming, subId);
        broadcastPreciseDataConnectionStateChanged(state, networkType, apnType, apn,
                linkProperties, "");
                linkProperties, DataFailCause.NONE);
    }

    public void notifyDataConnectionFailed(String apnType) {
@@ -1403,7 +1406,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
        synchronized (mRecords) {
            mPreciseDataConnectionState = new PreciseDataConnectionState(
                    TelephonyManager.DATA_UNKNOWN,TelephonyManager.NETWORK_TYPE_UNKNOWN,
                    apnType, "", null, "");
                    ApnSetting.getApnTypesBitmaskFromString(apnType), "", null,
                    DataFailCause.NONE);
            for (Record r : mRecords) {
                if (r.matchPhoneStateListenerEvent(
                        PhoneStateListener.LISTEN_PRECISE_DATA_CONNECTION_STATE)) {
@@ -1418,7 +1422,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
        }
        broadcastDataConnectionFailed(apnType, subId);
        broadcastPreciseDataConnectionStateChanged(TelephonyManager.DATA_UNKNOWN,
                TelephonyManager.NETWORK_TYPE_UNKNOWN, apnType, "", null, "");
                TelephonyManager.NETWORK_TYPE_UNKNOWN, apnType, "", null,
                DataFailCause.NONE);
    }

    public void notifyCellLocation(Bundle cellLocation) {
@@ -1528,14 +1533,15 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
        }
    }

    public void notifyPreciseDataConnectionFailed(String apnType, String apn, String failCause) {
    public void notifyPreciseDataConnectionFailed(String apnType,
            String apn, @DataFailCause.FailCause int failCause) {
        if (!checkNotifyPermission("notifyPreciseDataConnectionFailed()")) {
            return;
        }
        synchronized (mRecords) {
            mPreciseDataConnectionState = new PreciseDataConnectionState(
                    TelephonyManager.DATA_UNKNOWN, TelephonyManager.NETWORK_TYPE_UNKNOWN,
                    apnType, apn, null, failCause);
                    ApnSetting.getApnTypesBitmaskFromString(apnType), apn, null, failCause);
            for (Record r : mRecords) {
                if (r.matchPhoneStateListenerEvent(
                        PhoneStateListener.LISTEN_PRECISE_DATA_CONNECTION_STATE)) {
@@ -1929,9 +1935,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
    }

    private void broadcastPreciseDataConnectionStateChanged(int state, int networkType,
                                                            String apnType, String apn,
                                                            LinkProperties linkProperties,
                                                            String failCause) {
            String apnType, String apn, LinkProperties linkProperties,
            @DataFailCause.FailCause int failCause) {
        Intent intent = new Intent(TelephonyManager.ACTION_PRECISE_DATA_CONNECTION_STATE_CHANGED);
        intent.putExtra(PhoneConstants.STATE_KEY, state);
        intent.putExtra(PhoneConstants.DATA_NETWORK_TYPE_KEY, networkType);
@@ -1940,7 +1945,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
        if (linkProperties != null) {
            intent.putExtra(PhoneConstants.DATA_LINK_PROPERTIES_KEY, linkProperties);
        }
        if (failCause != null) intent.putExtra(PhoneConstants.DATA_FAILURE_CAUSE_KEY, failCause);
        intent.putExtra(PhoneConstants.DATA_FAILURE_CAUSE_KEY, failCause);

        mContext.sendBroadcastAsUser(intent, UserHandle.ALL,
                android.Manifest.permission.READ_PRECISE_PHONE_STATE);
+31 −6
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ package android.telephony;

import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.content.Context;
import android.os.PersistableBundle;

@@ -34,6 +35,7 @@ import java.util.Set;
 * Returned as the reason for a data connection failure as defined by modem and some local errors.
 * @hide
 */
@SystemApi
public final class DataFailCause {
    /** There is no failure */
    public static final int NONE = 0;
@@ -101,8 +103,8 @@ public final class DataFailCause {
    public static final int PDN_CONN_DOES_NOT_EXIST = 0x36;
    /** Multiple connections to a same PDN is not allowed. */
    public static final int MULTI_CONN_TO_SAME_PDN_NOT_ALLOWED = 0x37;
    /** Packet Data Protocol (PDP) */
    public static final int MAX_ACTIVE_PDP_CONTEXT_REACHED = 0x41;
    /** Max number of Packet Data Protocol (PDP) context reached. */
    public static final int ACTIVE_PDP_CONTEXT_MAX_NUMBER_REACHED = 0x41;
    /** Unsupported APN in current public land mobile network (PLMN). */
    public static final int UNSUPPORTED_APN_IN_CURRENT_PLMN = 0x42;
    /** Invalid transaction id. */
@@ -165,22 +167,36 @@ public final class DataFailCause {

    // Local errors generated by Vendor RIL
    // specified in ril.h
    /** Data fail due to registration failure. */
    public static final int REGISTRATION_FAIL = -1;
    /** Data fail due to GPRS registration failure. */
    public static final int GPRS_REGISTRATION_FAIL = -2;
    /** Data call drop due to network/modem disconnect. */
    public static final int SIGNAL_LOST = -3;                        /* no retry */
    /**
     * Preferred technology has changed, must retry with parameters appropriate for new technology.
     */
    public static final int PREF_RADIO_TECH_CHANGED = -4;
    /** data call was disconnected because radio was resetting, powered off. */
    public static final int RADIO_POWER_OFF = -5;                    /* no retry */
    /** Data call was disconnected by modem because tethered. */
    public static final int TETHERED_CALL_ACTIVE = -6;               /* no retry */
    /** Data call fail due to unspecific errors. */
    public static final int ERROR_UNSPECIFIED = 0xFFFF;

    // Errors generated by the Framework
    // specified here
    /** Unknown data failure cause. */
    public static final int UNKNOWN = 0x10000;
    /** Data fail due to radio not unavailable. */
    public static final int RADIO_NOT_AVAILABLE = 0x10001;                   /* no retry */
    /** @hide */
    public static final int UNACCEPTABLE_NETWORK_PARAMETER = 0x10002;        /* no retry */
    /** @hide */
    public static final int CONNECTION_TO_DATACONNECTIONAC_BROKEN = 0x10003;
    /** Data connection was lost. */
    public static final int LOST_CONNECTION = 0x10004;
    /** Data was reset by framework. */
    /** @hide */
    public static final int RESET_BY_FRAMEWORK = 0x10005;

    /** @hide */
@@ -216,7 +232,7 @@ public final class DataFailCause {
            ESM_INFO_NOT_RECEIVED,
            PDN_CONN_DOES_NOT_EXIST,
            MULTI_CONN_TO_SAME_PDN_NOT_ALLOWED,
            MAX_ACTIVE_PDP_CONTEXT_REACHED,
            ACTIVE_PDP_CONTEXT_MAX_NUMBER_REACHED,
            UNSUPPORTED_APN_IN_CURRENT_PLMN,
            INVALID_TRANSACTION_ID,
            MESSAGE_INCORRECT_SEMANTIC,
@@ -308,8 +324,8 @@ public final class DataFailCause {
        sFailCauseMap.put(PDN_CONN_DOES_NOT_EXIST, "PDN_CONN_DOES_NOT_EXIST");
        sFailCauseMap.put(MULTI_CONN_TO_SAME_PDN_NOT_ALLOWED,
                "MULTI_CONN_TO_SAME_PDN_NOT_ALLOWED");
        sFailCauseMap.put(MAX_ACTIVE_PDP_CONTEXT_REACHED,
                "MAX_ACTIVE_PDP_CONTEXT_REACHED");
        sFailCauseMap.put(ACTIVE_PDP_CONTEXT_MAX_NUMBER_REACHED,
                "ACTIVE_PDP_CONTEXT_MAX_NUMBER_REACHED");
        sFailCauseMap.put(UNSUPPORTED_APN_IN_CURRENT_PLMN,
                "UNSUPPORTED_APN_IN_CURRENT_PLMN");
        sFailCauseMap.put(INVALID_TRANSACTION_ID, "INVALID_TRANSACTION_ID");
@@ -369,6 +385,9 @@ public final class DataFailCause {
        sFailCauseMap.put(RESET_BY_FRAMEWORK, "RESET_BY_FRAMEWORK");
    }

    private DataFailCause() {
    }

    /**
     * Map of subId -> set of data call setup permanent failure for the carrier.
     */
@@ -382,6 +401,8 @@ public final class DataFailCause {
     * @param cause data disconnect cause
     * @param subId subscription index
     * @return true if the fail cause code needs platform to trigger a modem restart.
     *
     * @hide
     */
    public static boolean isRadioRestartFailure(@NonNull Context context, @FailCause int cause,
                                                int subId) {
@@ -410,6 +431,7 @@ public final class DataFailCause {
        return false;
    }

    /** @hide */
    public static boolean isPermanentFailure(@NonNull Context context, @FailCause int failCause,
                                             int subId) {
        synchronized (sPermanentFailureCache) {
@@ -469,6 +491,7 @@ public final class DataFailCause {
        }
    }

    /** @hide */
    public static boolean isEventLoggable(@FailCause int dataFailCause) {
        return (dataFailCause == OPERATOR_BARRED) || (dataFailCause == INSUFFICIENT_RESOURCES)
                || (dataFailCause == UNKNOWN_PDP_ADDRESS_TYPE)
@@ -488,11 +511,13 @@ public final class DataFailCause {
                || (dataFailCause == UNACCEPTABLE_NETWORK_PARAMETER);
    }

    /** @hide */
    public static String toString(@FailCause int dataFailCause) {
        int cause = getFailCause(dataFailCause);
        return (cause == UNKNOWN) ? "UNKNOWN(" + dataFailCause + ")" : sFailCauseMap.get(cause);
    }

    /** @hide */
    public static int getFailCause(@FailCause int failCause) {
        if (sFailCauseMap.containsKey(failCause)) {
            return failCause;
+6 −2
Original line number Diff line number Diff line
@@ -184,14 +184,17 @@ public class PhoneStateListener {
    public static final int LISTEN_PRECISE_CALL_STATE                       = 0x00000800;

    /**
     * Listen for precise changes and fails on the data connection (cellular).
     * Listen for {@link PreciseDataConnectionState} on the data connection (cellular).
     *
     * {@more}
     * Requires Permission: {@link android.Manifest.permission#READ_PRECISE_PHONE_STATE
     * READ_PRECISE_PHONE_STATE}
     *
     * @see #onPreciseDataConnectionStateChanged
     *
     * @hide
     */
    @SystemApi
    public static final int LISTEN_PRECISE_DATA_CONNECTION_STATE            = 0x00001000;

    /**
@@ -564,10 +567,11 @@ public class PhoneStateListener {

    /**
     * Callback invoked when data connection state changes with precise information.
     * @param dataConnectionState {@link PreciseDataConnectionState}
     *
     * @hide
     */
    @UnsupportedAppUsage
    @SystemApi
    public void onPreciseDataConnectionStateChanged(
            PreciseDataConnectionState dataConnectionState) {
        // default implementation empty
Loading