summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorAhmed ElArabawy <arabawy@google.com>2019-03-21 12:04:31 -0700
committerAhmed ElArabawy <arabawy@google.com>2019-03-27 09:27:41 -0700
commitbc19244cb7823901e185e7d24efe163cff5a70be (patch)
treed4b286e23d7092c3fb2e8d7baa20c4e75478482f /service
parent80ce9b20ff0678e07fecd07b378e591a76d69bcd (diff)
Explicitly disable power save in low latency mode
This commit explicitly disables power save mode on low latency mode instead of relying on the lower layers to do that. Bug: 129299467 Test: atest com.android.server.wifi Change-Id: I21ca0a09cc155e90dbe71c243294e700b9743ca7
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiLockManager.java32
1 files changed, 22 insertions, 10 deletions
diff --git a/service/java/com/android/server/wifi/WifiLockManager.java b/service/java/com/android/server/wifi/WifiLockManager.java
index 73541824e..4db6b334c 100644
--- a/service/java/com/android/server/wifi/WifiLockManager.java
+++ b/service/java/com/android/server/wifi/WifiLockManager.java
@@ -650,20 +650,32 @@ public class WifiLockManager {
private boolean setLowLatencyMode(boolean enabled) {
int lowLatencySupport = getLowLatencyModeSupport();
+ if (lowLatencySupport == LOW_LATENCY_SUPPORT_UNDEFINED) {
+ // Support undefined, no action is taken
+ return false;
+ }
+
if (lowLatencySupport == LOW_LATENCY_SUPPORTED) {
- return mClientModeImpl.setLowLatencyMode(enabled);
- } else if (lowLatencySupport == LOW_LATENCY_NOT_SUPPORTED) {
- // Since low-latency mode is not supported, use power save instead
- // Note: low-latency mode enabled ==> power-save disabled
- if (mVerboseLoggingEnabled) {
- Slog.d(TAG, "low-latency is not supported, using power-save instead");
+ if (!mClientModeImpl.setLowLatencyMode(enabled)) {
+ Slog.e(TAG, "Failed to set low latency mode");
+ return false;
}
- return mClientModeImpl.setPowerSave(!enabled);
- } else {
- // Support undefined, no need to attempt either functions
- return false;
+ if (!mClientModeImpl.setPowerSave(!enabled)) {
+ Slog.e(TAG, "Failed to set power save mode");
+ // Revert the low latency mode
+ mClientModeImpl.setLowLatencyMode(!enabled);
+ return false;
+ }
+ } else if (lowLatencySupport == LOW_LATENCY_NOT_SUPPORTED) {
+ // Only set power save mode
+ if (!mClientModeImpl.setPowerSave(!enabled)) {
+ Slog.e(TAG, "Failed to set power save mode");
+ return false;
+ }
}
+
+ return true;
}
private synchronized WifiLock findLockByBinder(IBinder binder) {