+++ /dev/null
-#include "update-manager.h"
-
-typedef struct _request_data {
- char *key;
- char *value;
-} request_data;
-static request_data request_stack[MAX_STACK_SIZE];
-static int top = -1;
-
-int client_controller_process_launch_request()
-{
- int ret = 0, status = 0;
- char *appid = NULL;
- bundle *bundle_data = NULL;
-
- appid = fota_client_info_get_appid();
- if (appid == NULL) {
- _I("Failed to launch client, client app id not found, current top : %d", top);
- goto request_destroy;
- }
-
- if (!common_client_status_checker_is_success()) {
- _I("Failed to launch client, user session is unset, current top : %d", top);
- goto request_destroy;
- }
-
- while (top > -1) {
- _I("Success to ready process launch client, top : %d, key : %s, value : %s",
- top, request_stack[top].key, request_stack[top].value);
-
- bundle_data = bundle_create();
- if (bundle_data == NULL) {
- _E("bundle_create failed");
- status = -1;
- goto request_destroy;
- }
-
- ret = aul_svc_set_operation(bundle_data, AUL_SVC_OPERATION_DEFAULT);
- if (ret != AUL_R_OK) {
- _E("aul_svc_set_operation failed : %d", ret);
- status = -1;
- goto request_destroy;
- }
-
- ret = aul_svc_add_data(bundle_data, request_stack[top].key, request_stack[top].value);
- if (ret != AUL_R_OK) {
- _E("aul_svc_add_data failed : %d", ret);
- status = -1;
- goto request_destroy;
- }
-
- ret = aul_launch_app_for_uid(appid, bundle_data, OWNER_UID);
- if (ret < AUL_R_OK) {
- _E("aul_launch_app_for_uid failed : %d", ret);
- status = -1;
- goto request_destroy;
- }
-
- _I("Success to launch client with, key : %s, value : %s",
- request_stack[top].key, request_stack[top].value);
-
- ret = bundle_free(bundle_data);
- if (ret != BUNDLE_ERROR_NONE)
- _W("bundle_free failed : %d", ret);
- bundle_data = NULL;
-
- free(request_stack[top].key);
- free(request_stack[top].value);
- top--;
- }
-
-request_destroy:
- if (bundle_data) {
- ret = bundle_free(bundle_data);
- if (ret != BUNDLE_ERROR_NONE)
- _W("bundle_free failed : %d", ret);
- }
-
- return status;
-}
-
-int client_controller_add_launch_request_with_data(const char *key, const char *value)
-{
- int ret = 0;
- char *mem = NULL;
-
- if (top == MAX_STACK_SIZE - 1) {
- _E("Failed to add launch request, Current top : %d", top);
- return -1;
- }
-
- mem = strndup(key, strlen(key));
- if (mem == NULL) {
- _E("Failed to strndup key (%s) : %m", key);
- return -1;
- }
- top++;
- request_stack[top].key = mem;
-
- mem = strndup(value, strlen(value));
- if (mem == NULL) {
- _E("Failed to strndup value (%s) : %m", value);
-
- /* Rollback */
- free(request_stack[top].key);
- top--;
- return -1;
- }
- request_stack[top].value = mem;
-
- _I("Success to add launch request, top : %d, key : %s, value : %s",
- top, request_stack[top].key, request_stack[top].value);
- ret = client_controller_process_launch_request();
- if (ret < 0) {
- _E("Failed to process launch client : %d", ret);
- return -1;
- }
-
- return 0;
-}
--- /dev/null
+#include "../update-manager.h"
+
+int common_client_controller_launch_req_data(const char* appid, req_data data)
+{
+ int ret = 0, status = 0;
+ bundle *bundle_data = NULL;
+
+ bundle_data = bundle_create();
+ if (bundle_data == NULL) {
+ _E("bundle_create failed");
+ status = -1;
+ goto launch_destroy;
+ }
+
+ ret = aul_svc_set_operation(bundle_data, AUL_SVC_OPERATION_DEFAULT);
+ if (ret != AUL_R_OK) {
+ _E("aul_svc_set_operation failed : %d", ret);
+ status = -1;
+ goto launch_destroy;
+ }
+
+ ret = aul_svc_add_data(bundle_data, data.key, data.value);
+ if (ret != AUL_R_OK) {
+ _E("aul_svc_add_data failed : %d", ret);
+ status = -1;
+ goto launch_destroy;
+ }
+
+ ret = aul_launch_app_for_uid(appid, bundle_data, OWNER_UID);
+ if (ret < AUL_R_OK) {
+ _E("aul_launch_app_for_uid failed : %d", ret);
+ status = -1;
+ }
+
+launch_destroy:
+ if (bundle_data) {
+ ret = bundle_free(bundle_data);
+ if (ret != BUNDLE_ERROR_NONE)
+ _W("bundle_free failed : %d", ret);
+ }
+
+ return status;
+}
+
+int common_client_controller_generate_req_data(const char *key, const char *value, req_data *data)
+{
+ char *mem = NULL;
+
+ mem = strndup(key, strlen(key));
+ if (mem == NULL) {
+ _E("Failed to strndup key (%s) : %m", key);
+ return -1;
+ }
+ data->key = mem;
+
+ mem = strndup(value, strlen(value));
+ if (mem == NULL) {
+ _E("Failed to strndup value (%s) : %m", value);
+
+ /* Rollback */
+ free(data->key);
+ return -1;
+ }
+ data->value = mem;
+
+ return 0;
+}
goto callback_destroy;
}
- _I("Success to find client id : %s", *app_id);
- ret = client_controller_process_launch_request();
- if (ret < 0)
- _E("Failed to process launch fota_client : %d", ret);
-
callback_destroy:
if (appinfo_h) {
ret = pkgmgrinfo_appinfo_destroy_appinfo(appinfo_h);
+#include "../recovery/recovery-manager.h"
#include "../update-manager.h"
static int boot_status = -1;
else
_W("vconf_ignore_key_changed for %s failed : %d", VCONFKEY_SYSMAN_BOOTINGSTATUS, ret);
- ret = client_controller_process_launch_request();
+ ret = fota_client_controller_process_launch_request();
if (ret < 0)
- _E("Failed to process launch client : %d", ret);
+ _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);
if (g_file_test(STATUS_FLAG_PATH, G_FILE_TEST_EXISTS)) {
_I("This boot is triggered with fota, start process to send result to client");
- ret = client_controller_add_launch_request_with_data(CLIENT_APP_CTRL_REBOOT_KEY, fota_result);
+ ret = fota_client_controller_add_launch_request_with_data(CLIENT_APP_CTRL_REBOOT_KEY, fota_result);
if (ret < 0) {
_E("Failed to add launch request : %d, key : %s, value : %s",
ret, CLIENT_APP_CTRL_REBOOT_KEY, fota_result);
--- /dev/null
+#include "../update-manager.h"
+
+static req_data fota_req_stack[MAX_STACK_SIZE];
+static int fota_req_top = -1;
+
+int fota_client_controller_process_launch_request()
+{
+ int ret = 0;
+ char *appid = NULL;
+
+ appid = fota_client_info_get_appid();
+ if (appid == NULL) {
+ _I("Failed to launch client, fota client app id not found, current top : %d", fota_req_top);
+ return -1;
+ }
+
+ if (!common_client_status_checker_is_success()) {
+ _I("Failed to launch client, user session is unset, current top : %d", fota_req_top);
+ return -1;
+ }
+
+ while(fota_req_top > -1) {
+ _I("Success to ready process launch fota client, top : %d, key : %s, value : %s",
+ fota_req_top, fota_req_stack[fota_req_top].key, fota_req_stack[fota_req_top].value);
+
+ ret = common_client_controller_launch_req_data(appid, fota_req_stack[fota_req_top]);
+ if (ret < 0) {
+ _E("Common client controller failed at fota");
+ return -1;
+ }
+
+ _I("Success to launch fota client with, key : %s, value : %s",
+ fota_req_stack[fota_req_top].key, fota_req_stack[fota_req_top].value);
+
+ free(fota_req_stack[fota_req_top].key);
+ free(fota_req_stack[fota_req_top].value);
+ fota_req_top--;
+ }
+
+ return 0;
+}
+
+int fota_client_controller_add_launch_request_with_data(const char *key, const char *value)
+{
+ int ret = 0;
+
+ if (fota_req_top == MAX_STACK_SIZE - 1) {
+ _E("Failed to add launch request, Current top : %d", fota_req_top);
+ return -1;
+ }
+
+ ret = common_client_controller_generate_req_data(key, value, &fota_req_stack[fota_req_top+1]);
+ if (ret < 0) {
+ _E("Failed to generate request data : %d", ret);
+ return -1;
+ }
+
+ fota_req_top++;
+ _I("Success to add launch request, top : %d, key : %s, value : %s",
+ fota_req_top, fota_req_stack[fota_req_top].key, fota_req_stack[fota_req_top].value);
+ ret = fota_client_controller_process_launch_request();
+ if (ret < 0) {
+ _E("Failed to process launch client : %d", ret);
+ return -1;
+ }
+
+ return 0;
+}
\ No newline at end of file
ret = common_client_info_checker_callback(handle, &fota_client_app_id);
if (ret < 0) {
- _E("Common client info checker callback failed at recovery");
+ _E("Common client info checker callback failed at fota");
return -1;
}
+ _I("Success to find fota client id : %s", fota_client_app_id);
+ ret = fota_client_controller_process_launch_request();
+ if (ret < 0)
+ _E("Failed to process launch fota client : %d", ret);
+
return 0;
}
goto process_destroy;
}
- ret = client_controller_add_launch_request_with_data(CLIENT_APP_CTRL_LOCAL_KEY, delta_path);
+ ret = fota_client_controller_add_launch_request_with_data(CLIENT_APP_CTRL_LOCAL_KEY, delta_path);
if (ret < 0) {
_E("Failed to add launch request : %d, key : %s, value : %s",
ret, CLIENT_APP_CTRL_LOCAL_KEY, delta_path);
{
int ret = 0;
if (storage_id == fota_storage_id) {
- ret = client_controller_add_launch_request_with_data(CLIENT_APP_CTRL_UNPLUG_KEY, mount_path);
+ ret = fota_client_controller_add_launch_request_with_data(CLIENT_APP_CTRL_UNPLUG_KEY, mount_path);
if (ret < 0) {
- _E("Failed to add launch request : %d, key : %s, value : %s",
+ _E("Failed to add fota launch request : %d, key : %s, value : %s",
ret, CLIENT_APP_CTRL_UNPLUG_KEY, mount_path);
}
fota_storage_id = -1;
--- /dev/null
+#include "recovery-manager.h"
+#include "../update-manager.h"
+
+static req_data recovery_req_stack[MAX_STACK_SIZE];
+static int recovery_req_top = -1;
+
+int recovery_client_controller_process_launch_request()
+{
+ int ret = 0;
+ char *appid = NULL;
+
+ appid = recovery_client_info_get_appid();
+ if (appid == NULL) {
+ _RLOGI("Failed to launch client, recovery client app id not found, current top : %d", recovery_req_top);
+ return -1;
+ }
+
+ if (!common_client_status_checker_is_success()) {
+ _RLOGI("Failed to launch client, user session is unset, current top : %d", recovery_req_top);
+ return -1;
+ }
+
+ while(recovery_req_top > -1) {
+ _RLOGI("Success to ready process launch recovery client, top : %d, key : %s, value : %s",
+ recovery_req_top, recovery_req_stack[recovery_req_top].key, recovery_req_stack[recovery_req_top].value);
+
+ ret = common_client_controller_launch_req_data(appid, recovery_req_stack[recovery_req_top]);
+ if (ret < 0) {
+ _RLOGE("Common client controller failed at recovery");
+ return -1;
+ }
+
+ _RLOGI("Success to launch recovery client with, key : %s, value : %s",
+ recovery_req_stack[recovery_req_top].key, recovery_req_stack[recovery_req_top].value);
+
+ free(recovery_req_stack[recovery_req_top].key);
+ free(recovery_req_stack[recovery_req_top].value);
+ recovery_req_top--;
+ }
+
+ return 0;
+}
+
+int recovery_client_controller_add_launch_request_with_data(const char *key, const char *value)
+{
+ int ret = 0;
+
+ if (recovery_req_top == MAX_STACK_SIZE - 1) {
+ _RLOGE("Failed to add launch request, Current top : %d", recovery_req_top);
+ return -1;
+ }
+
+ ret = common_client_controller_generate_req_data(key, value, &recovery_req_stack[recovery_req_top+1]);
+ if (ret < 0) {
+ _RLOGE("Failed to generate request data : %d", ret);
+ return -1;
+ }
+
+ recovery_req_top++;
+ _I("Success to add launch request, top : %d, key : %s, value : %s",
+ recovery_req_top, recovery_req_stack[recovery_req_top].key, recovery_req_stack[recovery_req_top].value);
+ ret = recovery_client_controller_process_launch_request();
+ if (ret < 0) {
+ _RLOGE("Failed to process launch client : %d", ret);
+ return -1;
+ }
+
+ return 0;
+}
\ No newline at end of file
return -1;
}
+ _I("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);
+
return 0;
}
/* Constant */
#define RECOVERY_CLIENT_METADATA_KEY "tizen-recovery-manager"
#define RECOVERY_CLIENT_METADATA_VALUE "client"
+#define RECOVERY_CLIENT_APP_CTRL_PLUG_KEY "recovery-plug"
+#define RECOVERY_CLIENT_APP_CTRL_UNPLUG_KEY "recovery-unplug"
#define RECOVERY_IMAGE_FILE "tizen-recovery.img"
/* Function */
+int recovery_client_controller_process_launch_request(void);
+int recovery_client_controller_add_launch_request_with_data(const char *, const char *);
+
int recovery_client_info_checker_init(void);
int recovery_client_info_checker_fini(void);
char *recovery_client_info_get_appid(void);
goto plug_destroy;
}
+ 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",
+ ret, RECOVERY_CLIENT_APP_CTRL_PLUG_KEY, image_path);
+ }
+ recovery_storage_id = storage_id;
+
plug_destroy:
g_free(image_path);
}
void recovery_storage_checker_unplug(int storage_id, const char *mount_path)
{
+ int ret = 0;
+
+ if (storage_id == recovery_storage_id) {
+ 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",
+ ret, RECOVERY_CLIENT_APP_CTRL_UNPLUG_KEY, mount_path);
+ }
+ recovery_storage_id = -1;
+ }
recovery_storage_id = -1;
}
#define SHARED_DIR "/opt/usr/home/owner/apps_rw"
#define SHARED_DATA_DIR "shared/data"
+/* Type */
+typedef struct _req_data {
+ char *key;
+ char *value;
+} req_data;
+
/* Function */
int fota_client_info_checker_init(void);
int fota_client_info_checker_fini(void);
char *fota_client_info_get_appid(void);
-int client_controller_process_launch_request(void);
-int client_controller_add_launch_request_with_data(const char *, const char *);
+int fota_client_controller_process_launch_request(void);
+int fota_client_controller_add_launch_request_with_data(const char *, const char *);
int common_storage_checker_init(void);
int common_storage_checker_fini(void);
-int common_client_status_checker_init(void);
-int common_client_status_checker_fini(void);
-bool common_client_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_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);