#include <aul.h>
#include <aul_svc.h>
+#include <app_control.h>
CApplicationManagerAul::CApplicationManagerAul()
{
return ret;
}
+static void result_cb(app_control_h request, app_control_error_e result, void *user_data) {
+ MAS_LOGI("App Control Error : %d", result);
+}
+
+static void reply_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *user_data) {
+ MAS_LOGI("App Control Result : %d", result);
+}
+
bool CApplicationManagerAul::launch_app_async(const std::string& appid, bool background)
{
bool ret = true;
- bundle *b = NULL;
- b = bundle_create();
- if (NULL == b) {
- MAS_LOGE("Failed creating bundle for aul operation");
- return false;
+ if (background) {
+ MAS_LOGE("ERROR : Background launch is not currently supported");
}
- int result = aul_svc_set_background_launch(b, background);
- if (result < AUL_R_OK) {
- MAS_LOGE("ERROR : aul_svc_set_background_launch failed. app_id [%s] bundle[%p] result[%d : %s]",
- appid.c_str(), b, result, get_error_message(result));
+ app_control_h app_control = nullptr;
+ int result = app_control_create(&app_control);
+ if (result != APP_CONTROL_ERROR_NONE) {
+ MAS_LOGE("ERROR : app_control_create failed : %d", result);
+ return false;
}
- result = aul_launch_app_async(appid.c_str(), b);
- if (result < AUL_R_OK) {
- MAS_LOGE("ERROR : aul_launch_app_async failed. app_id [%s] bundle[%p] result[%d : %s]",
- appid.c_str(), b, result, get_error_message(result));
+ result = app_control_set_app_id(app_control, appid.c_str());
+ result = app_control_send_launch_request_async(app_control, result_cb, reply_cb, nullptr);
+ if (result != APP_CONTROL_ERROR_NONE) {
+ MAS_LOGE("ERROR : app_control_send_launch_request_async failed. app_id [%s] result[%d : %s]",
+ appid.c_str(), result, get_error_message(result));
ret = false;
}
-
- if (b) bundle_free(b);
- b = NULL;
+ app_control_destroy(app_control);
return ret;
}
{
mAppIDCache.clear();
mPIDCache.clear();
-}
\ No newline at end of file
+}