From 4eedcaf5c1f320ac1db80cb827b5a7278be3f7bb Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 13 Apr 2020 17:02:04 +0900 Subject: [PATCH] Fix Frame Broker - Fixes log level - Fixes wrong implementation Change-Id: I20a32f830c65668718fe70ee3508937aa6091311 Signed-off-by: Hwankyu Jhun --- frame-broker/src/frame_broker.c | 11 +++-- frame-broker/src/frame_context.c | 55 +++++++++++++++++------- frame-broker/src/frame_context_private.h | 4 ++ 3 files changed, 52 insertions(+), 18 deletions(-) diff --git a/frame-broker/src/frame_broker.c b/frame-broker/src/frame_broker.c index 40f9bdce..2920d2a9 100644 --- a/frame-broker/src/frame_broker.c +++ b/frame-broker/src/frame_broker.c @@ -138,6 +138,8 @@ static void __aul_launcher_service_cb(const char *app_id, } __check_pre_context(broker); + frame_context_set_inst_id(broker->context, inst_id); + frame_context_set_pid(broker->context, pid); frame_context_get_pid(broker->context, &ctx_pid); frame_context_get_serial(broker->context, &ctx_serial); @@ -439,7 +441,7 @@ static int __send_request(struct request_s *req) &serial); } - if (inst_id && pid > 0) { + if (ret == FRAME_BROKER_ERROR_NONE) { frame_context_destroy(broker->pre_context); broker->pre_context = NULL; @@ -575,7 +577,7 @@ int frame_broker_launch(frame_broker_h handle, const char *app_id, ret = screen_connector_launcher_service_launch(handle->scls, app_id, inst_id ? inst_id : "", pid, *serial); if (ret != 0) { - _E("Failed to launch scls evas. error(%d)", ret); + _E("Failed to launch scls. error(%d)", ret); return FRAME_BROKER_ERROR_IO_ERROR; } @@ -598,7 +600,7 @@ int frame_broker_launch_with_shared_widget(frame_broker_h handle, handle->scls, app_id, inst_id ? inst_id : "", pid, *serial); if (ret != 0) { - _E("Failed to launch scls evas with shared widget. error(%d)", + _E("Failed to launch scls with shared widget. error(%d)", ret); return FRAME_BROKER_ERROR_IO_ERROR; } @@ -615,6 +617,7 @@ int frame_broker_launching(frame_broker_h handle, uint32_t serial) return FRAME_BROKER_ERROR_INVALID_PARAMETER; } + _W("serial(%u)", serial); ret = screen_connector_launcher_service_launching( handle->scls, serial); if (ret != 0) { @@ -634,6 +637,7 @@ int frame_broker_launch_cancel(frame_broker_h handle, uint32_t serial) return FRAME_BROKER_ERROR_INVALID_PARAMETER; } + _W("serial(%u)", serial); ret = screen_connector_launcher_service_launch_cancel( handle->scls, serial); if (ret != 0) { @@ -653,6 +657,7 @@ int frame_broker_launch_done(frame_broker_h handle, uint32_t serial) return FRAME_BROKER_ERROR_INVALID_PARAMETER; } + _W("serial(%u)", serial); ret = screen_connector_launcher_service_launch_done( handle->scls, serial); if (ret != 0) { diff --git a/frame-broker/src/frame_context.c b/frame-broker/src/frame_context.c index 62e33036..961ccde6 100644 --- a/frame-broker/src/frame_context.c +++ b/frame-broker/src/frame_context.c @@ -55,7 +55,7 @@ int frame_context_create(frame_broker_h broker, { struct frame_context_s *context; - if (!broker || !app_id || !inst_id || pid < 1 || !callback || !handle) { + if (!broker || !app_id || !callback || !handle) { _E("Invalid parameter"); return FRAME_BROKER_ERROR_INVALID_PARAMETER; } @@ -73,7 +73,7 @@ int frame_context_create(frame_broker_h broker, return FRAME_BROKER_ERROR_OUT_OF_MEMORY; } - context->inst_id = strdup(inst_id); + context->inst_id = strdup(inst_id ? inst_id : "Unknown"); if (!context->inst_id) { _E("Failed to duplicate instance ID"); frame_context_destroy(context); @@ -95,7 +95,7 @@ int frame_context_create(frame_broker_h broker, int frame_context_destroy(frame_context_h handle) { if (!handle) { - _E("Invalid parameter"); + _W("Invalid parameter"); return FRAME_BROKER_ERROR_INVALID_PARAMETER; } @@ -213,10 +213,35 @@ API int frame_context_finish_animation(frame_context_h handle) return FRAME_BROKER_ERROR_NONE; } +int frame_context_set_inst_id(frame_context_h handle, const char *inst_id) +{ + if (!handle || !inst_id) { + _W("Invalid parameter"); + return FRAME_BROKER_ERROR_INVALID_PARAMETER; + } + + free(handle->inst_id); + handle->inst_id = strdup(inst_id); + + return FRAME_BROKER_ERROR_NONE; +} + +int frame_context_set_pid(frame_context_h handle, int pid) +{ + if (!handle || pid < 0) { + _W("Invalid parameter"); + return FRAME_BROKER_ERROR_INVALID_PARAMETER; + } + + handle->pid = pid; + + return FRAME_BROKER_ERROR_NONE; +} + int frame_context_get_pid(frame_context_h handle, int *pid) { if (!handle || !pid) { - _E("Invalid parameter"); + _W("Invalid parameter"); return FRAME_BROKER_ERROR_INVALID_PARAMETER; } @@ -228,7 +253,7 @@ int frame_context_get_pid(frame_context_h handle, int *pid) int frame_context_set_serial(frame_context_h handle, uint32_t serial) { if (!handle) { - _E("Invalid parameter"); + _W("Invalid parameter"); return FRAME_BROKER_ERROR_INVALID_PARAMETER; } @@ -241,7 +266,7 @@ int frame_context_set_serial(frame_context_h handle, uint32_t serial) int frame_context_get_serial(frame_context_h handle, uint32_t *serial) { if (!handle || !serial) { - _E("Invalid parameter"); + _W("Invalid parameter"); return FRAME_BROKER_ERROR_INVALID_PARAMETER; } @@ -253,7 +278,7 @@ int frame_context_get_serial(frame_context_h handle, uint32_t *serial) int frame_context_set_frame(frame_context_h handle, frame_h frame) { if (!handle) { - _E("Invalid parameter"); + _W("Invalid parameter"); return FRAME_BROKER_ERROR_INVALID_PARAMETER; } @@ -268,7 +293,7 @@ int frame_context_set_frame(frame_context_h handle, frame_h frame) int frame_context_get_frame(frame_context_h handle, frame_h *frame) { if (!handle || !frame) { - _E("Invalid parameter"); + _W("Invalid parameter"); return FRAME_BROKER_ERROR_INVALID_PARAMETER; } @@ -281,7 +306,7 @@ int frame_context_set_state(frame_context_h handle, frame_context_state_e state) { if (!handle) { - _E("Invalid parameter"); + _W("Invalid parameter"); return FRAME_BROKER_ERROR_INVALID_PARAMETER; } @@ -294,7 +319,7 @@ int frame_context_get_state(frame_context_h handle, frame_context_state_e *state) { if (!handle || !state) { - _E("Invalid parameter"); + _W("Invalid parameter"); return FRAME_BROKER_ERROR_INVALID_PARAMETER; } @@ -306,7 +331,7 @@ int frame_context_get_state(frame_context_h handle, void frame_context_on_create(frame_context_h handle) { if (!handle) { - _E("Invalid parameter"); + _W("Invalid parameter"); return; } @@ -321,7 +346,7 @@ void frame_context_on_create(frame_context_h handle) void frame_context_on_resume(frame_context_h handle, frame_h frame) { if (!handle) { - _E("Invalid parameter"); + _W("Invalid parameter"); return; } @@ -345,7 +370,7 @@ void frame_context_on_resume(frame_context_h handle, frame_h frame) void frame_context_on_pause(frame_context_h handle) { if (!handle) { - _E("Invalid parameter"); + _W("Invalid parameter"); return; } @@ -360,7 +385,7 @@ void frame_context_on_pause(frame_context_h handle) void frame_context_on_destroy(frame_context_h handle) { if (!handle) { - _E("Invalid parameter"); + _W("Invalid parameter"); return; } @@ -375,7 +400,7 @@ void frame_context_on_destroy(frame_context_h handle) void frame_context_on_error(frame_context_h handle, frame_context_error_e error) { if (!handle) { - _E("Invalid parameter"); + _W("Invalid parameter"); return; } diff --git a/frame-broker/src/frame_context_private.h b/frame-broker/src/frame_context_private.h index 66c964e9..912fa50b 100644 --- a/frame-broker/src/frame_context_private.h +++ b/frame-broker/src/frame_context_private.h @@ -41,6 +41,10 @@ int frame_context_create(frame_broker_h broker, int frame_context_destroy(frame_context_h handle); +int frame_context_set_inst_id(frame_context_h handle, const char *inst_id); + +int frame_context_set_pid(frame_context_h handle, int pid); + int frame_context_get_pid(frame_context_h handle, int *pid); int frame_context_set_serial(frame_context_h handle, uint32_t serial); -- 2.34.1