Add error reporting for Tethering.
Also make the usb interface configuration more robust so retries are possible.
Makes all Tethering errors recoverable - no harm letting them try again anyway. Worst case
is they need to reboot.
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index 67b6200..a1c45dc 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -1457,15 +1457,36 @@
}
// javadoc from interface
- public boolean tether(String iface) {
+ public int tether(String iface) {
enforceTetherChangePermission();
- return isTetheringSupported() && mTethering.tether(iface);
+
+ if (isTetheringSupported()) {
+ return mTethering.tether(iface);
+ } else {
+ return ConnectivityManager.TETHER_ERROR_UNSUPPORTED;
+ }
}
// javadoc from interface
- public boolean untether(String iface) {
+ public int untether(String iface) {
enforceTetherChangePermission();
- return isTetheringSupported() && mTethering.untether(iface);
+
+ if (isTetheringSupported()) {
+ return mTethering.untether(iface);
+ } else {
+ return ConnectivityManager.TETHER_ERROR_UNSUPPORTED;
+ }
+ }
+
+ // javadoc from interface
+ public int getLastTetherError(String iface) {
+ enforceTetherAccessPermission();
+
+ if (isTetheringSupported()) {
+ return mTethering.getLastTetherError(iface);
+ } else {
+ return ConnectivityManager.TETHER_ERROR_UNSUPPORTED;
+ }
}
// TODO - proper iface API for selection by property, inspection, etc
@@ -1499,6 +1520,11 @@
return mTethering.getTetheredIfaces();
}
+ public String[] getTetheringErroredIfaces() {
+ enforceTetherAccessPermission();
+ return mTethering.getErroredIfaces();
+ }
+
// if ro.tether.denied = true we default to no tethering
// gservices could set the secure setting to 1 though to enable it on a build where it
// had previously been turned off.