/*
- * app-core
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>
+ * Copyright (c) 2000 - 2020 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.
* 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 __APPCORE_INTERNAL_H__
#define __APPCORE_INTERNAL_H__
-#define LOG_TAG "APP_CORE"
-
#include <stdio.h>
#include <stdbool.h>
#include <dlog.h>
+
#include "appcore-common.h"
+#undef LOG_TAG
+#define LOG_TAG "APP_CORE"
+
+#undef EXPORT_API
+#define EXPORT_API __attribute__ ((visibility("default")))
+
+#undef _ERR
+#define _ERR LOGE
+
+#undef _INFO
+#define _INFO LOGI
-#ifndef EXPORT_API
-# define EXPORT_API __attribute__ ((visibility("default")))
-#endif
-
-#ifndef _DLOG_H_
-#define _ERR(fmt, arg...) fprintf(stderr, "appcore: "fmt"\n", ##arg)
-#define _INFO(fmt, arg...) fprintf(stdout, fmt"\n", ##arg)
-#define _DBG(fmt, arg...) \
- do { \
- if (getenv("APPCORE_DEBUG")) { \
- fprintf(stdout, fmt"\n", ##arg); \
- } \
- } while (0)
-#else
-#define _ERR(fmt, arg...) LOGE(fmt, ##arg)
-#define _INFO(...) LOGI(__VA_ARGS__)
-#define _DBG(...) LOGD(__VA_ARGS__)
-#endif
-
-#define _warn_if(expr, fmt, arg...) do { \
- if (expr) { \
- _ERR(fmt, ##arg); \
- } \
- } while (0)
-
-#define _ret_if(expr) do { \
- if (expr) { \
- return; \
- } \
- } while (0)
-
-#define _retv_if(expr, val) do { \
- if (expr) { \
- return (val); \
- } \
- } while (0)
-
-#define _retm_if(expr, fmt, arg...) do { \
- if (expr) { \
- _ERR(fmt, ##arg); \
- return; \
- } \
- } while (0)
-
-#define _retvm_if(expr, val, fmt, arg...) do { \
- if (expr) { \
- _ERR(fmt, ##arg); \
- return (val); \
- } \
- } while (0)
+#undef _DBG
+#define _DBG LOGD
/**
* Appcore internal state
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2016 - 2020 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.
#pragma once
-#define LOG_TAG "APP_CORE_BASE"
-
#include <stdio.h>
#include <stdbool.h>
#include <dlog.h>
TIZEN_PROFILE_COMMON = 0x10,
} appcore_base_tizen_profile_t;
-#ifndef EXPORT_API
-# define EXPORT_API __attribute__ ((visibility("default")))
-#endif
-
-#ifndef _DLOG_H_
-# define _ERR(fmt, arg...) \
- do { fprintf(stderr, "appcore: "fmt"\n", ##arg); } while (0)
-
-# define _INFO(fmt, arg...) \
- do { fprintf(stdout, fmt"\n", ##arg); } while (0)
-
-# define _DBG(fmt, arg...) \
- do { \
- if (getenv("APPCORE_DEBUG")) { \
- fprintf(stdout, fmt"\n", ##arg); \
- } \
- } while (0)
-#else
-# define _ERR(fmt, arg...) \
- do { \
- fprintf(stderr, "appcore: "fmt"\n", ##arg); \
- LOGE(fmt, ##arg); \
- } while (0)
-# define _INFO(...) LOGI(__VA_ARGS__)
-# define _DBG(...) LOGD(__VA_ARGS__)
-#endif
-
-#define _warn_if(expr, fmt, arg...) do { \
- if (expr) { \
- _ERR(fmt, ##arg); \
- } \
- } while (0)
+#undef LOG_TAG
+#define LOG_TAG "APP_CORE_BASE"
-#define _ret_if(expr) do { \
- if (expr) { \
- return; \
- } \
- } while (0)
+#undef EXPORT_API
+#define EXPORT_API __attribute__ ((visibility("default")))
-#define _retv_if(expr, val) do { \
- if (expr) { \
- return (val); \
- } \
- } while (0)
+#undef _ERR
+#define _ERR LOGE
-#define _retm_if(expr, fmt, arg...) do { \
- if (expr) { \
- _ERR(fmt, ##arg); \
- return; \
- } \
- } while (0)
+#undef _INFO
+#define _INFO LOGI
-#define _retvm_if(expr, val, fmt, arg...) do { \
- if (expr) { \
- _ERR(fmt, ##arg); \
- return (val); \
- } \
- } while (0)
+#undef _DBG
+#define _DBG LOGD
appcore_base_tizen_profile_t appcore_base_get_tizen_profile(void);
-#define TIZEN_FEATURE_BACKGROUND_MANAGEMENT \
+#define TIZEN_FEATURE_BACKGROUND_MANAGEMENT \
(!(appcore_base_get_tizen_profile() & TIZEN_PROFILE_TV))
-#define TIZEN_FEATURE_CHARGER_STATUS \
+#define TIZEN_FEATURE_CHARGER_STATUS \
(appcore_base_get_tizen_profile() & TIZEN_PROFILE_WEARABLE)
extern void aul_finalize();
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2017 - 2020 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.
#pragma once
-#define LOG_TAG "APP_CORE_EFL_BASE"
-
#include <dlog.h>
-#ifndef EXPORT_API
+#undef LOG_TAG
+#define LOG_TAG "APP_CORE_EFL_BASE"
+
+#undef EXPORT_API
#define EXPORT_API __attribute__ ((visibility("default")))
-#endif
-#define _ERR(...) LOGE(__VA_ARGS__)
-#define _INFO(...) LOGI(__VA_ARGS__)
-#define _DBG(...) LOGD(__VA_ARGS__)
+#undef _ERR
+#define _ERR LOGE
+
+#undef _INFO
+#define _INFO LOGI
+
+#undef _DBG
+#define _DBG LOGD
{
struct timeval t;
- _retv_if(s == NULL || (s->tv_sec == 0 && s->tv_usec == 0), 0);
+ if (s == NULL || (s->tv_sec == 0 && s->tv_usec == 0))
+ return 0;
gettimeofday(&t, NULL);
char *s;
s = getenv(name ? : ENV_START);
- /*_retvm_if(s == NULL, -1, "%s is not set", name);*/
- _retv_if(s == NULL, -1);
+ if (s == NULL)
+ return -1;
r = sscanf(s, "%u/%u", (int *)&t->tv_sec, (int *)&t->tv_usec);
if (r != 2)
r = sscanf(s, "%u %u", (int *)&t->tv_sec, (int *)&t->tv_usec);
- _retv_if(r != 2, -1);
+ if (r != 2)
+ return -1;
return 0;
}
gettimeofday(&t, NULL);
r = __get_envtime(name, &s);
- _retv_if(r == -1, 0);
+ if (r == -1)
+ return 0;
return __get_msec(&s, &t);
}
EXPORT_API int appcore_unset_rotation_cb(void)
{
+ bool r;
+
if (rot.wm_rotate)
return rot.wm_rotate->unset_rotation_cb();
- else {
- bool r;
- _retv_if(rot.callback == NULL, 0);
+ if (rot.callback == NULL)
+ return 0;
- __del_rotlock();
+ __del_rotlock();
- if (rot.cb_set) {
- r = sensord_unregister_event(rot.handle,
- AUTO_ROTATION_CHANGE_STATE_EVENT);
- if (!r) {
- _ERR("sensord_unregister_event failed");
- return -1;
- }
- rot.cb_set = 0;
- }
- rot.callback = NULL;
- rot.cbdata = NULL;
-
- if (rot.sensord_started == 1) {
- r = sensord_stop(rot.handle);
- if (!r) {
- _ERR("sensord_stop failed");
- return -1;
- }
- rot.sensord_started = 0;
+ if (rot.cb_set) {
+ r = sensord_unregister_event(rot.handle,
+ AUTO_ROTATION_CHANGE_STATE_EVENT);
+ if (!r) {
+ _ERR("sensord_unregister_event failed");
+ return -1;
}
+ rot.cb_set = 0;
+ }
+ rot.callback = NULL;
+ rot.cbdata = NULL;
- r = sensord_disconnect(rot.handle);
+ if (rot.sensord_started == 1) {
+ r = sensord_stop(rot.handle);
if (!r) {
- _ERR("sensord_disconnect failed");
+ _ERR("sensord_stop failed");
return -1;
}
- rot.handle = -1;
+ rot.sensord_started = 0;
+ }
+
+ r = sensord_disconnect(rot.handle);
+ if (!r) {
+ _ERR("sensord_disconnect failed");
+ return -1;
}
+ rot.handle = -1;
return 0;
}
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2017 - 2020 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.
#include "appcore_base.h"
#include "appcore_multiwindow_base.h"
-#ifndef EXPORT_API
-# define EXPORT_API __attribute__ ((visibility("default")))
-#endif
+#undef LOG_TAG
+#define LOG_TAG "APP_CORE_MULTIWINDOW_BASE"
+
+#undef EXPORT_API
+#define EXPORT_API __attribute__ ((visibility("default")))
-#ifndef _DLOG_H_
-# define _ERR(fmt, arg...) \
- do { fprintf(stderr, "appcore: "fmt"\n", ##arg); } while (0)
+#undef _ERR
+#define _ERR LOGE
-# define _INFO(fmt, arg...) \
- do { fprintf(stdout, fmt"\n", ##arg); } while (0)
+#undef _INFO
+#define _INFO LOGI
-# define _DBG(fmt, arg...) \
- do { \
- if (getenv("APPCORE_DEBUG")) { \
- fprintf(stdout, fmt"\n", ##arg); \
- } \
- } while (0)
-#else
-# define _ERR(fmt, arg...) \
- do { \
- fprintf(stderr, "appcore: "fmt"\n", ##arg); \
- LOGE(fmt, ##arg); \
- } while (0)
-# define _INFO(...) LOGI(__VA_ARGS__)
-# define _DBG(...) LOGD(__VA_ARGS__)
-#endif
+#undef _DBG
+#define _DBG LOGD
typedef struct _appcore_multiwindow_base_context {
appcore_multiwindow_base_ops ops;
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2016 - 2020 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.
#pragma once
-#define LOG_TAG "APP_CORE_UI_BASE"
-
-#include <stdio.h>
-#include <stdbool.h>
#include <dlog.h>
-#ifndef EXPORT_API
-# define EXPORT_API __attribute__ ((visibility("default")))
-#endif
-
-#ifndef _DLOG_H_
-# define _ERR(fmt, arg...) \
- do { fprintf(stderr, "appcore: "fmt"\n", ##arg); } while (0)
+#undef LOG_TAG
+#define LOG_TAG "APP_CORE_UI_BASE"
-# define _INFO(fmt, arg...) \
- do { fprintf(stdout, fmt"\n", ##arg); } while (0)
+#undef EXPORT_API
+#define EXPORT_API __attribute__ ((visibility("default")))
-# define _DBG(fmt, arg...) \
- do { \
- if (getenv("APPCORE_DEBUG")) { \
- fprintf(stdout, fmt"\n", ##arg); \
- } \
- } while (0)
-#else
-# define _ERR(fmt, arg...) \
- do { \
- fprintf(stderr, "appcore: "fmt"\n", ##arg); \
- LOGE(fmt, ##arg); \
- } while (0)
-# define _INFO(...) LOGI(__VA_ARGS__)
-# define _DBG(...) LOGD(__VA_ARGS__)
-#endif
+#undef _ERR
+#define _ERR LOGE
+#undef _INFO
+#define _INFO LOGI
+#undef _DBG
+#define _DBG LOGD