Change behavior of pkgmgr-server with DRM related operations 46/119746/2
authorJunghyun Yeon <jungh.yeon@samsung.com>
Mon, 20 Mar 2017 04:21:09 +0000 (13:21 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Mon, 20 Mar 2017 05:35:10 +0000 (14:35 +0900)
- 3 drm related operations which are allowed by pkgmgr-server currently
should be performed with same process.
- these operations should be invoked sequentially so pkgmgr-server will not
terminated until all operations has done.

Change-Id: I9b1008bbfa4d11db7586ec96ae4124533e945788
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
src/pkgmgr-server.c

index a8be0f2..ab5a033 100644 (file)
@@ -82,6 +82,7 @@ is dynamically determined.
 */
 static char backend_busy = 0;
 extern int num_of_backends;
+bool is_drm_busy = false;
 
 static GIOChannel *sio;
 static guint swid;
@@ -294,7 +295,7 @@ gboolean exit_server(void *data)
 {
        DBG("exit_server Start");
        if (__check_backend_status_for_exit() &&
-                       __check_queue_status_for_exit()) {
+                       __check_queue_status_for_exit() && !is_drm_busy) {
                g_main_loop_quit(mainloop);
                return FALSE;
        }
@@ -1313,13 +1314,14 @@ static int __process_generate_license_request(struct backend_job *job)
                ERR("drm_tizen_generate_license_request failed: %d", ret);
                _return_value_to_caller(job->req_id, g_variant_new("(iss)",
                                        PKGMGR_R_ESYSTEM, "", ""));
+               is_drm_busy = false;
                return -1;
        }
 
        _return_value_to_caller(job->req_id,
                        g_variant_new("(iss)", PKGMGR_R_OK, req_data,
                                license_url));
-
+       is_drm_busy = true;
        return 0;
 }
 
@@ -1335,6 +1337,7 @@ static int __process_register_license(struct backend_job *job)
                ERR("drm_tizen_register_license failed: %d", ret);
                _return_value_to_caller(job->req_id,
                                g_variant_new("(i)", PKGMGR_R_ESYSTEM));
+               is_drm_busy = false;
                return -1;
        }
 
@@ -1360,11 +1363,13 @@ static int __process_decrypt_package(struct backend_job *job)
                ERR("drm_tizen_register_license failed: %d", ret);
                _return_value_to_caller(job->req_id,
                                g_variant_new("(i)", PKGMGR_R_ESYSTEM));
+               is_drm_busy = false;
                return -1;
        }
 
        _return_value_to_caller(job->req_id,
                        g_variant_new("(i)", PKGMGR_R_OK));
+       is_drm_busy = false;
 
        return 0;
 }