Merge "Power: handle launch hint end sent from framework"

This commit is contained in:
TreeHugger Robot
2017-12-07 22:47:27 +00:00
committed by Android (Google) Code Review

View File

@@ -200,13 +200,7 @@ static int process_boost(int hint_id, int boost_handle, int duration)
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 @@ static int process_video_encode_hint(void *data)
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 @@ int process_audio_low_latency_hint(int32_t data)
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 @@ static int process_activity_launch_hint(void *data)
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();