power: Clean up and fix set_interactive_override
* Remove debug logs and useless comments
* Consistent return values
* Add back display hints for legacy platforms, they used to live in
power-common.c but removed in commit 561cffcbfa66192e839e040d2da3bff2ecf8dcac
* Check if set_interactive_override handled hints and print
info message if it didn't
Change-Id: Iff9f7327ba71c282e34ff3143c45a3f40f72fc92
diff --git a/power-8960.c b/power-8960.c
index 0c5809b..6c29b06 100644
--- a/power-8960.c
+++ b/power-8960.c
@@ -138,3 +138,27 @@
}
return ret_val;
}
+
+int set_interactive_override(int on) {
+ char governor[80];
+
+ if (get_scaling_governor(governor, sizeof(governor)) == -1) {
+ ALOGE("Can't obtain scaling governor.");
+ return HINT_NONE;
+ }
+
+ if (!on) {
+ /* Display off */
+ if (is_interactive_governor(governor)) {
+ int resource_values[] = {TR_MS_50, THREAD_MIGRATION_SYNC_OFF};
+ perform_hint_action(DISPLAY_STATE_HINT_ID, resource_values,
+ ARRAY_SIZE(resource_values));
+ }
+ } else {
+ /* Display on */
+ if (is_interactive_governor(governor)) {
+ undo_hint_action(DISPLAY_STATE_HINT_ID);
+ }
+ }
+ return HINT_HANDLED;
+}