Update the Dev Tools app to the new route add/remove API.
Cherry-pick of: https://googleplex-android-review.git.corp.google.com/#/c/450447/ Change-Id: I629123567c907f0979e44998ef8d828b47059ec0
This commit is contained in:
committed by
Lorenzo Colitti
parent
f98bce8f58
commit
b24ff8773d
@@ -284,6 +284,14 @@
|
|||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/netid" />
|
||||||
|
<EditText android:id="@+id/netid"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minEms="5" />
|
||||||
<Button android:id="@+id/add_default_route"
|
<Button android:id="@+id/add_default_route"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -43,6 +43,7 @@
|
|||||||
<string name="start_hipri">Start HiPri</string>
|
<string name="start_hipri">Start HiPri</string>
|
||||||
<string name="stop_hipri">Stop HiPri</string>
|
<string name="stop_hipri">Stop HiPri</string>
|
||||||
<string name="crash">CRASH</string>
|
<string name="crash">CRASH</string>
|
||||||
|
<string name="netid">NetId</string>
|
||||||
<string name="add_default_route">Add Default Route</string>
|
<string name="add_default_route">Add Default Route</string>
|
||||||
<string name="remove_default_route">Remove Default Route</string>
|
<string name="remove_default_route">Remove Default Route</string>
|
||||||
<string name="default_request">Make a http request</string>
|
<string name="default_request">Make a http request</string>
|
||||||
|
|||||||
@@ -524,7 +524,8 @@ public class Connectivity extends Activity {
|
|||||||
|
|
||||||
private void onAddDefaultRoute() {
|
private void onAddDefaultRoute() {
|
||||||
try {
|
try {
|
||||||
mNetd.addRoute("eth0", new RouteInfo(null,
|
int netId = Integer.valueOf(((TextView) findViewById(R.id.netid)).getText().toString());
|
||||||
|
mNetd.addRoute(netId, new RouteInfo(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());
|
||||||
@@ -533,7 +534,8 @@ public class Connectivity extends Activity {
|
|||||||
|
|
||||||
private void onRemoveDefaultRoute() {
|
private void onRemoveDefaultRoute() {
|
||||||
try {
|
try {
|
||||||
mNetd.removeRoute("eth0", new RouteInfo(null,
|
int netId = Integer.valueOf(((TextView) findViewById(R.id.netid)).getText().toString());
|
||||||
|
mNetd.removeRoute(netId, new RouteInfo(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