DO NOT MERGE Fixing Connectivity
Passing Gateway addr info from telephony into ConnectivityService so it can add/remove the default route as needed. Fixed differently on master. bug:2927822 Change-Id: I9a3ee7cd23c4717e7c60098f0595aa3f77c44b15
This commit is contained in:
parent
0ef6875b30
commit
da9f734152
1 changed files with 15 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue