Surface tethering stats in data usage.

Bug: 5244846
Change-Id: Ib4ac03ab634278714576a66ef8d6fdbc6d15c82a
This commit is contained in:
Jeff Sharkey
2011-09-16 01:52:39 -07:00
parent a9efa2c2ea
commit a83a24f48a
5 changed files with 46 additions and 25 deletions

View File

@@ -393,4 +393,34 @@ public class Utils {
list.setPadding(effectivePaddingSide, 0, effectivePaddingSide, paddingBottom);
}
}
/**
* Return string resource that best describes combination of tethering
* options available on this device.
*/
public static int getTetheringLabel(ConnectivityManager cm) {
String[] usbRegexs = cm.getTetherableUsbRegexs();
String[] wifiRegexs = cm.getTetherableWifiRegexs();
String[] bluetoothRegexs = cm.getTetherableBluetoothRegexs();
boolean usbAvailable = usbRegexs.length != 0;
boolean wifiAvailable = wifiRegexs.length != 0;
boolean bluetoothAvailable = bluetoothRegexs.length != 0;
if (wifiAvailable && usbAvailable && bluetoothAvailable) {
return R.string.tether_settings_title_all;
} else if (wifiAvailable && usbAvailable) {
return R.string.tether_settings_title_all;
} else if (wifiAvailable && bluetoothAvailable) {
return R.string.tether_settings_title_all;
} else if (wifiAvailable) {
return R.string.tether_settings_title_wifi;
} else if (usbAvailable && bluetoothAvailable) {
return R.string.tether_settings_title_usb_bluetooth;
} else if (usbAvailable) {
return R.string.tether_settings_title_usb;
} else {
return R.string.tether_settings_title_bluetooth;
}
}
}