extern "C" {
#endif
+enum syscommon_resourced_memory_lmk_oom_level {
+ OOM_LEVEL_BACKGROUND_LEAST_RECENTLY_USED,
+ OOM_LEVEL_BACKGROUND_MOST_RECENTLY_USED,
+ OOM_LEVEL_FOREGROUND,
+ OOM_LEVEL_FOREGROUND_AND_PROC,
+ OOM_LEVEL_ALL,
+};
+
+struct task_info {
+ /*
+ * Mostly, there are not multiple processes with the same pgid.
+ * So, for the frequent case, we use pid variable to avoid
+ * allocating arrays.
+ */
+ pid_t pid;
+ GArray *pids;
+ pid_t pgid;
+ /* oom_score_adj is smae as /proc/<pid>/oom_score_adj */
+ int oom_score_adj;
+ /*
+ * oom_score_lru is same as oom_score_adj or adjusted by
+ * proc_app_info lru_state for apps that are marked as favourite.
+ *
+ * oom_score_lru is the main value used in comparison for LMK.
+ */
+ int oom_score_lru;
+ int size;
+ /**
+ * proc_app_info_oom_killed and proc_app_info_flags
+ * are not used if task is not an app.
+ * Especially, proc_app_info_oom_killed is NULL when this task
+ * is not an app.
+ */
+ bool *proc_app_info_oom_killed;
+ int proc_app_info_flags;
+
+ /**
+ * TODO: A process can have more than one window,
+ * and an app can have more than one process. Therefore,
+ * a task_info can have more than one window.
+ */
+ int window_pid;
+ int x;
+ int y;
+ int z;
+ int w;
+ int h;
+ int layer;
+ int opaque;
+ int visibility;
+ bool is_transformed;
+ bool alpha;
+ bool is_focused;
+ bool is_mapped;
+};
+
typedef struct _syscommon_plugin_backend_resourced_memory_lmk_funcs {
int (*get_kill_candidates)(GArray *candidates,
GArray *task_info_app_array,
#include <glib.h>
#include <stdbool.h>
+#include "syscommon-plugin-resourced-memory-lmk-interface.h"
+
#ifdef __cplusplus
extern "C" {
#endif
-enum syscommon_resourced_memory_lmk_oom_level {
- OOM_LEVEL_BACKGROUND_LEAST_RECENTLY_USED,
- OOM_LEVEL_BACKGROUND_MOST_RECENTLY_USED,
- OOM_LEVEL_FOREGROUND,
- OOM_LEVEL_FOREGROUND_AND_PROC,
- OOM_LEVEL_ALL,
-};
-
-struct task_info {
- /*
- * Mostly, there are not multiple processes with the same pgid.
- * So, for the frequent case, we use pid variable to avoid
- * allocating arrays.
- */
- pid_t pid;
- GArray *pids;
- pid_t pgid;
- /* oom_score_adj is smae as /proc/<pid>/oom_score_adj */
- int oom_score_adj;
- /*
- * oom_score_lru is same as oom_score_adj or adjusted by
- * proc_app_info lru_state for apps that are marked as favourite.
- *
- * oom_score_lru is the main value used in comparison for LMK.
- */
- int oom_score_lru;
- int size;
- /**
- * proc_app_info_oom_killed and proc_app_info_flags
- * are not used if task is not an app.
- * Especially, proc_app_info_oom_killed is NULL when this task
- * is not an app.
- */
- bool *proc_app_info_oom_killed;
- int proc_app_info_flags;
-
- /**
- * TODO: A process can have more than one window,
- * and an app can have more than one process. Therefore,
- * a task_info can have more than one window.
- */
- int window_pid;
- int x;
- int y;
- int z;
- int w;
- int h;
- int layer;
- int opaque;
- int visibility;
- bool is_transformed;
- bool alpha;
- bool is_focused;
- bool is_mapped;
-};
-
/**
* @brief Get the backend data of resourced-memory-lmk module
* @return @c 0 on success, otherwise a negative error value
#include <system/syscommon-plugin-common.h>
#include <system/syscommon-plugin-resourced-memory-lmk.h>
-#include <system/syscommon-plugin-resourced-memory-lmk-interface.h>
#ifndef EXPORT
#define EXPORT __attribute__((visibility("default")))