am 4b1bdc02: Merge "DO NOT MERGE Fixing Connectivity" into gingerbread
Merge commit '4b1bdc0209650436ebe0dad1020080cc891e97b6' into gingerbread-plus-aosp * commit '4b1bdc0209650436ebe0dad1020080cc891e97b6': DO NOT MERGE Fixing Connectivity
This commit is contained in:
@@ -240,6 +240,7 @@ public class MobileDataStateTracker extends NetworkStateTracker {
|
||||
if (mInterfaceName == null) {
|
||||
Log.d(TAG, "CONNECTED event did not supply interface name.");
|
||||
}
|
||||
mDefaultGatewayAddr = intent.getIntExtra(Phone.DATA_GATEWAY_KEY, 0);
|
||||
setDetailedState(DetailedState.CONNECTED, reason, apnName);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -128,4 +128,19 @@ public class NetworkUtils {
|
||||
| (addrBytes[0] & 0xff);
|
||||
return addr;
|
||||
}
|
||||
|
||||
public static int v4StringToInt(String str) {
|
||||
int result = 0;
|
||||
String[] array = str.split("\\.");
|
||||
if (array.length != 4) return 0;
|
||||
try {
|
||||
result = Integer.parseInt(array[3]);
|
||||
result = (result << 8) + Integer.parseInt(array[2]);
|
||||
result = (result << 8) + Integer.parseInt(array[1]);
|
||||
result = (result << 8) + Integer.parseInt(array[0]);
|
||||
} catch (NumberFormatException e) {
|
||||
return 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user