Power: handle launch hint end sent from framework

We handle launch hint end sent from framework on marlin as well.
On wahoo, it is disabled due to launch hint end sent earlier than camera
fully launch.

With more camera related hints linked to PowerHAL, we can do additional
boost for camera launch.

12-07 17:52:27.739   765   765 D QCOM PowerHAL: AUDIO STREAMING ON
// LAUCH ON from framework, boost
12-07 17:52:27.739   765   765 D QCOM PowerHAL: LAUNCH HINT: ON
12-07 17:52:27.741   765   765 D QCOM PowerHAL: Activity launch hint handled
12-07 17:52:27.775   765   765 D QCOM PowerHAL: AUDIO STREAMING OFF
// Do additional 2.5s boost for camera
12-07 17:52:27.784   765   765 D QCOM PowerHAL: CAMERA LAUNCH ON: 1000 MS
12-07 17:52:27.828   765   765 D QCOM PowerHAL: CAMERA STREAMING ON: 1000 MS
12-07 17:52:27.843   765   765 D QCOM PowerHAL: CAMERA STREAMING OFF
// LAUCH ON from framework, deboost
12-07 17:52:27.852   765   765 D QCOM PowerHAL: LAUNCH HINT: OFF
12-07 17:52:27.857   765   765 D QCOM PowerHAL: CAMERA STREAMING ON: 1000 MS
12-07 17:52:28.016   765   765 D QCOM PowerHAL: CAMERA STREAMING OFF
// Additional 2.5s boost for camera still remains
12-07 17:52:28.017   765   765 D QCOM PowerHAL: CAMERA LAUNCH OFF
12-07 17:52:28.017   765   765 D QCOM PowerHAL: Video Encode hint start

Test: monitor cpufreq with camera
Bug: 65034076
Change-Id: I06d6fa18c763f40f1a9d2f77b398c372957bbcd4
diff --git a/power/power-8998.c b/power/power-8998.c
index 869f23b..3c68a27 100644
--- a/power/power-8998.c
+++ b/power/power-8998.c
@@ -200,13 +200,7 @@
 
 static int process_video_encode_hint(void *data)
 {
-    static int boost_handle = -1;
-
     if (data) {
-        // TODO: remove the launch boost based on camera launch time
-        int duration = 2000; // boosts 2s for starting encoding
-        boost_handle = process_boost(BOOST_HINT_ID, boost_handle, duration);
-        ALOGD("LAUNCH ENCODER-ON: %d MS", duration);
         int *resource_values = NULL;
         int resources = 0;
         resource_values = getPowerhint(DEFAULT_VIDEO_ENCODE_HINT_ID, &resources);
@@ -225,10 +219,13 @@
 int process_camera_launch_hint(int32_t duration)
 {
     static int cam_launch_handle = -1;
+    static int boost_handle = -1;
 
     if (duration > 0) {
         cam_launch_handle = process_boost(CAMERA_LAUNCH_HINT_ID, cam_launch_handle, duration);
         ALOGD("CAMERA LAUNCH ON: %d MS", duration);
+        // boosts 2.5s for launching
+        boost_handle = process_boost(BOOST_HINT_ID, boost_handle, 2500);
         return HINT_HANDLED;
     } else if (duration == 0) {
         release_request(cam_launch_handle);
@@ -313,8 +310,8 @@
 
 static int process_activity_launch_hint(void *data)
 {
-    // boost will timeout in 1.25s
-    int duration = 1250;
+    // boost will timeout in 5s
+    int duration = 5000;
     ATRACE_BEGIN("launch");
     if (sustained_performance_mode || vr_mode) {
         ATRACE_END();
@@ -337,9 +334,7 @@
             return HINT_NONE;
         }
     } else if (data == NULL  && launch_mode == 1) {
-        // framework release hints aren't necessarily reliable
-        // always wait the full duration
-        // release_request(launch_handle);
+        release_request(launch_handle);
         ATRACE_INT("launch_lock", 0);
         launch_mode = 0;
         ATRACE_END();