PM_GET_MAX
} pkgmgr_getsize_type;
+typedef enum {
+ PM_RESTRICTION_MODE_ALL = 0x0F,
+ PM_RESTRICTION_MODE_INSTALL = 0x01,
+ PM_RESTRICTION_MODE_UNINSTALL = 0x02,
+ PM_RESTRICTION_MODE_REINSTALL = 0x04,
+ PM_RESTRICTION_MODE_MOVE = 0x08,
+} pkgmgr_restriction_mode;
+
/**
* @brief This API creates pkgmgr client.
*
int pkgmgr_client_disable_splash_screen(pkgmgr_client *pc, const char *appid);
int pkgmgr_client_usr_disable_splash_screen(pkgmgr_client *pc, const char *appid, uid_t uid);
+/**
+ * @brief Set restriction mode
+ *
+ * This API set restriction mode bit.\n
+ *
+ * @param[in] pc The pointer to pkgmgr_client instance
+ * @param[in] mode restriction mode bit
+ * @return 0 if success, error code(<0) if fail\n
+ * @retval PKGMGR_R_OK success
+ * @retval PKGMGR_R_EINVAL invalid argument
+ * @retval PKGMGR_R_ECOMM communication error
+ * @retval PKGMGR_R_EPRIV privilege denied
+ * @see pkgmgr_restriction_mode
+ */
+int pkgmgr_client_set_restriction_mode(pkgmgr_client *pc, int mode);
+int pkgmgr_client_usr_set_restriction_mode(pkgmgr_client *pc, int mode, uid_t uid);
+
+/**
+ * @brief Unset restriction mode
+ *
+ * This API unset restriction mode bit.\n
+ *
+ * @param[in] pc The pointer to pkgmgr_client instance
+ * @param[in] mode restriction mode bit
+ * @return 0 if success, error code(<0) if fail\n
+ * @retval PKGMGR_R_OK success
+ * @retval PKGMGR_R_EINVAL invalid argument
+ * @retval PKGMGR_R_ECOMM communication error
+ * @retval PKGMGR_R_EPRIV privilege denied
+ * @see pkgmgr_restriction_mode
+ */
+int pkgmgr_client_unset_restriction_mode(pkgmgr_client *pc, int mode);
+int pkgmgr_client_usr_unset_restriction_mode(pkgmgr_client *pc, int mode, uid_t uid);
+
+/**
+ * @brief Get restriction mode
+ *
+ * This API gets restriction mode bit.\n
+ *
+ * @param[in] pc The pointer to pkgmgr_client instance
+ * @param[out] mode restriction mode bit
+ * @return 0 if success, error code(<0) if fail\n
+ * @retval PKGMGR_R_OK success
+ * @retval PKGMGR_R_EINVAL invalid argument
+ * @retval PKGMGR_R_ECOMM communication error
+ * @retval PKGMGR_R_EPRIV privilege denied
+ * @see pkgmgr_restriction_mode
+ */
+int pkgmgr_client_get_restriction_mode(pkgmgr_client *pc, int *mode);
+int pkgmgr_client_usr_get_restriction_mode(pkgmgr_client *pc, int *mode, uid_t uid);
+
/** @} */
return ret;
}
+API int pkgmgr_client_usr_set_restriction_mode(pkgmgr_client *pc, int mode,
+ uid_t uid)
+{
+ GVariant *result;
+ int ret = PKGMGR_R_ECOMM;
+ pkgmgr_client_t *mpc = (pkgmgr_client_t *)pc;
+
+ if (pc == NULL) {
+ ERR("invalid parameter");
+ return PKGMGR_R_EINVAL;
+ }
+
+ ret = comm_client_request(mpc->info.request.cc, "set_restriction_mode",
+ g_variant_new("(ui)", uid, mode), &result);
+ if (ret != PKGMGR_R_OK) {
+ ERR("request failed: %d", ret);
+ return ret;
+ }
+
+ g_variant_get(result, "(i)", &ret);
+ g_variant_unref(result);
+
+ return ret;
+}
+
+API int pkgmgr_client_set_restriction_mode(pkgmgr_client *pc, int mode)
+{
+ return pkgmgr_client_usr_set_restriction_mode(pc, mode, _getuid());
+}
+
+API int pkgmgr_client_usr_unset_restriction_mode(pkgmgr_client *pc, int mode,
+ uid_t uid)
+{
+ GVariant *result;
+ int ret = PKGMGR_R_ECOMM;
+ pkgmgr_client_t *mpc = (pkgmgr_client_t *)pc;
+
+ if (pc == NULL) {
+ ERR("invalid parameter");
+ return PKGMGR_R_EINVAL;
+ }
+
+ ret = comm_client_request(mpc->info.request.cc,
+ "unset_restriction_mode",
+ g_variant_new("(ui)", uid, mode), &result);
+ if (ret != PKGMGR_R_OK) {
+ ERR("request failed: %d", ret);
+ return ret;
+ }
+
+ g_variant_get(result, "(i)", &ret);
+ g_variant_unref(result);
+
+ return ret;
+}
+
+API int pkgmgr_client_unset_restriction_mode(pkgmgr_client *pc, int mode)
+{
+ return pkgmgr_client_usr_unset_restriction_mode(pc, mode, _getuid());
+}
+
+API int pkgmgr_client_usr_get_restriction_mode(pkgmgr_client *pc,
+ int *mode, uid_t uid)
+{
+ GVariant *result;
+ int ret = PKGMGR_R_ECOMM;
+ gint m;
+ pkgmgr_client_t *mpc = (pkgmgr_client_t *)pc;
+
+ if (pc == NULL) {
+ ERR("invalid parameter");
+ return PKGMGR_R_EINVAL;
+ }
+
+ ret = comm_client_request(mpc->info.request.cc,
+ "get_restriction_mode",
+ g_variant_new("(u)", uid), &result);
+ if (ret != PKGMGR_R_OK) {
+ ERR("request failed: %d", ret);
+ return ret;
+ }
+
+ g_variant_get(result, "(ii)", &m, &ret);
+ g_variant_unref(result);
+ if (ret != PKGMGR_R_OK)
+ return ret;
+
+ *mode = m;
+
+ return PKGMGR_R_OK;
+}
+
+API int pkgmgr_client_get_restriction_mode(pkgmgr_client *pc,
+ int *mode)
+{
+ return pkgmgr_client_usr_get_restriction_mode(pc, mode, _getuid());
+}