ubuntu 在 R40e 上 還有 Debian 在 Sempron 2600 上

2012年5月4日 星期五

wifi 與 mobile 間的連動.

就是 wifi 連上的時候,3G 會被關閉。
wifi 關掉後,3G 又會打開..

從 log 上看.. V/WifiStateTracker( 2408): DhcpHandler: DHCP request succeeded D/NetworkStateTracker( 2408): setDetailed state, old =OBTAINING_IPADDR and new state=CONNECTED V/WifiStateTracker( 2408): IP configuration: ipaddr 192.168.204.177 gateway 192.168.204.254 netmask 255.255.255.0 dns1 192.168.147.15 dns2 192.168.147.240 DHCP server 192.168.204.254 lease 3600 seconds D/ConnectivityService( 2408): NetworkStateTracker.EVENT_STATE_CHANGED D/ConnectivityService( 2408): ConnectivityChange for WIFI: CONNECTED/CONNECTED V/ConnectivityService( 2408): handleConnect : type 1mNetworkPreference9mActiveDefaultNetwork0 V/ConnectivityService( 2408): Policy requires mobile teardown I/pppd ( 3011): Terminating on signal 15 I/pppd ( 3011): Connect time 94.3 minutes. I/pppd ( 3011): Sent 32451 bytes, received 353433 bytes. W/NetworkStateTracker( 2408): Can't set tcp buffer sizes:java.io.FileNotFoundException: /sys/kernel/ipv4/tcp_rmem_min (No such file or directory) D/WifiWatchdogService( 2408): (android.server.ServerThread) AP4 (00:1e:58:30:70:f9) does not require the watchdog D/pppd ( 3011): Script /etc/ppp/ip-down-ppp0 started (pid 3525) D/pppd ( 3011): sent [LCP TermReq id=0x2 "User request"] 好像是 ConnectivityService 負責.

grep 一下 "Policy requires mobile teardown".
結果在:
ConnectivityService.java: Ln1264: private void handleConnect(NetworkInfo info) { int type = info.getType(); // snapshot isFailover, because sendConnectedBroadcast() resets it boolean isFailover = info.isFailover(); NetworkStateTracker thisNet = mNetTrackers[type]; Slog.v(TAG,"handleConnect : type " +type+"mNetworkPreference"+mNetworkPreference+"mActiveDefaultNetwork"+mActiveDefaultNetwork); // if this is a default net and other default is running // kill the one not preferred if (mNetAttributes[type].isDefault()) { if (mActiveDefaultNetwork != -1 && mActiveDefaultNetwork != type) { if ((type != mNetworkPreference && mNetAttributes[mActiveDefaultNetwork].mPriority > mNetAttributes[type].mPriority) || mNetworkPreference == mActiveDefaultNetwork) { // don't accept this one Slog.v(TAG, "Not broadcasting CONNECT_ACTION " + "to torn down network " + info.getTypeName()); teardown(thisNet); return; } else { // tear down the other NetworkStateTracker otherNet = mNetTrackers[mActiveDefaultNetwork]; Slog.v(TAG, "Policy requires " + otherNet.getNetworkInfo().getTypeName() + " teardown"); if (!teardown(otherNet)) { Slog.e(TAG, "Network declined teardown request"); return; } if (isFailover) { otherNet.releaseWakeLock(); } } }
後面的部份: tear down the other.

所以負責 關掉 wifi 後,打開 mobile (3g) 應該是 handleDisconnect ?

但是看 handleDisconnect,好像只是被動的check network failover 是否成功。
沒有真的去 activate anthor network。

開啟這個 class 的 DBG 選項後,再看 log..

結果:android-reconnect-3g-after-disconect-wifi

沒有留言:

標籤

網誌存檔