summaryrefslogtreecommitdiff
path: root/services/java/com/android/server/ConnectivityService.java
diff options
context:
space:
mode:
authorRobert Greenwalt <robdroid@android.com>2010-01-26 11:40:34 -0800
committerRobert Greenwalt <robdroid@android.com>2010-02-04 09:15:06 -0800
commitd0e18ffb82b59d38aeaf0e552f48e734202719ab (patch)
tree5ad66758cf2629e3590201b37252be56518f2bc6 /services/java/com/android/server/ConnectivityService.java
parent3141e0a62abe57e93e5d716895a2a57cc052bb50 (diff)
First pass at USB Tethering.
bug:2281900
Diffstat (limited to 'services/java/com/android/server/ConnectivityService.java')
-rw-r--r--services/java/com/android/server/ConnectivityService.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index aa4956f1573e..42590160d99a 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -43,6 +43,8 @@ import android.util.Log;
import com.android.internal.telephony.Phone;
+import com.android.server.connectivity.Tethering;
+
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
@@ -62,6 +64,9 @@ public class ConnectivityService extends IConnectivityManager.Stub {
private static final String NETWORK_RESTORE_DELAY_PROP_NAME =
"android.telephony.apn-restore";
+
+ private Tethering mTethering;
+
/**
* Sometimes we want to refer to the individual network state
* trackers separately, and sometimes we just want to treat them
@@ -308,6 +313,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
continue;
}
}
+
+ mTethering = new Tethering(mContext);
}
@@ -784,6 +791,13 @@ public class ConnectivityService extends IConnectivityManager.Stub {
"ConnectivityService");
}
+ // TODO Make this a special check when it goes public
+ private void enforceTetherChangePermission() {
+ mContext.enforceCallingOrSelfPermission(
+ android.Manifest.permission.CHANGE_NETWORK_STATE,
+ "ConnectivityService");
+ }
+
/**
* Handle a {@code DISCONNECTED} event. If this pertains to the non-active
* network, we ignore it. If it is for the active network, we send out a
@@ -1368,4 +1382,28 @@ public class ConnectivityService extends IConnectivityManager.Stub {
}
}
}
+
+ // javadoc from interface
+ public boolean tether(String iface) {
+ enforceTetherChangePermission();
+ return mTethering.tether(iface);
+ }
+
+ // javadoc from interface
+ public boolean untether(String iface) {
+ enforceTetherChangePermission();
+ return mTethering.untether(iface);
+ }
+
+ // TODO - move iface listing, queries, etc to new module
+ // javadoc from interface
+ public String[] getTetherableIfaces() {
+ enforceAccessPermission();
+ return mTethering.getTetherableIfaces();
+ }
+
+ public String[] getTetheredIfaces() {
+ enforceAccessPermission();
+ return mTethering.getTetheredIfaces();
+ }
}