Use the updated RouteInfo API.
Bug: 15142362 Bug: 13885501 Change-Id: I97f1625e037c889b0cddd3db418c42c1d48b26b9
This commit is contained in:
@@ -28,6 +28,7 @@ import android.content.IntentFilter;
|
|||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
|
import android.net.LinkAddress;
|
||||||
import android.net.NetworkUtils;
|
import android.net.NetworkUtils;
|
||||||
import android.net.RouteInfo;
|
import android.net.RouteInfo;
|
||||||
import android.net.wifi.ScanResult;
|
import android.net.wifi.ScanResult;
|
||||||
@@ -525,7 +526,7 @@ public class Connectivity extends Activity {
|
|||||||
private void onAddDefaultRoute() {
|
private void onAddDefaultRoute() {
|
||||||
try {
|
try {
|
||||||
int netId = Integer.valueOf(((TextView) findViewById(R.id.netid)).getText().toString());
|
int netId = Integer.valueOf(((TextView) findViewById(R.id.netid)).getText().toString());
|
||||||
mNetd.addRoute(netId, new RouteInfo(null,
|
mNetd.addRoute(netId, new RouteInfo((LinkAddress) null,
|
||||||
NetworkUtils.numericToInetAddress("8.8.8.8")));
|
NetworkUtils.numericToInetAddress("8.8.8.8")));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(TAG, "onAddDefaultRoute got exception: " + e.toString());
|
Log.e(TAG, "onAddDefaultRoute got exception: " + e.toString());
|
||||||
@@ -535,7 +536,7 @@ public class Connectivity extends Activity {
|
|||||||
private void onRemoveDefaultRoute() {
|
private void onRemoveDefaultRoute() {
|
||||||
try {
|
try {
|
||||||
int netId = Integer.valueOf(((TextView) findViewById(R.id.netid)).getText().toString());
|
int netId = Integer.valueOf(((TextView) findViewById(R.id.netid)).getText().toString());
|
||||||
mNetd.removeRoute(netId, new RouteInfo(null,
|
mNetd.removeRoute(netId, new RouteInfo((LinkAddress) null,
|
||||||
NetworkUtils.numericToInetAddress("8.8.8.8")));
|
NetworkUtils.numericToInetAddress("8.8.8.8")));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(TAG, "onRemoveDefaultRoute got exception: " + e.toString());
|
Log.e(TAG, "onRemoveDefaultRoute got exception: " + e.toString());
|
||||||
|
|||||||
Reference in New Issue
Block a user