From b19fe20075c98b4be07f8cfd91c5af7193ae5ba9 Mon Sep 17 00:00:00 2001 From: Gabriele M Date: Mon, 6 Mar 2017 23:59:46 +0100 Subject: [PATCH] PerformanceManager: Don't force powersave mode with powersave profile Allow to use the powersave profile without enabling the powersave mode, but force the powersave profile when enabling the powersave mode. This makes the profile a bit more useful since unlike the the powersave mode it has no direct UX impact (e.g. animations), yet it allows to reduce the power consumption. Change-Id: Ie9312a51d58950b15cf54fb1cd0c2e1d7bcd36b6 --- .../internal/PerformanceManagerService.java | 21 +++++-------------- cm/res/res/values/strings.xml | 2 +- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/cm/lib/main/java/org/cyanogenmod/platform/internal/PerformanceManagerService.java b/cm/lib/main/java/org/cyanogenmod/platform/internal/PerformanceManagerService.java index 767f15cb..f3b1cb6f 100644 --- a/cm/lib/main/java/org/cyanogenmod/platform/internal/PerformanceManagerService.java +++ b/cm/lib/main/java/org/cyanogenmod/platform/internal/PerformanceManagerService.java @@ -287,22 +287,11 @@ public class PerformanceManagerService extends CMSystemService { boolean isProfileSame = profile == mActiveProfile; - if (!isProfileSame) { - if (profile == PROFILE_POWER_SAVE) { - // Handle the case where toggle power saver mode failed - long token = Binder.clearCallingIdentity(); - try { - if (!mPm.setPowerSaveMode(true)) { - return false; - } - } finally { - Binder.restoreCallingIdentity(token); - } - } else if (mActiveProfile == PROFILE_POWER_SAVE) { - long token = Binder.clearCallingIdentity(); - mPm.setPowerSaveMode(false); - Binder.restoreCallingIdentity(token); - } + if (!isProfileSame && profile != PROFILE_POWER_SAVE && + mActiveProfile == PROFILE_POWER_SAVE) { + long token = Binder.clearCallingIdentity(); + mPm.setPowerSaveMode(false); + Binder.restoreCallingIdentity(token); } /** diff --git a/cm/res/res/values/strings.xml b/cm/res/res/values/strings.xml index 47fc6ecc..d4a6f7d3 100644 --- a/cm/res/res/values/strings.xml +++ b/cm/res/res/values/strings.xml @@ -109,7 +109,7 @@ Quick - Maximum power savings. Reduces device performance, disables background tasks and data, disables animations, and reduces display frame rate + Maximum power savings, reduces device performance Balance of optimal performance and power characteristics High performance mode. Useful for applications requiring low latency and highest throughput when power consumption is not a concern Favor power savings. Limit maximum CPU power and optimize for power saving at the cost of higher latency