From b4478c115f31ebe17d45ec56505d3493a0d515b8 Mon Sep 17 00:00:00 2001 From: jongmyeongko Date: Wed, 3 Feb 2016 21:33:05 +0900 Subject: [PATCH] add 'preload' as long option this option represents current request is for preload app. Change-Id: Icdbb43bff3e716bea082bea6b51103276d774559 Signed-off-by: jongmyeongko --- comm/pkgmgr_installer.c | 11 +++++++++++ comm/pkgmgr_installer.h | 35 +++++++++++++++++++++++++++++++++++ comm/pkgmgr_installer_config.h | 3 +++ 3 files changed, 49 insertions(+) diff --git a/comm/pkgmgr_installer.c b/comm/pkgmgr_installer.c index a71cce9..d4ab319 100644 --- a/comm/pkgmgr_installer.c +++ b/comm/pkgmgr_installer.c @@ -60,6 +60,7 @@ struct pkgmgr_installer { char *tep_path; int tep_move; int is_tep_included; + int is_preload; GDBusConnection *conn; }; @@ -244,6 +245,10 @@ pkgmgr_installer_receive_request(pkgmgr_installer *pi, if (-1 == c) break; /* Parse is end */ switch (c) { + case OPTVAL_PRELOAD: /* request for preload app */ + pi->is_preload = 1; + DBG("option is 1000 is_preload[%d]", pi->is_preload ); + break; case 'k': /* session id */ if (pi->session_id) free(pi->session_id); @@ -457,6 +462,12 @@ API const char *pkgmgr_installer_get_caller_pkgid(pkgmgr_installer *pi) return pi->caller_pkgid; } +API int pkgmgr_installer_get_is_preload(pkgmgr_installer *pi) +{ + CHK_PI_RET(PKGMGR_REQ_INVALID); + return pi->is_preload; +} + API int pkgmgr_installer_send_app_uninstall_signal(pkgmgr_installer *pi, const char *pkg_type, const char *pkgid, diff --git a/comm/pkgmgr_installer.h b/comm/pkgmgr_installer.h index db76868..15b9514 100644 --- a/comm/pkgmgr_installer.h +++ b/comm/pkgmgr_installer.h @@ -545,6 +545,41 @@ int main(int argc, char **argv) const char *pkgmgr_installer_get_caller_pkgid(pkgmgr_installer *pi); /** + @brief Get if the request is for preload app or not + @pre pkgmgr_installer_receive_request() must be called. + @post None + @see pkgmgr_installer_receive_request + @param[in] pi pkgmgr_installer object + @return Operation result + @retval 0 if a request is not for preload + @retval 1 if a request is for preload + @remark None + @code +#include +int main(int argc, char **argv) +{ + pkgmgr_installer *pi; + int r = 0; + int is_preload = 0; + + pi = pkgmgr_installer_new(); + if(!pi) return -1; + if(pkgmgr_installer_receive_request(pi, argc, argv)) { + r = -1; + goto CLEANUP_RET; + } + preload = pkgmgr_installer_get_is_preload(pi); + + // Do something... + + pkgmgr_installer_free(pi); + return r; +} + @endcode + */ +int pkgmgr_installer_get_is_preload(pkgmgr_installer *pi); + +/** @brief Send a process status signal @pre None @post None diff --git a/comm/pkgmgr_installer_config.h b/comm/pkgmgr_installer_config.h index 8d61a30..a284ab6 100644 --- a/comm/pkgmgr_installer_config.h +++ b/comm/pkgmgr_installer_config.h @@ -31,6 +31,8 @@ extern "C" { #endif +#define OPTVAL_PRELOAD 1000 + /* Supported options */ const char *short_opts = "k:l:i:d:c:m:t:o:r:p:s:b:e:M:y:q"; const struct option long_opts[] = { @@ -49,6 +51,7 @@ const struct option long_opts[] = { { "smack", 1, NULL, 's' }, { "direct-manifest-install", 1, NULL, 'y' }, { "recovery", 1, NULL, 'b' }, + { "preload", 0, NULL, OPTVAL_PRELOAD }, { 0, 0, 0, 0 } /* sentinel */ }; -- 2.7.4