Loading src/java/com/android/internal/telephony/dataconnection/DataConnection.java +27 −26 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import android.os.Message; import android.os.SystemClock; import android.os.SystemProperties; import android.telephony.AccessNetworkConstants.TransportType; import android.telephony.DataFailCause; import android.telephony.Rlog; import android.telephony.ServiceState; import android.telephony.TelephonyManager; Loading Loading @@ -173,14 +174,14 @@ public class DataConnection extends StateMachine { private ApnSetting mApnSetting; private ConnectionParams mConnectionParams; private DisconnectParams mDisconnectParams; private DcFailCause mDcFailCause; private DataFailCause mDcFailCause; private Phone mPhone; private DataServiceManager mDataServiceManager; private LinkProperties mLinkProperties = new LinkProperties(); private long mCreateTime; private long mLastFailTime; private DcFailCause mLastFailCause; private DataFailCause mLastFailCause; private static final String NULL_IP = "0.0.0.0"; private Object mUserData; private int mSubscriptionOverride; Loading Loading @@ -349,10 +350,10 @@ public class DataConnection extends StateMachine { ERROR_STALE, ERROR_DATA_SERVICE_SPECIFIC_ERROR; public DcFailCause mFailCause; public DataFailCause mFailCause; SetupResult() { mFailCause = DcFailCause.fromInt(0); mFailCause = DataFailCause.fromInt(0); } @Override Loading Loading @@ -530,7 +531,7 @@ public class DataConnection extends StateMachine { mCreateTime = -1; mLastFailTime = -1; mLastFailCause = DcFailCause.NONE; mLastFailCause = DataFailCause.NONE; Message msg = obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE, cp); msg.obj = cp; Loading Loading @@ -609,7 +610,7 @@ public class DataConnection extends StateMachine { private void notifyAllOfDisconnectDcRetrying(String reason) { notifyAllWithEvent(null, DctConstants.EVENT_DISCONNECT_DC_RETRYING, reason); } private void notifyAllDisconnectCompleted(DcFailCause cause) { private void notifyAllDisconnectCompleted(DataFailCause cause) { notifyAllWithEvent(null, DctConstants.EVENT_DISCONNECT_DONE, cause.toString()); } Loading @@ -618,10 +619,10 @@ public class DataConnection extends StateMachine { * Send the connectionCompletedMsg. * * @param cp is the ConnectionParams * @param cause and if no error the cause is DcFailCause.NONE * @param cause and if no error the cause is DataFailCause.NONE * @param sendAll is true if all contexts are to be notified */ private void notifyConnectCompleted(ConnectionParams cp, DcFailCause cause, boolean sendAll) { private void notifyConnectCompleted(ConnectionParams cp, DataFailCause cause, boolean sendAll) { ApnContext alreadySent = null; if (cp != null && cp.mOnCompletedMsg != null) { Loading @@ -633,7 +634,7 @@ public class DataConnection extends StateMachine { long timeStamp = System.currentTimeMillis(); connectionCompletedMsg.arg1 = mCid; if (cause == DcFailCause.NONE) { if (cause == DataFailCause.NONE) { mCreateTime = timeStamp; AsyncResult.forMessage(connectionCompletedMsg); } else { Loading @@ -641,7 +642,7 @@ public class DataConnection extends StateMachine { mLastFailTime = timeStamp; // Return message with a Throwable exception to signify an error. if (cause == null) cause = DcFailCause.UNKNOWN; if (cause == null) cause = DataFailCause.UNKNOWN; AsyncResult.forMessage(connectionCompletedMsg, cause, new Throwable(cause.toString())); } Loading Loading @@ -687,7 +688,7 @@ public class DataConnection extends StateMachine { } if (sendAll) { if (reason == null) { reason = DcFailCause.UNKNOWN.toString(); reason = DataFailCause.UNKNOWN.toString(); } notifyAllWithEvent(alreadySent, DctConstants.EVENT_DISCONNECT_DONE, reason); } Loading Loading @@ -727,7 +728,7 @@ public class DataConnection extends StateMachine { mCreateTime = -1; mLastFailTime = -1; mLastFailCause = DcFailCause.NONE; mLastFailCause = DataFailCause.NONE; mCid = -1; mPcscfAddr = new String[5]; Loading Loading @@ -760,14 +761,14 @@ public class DataConnection extends StateMachine { result = SetupResult.ERROR_STALE; } else if (resultCode == DataServiceCallback.RESULT_ERROR_ILLEGAL_STATE) { result = SetupResult.ERROR_RADIO_NOT_AVAILABLE; result.mFailCause = DcFailCause.RADIO_NOT_AVAILABLE; result.mFailCause = DataFailCause.RADIO_NOT_AVAILABLE; } else if (response.getStatus() != 0) { if (response.getStatus() == DcFailCause.RADIO_NOT_AVAILABLE.getErrorCode()) { if (response.getStatus() == DataFailCause.RADIO_NOT_AVAILABLE.getErrorCode()) { result = SetupResult.ERROR_RADIO_NOT_AVAILABLE; result.mFailCause = DcFailCause.RADIO_NOT_AVAILABLE; result.mFailCause = DataFailCause.RADIO_NOT_AVAILABLE; } else { result = SetupResult.ERROR_DATA_SERVICE_SPECIFIC_ERROR; result.mFailCause = DcFailCause.fromInt(response.getStatus()); result.mFailCause = DataFailCause.fromInt(response.getStatus()); } } else { if (DBG) log("onSetupConnectionCompleted received successful DataCallResponse"); Loading Loading @@ -1135,7 +1136,7 @@ public class DataConnection extends StateMachine { // a failure we'll clear again at the bottom of this code. linkProperties.clear(); if (response.getStatus() == DcFailCause.NONE.getErrorCode()) { if (response.getStatus() == DataFailCause.NONE.getErrorCode()) { try { // set interface name linkProperties.setInterfaceName(response.getIfname()); Loading Loading @@ -1315,7 +1316,7 @@ public class DataConnection extends StateMachine { case EVENT_CONNECT: if (DBG) log("DcDefaultState: msg.what=EVENT_CONNECT, fail not expected"); ConnectionParams cp = (ConnectionParams) msg.obj; notifyConnectCompleted(cp, DcFailCause.UNKNOWN, false); notifyConnectCompleted(cp, DataFailCause.UNKNOWN, false); break; case EVENT_DISCONNECT: Loading Loading @@ -1429,7 +1430,7 @@ public class DataConnection extends StateMachine { */ private class DcInactiveState extends State { // Inform all contexts we've failed connecting public void setEnterNotificationParams(ConnectionParams cp, DcFailCause cause) { public void setEnterNotificationParams(ConnectionParams cp, DataFailCause cause) { if (VDBG) log("DcInactiveState: setEnterNotificationParams cp,cause"); mConnectionParams = cp; mDisconnectParams = null; Loading @@ -1441,11 +1442,11 @@ public class DataConnection extends StateMachine { if (VDBG) log("DcInactiveState: setEnterNotificationParams dp"); mConnectionParams = null; mDisconnectParams = dp; mDcFailCause = DcFailCause.NONE; mDcFailCause = DataFailCause.NONE; } // Inform all contexts of the failure cause public void setEnterNotificationParams(DcFailCause cause) { public void setEnterNotificationParams(DataFailCause cause) { mConnectionParams = null; mDisconnectParams = null; mDcFailCause = cause; Loading Loading @@ -1518,7 +1519,7 @@ public class DataConnection extends StateMachine { if (DBG) { log("DcInactiveState: msg.what=EVENT_CONNECT initConnection failed"); } notifyConnectCompleted(cp, DcFailCause.UNACCEPTABLE_NETWORK_PARAMETER, notifyConnectCompleted(cp, DataFailCause.UNACCEPTABLE_NETWORK_PARAMETER, false); } retVal = HANDLED; Loading Loading @@ -1598,7 +1599,7 @@ public class DataConnection extends StateMachine { switch (result) { case SUCCESS: // All is well mDcFailCause = DcFailCause.NONE; mDcFailCause = DataFailCause.NONE; transitionTo(mActiveState); break; case ERROR_RADIO_NOT_AVAILABLE: Loading Loading @@ -1762,7 +1763,7 @@ public class DataConnection extends StateMachine { if (DBG) { log("DcActiveState: EVENT_CONNECT cp=" + cp + " dc=" + DataConnection.this); } notifyConnectCompleted(cp, DcFailCause.NONE, false); notifyConnectCompleted(cp, DataFailCause.NONE, false); retVal = HANDLED; break; } Loading Loading @@ -1816,7 +1817,7 @@ public class DataConnection extends StateMachine { log("DcActiveState EVENT_LOST_CONNECTION dc=" + DataConnection.this); } mInactiveState.setEnterNotificationParams(DcFailCause.LOST_CONNECTION); mInactiveState.setEnterNotificationParams(DataFailCause.LOST_CONNECTION); transitionTo(mInactiveState); retVal = HANDLED; break; Loading Loading @@ -2104,7 +2105,7 @@ public class DataConnection extends StateMachine { // Transition to inactive but send notifications after // we've entered the mInactive state. mInactiveState.setEnterNotificationParams(cp, DcFailCause.UNACCEPTABLE_NETWORK_PARAMETER); DataFailCause.UNACCEPTABLE_NETWORK_PARAMETER); transitionTo(mInactiveState); } else { if (DBG) { Loading src/java/com/android/internal/telephony/dataconnection/DcController.java +2 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.os.Build; import android.os.Handler; import android.os.Message; import android.telephony.AccessNetworkConstants.TransportType; import android.telephony.DataFailCause; import android.telephony.PhoneStateListener; import android.telephony.Rlog; import android.telephony.TelephonyManager; Loading Loading @@ -330,7 +331,7 @@ public class DcController extends StateMachine { apnsToCleanup.addAll(apnContexts); mDct.isCleanupRequired.set(false); } else { DcFailCause failCause = DcFailCause.fromInt(newState.getStatus()); DataFailCause failCause = DataFailCause.fromInt(newState.getStatus()); if (failCause.isRadioRestartFailure(mPhone.getContext(), mPhone.getSubId())) { if (DBG) { Loading src/java/com/android/internal/telephony/dataconnection/DcFailBringUp.java +5 −4 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.internal.telephony.dataconnection; import android.content.Intent; import android.telephony.DataFailCause; import android.telephony.Rlog; /** Loading @@ -39,8 +40,8 @@ public class DcFailBringUp { // failCause with its --ei option name and default value static final String FAIL_CAUSE = "fail_cause"; static final DcFailCause DEFAULT_FAIL_CAUSE = DcFailCause.ERROR_UNSPECIFIED; DcFailCause mFailCause; static final DataFailCause DEFAULT_FAIL_CAUSE = DataFailCause.ERROR_UNSPECIFIED; DataFailCause mFailCause; // suggestedRetryTime with its --ei option name and default value static final String SUGGESTED_RETRY_TIME = "suggested_retry_time"; Loading @@ -51,7 +52,7 @@ public class DcFailBringUp { void saveParameters(Intent intent, String s) { if (DBG) log(s + ".saveParameters: action=" + intent.getAction()); mCounter = intent.getIntExtra(COUNTER, DEFAULT_COUNTER); mFailCause = DcFailCause.fromInt( mFailCause = DataFailCause.fromInt( intent.getIntExtra(FAIL_CAUSE, DEFAULT_FAIL_CAUSE.getErrorCode())); mSuggestedRetryTime = intent.getIntExtra(SUGGESTED_RETRY_TIME, DEFAULT_SUGGESTED_RETRY_TIME); Loading @@ -62,7 +63,7 @@ public class DcFailBringUp { public void saveParameters(int counter, int failCause, int suggestedRetryTime) { mCounter = counter; mFailCause = DcFailCause.fromInt(failCause); mFailCause = DataFailCause.fromInt(failCause); mSuggestedRetryTime = suggestedRetryTime; } Loading src/java/com/android/internal/telephony/dataconnection/DcFailCause.javadeleted 100644 → 0 +0 −259 Original line number Diff line number Diff line /* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.telephony.dataconnection; import android.content.Context; import android.os.PersistableBundle; import android.telephony.CarrierConfigManager; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; /** * Returned as the reason for a connection failure as defined * by RIL_DataCallFailCause in ril.h and some local errors. */ public enum DcFailCause { NONE(0), // This series of errors as specified by the standards // specified in ril.h OPERATOR_BARRED(0x08), /* no retry */ NAS_SIGNALLING(0x0E), LLC_SNDCP(0x19), INSUFFICIENT_RESOURCES(0x1A), MISSING_UNKNOWN_APN(0x1B), /* no retry */ UNKNOWN_PDP_ADDRESS_TYPE(0x1C), /* no retry */ USER_AUTHENTICATION(0x1D), /* no retry */ ACTIVATION_REJECT_GGSN(0x1E), /* no retry */ ACTIVATION_REJECT_UNSPECIFIED(0x1F), SERVICE_OPTION_NOT_SUPPORTED(0x20), /* no retry */ SERVICE_OPTION_NOT_SUBSCRIBED(0x21), /* no retry */ SERVICE_OPTION_OUT_OF_ORDER(0x22), NSAPI_IN_USE(0x23), /* no retry */ REGULAR_DEACTIVATION(0x24), /* possibly restart radio, based on config */ QOS_NOT_ACCEPTED(0x25), NETWORK_FAILURE(0x26), UMTS_REACTIVATION_REQ(0x27), FEATURE_NOT_SUPP(0x28), TFT_SEMANTIC_ERROR(0x29), TFT_SYTAX_ERROR(0x2A), UNKNOWN_PDP_CONTEXT(0x2B), FILTER_SEMANTIC_ERROR(0x2C), FILTER_SYTAX_ERROR(0x2D), PDP_WITHOUT_ACTIVE_TFT(0x2E), ONLY_IPV4_ALLOWED(0x32), /* no retry */ ONLY_IPV6_ALLOWED(0x33), /* no retry */ ONLY_SINGLE_BEARER_ALLOWED(0x34), ESM_INFO_NOT_RECEIVED(0x35), PDN_CONN_DOES_NOT_EXIST(0x36), MULTI_CONN_TO_SAME_PDN_NOT_ALLOWED(0x37), MAX_ACTIVE_PDP_CONTEXT_REACHED(0x41), UNSUPPORTED_APN_IN_CURRENT_PLMN(0x42), INVALID_TRANSACTION_ID(0x51), MESSAGE_INCORRECT_SEMANTIC(0x5F), INVALID_MANDATORY_INFO(0x60), MESSAGE_TYPE_UNSUPPORTED(0x61), MSG_TYPE_NONCOMPATIBLE_STATE(0x62), UNKNOWN_INFO_ELEMENT(0x63), CONDITIONAL_IE_ERROR(0x64), MSG_AND_PROTOCOL_STATE_UNCOMPATIBLE(0x65), PROTOCOL_ERRORS(0x6F), /* no retry */ APN_TYPE_CONFLICT(0x70), INVALID_PCSCF_ADDR(0x71), INTERNAL_CALL_PREEMPT_BY_HIGH_PRIO_APN(0x72), EMM_ACCESS_BARRED(0x73), EMERGENCY_IFACE_ONLY(0x74), IFACE_MISMATCH(0x75), COMPANION_IFACE_IN_USE(0x76), IP_ADDRESS_MISMATCH(0x77), IFACE_AND_POL_FAMILY_MISMATCH(0x78), EMM_ACCESS_BARRED_INFINITE_RETRY(0x79), AUTH_FAILURE_ON_EMERGENCY_CALL(0x7A), // OEM sepecific error codes. To be used by OEMs when they don't // want to reveal error code which would be replaced by ERROR_UNSPECIFIED OEM_DCFAILCAUSE_1(0x1001), OEM_DCFAILCAUSE_2(0x1002), OEM_DCFAILCAUSE_3(0x1003), OEM_DCFAILCAUSE_4(0x1004), OEM_DCFAILCAUSE_5(0x1005), OEM_DCFAILCAUSE_6(0x1006), OEM_DCFAILCAUSE_7(0x1007), OEM_DCFAILCAUSE_8(0x1008), OEM_DCFAILCAUSE_9(0x1009), OEM_DCFAILCAUSE_10(0x100A), OEM_DCFAILCAUSE_11(0x100B), OEM_DCFAILCAUSE_12(0x100C), OEM_DCFAILCAUSE_13(0x100D), OEM_DCFAILCAUSE_14(0x100E), OEM_DCFAILCAUSE_15(0x100F), // Local errors generated by Vendor RIL // specified in ril.h REGISTRATION_FAIL(-1), GPRS_REGISTRATION_FAIL(-2), SIGNAL_LOST(-3), /* no retry */ PREF_RADIO_TECH_CHANGED(-4), RADIO_POWER_OFF(-5), /* no retry */ TETHERED_CALL_ACTIVE(-6), /* no retry */ ERROR_UNSPECIFIED(0xFFFF), // Errors generated by the Framework // specified here UNKNOWN(0x10000), RADIO_NOT_AVAILABLE(0x10001), /* no retry */ UNACCEPTABLE_NETWORK_PARAMETER(0x10002), /* no retry */ CONNECTION_TO_DATACONNECTIONAC_BROKEN(0x10003), LOST_CONNECTION(0x10004), RESET_BY_FRAMEWORK(0x10005); private final int mErrorCode; private static final HashMap<Integer, DcFailCause> sErrorCodeToFailCauseMap; static { sErrorCodeToFailCauseMap = new HashMap<Integer, DcFailCause>(); for (DcFailCause fc : values()) { sErrorCodeToFailCauseMap.put(fc.getErrorCode(), fc); } } /** * Map of subId -> set of data call setup permanent failure for the carrier. */ private static final HashMap<Integer, HashSet<DcFailCause>> sPermanentFailureCache = new HashMap<>(); DcFailCause(int errorCode) { mErrorCode = errorCode; } public int getErrorCode() { return mErrorCode; } /** * Returns whether or not the fail cause is a failure that requires a modem restart * * @param context device context * @param subId subscription index * @return true if the fail cause code needs platform to trigger a modem restart. */ public boolean isRadioRestartFailure(Context context, int subId) { CarrierConfigManager configManager = (CarrierConfigManager) context.getSystemService(Context.CARRIER_CONFIG_SERVICE); if (configManager != null) { PersistableBundle b = configManager.getConfigForSubId(subId); if (b != null) { if (this == REGULAR_DEACTIVATION && b.getBoolean(CarrierConfigManager .KEY_RESTART_RADIO_ON_PDP_FAIL_REGULAR_DEACTIVATION_BOOL)) { // This is for backward compatibility support. We need to continue support this // old configuration until it gets removed in the future. return true; } // Check the current configurations. int[] causeCodes = b.getIntArray(CarrierConfigManager .KEY_RADIO_RESTART_FAILURE_CAUSES_INT_ARRAY); if (causeCodes != null) { return Arrays.stream(causeCodes).anyMatch(i -> i == getErrorCode()); } } } return false; } public boolean isPermanentFailure(Context context, int subId) { synchronized (sPermanentFailureCache) { HashSet<DcFailCause> permanentFailureSet = sPermanentFailureCache.get(subId); // In case of cache miss, we need to look up the settings from carrier config. if (permanentFailureSet == null) { // Retrieve the permanent failure from carrier config CarrierConfigManager configManager = (CarrierConfigManager) context.getSystemService(Context.CARRIER_CONFIG_SERVICE); if (configManager != null) { PersistableBundle b = configManager.getConfigForSubId(subId); if (b != null) { String[] permanentFailureStrings = b.getStringArray(CarrierConfigManager. KEY_CARRIER_DATA_CALL_PERMANENT_FAILURE_STRINGS); if (permanentFailureStrings != null) { permanentFailureSet = new HashSet<>(); for (String failure : permanentFailureStrings) { permanentFailureSet.add(DcFailCause.valueOf(failure)); } } } } // If we are not able to find the configuration from carrier config, use the default // ones. if (permanentFailureSet == null) { permanentFailureSet = new HashSet<DcFailCause>() { { add(OPERATOR_BARRED); add(MISSING_UNKNOWN_APN); add(UNKNOWN_PDP_ADDRESS_TYPE); add(USER_AUTHENTICATION); add(ACTIVATION_REJECT_GGSN); add(SERVICE_OPTION_NOT_SUPPORTED); add(SERVICE_OPTION_NOT_SUBSCRIBED); add(NSAPI_IN_USE); add(ONLY_IPV4_ALLOWED); add(ONLY_IPV6_ALLOWED); add(PROTOCOL_ERRORS); add(RADIO_POWER_OFF); add(TETHERED_CALL_ACTIVE); add(RADIO_NOT_AVAILABLE); add(UNACCEPTABLE_NETWORK_PARAMETER); add(SIGNAL_LOST); } }; } sPermanentFailureCache.put(subId, permanentFailureSet); } return permanentFailureSet.contains(this); } } public boolean isEventLoggable() { return (this == OPERATOR_BARRED) || (this == INSUFFICIENT_RESOURCES) || (this == UNKNOWN_PDP_ADDRESS_TYPE) || (this == USER_AUTHENTICATION) || (this == ACTIVATION_REJECT_GGSN) || (this == ACTIVATION_REJECT_UNSPECIFIED) || (this == SERVICE_OPTION_NOT_SUBSCRIBED) || (this == SERVICE_OPTION_NOT_SUPPORTED) || (this == SERVICE_OPTION_OUT_OF_ORDER) || (this == NSAPI_IN_USE) || (this == ONLY_IPV4_ALLOWED) || (this == ONLY_IPV6_ALLOWED) || (this == PROTOCOL_ERRORS) || (this == SIGNAL_LOST) || (this == RADIO_POWER_OFF) || (this == TETHERED_CALL_ACTIVE) || (this == UNACCEPTABLE_NETWORK_PARAMETER); } public static DcFailCause fromInt(int errorCode) { DcFailCause fc = sErrorCodeToFailCauseMap.get(errorCode); if (fc == null) { fc = UNKNOWN; } return fc; } } src/java/com/android/internal/telephony/dataconnection/DcTesterFailBringUpAll.java +4 −3 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.os.Build; import android.os.Handler; import android.telephony.DataFailCause; import android.telephony.Rlog; import com.android.internal.telephony.Phone; Loading @@ -35,7 +36,7 @@ import com.android.internal.telephony.Phone; * Also you can add a suggested retry time if desired: * --ei suggested_retry_time 5000 * * The fail_cause is one of {@link DcFailCause} * The fail_cause is one of {@link DataFailCause} */ public class DcTesterFailBringUpAll { private static final String LOG_TAG = "DcTesterFailBrinupAll"; Loading @@ -61,12 +62,12 @@ public class DcTesterFailBringUpAll { // Counter is MAX, bringUp/retry will always fail log("simulate detaching"); mFailBringUp.saveParameters(Integer.MAX_VALUE, DcFailCause.LOST_CONNECTION.getErrorCode(), DataFailCause.LOST_CONNECTION.getErrorCode(), DcFailBringUp.DEFAULT_SUGGESTED_RETRY_TIME); } else if (action.equals(mPhone.getActionAttached())) { // Counter is 0 next bringUp/retry will succeed log("simulate attaching"); mFailBringUp.saveParameters(0, DcFailCause.NONE.getErrorCode(), mFailBringUp.saveParameters(0, DataFailCause.NONE.getErrorCode(), DcFailBringUp.DEFAULT_SUGGESTED_RETRY_TIME); } else { if (DBG) log("onReceive: unknown action=" + action); Loading Loading
src/java/com/android/internal/telephony/dataconnection/DataConnection.java +27 −26 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import android.os.Message; import android.os.SystemClock; import android.os.SystemProperties; import android.telephony.AccessNetworkConstants.TransportType; import android.telephony.DataFailCause; import android.telephony.Rlog; import android.telephony.ServiceState; import android.telephony.TelephonyManager; Loading Loading @@ -173,14 +174,14 @@ public class DataConnection extends StateMachine { private ApnSetting mApnSetting; private ConnectionParams mConnectionParams; private DisconnectParams mDisconnectParams; private DcFailCause mDcFailCause; private DataFailCause mDcFailCause; private Phone mPhone; private DataServiceManager mDataServiceManager; private LinkProperties mLinkProperties = new LinkProperties(); private long mCreateTime; private long mLastFailTime; private DcFailCause mLastFailCause; private DataFailCause mLastFailCause; private static final String NULL_IP = "0.0.0.0"; private Object mUserData; private int mSubscriptionOverride; Loading Loading @@ -349,10 +350,10 @@ public class DataConnection extends StateMachine { ERROR_STALE, ERROR_DATA_SERVICE_SPECIFIC_ERROR; public DcFailCause mFailCause; public DataFailCause mFailCause; SetupResult() { mFailCause = DcFailCause.fromInt(0); mFailCause = DataFailCause.fromInt(0); } @Override Loading Loading @@ -530,7 +531,7 @@ public class DataConnection extends StateMachine { mCreateTime = -1; mLastFailTime = -1; mLastFailCause = DcFailCause.NONE; mLastFailCause = DataFailCause.NONE; Message msg = obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE, cp); msg.obj = cp; Loading Loading @@ -609,7 +610,7 @@ public class DataConnection extends StateMachine { private void notifyAllOfDisconnectDcRetrying(String reason) { notifyAllWithEvent(null, DctConstants.EVENT_DISCONNECT_DC_RETRYING, reason); } private void notifyAllDisconnectCompleted(DcFailCause cause) { private void notifyAllDisconnectCompleted(DataFailCause cause) { notifyAllWithEvent(null, DctConstants.EVENT_DISCONNECT_DONE, cause.toString()); } Loading @@ -618,10 +619,10 @@ public class DataConnection extends StateMachine { * Send the connectionCompletedMsg. * * @param cp is the ConnectionParams * @param cause and if no error the cause is DcFailCause.NONE * @param cause and if no error the cause is DataFailCause.NONE * @param sendAll is true if all contexts are to be notified */ private void notifyConnectCompleted(ConnectionParams cp, DcFailCause cause, boolean sendAll) { private void notifyConnectCompleted(ConnectionParams cp, DataFailCause cause, boolean sendAll) { ApnContext alreadySent = null; if (cp != null && cp.mOnCompletedMsg != null) { Loading @@ -633,7 +634,7 @@ public class DataConnection extends StateMachine { long timeStamp = System.currentTimeMillis(); connectionCompletedMsg.arg1 = mCid; if (cause == DcFailCause.NONE) { if (cause == DataFailCause.NONE) { mCreateTime = timeStamp; AsyncResult.forMessage(connectionCompletedMsg); } else { Loading @@ -641,7 +642,7 @@ public class DataConnection extends StateMachine { mLastFailTime = timeStamp; // Return message with a Throwable exception to signify an error. if (cause == null) cause = DcFailCause.UNKNOWN; if (cause == null) cause = DataFailCause.UNKNOWN; AsyncResult.forMessage(connectionCompletedMsg, cause, new Throwable(cause.toString())); } Loading Loading @@ -687,7 +688,7 @@ public class DataConnection extends StateMachine { } if (sendAll) { if (reason == null) { reason = DcFailCause.UNKNOWN.toString(); reason = DataFailCause.UNKNOWN.toString(); } notifyAllWithEvent(alreadySent, DctConstants.EVENT_DISCONNECT_DONE, reason); } Loading Loading @@ -727,7 +728,7 @@ public class DataConnection extends StateMachine { mCreateTime = -1; mLastFailTime = -1; mLastFailCause = DcFailCause.NONE; mLastFailCause = DataFailCause.NONE; mCid = -1; mPcscfAddr = new String[5]; Loading Loading @@ -760,14 +761,14 @@ public class DataConnection extends StateMachine { result = SetupResult.ERROR_STALE; } else if (resultCode == DataServiceCallback.RESULT_ERROR_ILLEGAL_STATE) { result = SetupResult.ERROR_RADIO_NOT_AVAILABLE; result.mFailCause = DcFailCause.RADIO_NOT_AVAILABLE; result.mFailCause = DataFailCause.RADIO_NOT_AVAILABLE; } else if (response.getStatus() != 0) { if (response.getStatus() == DcFailCause.RADIO_NOT_AVAILABLE.getErrorCode()) { if (response.getStatus() == DataFailCause.RADIO_NOT_AVAILABLE.getErrorCode()) { result = SetupResult.ERROR_RADIO_NOT_AVAILABLE; result.mFailCause = DcFailCause.RADIO_NOT_AVAILABLE; result.mFailCause = DataFailCause.RADIO_NOT_AVAILABLE; } else { result = SetupResult.ERROR_DATA_SERVICE_SPECIFIC_ERROR; result.mFailCause = DcFailCause.fromInt(response.getStatus()); result.mFailCause = DataFailCause.fromInt(response.getStatus()); } } else { if (DBG) log("onSetupConnectionCompleted received successful DataCallResponse"); Loading Loading @@ -1135,7 +1136,7 @@ public class DataConnection extends StateMachine { // a failure we'll clear again at the bottom of this code. linkProperties.clear(); if (response.getStatus() == DcFailCause.NONE.getErrorCode()) { if (response.getStatus() == DataFailCause.NONE.getErrorCode()) { try { // set interface name linkProperties.setInterfaceName(response.getIfname()); Loading Loading @@ -1315,7 +1316,7 @@ public class DataConnection extends StateMachine { case EVENT_CONNECT: if (DBG) log("DcDefaultState: msg.what=EVENT_CONNECT, fail not expected"); ConnectionParams cp = (ConnectionParams) msg.obj; notifyConnectCompleted(cp, DcFailCause.UNKNOWN, false); notifyConnectCompleted(cp, DataFailCause.UNKNOWN, false); break; case EVENT_DISCONNECT: Loading Loading @@ -1429,7 +1430,7 @@ public class DataConnection extends StateMachine { */ private class DcInactiveState extends State { // Inform all contexts we've failed connecting public void setEnterNotificationParams(ConnectionParams cp, DcFailCause cause) { public void setEnterNotificationParams(ConnectionParams cp, DataFailCause cause) { if (VDBG) log("DcInactiveState: setEnterNotificationParams cp,cause"); mConnectionParams = cp; mDisconnectParams = null; Loading @@ -1441,11 +1442,11 @@ public class DataConnection extends StateMachine { if (VDBG) log("DcInactiveState: setEnterNotificationParams dp"); mConnectionParams = null; mDisconnectParams = dp; mDcFailCause = DcFailCause.NONE; mDcFailCause = DataFailCause.NONE; } // Inform all contexts of the failure cause public void setEnterNotificationParams(DcFailCause cause) { public void setEnterNotificationParams(DataFailCause cause) { mConnectionParams = null; mDisconnectParams = null; mDcFailCause = cause; Loading Loading @@ -1518,7 +1519,7 @@ public class DataConnection extends StateMachine { if (DBG) { log("DcInactiveState: msg.what=EVENT_CONNECT initConnection failed"); } notifyConnectCompleted(cp, DcFailCause.UNACCEPTABLE_NETWORK_PARAMETER, notifyConnectCompleted(cp, DataFailCause.UNACCEPTABLE_NETWORK_PARAMETER, false); } retVal = HANDLED; Loading Loading @@ -1598,7 +1599,7 @@ public class DataConnection extends StateMachine { switch (result) { case SUCCESS: // All is well mDcFailCause = DcFailCause.NONE; mDcFailCause = DataFailCause.NONE; transitionTo(mActiveState); break; case ERROR_RADIO_NOT_AVAILABLE: Loading Loading @@ -1762,7 +1763,7 @@ public class DataConnection extends StateMachine { if (DBG) { log("DcActiveState: EVENT_CONNECT cp=" + cp + " dc=" + DataConnection.this); } notifyConnectCompleted(cp, DcFailCause.NONE, false); notifyConnectCompleted(cp, DataFailCause.NONE, false); retVal = HANDLED; break; } Loading Loading @@ -1816,7 +1817,7 @@ public class DataConnection extends StateMachine { log("DcActiveState EVENT_LOST_CONNECTION dc=" + DataConnection.this); } mInactiveState.setEnterNotificationParams(DcFailCause.LOST_CONNECTION); mInactiveState.setEnterNotificationParams(DataFailCause.LOST_CONNECTION); transitionTo(mInactiveState); retVal = HANDLED; break; Loading Loading @@ -2104,7 +2105,7 @@ public class DataConnection extends StateMachine { // Transition to inactive but send notifications after // we've entered the mInactive state. mInactiveState.setEnterNotificationParams(cp, DcFailCause.UNACCEPTABLE_NETWORK_PARAMETER); DataFailCause.UNACCEPTABLE_NETWORK_PARAMETER); transitionTo(mInactiveState); } else { if (DBG) { Loading
src/java/com/android/internal/telephony/dataconnection/DcController.java +2 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.os.Build; import android.os.Handler; import android.os.Message; import android.telephony.AccessNetworkConstants.TransportType; import android.telephony.DataFailCause; import android.telephony.PhoneStateListener; import android.telephony.Rlog; import android.telephony.TelephonyManager; Loading Loading @@ -330,7 +331,7 @@ public class DcController extends StateMachine { apnsToCleanup.addAll(apnContexts); mDct.isCleanupRequired.set(false); } else { DcFailCause failCause = DcFailCause.fromInt(newState.getStatus()); DataFailCause failCause = DataFailCause.fromInt(newState.getStatus()); if (failCause.isRadioRestartFailure(mPhone.getContext(), mPhone.getSubId())) { if (DBG) { Loading
src/java/com/android/internal/telephony/dataconnection/DcFailBringUp.java +5 −4 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.internal.telephony.dataconnection; import android.content.Intent; import android.telephony.DataFailCause; import android.telephony.Rlog; /** Loading @@ -39,8 +40,8 @@ public class DcFailBringUp { // failCause with its --ei option name and default value static final String FAIL_CAUSE = "fail_cause"; static final DcFailCause DEFAULT_FAIL_CAUSE = DcFailCause.ERROR_UNSPECIFIED; DcFailCause mFailCause; static final DataFailCause DEFAULT_FAIL_CAUSE = DataFailCause.ERROR_UNSPECIFIED; DataFailCause mFailCause; // suggestedRetryTime with its --ei option name and default value static final String SUGGESTED_RETRY_TIME = "suggested_retry_time"; Loading @@ -51,7 +52,7 @@ public class DcFailBringUp { void saveParameters(Intent intent, String s) { if (DBG) log(s + ".saveParameters: action=" + intent.getAction()); mCounter = intent.getIntExtra(COUNTER, DEFAULT_COUNTER); mFailCause = DcFailCause.fromInt( mFailCause = DataFailCause.fromInt( intent.getIntExtra(FAIL_CAUSE, DEFAULT_FAIL_CAUSE.getErrorCode())); mSuggestedRetryTime = intent.getIntExtra(SUGGESTED_RETRY_TIME, DEFAULT_SUGGESTED_RETRY_TIME); Loading @@ -62,7 +63,7 @@ public class DcFailBringUp { public void saveParameters(int counter, int failCause, int suggestedRetryTime) { mCounter = counter; mFailCause = DcFailCause.fromInt(failCause); mFailCause = DataFailCause.fromInt(failCause); mSuggestedRetryTime = suggestedRetryTime; } Loading
src/java/com/android/internal/telephony/dataconnection/DcFailCause.javadeleted 100644 → 0 +0 −259 Original line number Diff line number Diff line /* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.telephony.dataconnection; import android.content.Context; import android.os.PersistableBundle; import android.telephony.CarrierConfigManager; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; /** * Returned as the reason for a connection failure as defined * by RIL_DataCallFailCause in ril.h and some local errors. */ public enum DcFailCause { NONE(0), // This series of errors as specified by the standards // specified in ril.h OPERATOR_BARRED(0x08), /* no retry */ NAS_SIGNALLING(0x0E), LLC_SNDCP(0x19), INSUFFICIENT_RESOURCES(0x1A), MISSING_UNKNOWN_APN(0x1B), /* no retry */ UNKNOWN_PDP_ADDRESS_TYPE(0x1C), /* no retry */ USER_AUTHENTICATION(0x1D), /* no retry */ ACTIVATION_REJECT_GGSN(0x1E), /* no retry */ ACTIVATION_REJECT_UNSPECIFIED(0x1F), SERVICE_OPTION_NOT_SUPPORTED(0x20), /* no retry */ SERVICE_OPTION_NOT_SUBSCRIBED(0x21), /* no retry */ SERVICE_OPTION_OUT_OF_ORDER(0x22), NSAPI_IN_USE(0x23), /* no retry */ REGULAR_DEACTIVATION(0x24), /* possibly restart radio, based on config */ QOS_NOT_ACCEPTED(0x25), NETWORK_FAILURE(0x26), UMTS_REACTIVATION_REQ(0x27), FEATURE_NOT_SUPP(0x28), TFT_SEMANTIC_ERROR(0x29), TFT_SYTAX_ERROR(0x2A), UNKNOWN_PDP_CONTEXT(0x2B), FILTER_SEMANTIC_ERROR(0x2C), FILTER_SYTAX_ERROR(0x2D), PDP_WITHOUT_ACTIVE_TFT(0x2E), ONLY_IPV4_ALLOWED(0x32), /* no retry */ ONLY_IPV6_ALLOWED(0x33), /* no retry */ ONLY_SINGLE_BEARER_ALLOWED(0x34), ESM_INFO_NOT_RECEIVED(0x35), PDN_CONN_DOES_NOT_EXIST(0x36), MULTI_CONN_TO_SAME_PDN_NOT_ALLOWED(0x37), MAX_ACTIVE_PDP_CONTEXT_REACHED(0x41), UNSUPPORTED_APN_IN_CURRENT_PLMN(0x42), INVALID_TRANSACTION_ID(0x51), MESSAGE_INCORRECT_SEMANTIC(0x5F), INVALID_MANDATORY_INFO(0x60), MESSAGE_TYPE_UNSUPPORTED(0x61), MSG_TYPE_NONCOMPATIBLE_STATE(0x62), UNKNOWN_INFO_ELEMENT(0x63), CONDITIONAL_IE_ERROR(0x64), MSG_AND_PROTOCOL_STATE_UNCOMPATIBLE(0x65), PROTOCOL_ERRORS(0x6F), /* no retry */ APN_TYPE_CONFLICT(0x70), INVALID_PCSCF_ADDR(0x71), INTERNAL_CALL_PREEMPT_BY_HIGH_PRIO_APN(0x72), EMM_ACCESS_BARRED(0x73), EMERGENCY_IFACE_ONLY(0x74), IFACE_MISMATCH(0x75), COMPANION_IFACE_IN_USE(0x76), IP_ADDRESS_MISMATCH(0x77), IFACE_AND_POL_FAMILY_MISMATCH(0x78), EMM_ACCESS_BARRED_INFINITE_RETRY(0x79), AUTH_FAILURE_ON_EMERGENCY_CALL(0x7A), // OEM sepecific error codes. To be used by OEMs when they don't // want to reveal error code which would be replaced by ERROR_UNSPECIFIED OEM_DCFAILCAUSE_1(0x1001), OEM_DCFAILCAUSE_2(0x1002), OEM_DCFAILCAUSE_3(0x1003), OEM_DCFAILCAUSE_4(0x1004), OEM_DCFAILCAUSE_5(0x1005), OEM_DCFAILCAUSE_6(0x1006), OEM_DCFAILCAUSE_7(0x1007), OEM_DCFAILCAUSE_8(0x1008), OEM_DCFAILCAUSE_9(0x1009), OEM_DCFAILCAUSE_10(0x100A), OEM_DCFAILCAUSE_11(0x100B), OEM_DCFAILCAUSE_12(0x100C), OEM_DCFAILCAUSE_13(0x100D), OEM_DCFAILCAUSE_14(0x100E), OEM_DCFAILCAUSE_15(0x100F), // Local errors generated by Vendor RIL // specified in ril.h REGISTRATION_FAIL(-1), GPRS_REGISTRATION_FAIL(-2), SIGNAL_LOST(-3), /* no retry */ PREF_RADIO_TECH_CHANGED(-4), RADIO_POWER_OFF(-5), /* no retry */ TETHERED_CALL_ACTIVE(-6), /* no retry */ ERROR_UNSPECIFIED(0xFFFF), // Errors generated by the Framework // specified here UNKNOWN(0x10000), RADIO_NOT_AVAILABLE(0x10001), /* no retry */ UNACCEPTABLE_NETWORK_PARAMETER(0x10002), /* no retry */ CONNECTION_TO_DATACONNECTIONAC_BROKEN(0x10003), LOST_CONNECTION(0x10004), RESET_BY_FRAMEWORK(0x10005); private final int mErrorCode; private static final HashMap<Integer, DcFailCause> sErrorCodeToFailCauseMap; static { sErrorCodeToFailCauseMap = new HashMap<Integer, DcFailCause>(); for (DcFailCause fc : values()) { sErrorCodeToFailCauseMap.put(fc.getErrorCode(), fc); } } /** * Map of subId -> set of data call setup permanent failure for the carrier. */ private static final HashMap<Integer, HashSet<DcFailCause>> sPermanentFailureCache = new HashMap<>(); DcFailCause(int errorCode) { mErrorCode = errorCode; } public int getErrorCode() { return mErrorCode; } /** * Returns whether or not the fail cause is a failure that requires a modem restart * * @param context device context * @param subId subscription index * @return true if the fail cause code needs platform to trigger a modem restart. */ public boolean isRadioRestartFailure(Context context, int subId) { CarrierConfigManager configManager = (CarrierConfigManager) context.getSystemService(Context.CARRIER_CONFIG_SERVICE); if (configManager != null) { PersistableBundle b = configManager.getConfigForSubId(subId); if (b != null) { if (this == REGULAR_DEACTIVATION && b.getBoolean(CarrierConfigManager .KEY_RESTART_RADIO_ON_PDP_FAIL_REGULAR_DEACTIVATION_BOOL)) { // This is for backward compatibility support. We need to continue support this // old configuration until it gets removed in the future. return true; } // Check the current configurations. int[] causeCodes = b.getIntArray(CarrierConfigManager .KEY_RADIO_RESTART_FAILURE_CAUSES_INT_ARRAY); if (causeCodes != null) { return Arrays.stream(causeCodes).anyMatch(i -> i == getErrorCode()); } } } return false; } public boolean isPermanentFailure(Context context, int subId) { synchronized (sPermanentFailureCache) { HashSet<DcFailCause> permanentFailureSet = sPermanentFailureCache.get(subId); // In case of cache miss, we need to look up the settings from carrier config. if (permanentFailureSet == null) { // Retrieve the permanent failure from carrier config CarrierConfigManager configManager = (CarrierConfigManager) context.getSystemService(Context.CARRIER_CONFIG_SERVICE); if (configManager != null) { PersistableBundle b = configManager.getConfigForSubId(subId); if (b != null) { String[] permanentFailureStrings = b.getStringArray(CarrierConfigManager. KEY_CARRIER_DATA_CALL_PERMANENT_FAILURE_STRINGS); if (permanentFailureStrings != null) { permanentFailureSet = new HashSet<>(); for (String failure : permanentFailureStrings) { permanentFailureSet.add(DcFailCause.valueOf(failure)); } } } } // If we are not able to find the configuration from carrier config, use the default // ones. if (permanentFailureSet == null) { permanentFailureSet = new HashSet<DcFailCause>() { { add(OPERATOR_BARRED); add(MISSING_UNKNOWN_APN); add(UNKNOWN_PDP_ADDRESS_TYPE); add(USER_AUTHENTICATION); add(ACTIVATION_REJECT_GGSN); add(SERVICE_OPTION_NOT_SUPPORTED); add(SERVICE_OPTION_NOT_SUBSCRIBED); add(NSAPI_IN_USE); add(ONLY_IPV4_ALLOWED); add(ONLY_IPV6_ALLOWED); add(PROTOCOL_ERRORS); add(RADIO_POWER_OFF); add(TETHERED_CALL_ACTIVE); add(RADIO_NOT_AVAILABLE); add(UNACCEPTABLE_NETWORK_PARAMETER); add(SIGNAL_LOST); } }; } sPermanentFailureCache.put(subId, permanentFailureSet); } return permanentFailureSet.contains(this); } } public boolean isEventLoggable() { return (this == OPERATOR_BARRED) || (this == INSUFFICIENT_RESOURCES) || (this == UNKNOWN_PDP_ADDRESS_TYPE) || (this == USER_AUTHENTICATION) || (this == ACTIVATION_REJECT_GGSN) || (this == ACTIVATION_REJECT_UNSPECIFIED) || (this == SERVICE_OPTION_NOT_SUBSCRIBED) || (this == SERVICE_OPTION_NOT_SUPPORTED) || (this == SERVICE_OPTION_OUT_OF_ORDER) || (this == NSAPI_IN_USE) || (this == ONLY_IPV4_ALLOWED) || (this == ONLY_IPV6_ALLOWED) || (this == PROTOCOL_ERRORS) || (this == SIGNAL_LOST) || (this == RADIO_POWER_OFF) || (this == TETHERED_CALL_ACTIVE) || (this == UNACCEPTABLE_NETWORK_PARAMETER); } public static DcFailCause fromInt(int errorCode) { DcFailCause fc = sErrorCodeToFailCauseMap.get(errorCode); if (fc == null) { fc = UNKNOWN; } return fc; } }
src/java/com/android/internal/telephony/dataconnection/DcTesterFailBringUpAll.java +4 −3 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.os.Build; import android.os.Handler; import android.telephony.DataFailCause; import android.telephony.Rlog; import com.android.internal.telephony.Phone; Loading @@ -35,7 +36,7 @@ import com.android.internal.telephony.Phone; * Also you can add a suggested retry time if desired: * --ei suggested_retry_time 5000 * * The fail_cause is one of {@link DcFailCause} * The fail_cause is one of {@link DataFailCause} */ public class DcTesterFailBringUpAll { private static final String LOG_TAG = "DcTesterFailBrinupAll"; Loading @@ -61,12 +62,12 @@ public class DcTesterFailBringUpAll { // Counter is MAX, bringUp/retry will always fail log("simulate detaching"); mFailBringUp.saveParameters(Integer.MAX_VALUE, DcFailCause.LOST_CONNECTION.getErrorCode(), DataFailCause.LOST_CONNECTION.getErrorCode(), DcFailBringUp.DEFAULT_SUGGESTED_RETRY_TIME); } else if (action.equals(mPhone.getActionAttached())) { // Counter is 0 next bringUp/retry will succeed log("simulate attaching"); mFailBringUp.saveParameters(0, DcFailCause.NONE.getErrorCode(), mFailBringUp.saveParameters(0, DataFailCause.NONE.getErrorCode(), DcFailBringUp.DEFAULT_SUGGESTED_RETRY_TIME); } else { if (DBG) log("onReceive: unknown action=" + action); Loading