summaryrefslogtreecommitdiff
authorkejun.gao <kejun.gao@amlogic.com>2011-10-30 10:01:50 (GMT)
committer kejun.gao <kejun.gao@amlogic.com>2011-10-30 10:01:50 (GMT)
commit1d46b0518405cbca7e728262ef536c1a83060c08 (patch)
treeb9cfb52c17eba5dc57c0d31793b9cc4513940275
parent32efe139022ba237d0a7abe146c68c93e99b9521 (diff)
downloadPPPoE-1d46b0518405cbca7e728262ef536c1a83060c08.zip
PPPoE-1d46b0518405cbca7e728262ef536c1a83060c08.tar.gz
PPPoE-1d46b0518405cbca7e728262ef536c1a83060c08.tar.bz2
fix bug: crash if discard when disconnecting
Diffstat
-rwxr-xr-xres/values-zh-rCN/strings.xml3
-rwxr-xr-xres/values-zh-rTW/strings.xml3
-rwxr-xr-xres/values/strings.xml3
-rwxr-xr-xsrc/com/amlogic/PPPoE/PppoeConfigDialog.java19
4 files changed, 18 insertions, 10 deletions
diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml
index 4069e80..10d965f 100755
--- a/res/values-zh-rCN/strings.xml
+++ b/res/values-zh-rCN/strings.xml
@@ -9,7 +9,8 @@
<string name="pppoe_passwd">密码</string>
<string name="pppoe_dial">拨号</string>
<string name="pppoe_disconnect">断开</string>
- <string name="pppoe_waiting_msg">正在拨号,请稍等...</string>
+ <string name="pppoe_dial_waiting_msg">正在拨号,请稍等...</string>
+ <string name="pppoe_hangup_waiting_msg">正在断开拨号,请稍等...</string>
<string name="pppoe_conf_summary">宽带拨号配置</string>
<string name="pppoe_connect_ok">宽带拨号成功</string>
<string name="pppoe_connect_failed">宽带拨号失败</string>
diff --git a/res/values-zh-rTW/strings.xml b/res/values-zh-rTW/strings.xml
index 1bb493f..08b4627 100755
--- a/res/values-zh-rTW/strings.xml
+++ b/res/values-zh-rTW/strings.xml
@@ -9,7 +9,8 @@
<string name="pppoe_passwd">密碼</string>
<string name="pppoe_dial">撥號</string>
<string name="pppoe_disconnect">斷開</string>
- <string name="pppoe_waiting_msg">正在撥號,請稍等...</string>
+ <string name="pppoe_dial_waiting_msg">正在撥號,請稍等...</string>
+ <string name="pppoe_hangup_waiting_msg">正在断开撥號,請稍等...</string>
<string name="pppoe_conf_summary">寬帶撥號配置</string>
<string name="pppoe_connect_ok">寬帶撥號成功</string>
<string name="pppoe_connect_failed">寬帶撥號失败</string>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1393114..082e059 100755
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -9,7 +9,8 @@
<string name="pppoe_passwd">Password</string>
<string name="pppoe_dial">Dial</string>
<string name="pppoe_disconnect">Disconnect</string>
- <string name="pppoe_waiting_msg">Please wait for dial...</string>
+ <string name="pppoe_dial_waiting_msg">Please wait for dial...</string>
+ <string name="pppoe_hangup_waiting_msg">Please wait for hangup...</string>
<string name="pppoe_conf_summary">Configure dial</string>
<string name="pppoe_connect_ok">Connect Ok!</string>
<string name="pppoe_connect_failed">Connect failed!</string>
diff --git a/src/com/amlogic/PPPoE/PppoeConfigDialog.java b/src/com/amlogic/PPPoE/PppoeConfigDialog.java
index 222e117..0e26d85 100755
--- a/src/com/amlogic/PPPoE/PppoeConfigDialog.java
+++ b/src/com/amlogic/PPPoE/PppoeConfigDialog.java
@@ -120,12 +120,11 @@ public class PppoeConfigDialog extends AlertDialog implements DialogInterface.On
super.show();
}
- void showWaitDialog()
+ void showWaitDialog(int id)
{
- Log.d(TAG, "showWaitDialog");
waitDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
waitDialog.setTitle("");
- waitDialog.setMessage(this.context.getResources().getString(R.string.pppoe_waiting_msg));
+ waitDialog.setMessage(this.context.getResources().getString(id));
waitDialog.setIcon(null);
waitDialog.setButton(android.content.DialogInterface.BUTTON_POSITIVE,this.context.getResources().getString(R.string.menu_cancel),clickListener);
waitDialog.setIndeterminate(false);
@@ -260,7 +259,7 @@ public class PppoeConfigDialog extends AlertDialog implements DialogInterface.On
//Timeout after 30 seconds
connect_timer.schedule(check_task, 30000);
- showWaitDialog();
+ showWaitDialog(R.string.pppoe_dial_waiting_msg);
operation.connect(name, passwd);
}
}
@@ -303,10 +302,10 @@ public class PppoeConfigDialog extends AlertDialog implements DialogInterface.On
}
};
- //Timeout after 10 seconds
- disconnect_timer.schedule(check_task, 10000);
+ //Timeout after 5 seconds
+ disconnect_timer.schedule(check_task, 5000);
- showWaitDialog();
+ showWaitDialog(R.string.pppoe_hangup_waiting_msg);
}
@@ -320,6 +319,12 @@ public class PppoeConfigDialog extends AlertDialog implements DialogInterface.On
{
public void onClick(DialogInterface dialog, int which)
{
+ //If do not cancel the timer, then discard when disconnecting
+ //will cause APK crash
+ Log.d(TAG, "#####################################");
+ if (disconnect_timer != null)
+ disconnect_timer.cancel();
+
handleCancelDial();
waitDialog.cancel();
clearSelf();