power: Align to AOSP API
authorChristopher N. Hesse <raymanfx@gmail.com>
Wed, 5 Apr 2017 16:52:48 +0000 (18:52 +0200)
committerChristopher N. Hesse <raymanfx@gmail.com>
Wed, 5 Apr 2017 16:58:09 +0000 (18:58 +0200)
AOSP power hints can have a NULL data parameter,
only our custom hints are guaranteed to provide data.

Change-Id: Ibea874e75a7092b3f9c1c56dc5182cdf73f35532

power/power.c

index 5489400ad9068fd563995a103abdc3818f4c9024..e46a53eb2ca1aa3821ca4e7580ad5674e697d24b 100644 (file)
@@ -439,11 +439,14 @@ static void samsung_power_hint(struct power_module *module,
             break;
         case POWER_HINT_LOW_POWER:
             ALOGV("%s: POWER_HINT_LOW_POWER", __func__);
-            set_power_profile(samsung_pwr, PROFILE_POWER_SAVE);
+            set_power_profile(samsung_pwr, data ? PROFILE_POWER_SAVE : PROFILE_BALANCED);
             break;
         case POWER_HINT_LAUNCH:
+            ALOGV("%s: POWER_HINT_LAUNCH", __func__);
+            send_boostpulse(samsung_pwr->boostpulse_fd);
+            break;
         case POWER_HINT_CPU_BOOST:
-            ALOGV("%s: POWER_HINT_LAUNCH | POWER_HINT_CPU_BOOST", __func__);
+            ALOGV("%s: POWER_HINT_CPU_BOOST", __func__);
             boost((*(int32_t *)data));
             break;
         case POWER_HINT_SET_PROFILE:
@@ -453,11 +456,7 @@ static void samsung_power_hint(struct power_module *module,
             break;
         case POWER_HINT_DISABLE_TOUCH:
             ALOGV("%s: POWER_HINT_DISABLE_TOUCH", __func__);
-            if (data) {
-                sysfs_write(samsung_pwr->touchscreen_power_path, "0");
-            } else {
-                sysfs_write(samsung_pwr->touchscreen_power_path, "1");
-            }
+            sysfs_write(samsung_pwr->touchscreen_power_path, data ? "0" : "1");
             break;
         default:
             ALOGW("%s: Unknown power hint: %d", __func__, hint);