android 6.0 wifi管理,rk3288 android6.0 wifi子系统 - wifi设置为默认打开

/**

* Check if Wi-Fi needs to be enabled and start

* if needed

*

* This function is used only at boot time*/

public voidcheckAndStartWifi() {/*Check if wi-fi needs to be enabled*/boolean wifiEnabled=mSettingsStore.isWifiToggleEnabled();

Slog.i(TAG,"WifiService starting up with Wi-Fi" +(wifiEnabled? "enabled" : "disabled"));

registerForScanModeChange();

mContext.registerReceiver(newBroadcastReceiver() {

@Overridepublic voidonReceive(Context context, Intent intent) {if(mSettingsStore.handleAirplaneModeToggled()) {

mWifiController.sendMessage(CMD_AIRPLANE_TOGGLED);

}if(mSettingsStore.isAirplaneModeOn()) {

Log.d(TAG,"resetting country code because Airplane mode is ON");

mWifiStateMachine.resetCountryCode();

}

}

},newIntentFilter(Intent.ACTION_AIRPLANE_MODE_CHANGED));

mContext.registerReceiver(newBroadcastReceiver() {

@Overridepublic voidonReceive(Context context, Intent intent) {

String state=intent.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE);if(state.equals(IccCardConstants.INTENT_VALUE_ICC_ABSENT)) {

Log.d(TAG,"resetting country code because SIM is removed");

mWifiStateMachine.resetCountryCode();

}

}

},newIntentFilter(TelephonyIntents.ACTION_SIM_STATE_CHANGED));//Adding optimizations of only receiving broadcasts when wifi is enabled//can result in race conditions when apps toggle wifi in the background//without active user involvement. Always receive broadcasts.

registerForBroadcasts();

registerForPackageOrUserRemoval();

mInIdleMode=mPowerManager.isDeviceIdleMode();

mWifiController.start();//If we are already disabled (could be due to airplane mode), avoid changing persist//state here

if(wifiEnabled) setWifiEnabled(wifiEnabled);

mWifiWatchdogStateMachine=WifiWatchdogStateMachine.

makeWifiWatchdogStateMachine(mContext, mWifiStateMachine.getMessenger());

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值