Make ode-external-lock a user service 14/209414/2 accepted/tizen/unified/20190820.115127 submit/tizen/20190816.084956
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Fri, 5 Jul 2019 15:20:33 +0000 (17:20 +0200)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Mon, 22 Jul 2019 12:38:50 +0000 (14:38 +0200)
The ode-external-lock service is made a user service so that it's
launched when UI is ready. It is path activated.

Use aul API (user session only) to detect the fact of homescreen being active.

Change-Id: I8f67ad05abca341e491ae88ed00f488fc93fcc1b

ode/CMakeLists.txt
ode/service/ode-external-lock.path [new file with mode: 0644]
ode/service/ode-external-lock.service.in
ode/src/ode.cpp
packaging/ode-ui.spec

index 6dfec3e7571c192c9e8d4efc4613faea3153d6fa..ed300449ec449e4b4e0451eed7fa086ce0b41d17 100755 (executable)
@@ -8,6 +8,7 @@ PKG_CHECK_MODULES(ode_pkgs REQUIRED
                capi-system-runtime-info
                capi-system-device
                capi-system-system-settings
+               aul
 )
 
 INCLUDE_DIRECTORIES(${EFL_APP_INCLUDE_DIRS} ${ode_pkgs_INCLUDE_DIRS} ${ODE_LIB})
@@ -85,6 +86,6 @@ CONFIGURE_FILE(service/ode-progress-ui@.service.in service/ode-progress-ui@.serv
 INSTALL(FILES service/ode-progress-ui@.service DESTINATION ${SYSTEMD_UNIT_DIR})
 
 CONFIGURE_FILE(service/ode-external-lock.service.in service/ode-external-lock.service)
-INSTALL(FILES service/ode-external-lock.service DESTINATION ${SYSTEMD_UNIT_DIR})
+INSTALL(FILES service/ode-external-lock.service service/ode-external-lock.path DESTINATION ${SYSTEMD_UNIT_DIR_USER})
 
 ADD_SUBDIRECTORY(po)
diff --git a/ode/service/ode-external-lock.path b/ode/service/ode-external-lock.path
new file mode 100644 (file)
index 0000000..8d40285
--- /dev/null
@@ -0,0 +1,6 @@
+[Unit]
+Description=Path activator used to launch encrypted sdcard UI
+
+[Path]
+PathModified=/run/ode-booting-with-encrypted-sdcard
+PathExists=/run/ode-booting-with-encrypted-sdcard
index b05bcb46a7f557cc42954a034711f363143fb0d1..7649cfb0a37cd1f1e209ae28cc62f1103a8bff99 100644 (file)
@@ -1,10 +1,8 @@
 [Unit]
 Description=ODE external storage lock interface
+DefaultDependencies=no
 
 [Service]
-User=application
-Group=application
-SmackProcessLabel=System
 EnvironmentFile=/run/tizen-system-env
 EnvironmentFile=/run/xdg-root-env
 ExecStart=/usr/bin/ode lock
index d99048ed5f12b1b8b2c5a63f1ddd7d40548161a1..dd37d4f71930dcd243b7f9fd214aabe7591b5f72 100644 (file)
  */
 #include "ode.h"
 
+#include <unistd.h>
+
+#include <aul.h>
+
 ODELaunchPad::ODELaunchPad()
        : Application("org.tizen.ode"), viewtype(""), mode(0), interface(nullptr)
 {
@@ -131,6 +135,20 @@ void ODEStandAlone::createProgressInterface(const std::string &type, const std::
 
 void ODEStandAlone::createPasswordInterface()
 {
+       char *homescreenApp = ::vconf_get_str(VCONFKEY_SETAPPL_SELECTED_PACKAGE_NAME);
+       if (homescreenApp)
+       {
+               int status;
+               for(;;) {
+                       status = ::aul_app_get_status(homescreenApp);
+                       if (status == STATUS_VISIBLE || status == STATUS_FOCUS)
+                               break;
+                       sleep(1);
+               }
+
+               free(homescreenApp);
+       }
+
        interface.reset(new PasswordSDCard{});
 
        if (interface)
index e7fd1a67b333b4020dfb72162966db5cf4da2be3..0f2a0ef799e809a74cd681059ff96374f85fefe6 100755 (executable)
@@ -36,6 +36,7 @@ The ode-ui package provides reference applications which are responsible for enc
          -DCMAKE_BUILD_TYPE=%{build_type} \
          -DBIN_DIR=%{TZ_SYS_BIN} \
          -DSYSTEMD_UNIT_DIR=%{_unitdir} \
+         -DSYSTEMD_UNIT_DIR_USER=%{_unitdir_user} \
          -DAPP_INSTALL_PREFIX="%{TZ_SYS_RO_APP}" \
          -DAPP_SHARE_PACKAGES_DIR="%{TZ_SYS_RO_PACKAGES}"
 
@@ -46,6 +47,10 @@ make %{?jobs:-j%jobs}
 
 %find_lang secure-erase
 %find_lang ode
+
+mkdir -p %{buildroot}/%{_unitdir_user}/default.target.wants
+ln -s ../ode-external-lock.path  %{buildroot}/%{_unitdir_user}/default.target.wants/ode-external-lock.path
+
 %clean
 rm -rf %{buildroot}
 
@@ -86,7 +91,9 @@ ln -sf %{odeapp_home}/bin/org.tizen.ode /usr/bin/ode
 %{odeapp_home}/res/*
 %{TZ_SYS_RO_PACKAGES}/org.tizen.ode.xml
 %{_unitdir}/ode-progress-ui@.service
-%{_unitdir}/ode-external-lock.service
+%{_unitdir_user}/ode-external-lock.service
+%{_unitdir_user}/ode-external-lock.path
+%{_unitdir_user}/default.target.wants/ode-external-lock.path
 
 ## Secure Erase Application Package ################################
 %package -n org.tizen.secure-erase