diff options
author | Mikael Kanstrup <mikael.kanstrup@sonyericsson.com> | 2010-04-07 16:45:58 +0200 |
---|---|---|
committer | Johan Redestig <johan.redestig@sonyericsson.com> | 2010-06-10 14:51:43 +0200 |
commit | ea8bd1d1676dd96f8f9726bb8f67fa18dec7b9c1 (patch) | |
tree | a872f24e1ee79dc729b5eb644e42128c6390abfe /wifi | |
parent | 9226a713ff7a372f8efc68c17da3ba8fd7f22365 (diff) | |
download | frameworks_base-ea8bd1d1676dd96f8f9726bb8f67fa18dec7b9c1.zip frameworks_base-ea8bd1d1676dd96f8f9726bb8f67fa18dec7b9c1.tar.gz frameworks_base-ea8bd1d1676dd96f8f9726bb8f67fa18dec7b9c1.tar.bz2 |
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: I5035aad10146812ecef1be8ea4b22a03e230ccc9
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 | 16 |
2 files changed, 16 insertions, 2 deletions
diff --git a/wifi/java/android/net/wifi/WifiNative.java b/wifi/java/android/net/wifi/WifiNative.java index c3c519f..d9378fc 100644 --- a/wifi/java/android/net/wifi/WifiNative.java +++ b/wifi/java/android/net/wifi/WifiNative.java @@ -106,6 +106,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 f97f21b..c45b480 100644 --- a/wifi/java/android/net/wifi/WifiStateTracker.java +++ b/wifi/java/android/net/wifi/WifiStateTracker.java @@ -1755,6 +1755,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 @@ -1782,7 +1784,15 @@ public class WifiStateTracker extends NetworkStateTracker { } synchronized (WifiStateTracker.this) { - WifiNative.setPowerModeCommand(DRIVER_POWER_MODE_ACTIVE); + powerMode = WifiNative.getPowerModeCommand(); + if (powerMode < 0) { + // Handle the case where supplicant driver does not support + // getPowerModeCommand. + powerMode = DRIVER_POWER_MODE_AUTO; + } + if (powerMode != DRIVER_POWER_MODE_ACTIVE) { + WifiNative.setPowerModeCommand(DRIVER_POWER_MODE_ACTIVE); + } } synchronized (this) { // A new request is being made, so assume we will callback @@ -1798,7 +1808,9 @@ public class WifiStateTracker extends NetworkStateTracker { NetworkUtils.getDhcpError()); } synchronized (WifiStateTracker.this) { - WifiNative.setPowerModeCommand(DRIVER_POWER_MODE_AUTO); + if (powerMode != DRIVER_POWER_MODE_ACTIVE) { + WifiNative.setPowerModeCommand(powerMode); + } } if (modifiedBluetoothCoexistenceMode) { |