summaryrefslogtreecommitdiffstats
path: root/core/tests/ConnectivityManagerTest
diff options
context:
space:
mode:
authorHung Dang <hndang@google.com>2010-07-16 15:15:44 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-07-16 15:15:44 -0700
commitb6761e73ce6b255cfe96bfa1fa6ac611abcfc067 (patch)
treeb9047bd8b1b350d5388171bcb4e697fa1d2d5e5c /core/tests/ConnectivityManagerTest
parentc8c79a654d4ae8e3a883854e19cc2df757f72d82 (diff)
parent28fe43be5c364a8f7f248a5ac05cf832a83737c2 (diff)
downloadframeworks_base-b6761e73ce6b255cfe96bfa1fa6ac611abcfc067.zip
frameworks_base-b6761e73ce6b255cfe96bfa1fa6ac611abcfc067.tar.gz
frameworks_base-b6761e73ce6b255cfe96bfa1fa6ac611abcfc067.tar.bz2
am 28fe43be: Merge "Add the hook which can set the device to connect to wifi and in airplane mode after reboot. This is for the power test." into froyo
Merge commit '28fe43be5c364a8f7f248a5ac05cf832a83737c2' into gingerbread * commit '28fe43be5c364a8f7f248a5ac05cf832a83737c2': Add the hook which can set the device to connect to wifi and in airplane mode after reboot. This is for the power test.
Diffstat (limited to 'core/tests/ConnectivityManagerTest')
-rw-r--r--core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerTestActivity.java43
1 files changed, 43 insertions, 0 deletions
diff --git a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerTestActivity.java b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerTestActivity.java
index 7392ad4..e42b657 100644
--- a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerTestActivity.java
+++ b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerTestActivity.java
@@ -24,6 +24,7 @@ import android.content.IntentFilter;
import android.os.Bundle;
import android.provider.Settings;
import android.util.Log;
+import android.view.KeyEvent;
import java.util.List;
import android.widget.LinearLayout;
import android.net.ConnectivityManager;
@@ -64,6 +65,8 @@ public class ConnectivityManagerTestActivity extends Activity {
public int mWifiState;
public NetworkInfo mWifiNetworkInfo;
public String mBssid;
+ public String mPowerSsid = "GoogleGuest"; //Default power SSID
+ private Context mContext;
/*
* Control Wifi States
@@ -404,4 +407,44 @@ public class ConnectivityManagerTestActivity extends Activity {
}
Log.v(LOG_TAG, "onDestroy, inst=" + Integer.toHexString(hashCode()));
}
+
+ @Override
+ public void onStart() {
+ super.onStart();
+ mContext = this;
+ Bundle bundle = this.getIntent().getExtras();
+ if (bundle != null){
+ mPowerSsid = bundle.getString("power_ssid");
+ }
+ }
+ //A thread to set the device into airplane mode then turn on wifi.
+ Thread setDeviceWifiAndAirplaneThread = new Thread(new Runnable() {
+ public void run() {
+ setAirplaneMode(mContext, true);
+ connectToWifi(mPowerSsid);
+ }
+ });
+
+ //A thread to set the device into wifi
+ Thread setDeviceInWifiOnlyThread = new Thread(new Runnable() {
+ public void run() {
+ connectToWifi(mPowerSsid);
+ }
+ });
+
+ @Override
+ public boolean onKeyDown(int keyCode, KeyEvent event) {
+ switch (keyCode) {
+ //This is a tricky way for the scripted monkey to
+ //set the device in wifi and wifi in airplane mode.
+ case KeyEvent.KEYCODE_1:
+ setDeviceWifiAndAirplaneThread.start();
+ break;
+
+ case KeyEvent.KEYCODE_2:
+ setDeviceInWifiOnlyThread.start();
+ break;
+ }
+ return super.onKeyDown(keyCode, event);
+ }
}