Update internal state when cancel is called in ready state 74/139174/2
authorWonnam Jang <wn.jang@samsung.com>
Mon, 17 Jul 2017 02:06:55 +0000 (11:06 +0900)
committerWonnam Jang <wn.jang@samsung.com>
Mon, 24 Jul 2017 05:55:11 +0000 (14:55 +0900)
Change-Id: I7f2816b1d931d6e31bd32759fa763670e6493530
Signed-off-by: Wonnam Jang <wn.jang@samsung.com>
client/vc_mgr.c
server/vcd_server.c

index 62c4333a86992262cd0467de03507c5de57b4f88..fa15f7d76a3204a285a84fd396bf80a918765b1b 100644 (file)
@@ -2511,12 +2511,6 @@ int __vc_mgr_cb_service_state(int state)
        vc_service_state_e before_state;
        vc_mgr_client_get_service_state(g_vc_m, &before_state);
 
-       if (current_state == before_state) {
-               SLOG(LOG_WARN, TAG_VCM, "Service State NOT changed : Before(%d) Current(%d)",
-                       before_state, current_state);
-               return 0;
-       }
-
        SLOG(LOG_DEBUG, TAG_VCM, "Service State changed : Before(%d) Current(%d)",
                before_state, current_state);
 
@@ -2529,6 +2523,12 @@ int __vc_mgr_cb_service_state(int state)
                        vc_mgr_client_set_internal_state(g_vc_m, VC_INTERNAL_STATE_NONE);
        }
 
+       if (current_state == before_state) {
+               SLOG(LOG_WARN, TAG_VCM, "Service State NOT changed : Before(%d) Current(%d)",
+                       before_state, current_state);
+               return 0;
+       }
+
        /* Save service state */
        vc_mgr_client_set_service_state(g_vc_m, current_state);
 
index 0b1ae7349e4987399be8a14f4d5c281cec300295..a2aa15027e3b66122324f330c5723f67e49b5cdb 100644 (file)
@@ -558,6 +558,10 @@ static void __vcd_server_result_cb(vcp_result_event_e event, int* result_id, int
        /* system > exclusive > foreground = widget > system_background > background */
        int i = 0;
        int* filtered_id = (int*)calloc(count, sizeof(int));
+       if (!filtered_id) {
+               SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to allocate memory");
+               return;
+       }
        int filtered_count = 0;
        int top_priority = VC_COMMAND_PRIORITY_BACKGROUND;
        for (i = 0; i < count; i++) {
@@ -1655,6 +1659,7 @@ int vcd_server_mgr_cancel()
        if (VCD_STATE_READY == state) {
                SLOG(LOG_DEBUG, TAG_VCD, "[Server] Current state is READY");
                vcd_recorder_stop();
+               vcdc_send_service_state(VCD_STATE_READY);
                return VCD_ERROR_NONE;
        }