summaryrefslogtreecommitdiffstats
path: root/wifi/java/android
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2010-06-14 11:35:51 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2010-06-14 11:35:51 -0700
commit864c68ea452baa0f4f298faf2155af45a9b6d60c (patch)
tree04cc67b82596528b296fcb6fec71dc484ceb5b6c /wifi/java/android
parent6b9b8806afb06e393203450bda8a53af08952590 (diff)
parentd7b814188df4765e42a34ce94182ef5021ef8f16 (diff)
downloadframeworks_base-864c68ea452baa0f4f298faf2155af45a9b6d60c.zip
frameworks_base-864c68ea452baa0f4f298faf2155af45a9b6d60c.tar.gz
frameworks_base-864c68ea452baa0f4f298faf2155af45a9b6d60c.tar.bz2
merge from froyo-plus-aosp
Change-Id: I9cede57e10df9d6ba411b2960a77d7b9b60a1489
Diffstat (limited to 'wifi/java/android')
-rw-r--r--wifi/java/android/net/wifi/WifiNative.java2
-rw-r--r--wifi/java/android/net/wifi/WifiStateTracker.java29
2 files changed, 28 insertions, 3 deletions
diff --git a/wifi/java/android/net/wifi/WifiNative.java b/wifi/java/android/net/wifi/WifiNative.java
index f98cd28..7a3282c 100644
--- a/wifi/java/android/net/wifi/WifiNative.java
+++ b/wifi/java/android/net/wifi/WifiNative.java
@@ -109,6 +109,8 @@ public class WifiNative {
public native static boolean setPowerModeCommand(int mode);
+ public native static int getPowerModeCommand();
+
public native static boolean setNumAllowedChannelsCommand(int numChannels);
public native static int getNumAllowedChannelsCommand();
diff --git a/wifi/java/android/net/wifi/WifiStateTracker.java b/wifi/java/android/net/wifi/WifiStateTracker.java
index 78a9674..2160ae2 100644
--- a/wifi/java/android/net/wifi/WifiStateTracker.java
+++ b/wifi/java/android/net/wifi/WifiStateTracker.java
@@ -1928,6 +1928,17 @@ public class WifiStateTracker extends NetworkStateTracker {
}
/**
+ * Get power mode
+ * @return power mode
+ */
+ public synchronized int getPowerMode() {
+ if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) {
+ return -1;
+ }
+ return WifiNative.getPowerModeCommand();
+ }
+
+ /**
* Set power mode
* @param mode
* DRIVER_POWER_MODE_AUTO
@@ -2252,6 +2263,8 @@ public class WifiStateTracker extends NetworkStateTracker {
case EVENT_DHCP_START:
boolean modifiedBluetoothCoexistenceMode = false;
+ int powerMode = DRIVER_POWER_MODE_AUTO;
+
if (shouldDisableCoexistenceMode()) {
/*
* There are problems setting the Wi-Fi driver's power
@@ -2275,8 +2288,16 @@ public class WifiStateTracker extends NetworkStateTracker {
setBluetoothCoexistenceMode(
WifiNative.BLUETOOTH_COEXISTENCE_MODE_DISABLED);
}
-
- setPowerMode(DRIVER_POWER_MODE_ACTIVE);
+
+ powerMode = getPowerMode();
+ if (powerMode < 0) {
+ // Handle the case where supplicant driver does not support
+ // getPowerModeCommand.
+ powerMode = DRIVER_POWER_MODE_AUTO;
+ }
+ if (powerMode != DRIVER_POWER_MODE_ACTIVE) {
+ setPowerMode(DRIVER_POWER_MODE_ACTIVE);
+ }
synchronized (this) {
// A new request is being made, so assume we will callback
@@ -2292,7 +2313,9 @@ public class WifiStateTracker extends NetworkStateTracker {
NetworkUtils.getDhcpError());
}
- setPowerMode(DRIVER_POWER_MODE_AUTO);
+ if (powerMode != DRIVER_POWER_MODE_ACTIVE) {
+ setPowerMode(powerMode);
+ }
if (modifiedBluetoothCoexistenceMode) {
// Set the coexistence mode back to its default value