This patch fix the gprs registration on the cupcake version

Signed-off-by: Michael Trimarchi <[email protected]>
---
diff --git a/telephony/java/com/android/internal/telephony/gsm/PdpConnection.java b/telephony/java/com/android/internal/telephony/gsm/PdpConnection.java
index 66f8b72..4db730d 100644
--- a/telephony/java/com/android/internal/telephony/gsm/PdpConnection.java
+++ b/telephony/java/com/android/internal/telephony/gsm/PdpConnection.java
@@ -152,11 +152,6 @@ public class PdpConnection extends Handler {
         this.dataLink = null;
         receivedDisconnectReq = false;
         this.dnsServers = new String[2];
-
-        if (SystemProperties.get("ro.radio.use-ppp","no").equals("yes")) {
-            dataLink = new PppLink(phone.mDataConnection);
-            dataLink.setOnLinkChange(this, EVENT_LINK_STATE_CHANGED, null);
-        }
     }
 
     /**
@@ -196,6 +191,7 @@ public class PdpConnection extends Handler {
         if (state == PdpState.ACTIVE) {
             if (dataLink != null) {
                 dataLink.disconnect();
+                dataLink = null;
             }
 
             if (phone.mCM.getRadioState().isOn()) {
@@ -403,9 +399,9 @@ public class PdpConnection extends Handler {
                     } else {
                         String[] response = ((String[]) ar.result);
                         cid = Integer.parseInt(response[0]);
+                        interfaceName = response[1];
 
                         if (response.length > 2) {
-                            interfaceName = response[1];
                             ipAddress = response[2];
                             String prefix = "net." + interfaceName + ".";
                             gatewayAddress = SystemProperties.get(prefix + "gw");
@@ -435,6 +431,12 @@ public class PdpConnection extends Handler {
                             }
                         }
 
+
+                        if (SystemProperties.get("ro.radio.use-ppp","no").equals("yes")) {
+                            dataLink = new PppLink(phone.mDataConnection);
+                            dataLink.setOnLinkChange(this, EVENT_LINK_STATE_CHANGED, null);
+                        }
+
                         if (dataLink != null) {
                             dataLink.connect();
                         } else {
diff --git a/telephony/java/com/android/internal/telephony/gsm/PppLink.java b/telephony/java/com/android/internal/telephony/gsm/PppLink.java
index 43d4f1f..c687c4a 100644
--- a/telephony/java/com/android/internal/telephony/gsm/PppLink.java
+++ b/telephony/java/com/android/internal/telephony/gsm/PppLink.java
@@ -153,7 +153,8 @@ final class PppLink extends DataLink implements DataLinkInterface {
             if (ArrayUtils.equals(mCheckPPPBuffer, UP_ASCII_STRING, UP_ASCII_STRING.length)
                     || ArrayUtils.equals(mCheckPPPBuffer, UNKNOWN_ASCII_STRING,
                             UNKNOWN_ASCII_STRING.length) 
-                            && dataConnection.state == State.CONNECTING) {
+                            && dataConnection.state == State.INITING ||
+                            connecting) {
 
                 Log.i(LOG_TAG, 
                 "found ppp interface. Notifying GPRS connected");
_______________________________________________
android-freerunner mailing list
[email protected]
http://android.koolu.org/listinfo.cgi/android-freerunner-koolu.org

Reply via email to