BuildRequires: pkgconfig(capi-appfw-application)
BuildRequires: pkgconfig(evas)
BuildRequires: pkgconfig(notification)
-BuildRequires: pkgconfig(shortcut)
Requires: libzone = %{version}-%{release}
%description -n org.tizen.zone-setup-wizard
BuildRequires: pkgconfig(capi-appfw-application)
BuildRequires: pkgconfig(evas)
BuildRequires: pkgconfig(capi-ui-efl-util)
+BuildRequires: pkgconfig(auth-fw)
+BuildRequires: pkgconfig(shortcut)
%description -n org.tizen.keyguard
Tizen Krate keyguard interface for zone
Group: Development/Libraries
BuildRequires: pkgconfig(capi-appfw-application)
BuildRequires: pkgconfig(capi-appfw-package-manager)
-BuildRequires: pkgconfig(capi-appfw-app-control)
BuildRequires: pkgconfig(libtzplatform-config)
Requires: %{name} = %{version}-%{release}
Requires(post): /sbin/ldconfig
#define DEFAULT_SHELL "/bin/bash"
-#define ZONE_DELEGATOR_APP "org.tizen.zone-setup-wizard"
+#define ZONE_DELEGATOR_APP "org.tizen.keyguard"
#define NOTIFICATION_SUB_ICON_PATH DATA_PATH "/zone_noti_list_sub_icon.png"
namespace DevicePolicyManager {
appId = strdup("");
}
- zoneLauncherUri = "zone://" + user.getName() + "/" + appId;
+ zoneLauncherUri = "zone://enter/" + user.getName() + "/" + appId;
app_control_get_uri(appControl, &uri);
if (uri != NULL) {
capi-appfw-application
capi-ui-efl-util
evas
+ auth-fw
+ shortcut
)
INCLUDE_DIRECTORIES(${keyguard_pkgs_INCLUDE_DIRS} ${ZONE_LIBS})
#include <dlog.h>
#include <Elementary.h>
#include <efl_extension.h>
+#include <shortcut_manager.h>
+#include <auth-passwd.h>
#include <zone/zone.h>
+#include <zone/app-proxy.h>
#ifdef LOG_TAG
#undef LOG_TAG
#define PACKAGE "org.tizen.keyguard"
#endif
+#define KEYGUARD_PACKAGE "org.tizen.keyguard"
+#define KASKIT_PACKAGE "org.tizen.kaskit"
+
void _create_keyguard_window(void);
+void _launch_req_app(void);
+
+bool _has_password(void);
+bool _check_password(const char* password);
+unsigned int _get_left_attempts(void);
#endif /* __ZONE_KEYGUARD_H__ */
<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns="http://tizen.org/ns/packages" api-version="3.0" package="org.tizen.keyguard" version="1.0.0">
<profile name="mobile"/>
+ <privileges>
+ <privilege>http://tizen.org/privilege/shortcut</privilege>
+ <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
+ </privileges>
<ui-application appid="org.tizen.keyguard" exec="/usr/apps/org.tizen.keyguard/bin/org.tizen.keyguard" multiple="false" nodisplay="true" taskmanage="false" type="capp">
<label>Keyguard</label>
</ui-application>
#include "keyguard.h"
#include "widget.h"
+static app_control_h __req_app_control;
+
+void _launch_req_app()
+{
+ app_control_send_launch_request(__req_app_control, NULL, NULL);
+ app_control_destroy(__req_app_control);
+}
+
+bool _check_password(const char* password)
+{
+ return true;
+}
+
+bool _has_password()
+{
+ return true;
+}
+
+unsigned int _get_left_attempts()
+{
+ return 10;
+}
+
+static void __launch_zone_app(const char* zone_name, app_control_h app_control)
+{
+ zone_manager_h zone_mgr;
+ zone_app_proxy_h zone_app;
+
+ zone_manager_create(&zone_mgr);
+ zone_app_proxy_create(zone_mgr, zone_name, &zone_app);
+ zone_app_proxy_send_launch_request(zone_app, app_control);
+ zone_app_proxy_destroy(zone_app);
+ zone_manager_destroy(zone_mgr);
+}
+
+static void __add_shortcut(const char* zone_name)
+{
+ char uri[PATH_MAX];
+
+ snprintf(uri, sizeof(uri), "zone://enter/%s", zone_name);
+ shortcut_add_to_home(zone_name, LAUNCH_BY_URI, uri, "", 0, NULL, NULL);
+}
+
static bool __app_create(void *data)
{
- elm_app_base_scale_set(1.8);
- _create_keyguard_window();
return true;
}
static void __app_control(app_control_h app_control, void *data)
{
- return;
+ char* uri, *tmp;
+ int ret = 0;
+
+ ret = app_control_get_uri(app_control, &uri);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Failed to get URI");
+ ui_app_exit();
+ return;
+ }
+
+ if (strncmp(uri, "zone://", sizeof("zone://") - 1) != 0) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Mismatched URI");
+ free(uri);
+ ui_app_exit();
+ return;
+ }
+
+ tmp = uri + sizeof("zone://") - 1;
+
+ if (strncmp(tmp, "setup/", sizeof("setup/") - 1) == 0) {
+ char *zone_name;
+
+ zone_name = tmp + sizeof("setup/") - 1;
+ __add_shortcut(zone_name);
+ ui_app_exit();
+ return;
+ } else if (strncmp(tmp, "enter/", sizeof("enter/") - 1) == 0) {
+ char* zone_name, *launch_parameter;
+ char new_uri[PATH_MAX];
+
+ zone_name = tmp + sizeof("enter/") - 1;
+ launch_parameter = strchr(zone_name, '/');
+ if (launch_parameter != NULL) {
+ *(launch_parameter++) = '\0';
+ if (launch_parameter[0] == '\0') {
+ launch_parameter = KASKIT_PACKAGE;
+ }
+ } else {
+ launch_parameter = KASKIT_PACKAGE;
+ }
+ snprintf(new_uri, PATH_MAX, "zone://launch/%s", launch_parameter);
+ app_control_set_uri(app_control, new_uri);
+ app_control_set_app_id(app_control, PACKAGE);
+
+ dlog_print(DLOG_ERROR, LOG_TAG, "Wow");
+ dlog_print(DLOG_ERROR, LOG_TAG, PACKAGE);
+ dlog_print(DLOG_ERROR, LOG_TAG, new_uri);
+ dlog_print(DLOG_ERROR, LOG_TAG, zone_name);
+
+ __launch_zone_app(zone_name, app_control);
+ ui_app_exit();
+ return;
+ }else if (strncmp(tmp, "launch/", sizeof("launch/") - 1) == 0) {
+ char* app_id;
+
+ app_id = tmp + sizeof("launch/") - 1;
+ uri = strchr(app_id, '?');
+ if (uri != NULL) {
+ *(uri++) = '\0';
+ if (strncmp(uri, "uri=", sizeof("uri=") - 1) == 0) {
+ tmp += sizeof("uri=") - 1;
+ }
+ }
+ app_control_clone(&__req_app_control, app_control);
+ app_control_set_uri(__req_app_control, uri);
+ app_control_set_app_id(__req_app_control, app_id);
+
+ if (_has_password()) {
+ _create_keyguard_window();
+ } else {
+ _launch_req_app();
+ }
+ return;
+ } else {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Invalid URI");
+ ui_app_exit();
+ }
+ free(uri);
}
int main(int argc, char *argv[])
static void __entry_change_cb(void *data, Evas_Object *obj, void *event_info)
{
- char text[PATH_MAX];
- int left_attempts = 10; /* [TBD] get left attempts number */
+ char text[32];
- snprintf(text, PATH_MAX, "%d attempts left", left_attempts);
+ snprintf(text, 32, "%u attempts left", _get_left_attempts());
__change_info_text(text);
}
static void __entry_activate_cb(void *data, Evas_Object *obj, void *event_info)
{
- char password[10] = "asdf"; /* [TBD] get krate password from dpm */
const char *input = elm_object_text_get(obj);
- if (!strcmp(password, input)) {
+ if (_check_password(input)) {
+ _launch_req_app();
ui_app_exit();
} else {
elm_entry_input_panel_hide(obj);
__change_info_text("Incorrect Password. Try again.");
+ if (_get_left_attempts() == 0) {
+ ui_app_exit();
+ }
}
}
Evas_Object *_create_win(const char *package)
{
- Evas_Object *win = elm_win_add(NULL, package, ELM_WIN_NOTIFICATION);
+ Evas_Object *win;
+ elm_app_base_scale_set(1.8);
+
+ win = elm_win_add(NULL, package, ELM_WIN_NOTIFICATION);
efl_util_set_notification_window_level(win, EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT);
/* [TBD] enable : eext_win_keygrab_set(win, "XF86Home"); */
capi-appfw-application
evas
notification
- shortcut
)
INCLUDE_DIRECTORIES(${setup_pkgs_INCLUDE_DIRS} ${ZONE_LIBS})
#include <dlog.h>
#include <Elementary.h>
#include <efl_extension.h>
-#include <shortcut_manager.h>
#include <zone/zone.h>
#include <zone/app-proxy.h>
#define PACKAGE "org.tizen.zone-setup-wizard"
#endif
+#define KEYGUARD_PACKAGE "org.tizen.keyguard"
#define KASKIT_PACKAGE "org.tizen.kaskit"
#define DPM_SYSPOPUP_ICON_PATH "/usr/share/icons/default/small/org.tizen.dpm-syspopup.png"
<profile name="mobile"/>
<privileges>
<privilege>http://tizen.org/privilege/notification</privilege>
- <privilege>http://tizen.org/privilege/shortcut</privilege>
<privilege>http://tizen.org/privilege/appmanager.launch</privilege>
</privileges>
<ui-application appid="org.tizen.zone-setup-wizard" exec="/usr/apps/org.tizen.zone-setup-wizard/bin/org.tizen.zone-setup-wizard" multiple="false" nodisplay="true" taskmanage="false" type="capp">
char uri[PATH_MAX];
appdata_s *ad = (appdata_s *) user_data;
- ad->request_done = true;
if (!strcmp(ad->mode, "create")) {
- snprintf(uri, sizeof(uri), "zone://%s/" KASKIT_PACKAGE, ad->zone_name);
- shortcut_add_to_home(ad->zone_name, LAUNCH_BY_URI, uri, "", 0, NULL, NULL);
+ app_control_create(&app_control);
+ app_control_set_app_id(app_control, KEYGUARD_PACKAGE);
+ snprintf(uri, sizeof(uri), "zone://setup/%s", ad->zone_name);
+ app_control_set_uri(app_control, uri);
+ app_control_send_launch_request(app_control, NULL, NULL);
+ app_control_destroy(app_control);
app_control_create(&app_control);
app_control_set_app_id(app_control, KASKIT_PACKAGE);
__launch_zone_app(ad->zone_manager, ad->zone_name, app_control);
app_control_destroy(app_control);
-
}
+ ad->request_done = true;
}
static bool __app_create(void *data)
return;
}
-static int __parse_uri(app_control_h app_control, appdata_s *ad)
-{
- char* uri, *zone_uri, *app_id, *zone_name;
- int ret = 0;
-
- ret = app_control_get_uri(app_control, &uri);
- if (ret != APP_CONTROL_ERROR_NONE || uri == NULL) {
- dlog_print(DLOG_DEBUG, LOG_TAG, "No URI");
- return -1;
- }
-
- if (strncmp(uri, "zone://", sizeof("zone://") - 1) != 0) {
- dlog_print(DLOG_ERROR, LOG_TAG, "Mismatched URI");
- free(uri);
- return -1;
- }
-
- zone_name = uri + sizeof("zone://") - 1;
-
- app_control_set_uri(app_control, NULL);
- app_id = strchr(zone_name, '/');
- *(app_id++) = '\0';
- zone_uri = strchr(app_id, '?');
- if (zone_uri != NULL) {
- *(zone_uri++) = '\0';
- if (strncmp(uri, "uri=", sizeof("uri=") - 1) == 0) {
- zone_uri += sizeof("uri=") - 1;
- app_control_set_uri(app_control, zone_uri);
- }
- }
-
- app_control_set_app_id(app_control, app_id);
- __launch_zone_app(ad->zone_manager, zone_name, app_control);
-
- free(uri);
-
- return 0;
-}
-
static void __app_control(app_control_h app_control, void *data)
{
appdata_s *ad = (appdata_s *) data;
int ret = 0;
- ret = __parse_uri(app_control, ad);
- if (ret == 0) {
- ui_app_exit();
- return;
- }
-
ret = app_control_get_extra_data(app_control, "mode", &ad->mode);
if (ret != APP_CONTROL_ERROR_NONE) {
dlog_print(DLOG_ERROR, LOG_TAG, "Failed to get mode");
return;
}
- elm_app_base_scale_set(1.8);
_create_base_window(ad);
return;
Evas_Object *_create_win(const char *package)
{
- Evas_Object *win = elm_win_util_standard_add(package, package);
- elm_win_conformant_set(win, EINA_TRUE);
- elm_win_autodel_set(win, EINA_TRUE);
+ Evas_Object *win;
- evas_object_smart_callback_add(win, "delete,request", __win_delete_request_cb, NULL);
- elm_win_indicator_mode_set(win, ELM_WIN_INDICATOR_SHOW);
- elm_win_indicator_opacity_set(win, ELM_WIN_INDICATOR_TRANSPARENT);
+ elm_app_base_scale_set(1.8);
- return win;
+ win = elm_win_util_standard_add(package, package);
+ 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)