diff options
author | Mikael Kanstrup <mikael.kanstrup@sonyericsson.com> | 2010-04-07 16:45:58 +0200 |
---|---|---|
committer | Irfan Sheriff <isheriff@google.com> | 2010-08-13 10:24:04 -0700 |
commit | 876247784ee6202066abdefd8366f2e09e681fab (patch) | |
tree | cac3ca70fcfda31b9ee09a9a92a124887fc4bf60 /wifi | |
parent | 94364b91a2894bf037b8beb027132fbb812e1434 (diff) | |
download | frameworks_base-876247784ee6202066abdefd8366f2e09e681fab.zip frameworks_base-876247784ee6202066abdefd8366f2e09e681fab.tar.gz frameworks_base-876247784ee6202066abdefd8366f2e09e681fab.tar.bz2 |
DO NOT MERGE WLAN: Reset power save mode to startup value after DHCP response.
When the driver was configured to run with power save mode disabled the
power save mode incorrectly got reverted back to AUTO mode right after
DHCP response. The power save mode value is now saved so that the device
properly reverts back to a previous mode after DHCP response.
Change-Id: Ie68cd107872d233bf422e24130a1eb9f6432db91
Bug: 2834260
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 | 27 |
2 files changed, 27 insertions, 2 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 8b2cfc6..75a78d4 100644 --- a/wifi/java/android/net/wifi/WifiStateTracker.java +++ b/wifi/java/android/net/wifi/WifiStateTracker.java @@ -1931,6 +1931,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 @@ -2255,6 +2266,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 @@ -2279,7 +2292,15 @@ public class WifiStateTracker extends NetworkStateTracker { 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 @@ -2295,7 +2316,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 |