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

Commit 73ad388a authored by Wink Saville's avatar Wink Saville Committed by Android (Google) Code Review
Browse files

Merge "Check different CellLocation type in GsmDataConnectionTracker" into honeycomb-LTE

parents 63edf6c4 8968f9f6
Loading
Loading
Loading
Loading
+20 −9
Original line number Diff line number Diff line
@@ -38,8 +38,10 @@ import android.os.SystemClock;
import android.os.SystemProperties;
import android.provider.Settings;
import android.provider.Telephony;
import android.telephony.CellLocation;
import android.telephony.ServiceState;
import android.telephony.TelephonyManager;
import android.telephony.cdma.CdmaCellLocation;
import android.telephony.gsm.GsmCellLocation;
import android.text.TextUtils;
import android.util.EventLog;
@@ -995,9 +997,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
                Log.i(LOG_TAG, "PDP connection has dropped. Reconnecting");

                // Add an event log when the network drops PDP
                int cid = -1;
                GsmCellLocation loc = ((GsmCellLocation)mPhone.getCellLocation());
                if (loc != null) cid = loc.getCid();
                int cid = getCellLocationId();
                EventLog.writeEvent(EventLogTags.PDP_NETWORK_DROP, cid,
                        TelephonyManager.getDefault().getNetworkType());

@@ -1018,9 +1018,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
                                    + " Reconnecting");

                    // Log the network drop on the event log.
                    int cid = -1;
                    GsmCellLocation loc = ((GsmCellLocation)mPhone.getCellLocation());
                    if (loc != null) cid = loc.getCid();
                    int cid = getCellLocationId();
                    EventLog.writeEvent(EventLogTags.PDP_NETWORK_DROP, cid,
                            TelephonyManager.getDefault().getNetworkType());

@@ -1522,10 +1520,9 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
            }
            if (cause.isEventLoggable()) {
                // Log this failure to the Event Logs.
                GsmCellLocation loc = ((GsmCellLocation)mPhone.getCellLocation());
                int cid = getCellLocationId();
                EventLog.writeEvent(EventLogTags.PDP_SETUP_FAIL,
                        cause.ordinal(), loc != null ? loc.getCid() : -1,
                        TelephonyManager.getDefault().getNetworkType());
                        cause.ordinal(), cid, TelephonyManager.getDefault().getNetworkType());
            }

            // Count permanent failures and remove the APN we just tried
@@ -1984,6 +1981,20 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
        }
    }

    private int getCellLocationId() {
        int cid = -1;
        CellLocation loc = mPhone.getCellLocation();

        if (loc != null) {
            if (loc instanceof GsmCellLocation) {
                cid = ((GsmCellLocation)loc).getCid();
            } else if (loc instanceof CdmaCellLocation) {
                cid = ((CdmaCellLocation)loc).getBaseStationId();
            }
        }
        return cid;
    }

    @Override
    public boolean isAnyActiveDataConnections() {
        return isConnected();