--- /dev/null
+#include "../recovery/recovery-manager.h"
+#include "../update-manager.h"
+
+static int boot_status = -1;
+
+bool common_boot_status_checker_is_success()
+{
+ return (boot_status == VCONFKEY_SYSMAN_BOOTING_SUCCESS);
+}
+
+void common_boot_status_checker_callback(keynode_t *node, void *user_data)
+{
+ int ret = 0;
+
+ ret = vconf_keynode_get_type(node);
+ if (ret == VCONF_TYPE_INT) {
+ boot_status = vconf_keynode_get_int(node);
+ if (common_boot_status_checker_is_success()) {
+ _I("Success to get bootstatus : success");
+
+ ret = vconf_ignore_key_changed(VCONFKEY_SYSMAN_BOOTINGSTATUS, common_boot_status_checker_callback);
+ if (ret == VCONF_OK)
+ _I("Success to remove bootstatus callback");
+ else
+ _W("vconf_ignore_key_changed for %s failed : %d", VCONFKEY_SYSMAN_BOOTINGSTATUS, ret);
+
+ ret = fota_client_controller_process_launch_request();
+ if (ret < 0)
+ _E("Failed to process fota client : %d", ret);
+
+ ret = recovery_client_controller_process_launch_request();
+ if (ret < 0)
+ _E("Failed to process recovery client : %d", ret);
+ }
+ } else {
+ _E("Invalid vconf key type : %d", ret);
+ }
+}
+
+int common_boot_status_checker_init()
+{
+ int ret = 0;
+
+ _I("Start process to get boot status");
+ ret = vconf_get_int(VCONFKEY_SYSMAN_BOOTINGSTATUS, &boot_status);
+ if (ret != VCONF_OK) {
+ _E("vconf_get_int for %s failed: %d", VCONFKEY_SYSMAN_BOOTINGSTATUS, ret);
+ return -1;
+ }
+
+ if (common_boot_status_checker_is_success()) {
+ _I("Success to get boot status : success");
+ } else {
+ ret = vconf_notify_key_changed(VCONFKEY_SYSMAN_BOOTINGSTATUS, common_boot_status_checker_callback, NULL);
+ if (ret != VCONF_OK) {
+ _E("vconf_notify_key_changed for %s failed : %d", VCONFKEY_SYSMAN_BOOTINGSTATUS, ret);
+ return -1;
+ }
+ _I("Success to register boot status callback");
+ }
+
+ return 0;
+}
+
+int common_boot_status_checker_fini()
+{
+ int ret = 0;
+
+ if (!common_boot_status_checker_is_success()) {
+ ret = vconf_ignore_key_changed(VCONFKEY_SYSMAN_BOOTINGSTATUS, common_boot_status_checker_callback);
+ if (ret != VCONF_OK)
+ _W("vconf_ignore_key_changed for %s failed : %d", VCONFKEY_SYSMAN_BOOTINGSTATUS, ret);
+ }
+
+ return 0;
+}
#include "../update-manager.h"
-int common_client_info_checker_callback(pkgmgrinfo_appinfo_h handle, char **app_id)
+int common_client_info_checker_get_appid(pkgmgrinfo_appinfo_h handle, char **app_id)
{
int ret = 0, status = 0;
pkgmgrinfo_appinfo_h appinfo_h = NULL;
return status;
}
-int common_client_info_checker_init(const char* key, const char* value, pkgmgrinfo_app_list_cb cb)
+int common_client_info_checker_filter(const char* key, const char* value, pkgmgrinfo_app_list_cb cb)
{
int ret = 0, status = 0;
pkgmgrinfo_appinfo_metadata_filter_h filter_h = NULL;
+++ /dev/null
-#include "../recovery/recovery-manager.h"
-#include "../update-manager.h"
-
-static int boot_status = -1;
-
-bool common_client_status_checker_is_success()
-{
- return (boot_status == VCONFKEY_SYSMAN_BOOTING_SUCCESS);
-}
-
-void common_client_status_checker_callback(keynode_t *node, void *user_data)
-{
- int ret = 0;
-
- ret = vconf_keynode_get_type(node);
- if (ret == VCONF_TYPE_INT) {
- boot_status = vconf_keynode_get_int(node);
- if (common_client_status_checker_is_success()) {
- _I("Success to get bootstatus : success");
-
- ret = vconf_ignore_key_changed(VCONFKEY_SYSMAN_BOOTINGSTATUS, common_client_status_checker_callback);
- if (ret == VCONF_OK)
- _I("Success to remove bootstatus callback");
- else
- _W("vconf_ignore_key_changed for %s failed : %d", VCONFKEY_SYSMAN_BOOTINGSTATUS, ret);
-
- ret = fota_client_controller_process_launch_request();
- if (ret < 0)
- _E("Failed to process fota client : %d", ret);
-
- ret = recovery_client_controller_process_launch_request();
- if (ret < 0)
- _E("Failed to process recovery client : %d", ret);
- }
- } else {
- _E("Invalid vconf key type : %d", ret);
- }
-}
-
-int common_client_status_checker_init()
-{
- int ret = 0;
-
- _I("Start process to get boot status");
- ret = vconf_get_int(VCONFKEY_SYSMAN_BOOTINGSTATUS, &boot_status);
- if (ret != VCONF_OK) {
- _E("vconf_get_int for %s failed: %d", VCONFKEY_SYSMAN_BOOTINGSTATUS, ret);
- return -1;
- }
-
- if (common_client_status_checker_is_success()) {
- _I("Success to get boot status : success");
- } else {
- ret = vconf_notify_key_changed(VCONFKEY_SYSMAN_BOOTINGSTATUS, common_client_status_checker_callback, NULL);
- if (ret != VCONF_OK) {
- _E("vconf_notify_key_changed for %s failed : %d", VCONFKEY_SYSMAN_BOOTINGSTATUS, ret);
- return -1;
- }
- _I("Success to register boot status callback");
- }
-
- return 0;
-}
-
-int common_client_status_checker_fini()
-{
- int ret = 0;
-
- if (!common_client_status_checker_is_success()) {
- ret = vconf_ignore_key_changed(VCONFKEY_SYSMAN_BOOTINGSTATUS, common_client_status_checker_callback);
- if (ret != VCONF_OK)
- _W("vconf_ignore_key_changed for %s failed : %d", VCONFKEY_SYSMAN_BOOTINGSTATUS, ret);
- }
-
- return 0;
-}
return -1;
}
- if (!common_client_status_checker_is_success()) {
+ if (!common_boot_status_checker_is_success()) {
_I("Failed to launch client, user session is unset, current top : %d", fota_req_top);
return -1;
}
{
int ret = 0;
- ret = common_client_info_checker_callback(handle, &fota_client_app_id);
+ ret = common_client_info_checker_get_appid(handle, &fota_client_app_id);
if (ret < 0) {
- _E("Common client info checker callback failed at fota");
+ _E("Failed to get fota app id from handle : %d", ret);
return -1;
}
{
int ret = 0;
- ret = common_client_info_checker_init(FOTA_CLIENT_METADATA_KEY, FOTA_CLIENT_METADATA_VALUE, fota_client_info_checker_callback);
+ ret = common_client_info_checker_filter(FOTA_CLIENT_METADATA_KEY, FOTA_CLIENT_METADATA_VALUE, fota_client_info_checker_callback);
if (ret < 0) {
- _E("Common client info checker failed, key : %s, value : %s", FOTA_CLIENT_METADATA_KEY, FOTA_CLIENT_METADATA_VALUE);
+ _E("Failed to set fota client app filter : %d, key : %s, value : %s",
+ ret, FOTA_CLIENT_METADATA_KEY, FOTA_CLIENT_METADATA_VALUE);
return -1;
}
return -ENOMEM;
}
- /* Client */
- ret = fota_client_info_checker_init();
+ /* Common */
+ ret = common_storage_checker_init();
if (ret < 0) {
- _E("Failed to initialize fota client info checker : %d", ret);
+ _E("Failed to initialize common storage checker : %d", ret);
goto main_destroy;
}
- ret = common_client_status_checker_init();
+ ret = common_boot_status_checker_init();
if (ret < 0) {
- _E("Failed to initialize client status checker : %d", ret);
+ _E("Failed to initialize common boot status checker : %d", ret);
goto main_destroy;
}
- /* Common */
- ret = common_storage_checker_init();
+ /* Recovery */
+ ret = recovery_client_info_checker_init();
if (ret < 0) {
- _E("Failed to initialize common storage checker : %d", ret);
+ _E("Failed to initialize recovery client info checker : %d", ret);
goto main_destroy;
}
/* Fota */
+ ret = fota_client_info_checker_init();
+ if (ret < 0) {
+ _E("Failed to initialize fota client info checker : %d", ret);
+ goto main_destroy;
+ }
+
ret = fota_info_checker_init();
if (ret < 0) {
_E("Failed to initialize fota info checker : %d", ret);
g_main_loop_run(mainloop);
main_destroy:
- /* Client */
- ret = fota_client_info_checker_fini();
+ /* Common */
+ ret = common_storage_checker_fini();
if (ret < 0)
- _W("Failed to finalize fota client info checker : %d", ret);
+ _W("Failed to finalize common storage checker : %d", ret);
- ret = common_client_status_checker_fini();
+ ret = common_boot_status_checker_fini();
if (ret < 0)
- _W("Failed to finalize client status checker : %d", ret);
+ _W("Failed to finalize common boot status checker : %d", ret);
- /* Common */
- ret = common_storage_checker_fini();
+ /* Recovery */
+ ret = recovery_client_info_checker_fini();
if (ret < 0)
- _W("Failed to finalize common storage checker : %d", ret);
+ _W("Failed to finalize recovery client info checker : %d", ret);
/* Fota */
+ ret = fota_client_info_checker_fini();
+ if (ret < 0)
+ _W("Failed to finalize fota client info checker : %d", ret);
+
ret = fota_info_checker_fini();
if (ret < 0)
_W("Failed to finalize fota info checker : %d", ret);
return -1;
}
- if (!common_client_status_checker_is_success()) {
+ if (!common_boot_status_checker_is_success()) {
_RLOGI("Failed to launch client, user session is unset, current top : %d", recovery_req_top);
return -1;
}
{
int ret = 0;
- ret = common_client_info_checker_callback(handle, &recovery_client_app_id);
+ ret = common_client_info_checker_get_appid(handle, &recovery_client_app_id);
if (ret < 0) {
- _E("Common client info checker callback failed at recovery");
+ _RLOGE("Failed to get recovery app id from handle : %d", ret);
return -1;
}
- _I("Success to find recovery client id : %s", recovery_client_app_id);
+ _RLOGI("Success to find recovery client id : %s", recovery_client_app_id);
ret = recovery_client_controller_process_launch_request();
if (ret < 0)
- _E("Failed to process launch recovery client : %d", ret);
+ _RLOGE("Failed to process launch recovery client : %d", ret);
return 0;
}
{
int ret = 0;
- ret = common_client_info_checker_init(RECOVERY_CLIENT_METADATA_KEY, RECOVERY_CLIENT_METADATA_VALUE, recovery_client_info_checker_callback);
+ ret = common_client_info_checker_filter(RECOVERY_CLIENT_METADATA_KEY, RECOVERY_CLIENT_METADATA_VALUE, recovery_client_info_checker_callback);
if (ret < 0) {
- _E("Common client info checker failed, key : %s, value : %s", RECOVERY_CLIENT_METADATA_KEY, RECOVERY_CLIENT_METADATA_KEY);
+ _RLOGE("Failed to set recovery client app filter : %d, key : %s, value : %s",
+ ret, RECOVERY_CLIENT_METADATA_KEY, RECOVERY_CLIENT_METADATA_KEY);
return -1;
}
goto plug_destroy;
}
+ _RLOGD("Ready to trigger plug event, try to add launch request key : %s, value : %s",
+ RECOVERY_CLIENT_APP_CTRL_PLUG_KEY, image_path);
ret = recovery_client_controller_add_launch_request_with_data(RECOVERY_CLIENT_APP_CTRL_PLUG_KEY, image_path);
if (ret < 0) {
_RLOGE("Failed to add launch request : %d, key : %s, value : %s",
int ret = 0;
if (storage_id == recovery_storage_id) {
+ _RLOGD("Ready to trigger unplug event, try to add launch request key : %s, value : %s",
+ RECOVERY_CLIENT_APP_CTRL_UNPLUG_KEY, mount_path);
ret = recovery_client_controller_add_launch_request_with_data(RECOVERY_CLIENT_APP_CTRL_UNPLUG_KEY, mount_path);
if (ret < 0) {
_RLOGE("Failed to add recovery launch request : %d, key : %s, value : %s",
int common_storage_checker_init(void);
int common_storage_checker_fini(void);
+int common_boot_status_checker_init(void);
+int common_boot_status_checker_fini(void);
+bool common_boot_status_checker_is_success(void);
+
int common_client_controller_launch_req_data(const char*, req_data);
int common_client_controller_generate_req_data(const char *, const char *, req_data *);
-int common_client_info_checker_callback(pkgmgrinfo_appinfo_h, char **);
-int common_client_info_checker_init(const char*, const char*, pkgmgrinfo_app_list_cb);
+int common_client_info_checker_get_appid(pkgmgrinfo_appinfo_h, char **);
+int common_client_info_checker_filter(const char*, const char*, pkgmgrinfo_app_list_cb);
-int common_client_status_checker_init(void);
-int common_client_status_checker_fini(void);
-bool common_client_status_checker_is_success(void);
int dbus_manager_init(void);
int dbus_manager_fini(void);