diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2010-06-14 11:39:26 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-06-14 11:39:26 -0700 |
commit | e377032899fd7a9f88ad1313847e77c098b9f248 (patch) | |
tree | e986fa3bbeb7581a5d64a24a3282bf230d8bfa72 /wifi | |
parent | 26b327c80b8a2728e9d4d16671e03d7085c38747 (diff) | |
parent | 864c68ea452baa0f4f298faf2155af45a9b6d60c (diff) | |
download | frameworks_base-e377032899fd7a9f88ad1313847e77c098b9f248.zip frameworks_base-e377032899fd7a9f88ad1313847e77c098b9f248.tar.gz frameworks_base-e377032899fd7a9f88ad1313847e77c098b9f248.tar.bz2 |
am 864c68ea: merge from froyo-plus-aosp
Merge commit '864c68ea452baa0f4f298faf2155af45a9b6d60c'
* commit '864c68ea452baa0f4f298faf2155af45a9b6d60c':
Added an addAll to the ArrayAdapter
WLAN: Reset power save mode to startup value after DHCP response.
Add PageUp and PageDown hot keys
Should accept "application/vnd.wap.multipart.alternative" message.
replaced deprecated getIntent with parseURI
Diffstat (limited to 'wifi')
-rw-r--r-- | wifi/java/android/net/wifi/WifiNative.java | 2 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiStateTracker.java | 29 |
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 2cec996..73cba93 100644 --- a/wifi/java/android/net/wifi/WifiStateTracker.java +++ b/wifi/java/android/net/wifi/WifiStateTracker.java @@ -2010,6 +2010,17 @@ public class WifiStateTracker extends Handler implements 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 @@ -2342,6 +2353,8 @@ public class WifiStateTracker extends Handler implements 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 @@ -2365,8 +2378,16 @@ public class WifiStateTracker extends Handler implements 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 @@ -2382,7 +2403,9 @@ public class WifiStateTracker extends Handler implements 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 |