int mas_launch_client_by_appid(const char *appid, CLIENT_LAUNCH_MODE launch_mode)
{
- app_control_h app_control;
- int ret = 0;
-
if (NULL == appid || 0 == strlen(appid)) {
MAS_LOGE("appid invalid, failed launching MA Client");
return -1;
}
- ret = app_control_create(&app_control);
- if (APP_CONTROL_ERROR_NONE != ret) {
- MAS_LOGW("app_control_create returned %08x", ret);
- return -1;
- }
-
- ret = app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT);
- if (APP_CONTROL_ERROR_NONE != ret) {
- MAS_LOGW("app_control_set_operation returned %08x", ret);
- app_control_destroy(app_control);
+ bundle *b = NULL;
+ b = bundle_create();
+ if (NULL == b) {
+ MAS_LOGE("Failed creating bundle for aul operation");
return -1;
}
- ret = app_control_set_app_id(app_control, appid);
- if (APP_CONTROL_ERROR_NONE != ret) {
- MAS_LOGW("app_control_set_app_id returned %08x", ret);
- app_control_destroy(app_control);
- return -1;
+ int result;
+ if (CLIENT_LAUNCH_MODE_PRELAUNCH == launch_mode) {
+ result = aul_svc_set_background_launch(b, TRUE);
+ if (result < AUL_R_OK) {
+ MAS_LOGE("ERROR : aul_svc_set_background_launch failed. app_id [%s] bundle[%p] result[%d : %s]",
+ appid, b, result, get_error_message(result));
+ }
}
- ret = app_control_send_launch_request(app_control, NULL, NULL);
- if (APP_CONTROL_ERROR_NONE != ret) {
- MAS_LOGW ("app_control_send_launch_request returned %08x, app_id=%s", ret, appid);
+ result = aul_launch_app(appid, b);
+ if (result < AUL_R_OK) {
+ MAS_LOGE("ERROR : aul_launch_app failed. app_id [%s] bundle[%p] result[%d : %s]",
+ appid, b, result, get_error_message(result));
}
- app_control_destroy (app_control);
- if (APP_CONTROL_ERROR_NONE == ret && CLIENT_LAUNCH_MODE_ACTIVATION == launch_mode) {
+ if (CLIENT_LAUNCH_MODE_ACTIVATION == launch_mode) {
bool found = false;
for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) {
if (g_maclient_info[loop].used &&
MAS_LOGD("g_wakeup_maclient_appid : %s, %d", g_wakeup_maclient_appid, found);
}
- return ret;
+ if (b) bundle_free(b);
+ b = NULL;
+
+ return result;
}
int mas_launch_client_by_wakeup_word(const char *wakeup_word)