Remove / re-word some settings for WiFi-only devices.
Bug: 3468248 1. Remove Wireless->Mobile networks 2. Remove Wireless->Tethering and WiFi hotspot 3. Remove Wireless->Wi-Fi Settings->Wi-Fi disconnect policy 4. Re-word Network location summary text to not include "mobile network" Change-Id: I84a551a1b63591974731029b0d4b90a85e43a716
This commit is contained in:
@@ -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 -->
|
||||
|
@@ -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">
|
||||
|
@@ -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()) {
|
||||
|
@@ -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"));
|
||||
}
|
||||
}
|
||||
|
@@ -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();
|
||||
|
@@ -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());
|
||||
|
Reference in New Issue
Block a user