summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/WirelessSettings.java
diff options
context:
space:
mode:
authorChia-chi Yeh <chiachi@android.com>2010-01-13 06:11:29 +0800
committerChia-chi Yeh <chiachi@android.com>2010-01-15 06:12:29 +0800
commitb90452f3d26201ea6a231f2150204241e66cd3fb (patch)
treefe7cd1cdc92cf211428c979874ea58d70db7324f /src/com/android/settings/WirelessSettings.java
parente751e555f7f8b131aa51e5a31255610e26b8665b (diff)
downloadpackages_apps_Settings-b90452f3d26201ea6a231f2150204241e66cd3fb.zip
packages_apps_Settings-b90452f3d26201ea6a231f2150204241e66cd3fb.tar.gz
packages_apps_Settings-b90452f3d26201ea6a231f2150204241e66cd3fb.tar.bz2
Settings: revise WifiEnabler and BluetoothEnabler.
This mainly changes the way both enablers react to the airplane mode. Now enablers show a toast message instead of disabling the check box directly. This avoids the inconsistent state introduced by WirelessSettings which controls the check box using layout dependency. Related bug: 2053751
Diffstat (limited to 'src/com/android/settings/WirelessSettings.java')
-rw-r--r--src/com/android/settings/WirelessSettings.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/com/android/settings/WirelessSettings.java b/src/com/android/settings/WirelessSettings.java
index 1d0b2d8..bf75e27 100644
--- a/src/com/android/settings/WirelessSettings.java
+++ b/src/com/android/settings/WirelessSettings.java
@@ -17,6 +17,7 @@
package com.android.settings;
import android.bluetooth.BluetoothAdapter;
+import android.content.Context;
import android.content.Intent;
import android.net.wifi.WifiManager;
import android.os.Bundle;
@@ -67,7 +68,17 @@ public class WirelessSettings extends PreferenceActivity {
// Let the intents be launched by the Preference manager
return false;
}
-
+
+ public static boolean isRadioAllowed(Context context, String type) {
+ if (!AirplaneModeEnabler.isAirplaneModeOn(context)) {
+ return true;
+ }
+ // Here we use the same logic in onCreate().
+ String toggleable = Settings.System.getString(context.getContentResolver(),
+ Settings.System.AIRPLANE_MODE_TOGGLEABLE_RADIOS);
+ return toggleable != null && toggleable.contains(type);
+ }
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -86,7 +97,7 @@ public class WirelessSettings extends PreferenceActivity {
String toggleable = Settings.System.getString(getContentResolver(),
Settings.System.AIRPLANE_MODE_TOGGLEABLE_RADIOS);
- // Manually set up dependencies for Wifi when not toggleable.
+ // Manually set dependencies for Wifi when not toggleable.
if (toggleable == null || !toggleable.contains(Settings.System.RADIO_WIFI)) {
wifi.setDependency(KEY_TOGGLE_AIRPLANE);
findPreference(KEY_WIFI_SETTINGS).setDependency(KEY_TOGGLE_AIRPLANE);
@@ -99,7 +110,7 @@ public class WirelessSettings extends PreferenceActivity {
findPreference(KEY_BT_SETTINGS).setDependency(KEY_TOGGLE_AIRPLANE);
}
- // Disable BT Settings if BT service is not available.
+ // Disable Bluetooth Settings if Bluetooth service is not available.
if (ServiceManager.getService(BluetoothAdapter.BLUETOOTH_SERVICE) == null) {
findPreference(KEY_BT_SETTINGS).setEnabled(false);
}