ImageVerifierCode 换一换
格式:DOCX , 页数:47 ,大小:191.19KB ,
资源ID:16825101      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/16825101.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(AndroidWIFIPower managmentWord格式.docx)为本站会员(b****6)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

AndroidWIFIPower managmentWord格式.docx

1、mNotificationTask- mContext.sendOrderedBroadcast(mScreenOnIntent, null, mScreenOnBroadcastDone, mHandler, 0, null, null);4. Wifi Service will receive the SCREEN_ON intent, will enable Rssi polling, then call updateWifiState. if (action.equals(Intent.ACTION_SCREEN_ON) Log.d(TAG, ACTION_SCREEN_ON); mA

2、larmManager.cancel(mIdleIntent); mDeviceIdle = false; mScreenOff = false; mWifiStateTracker.enableRssiPolling(true);5. updateWifiState will send start driver message: MESSAGE_START_WIFI to Wifi Service itself.if (wifiShouldBeEnabled) if (wifiShouldBeStarted) sWakeLock.acquire(); sendEnableMessage(tr

3、ue, false, mLastEnableUid); sendStartMessage(strongestLockMode = WifiManager.WIFI_MODE_SCAN_ONLY); 6. HandleMessage will call restart of WifiStateTracker public void handleMessage(Message msg) switch (msg.what) case MESSAGE_START_WIFI: mWifiStateTracker.setScanOnlyMode(msg.arg1 != 0); mWifiStateTrac

4、ker.restart(); sWakeLock.release(); break;7. restart of WifiStateTracker will reset interface, call WifiNative.startDriverCommand public synchronized boolean restart() if (mRunState = RUN_STATE_STOPPED) mRunState = RUN_STATE_STARTING; resetInterface(true); return WifiNative.startDriverCommand(); els

5、e if (mRunState = RUN_STATE_STOPPING) return true;8. resetInterface will clear wifi ip address, reset Connections and stop DHCP. /* * Resets the Wi-Fi interface by clearing any state, resetting any sockets * using the interface, stopping DHCP, and disabling the interface. */ public void resetInterfa

6、ce(boolean reenable) mHaveIpAddress = false; mObtainingIpAddress = false; mWifiInfo.setIpAddress(0); /* * Reset connection depends on both the interface and the IP assigned, * so it should be done before any chance of the IP being lost. NetworkUtils.resetConnections(mInterfaceName); / Stop DHCP if (

7、mDhcpTarget != null) mDhcpTarget.setCancelCallback(true); mDhcpTarget.removeMessages(EVENT_DHCP_START); if (!NetworkUtils.stopDhcp(mInterfaceName) Log.e(TAG, Could not stop DHCP/Marvell:cant disableInterface here as the driver wont turn it on automatically/ NetworkUtils.disableInterface(mInterfaceNa

8、me); / we no longer net to start the interface (driver does this for us) / and it led to problems - removed. * The supplicant is reporting that we are disconnected from the current * access point. Often, however, a disconnect will be followed very shortly * by a reconnect to the same access point. T

9、herefore, we delay resetting * the connections IP state for a bit.8. WifiNative.startDriverCommand send start driver event to wpa_suppliant9. Wpa_supplicant call wext to handle start driver event, wpa_supplicant_run eloop_run(void) tmp-handler(tmp-eloop_data, tmp-user_data); -wpa_supplicant_ctrl_ifa

10、ce_receive wpa_supplicant_ctrl_iface_process-wpa_supplicant_driver_cmd wpa_drv_driver_cmd-wpa_s-driver-driver_cmd(wpa_s-drv_priv, cmd, buf, buf_len);10. Wext will call ioctl to send command to Wlan kernel driver11. Wlan kernel driver will handle start driver command (now not support yet)1.3 Screen o

11、ff1. When Android is in running mode , if the power key is pressed, Thread InputDeviceReader will be created and process the key event. Send a message to Windows manager.3. Power manager Service will call setPowerState to set power state, call sendNotificationLocked to notify power on event. will ca

12、ll screenTurnedOff of KeyguardViewMediator to turn off screen, call goingToSleep() of ActivityManagerService to pause activity, broadcast intent, Intent(Intent.ACTION_SCREEN_OFF), send broadcast message:4. Wifi Service will receive the SCREEN_OFF intent, will disable Rssi polling, Set an alarm timer

13、 to send ACTION_DEVICE_IDLE else if (action.equals(Intent.ACTION_SCREEN_OFF) ACTION_SCREEN_OFF mScreenOff = true; mWifiStateTracker.enableRssiPolling(false); * Set a timer to put Wi-Fi to sleep, but only if the screen is off * AND the stay on while plugged in setting doesnt match the * current power

14、 conditions (i.e, not plugged in, plugged in to USB, * or plugged in to AC).shouldWifiStayAwake(stayAwakeConditions, mPluggedType) WifiInfo info = mWifiStateTracker.requestConnectionInfo(); if (info.getSupplicantState() != SupplicantState.COMPLETED) / we used to go to sleep immediately, but this cau

15、sed some race conditions / we dont have time to track down for this release. Delay instead, but not / as long as we would if connected (below) / TODO - fix the race conditions and switch back to the immediate turn-off long triggerTime = System.currentTimeMillis() + (2*60*1000); / 2 minsetting ACTION

16、_DEVICE_IDLE timer for 120,000 ms mAlarmManager.set(AlarmManager.RTC_WAKEUP, triggerTime, mIdleIntent); / / do not keep Wifi awake when screen is off if Wifi is not associated / mDeviceIdle = true; / updateWifiState(); else long triggerTime = System.currentTimeMillis() + idleMillis;setting ACTION_DE

17、VICE_IDLE timer for + idleMillis + ms MESSAGE_STOP_WIFI to Wifi Service itself.sDriverStopWakeLock.acquire();mWifiHandler.sendEmptyMessage(MESSAGE_STOP_WIFI); mWifiHandler.sendEmptyMessageDelayed(MESSAGE_RELEASE_WAKELOCK, wakeLockTimeout); 6. HandleMessage will call disconnectAndStop of WifiStateTra

18、cker case MESSAGE_STOP_WIFI: mWifiStateTracker.disconnectAndStop(); / dont release wakelock7. disconnectAndStop of WifiStateTracker call WifiNative.disconnectCommand first to disconnect the wifi network. /* * We want to stop the driver, but if were connected to a network, * we first want to disconne

19、ct, so that the supplicant is always in * a known state (DISCONNECTED) when the driver is stopped. * return code true if the operation succeeds, which means that the * disconnect or stop command was initiated. public synchronized boolean disconnectAndStop() if (mRunState != RUN_STATE_STOPPING & mRun

20、State != RUN_STATE_STOPPED) / Take down any open network notifications setNotificationVisible(false, 0, false, 0); mRunState = RUN_STATE_STOPPING; if (mWifiInfo.getSupplicantState() = SupplicantState.DORMANT) return WifiNative.stopDriverCommand(); return WifiNative.disconnectCommand(); * The driver-

21、stop wake lock normally is released from the * connectivity manager after the mobile data connection has * been established, or after a timeout period, if that never * happens. Because WifiService.updateWifiState() can get called * multiple times, we can end up acquiring the wake lock and calling *

22、disconnectAndStop() even when a disconnect or stop operation * is already in progress. In that case, we want to ignore the * disconnectAndStop request and release the (ref-counted) wake * lock, so that eventually, when the mobile data connection is * established, the ref count will drop to zero. rel

23、easeWakeLock();8. wpa_supplicant_ctrl_iface_process of handles “DISCONNECT” command, will call wpa_supplicant_disassociate, then call wpa_drv_disassociatevoid wpa_supplicant_disassociate(struct wpa_supplicant *wpa_s, int reason_code) u8 *addr = NULL; if (os_memcmp(wpa_s-bssid, x00x00x00x00x00x00, ET

24、H_ALEN) != 0) if (wpa_s-use_client_mlme) ieee80211_sta_disassociate(wpa_s, reason_code); else wpa_drv_disassociate(wpa_s, wpa_s-bssid, reason_code); addr = wpa_s-bssid; wpa_clear_keys(wpa_s, addr); wpa_supplicant_mark_disassoc(wpa_s); wpa_s-current_ssid = NULL; wpa_sm_set_config(wpa_s-wpa, NULL);9.

25、wpa_drv_disassociate will call wpa_driver_wext_disassociatestatic int wpa_driver_wext_disassociate(void *priv, const u8 *addr, int reason_code) struct wpa_driver_wext_data *drv = priv; wpa_printf(MSG_DEBUG, %s, _FUNCTION_); return wpa_driver_wext_mlme(drv, addr, IW_MLME_DISASSOC, reason_code);10. wpa_driver_wext_disassociate call wpa_driver_wext

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1