summaryrefslogtreecommitdiffstats
path: root/wifi
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2012-09-26 15:54:06 -0700
committerJeff Sharkey <jsharkey@android.com>2012-09-26 17:18:49 -0700
commitbdfce2ec05a3e9ca6acd6711de6133e06f2446e6 (patch)
tree50fd53ef94070944416713eacceaa4cb4bff15c5 /wifi
parent51ce1607b392bf463e4175596d0b91dc337f4c14 (diff)
downloadframeworks_base-bdfce2ec05a3e9ca6acd6711de6133e06f2446e6.zip
frameworks_base-bdfce2ec05a3e9ca6acd6711de6133e06f2446e6.tar.gz
frameworks_base-bdfce2ec05a3e9ca6acd6711de6133e06f2446e6.tar.bz2
First step towards cleaning up Global settings.
Remove all @Deprecated @hide settings, and clean up any stragglers. Bug: 7232125 Change-Id: Ibf67093c728d4a28565129b923edb1701d3b2789
Diffstat (limited to 'wifi')
-rw-r--r--wifi/java/android/net/wifi/WifiStateMachine.java20
-rw-r--r--wifi/java/android/net/wifi/WifiWatchdogStateMachine.java40
-rw-r--r--wifi/java/android/net/wifi/p2p/WifiP2pService.java8
3 files changed, 27 insertions, 41 deletions
diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java
index e7927ae..ab9db88 100644
--- a/wifi/java/android/net/wifi/WifiStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiStateMachine.java
@@ -608,8 +608,8 @@ public class WifiStateMachine extends StateMachine {
mPrimaryDeviceType = mContext.getResources().getString(
R.string.config_wifi_p2p_device_type);
- mUserWantsSuspendOpt.set(Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED, 1) == 1);
+ mUserWantsSuspendOpt.set(Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED, 1) == 1);
mContext.registerReceiver(
new BroadcastReceiver() {
@@ -659,13 +659,13 @@ public class WifiStateMachine extends StateMachine {
},
new IntentFilter(ACTION_DELAYED_DRIVER_STOP));
- mContext.getContentResolver().registerContentObserver(Settings.Secure.getUriFor(
- Settings.Secure.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED), false,
+ mContext.getContentResolver().registerContentObserver(Settings.Global.getUriFor(
+ Settings.Global.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED), false,
new ContentObserver(getHandler()) {
@Override
public void onChange(boolean selfChange) {
- mUserWantsSuspendOpt.set(Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED, 1) == 1);
+ mUserWantsSuspendOpt.set(Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED, 1) == 1);
}
});
@@ -1074,8 +1074,8 @@ public class WifiStateMachine extends StateMachine {
*/
public void setFrequencyBand(int band, boolean persist) {
if (persist) {
- Settings.Secure.putInt(mContext.getContentResolver(),
- Settings.Secure.WIFI_FREQUENCY_BAND,
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.WIFI_FREQUENCY_BAND,
band);
}
sendMessage(obtainMessage(CMD_SET_FREQUENCY_BAND, band, 0));
@@ -1331,8 +1331,8 @@ public class WifiStateMachine extends StateMachine {
* Set the frequency band from the system setting value, if any.
*/
private void setFrequencyBand() {
- int band = Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.WIFI_FREQUENCY_BAND, WifiManager.WIFI_FREQUENCY_BAND_AUTO);
+ int band = Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.WIFI_FREQUENCY_BAND, WifiManager.WIFI_FREQUENCY_BAND_AUTO);
setFrequencyBand(band, false);
}
diff --git a/wifi/java/android/net/wifi/WifiWatchdogStateMachine.java b/wifi/java/android/net/wifi/WifiWatchdogStateMachine.java
index 7fa6aac..4440145 100644
--- a/wifi/java/android/net/wifi/WifiWatchdogStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiWatchdogStateMachine.java
@@ -343,13 +343,13 @@ public class WifiWatchdogStateMachine extends StateMachine {
// Watchdog is always enabled. Poor network detection can be seperately turned on/off
// TODO: Remove this setting & clean up state machine since we always have
// watchdog in an enabled state
- putSettingsBoolean(contentResolver, Settings.Secure.WIFI_WATCHDOG_ON, true);
+ putSettingsGlobalBoolean(contentResolver, Settings.Global.WIFI_WATCHDOG_ON, true);
// disable poor network avoidance
if (sWifiOnly) {
logd("Disabling poor network avoidance for wi-fi only device");
- putSettingsBoolean(contentResolver,
- Settings.Secure.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED, false);
+ putSettingsGlobalBoolean(contentResolver,
+ Settings.Global.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED, false);
}
WifiWatchdogStateMachine wwsm = new WifiWatchdogStateMachine(context);
@@ -402,7 +402,7 @@ public class WifiWatchdogStateMachine extends StateMachine {
};
mContext.getContentResolver().registerContentObserver(
- Settings.Secure.getUriFor(Settings.Secure.WIFI_WATCHDOG_ON),
+ Settings.Global.getUriFor(Settings.Global.WIFI_WATCHDOG_ON),
false, contentObserver);
}
@@ -418,7 +418,7 @@ public class WifiWatchdogStateMachine extends StateMachine {
};
mContext.getContentResolver().registerContentObserver(
- Settings.Secure.getUriFor(Settings.Secure.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED),
+ Settings.Global.getUriFor(Settings.Global.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED),
false, contentObserver);
}
@@ -432,7 +432,8 @@ public class WifiWatchdogStateMachine extends StateMachine {
}
private boolean isWatchdogEnabled() {
- boolean ret = getSettingsBoolean(mContentResolver, Settings.Secure.WIFI_WATCHDOG_ON, true);
+ boolean ret = getSettingsGlobalBoolean(
+ mContentResolver, Settings.Global.WIFI_WATCHDOG_ON, true);
if (DBG) logd("Watchdog enabled " + ret);
return ret;
}
@@ -440,8 +441,8 @@ public class WifiWatchdogStateMachine extends StateMachine {
private void updateSettings() {
if (DBG) logd("Updating secure settings");
- mPoorNetworkDetectionEnabled = getSettingsBoolean(mContentResolver,
- Settings.Secure.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED, true);
+ mPoorNetworkDetectionEnabled = getSettingsGlobalBoolean(mContentResolver,
+ Settings.Global.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED, true);
}
/**
@@ -927,21 +928,6 @@ public class WifiWatchdogStateMachine extends StateMachine {
}
/**
- * Convenience function for retrieving a single secure settings value
- * as a string with a default value.
- *
- * @param cr The ContentResolver to access.
- * @param name The name of the setting to retrieve.
- * @param def Value to return if the setting is not defined.
- *
- * @return The setting's current value, or 'def' if it is not defined
- */
- private static String getSettingsStr(ContentResolver cr, String name, String def) {
- String v = Settings.Secure.getString(cr, name);
- return v != null ? v : def;
- }
-
- /**
* Convenience function for retrieving a single secure settings value as a
* boolean. Note that internally setting values are always stored as
* strings; this function converts the string to a boolean for you. The
@@ -954,8 +940,8 @@ public class WifiWatchdogStateMachine extends StateMachine {
* @return The setting's current value, or 'def' if it is not defined or not
* a valid boolean.
*/
- private static boolean getSettingsBoolean(ContentResolver cr, String name, boolean def) {
- return Settings.Secure.getInt(cr, name, def ? 1 : 0) == 1;
+ private static boolean getSettingsGlobalBoolean(ContentResolver cr, String name, boolean def) {
+ return Settings.Global.getInt(cr, name, def ? 1 : 0) == 1;
}
/**
@@ -970,8 +956,8 @@ public class WifiWatchdogStateMachine extends StateMachine {
* @param value The new value for the setting.
* @return true if the value was set, false on database errors
*/
- private static boolean putSettingsBoolean(ContentResolver cr, String name, boolean value) {
- return Settings.Secure.putInt(cr, name, value ? 1 : 0);
+ private static boolean putSettingsGlobalBoolean(ContentResolver cr, String name, boolean value) {
+ return Settings.Global.putInt(cr, name, value ? 1 : 0);
}
private static void logd(String s) {
diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pService.java b/wifi/java/android/net/wifi/p2p/WifiP2pService.java
index 8f0d8f0..8670650 100644
--- a/wifi/java/android/net/wifi/p2p/WifiP2pService.java
+++ b/wifi/java/android/net/wifi/p2p/WifiP2pService.java
@@ -2039,8 +2039,8 @@ public class WifiP2pService extends IWifiP2pManager.Stub {
}
private String getPersistedDeviceName() {
- String deviceName = Settings.Secure.getString(mContext.getContentResolver(),
- Settings.Secure.WIFI_P2P_DEVICE_NAME);
+ String deviceName = Settings.Global.getString(mContext.getContentResolver(),
+ Settings.Global.WIFI_P2P_DEVICE_NAME);
if (deviceName == null) {
/* We use the 4 digits of the ANDROID_ID to have a friendly
* default that has low likelihood of collision with a peer */
@@ -2062,8 +2062,8 @@ public class WifiP2pService extends IWifiP2pManager.Stub {
mThisDevice.deviceName = devName;
mWifiNative.setP2pSsidPostfix("-" + mThisDevice.deviceName);
- Settings.Secure.putString(mContext.getContentResolver(),
- Settings.Secure.WIFI_P2P_DEVICE_NAME, devName);
+ Settings.Global.putString(mContext.getContentResolver(),
+ Settings.Global.WIFI_P2P_DEVICE_NAME, devName);
sendThisDeviceChangedBroadcast();
return true;
}