modifided ua-manager
authorsaerome kim <saerome.kim@samsung.com>
Thu, 24 Jan 2019 06:14:44 +0000 (15:14 +0900)
committer김새롬/Tizen Platform Lab(SR)/Staff Engineer/삼성전자 <saerome.kim@samsung.com>
Thu, 24 Jan 2019 06:59:33 +0000 (15:59 +0900)
- aligned with error codes with user-awareness
- make 'req_vd' feature as default disable

Signed-off-by: saerome kim <saerome.kim@samsung.com>
include/ua-api.h
packaging/ua-manager.conf [new file with mode: 0644]
packaging/ua-manager.spec

index 04ecbdd..4e8ddc4 100644 (file)
 #define __UAM_API_H__
 
 #include <gmodule.h>
+#include <tizen_error.h>
+
+#ifndef TIZEN_ERROR_UA
+#define TIZEN_ERROR_UA 0x10000000 /**< To-Do: This should move to tizen_error.h */
+#endif
 
 #ifdef __cplusplus
 extern "C" {
@@ -66,18 +71,18 @@ typedef enum {
 } uam_event_e;
 
 #define FOREACH_ERROR(ERROR) \
-       ERROR(UAM_ERROR_NONE, 0x00) \
-       ERROR(UAM_ERROR_INTERNAL, 0x01) \
-       ERROR(UAM_ERROR_TIMEOUT, 0x02) \
-       ERROR(UAM_ERROR_ALREADY_REGISTERED, 0x03) \
-       ERROR(UAM_ERROR_NOT_REGISTERED, 0x04) \
-       ERROR(UAM_ERROR_NOT_SUPPORTED, 0x05) \
-       ERROR(UAM_ERROR_NOT_IN_OPERATION, 0x06) \
-       ERROR(UAM_ERROR_INVALID_PARAM, 0x07) \
-       ERROR(UAM_ERROR_NOW_IN_PROGRESS, 0x08) \
-       ERROR(UAM_ERROR_ALREADY_DONE, 0x09) \
-       ERROR(UAM_ERROR_NOT_FOUND, 0x0A) \
-       ERROR(UAM_ERROR_DB_FAILED, 0x0B) \
+       ERROR(UAM_ERROR_NONE, TIZEN_ERROR_NONE) \
+       ERROR(UAM_ERROR_INVALID_PARAM, TIZEN_ERROR_INVALID_PARAMETER) \
+       ERROR(UAM_ERROR_TIMEOUT, TIZEN_ERROR_TIMED_OUT) \
+       ERROR(UAM_ERROR_NOW_IN_PROGRESS, TIZEN_ERROR_NOW_IN_PROGRESS) \
+       ERROR(UAM_ERROR_NOT_SUPPORTED, TIZEN_ERROR_NOT_SUPPORTED) \
+       ERROR(UAM_ERROR_NOT_REGISTERED, TIZEN_ERROR_UA | 0x0) \
+       ERROR(UAM_ERROR_NOT_IN_OPERATION, TIZEN_ERROR_UA | 0x02) \
+       ERROR(UAM_ERROR_ALREADY_DONE, TIZEN_ERROR_UA | 0x03) \
+       ERROR(UAM_ERROR_INTERNAL, TIZEN_ERROR_UA | 0x04) \
+       ERROR(UAM_ERROR_NOT_FOUND, TIZEN_ERROR_UA | 0x10) \
+       ERROR(UAM_ERROR_ALREADY_REGISTERED, TIZEN_ERROR_UA | 0x11) \
+       ERROR(UAM_ERROR_DB_FAILED, TIZEN_ERROR_UA | 0x12) \
 
 #define GENERATE_ERROR_ENUM(ENUM, offset) ENUM = -offset,
 #define GENERATE_ERROR_STRING(STRING, offset) #STRING,
diff --git a/packaging/ua-manager.conf b/packaging/ua-manager.conf
new file mode 100644 (file)
index 0000000..d318174
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+
+<busconfig>
+        <policy user="network_fw">
+                <allow own="net.uamd"/>
+        </policy>
+       <policy context="default">
+               <deny own="net.uamd"/>
+               <allow send_destination="net.uamd"/>
+       </policy>
+</busconfig>
+
index 500cdbf..b815990 100644 (file)
@@ -11,7 +11,6 @@ Source1001: ua-manager.manifest
 
 %define database_full_path /opt/usr/dbspace/.ua-manager-data.db
 %define config_file_path /opt/usr/data/ua
-%define vd_req ENABLED
 
 BuildRequires:  cmake
 BuildRequires:  pkgconfig(dlog)
@@ -21,7 +20,8 @@ BuildRequires:  pkgconfig(gio-unix-2.0)
 BuildRequires:  pkgconfig(libtzplatform-config)
 BuildRequires:  pkgconfig(sqlite3)
 BuildRequires:  pkgconfig(json-c)
-%if %{vd_req} == ENABLED
+
+%if 0%{?vd_req:1}
 BuildRequires:  pkgconfig(vconf)
 BuildRequires:  pkgconfig(deviced)
 %endif
@@ -58,7 +58,7 @@ This package contains User Awareness manager.
 cp %{SOURCE1001} .
 
 %build
-%if %{vd_req} == ENABLED
+%if 0%{?vd_req:1}
 export CFLAGS="$CFLAGS -DVD_REQ"
 %endif
 
@@ -84,6 +84,9 @@ mkdir -p %{buildroot}%{_unitdir}/multi-user.target.wants
 install -m 0644 packaging/ua-manager.service %{buildroot}%{_unitdir}/ua-manager.service
 ln -s ../ua-manager.service %{buildroot}%{_unitdir}/multi-user.target.wants/ua-manager.service
 
+mkdir -p %{buildroot}/etc/dbus-1/system.d/
+cp -af %{_builddir}/%{name}-%{version}/packaging/ua-manager.conf %{buildroot}/etc/dbus-1/system.d/
+
 %post -p /sbin/ldconfig
 
 %postun -p /sbin/ldconfig
@@ -106,7 +109,9 @@ ln -s ../ua-manager.service %{buildroot}%{_unitdir}/multi-user.target.wants/ua-m
 %files plugins
 %defattr(-, root, root)
 %{_includedir}/ua-manager/ua-plugin.h
+%if 0%{?vd_req:1}
 %{_includedir}/ua-manager/ua-power-plugin.h
+%endif
 %{_libdir}/pkgconfig/ua-plugins.pc
 
 %files daemon
@@ -118,4 +123,5 @@ ln -s ../ua-manager.service %{buildroot}%{_unitdir}/multi-user.target.wants/ua-m
 %{_unitdir}/multi-user.target.wants/ua-manager.service
 %{_unitdir}/ua-manager.service
 %{_datadir}/dbus-1/system-services/net.uamd.service
+%attr(644,root,root) %{_sysconfdir}/dbus-1/system.d/ua-manager.conf
 %{config_file_path}/uam-config.json