First pass at USB Tethering.

bug:2281900
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index aa4956f..4259016 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -43,6 +43,8 @@
 
 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 @@
     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 @@
                 continue;
             }
         }
+
+        mTethering = new Tethering(mContext);
     }
 
 
@@ -784,6 +791,13 @@
                 "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 @@
             }
         }
     }
+
+    // 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();
+    }
 }