summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSreeram Ramachandran <sreeram@google.com>2014-04-15 19:04:19 -0700
committerLorenzo Colitti <lorenzo@google.com>2014-05-14 12:26:23 +0000
commitb24ff8773d43aaaadaa7a2662c04563bb5e96a1d (patch)
treed92a420221678e064835f910da6383ff7889b351
parentf98bce8f5870e94d9be50c2569deecddec174559 (diff)
downloadandroid_development-b24ff8773d43aaaadaa7a2662c04563bb5e96a1d.tar.gz
android_development-b24ff8773d43aaaadaa7a2662c04563bb5e96a1d.tar.bz2
android_development-b24ff8773d43aaaadaa7a2662c04563bb5e96a1d.zip
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
-rw-r--r--apps/Development/res/layout/connectivity.xml8
-rw-r--r--apps/Development/res/values/strings.xml1
-rw-r--r--apps/Development/src/com/android/development/Connectivity.java6
3 files changed, 13 insertions, 2 deletions
diff --git a/apps/Development/res/layout/connectivity.xml b/apps/Development/res/layout/connectivity.xml
index a3a3dcf41..2aaf6c61f 100644
--- a/apps/Development/res/layout/connectivity.xml
+++ b/apps/Development/res/layout/connectivity.xml
@@ -284,6 +284,14 @@
android:orientation="horizontal"
android:layout_width="match_parent"
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"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
diff --git a/apps/Development/res/values/strings.xml b/apps/Development/res/values/strings.xml
index ced7b727d..0c13987c4 100644
--- a/apps/Development/res/values/strings.xml
+++ b/apps/Development/res/values/strings.xml
@@ -43,6 +43,7 @@
<string name="start_hipri">Start HiPri</string>
<string name="stop_hipri">Stop HiPri</string>
<string name="crash">CRASH</string>
+ <string name="netid">NetId</string>
<string name="add_default_route">Add Default Route</string>
<string name="remove_default_route">Remove Default Route</string>
<string name="default_request">Make a http request</string>
diff --git a/apps/Development/src/com/android/development/Connectivity.java b/apps/Development/src/com/android/development/Connectivity.java
index 7d4491b4f..55e53500c 100644
--- a/apps/Development/src/com/android/development/Connectivity.java
+++ b/apps/Development/src/com/android/development/Connectivity.java
@@ -524,7 +524,8 @@ public class Connectivity extends Activity {
private void onAddDefaultRoute() {
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")));
} catch (Exception e) {
Log.e(TAG, "onAddDefaultRoute got exception: " + e.toString());
@@ -533,7 +534,8 @@ public class Connectivity extends Activity {
private void onRemoveDefaultRoute() {
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")));
} catch (Exception e) {
Log.e(TAG, "onRemoveDefaultRoute got exception: " + e.toString());