收藏 分享(赏)

android 无线启动过程分析.doc

上传人:gnk289057 文档编号:12237130 上传时间:2021-12-04 格式:DOC 页数:11 大小:48KB
下载 相关 举报
android 无线启动过程分析.doc_第1页
第1页 / 共11页
android 无线启动过程分析.doc_第2页
第2页 / 共11页
android 无线启动过程分析.doc_第3页
第3页 / 共11页
android 无线启动过程分析.doc_第4页
第4页 / 共11页
android 无线启动过程分析.doc_第5页
第5页 / 共11页
点击查看更多>>
资源描述

1、android 无线启动过程分析寮鏈鸿繃绋嬩腑鏃犵嚎妯潡鐨勫垵濮嬪寲杩囩锛?rild 璋冪敤鍙傝冨疄鐜? Reference-ril.c (hardwarerilreference-ril) 涓 殑鍑芥暟锛?const RIL_RadioFunctions *RIL_Init(const struct RIL_Env *env, int argc, char *argv)ret = pthread_create(static void *mainLoop(void *param)ret = at_open(fd, onUnsolicited);RIL_requestTimedCallback(

2、initializeCallback, NULL, 鍦?initializeCallback 鍑芥暟涓 鐚 繘琛屼簡鍒濆 鍖栥?static void initializeCallback(void *param)ATResponse *p_response = NULL;int err;setRadioState (RADIO_STATE_OFF);at_handshake();/* note: we dont check errors here. Everything important willbe handled in onATTimeout and onATReaderClosed

3、*/* atchannel is tolerant of echo but it must */* have verbose result codes */at_send_command(“ATE0Q0V1“, NULL);/* No auto-answer */at_send_command(“ATS0=0“, NULL);/* Extended errors */at_send_command(“AT+CMEE=1“, NULL);/* Network registration events */err = at_send_command(“AT+CREG=2“, /* some hand

4、sets - in tethered mode - dont support CREG=2 */if (err success = 0) at_send_command(“AT+CREG=1“, NULL);at_response_free(p_response);/* GPRS registration events */at_send_command(“AT+CGREG=1“, NULL);/* Call Waiting notifications */at_send_command(“AT+CCWA=1“, NULL);/* Alternating voice/data off */at

5、_send_command(“AT+CMOD=0“, NULL);/* Not muted */at_send_command(“AT+CMUT=0“, NULL);/* +CSSU unsolicited supp service notifications */at_send_command(“AT+CSSN=0,1“, NULL);/* no connected line identification */at_send_command(“AT+COLP=0“, NULL);/* HEX character set */at_send_command(“AT+CSCS=“HEX“, NU

6、LL);/* USSD unsolicited */at_send_command(“AT+CUSD=1“, NULL);/* Enable +CGEV GPRS event notifications, but dont buffer */at_send_command(“AT+CGEREP=1,0“, NULL);/* SMS PDU mode */at_send_command(“AT+CMGF=0“, NULL);#ifdef USE_TI_COMMANDSat_send_command(“AT%CPI=3“, NULL);/* TI specific - notifications

7、when SMS is ready (currently ignored) */at_send_command(“AT%CSTAT=1“, NULL);#endif /* USE_TI_COMMANDS */* assume radio is off on error */if (isRadioOn() 0) setRadioState (RADIO_STATE_SIM_NOT_READY);榛樿 鐘跺喌涓嬪亣璁惧皠棰戞 鍧楁槸濂界殑锛?閫氳繃 setRadioState (RADIO_STATE_SIM_NOT_READY) 鏉 鍙戝 鏃犵嚎妯潡鐨勫垵濮嬪寲銆?閫氳繃 static void

8、 onRadioPowerOn() 瀵规棤绾挎 鍧楀垵濮嬪寲銆?棣栧厛閫氳繃 pollSIMState(NULL); 杞 sim 鍗姸鎬?銆?static void pollSIMState (void *param)ATResponse *p_response;int ret;if (sState != RADIO_STATE_SIM_NOT_READY) / no longer valid to pollreturn;switch(getSIMStatus() case RIL_SIM_ABSENT:case RIL_SIM_PIN:case RIL_SIM_PUK:case RIL_SI

9、M_NETWORK_PERSONALIZATION:default:setRadioState(RADIO_STATE_SIM_LOCKED_OR_ABSENT);return;case RIL_SIM_NOT_READY:RIL_requestTimedCallback (pollSIMState, NULL, return;case RIL_SIM_READY:setRadioState(RADIO_STATE_SIM_READY);return;璇诲彇 sim 鍗姸鎬佺殑鍑芥暟鏄 細 getSIMStatus()err = at_send_command_singleline(“AT+C

10、PIN?“, “+CPIN:“, 瀹冨悜鐚 彂閫佷簡 at 鍛戒护 AT+CPIN? 鏉煡璇棤绾挎 鍧楃殑鐘舵侊紝濡傛灉鏃犵嚎妯潡杩樻病鏈夊氨缁 紝閭箞浠栭殧 1 绉掗挓缁 画璋冪敤sim 鍗姸鎬佽疆璇嚱鏁?pollSIMState 锛岀洿鍒拌幏寰梥 im 鍗姸鎬併?褰搒 im 鍗姸鎬佷负灏辩华锛岄偅涔堥氳繃 setRadioState(RADIO_STATE_SIM_READY) 璁剧疆鍙橀噺 sState 涓猴細RADIO_STATE_SIM_READY 锛岃繖鏃跺欎細璋冪敤鍑芥暟 static void onSIMReady()鏉繘涓姝垵濮嬪寲鏃犵嚎妯潡銆?鍙戦佺殑 at 鍛戒护鏈夛細a

11、t_send_command_singleline(“AT+CSMS=1“, “+CSMS:“, NULL);at_send_command(“AT+CNMI=1,2,2,1,1“, NULL);濡傛灉 sim 鍗攣寮鍚 紝鎴栬卲 in 琚 攣浣忕殑鏃跺欙紝浼氳 姹傝緭鍏in 鎴栬卲 uk 锛屼絾鏄 繖涓 閿佸姩浣滃繀椤诲湪绯荤粺鍒濆 鍖栧畬鎴愪互鍚庢墠鑳?杩涜 銆傦紙鍥惧舰绯荤粺閮借繕娌湁鍒濆 鍖栨庝箞杈撳叆瀵嗙爜闃匡紵锛夊綋绯荤粺鍒濆 鍖栧畬鎴愪互鍚庝細璋冪敤 wm.systemReady()鏉氱煡澶 銆?杩欐椂鍊欒 鍋氫粈涔堝氨鍋氫粈涔堛?锛濓紳锛濓紳锛濓紳锛濓紳锛濓紳wm.system

12、Ready()鐨勮皟鐢細瑙彂瑙攣鐣岄潰銆傚叿浣撴祦绋嬪 涓嬶細鍥犱负鏈夛細 WindowManagerService wm = null;鎵浠?wm.systemReady()璋冪敤鐨勬槸 WindowManagerService 涓 殑鍑芥暟锛?public void systemReady() mPolicy.systemReady();WindowManagerService 涓 湁锛?final WindowManagerPolicy mPolicy = PolicyManager.makeNewWindowManager();PolicyManager.makeNewWindowMa

13、nager 璋冪敤鐨勬槸鏂囦欢 PolicyManager.java 涓 殑鍑芥暟锛?public static WindowManagerPolicy makeNewWindowManager() return sPolicy.makeNewWindowManager();sPolicy.makeNewWindowManager 璋冪敤鐨勬槸鏂囦欢 Policy.java 涓 殑鍑芥暟锛?public PhoneWindowManager makeNewWindowManager() return new PhoneWindowManager();鍥犱负 PhoneWindowManager

14、 缁 壙鑷? WindowManagerPolicy鎵浠? mPolicy.systemReady() 鏈缁堣皟鐢殑鏄 枃浠?PhoneWindowManager.java 涓 殑鍑芥暟锛?public void systemReady()mKeyguardMediator.onSystemReady();doKeyguard();showLocked();Message msg = mHandler.obtainMessage(SHOW);mHandler.sendMessage(msg);鍙戦?SHOW 鐨勬秷鎭? 鏂囦欢 KeyguardViewMediator.java 涓 殑娑堟伅澶

15、勭悊鍑芥暟锛?public void handleMessage(Message msg) 瀵?SHOW 娑堟伅杩涜 浜嗗 鐞嗐? 濡傛灉 msg.what 绛変簬 SHOW 閭箞鎵 锛? handleShow();private void handleShow().mCallback.onKeyguardShow();mKeyguardViewManager.show();mShowing = true;mKeyguardViewManager.show() 璋冪敤鐨勬槸鏂囦欢 KeyguardViewManager.java 涓 殑鍑芥暟锛?public synchronized void

16、 show().mKeyguardView = mKeyguardViewProperties.createKeyguardView(mContext, mUpdateMonitor, this);.mKeyguardViewProperties.createKeyguardView 璋冪敤鐨勬槸鏂囦欢 LockPatternKeyguardViewProperties.java涓 殑鍑芥暟锛?public KeyguardViewBase createKeyguardView(Context context,KeyguardUpdateMonitor updateMonitor,Keygua

17、rdWindowController controller) return new LockPatternKeyguardView(context, updateMonitor,mLockPatternUtils, controller);new LockPatternKeyguardView 璋冪敤浜嗙被 LockPatternKeyguardView 鐨勬瀯閫犲嚱鏁帮細public LockPatternKeyguardView(Context context,KeyguardUpdateMonitor updateMonitor,LockPatternUtils lockPatternU

18、tils,KeyguardWindowController controller).mLockScreen = createLockScreen();addView(mLockScreen);final UnlockMode unlockMode = getUnlockMode();mUnlockScreen = createUnlockScreenFor(unlockMode);mUnlockScreenMode = unlockMode;addView(mUnlockScreen);updateScreen(mMode);鎵 涓婇潰鐨勭搴忕劧鍚庡脊鍑鸿 閿佺晫闈 紝getUnlockMod

19、e 鑾峰緱閿佺被鍨嬶紝閫氬父鏈変笁绉嶏細enum UnlockMode Pattern, /鍥炬 閿? SimPin, /杈撳叆 pin 鎴栬卲 ukAccount /璐彿閿?閫氳繃涓婇潰鐨勮繃绋嬫垜浠 彲浠煡閬擄紝鍦郴缁熷垵濮嬪寲闃舵 鍚 姩 rild 鐨勬椂鍊欙紝 rild 涓庣尗杩涜 浜嗛氫俊锛屽苟瀵圭尗杩涜 鍒濆 鍖栥?淇濆瓨浜嗙綉缁滅殑涓绯诲垪鐘舵併? 锛濓紳锛濓紳锛濓紳锛濓紳锛?寰呮満鐘舵佷笅锛岄 琛屾 寮忓垏鎹祦绋嬪垎鏋愶細椋炶 妯紡鍒囨崲姣旇緝澶嶆潅锛屽畠鐘舵佹敼鍙樻椂娑夊強鍒版瀬澶 鍧楃姸鎬佸垏鎹 細GSM 妯潡锛岃摑鐗欐 鍧楋紝 wifi 妯潡銆?椋炶 妯紡鐨別nabler

20、 灞備細鍙戦佸箍鎾 秷鎭 細ACTION_AIRPLANE_MODE_CHANGEDprivate void setAirplaneModeOn(boolean enabling) mCheckBoxPref.setEnabled(false);mCheckBoxPref.setSummary(enabling ? R.string.airplane_mode_turning_on: R.string.airplane_mode_turning_off);/ Change the system settingSettings.System.putInt(mContext.getContentR

21、esolver(), Settings.System.AIRPLANE_MODE_ON,enabling ? 1 : 0);/ Post the intentIntent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);intent.putExtra(“state“, enabling);mContext.sendBroadcast(intent);鍥犱负 GSM 锛岃摑鐗欙紝 wifi 妯潡鍒嗗埆娉唽浜嗗 ACTION_AIRPLANE_MODE_CHANGED 娑堟伅鐨勭洃娴嬶紝鎵浠敹鍒?璇秷鎭 悗锛屾 鍧椾細杩涜 鍒囨崲銆

22、?BluetoothDeviceService.java寮鍚 摑鐗欙細 enable(false);鍏抽棴钃濈墮锛歞 isable(false);PhoneApp.java (packagesappsphonesrccomandroidphone)璁剧疆 GSM 妯潡鐘舵?phone.setRadioPower(enabled);WifiService.java璁剧疆 wifi 鐘舵? setWifiEnabledBlocking(wifiEnabled, false, Process.myUid();锛濓紳锛?GSM 妯潡鍒囨崲杩囩鍒嗘瀽锛?phone.setRadioPower(enabl

23、ed)璋冪敤鐨勬槸锛?鏂囦欢 GSMPhone.java 涓 殑鐨勫嚱鏁帮細public void setRadioPower(boolean power)mSST.setRadioPower(power);鍥犱负鏈?ServiceStateTracker mSST;mSST.setRadioPower 璋冪敤鐨勬槸鏂囦欢 ServiceStateTracker.java 涓 殑鍑芥暟锛?public void setRadioPower(boolean power)mDesiredPowerState = power;setPowerStateToDesired();cm.setRadioP

24、ower(true, null);鎴栬? cm.setRadioPower(false, null);鍥犱负鏈夛細CommandsInterface cm;public final class RIL extends BaseCommands implements CommandsInterface鎵浠? cm.setRadioPower 璋冪敤鐨勬槸鏂囦欢 RIL.java 涓殑鍑芥暟锛?public void setRadioPower(boolean on, Message result)RILRequest rr = RILRequest.obtain(RIL_REQUEST_RADI

25、O_POWER, result);rr.mp.writeInt(1);.send(rr)閫氳繃 send 鍚?rild 鍙戦?RIL_REQUEST_RADIO_POWER 璇锋眰鏉紑鍚 垨鑰呭叧闂璆 SM 妯潡銆?rild 鏁版嵁鎺敹娴佺锛?鏀跺埌 RIL_REQUEST_RADIO_POWER 鎵 锛?requestRadioPower(data, datalen, t);鐒跺悗鏍规嵁鏉欢寰鏃犵嚎妯潡鍙戦佹 鍧楀紑鍚 拰鍏抽棴璇锋眰涓昏 鐨刟 t 鍛戒护鏈夛細err = at_send_command(“AT+CFUN=0“, err = at_send_command(“AT+CFUN=

26、1“, 锛濓紳锛?钃濈墮妯潡鍒囨崲杩囩鍒嗘瀽锛?enable(false);钃濈墮寮鍚 皟鐢枃浠? BluetoothDeviceService.java 涓殑鍑芥暟锛?public synchronized boolean enable(boolean saveSetting)setBluetoothState(BluetoothDevice.BLUETOOTH_STATE_TURNING_ON);mEnableThread = new EnableThread(saveSetting);mEnableThread.start();锛嶏紞锛嶏紞disable(false)钃濈墮鍏抽棴璋冪敤鏂

27、囦欢 涓 殑鍑芥暟锛?public synchronized boolean disable(boolean saveSetting)setBluetoothState(BluetoothDevice.BLUETOOTH_STATE_TURNING_OFF);锛濓紳锛?wifi 妯潡鍒囨崲杩囩鍒嗘瀽锛?骞挎挱 wifi 鐘舵佹敼鍙樼殑娑堟伅锛歐 IFI_STATE_CHANGED_ACTIONsetWifiEnabledState(enable ? WIFI_STATE_ENABLING : WIFI_STATE_DISABLING, uid);鏇存柊 wifi 鐘舵侊細private voi

28、d updateWifiState()濡傛灉闇瑕佷娇鑳藉紑鍚?wifi 閭箞浼氬彂閫侊細sendEnableMessage(true, false, mLastEnableUid);sendStartMessage(strongestLockMode = WifiManager.WIFI_MODE_SCAN_ONLY);mWifiHandler.sendEmptyMessage(MESSAGE_STOP_WIFI);娑堟伅寰 幆涓 鐞嗗懡浠秷鎭 細public void handleMessage(Message msg)濡傛灉浣胯兘 wifi 锛歴 etWifiEnabledBlocking

29、(true, msg.arg1 = 1, msg.arg2);寮鍚痺 ifi 锛?mWifiStateTracker.setScanOnlyMode(msg.arg1 != 0);setWifiEnabledBlocking(false, msg.arg1 = 1, msg.arg2);鏂 紑 mWifiStateTracker.disconnectAndStop();寮鍚 繃绋嬫 楠細1 瑁呰浇 wifi 椹卞姩锛?WifiNative.loadDriver()2 鍚 姩鍚庨 daemo supplicant 锛?WifiNative.startSupplicant()鍏抽棴杩囩姝 锛?1

30、鍋滄 鍚庨 daemo supplicant 锛歐 ifiNative.stopSupplicant()2 鍗歌浇 wifi 椹卞姩: WifiNative.unloadDriver()濡傛灉 wifi 鐘舵侀粯璁负寮鍚 偅涔? WifiService 鏈嶅姟鐨勬瀯閫犲嚱鏁帮細WifiService(Context context, WifiStateTracker tracker)boolean wifiEnabled = getPersistedWifiEnabled();setWifiEnabledBlocking(wifiEnabled, false, Process.myUid();浼氬紑鍚痺 ifi 妯潡銆?

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 企业管理 > 管理学资料

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报