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

Commit 89a54408 authored by Robert Greenwalt's avatar Robert Greenwalt Committed by Android (Google) Code Review
Browse files

Merge "Update networktype before sending state change." into gingerbread

parents 591a5f86 67881c41
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -149,6 +149,11 @@ public class MobileDataStateTracker extends NetworkStateTracker {
        ConnectivityManager mConnectivityManager;
        public void onReceive(Context context, Intent intent) {
            synchronized(this) {
                // update state and roaming before we set the state - only state changes are
                // noticed
                TelephonyManager tm = TelephonyManager.getDefault();
                setRoamingStatus(tm.isNetworkRoaming());
                setSubtype(tm.getNetworkType(), tm.getNetworkTypeName());
                if (intent.getAction().equals(TelephonyIntents.
                        ACTION_ANY_DATA_CONNECTION_STATE_CHANGED)) {
                    Phone.DataState state = getMobileDataState(intent);
@@ -254,9 +259,6 @@ public class MobileDataStateTracker extends NetworkStateTracker {
                            reason == null ? "" : "(" + reason + ")");
                    setDetailedState(DetailedState.FAILED, reason, apnName);
                }
                TelephonyManager tm = TelephonyManager.getDefault();
                setRoamingStatus(tm.isNetworkRoaming());
                setSubtype(tm.getNetworkType(), tm.getNetworkTypeName());
            }
        }
    }
+5 −5
Original line number Diff line number Diff line
@@ -327,10 +327,10 @@ public abstract class NetworkStateTracker extends Handler {
    }

    protected void setSubtype(int subtype, String subtypeName) {
        if (mNetworkInfo.isConnected()) {
        int oldSubtype = mNetworkInfo.getSubtype();
        if (subtype != oldSubtype) {
            mNetworkInfo.setSubtype(subtype, subtypeName);
            if (mNetworkInfo.isConnected()) {
                Message msg = mTarget.obtainMessage(
                        EVENT_NETWORK_SUBTYPE_CHANGED, oldSubtype, 0, mNetworkInfo);
                msg.sendToTarget();