#include <sensor_internal.h>
#include <ttrace.h>
#include <system_info.h>
+
#include "appcore_base.h"
#include "appcore_base_private.h"
+#include "appcore_watchdog.h"
#define PATH_LOCALE "locale"
-#define RESOURCED_FREEZER_PATH "/Org/Tizen/Resourced/Freezer"
+#define RESOURCED_FREEZER_PATH "/Org/Tizen/ResourceD/Freezer"
#define RESOURCED_FREEZER_INTERFACE "org.tizen.resourced.freezer"
#define RESOURCED_FREEZER_SIGNAL "FreezerState"
#define SQLITE_FLUSH_MAX (1024 * 1024)
{
int suspend = APPCORE_BASE_SUSPENDED_STATE_WILL_ENTER_SUSPEND;
- appcore_base_flush_memory();
+ if (__context.ops.trim_memory)
+ __context.ops.trim_memory(__context.data);
+
__context.tid = 0;
if (!__context.allowed_bg && !__context.suspended_state) {
if (__context.ops.set_i18n)
__context.ops.set_i18n(__context.data);
+ appcore_watchdog_enable();
+
if (__context.ops.create) {
traceBegin(TTRACE_TAG_APPLICATION_MANAGER, "APPCORE:CREATE");
r = __context.ops.create(__context.data);
int i;
aul_status_update(STATUS_DYING);
+ appcore_watchdog_disable();
if (__context.ops.terminate) {
traceBegin(TTRACE_TAG_APPLICATION_MANAGER, "APPCORE:TERMINATE");
__context.ops.terminate(__context.data);
EXPORT_API int appcore_base_flush_memory(void)
{
- int (*sqlite3_free_heap_memory)(int);
- void (*elm_free_all_cache)(void);
-
- elm_free_all_cache = dlsym(RTLD_DEFAULT, "elm_cache_all_flush");
- if (elm_free_all_cache)
- elm_free_all_cache();
-
- sqlite3_free_heap_memory = dlsym(RTLD_DEFAULT,
- "sqlite3_release_memory");
- if (sqlite3_free_heap_memory)
- sqlite3_free_heap_memory(SQLITE_FLUSH_MAX);
+ if (__context.ops.trim_memory)
+ __context.ops.trim_memory(__context.data);
- malloc_trim(0);
return 0;
}
}
}
+EXPORT_API int appcore_base_on_trim_memory(void)
+{
+ int (*sqlite3_free_heap_memory)(int);
+
+ sqlite3_free_heap_memory = dlsym(RTLD_DEFAULT,
+ "sqlite3_release_memory");
+ if (sqlite3_free_heap_memory)
+ sqlite3_free_heap_memory(SQLITE_FLUSH_MAX);
+
+ malloc_trim(0);
+
+ return 0;
+}
+
EXPORT_API appcore_base_event_h appcore_base_add_event(enum appcore_base_event event,
appcore_base_event_cb cb, void *data)
{
static void __on_set_event(enum appcore_base_event event, void *data)
{
- return appcore_base_on_set_event(event);
+ appcore_base_on_set_event(event);
}
static void __on_unset_event(enum appcore_base_event event, void *data)
{
- return appcore_base_on_unset_event(event);
+ appcore_base_on_unset_event(event);
+}
+
+static void __on_trim_memory(void *data)
+{
+ appcore_base_on_trim_memory();
}
EXPORT_API appcore_base_ops appcore_base_get_default_ops(void)
ops.exit = NULL;
ops.set_event = __on_set_event;
ops.unset_event = __on_unset_event;
+ ops.trim_memory = __on_trim_memory;
return ops;
}