BuildRequires: pkgconfig(dbus-glib-1)
BuildRequires: pkgconfig(dlog)
Requires: dbus
+Provides: %{name}-profile_common = %{version}-%{release}
+Provides: %{name}-profile_mobile = %{version}-%{release}
+Provides: %{name}-profile_ivi = %{version}-%{release}
+Provides: %{name}-profile_wearable = %{version}-%{release}
%description
Description: SDB daemon.
+%package profile_tv
+Summary: SDB daemon extension for TV
+Requires: %{name} = %{version}-%{release}
+%description profile_tv
+SDB daemon extension for TV.
+This changes the service unit files of the default SDB daemon service files.
+
%package -n sdbd-devel
Summary: SDBD plugin API
Group: Development/Libraries
cp %{SOURCE1003} .
%build
-%if "%{?tizen_profile_name}" == "wearable"
-%define wearable_profile on
-%else
-%define wearable_profile off
-%endif
+
+# DO YOU REALLY SURE THAT x86 is never going to be non-emulator?
%if %{with emulator}
%define target_arch x86
%else
%define target_arch arm
%endif
+
cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \
- -DWEARABLE_PROFILE=%{wearable_profile} \
-DTARGET_ARCH=%{target_arch}
make %{?jobs:-j%jobs}
mkdir -p %{buildroot}%{_unitdir}
%if %{with emulator}
-%if "%{profile}" == "tv"
-install -m 0644 %SOURCE1006 %{buildroot}%{_unitdir}/sdbd.service
-%else
+install -m 0644 %SOURCE1006 %{buildroot}%{_unitdir}/sdbd.service.tv
install -m 0644 %SOURCE1002 %{buildroot}%{_unitdir}/sdbd.service
-%endif
mkdir -p %{buildroot}/%{_unitdir}/emulator_preinit.target.wants
ln -s %{_unitdir}/sdbd.service %{buildroot}/%{_unitdir}/emulator_preinit.target.wants/
%else
-%if "%{profile}" == "tv"
-install -m 0644 %SOURCE1005 %{buildroot}%{_unitdir}/sdbd.service
-%else
+install -m 0644 %SOURCE1005 %{buildroot}%{_unitdir}/sdbd.service.tv
install -m 0644 %SOURCE1001 %{buildroot}%{_unitdir}/sdbd.service
-%endif
install -m 0644 %SOURCE1004 %{buildroot}%{_unitdir}/sdbd_tcp.service
mkdir -p %{buildroot}/%{_unitdir}/multi-user.target.wants
ln -s %{_unitdir}/sdbd.service %{buildroot}/%{_unitdir}/multi-user.target.wants/
/usr/share/license/%{name}
%{TZ_SYS_BIN}/profile_command
+%post profile_tv
+pushd {%_unitdir}
+mv sdbd.service.tv sdbd.service
+popd
+%preun profile_tv
+pushd {%_unitdir}
+cp sdbd.service sdbd.service.tv
+echo For correct bahavior of %{name} after uninstalling %{name}-profile_tv, you need to reinstall %{name}
+popd
+%files profile_tv
+%{_unitdir}/sdbd.service.tv
+
%files -n sdbd-devel
%{_includedir}/sdb/sdbd_plugin.h
%{_libdir}/pkgconfig/sdbd.pc
#include "sdbd_plugin.h"
#include "default_plugin.h"
+#include <system_info.h>
+
+typedef enum {
+ TIZEN_PROFILE_UNKNOWN = 0,
+ TIZEN_PROFILE_MOBILE = 0x1,
+ TIZEN_PROFILE_WEARABLE = 0x2,
+ TIZEN_PROFILE_TV = 0x4,
+ TIZEN_PROFILE_IVI = 0x8,
+ TIZEN_PROFILE_COMMON = 0x10,
+} tizen_profile_t;
+static tizen_profile_t profile = TIZEN_PROFILE_UNKNOWN;
+static tizen_profile_t _get_tizen_profile()
+{
+ char *profileName;
+ system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
+ switch (*profileName) {
+ case 'm':
+ case 'M':
+ profile = TIZEN_PROFILE_MOBILE;
+ break;
+ case 'w':
+ case 'W':
+ profile = TIZEN_PROFILE_WEARABLE;
+ break;
+ case 't':
+ case 'T':
+ profile = TIZEN_PROFILE_TV;
+ break;
+ case 'i':
+ case 'I':
+ profile = TIZEN_PROFILE_IVI;
+ break;
+ default: // common or unknown ==> ALL ARE COMMON.
+ profile = TIZEN_PROFILE_COMMON;
+ }
+ free(profileName);
+
+ return profile;
+}
+static inline tizen_profile_t get_tizen_profile()
+{
+ if (__builtin_expect(profile != TIZEN_PROFILE_UNKNOWN, 1))
+ return profile;
+
+ return _get_tizen_profile();
+}
+
int plugin_pwlocked ( void )
{
int pwlock_status = 0;
pwlock_status = 0;
PLUGIN_LOG ( "failed to get pw lock status\n" );
}
-#ifdef _WEARABLE
- PLUGIN_LOG ( "wearable lock applied\n" );
- // for wearable which uses different VCONF key (lock type)
- if ( vconf_get_int ( VCONFKEY_SETAPPL_PRIVACY_LOCK_TYPE_INT, &pwlock_type ) ) {
- pwlock_type = 0;
- PLUGIN_LOG ( "failed to get pw lock type\n" );
- }
- if ( ( pwlock_status == VCONFKEY_IDLE_LOCK ) && ( pwlock_type != SETTING_PRIVACY_LOCK_TYPE_NONE ) ) {
- PLUGIN_LOG ( "device has been locked\n" );
- return 1; // locked!
- }
-#else
- PLUGIN_LOG ( "mobile lock applied\n" );
- // for mobile
- if ( vconf_get_int ( VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &pwlock_type ) ) {
- pwlock_type = 0;
- PLUGIN_LOG ( "failed to get pw lock type\n" );
- }
- if ( pwlock_status == VCONFKEY_IDLE_LOCK && ( ( pwlock_type != SETTING_SCREEN_LOCK_TYPE_NONE ) && ( pwlock_type != SETTING_SCREEN_LOCK_TYPE_SWIPE ) ) ) {
- PLUGIN_LOG ( "device has been locked\n" );
- return 1; // locked!
+ if (get_tizen_profile() == TIZEN_PROFILE_WEARABLE) {
+ PLUGIN_LOG ( "wearable lock applied\n" );
+ // for wearable which uses different VCONF key (lock type)
+ if ( vconf_get_int ( VCONFKEY_SETAPPL_PRIVACY_LOCK_TYPE_INT, &pwlock_type ) ) {
+ pwlock_type = 0;
+ PLUGIN_LOG ( "failed to get pw lock type\n" );
+ }
+ if ( ( pwlock_status == VCONFKEY_IDLE_LOCK ) && ( pwlock_type != SETTING_PRIVACY_LOCK_TYPE_NONE ) ) {
+ PLUGIN_LOG ( "device has been locked\n" );
+ return 1; // locked!
+ }
+ } else {
+ PLUGIN_LOG ( "mobile lock applied\n" );
+ // for mobile
+ if ( vconf_get_int ( VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &pwlock_type ) ) {
+ pwlock_type = 0;
+ PLUGIN_LOG ( "failed to get pw lock type\n" );
+ }
+ if ( pwlock_status == VCONFKEY_IDLE_LOCK && ( ( pwlock_type != SETTING_SCREEN_LOCK_TYPE_NONE ) && ( pwlock_type != SETTING_SCREEN_LOCK_TYPE_SWIPE ) ) ) {
+ PLUGIN_LOG ( "device has been locked\n" );
+ return 1; // locked!
+ }
}
-#endif
return 0; // unlocked!
}