#include <aul.h>
#include <bundle_internal.h>
#include <sensor_internal.h>
+#include <ttrace.h>
#include "appcore_base.h"
#include "appcore_base_private.h"
val = vconf_keynode_get_int(key);
if (val >= VCONFKEY_SYSMAN_LOW_MEMORY_SOFT_WARNING) {
- __invoke_callback(key, APPCORE_BASE_EVENT_LOW_MEMORY);
+ __invoke_callback(&val, APPCORE_BASE_EVENT_LOW_MEMORY);
malloc_trim(0);
}
}
val = vconf_keynode_get_int(key);
if (val <= VCONFKEY_SYSMAN_BAT_CRITICAL_LOW)
- __invoke_callback(key, APPCORE_BASE_EVENT_LOW_BATTERY);
+ __invoke_callback(&val, APPCORE_BASE_EVENT_LOW_BATTERY);
}
static void __destroy_lang_info(gpointer data)
const char *name;
name = vconf_keynode_get_name(key);
- if (!strcmp(name, VCONFKEY_REGIONFORMAT))
+ if (name && !strcmp(name, VCONFKEY_REGIONFORMAT))
val = vconf_keynode_get_str(key);
__update_region();
return 0;
}
+EXPORT_API int appcore_base_set_i18n(const char *domain_name, const char *dir_name)
+{
+ return __set_i18n(domain_name, dir_name);
+}
+
EXPORT_API int appcore_base_init(appcore_base_ops ops, int argc, char **argv, void *data)
{
int i;
+ int r;
__context.ops = ops;
__context.argc = argc;
__context.suspended_state = false;
__context.allowed_bg = false;
+ if (__context.ops.init)
+ __context.ops.init(argc, argv, data);
+
if (__context.ops.set_i18n)
__context.ops.set_i18n(__context.data);
}
}
- if (__context.ops.create && __context.ops.create(__context.data) < 0) {
- aul_status_update(STATUS_DYING);
- return 0;
+ if (__context.ops.create) {
+ traceBegin(TTRACE_TAG_APPLICATION_MANAGER, "APPCORE:CREATE");
+ r = __context.ops.create(__context.data);
+ traceEnd(TTRACE_TAG_APPLICATION_MANAGER);
+ if (r < 0) {
+ aul_status_update(STATUS_DYING);
+ return 0;
+ }
}
if (__context.ops.run)
int i;
aul_status_update(STATUS_DYING);
- if (__context.ops.terminate)
+ if (__context.ops.terminate) {
+ traceBegin(TTRACE_TAG_APPLICATION_MANAGER, "APPCORE:TERMINATE");
__context.ops.terminate(__context.data);
+ traceEnd(TTRACE_TAG_APPLICATION_MANAGER);
+ }
for (i = APPCORE_BASE_EVENT_START + 1; i < APPCORE_BASE_EVENT_MAX; i++) {
if (__exist_callback(i)) {
}
__context.dirty = false;
+
+ if (__context.ops.finish)
+ __context.ops.finish();
}
EXPORT_API int appcore_base_flush_memory(void)
__remove_suspend_timer();
}
- if (__context.ops.control)
- __context.ops.control(b, __context.data);
+ if (__context.ops.control) {
+ traceBegin(TTRACE_TAG_APPLICATION_MANAGER, "APPCORE:RESET");
+ __context.ops.control(b, __context.data);
+ traceEnd(TTRACE_TAG_APPLICATION_MANAGER);
+ }
break;
case AUL_RESUME:
_DBG("[APP %d] AUL event: AUL_RESUME", getpid());
appcore_base_event_node *node = handle;
enum appcore_base_event event;
+ if (!node || !g_list_find(__events, node))
+ return -1;
+
event = node->type;
__events = g_list_remove(__events, node);
free(node);
EXPORT_API int appcore_base_get_rotation_state(enum appcore_base_rm *curr)
{
+ if (curr == NULL)
+ return -1;
+
+ if (!__rotation.ref)
+ return -1;
+
+ *curr = __rotation.rm;
return 0;
}
ops.terminate = __on_terminate;
ops.receive = __on_receive;
ops.set_i18n = __on_set_i18n;
+ ops.init = NULL;
+ ops.finish = NULL;
ops.run = NULL;
ops.exit = NULL;
ops.set_event = __on_set_event;