int aul_prepare_app_defined_loader(const char *loader_name);
int aul_prepare_app_defined_loader_for_uid(const char *loader_name, uid_t uid);
+/**
+ * @remarks This function is only for App Framework internally.
+ */
+int aul_status_update_v2(int status);
+
#ifdef __cplusplus
}
#endif
#include "aul_api.h"
#include "launch.h"
#include "aul_app_com.h"
+#include "aul_error.h"
typedef struct _app_status_cb_info_t {
int (*handler)(int status, void *data);
return "Unknown status";
}
}
+
+API int aul_status_update_v2(int status)
+{
+ char buf[12];
+ bundle *b;
+ int ret;
+
+ if (status < 0) {
+ _E("Invalid parameter");
+ return AUL_R_EINVAL;
+ }
+
+ if (app_status == status)
+ return AUL_R_OK;
+
+ app_status = status;
+
+ b = bundle_create();
+ if (!b) {
+ _E("Out of memory");
+ return AUL_R_ENOMEM;
+ }
+
+ snprintf(buf, sizeof(buf), "%d", status);
+ bundle_add(b, AUL_K_STATUS, buf);
+
+ ret = aul_sock_send_bundle(AUL_UTIL_PID, getuid(), APP_STATUS_UPDATE_V2,
+ b, AUL_SOCK_NONE);
+ if (ret != 0) {
+ _E("Failed to update app status. error(%d)", ret);
+ return aul_error_convert(ret);
+ } else {
+ aul_invoke_status_local_cb(status);
+ }
+
+ return AUL_R_OK;
+}