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

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

Merge "Use apn types instead of host when sending notifications."

parents a4db0115 26f5a384
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ public class MobileDataStateTracker implements NetworkStateTracker {

    private static final String TAG = "MobileDataStateTracker";
    private static final boolean DBG = true;
    private static final boolean VDBG = false;

    private Phone.DataState mMobileDataState;
    private ITelephony mPhoneService;
@@ -156,10 +157,15 @@ public class MobileDataStateTracker implements NetworkStateTracker {
    private class MobileDataStateReceiver extends BroadcastReceiver {
        IConnectivityManager mConnectivityManager;

        @Override
        public void onReceive(Context context, Intent intent) {
            if (intent.getAction().equals(TelephonyIntents.
                    ACTION_ANY_DATA_CONNECTION_STATE_CHANGED)) {
                String apnType = intent.getStringExtra(Phone.DATA_APN_TYPE_KEY);
                if (VDBG) Log.d(TAG,
                        String.format("Broadcast received: ACTION_ANY_DATA_CONNECTION_STATE_CHANGED"
                                            + "mApnType=%s %s received apnType=%s",
                        mApnType, TextUtils.equals(apnType, mApnType) ? "==" : "!=", apnType));
                if (!TextUtils.equals(apnType, mApnType)) {
                    return;
                }
@@ -249,6 +255,8 @@ public class MobileDataStateTracker implements NetworkStateTracker {
                    equals(TelephonyIntents.ACTION_DATA_CONNECTION_FAILED)) {
                String apnType = intent.getStringExtra(Phone.DATA_APN_TYPE_KEY);
                if (!TextUtils.equals(apnType, mApnType)) {
                    if (DBG) Log.d(TAG, String.format("Broadcast received: ACTION_ANY_DATA_CONNECTION_FAILED ignore, mApnType=%s != received apnType=%s",
                            mApnType, apnType));
                    return;
                }
                String reason = intent.getStringExtra(Phone.FAILURE_REASON_KEY);
@@ -256,6 +264,8 @@ public class MobileDataStateTracker implements NetworkStateTracker {
                if (DBG) Log.d(TAG, mApnType + "Received " + intent.getAction() +
                        " broadcast" + reason == null ? "" : "(" + reason + ")");
                setDetailedState(DetailedState.FAILED, reason, apnName);
            } else {
                if (DBG) Log.d(TAG, "Broadcast received: ignore " + intent.getAction());
            }
        }
    }
+2 −2
Original line number Diff line number Diff line
@@ -388,8 +388,8 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
            return;
        }
        Slog.i(TAG, "notifyDataConnection: state=" + state + " isDataConnectivityPossible="
                + isDataConnectivityPossible + " reason=" + reason
                + " apn=" + apn + " networkType=" + networkType);
                + isDataConnectivityPossible + " reason='" + reason
                + "' apn='" + apn + "' apnType=" + apnType + " networkType=" + networkType);
        synchronized (mRecords) {
            boolean modified = false;
            if (state == TelephonyManager.DATA_CONNECTED) {
+1 −1
Original line number Diff line number Diff line
@@ -687,7 +687,7 @@ public abstract class DataConnectionTracker extends Handler {

    public boolean isApnTypeEnabled(String apnType) {
        if (apnType == null) {
            apnType = getActiveApnString();
            apnType = getActiveApnType();
        }
        return isApnIdEnabled(apnTypeToId(apnType));
    }
+1 −1
Original line number Diff line number Diff line
@@ -115,7 +115,7 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
            mRegistry.notifyDataConnection(
                    convertDataState(state),
                    sender.isDataConnectivityPossible(), reason,
                    sender.getActiveApn(),
                    sender.getActiveApnHost(),
                    apnType,
                    linkProperties,
                    linkCapabilities,
+6 −5
Original line number Diff line number Diff line
@@ -309,16 +309,17 @@ public interface Phone {

    /**
     * Returns an array of string identifiers for the APN types serviced by the
     * currently active or last connected APN.
     *  @return The string array.
     * currently active.
     *  @return The string array will always return at least one entry, Phone.APN_TYPE_DEFAULT.
     * TODO: Revisit if we always should return at least one entry.
     */
    String[] getActiveApnTypes();

    /**
     * Returns a string identifier for currently active or last connected APN.
     *  @return The string name.
     * Returns string for the active APN host.
     *  @return type as a string or null if none.
     */
    String getActiveApn();
    String getActiveApnHost();

    /**
     * Return the LinkProperties for the named apn or null if not available
Loading