power: Discard hints in power save mode
authorChristopher N. Hesse <raymanfx@gmail.com>
Sun, 12 Mar 2017 16:04:53 +0000 (17:04 +0100)
committerChristopher N. Hesse <raymanfx@gmail.com>
Tue, 14 Mar 2017 08:05:31 +0000 (08:05 +0000)
Change-Id: I9c3701261e49023761599ebaa8cd3e09a88a40c6

power/power.c

index 12b3440b3955f283c317f83b479eb703f982f1ce..dd32945043fd5562fd7f0f2f41d7bea4b30f3e38 100644 (file)
@@ -408,12 +408,14 @@ static void samsung_power_hint(struct power_module *module,
     char errno_str[64];
     int len;
 
+    /* Bail out if low-power mode is active */
+    if (current_power_profile == PROFILE_POWER_SAVE && hint != POWER_HINT_SET_PROFILE) {
+        ALOGW("%s: PROFILE_POWER_SAVE active, ignoring hint %d", __func__, hint);
+        return;
+    }
+
     switch (hint) {
         case POWER_HINT_INTERACTION: {
-            if (current_power_profile == PROFILE_POWER_SAVE) {
-                return;
-            }
-
             ALOGV("%s: POWER_HINT_INTERACTION", __func__);
             send_boostpulse(samsung_pwr->boostpulse_fd);
             break;