Update Tether Settings for new UMS behavior.

Framework Tethering now will remove USB interfaces from the available iface list
when UMS is started.  Do note when UMS changes though so we can display the correct
strings.

bug:2469818
Change-Id: I5bf1eaea71994cbf9882e10301e88593533651a2
This commit is contained in:
Robert Greenwalt
2010-03-10 16:57:08 -08:00
parent d2b8efa494
commit a2488762a7

View File

@@ -85,6 +85,7 @@ public class TetherSettings extends PreferenceActivity {
private class TetherChangeReceiver extends BroadcastReceiver {
public void onReceive(Context content, Intent intent) {
if (intent.getAction().equals(ConnectivityManager.ACTION_TETHER_STATE_CHANGED)) {
// TODO - this should understand the interface types
ArrayList<String> available = intent.getStringArrayListExtra(
ConnectivityManager.EXTRA_AVAILABLE_TETHER);
@@ -92,8 +93,11 @@ public class TetherSettings extends PreferenceActivity {
ConnectivityManager.EXTRA_ACTIVE_TETHER);
ArrayList<String> errored = intent.getStringArrayListExtra(
ConnectivityManager.EXTRA_ERRORED_TETHER);
updateState(available.toArray(), active.toArray(), errored.toArray());
} else if (intent.getAction().equals(Intent.ACTION_MEDIA_SHARED) ||
intent.getAction().equals(Intent.ACTION_MEDIA_UNSHARED)) {
updateState();
}
}
}
@@ -185,10 +189,6 @@ public class TetherSettings extends PreferenceActivity {
mUsbTether.setSummary(R.string.usb_tethering_active_subtext);
mUsbTether.setEnabled(true);
mUsbTether.setChecked(true);
} else if (massStorageActive) {
mUsbTether.setSummary(R.string.usb_tethering_storage_active_subtext);
mUsbTether.setEnabled(false);
mUsbTether.setChecked(false);
} else if (usbAvailable) {
if (usbError == ConnectivityManager.TETHER_ERROR_NO_ERROR) {
mUsbTether.setSummary(R.string.usb_tethering_available_subtext);
@@ -201,6 +201,10 @@ public class TetherSettings extends PreferenceActivity {
mUsbTether.setSummary(R.string.usb_tethering_errored_subtext);
mUsbTether.setEnabled(false);
mUsbTether.setChecked(false);
} else if (massStorageActive) {
mUsbTether.setSummary(R.string.usb_tethering_storage_active_subtext);
mUsbTether.setEnabled(false);
mUsbTether.setChecked(false);
} else {
mUsbTether.setSummary(R.string.usb_tethering_unavailable_subtext);
mUsbTether.setEnabled(false);