Merge "Fix USB tethering"

This commit is contained in:
Mike Lockwood
2011-07-23 19:36:32 -07:00
committed by Android (Google) Code Review
3 changed files with 22 additions and 0 deletions

View File

@@ -653,6 +653,17 @@ public class ConnectivityManager {
} }
} }
/**
* {@hide}
*/
public int setUsbTethering(boolean enable) {
try {
return mService.setUsbTethering(enable);
} catch (RemoteException e) {
return TETHER_ERROR_SERVICE_UNAVAIL;
}
}
/** {@hide} */ /** {@hide} */
public static final int TETHER_ERROR_NO_ERROR = 0; public static final int TETHER_ERROR_NO_ERROR = 0;
/** {@hide} */ /** {@hide} */

View File

@@ -88,6 +88,8 @@ interface IConnectivityManager
String[] getTetherableBluetoothRegexs(); String[] getTetherableBluetoothRegexs();
int setUsbTethering(boolean enable);
void requestNetworkTransitionWakelock(in String forWhom); void requestNetworkTransitionWakelock(in String forWhom);
void reportInetCondition(int networkType, int percentage); void reportInetCondition(int networkType, int percentage);

View File

@@ -2262,6 +2262,15 @@ public class ConnectivityService extends IConnectivityManager.Stub {
} }
} }
public int setUsbTethering(boolean enable) {
enforceTetherAccessPermission();
if (isTetheringSupported()) {
return mTethering.setUsbTethering(enable);
} else {
return ConnectivityManager.TETHER_ERROR_UNSUPPORTED;
}
}
// TODO - move iface listing, queries, etc to new module // TODO - move iface listing, queries, etc to new module
// javadoc from interface // javadoc from interface
public String[] getTetherableIfaces() { public String[] getTetherableIfaces() {