author | Zhiwei Gong <zhiwei.gong@amlogic.com> | 2015-07-24 10:26:34 (GMT) |
---|---|---|
committer | zhiwei.gong <zhiwei.gong@amlogic.com> | 2015-07-24 10:56:09 (GMT) |
commit | 92676a1657634d998509544aa8fc631cfe3b96df (patch) | |
tree | 1e699eab9f3db0019f6bee79d4d2b74842d4e088 | |
parent | 9e0f7e2a6987e4733ec01705b4d28ac4274cec6b (diff) | |
download | PPPoE-92676a1657634d998509544aa8fc631cfe3b96df.zip PPPoE-92676a1657634d998509544aa8fc631cfe3b96df.tar.gz PPPoE-92676a1657634d998509544aa8fc631cfe3b96df.tar.bz2 |
PD#109974:PD#109982:fix pppoe con not access net again when wake up
Change-Id: Ie599fb9281215efb862ece24a741e0e745764281
-rw-r--r-- | src/com/droidlogic/PPPoE/MyPppoeService.java | 48 | ||||
-rw-r--r-- | src/com/droidlogic/PPPoE/PppoeConfigDialog.java | 2 |
2 files changed, 33 insertions, 17 deletions
diff --git a/src/com/droidlogic/PPPoE/MyPppoeService.java b/src/com/droidlogic/PPPoE/MyPppoeService.java index c1548bd..be0e584 100644 --- a/src/com/droidlogic/PPPoE/MyPppoeService.java +++ b/src/com/droidlogic/PPPoE/MyPppoeService.java @@ -27,9 +27,11 @@ public class MyPppoeService extends Service private static final String TAG = "MyPppoeService"; private NotificationManager mNM; private Handler mHandler; + private Handler mPppoeHandler; private PppoeOperation operation = null; private InterfaceObserver mInterfaceObserver; private INetworkManagementService mNMService; + public static final int MSG_PPPOE_START = 0xabcd0080; @Override public void onCreate() { @@ -40,6 +42,7 @@ public class MyPppoeService extends Service mNM = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); mHandler = new DMRHandler(); + mPppoeHandler = new PppoeHandler(); mInterfaceObserver = new InterfaceObserver(); try { mNMService.registerObserver(mInterfaceObserver); @@ -100,23 +103,36 @@ public class MyPppoeService extends Service } } - -private BroadcastReceiver mShutdownReceiver = - new BroadcastReceiver() { - @Override - public void onReceive(Context context, Intent intent) { - Log.d(TAG , "onReceive :" +intent.getAction()); - - if ((Intent.ACTION_SCREEN_OFF).equals(intent.getAction())) { - operation = new PppoeOperation(); - operation.disconnect(); - } - if ((Intent.ACTION_SCREEN_ON).equals(intent.getAction())) { - updateInterfaceState("eth0", true); + private class PppoeHandler extends Handler + { + @Override + public void handleMessage(Message msg) { + super.handleMessage(msg); + switch (msg.what) { + case MSG_PPPOE_START: + updateInterfaceState("eth0", true); + break; + default: + Log.d(TAG, "handleMessage: " + msg.what); + break; + } } - } -}; - + private BroadcastReceiver mShutdownReceiver = + new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + Log.d(TAG , "onReceive :" +intent.getAction()); + if ((Intent.ACTION_SCREEN_OFF).equals(intent.getAction())) { + operation = new PppoeOperation(); + operation.disconnect(); + } + if ((Intent.ACTION_SCREEN_ON).equals(intent.getAction())) { + operation = new PppoeOperation(); + operation.disconnect(); + mPppoeHandler.sendEmptyMessageDelayed(MSG_PPPOE_START, 10000); + } + } + }; } diff --git a/src/com/droidlogic/PPPoE/PppoeConfigDialog.java b/src/com/droidlogic/PPPoE/PppoeConfigDialog.java index cefa8a2..5a52d99 100644 --- a/src/com/droidlogic/PPPoE/PppoeConfigDialog.java +++ b/src/com/droidlogic/PPPoE/PppoeConfigDialog.java @@ -511,7 +511,7 @@ public class PppoeConfigDialog extends AlertDialog implements DialogInterface.On } }; - connect_timer.schedule(check_task, 60000 * 2); + connect_timer.schedule(check_task, 60000); showWaitDialog(R.string.pppoe_dial_waiting_msg); pppoe_state = PPPOE_STATE_CONNECTING; |