summaryrefslogtreecommitdiff
path: root/include/notification_private.h
blob: 86866b4ac81341a6220ae8265d20a0a43d38e4a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/*
 * Copyright (c) 2000 - 2016 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef __NOTIFICATION_PRIVATE_H__
#define __NOTIFICATION_PRIVATE_H__
#include <sys/types.h>

#ifndef EXPORT_API
#define EXPORT_API __attribute__ ((visibility("default")))
#endif

#define SAFE_STRDUP(s) ((s) ? strdup(s) : NULL)
#define SAFE_FREE(s)			\
	do {				\
		if (s) {		\
			free(s);	\
			s = NULL;	\
		}			\
	} while (0)

#define NOTIFICATION_SETTING_DB_TABLE "notification_setting"
#define NOTIFICATION_SYSTEM_SETTING_DB_TABLE "notification_system_setting"
#define NOTIFICATION_DND_ALLOW_EXCEPTION "dnd_allow_exception"

struct _notification {
	notification_type_e type;
	notification_ly_type_e layout;

	int group_id;		/* Group ID */
	int internal_group_id;	/* Internal Group ID */
	int priv_id;		/* Private ID */

	char *caller_pkgname;	/* Caller App package name */
	char *launch_pkgname;	/* Launch App package name. It will be from appsvc_set_pkgname */
	bundle *args;		/* Will be removed. */
	bundle *group_args;	/* Will be removed. */

	bundle *b_execute_option;
	bundle *b_service_responding;
	bundle *b_service_single_launch;
	bundle *b_service_multi_launch;

	bundle *b_event_handler[NOTIFICATION_EVENT_TYPE_MAX];

	char *domain;		/* Text domain for localization */
	char *dir;		/* Text dir for localization */

	bundle *b_text;		/* basic text */
	bundle *b_key;		/* key for localized text */
	bundle *b_format_args;	/* args type and value for format string */
	int num_format_args;	/* number of format string args */

	bundle *b_image_path;	/* image path */

	notification_sound_type_e sound_type;
	char *sound_path;
	notification_vibration_type_e vibration_type;
	char *vibration_path;
	notification_led_op_e led_operation;
	int led_argb;
	int led_on_ms;
	int led_off_ms;

	time_t time;		/* time set by application */
	time_t insert_time;	/* insert time */

	int flags_for_property;	/* property NOTIFICATION_PROP_XXX */
	int display_applist;	/* display app list  NOTIFICATION_DISPLAY_APP_XXX */

	double progress_size;	/* size of progress */
	double progress_percentage;	/* percentage of progress */

	char *app_icon_path;	/* Temporary stored app icon path from AIL */
	char *app_name;		/* Temporary stored app name from AIL */
	char *temp_title;
	char *temp_content;
	char *tag;
	bool ongoing_flag;
	int ongoing_value_type;
	int ongoing_current;		/* Ongoing current time */
	int ongoing_duration;		/* Ongoing duration time */
	bool auto_remove;
	notification_button_index_e default_button_index;
	int timeout;
	int text_input_max_length;
	bool event_flag;
	uid_t uid;
};

typedef enum notification_data_type {
	NOTIFICATION_DATA_TYPE_NOTI_TYPE = 1,
	NOTIFICATION_DATA_TYPE_LAYOUT,
	NOTIFICATION_DATA_TYPE_GROUP_ID,
	NOTIFICATION_DATA_TYPE_INTERNAL_GROUP_ID,
	NOTIFICATION_DATA_TYPE_PRIV_ID,
	NOTIFICATION_DATA_TYPE_CALLER_PKGNAME,
	NOTIFICATION_DATA_TYPE_LAUNCH_PKGNAME,
	NOTIFICATION_DATA_TYPE_ARGS,
	NOTIFICATION_DATA_TYPE_GROUP_ARGS,
	NOTIFICATION_DATA_TYPE_EXECUTE_OPTION,
	NOTIFICATION_DATA_TYPE_SERVICE_RESPONDING,
	NOTIFICATION_DATA_TYPE_SERVICE_SINGLE_LAUNCH,
	NOTIFICATION_DATA_TYPE_SERVICE_MULTI_LAUNCH,
	NOTIFICATION_DATA_TYPE_BUTTON1_EVENT,
	NOTIFICATION_DATA_TYPE_BUTTON2_EVENT,
	NOTIFICATION_DATA_TYPE_BUTTON3_EVENT,
	NOTIFICATION_DATA_TYPE_BUTTON4_EVENT,
	NOTIFICATION_DATA_TYPE_BUTTON5_EVENT,
	NOTIFICATION_DATA_TYPE_BUTTON6_EVENT,
	NOTIFICATION_DATA_TYPE_ICON_EVENT,
	NOTIFICATION_DATA_TYPE_THUMBNAIL_EVENT,
	NOTIFICATION_DATA_TYPE_TEXT_INPUT_BUTTON_EVENT,
	NOTIFICATION_DATA_TYPE_DOMAIN,
	NOTIFICATION_DATA_TYPE_DIR,
	NOTIFICATION_DATA_TYPE_TEXT,
	NOTIFICATION_DATA_TYPE_KEY,
	NOTIFICATION_DATA_TYPE_FORMAT_ARGS,
	NOTIFICATION_DATA_TYPE_NUM_FORMAT_ARGS,
	NOTIFICATION_DATA_TYPE_IMAGE_PATH,
	NOTIFICATION_DATA_TYPE_SOUND_TYPE,
	NOTIFICATION_DATA_TYPE_SOUND_PATH,
	NOTIFICATION_DATA_TYPE_VIBRATION_TYPE,
	NOTIFICATION_DATA_TYPE_VIBRATION_PATH,
	NOTIFICATION_DATA_TYPE_LED_OPERATION,
	NOTIFICATION_DATA_TYPE_LED_ARGB,
	NOTIFICATION_DATA_TYPE_LED_ON_MS,
	NOTIFICATION_DATA_TYPE_LED_OFF_MS,
	NOTIFICATION_DATA_TYPE_TIME,
	NOTIFICATION_DATA_TYPE_INSERT_TIME,
	NOTIFICATION_DATA_TYPE_FLAGS_FOR_PROPERTY,
	NOTIFICATION_DATA_TYPE_DISPLAY_APPLIST,
	NOTIFICATION_DATA_TYPE_PROGRESS_SIZE,
	NOTIFICATION_DATA_TYPE_PROGRESS_PERCENTAGE,
	NOTIFICATION_DATA_TYPE_APP_ICON_PATH,
	NOTIFICATION_DATA_TYPE_APP_NAME,
	NOTIFICATION_DATA_TYPE_TEMP_TITLE,
	NOTIFICATION_DATA_TYPE_TEMP_CONTENT,
	NOTIFICATION_DATA_TYPE_TAG,
	NOTIFICATION_DATA_TYPE_ONGOING_FLAG,
	NOTIFICATION_DATA_TYPE_ONGOING_VALUE_TYPE,
	NOTIFICATION_DATA_TYPE_ONGOING_CURRENT,
	NOTIFICATION_DATA_TYPE_ONGOING_DURATION,
	NOTIFICATION_DATA_TYPE_AUTO_REMOVE,
	NOTIFICATION_DATA_TYPE_DEFAULT_BUTTON,
	NOTIFICATION_DATA_TYPE_TIMEOUT,
	NOTIFICATION_DATA_TYPE_TEXT_INPUT_MAX_LENGTH,
	NOTIFICATION_DATA_TYPE_EVENT_FLAG,
	NOTIFICATION_DATA_TYPE_UID,
} notification_data_type_e;

void notification_call_changed_cb_for_uid(notification_op *op_list, int op_num, uid_t uid);
void notification_call_dnd_changed_cb_for_uid(int do_not_disturb, uid_t uid);
void notification_call_event_handler_cb(notification_h noti, int event_type);
void notification_delete_event_handler_cb(int priv_id);
char *notification_get_pkgname_by_pid(void);

#endif /* __NOTIFICATION_PRIVATE_H__ */