summaryrefslogtreecommitdiff
authorZhiwei Gong <zhiwei.gong@amlogic.com>2015-02-05 04:48:36 (GMT)
committer Tellen Yu <tellen.yu@amlogic.com>2015-05-08 07:30:26 (GMT)
commit415e168d8da16be4a99cfa311ac9343911ee6c52 (patch)
treef490d8f8e6fb68c187e1acc2dca53e3eac6b021e
parent8131cfc03749b9dd7f84dd8ae21dcb357e1b19d6 (diff)
downloadPPPoE-415e168d8da16be4a99cfa311ac9343911ee6c52.zip
PPPoE-415e168d8da16be4a99cfa311ac9343911ee6c52.tar.gz
PPPoE-415e168d8da16be4a99cfa311ac9343911ee6c52.tar.bz2
PD #103102 don't start pppoe.apk when ethernet cable isn't plug in
Change-Id: Ia3dd033a2b455cafa18bdbf7992f6df1d6869c43
Diffstat
-rw-r--r--res/values-zh-rCN/strings.xml1
-rw-r--r--res/values-zh-rTW/strings.xml1
-rw-r--r--res/values/strings.xml1
-rw-r--r--src/com/droidlogic/PPPoE/PPPoEActivity.java12
4 files changed, 14 insertions, 1 deletions
diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml
index 71a3cba..9ece9ff 100644
--- a/res/values-zh-rCN/strings.xml
+++ b/res/values-zh-rCN/strings.xml
@@ -21,4 +21,5 @@
<string name="pppoe_ppp_interface_occupied">ppp接口被占用</string>
<string name="amlogic_ok">确定</string>
<string name="pppoe_auto_dial">开机自动拨号</string>
+ <string name="please_insert_the_cable">请插入网线</string>
</resources>
diff --git a/res/values-zh-rTW/strings.xml b/res/values-zh-rTW/strings.xml
index 33bc789..f6461d3 100644
--- a/res/values-zh-rTW/strings.xml
+++ b/res/values-zh-rTW/strings.xml
@@ -21,4 +21,5 @@
<string name="pppoe_ppp_interface_occupied">ppp接口被佔用</string>
<string name="amlogic_ok">確定</string>
<string name="pppoe_auto_dial">開機自動撥號</string>
+ <string name="please_insert_the_cable">請插入網綫</string>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index c4f9c10..60bacb3 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -21,4 +21,5 @@
<string name="pppoe_ppp_interface_occupied">ppp interface occupied!</string>
<string name="amlogic_ok">OK</string>
<string name="pppoe_auto_dial">Auto Dial on Reboot</string>
+ <string name="please_insert_the_cable">Please insert the cable</string>
</resources>
diff --git a/src/com/droidlogic/PPPoE/PPPoEActivity.java b/src/com/droidlogic/PPPoE/PPPoEActivity.java
index 1a40929..6be6d2d 100644
--- a/src/com/droidlogic/PPPoE/PPPoEActivity.java
+++ b/src/com/droidlogic/PPPoE/PPPoEActivity.java
@@ -4,6 +4,7 @@ import com.droidlogic.pppoe.PppoeManager;
import com.droidlogic.pppoe.IPppoeManager;
import com.droidlogic.pppoe.PppoeStateTracker;
import com.droidlogic.pppoe.PppoeDevInfo;
+import com.droidlogic.app.SystemControlManager;
import android.app.Activity;
import android.net.ConnectivityManager;
@@ -23,6 +24,7 @@ public class PPPoEActivity extends Activity {
private PppoeConfigDialog mPppoeConfigDialog;
private PppoeDevInfo mPppoeInfo;
private PppoeManager mPppoeManager;
+ private SystemControlManager mSystemControlManager = null;
public static final int MSG_START_DIAL = 0xabcd0000;
public static final int MSG_MANDATORY_DIAL = 0xabcd0010;
public static final int MSG_CONNECT_TIMEOUT = 0xabcd0020;
@@ -36,9 +38,17 @@ public class PPPoEActivity extends Activity {
Log.d(TAG, "Create PppoeConfigDialog");
mPppoeConfigDialog = new PppoeConfigDialog(this);
-
+ mSystemControlManager = new SystemControlManager(this);
ConnectivityManager cm = (ConnectivityManager)this.getSystemService
( Context.CONNECTIVITY_SERVICE);
+ String eth_link = mSystemControlManager.readSysFs("/sys/class/ethernet/linkspeed");
+ if (eth_link.contains("unlink")) {
+ Toast toast = Toast.makeText(this,this.getResources().getString(R.string.please_insert_the_cable),Toast.LENGTH_LONG);
+ toast.setGravity(Gravity.CENTER, 0, 0);
+ toast.show();
+ finish();
+ }
+
NetworkInfo info = cm.getActiveNetworkInfo();
if (info != null) {
Log.d(TAG, info.toString());