From a2488762a7c80eb4a22a4dd018c916784526bba4 Mon Sep 17 00:00:00 2001 From: Robert Greenwalt Date: Wed, 10 Mar 2010 16:57:08 -0800 Subject: 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 --- src/com/android/settings/TetherSettings.java | 30 ++++++++++++++++------------ 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'src/com/android/settings') diff --git a/src/com/android/settings/TetherSettings.java b/src/com/android/settings/TetherSettings.java index 9b8337914..9d952ec01 100644 --- a/src/com/android/settings/TetherSettings.java +++ b/src/com/android/settings/TetherSettings.java @@ -85,15 +85,19 @@ public class TetherSettings extends PreferenceActivity { private class TetherChangeReceiver extends BroadcastReceiver { public void onReceive(Context content, Intent intent) { - // TODO - this should understand the interface types - ArrayList available = intent.getStringArrayListExtra( - ConnectivityManager.EXTRA_AVAILABLE_TETHER); - ArrayList active = intent.getStringArrayListExtra( - ConnectivityManager.EXTRA_ACTIVE_TETHER); - ArrayList errored = intent.getStringArrayListExtra( - ConnectivityManager.EXTRA_ERRORED_TETHER); - - updateState(available.toArray(), active.toArray(), errored.toArray()); + if (intent.getAction().equals(ConnectivityManager.ACTION_TETHER_STATE_CHANGED)) { + // TODO - this should understand the interface types + ArrayList available = intent.getStringArrayListExtra( + ConnectivityManager.EXTRA_AVAILABLE_TETHER); + ArrayList active = intent.getStringArrayListExtra( + ConnectivityManager.EXTRA_ACTIVE_TETHER); + ArrayList 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); -- cgit v1.2.3