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

Commit 068138e0 authored by Steve Kondik's avatar Steve Kondik
Browse files

Merge tag 'android-4.3_r3.1' of...

Merge tag 'android-4.3_r3.1' of https://android.googlesource.com/platform/frameworks/opt/telephony into cm-10.2

Android 4.3 Release 3.1
parents 348bd6b2 b7628116
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -17,8 +17,10 @@
package com.android.internal.telephony.dataconnection;

import android.app.PendingIntent;
import android.content.Context;
import android.telephony.Rlog;

import com.android.internal.R;
import com.android.internal.telephony.DctConstants;
import com.android.internal.telephony.Phone;

@@ -37,6 +39,8 @@ public class ApnContext {

    protected static final boolean DBG = false;

    private final Context mContext;

    private final String mApnType;

    private DctConstants.State mState;
@@ -64,7 +68,8 @@ public class ApnContext {
     */
    AtomicBoolean mDependencyMet;

    public ApnContext(String apnType, String logTag) {
    public ApnContext(Context context, String apnType, String logTag) {
        mContext = context;
        mApnType = apnType;
        mState = DctConstants.State.IDLE;
        setReason(Phone.REASON_DATA_ENABLED);
@@ -214,6 +219,16 @@ public class ApnContext {
       return mDependencyMet.get();
    }

    public boolean isProvisioningApn() {
        String provisioningApn = mContext.getResources()
                .getString(R.string.mobile_provisioning_apn);
        if (mApnSetting != null) {
            return (mApnSetting.apn.equals(provisioningApn));
        } else {
            return false;
        }
    }

    @Override
    public synchronized String toString() {
        // We don't print mDataConnection because its recursive.
+33 −5
Original line number Diff line number Diff line
@@ -1222,13 +1222,29 @@ public final class DataConnection extends StateMachine {
                            if (DBG) {
                                log("DcActivatingState: ERR_RilError "
                                        + " delay=" + delay
                                        + " isRetryNeeded=" + mRetryManager.isRetryNeeded());
                            }
                            if (delay >= 0) {
                                        + " isRetryNeeded=" + mRetryManager.isRetryNeeded()
                                        + " result=" + result
                                        + " result.isRestartRadioFail=" +
                                                result.mFailCause.isRestartRadioFail()
                                        + " result.isPermanentFail=" +
                                                result.mFailCause.isPermanentFail());
                            }
                            if (result.mFailCause.isRestartRadioFail()) {
                                if (DBG) log("DcActivatingState: ERR_RilError restart radio");
                                mDct.sendRestartRadio();
                                mInactiveState.setEnterNotificationParams(cp, result.mFailCause);
                                transitionTo(mInactiveState);
                            } else if (result.mFailCause.isPermanentFail()) {
                                if (DBG) log("DcActivatingState: ERR_RilError perm error");
                                mInactiveState.setEnterNotificationParams(cp, result.mFailCause);
                                transitionTo(mInactiveState);
                            } else if (delay >= 0) {
                                if (DBG) log("DcActivatingState: ERR_RilError retry");
                                mDcRetryAlarmController.startRetryAlarm(EVENT_RETRY_CONNECTION,
                                                            mTag, delay);
                                transitionTo(mRetryingState);
                            } else {
                                if (DBG) log("DcActivatingState: ERR_RilError no retry");
                                mInactiveState.setEnterNotificationParams(cp, result.mFailCause);
                                transitionTo(mInactiveState);
                            }
@@ -1268,13 +1284,25 @@ public final class DataConnection extends StateMachine {
                                    + " isRetryNeeded=" + mRetryManager.isRetryNeeded()
                                    + " dc=" + DataConnection.this);
                        }
                        if (mRetryManager.isRetryNeeded()) {
                        if (cause.isRestartRadioFail()) {
                            if (DBG) {
                                log("DcActivatingState: EVENT_GET_LAST_FAIL_DONE"
                                        + " restart radio");
                            }
                            mDct.sendRestartRadio();
                            mInactiveState.setEnterNotificationParams(cp, cause);
                            transitionTo(mInactiveState);
                        } else if (cause.isPermanentFail()) {
                            if (DBG) log("DcActivatingState: EVENT_GET_LAST_FAIL_DONE perm er");
                            mInactiveState.setEnterNotificationParams(cp, cause);
                            transitionTo(mInactiveState);
                        } else if ((retryDelay >= 0) && (mRetryManager.isRetryNeeded())) {
                            if (DBG) log("DcActivatingState: EVENT_GET_LAST_FAIL_DONE retry");
                            mDcRetryAlarmController.startRetryAlarm(EVENT_RETRY_CONNECTION, mTag,
                                                            retryDelay);
                            transitionTo(mRetryingState);
                        } else {
                            // Transition to inactive but send notifications after
                            // we've entered the mInactive state.
                            if (DBG) log("DcActivatingState: EVENT_GET_LAST_FAIL_DONE no retry");
                            mInactiveState.setEnterNotificationParams(cp, cause);
                            transitionTo(mInactiveState);
                        }
+12 −2
Original line number Diff line number Diff line
@@ -224,8 +224,18 @@ class DcController extends StateMachine {
                    if (DBG) log("onDataStateChanged: Found ConnId=" + newState.cid
                            + " newState=" + newState.toString());
                    if (newState.active == DATA_CONNECTION_ACTIVE_PH_LINK_INACTIVE) {
                        DcFailCause failCause = DcFailCause.fromInt(newState.status);
                        if (DBG) log("onDataStateChanged: inactive failCause=" + failCause);
                        if (failCause.isRestartRadioFail()) {
                            if (DBG) log("onDataStateChanged: X restart radio");
                            mDct.sendRestartRadio();
                        } else if (failCause.isPermanentFail()) {
                            if (DBG) log("onDataStateChanged: inactive, add to cleanup list");
                            apnsToCleanup.addAll(dc.mApnContexts);
                        } else {
                            if (DBG) log("onDataStateChanged: inactive, add to retry list");
                            dcsToRetry.add(dc);
                        }
                    } else {
                        // Its active so update the DataConnections link properties
                        UpdateLinkPropertyResult result = dc.updateLinkProperty(newState);
+25 −18
Original line number Diff line number Diff line
@@ -26,37 +26,38 @@ public enum DcFailCause {

    // This series of errors as specified by the standards
    // specified in ril.h
    OPERATOR_BARRED(0x08),
    OPERATOR_BARRED(0x08),                  /* no retry */
    INSUFFICIENT_RESOURCES(0x1A),
    MISSING_UNKNOWN_APN(0x1B),
    UNKNOWN_PDP_ADDRESS_TYPE(0x1C),
    USER_AUTHENTICATION(0x1D),
    ACTIVATION_REJECT_GGSN(0x1E),
    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),
    SERVICE_OPTION_NOT_SUBSCRIBED(0x21),
    SERVICE_OPTION_NOT_SUPPORTED(0x20),     /* no retry */
    SERVICE_OPTION_NOT_SUBSCRIBED(0x21),    /* no retry */
    SERVICE_OPTION_OUT_OF_ORDER(0x22),
    NSAPI_IN_USE(0x23),
    ONLY_IPV4_ALLOWED(0x32),
    ONLY_IPV6_ALLOWED(0x33),
    NSAPI_IN_USE(0x23),                     /* no retry */
    REGULAR_DEACTIVATION(0x24),             /* Restart radio */
    ONLY_IPV4_ALLOWED(0x32),                /* no retry */
    ONLY_IPV6_ALLOWED(0x33),                /* no retry */
    ONLY_SINGLE_BEARER_ALLOWED(0x34),
    PROTOCOL_ERRORS(0x6F),
    PROTOCOL_ERRORS(0x6F),                  /* no retry */

    // Local errors generated by Vendor RIL
    // specified in ril.h
    REGISTRATION_FAIL(-1),
    GPRS_REGISTRATION_FAIL(-2),
    SIGNAL_LOST(-3),
    PREF_RADIO_TECH_CHANGED(-4),
    RADIO_POWER_OFF(-5),
    TETHERED_CALL_ACTIVE(-6),
    SIGNAL_LOST(-3),                        /* no retry */
    PREF_RADIO_TECH_CHANGED(-4),            /* no retry */
    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),
    UNACCEPTABLE_NETWORK_PARAMETER(0x10002),
    RADIO_NOT_AVAILABLE(0x10001),                   /* no retry */
    UNACCEPTABLE_NETWORK_PARAMETER(0x10002),        /* no retry */
    CONNECTION_TO_DATACONNECTIONAC_BROKEN(0x10003),
    LOST_CONNECTION(0x10004),
    RESET_BY_FRAMEWORK(0x10005);
@@ -78,6 +79,11 @@ public enum DcFailCause {
        return mErrorCode;
    }

    /** Radio has failed such that the radio should be restarted */
    public boolean isRestartRadioFail() {
        return (this == REGULAR_DEACTIVATION);
    }

    public boolean isPermanentFail() {
        return (this == OPERATOR_BARRED) || (this == MISSING_UNKNOWN_APN) ||
               (this == UNKNOWN_PDP_ADDRESS_TYPE) || (this == USER_AUTHENTICATION) ||
@@ -85,7 +91,8 @@ public enum DcFailCause {
               (this == SERVICE_OPTION_NOT_SUBSCRIBED) || (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 == RADIO_POWER_OFF) || (this == TETHERED_CALL_ACTIVE) ||
               (this == RADIO_NOT_AVAILABLE) || (this == UNACCEPTABLE_NETWORK_PARAMETER);
    }

    public boolean isEventLoggable() {
+90 −15
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.internal.telephony.dataconnection;

import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.ActivityNotFoundException;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
@@ -38,6 +39,7 @@ import android.os.Message;
import android.os.Messenger;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.provider.Settings;
import android.provider.Telephony;
import android.telephony.CellLocation;
@@ -53,6 +55,7 @@ import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneBase;
import com.android.internal.telephony.DctConstants;
import com.android.internal.telephony.EventLogTags;
import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.gsm.GSMPhone;
import com.android.internal.telephony.cdma.CdmaSubscriptionSourceManager;
import com.android.internal.telephony.PhoneConstants;
@@ -237,7 +240,7 @@ public final class DcTracker extends DcTrackerBase {
    }

    private ApnContext addApnContext(String type) {
        ApnContext apnContext = new ApnContext(type, LOG_TAG);
        ApnContext apnContext = new ApnContext(mPhone.getContext(), type, LOG_TAG);
        apnContext.setDependencyMet(false);
        mApnContexts.put(type, apnContext);
        return apnContext;
@@ -377,6 +380,16 @@ public final class DcTracker extends DcTrackerBase {
        return DctConstants.State.FAILED;
    }

    // Return if apn type is a provisioning apn.
    @Override
    protected boolean isProvisioningApn(String apnType) {
        ApnContext apnContext = mApnContexts.get(apnType);
        if (apnContext != null) {
            return apnContext.isProvisioningApn();
        }
        return false;
    }

    // Return state of overall
    @Override
    public DctConstants.State getOverallState() {
@@ -637,7 +650,7 @@ public final class DcTracker extends DcTrackerBase {

        if (apnContext == null ){
            if (DBG) log("trySetupData new apn context for type:" + type);
            apnContext = new ApnContext(type, LOG_TAG);
            apnContext = new ApnContext(mPhone.getContext(), type, LOG_TAG);
            mApnContexts.put(type, apnContext);
        }
        apnContext.setReason(reason);
@@ -1225,18 +1238,6 @@ public final class DcTracker extends DcTrackerBase {
        if (DBG) log("onDataStateChanged(ar): X");
    }

    private void notifyDefaultData(ApnContext apnContext) {
        if (DBG) {
            log("notifyDefaultData: type=" + apnContext.getApnType()
                + ", reason:" + apnContext.getReason());
        }
        apnContext.setState(DctConstants.State.CONNECTED);
        // setState(DctConstants.State.CONNECTED);
        mPhone.notifyDataConnection(apnContext.getReason(), apnContext.getApnType());
        startNetStatPoll();
        startDataStallAlarm(DATA_STALL_NOT_SUSPECTED);
    }

    // TODO: For multiple Active APNs not exactly sure how to do this.
    @Override
    protected void gotoIdleAndNotifyDataConnection(String reason) {
@@ -1572,6 +1573,35 @@ public final class DcTracker extends DcTrackerBase {
        notifyOffApnsOfAvailability(null);
    }

    @Override
    protected void completeConnection(ApnContext apnContext) {
        boolean isProvApn = apnContext.isProvisioningApn();

        if (DBG) log("completeConnection: successful, notify the world apnContext=" + apnContext);

        if (mIsProvisioning && !TextUtils.isEmpty(mProvisioningUrl)) {
            if (DBG) {
                log("completeConnection: MOBILE_PROVISIONING_ACTION url="
                        + mProvisioningUrl);
            }
            Intent newIntent =
                    new Intent(Intent.ACTION_VIEW, Uri.parse(mProvisioningUrl));
            newIntent.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT |
                    Intent.FLAG_ACTIVITY_NEW_TASK);
            try {
                mPhone.getContext().startActivity(newIntent);
            } catch (ActivityNotFoundException e) {
                loge("completeConnection: startActivityAsUser failed" + e);
            }
        }
        mIsProvisioning = false;
        mProvisioningUrl = null;

        mPhone.notifyDataConnection(apnContext.getReason(), apnContext.getApnType());
        startNetStatPoll();
        startDataStallAlarm(DATA_STALL_NOT_SUSPECTED);
    }

    /**
     * A SETUP (aka bringUp) has completed, possibly with an error. If
     * there is an error this method will call {@link #onDataSetupCompleteError}.
@@ -1645,7 +1675,52 @@ public final class DcTracker extends DcTrackerBase {
                } else {
                    SystemProperties.set(PUPPET_MASTER_RADIO_STRESS_TEST, "false");
                }
                notifyDefaultData(apnContext);

                // A connection is setup
                apnContext.setState(DctConstants.State.CONNECTED);
                boolean isProvApn = apnContext.isProvisioningApn();
                if ((!isProvApn) || mIsProvisioning) {
                    // Complete the connection normally notifying the world we're connected.
                    // We do this if this isn't a special provisioning apn or if we've been
                    // told its time to provision.
                    completeConnection(apnContext);
                } else {
                    // This is a provisioning APN that we're reporting as connected. Later
                    // when the user desires to upgrade this to a "default" connection,
                    // mIsProvisioning == true, we'll go through the code path above.
                    // mIsProvisioning becomes true when CMD_ENABLE_MOBILE_PROVISIONING
                    // is sent to the DCT.
                    if (DBG) {
                        log("onDataSetupComplete: successful, BUT send connected to prov apn as"
                                + " mIsProvisioning:" + mIsProvisioning + " == false"
                                + " && (isProvisioningApn:" + isProvApn + " == true");
                    }

                    Intent intent = new Intent(
                            TelephonyIntents.ACTION_DATA_CONNECTION_CONNECTED_TO_PROVISIONING_APN);
                    intent.putExtra(PhoneConstants.DATA_APN_KEY, apnContext.getApnSetting().apn);
                    intent.putExtra(PhoneConstants.DATA_APN_TYPE_KEY, apnContext.getApnType());

                    String apnType = apnContext.getApnType();
                    LinkProperties linkProperties = getLinkProperties(apnType);
                    if (linkProperties != null) {
                        intent.putExtra(PhoneConstants.DATA_LINK_PROPERTIES_KEY, linkProperties);
                        String iface = linkProperties.getInterfaceName();
                        if (iface != null) {
                            intent.putExtra(PhoneConstants.DATA_IFACE_NAME_KEY, iface);
                        }
                    }
                    LinkCapabilities linkCapabilities = getLinkCapabilities(apnType);
                    if (linkCapabilities != null) {
                        intent.putExtra(PhoneConstants.DATA_LINK_CAPABILITIES_KEY, linkCapabilities);
                    }

                    mPhone.getContext().sendBroadcastAsUser(intent, UserHandle.ALL);
                }
                if (DBG) {
                    log("onDataSetupComplete: SETUP complete type=" + apnContext.getApnType()
                        + ", reason:" + apnContext.getReason());
                }
            }
        } else {
            cause = (DcFailCause) (ar.result);
Loading