BuildRequires: gettext-tools
BuildRequires: pkgconfig(klay)
BuildRequires: pkgconfig(glib-2.0)
-BuildRequires: pkgconfig(libxml-2.0)
+BuildRequires: pkgconfig(aul)
+BuildRequires: pkgconfig(bundle)
BuildRequires: pkgconfig(libtzplatform-config)
BuildRequires: pkgconfig(key-manager)
BuildRequires: pkgconfig(cynara-client)
-DCMAKE_BUILD_TYPE=%{build_type} \
-DRUN_DIR=%{TZ_SYS_RUN} \
-DBIN_DIR=%{TZ_SYS_BIN} \
- -DSYSTEMD_UNIT_DIR=%{_unitdir}
+ -DSYSTEMD_UNIT_DIR=%{_unitdir} \
+ -DAPP_INSTALL_PREFIX="%{TZ_SYS_RO_APP}" \
+ -DAPP_SHARE_PACKAGES_DIR="%{TZ_SYS_RO_PACKAGES}"
make %{?jobs:-j%jobs}
%manifest ode.manifest
%defattr(644,root,root,755)
%attr(755,root,root) %{_bindir}/ode-engine-unit-tests
+
+## ODE App package #############################################################
+%package -n org.tizen.ode-gui
+Summary: Tizen ODE User Interface
+Group: Security/Other
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(evas)
+BuildRequires: pkgconfig(elementary)
+BuildRequires: pkgconfig(efl-extension)
+BuildRequires: pkgconfig(capi-ui-efl-util)
+BuildRequires: pkgconfig(capi-appfw-app-control)
+BuildRequires: pkgconfig(capi-appfw-application)
+
+%description -n org.tizen.ode-gui
+Tizen ODE User Interface for device policy management
+
+%define odeapp_home %{TZ_SYS_RO_APP}/org.tizen.ode-gui
+
+%post -n org.tizen.ode-gui
+ln -sf %{odeapp_home}/bin/org.tizen.ode-gui /usr/bin/ode-gui
+
+%files -n org.tizen.ode-gui
+%defattr(-,root,root,-)
+%{odeapp_home}/bin/*
+%{odeapp_home}/res/*
+%{TZ_SYS_RO_PACKAGES}/org.tizen.ode-gui.xml
#
SET(SERVER_SRCS main.cpp
server.cpp
+ launchpad.cpp
ext4-tool.cpp
+ app-bundle.cpp
secure-erase.cpp
block-device.cpp
internal-encryption.cpp
SET(DEPENDENCY klay
glib-2.0
gio-2.0
- libxml-2.0
+ aul
+ bundle
libtzplatform-config
cynara-client
cynara-session
--- /dev/null
+/*
+ * Copyright (c) 2015 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
+ */
+#include <memory>
+
+#include <klay/exception.h>
+
+#include "app-bundle.h"
+
+AppBundle::AppBundle() :
+ handle(nullptr)
+{
+ handle = ::bundle_create();
+ if (handle == nullptr) {
+ throw runtime::Exception("Failed to create bundle");
+ }
+}
+
+AppBundle::~AppBundle()
+{
+ ::bundle_free(handle);
+}
+
+void AppBundle::addInternal(const std::string& key, const std::string& value)
+{
+ ::bundle_add_str(handle, key.c_str(), value.c_str());
+}
+
+void AppBundle::addArrayInternal(const std::string& key, const std::vector<std::string>& array)
+{
+ std::unique_ptr<const char*[]> arrayptr(new const char*[array.size()]);
+
+ int index = 0;
+ for (const std::string& data : array) {
+ arrayptr.get()[index++] = data.c_str();
+ }
+
+ ::bundle_add_str_array(handle, key.c_str(), arrayptr.get(), array.size());
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 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 __DPM_APP_BUNDLE_H__
+#define __DPM_APP_BUNDLE_H__
+
+#include <string>
+#include <vector>
+
+#include <bundle.h>
+
+class AppBundle {
+public:
+ AppBundle();
+ ~AppBundle();
+
+ template<typename T>
+ void add(const std::string& key, const std::vector<T>& value)
+ {
+ addArrayInternal(key, value);
+ }
+
+ template<typename T>
+ void add(const std::string& key, const T& value)
+ {
+ addInternal(key, value);
+ }
+
+ bundle* get() const
+ {
+ return handle;
+ }
+
+private:
+ void addInternal(const std::string& key, const std::string& value);
+ void addArrayInternal(const std::string& key, const std::vector<std::string>& array);
+
+private:
+ bundle* handle;
+};
+
+#endif //__DPM_APP_BUNDLE_H__
#include <klay/filesystem.h>
#include <klay/audit/logger.h>
+#include "launchpad.h"
+#include "app-bundle.h"
#include "engine/ecryptfs-engine.h"
#include "key-manager/key-manager.h"
}
}
+void showProgressUI(const std::string type) {
+ AppBundle bundle;
+ bundle.add("mode", "progress");
+ bundle.add("type", type);
+ bundle.add("target", "SD card encryption");
+
+ Launchpad launchpad(::tzplatform_getuid(TZ_SYS_DEFAULT_USER));
+ launchpad.launch("org.tizen.ode-gui", bundle);
+}
+
}
ExternalEncryption::ExternalEncryption(ODEControlContext& ctx) :
KeyManager::data DEK = keyManager.getDEK(pwData);
auto encryptWorker = [DEK, this]() {
+ showProgressUI("Encrypting");
+
INFO("Close all applications using external storage...");
killDependedApplications();
INFO("Encryption started...");
KeyManager::data DEK = keyManager.getDEK(pwData);
auto decryptWorker = [DEK, this]() {
+ showProgressUI("Decrypting");
+
INFO("Close all applications using external storage...");
killDependedApplications();
INFO("Umount internal storage...");
#include <sys/mount.h>
#include <sys/reboot.h>
+#include <klay/process.h>
#include <klay/file-user.h>
#include <klay/filesystem.h>
#include <klay/dbus/connection.h>
}
}
+void showProgressUI(const std::string type) {
+ std::vector<std::string> args = {
+ "ode-gui", "progress", type, "Internal storage encryption"
+ };
+
+ runtime::Process proc("/usr/bin/ode-gui", args);
+ proc.execute();
+}
+
}
InternalEncryption::InternalEncryption(ODEControlContext& ctx) :
KeyManager::data DEK = keyManager.getDEK(pwData);
auto encryptWorker = [DEK, this]() {
+ showProgressUI("Encrypting");
+
INFO("Close all processes using internal storage...");
stopDependedSystemdServices();
INFO("Umount internal storage...");
break;
}
}
+
INFO("Encryption started...");
engine.encrypt(DEK);
INFO("Sync disk...");
KeyManager::data DEK = keyManager.getDEK(pwData);
auto decryptWorker = [DEK, this]() {
+ showProgressUI("Decrypting");
+
INFO("Close all processes using internal storage...");
stopDependedSystemdServices();
INFO("Umount internal storage...");
try {
engine.umount();
} catch (runtime::Exception& e) {}
+
INFO("Decryption started...");
engine.decrypt(DEK);
INFO("Sync disk...");
--- /dev/null
+/*
+ * Copyright (c) 2015 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
+ */
+#include <unistd.h>
+#include <signal.h>
+#include <sys/types.h>
+
+#include <aul.h>
+#include <klay/exception.h>
+#include <klay/audit/logger.h>
+
+#include "launchpad.h"
+
+Launchpad::Launchpad(const uid_t uid) :
+ user(uid)
+{
+ if (user == 0) {
+ throw runtime::Exception("No logined user for launching app");
+ }
+}
+
+bool Launchpad::isRunning(const std::string& appid)
+{
+ return ::aul_app_is_running_for_uid(appid.c_str(), user);
+}
+
+void Launchpad::launch(const std::string& appid)
+{
+ launch(appid, AppBundle());
+}
+
+void Launchpad::launch(const std::string& appid, const AppBundle& bundle)
+{
+ if (::aul_launch_app_for_uid(appid.c_str(), bundle.get(), user) < 0) {
+ throw runtime::Exception("Failed to launch app " + appid);
+ }
+}
+
+void Launchpad::resume(const std::string& appid)
+{
+ if (::aul_resume_app_for_uid(appid.c_str(), user) < 0) {
+ throw runtime::Exception("Failed to resume app " + appid);
+ }
+}
+
+void Launchpad::terminate(const std::string& appid)
+{
+ int pid = ::aul_app_get_pid_for_uid(appid.c_str(), user);
+ if (pid > 0) {
+ if (::aul_terminate_pid_for_uid(pid, user) < 0) {
+ WARN("Failed to terminate app PID=" + std::to_string(pid));
+ ::kill(pid, SIGKILL);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 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 __DPM_LAUNCHPAD_H__
+#define __DPM_LAUNCHPAD_H__
+
+#include <string>
+
+#include "app-bundle.h"
+
+class Launchpad {
+public:
+ Launchpad(const uid_t uid = 0);
+ Launchpad(const Launchpad&) = delete;
+ Launchpad(Launchpad&&) = delete;
+
+ void launch(const std::string& appid);
+ void launch(const std::string& appid, const AppBundle& bundle);
+ void resume(const std::string& appid);
+ bool isRunning(const std::string& appid);
+ void terminate(const std::string& appid);
+
+private:
+ uid_t user;
+};
+
+#endif //__DPM_LAUNCHPAD_H__
CapabilityBoundingSet=~CAP_MAC_ADMIN
CapabilityBoundingSet=~CAP_MAC_OVERRIDE
CapabilityBoundingSet=~CAP_DAC_OVERRIDE
+EnvironmentFile=/run/tizen-system-env
+EnvironmentFile=/run/xdg-root-env
[Install]
WantedBy=multi-user.target
# limitations under the License.
#
-#SET(ODE_APPS ${ODE_TOOLS}/apps)
+SET(ODE_APPS ${ODE_TOOLS}/apps)
SET(ODE_CLI ${ODE_TOOLS}/cli)
-#ADD_SUBDIRECTORY(${ODE_APPS})
+ADD_SUBDIRECTORY(${ODE_APPS})
ADD_SUBDIRECTORY(${ODE_CLI})
--- /dev/null
+#
+# Copyright (c) 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.
+#
+
+FIND_PACKAGE(PkgConfig REQUIRED)
+PKG_CHECK_MODULES(EFL_APP REQUIRED
+ dlog
+ glib-2.0
+ bundle
+ efl-extension
+ elementary
+ capi-appfw-application
+ capi-ui-efl-util
+ evas
+)
+
+SET(ODE_APPS_ODE ${ODE_APPS}/ode)
+
+ADD_SUBDIRECTORY(${ODE_APPS_ODE})
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(org.tizen.ode-gui C)
+
+INCLUDE_DIRECTORIES(${EFL_APP_INCLUDE_DIRS} ${ODE_LIB} include)
+LINK_DIRECTORIES(${EFL_APP_LIBRARY_DIRS})
+
+SET(APP_SRCS
+ src/main.c
+ src/ui.c
+ src/widget.c
+)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIE")
+SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
+
+ADD_EXECUTABLE(${PROJECT_NAME} ${APP_SRCS})
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${APP_INSTALL_PREFIX}/${PROJECT_NAME}/bin)
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${EFL_APP_LIBRARIES} ode)
+
+ADD_CUSTOM_TARGET(${PROJECT_NAME}.edj
+ COMMAND edje_cc -no-save -id ${CMAKE_CURRENT_SOURCE_DIR}/res/images
+ ${CMAKE_CURRENT_SOURCE_DIR}/res/edje/${PROJECT_NAME}.edc
+ ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.edj
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/res/edje/${PROJECT_NAME}.edc)
+
+ADD_DEPENDENCIES(${PROJECT_NAME} ${PROJECT_NAME}.edj)
+INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.edj DESTINATION ${APP_INSTALL_PREFIX}/${PROJECT_NAME}/res)
+
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.xml DESTINATION ${APP_SHARE_PACKAGES_DIR})
--- /dev/null
+/*
+ * Tizen Krate Setup-Wizard application
+ *
+ * Copyright (c) 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 __ODE_H__
+#define __ODE_H__
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+#include <app.h>
+#include <app_common.h>
+#include <bundle.h>
+#include <dlog.h>
+#include <Elementary.h>
+#include <efl_extension.h>
+
+#include "text.h"
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "ODE"
+
+#if !defined(PACKAGE)
+#define PACKAGE "org.tizen.ode-gui"
+#endif
+
+void _create_base_window();
+void _create_progress_view(const char *type, const char *target);
+
+#endif /* __ODE_H__ */
--- /dev/null
+/*
+ * Tizen Krate Setup-Wizard application
+ *
+ * Copyright (c) 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 __TEXT_H__
+#define __TEXT_H__
+
+#define SUB_TITLE_STYLE_B "DEFAULT='font=Tizen:style=Regular font_size=50 color=#000000 wrap=mixed align=center'"
+#define SUB_CONTENT_STYLE_B "DEFAULT='font=Tizen:style=Regular font_size=36 color=#000000 wrap=mixed'"
+
+#define SUB_TITLE_STYLE_W "DEFAULT='font=Tizen:style=Regular font_size=50 color=#ffffff wrap=mixed align=center'"
+#define SUB_CONTENT_STYLE_W "DEFAULT='font=Tizen:style=Regular font_size=36 color=#ffffff wrap=mixed'"
+
+#define ENTRY_TITLE_STYLE_B "DEFAULT='font=Tizen:style=Regular font_size=36 color=#000000 wrap=mixed'"
+#define ENTRY_INFO_STYLE_G "DEFAULT='font=Tizen:style=Regular font_size=32 color=#A9A9A9 wrap=mixed'"
+
+#define PROGRESS_MESSAGE_TITLE "%s..."
+#define PROGRESS_MESSAGE_CONTENT "Wait until %s is completed."
+
+#endif /*__TEXT_H__*/
--- /dev/null
+/*
+ * Tizen Krate Setup-Wizard application
+ *
+ * Copyright (c) 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 WIDGET_H_
+#define WIDGET_H_
+
+#include <app.h>
+#include <dlog.h>
+#include <Elementary.h>
+#include <efl_extension.h>
+
+Evas_Object *_create_win(const char *package);
+Evas_Object *_create_conformant(Evas_Object *parent);
+Evas_Object *_create_layout(Evas_Object *parent, char *file, const char *group);
+Evas_Object *_create_button(Evas_Object *parent, const char *text, Evas_Smart_Cb callback, void *user_data);
+Evas_Object *_create_textblock(Evas_Object *parent, const char *text, char *style);
+Evas_Object *_create_progressbar(Evas_Object *parent, const char *style);
+
+#endif /* WIDGET_H_ */
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_" />
+ </request>
+</manifest>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" api-version="3.0" package="org.tizen.ode-gui" version="1.0.0">
+ <profile name="mobile"/>
+ <privileges>
+ </privileges>
+ <ui-application appid="org.tizen.ode-gui" exec="/usr/apps/org.tizen.ode-gui/bin/org.tizen.ode-gui" multiple="false" nodisplay="false" taskmanage="true" type="capp">
+ <label>ODE</label>
+ </ui-application>
+</manifest>
--- /dev/null
+/*
+ * Copyright (c) 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.
+ *
+ */
+
+collections {
+ base_scale: 1.8;
+ #include "progress.edc"
+}
--- /dev/null
+/*
+ * Tizen Krate Setup-Wizard Layout
+ *
+ * Copyright (c) 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.
+ *
+ */
+group { name: "progress_layout";
+ parts {
+ part { name: "bg1";
+ type: RECT;
+ scale: 1;
+ description { state: "default" 0.0;
+ color: 55 166 184 255;
+ rel1 { relative: 0.0 0.0; }
+ rel2 { relative: 1.0 1.0; }
+ }
+ }
+ part { name: "bg2";
+ type: RECT;
+ scale: 1;
+ description { state: "default" 0.0;
+ color: 0 0 0 25;
+ rel1 { relative: 0.0 0.0; to: "bg1";}
+ rel2 { relative: 1.0 1.0; to: "bg1";}
+ }
+ }
+ part { name: "bg_top_padding";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ rel1 {relative: 0.0 0.0; to: "bg1";}
+ rel2 {relative: 1.0 0.0; to: "bg1"; offset: 0 160;}
+ }
+ }
+ part { name: "message_title";
+ type: SWALLOW;
+ scale: 1;
+ description { state: "default" 0.0;
+ rel1 { relative: 0.0 1.0; to: "bg_top_padding"; offset: 32 0;}
+ rel2 { relative: 1.0 1.0; to: "bg_top_padding"; offset: -32 67;}
+ }
+ }
+ part { name: "message_top_padding";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ rel1 { relative: 0.0 1.0; to: "message_title";}
+ rel2 { relative: 1.0 1.0; to: "message_title"; offset: 0 42;}
+ }
+ }
+ part { name: "progress_area";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ rel1 { relative: 0.0 1.0; to: "message_top_padding";}
+ rel2 { relative: 1.0 1.0; to: "message_top_padding"; offset: 0 114;}
+ }
+ }
+ part { name: "progress_top_padding";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; to: "progress_area";}
+ rel2 { relative: 1.0 0.0; to: "progress_area"; offset: 0 66;}
+ }
+ }
+ part { name: "progress_indicator";
+ type: SWALLOW;
+ scale: 1;
+ description { state: "default" 0.0;
+ rel1 { relative: 0.0 1.0; to: "progress_top_padding";}
+ rel2 { relative: 1.0 1.0; to: "progress_top_padding"; offset: 0 48;}
+ }
+ }
+ part { name: "progress_bottom_padding";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ rel1 { relative: 0.0 1.0; to: "progress_area";}
+ rel2 { relative: 1.0 1.0; to: "progress_area"; offset: 0 49;}
+ }
+ }
+ part { name: "message_content";
+ type: SWALLOW;
+ scale: 1;
+ description { state: "default" 0.0;
+ rel1 { relative: 0.0 1.0; to: "progress_bottom_padding";}
+ rel2 { relative: 1.0 1.0; to: "progress_bottom_padding"; offset: 0 208;}
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Tizen Krate Setup-Wizard application
+ *
+ * Copyright (c) 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.
+ *
+ */
+#include "ode.h"
+
+int launchpad_main(int argc, char *argv[]);
+int standalone_main(int argc, char *argv[]);
+
+struct submain {
+ const char* name;
+ int (*main)(int argc, char* argv[]);
+} submains[] = {
+ {
+ .name = PACKAGE,
+ .main = launchpad_main
+ },
+ {
+ .name = "ode-gui",
+ .main = standalone_main
+ },
+};
+
+static bool __app_create(void *data)
+{
+ return true;
+}
+
+static void __app_pause(void *data)
+{
+}
+
+static void __app_resume(void *data)
+{
+}
+
+static void __app_terminate(void *data)
+{
+}
+
+static void __app_control(app_control_h app_control, void *data)
+{
+ char *mode;
+ int ret = 0;
+
+ ret = app_control_get_extra_data(app_control, "mode", &mode);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Failed to get mode");
+ ui_app_exit();
+ return;
+ }
+
+ _create_base_window();
+
+ if (!strncmp(mode, "progress", sizeof("progress"))) {
+ char *type, *target;
+
+ ret = app_control_get_extra_data(app_control, "type", &type);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Failed to get type");
+ ui_app_exit();
+ return;
+ }
+ ret = app_control_get_extra_data(app_control, "target", &target);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Failed to get target");
+ ui_app_exit();
+ return;
+ }
+ _create_progress_view(type, target);
+ }
+}
+
+int launchpad_main(int argc, char *argv[])
+{
+ int ret = 0;
+
+ ui_app_lifecycle_callback_s event_callback = {0, };
+
+ event_callback.create = __app_create;
+ event_callback.terminate = __app_terminate;
+ event_callback.pause = __app_pause;
+ event_callback.resume = __app_resume;
+ event_callback.app_control = __app_control;
+
+ ret = ui_app_main(argc, argv, &event_callback, NULL);
+ if (ret != APP_ERROR_NONE)
+ dlog_print(DLOG_ERROR, LOG_TAG, "ui_app_main is failed. err = %d", ret);
+
+ return ret;
+}
+
+int standalone_main(int argc, char *argv[])
+{
+ setenv("HOME", "/root", 1);
+
+ if (argc <2) {
+ fprintf(stderr, "Other arguments is needed\n");
+ return EXIT_FAILURE;
+ }
+
+ elm_init(argc, argv);
+ _create_base_window();
+
+ if (!strncmp(argv[1], "progress", sizeof("progress"))) {
+ if (argc < 4) {
+ fprintf(stderr, "Other arguments is needed\n");
+ return EXIT_FAILURE;
+ }
+ _create_progress_view(argv[2], argv[3]);
+ }
+
+ elm_run();
+
+ return EXIT_SUCCESS;
+}
+
+int main(int argc, char* argv[])
+{
+ char *name = strrchr(argv[0], '/');
+ int i;
+
+ name = name ? name + 1 : argv[0];
+
+ for (i = 0; i < sizeof(submains) / sizeof(struct submain); i++) {
+ if (strcmp(name, submains[i].name) == 0) {
+ return submains[i].main(argc, argv);
+ }
+ }
+
+ return EXIT_FAILURE;
+}
--- /dev/null
+/*
+ * Tizen Krate Setup-Wizard application
+ *
+ * Copyright (c) 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.
+ *
+ */
+#include "ode.h"
+#include "widget.h"
+
+#define EDJ_PATH "/usr/apps/" PACKAGE "/res/" PACKAGE ".edj"
+
+static Evas_Object *win, *conform, *layout;
+
+void _create_base_window()
+{
+ /* Create main UI widget */
+ win = _create_win(PACKAGE);
+ conform = _create_conformant(win);
+ layout = _create_layout(conform, NULL, NULL);
+ elm_object_content_set(conform, layout);
+
+ evas_object_show(win);
+ return;
+}
+
+void _create_progress_view(const char *type, const char *target)
+{
+ Evas_Object *progress_layout;
+ Evas_Object *progressbar;
+ Evas_Object *title, *content;
+ char string[256];
+
+ progress_layout = _create_layout(layout, EDJ_PATH, "progress_layout");
+
+ snprintf(string, sizeof(string), PROGRESS_MESSAGE_TITLE, type);
+ title = _create_textblock(progress_layout, string, SUB_TITLE_STYLE_W);
+
+ snprintf(string, sizeof(string), PROGRESS_MESSAGE_CONTENT, target);
+ content = _create_textblock(progress_layout, string, SUB_CONTENT_STYLE_W);
+
+ elm_object_part_content_set(progress_layout, "message_title", title);
+
+ progressbar = _create_progressbar(progress_layout, "pending");
+ elm_object_part_content_set(progress_layout, "progress_indicator", progressbar);
+
+ elm_object_part_content_set(progress_layout, "message_content", content);
+
+ elm_object_part_content_set(layout, "elm.swallow.content", progress_layout);
+
+ return;
+}
--- /dev/null
+/*
+ * Tizen Krate Setup-Wizard application
+ *
+ * Copyright (c) 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.
+ *
+ */
+#include "widget.h"
+
+static void __win_delete_request_cb(void *data , Evas_Object *obj , void *event_info)
+{
+ ui_app_exit();
+}
+
+Evas_Object *_create_win(const char *package)
+{
+ Evas_Object *win;
+
+ elm_app_base_scale_set(1.8);
+
+ win = elm_win_add(NULL, package, ELM_WIN_BASIC);
+ elm_win_indicator_mode_set(win, ELM_WIN_INDICATOR_SHOW);
+ elm_win_indicator_opacity_set(win, ELM_WIN_INDICATOR_BG_TRANSPARENT);
+
+ elm_win_conformant_set(win, EINA_TRUE);
+ elm_win_autodel_set(win, EINA_TRUE);
+ elm_win_alpha_set(win, EINA_TRUE);
+
+ evas_object_smart_callback_add(win, "delete,request", __win_delete_request_cb, NULL);
+
+ return win;
+}
+
+Evas_Object *_create_conformant(Evas_Object *parent)
+{
+ Evas_Object *conform = elm_conformant_add(parent);
+
+ evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(parent, conform);
+
+ evas_object_show(conform);
+
+ return conform;
+}
+
+Evas_Object *_create_layout(Evas_Object *parent, char *file, const char *group)
+{
+ Evas_Object *layout = elm_layout_add(parent);
+
+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ if (file == NULL)
+ elm_layout_theme_set(layout, "layout", "application", "default");
+ else
+ elm_layout_file_set(layout, file, group);
+
+ evas_object_show(layout);
+
+ return layout;
+}
+
+Evas_Object *_create_button(Evas_Object *parent, const char *text, Evas_Smart_Cb callback, void *user_data)
+{
+ Evas_Object *btn = elm_button_add(parent);
+
+ evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_text_set(btn, text);
+ elm_object_style_set(btn, "bottom");
+ evas_object_smart_callback_add(btn, "clicked", callback, user_data);
+
+ evas_object_show(btn);
+
+ return btn;
+}
+
+Evas_Object *_create_textblock(Evas_Object *parent, const char *text, char *style)
+{
+ Evas_Object *txt = evas_object_textblock_add(parent);
+ Evas_Textblock_Style *text_st = NULL;
+
+ if (style != NULL) {
+ text_st = evas_textblock_style_new();
+ evas_textblock_style_set(text_st, style);
+ evas_object_textblock_style_set(txt, text_st);
+ }
+
+ evas_object_textblock_text_markup_set(txt, text);
+ evas_object_show(txt);
+
+ if (text_st != NULL)
+ evas_textblock_style_free(text_st);
+
+ return txt;
+}
+
+Evas_Object *_create_progressbar(Evas_Object *parent, const char *style)
+{
+ Evas_Object *progressbar = elm_progressbar_add(parent);
+
+ if (style != NULL)
+ elm_object_style_set(progressbar, style);
+
+ evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, 0.5);
+ evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_progressbar_pulse(progressbar, EINA_TRUE);
+ elm_progressbar_pulse_set(progressbar, EINA_TRUE);
+ evas_object_show(progressbar);
+
+ return progressbar;
+}