summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/values/strings.xml2
-rw-r--r--res/xml/wireless_settings.xml1
-rw-r--r--src/com/android/settings/SecuritySettings.java5
-rw-r--r--src/com/android/settings/Utils.java4
-rw-r--r--src/com/android/settings/WirelessSettings.java10
-rw-r--r--src/com/android/settings/wifi/WifiSettings.java15
6 files changed, 30 insertions, 7 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 131fe6b..966dcde 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1852,6 +1852,8 @@
<string name="location_networks_disabled">See location in applications (such as Maps) using wireless networks</string>
<!-- Security & location settings screen, setting summary when Use wireless networks check box is selected -->
<string name="location_neighborhood_level">Location determined by Wi-Fi and/or mobile networks</string>
+ <!-- Security & location settings screen, setting summary when Use wireless networks check box is selected, for wifi-only devices [CHAR LIMIT=100] -->
+ <string name="location_neighborhood_level_wifi">Location determined by Wi-Fi</string>
<!-- Security & location settings screen, setting check box label if the GPS receiver should be enabled -->
<string name="location_gps">Use GPS satellites</string>
<!-- [CHAR LIMIT=100] Security & location settings screen, setting summary when Use GPS satellites check box is selected -->
diff --git a/res/xml/wireless_settings.xml b/res/xml/wireless_settings.xml
index ffbaef2..466df7b 100644
--- a/res/xml/wireless_settings.xml
+++ b/res/xml/wireless_settings.xml
@@ -72,6 +72,7 @@
android:persistent="false" />
<PreferenceScreen
+ android:key="mobile_network_settings"
android:title="@string/network_settings_title"
android:summary="@string/network_settings_summary"
android:dependency="toggle_airplane">
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index 5d031ef..dc4c42b 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -160,6 +160,11 @@ public class SecuritySettings extends SettingsPreferenceFragment
mUseLocation = useLocation;
}
+ // Change the summary for wifi-only devices
+ if (Utils.isWifiOnly()) {
+ mNetwork.setSummaryOn(R.string.location_neighborhood_level_wifi);
+ }
+
// Add options for lock/unlock screen
int resid = 0;
if (!mLockPatternUtils.isSecure()) {
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index d635403..dd80222 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -278,4 +278,8 @@ public class Utils {
(TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
return telephony != null && telephony.isVoiceCapable();
}
+
+ public static boolean isWifiOnly() {
+ return "wifi-only".equals(SystemProperties.get("ro.carrier"));
+ }
}
diff --git a/src/com/android/settings/WirelessSettings.java b/src/com/android/settings/WirelessSettings.java
index bdf8ce8..9567c01 100644
--- a/src/com/android/settings/WirelessSettings.java
+++ b/src/com/android/settings/WirelessSettings.java
@@ -48,6 +48,7 @@ public class WirelessSettings extends SettingsPreferenceFragment {
private static final String KEY_VPN_SETTINGS = "vpn_settings";
private static final String KEY_TETHER_SETTINGS = "tether_settings";
private static final String KEY_PROXY_SETTINGS = "proxy_settings";
+ private static final String KEY_MOBILE_NETWORK_SETTINGS = "mobile_network_settings";
public static final String EXIT_ECM_RESULT = "exit_ecm_result";
public static final int REQUEST_CODE_EXIT_ECM = 1;
@@ -131,6 +132,11 @@ public class WirelessSettings extends SettingsPreferenceFragment {
getPreferenceScreen().removePreference(nfc);
}
+ // Remove Mobile Network Settings if it's a wifi-only device.
+ if (Utils.isWifiOnly()) {
+ getPreferenceScreen().removePreference(findPreference(KEY_MOBILE_NETWORK_SETTINGS));
+ }
+
// Enable Proxy selector settings if allowed.
Preference mGlobalProxy = findPreference(KEY_PROXY_SETTINGS);
DevicePolicyManager mDPM = (DevicePolicyManager)
@@ -139,10 +145,10 @@ public class WirelessSettings extends SettingsPreferenceFragment {
getPreferenceScreen().removePreference(mGlobalProxy);
mGlobalProxy.setEnabled(mDPM.getGlobalProxyAdmin() == null);
- // Disable Tethering if it's not allowed
+ // Disable Tethering if it's not allowed or if it's a wifi-only device
ConnectivityManager cm =
(ConnectivityManager) activity.getSystemService(Context.CONNECTIVITY_SERVICE);
- if (!cm.isTetheringSupported()) {
+ if (!cm.isTetheringSupported() || Utils.isWifiOnly()) {
getPreferenceScreen().removePreference(findPreference(KEY_TETHER_SETTINGS));
} else {
String[] usbRegexs = cm.getTetherableUsbRegexs();
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index 1222e77..5a2bf45 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -21,6 +21,7 @@ import static android.net.wifi.WifiConfiguration.INVALID_NETWORK_ID;
import com.android.settings.ProgressCategoryBase;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
+import com.android.settings.Utils;
import android.app.Activity;
import android.app.AlertDialog;
@@ -211,11 +212,15 @@ public class WifiSettings extends SettingsPreferenceFragment
ListPreference pref = (ListPreference) findPreference(KEY_SLEEP_POLICY);
if (pref != null) {
- pref.setOnPreferenceChangeListener(this);
- int value = Settings.System.getInt(getContentResolver(),
- Settings.System.WIFI_SLEEP_POLICY,
- Settings.System.WIFI_SLEEP_POLICY_NEVER);
- pref.setValue(String.valueOf(value));
+ if (Utils.isWifiOnly()) {
+ getPreferenceScreen().removePreference(pref);
+ } else {
+ pref.setOnPreferenceChangeListener(this);
+ int value = Settings.System.getInt(getContentResolver(),
+ Settings.System.WIFI_SLEEP_POLICY,
+ Settings.System.WIFI_SLEEP_POLICY_NEVER);
+ pref.setValue(String.valueOf(value));
+ }
}
registerForContextMenu(getListView());