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
This commit is contained in:
Gabriele M
2017-03-06 23:59:46 +01:00
committed by Michael Bestas
parent 54996d44cd
commit b19fe20075
2 changed files with 6 additions and 17 deletions

View File

@@ -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);
}
/**

View File

@@ -109,7 +109,7 @@
<string name="perf_profile_bias_perf">Quick</string>
<!-- Performance profiles -->
<string name="perf_profile_pwrsv_summary">Maximum power savings. Reduces device performance, disables background tasks and data, disables animations, and reduces display frame rate</string>
<string name="perf_profile_pwrsv_summary">Maximum power savings, reduces device performance</string>
<string name="perf_profile_bal_summary">Balance of optimal performance and power characteristics</string>
<string name="perf_profile_perf_summary">High performance mode. Useful for applications requiring low latency and highest throughput when power consumption is not a concern</string>
<string name="perf_profile_bias_power_summary">Favor power savings. Limit maximum CPU power and optimize for power saving at the cost of higher latency</string>