本文转自http://blog..net/wwwwap2008/article/details/51783138
最近在项目里发现一段logcat:
W/Settings: Setting wifi_sleep_policy has moved from android.provider.Settings.System to android.provider.Settings.Global, value is unchanged.
后来检查定位到如下代码:
/**
* @brief 临时保存系统休眠时的wifi连接策略
* @param context 上下文
*/
public static void setWifiDormancy()
{
Context context = MyApplication.getInstance();
try {
int value = Settings.System.getInt(context.getContentResolver(), Settings.System.WIFI_SLEEP_POLICY, Settings.System.WIFI_SLEEP_POLICY_DEFAULT);
PreferenceMgr.getInstance().setIntConfigValue(Constants.CONFIG_WIFI_SLEEP_POLICY_DEFAULT, value);
if(Settings.System.WIFI_SLEEP_POLICY_NEVER != value)
{
Settings.System.putInt(context.getContentResolver(), Settings.System.WIFI_SLEEP_POLICY,