author | Zhiwei Gong <zhiwei.gong@amlogic.com> | 2015-02-04 04:47:42 (GMT) |
---|---|---|
committer | zhiwei.gong <zhiwei.gong@amlogic.com> | 2015-02-04 05:04:04 (GMT) |
commit | 8131cfc03749b9dd7f84dd8ae21dcb357e1b19d6 (patch) | |
tree | d1156913bf6ce9e55c037d57cc7536a8f8e7a208 | |
parent | 6bce7cbd8fc939c7b4370ba0cd9887bdf790b925 (diff) | |
download | PPPoE-8131cfc03749b9dd7f84dd8ae21dcb357e1b19d6.zip PPPoE-8131cfc03749b9dd7f84dd8ae21dcb357e1b19d6.tar.gz PPPoE-8131cfc03749b9dd7f84dd8ae21dcb357e1b19d6.tar.bz2 |
PD 103061 pppoe Auto Dialon Reboot
Change-Id: I6a37d0918e1de39ccdd5b2c872ca2986794381c9
-rw-r--r-- | src/com/droidlogic/PPPoE/PppoeBroadcastReceiver.java | 98 |
1 files changed, 40 insertions, 58 deletions
diff --git a/src/com/droidlogic/PPPoE/PppoeBroadcastReceiver.java b/src/com/droidlogic/PPPoE/PppoeBroadcastReceiver.java index de75501..9baeff6 100644 --- a/src/com/droidlogic/PPPoE/PppoeBroadcastReceiver.java +++ b/src/com/droidlogic/PPPoE/PppoeBroadcastReceiver.java @@ -104,68 +104,50 @@ public class PppoeBroadcastReceiver extends BroadcastReceiver { } Log.d(TAG , ">>>>>onReceive :" +intent.getAction()); - if (ETH_STATE_CHANGED_ACTION.equals(action)) { - if (!mInterfaceSelected.startsWith("eth")) - return; - - int event = intent.getIntExtra(EXTRA_ETH_STATE, -1); - if (event == EVENT_HW_PHYCONNECTED) { - Log.d(TAG, "EVENT_HW_PHYCONNECTED"); - if (mMandatoryDialTimer != null) { - mMandatoryDialTimer.cancel(); - mMandatoryDialTimer = null; - } - mFirstAutoDialDone = true; - - Log.d(TAG, "EVENT_HW_PHYCONNECTED trigger AUTO DIAL"); + if (!mInterfaceSelected.startsWith("eth")) + return; - set_pppoe_running_flag(); - operation.terminate(); - operation.disconnect(); - mHandler.sendEmptyMessageDelayed(PPPoEActivity.MSG_START_DIAL, 30000); - } - else { - if (event == EVENT_HW_DISCONNECTED ) { - Log.d(TAG, "EVENT_HW_DISCONNECTED"); - } - else if (event == EVENT_HW_CONNECTED ) - Log.d(TAG, "EVENT_HW_CONNECTED"); - else - Log.d(TAG, "EVENT=" + event); - - if (event != EVENT_HW_DISCONNECTED&& !mFirstAutoDialDone) { - Log.d(TAG, "EVENT_HW_PHYCONNECTED LOST"); - mFirstAutoDialDone = true; - mMandatoryDialTimer = new Timer(); - TimerTask check_task = new TimerTask() { - public void run() - { - Message message = new Message(); - message.what = PPPoEActivity.MSG_MANDATORY_DIAL; - Log.d(TAG, "Send MSG_MANDATORY_DIAL"); - mHandler.sendMessage(message); - } - }; - - //Timeout after 5 seconds - mMandatoryDialTimer.schedule(check_task, 5000); - } + int event = intent.getIntExtra(EXTRA_ETH_STATE, -1); + if (event == EVENT_HW_PHYCONNECTED) { + Log.d(TAG, "EVENT_HW_PHYCONNECTED"); + if (mMandatoryDialTimer != null) { + mMandatoryDialTimer.cancel(); + mMandatoryDialTimer = null; } + mFirstAutoDialDone = true; + + Log.d(TAG, "EVENT_HW_PHYCONNECTED trigger AUTO DIAL"); + + set_pppoe_running_flag(); + operation.terminate(); + operation.disconnect(); + mHandler.sendEmptyMessageDelayed(PPPoEActivity.MSG_START_DIAL, 30000); } - else if (WifiManager.NETWORK_STATE_CHANGED_ACTION.equals(action)) { - NetworkInfo info = (NetworkInfo) intent.getParcelableExtra( - WifiManager.EXTRA_NETWORK_INFO); - if (!mInterfaceSelected.startsWith("wlan")) - return; - - if (info.isConnected()) { - Log.d(TAG, "AUTO DIAL OVER WIFI"); - set_pppoe_running_flag(); - operation.terminate(); - operation.disconnect(); + else { + if (event == EVENT_HW_DISCONNECTED ) { + Log.d(TAG, "EVENT_HW_DISCONNECTED"); + } + else if (event == EVENT_HW_CONNECTED ) + Log.d(TAG, "EVENT_HW_CONNECTED"); + else + Log.d(TAG, "EVENT=" + event); - mHandler = new PppoeHandler(); - mHandler.sendEmptyMessageDelayed(PPPoEActivity.MSG_START_DIAL, 5000); + if (event != EVENT_HW_DISCONNECTED&& !mFirstAutoDialDone) { + Log.d(TAG, "EVENT_HW_PHYCONNECTED LOST"); + mFirstAutoDialDone = true; + mMandatoryDialTimer = new Timer(); + TimerTask check_task = new TimerTask() { + public void run() + { + Message message = new Message(); + message.what = PPPoEActivity.MSG_MANDATORY_DIAL; + Log.d(TAG, "Send MSG_MANDATORY_DIAL"); + mHandler.sendMessage(message); + } + }; + + //Timeout after 5 seconds + mMandatoryDialTimer.schedule(check_task, 5000); } } } |