tizen 2.3.1 release tizen_2.3.1 submit/tizen_2.3.1/20150915.072544 tizen_2.3.1_release
authorjk7744.park <jk7744.park@samsung.com>
Tue, 8 Sep 2015 12:34:06 +0000 (21:34 +0900)
committerjk7744.park <jk7744.park@samsung.com>
Tue, 8 Sep 2015 12:34:06 +0000 (21:34 +0900)
17 files changed:
.gitignore [new file with mode: 0755]
CMakeLists.txt [new file with mode: 0755]
INSTALL [new file with mode: 0644]
LICENSE [new file with mode: 0644]
NOTICE [new file with mode: 0644]
app-selector-util.c [new file with mode: 0755]
app-selector-util.h [new file with mode: 0755]
app-selector-view.c [new file with mode: 0755]
app-selector-view.h [new file with mode: 0755]
app-selector.c [new file with mode: 0755]
app-selector.h [new file with mode: 0755]
data/app-selector.edc [new file with mode: 0644]
data/groups/popup_custom.edc [new file with mode: 0644]
org.tizen.app-selector-wearable.efl [new file with mode: 0644]
org.tizen.app-selector-wearable.manifest [new file with mode: 0644]
org.tizen.app-selector-wearable.xml.in [new file with mode: 0755]
packaging/org.tizen.app-selector-wearable.spec [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100755 (executable)
index 0000000..6c53821
--- /dev/null
@@ -0,0 +1,12 @@
+build_log
+*.log
+*.pyc
+usr
+opt
+*.o
+*.os
+*.exe
+packages
+binaries
+*.ipk
+*~
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..b0d0a23
--- /dev/null
@@ -0,0 +1,78 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(app-selector C)
+
+SET(SRCS app-selector.c app-selector-view.c app-selector-util.c)
+
+SET(PACKAGE ${PROJECT_NAME})
+SET(PKGNAME "org.tizen.${PACKAGE}-wearable")
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(BINDIR "${PREFIX}/apps/${PKGNAME}/bin")
+SET(DATADIR "${PREFIX}/apps/${PKGNAME}/data")
+SET(RESDIR "${PREFIX}/apps/${PKGNAME}/res")
+SET(LOCALEDIR "${RESDIR}/locale")
+SET(ICONDIR "${DATADIR}/icons")
+SET(EDJDIR "${RESDIR}/edje/")
+
+
+IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+       SET(CMAKE_BUILD_TYPE "Release")
+ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(pkgs REQUIRED appcore-efl aul utilX ecore-x eina evas ecore ecore-file ecore-input edje appsvc x11 efl-assist vconf pkgmgr-info)
+
+FOREACH(flag ${pkgs_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -fvisibility=hidden -Wall")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+SET(CMAKE_C_FLAGS_RELEASE "-O2")
+
+FIND_PROGRAM(UNAME NAMES uname)
+EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")
+IF("${ARCH}" MATCHES "^arm.*")
+       ADD_DEFINITIONS("-DTARGET")
+       MESSAGE("add -DTARGET")
+ENDIF("${ARCH}" MATCHES "^arm.*")
+
+ADD_DEFINITIONS("-fpie")
+
+ADD_DEFINITIONS("-DVENDOR=\"${VENDOR}\"")
+ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE}\"")
+ADD_DEFINITIONS("-DPACKAGE_NAME=\"${PKGNAME}\"")
+ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
+ADD_DEFINITIONS("-DLOCALEDIR=\"${LOCALEDIR}\"")
+ADD_DEFINITIONS("-DEDJ_NAME=\"${EDJDIR}/app-selector.edj\"")
+
+ADD_DEFINITIONS("-DENABLE_EFL_LANG_CHANGE")
+ADD_DEFINITIONS("-DEND_POPUP_AFTER_LAUNCH_RUNNING_APP")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
+
+ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} "-pie")
+
+ADD_CUSTOM_TARGET(app-selector.edj
+               COMMAND edje_cc -id ${CMAKE_SOURCE_DIR}/data/images -sd ${CMAKE_SOURCE_DIR}/data/sounds
+               ${CMAKE_SOURCE_DIR}/data/app-selector.edc ${CMAKE_BINARY_DIR}/app-selector.edj
+               DEPENDS ${CMAKE_SOURCE_DIR}/data/app-selector.edc
+)
+ADD_DEPENDENCIES(${PROJECT_NAME} app-selector.edj)
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR})
+INSTALL(FILES ${CMAKE_BINARY_DIR}/app-selector.edj DESTINATION ${EDJDIR})
+
+# install manifest file & icon
+CONFIGURE_FILE(${PKGNAME}.xml.in ${CMAKE_BINARY_DIR}/${PKGNAME}.xml)
+INSTALL(FILES ${CMAKE_BINARY_DIR}/${PKGNAME}.xml DESTINATION /usr/share/packages)
+
+# install smack rule
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/org.tizen.app-selector-wearable.efl DESTINATION /etc/smack/accesses.d)
+
+# i18n
+#ADD_SUBDIRECTORY(po)
+
diff --git a/INSTALL b/INSTALL
new file mode 100644 (file)
index 0000000..ddf4e78
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,33 @@
+1. make the build directory
+
+  ex) 
+
+   $ mkdir build
+
+
+2. change the working directory to the build directory
+
+  ex)
+
+   $ cd build
+
+
+3. run 'cmake'
+
+  $ cmake ${SOURCE_DIR} -DCMAKE_INSTALL_PREFIX=/usr
+
+  ex)
+
+   $ cmake .. -DCMAKE_INSTALL_PREFIX=/usr
+
+   or
+
+   $ cmake ..
+
+
+4. make & make install
+
+  ex)
+
+   $ make -j 2 && make install
+
diff --git a/LICENSE b/LICENSE
new file mode 100644 (file)
index 0000000..571fe79
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,206 @@
+Flora License
+
+Version 1.1, April, 2013
+
+http://floralicense.org/license/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction,
+and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by
+the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and
+all other entities that control, are controlled by, or are
+under common control with that entity. For the purposes of
+this definition, "control" means (i) the power, direct or indirect,
+to cause the direction or management of such entity,
+whether by contract or otherwise, or (ii) ownership of fifty percent (50%)
+or more of the outstanding shares, or (iii) beneficial ownership of
+such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity
+exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications,
+including but not limited to software source code, documentation source,
+and configuration files.
+
+"Object" form shall mean any form resulting from mechanical
+transformation or translation of a Source form, including but
+not limited to compiled object code, generated documentation,
+and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form,
+made available under the License, as indicated by a copyright notice
+that is included in or attached to the work (an example is provided
+in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form,
+that is based on (or derived from) the Work and for which the editorial
+revisions, annotations, elaborations, or other modifications represent,
+as a whole, an original work of authorship. For the purposes of this License,
+Derivative Works shall not include works that remain separable from,
+or merely link (or bind by name) to the interfaces of, the Work and
+Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original
+version of the Work and any modifications or additions to that Work or
+Derivative Works thereof, that is intentionally submitted to Licensor
+for inclusion in the Work by the copyright owner or by an individual or
+Legal Entity authorized to submit on behalf of the copyright owner.
+For the purposes of this definition, "submitted" means any form of
+electronic, verbal, or written communication sent to the Licensor or
+its representatives, including but not limited to communication on
+electronic mailing lists, source code control systems, and issue
+tracking systems that are managed by, or on behalf of, the Licensor
+for the purpose of discussing and improving the Work, but excluding
+communication that is conspicuously marked or otherwise designated
+in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity
+on behalf of whom a Contribution has been received by Licensor and
+subsequently incorporated within the Work.
+
+"Tizen Certified Platform" shall mean a software platform that complies
+with the standards set forth in the Tizen Compliance Specification
+and passes the Tizen Compliance Tests as defined from time to time
+by the Tizen Technical Steering Group and certified by the Tizen
+Association or its designated agent.
+
+2. Grant of Copyright License.  Subject to the terms and conditions of
+this License, each Contributor hereby grants to You a perpetual,
+worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+copyright license to reproduce, prepare Derivative Works of,
+publicly display, publicly perform, sublicense, and distribute the
+Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License.  Subject to the terms and conditions of
+this License, each Contributor hereby grants to You a perpetual,
+worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+(except as stated in this section) patent license to make, have made,
+use, offer to sell, sell, import, and otherwise transfer the Work
+solely as incorporated into a Tizen Certified Platform, where such
+license applies only to those patent claims licensable by such
+Contributor that are necessarily infringed by their Contribution(s)
+alone or by combination of their Contribution(s) with the Work solely
+as incorporated into a Tizen Certified Platform to which such
+Contribution(s) was submitted. If You institute patent litigation
+against any entity (including a cross-claim or counterclaim
+in a lawsuit) alleging that the Work or a Contribution incorporated
+within the Work constitutes direct or contributory patent infringement,
+then any patent licenses granted to You under this License for that
+Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution.  You may reproduce and distribute copies of the
+Work or Derivative Works thereof pursuant to the copyright license
+above, in any medium, with or without modifications, and in Source or
+Object form, provided that You meet the following conditions:
+
+  1. You must give any other recipients of the Work or Derivative Works
+     a copy of this License; and
+  2. You must cause any modified files to carry prominent notices stating
+     that You changed the files; and
+  3. You must retain, in the Source form of any Derivative Works that
+     You distribute, all copyright, patent, trademark, and attribution
+     notices from the Source form of the Work, excluding those notices
+     that do not pertain to any part of the Derivative Works; and
+  4. If the Work includes a "NOTICE" text file as part of its distribution,
+     then any Derivative Works that You distribute must include a readable
+     copy of the attribution notices contained within such NOTICE file,
+     excluding those notices that do not pertain to any part of
+     the Derivative Works, in at least one of the following places:
+     within a NOTICE text file distributed as part of the Derivative Works;
+     within the Source form or documentation, if provided along with the
+     Derivative Works; or, within a display generated by the Derivative Works,
+     if and wherever such third-party notices normally appear.
+     The contents of the NOTICE file are for informational purposes only
+     and do not modify the License. You may add Your own attribution notices 
+     within Derivative Works that You distribute, alongside or as an addendum 
+     to the NOTICE text from the Work, provided that such additional attribution 
+     notices cannot be construed as modifying the License. You may add Your own
+     copyright statement to Your modifications and may provide additional or
+     different license terms and conditions for use, reproduction, or
+     distribution of Your modifications, or for any such Derivative Works
+     as a whole, provided Your use, reproduction, and distribution of
+     the Work otherwise complies with the conditions stated in this License
+     and your own copyright statement or terms and conditions do not conflict
+     the conditions stated in the License including section 3.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+any Contribution intentionally submitted for inclusion in the Work
+by You to the Licensor shall be under the terms and conditions of
+this License, without any additional terms or conditions.
+Notwithstanding the above, nothing herein shall supersede or modify
+the terms of any separate license agreement you may have executed
+with Licensor regarding such Contributions.
+
+6. Trademarks.  This License does not grant permission to use the trade
+names, trademarks, service marks, or product names of the Licensor,
+except as required for reasonable and customary use in describing the
+origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+agreed to in writing, Licensor provides the Work (and each
+Contributor provides its Contributions) on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+implied, including, without limitation, any warranties or conditions
+of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+PARTICULAR PURPOSE. You are solely responsible for determining the
+appropriateness of using or redistributing the Work and assume any
+risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+whether in tort (including negligence), contract, or otherwise,
+unless required by applicable law (such as deliberate and grossly
+negligent acts) or agreed to in writing, shall any Contributor be
+liable to You for damages, including any direct, indirect, special,
+incidental, or consequential damages of any character arising as a
+result of this License or out of the use or inability to use the
+Work (including but not limited to damages for loss of goodwill,
+work stoppage, computer failure or malfunction, or any and all
+other commercial damages or losses), even if such Contributor
+has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+the Work or Derivative Works thereof, You may choose to offer,
+and charge a fee for, acceptance of support, warranty, indemnity,
+or other liability obligations and/or rights consistent with this
+License. However, in accepting such obligations, You may act only
+on Your own behalf and on Your sole responsibility, not on behalf
+of any other Contributor, and only if You agree to indemnify,
+defend, and hold each Contributor harmless for any liability
+incurred by, or claims asserted against, such Contributor by reason
+of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Flora License to your work
+
+To apply the Flora License to your work, attach the following
+boilerplate notice, with the fields enclosed by brackets "[]"
+replaced with your own identifying information. (Don't include
+the brackets!) The text should be enclosed in the appropriate
+comment syntax for the file format. We also recommend that a
+file or class name and description of purpose be included on the
+same "printed page" as the copyright notice for easier
+identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Flora License, Version 1.1 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://floralicense.org/license/
+
+   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.
+
diff --git a/NOTICE b/NOTICE
new file mode 100644 (file)
index 0000000..4297ee3
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1 @@
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
diff --git a/app-selector-util.c b/app-selector-util.c
new file mode 100755 (executable)
index 0000000..aa2c8ae
--- /dev/null
@@ -0,0 +1,130 @@
+/*
+ * Copyright 2012  Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+
+ *     http://floralicense.org/license
+
+ * 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 <Ecore.h>
+#include <Ecore_X.h>
+
+#include <sys/shm.h>
+
+#include <X11/Xatom.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/extensions/Xcomposite.h>
+#include <X11/extensions/XShm.h>
+
+#include "app-selector.h"
+#include "app-selector-util.h"
+
+
+static pid_t __get_win_pid(Display *d, Window win);
+static int __tm_get_win_with_pid(Display *d, Window * win, pid_t pid);
+static Window __find_top_win(Window win);
+
+
+static pid_t __get_win_pid(Display *d, Window win)
+{
+       int ret;
+       pid_t pid;
+
+       Atom a_pid;
+       Atom a_type;
+       int format;
+       unsigned long nitems;
+       unsigned long bytes_after;
+       unsigned char *prop_ret;
+
+       if (!d)
+               return -1;
+
+       a_pid = XInternAtom(d, "_NET_WM_PID", True);
+       if (a_pid == 0)
+               return -1;
+
+       ret = XGetWindowProperty(d, win, a_pid, 0, 1, False, XA_CARDINAL,
+                                &a_type, &format, &nitems, &bytes_after,
+                                &prop_ret);
+
+       if (ret != 0 || prop_ret == NULL)
+               return -1;
+
+       pid = *(unsigned long *)prop_ret;
+
+       XFree(prop_ret);
+       return pid;
+}
+
+static int __tm_get_win_with_pid(Display *d, Window * win, pid_t pid)
+{
+       int ret;
+       pid_t p;
+       unsigned int n;
+       Window root, parent, *child;
+
+       p = __get_win_pid(d, *win);
+       if (p == pid)
+               return 1;
+
+       ret = XQueryTree(d, *win, &root, &parent, &child, &n);
+       if (ret) {
+               int i;
+               int found = 0;
+
+               for (i = 0; i < n; i++) {
+                       found = __tm_get_win_with_pid(d, &child[i], pid);
+                       if (found) {
+                               *win = child[i];
+                               break;
+                       }
+               }
+
+               XFree(child);
+               if (found)
+                       return 1;
+       }
+       return 0;
+}
+
+static Window __find_top_win(Window win)
+{
+       Window root, parent, *childw, return_win;
+       unsigned int nchild;
+       if (!XQueryTree(ecore_x_display_get(),
+           win, &root, &parent, &childw, &nchild)) {
+/*              DBG_PRT("XQueryTree failed.\n");*/
+               return win;
+       }
+       if (parent == root) {
+/*              DBG_PRT("toplevel window: 0x%x \n", (unsigned int)win);*/
+               return_win = win;
+               XFree(childw);
+               return return_win;
+       } else {
+/*              DBG_PRT("window: 0x%x \n",(unsigned int)win);*/
+               XFree(childw);
+               return __find_top_win(parent);
+       }
+}
+
+int set_transient(Ecore_X_Display *display, Ecore_X_Window win,
+                 Ecore_X_Window prev_win)
+{
+       int ret = 0;
+
+       ret = XSetTransientForHint(display, win, prev_win);
+
+       return ret;
+}
diff --git a/app-selector-util.h b/app-selector-util.h
new file mode 100755 (executable)
index 0000000..e20ce36
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2012  Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+
+ *     http://floralicense.org/license
+
+ * 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 __DEF_APP_SELECT_UTIL_H_
+#define __DEF_APP_SELECT_UTIL_H_
+
+#include <Elementary.h>
+
+int set_transient(Ecore_X_Display *display, Ecore_X_Window win,
+                 Ecore_X_Window prev_win);
+
+#endif                         /* __DEF_APP_SELECT_UTIL_H__ */
diff --git a/app-selector-view.c b/app-selector-view.c
new file mode 100755 (executable)
index 0000000..fcb68ea
--- /dev/null
@@ -0,0 +1,423 @@
+/*
+ * Copyright 2012  Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+
+ *     http://floralicense.org/license
+
+ * 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 <aul.h>
+#include <appsvc.h>
+#include <efl_assist.h>
+#include <pkgmgr-info.h>
+
+#include "app-selector.h"
+#include "app-selector-view.h"
+
+#define PATH_LEN       256
+#define NAME_LEN       256
+#define MAX_MIME_STR_SIZE 256
+
+extern int aul_forward_app(const char* pkgname, bundle *kb);
+
+static Evas_Object *app_genlist;
+static Elm_Genlist_Item_Class app_gic;
+
+extern void _tasks_related_launching_app(void *data);
+extern void _unregister_key_handler(void *data);
+extern bool _is_caller_window_floating_state(void *data);
+extern void _transient_for_unset_app(void *data);
+
+static void __launch_selected_app(void *data)
+{
+       int ret=0;
+
+       if (!data)
+               return;
+
+       struct _select_app_info *info = (struct _select_app_info *)data;
+
+       _unregister_key_handler(info->ad);
+
+#ifdef END_POPUP_AFTER_LAUNCH_RUNNING_APP
+       bool running = false;
+       ret = aul_app_is_running(info->app_id);
+       if(ret) {
+               _SD("app(%s)_is_running. app-selector will be destroyed immediately after app launch", info->app_id);
+               running = true;
+       }
+#endif
+
+       ret = aul_forward_app(info->app_id, info->ad->kb);
+       if(ret < 0) {
+               _SE("app(%s) launch error", info->app_id);
+       } else {
+               _SD("app(%s) launch ok", info->app_id);
+               bundle_add(info->ad->kb, "__APP_SVC_START_INFO__", info->app_id);
+       }
+
+
+       if(ret == info->ad->caller_pid)
+       {
+               /* Issue case : A app --(transient)--> popup --> launch A app */
+               _D("launch app is same as caller. unset transient");
+               _transient_for_unset_app(info->ad);
+       }
+
+#ifdef END_POPUP_AFTER_LAUNCH_RUNNING_APP
+       if(running)
+               elm_exit();
+#endif
+
+       if(_is_caller_window_floating_state(info->ad)) {
+               _D("caller window is floating mode. app-selector will be destroyed immediately after app launch");
+               elm_exit();
+       }
+}
+
+static void __clear_app_list(void *data)
+{
+       struct appdata *ad = data;
+       Eina_List *l;
+       struct _select_app_info *info;
+
+       if (ad->app_list) {
+               EINA_LIST_FOREACH(ad->app_list, l, info) {
+                       if (info != NULL) {
+                               free(info->pkg_name);
+                               free(info->app_name);
+                               free(info->app_id);
+                               free(info->app_path);
+                               free(info->app_icon_path);
+                               free(info);
+                               info = NULL;
+                       }
+               }
+
+               eina_list_free(ad->app_list);
+               ad->app_list = NULL;
+       }
+
+       if (app_genlist) {
+               elm_genlist_clear(app_genlist);
+       }
+}
+
+static int __iterate(const char* pkg_name, void *data)
+{
+       struct appdata *ad = data;
+       struct _select_app_info *info;
+       int ret = 0;
+       pkgmgrinfo_appinfo_h handle = NULL;
+       char *str = NULL;
+
+       ret = pkgmgrinfo_appinfo_get_appinfo(pkg_name, &handle);
+       if (ret != PMINFO_R_OK) {
+               return -1;
+       }
+
+       info = calloc(1, sizeof(struct _select_app_info));
+       if (info == NULL) {
+               _E("out of memory");
+               if (pkgmgrinfo_appinfo_destroy_appinfo(handle) != PMINFO_R_OK)
+                       _D("destroy appinfo handle error");
+
+               return -1;
+       }
+
+       ret = pkgmgrinfo_appinfo_get_pkgname(handle, &str);
+       if ((ret == PMINFO_R_OK) && (str)) {
+               info->pkg_name = strdup(str);
+       }
+       str = NULL;
+
+       ret = pkgmgrinfo_appinfo_get_label(handle, &str);
+       if ((ret == PMINFO_R_OK) && (str)) {
+               info->app_name = strdup(str);
+       }
+       str = NULL;
+
+       ret = pkgmgrinfo_appinfo_get_appid(handle, &str);
+       if ((ret == PMINFO_R_OK) && (str)) {
+               info->app_id = strdup(str);
+       }
+       str = NULL;
+
+       ret = pkgmgrinfo_appinfo_get_exec(handle, &str);
+       if ((ret == PMINFO_R_OK) && (str)) {
+               info->app_path = strdup(str);
+       }
+       str = NULL;
+
+       ret = pkgmgrinfo_appinfo_get_icon(handle, &str);
+       if ((ret == PMINFO_R_OK) && (str)) {
+               info->app_icon_path = strdup(str);
+       }
+       str = NULL;
+
+       _SD("PKGNAME : %s, APPNAME : %s, ICONPATH : %s\n", info->pkg_name, info->app_name,
+                      info->app_icon_path);
+
+       info->ad = data;
+
+       ad->app_list = eina_list_append(ad->app_list, info);
+
+       ret = pkgmgrinfo_appinfo_destroy_appinfo(handle);
+       if (ret != PMINFO_R_OK) {
+               _D("destroy appinfo handle error(%d)", ret);
+               return -1;
+       }
+
+       return 0;
+}
+
+
+static int __app_list_get_with_control(void *data)
+{
+       struct appdata *ad = data;
+       bundle *kb;
+       int i=0;
+
+       for(i=0;i<ad->extra_list_cnt;i++) {
+               _D("extra list(%d) : %s", i , ad->extra_list[i]);
+               __iterate(ad->extra_list[i],data);
+       }
+
+       kb = bundle_create();
+       if(kb == NULL) {
+               _E("bundle creation fail\n");
+               return -1;
+       }
+
+       if(ad->window_id){
+               bundle_add(kb, "__APP_SVC_K_WIN_ID__", ad->window_id);
+       }
+
+       if(ad->control_op){
+               appsvc_set_operation(kb, ad->control_op);
+       }
+
+       if(ad->control_uri){
+               appsvc_set_uri(kb, ad->control_uri);
+       }
+
+       if(ad->control_mime){
+               appsvc_set_mime(kb, ad->control_mime);
+       }
+
+       if( appsvc_get_list(kb, __iterate, ad) != 0 ){
+               bundle_free(kb);
+               return -1;
+       }
+
+       bundle_free(kb);
+
+       return 0;
+}
+
+static void
+__selected_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       Elm_Object_Item *item = (Elm_Object_Item *) event_info;
+       if (item) {
+               _E("selected item will be launched");
+               _tasks_related_launching_app(data);
+               __launch_selected_app((void*)elm_object_item_data_get(item));
+       } else {
+               _E("selected item data is null");
+       }       
+}
+
+static char *__list_text_get(void *data, Evas_Object * obj,
+                          const char *part)
+{
+       struct _select_app_info *info = (struct _select_app_info *)data;
+
+       if(!info) {
+               _E("app info is null");
+               return NULL;
+       }
+
+       if (!strcmp(part, "elm.text")) {
+               return elm_entry_utf8_to_markup(info->app_name);
+       }
+       return NULL;
+}
+
+static Evas_Object *
+__list_content_get(void *data, Evas_Object *obj, const char *part)
+{
+       struct _select_app_info *info = (struct _select_app_info *)data;
+       char buf[PATH_LEN] = { 0, };
+
+       Evas_Object *icon = NULL;
+
+       if (!strcmp(part, "elm.icon")) {
+               snprintf(buf, (size_t) PATH_LEN, "%s", info->app_icon_path);
+
+               _SD("icon buf : %s", buf);
+
+               icon = elm_image_add(obj);
+               elm_image_file_set(icon, buf, NULL);
+               evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+               //evas_object_size_hint_min_set(icon, 50 * elm_config_scale_get(), 50 * elm_config_scale_get());
+               //evas_object_size_hint_max_set(icon, 50 * elm_config_scale_get(), 50 * elm_config_scale_get());
+               evas_object_show(icon);
+
+               return icon;
+       }
+       return NULL;
+}
+
+static int __app_genlist_item_append(struct appdata *ad)
+{
+       struct _select_app_info *info;
+       Eina_List *l;
+       int count = 0;
+
+       if(!ad->app_list) {
+               return 0;
+       }
+
+       app_gic.item_style = "1text";
+       app_gic.func.text_get = __list_text_get;
+       app_gic.func.content_get = __list_content_get;
+       app_gic.func.state_get = NULL;
+       app_gic.func.del = NULL;
+
+       EINA_LIST_FOREACH(ad->app_list, l, info) {
+               count++;
+               info->it =
+                   elm_genlist_item_append(app_genlist, &app_gic,
+                       (void *)info, NULL, ELM_GENLIST_ITEM_NONE, __selected_cb, ad);
+       }
+
+       return count;
+}
+
+static void _popup_back_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       _D("ea callback back for popup");
+       evas_object_del(obj);
+       elm_exit();
+}
+
+static void __load_app_list(struct appdata *ad)
+{
+       Evas_Object *popup, *layout;
+       int cnt;
+
+       ea_theme_changeable_ui_enabled_set(EINA_TRUE);
+
+       popup = elm_popup_add(ad->win);
+       evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       ea_object_event_callback_add(popup, EA_CALLBACK_BACK, _popup_back_cb, NULL);
+       ad->popup = popup;
+
+       layout = elm_layout_add(popup);
+       evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+       Evas_Object *genlist;
+       genlist = elm_genlist_add(popup);
+       elm_object_style_set(genlist, "popup");
+       elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
+       elm_genlist_homogeneous_set(genlist, EINA_TRUE);
+
+       app_genlist = genlist;
+
+       cnt = __app_genlist_item_append(ad);
+
+       if(cnt > 4) {
+               elm_layout_file_set(layout, EDJ_NAME, "app-selector/popup/layout/full");
+       } else {
+               elm_layout_file_set(layout, EDJ_NAME, "app-selector/popup/layout/default");
+       }
+
+       elm_object_part_content_set(layout, "elm.swallow.content", genlist);
+       elm_object_content_set(popup, layout);
+       evas_object_show(genlist);
+
+       evas_object_show(popup);
+}
+
+static Eina_Bool __unload_info_popup(void *data)
+{
+       elm_exit();
+
+       return ECORE_CALLBACK_CANCEL;
+}
+
+void load_info_popup(struct appdata *ad, char *str)
+{
+       Evas_Object *eo = NULL;
+       eo = elm_popup_add(ad->win);
+       evas_object_size_hint_weight_set(eo, EVAS_HINT_EXPAND,
+                                        EVAS_HINT_EXPAND);
+       elm_object_text_set(eo, str);
+
+       ecore_timer_add(2.0, __unload_info_popup, eo);
+       evas_object_show(eo);
+}
+
+void update_app_list(struct appdata *ad)
+{
+       int ret = -1;
+
+       __clear_app_list(ad);
+
+       ret = __app_list_get_with_control(ad);
+       if (ret == -1) {
+               _E("app list get failed\n");
+               return;
+       }
+
+       if (eina_list_count(ad->app_list) < 1) {
+               _E("no matched list");
+               return;
+       } else {
+               __app_genlist_item_append(ad);
+       }
+
+       return;
+}
+
+void load_app_select_popup(struct appdata *ad)
+{
+       int ret = -1;
+
+       ret = __app_list_get_with_control(ad);
+       if (ret == -1) {
+               _E("app list get fail\n");
+               return;
+       }
+       else
+               __load_app_list(ad);
+}
+
+void clear_list_info(struct appdata *ad)
+{
+       _D("clear_list_info");
+
+       __clear_app_list(ad);
+
+       if (app_genlist) {
+               elm_genlist_clear(app_genlist);
+               evas_object_del(app_genlist);
+               app_genlist = NULL;
+       }
+}
+
+void popup_update_by_lang_changed_sig(struct appdata *ad)
+{
+       _D("update app list by lang changed");
+       update_app_list(ad);
+}
diff --git a/app-selector-view.h b/app-selector-view.h
new file mode 100755 (executable)
index 0000000..d22f571
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2012  Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+
+ *     http://floralicense.org/license
+
+ * 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 __DEF_APP_SELECT_VIEW_H_
+#define __DEF_APP_SELECT_VIEW_H_
+
+#include <Elementary.h>
+#include "app-selector.h"
+
+void load_info_popup(struct appdata *ad, char *str);
+void update_app_list(struct appdata *ad);
+void load_app_select_popup(struct appdata *ad);
+void clear_list_info(struct appdata *ad);
+#endif                         /* __DEF_APP_SELECT_VIEW_H__ */
diff --git a/app-selector.c b/app-selector.c
new file mode 100755 (executable)
index 0000000..43642f6
--- /dev/null
@@ -0,0 +1,744 @@
+/*
+ * Copyright 2012  Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+
+ *     http://floralicense.org/license
+
+ * 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 <stdio.h>
+#include <appcore-efl.h>
+#include <Ecore_X.h>
+#include <utilX.h>
+#include <aul.h>
+#include <appsvc.h>
+#include <X11/Xatom.h>
+#include <X11/Xutil.h>
+#include <Ecore.h>
+#include <Ecore_Input.h>
+#include <efl_assist.h>
+
+#include <vconf.h>
+
+#include "app-selector.h"
+#include "app-selector-view.h"
+#include "app-selector-util.h"
+
+#define WIN_PROP_NAME "APP_SELECTOR"
+
+#ifndef EXPORT_API
+#define EXPORT_API __attribute__ ((visibility("default")))
+#endif
+
+extern int appsvc_request_transient_app(bundle *b, Ecore_X_Window callee_id, appsvc_host_res_fn cbfunc, void *data);
+extern int app_send_cmd_with_noreply(int pid, int cmd, bundle *kb);
+extern void popup_update_by_lang_changed_sig(struct appdata *ad);
+
+bool enable_pause_terminate = false;
+Ecore_Timer *exit_timer;
+
+int is_reset = 0;
+
+Ecore_Event_Handler *ecore_x_handler;
+
+
+static void __win_del(void *data, Evas_Object * obj, void *event)
+{
+       elm_exit();
+}
+
+static Eina_Bool __window_focus_out_event_cb(void *data, int type, void *event)
+{
+       _D("selector popup get focus out event. popup will be terminated");
+
+       elm_exit();
+
+       return ECORE_CALLBACK_CANCEL;
+}
+
+static Eina_Bool __exit_timer_cb(void *data)
+{
+       _D("selected app is not launched successfully. abnormal case. selector popup will be terminated by force.");
+
+       elm_exit();
+
+       return ECORE_CALLBACK_CANCEL;
+}
+
+void _tasks_related_launching_app(void *data)
+{
+       struct appdata *ad = (struct appdata *)data;
+
+       /* handler for case that 32bit window is launched from popup  (no pause event) */
+       ecore_x_window_client_manage(ad->xwin);
+       ecore_x_handler = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, __window_focus_out_event_cb, NULL);
+
+       /* app terminate timer for case that abnormal case like selected app launch fail */
+       exit_timer = ecore_timer_add(3, __exit_timer_cb, NULL);
+
+       enable_pause_terminate = TRUE;
+}
+
+bool _is_caller_window_floating_state(void *data)
+{
+       struct appdata *ad = (struct appdata *)data;
+       int ret;
+
+       ret = ecore_x_e_illume_window_state_get(ad->caller_xwin);
+       if(ret == ECORE_X_ILLUME_WINDOW_STATE_FLOATING) {
+               return true;
+       }
+
+       return false;
+}
+
+static Evas_Object *__create_win(const char *name)
+{
+       Evas_Object *eo;
+       int w;
+       int h;
+       Evas_Object *bg;
+
+       eo = elm_win_add(NULL, name, ELM_WIN_BASIC);
+       if (eo) {
+               elm_win_title_set(eo, name);
+               elm_win_borderless_set(eo, EINA_TRUE);
+
+               elm_win_alpha_set(eo, EINA_TRUE);
+
+               evas_object_smart_callback_add(eo, "delete,request",
+                                              __win_del, NULL);
+               ecore_x_window_size_get(ecore_x_window_root_first_get(),
+                                       &w, &h);
+               evas_object_resize(eo, w, h);
+
+               ea_screen_reader_support_set(eo, EINA_TRUE);
+
+               bg = elm_bg_add(eo);
+               evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+               elm_win_resize_object_add(eo, bg);
+               evas_object_show(bg);
+       }
+
+       return eo;
+}
+
+static Evas_Object *__create_layout_main(Evas_Object * parent)
+{
+       Evas_Object *layout;
+
+       if (!parent)
+               return NULL;
+
+       layout = elm_layout_add(parent);
+       if (!layout)
+               return NULL;
+
+       elm_layout_theme_set(layout, "layout", "application", "default");
+       evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND,
+                                        EVAS_HINT_EXPAND);
+
+       edje_object_signal_emit(_EDJ(layout), "elm,state,show,content", "elm");
+
+       evas_object_show(layout);
+
+       return layout;
+}
+
+static int __get_window_property(Display *dpy, Window win, Atom atom,
+                                         Atom type, unsigned int *val,
+                                         unsigned int len)
+{
+       unsigned char *prop_ret;
+       Atom type_ret;
+       unsigned long bytes_after;
+       unsigned long  num_ret;
+       int format_ret;
+       unsigned int i;
+       int num;
+
+       prop_ret = NULL;
+       if (XGetWindowProperty(dpy, win, atom, 0, 0x7fffffff, False,
+                              type, &type_ret, &format_ret, &num_ret,
+                              &bytes_after, &prop_ret) != Success)
+               return -1;
+
+       if (type_ret != type || format_ret != 32)
+               num = -1;
+       else if (num_ret == 0 || !prop_ret)
+               num = 0;
+       else {
+               if (num_ret < len)
+                       len = num_ret;
+               for (i = 0; i < len; i++) {
+                       val[i] = ((unsigned long *)prop_ret)[i];
+               }
+               num = len;
+       }
+
+       if (prop_ret)
+               XFree(prop_ret);
+
+       return num;
+}
+
+#ifdef ROTATE_USING_X_CLIENT
+static int __x_rotation_get(Display *dpy, Window win)
+{
+       Window active_win;
+       Window root_win;
+       int rotation = -1;
+       int ret;
+
+       Atom atom_active_win;
+       Atom atom_win_rotate_angle;
+
+       root_win = XDefaultRootWindow(dpy);
+
+       atom_active_win = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False);
+       ret = __get_window_property(dpy, root_win, atom_active_win,
+                                            XA_WINDOW,
+                                            (unsigned int *)&active_win, 1);
+
+       if (ret < 0)
+               return ret;
+
+       atom_win_rotate_angle =
+               XInternAtom(dpy, "_E_ILLUME_ROTATE_WINDOW_ANGLE", False);
+       ret = __get_window_property(dpy, active_win,
+                                         atom_win_rotate_angle, XA_CARDINAL,
+                                         (unsigned int *)&rotation, 1);
+
+       if (ret != -1)
+               return rotation;
+
+       return -1;
+}
+
+static int __as_rotate(Display *dpy, Window xwin, Evas_Object *win, void *data)
+{
+       int rotation;
+       struct appdata *ad = data;
+
+       ecore_x_icccm_hints_set(xwin, 0, 0, 0, 0, 0, 0, 0);
+
+       rotation = __x_rotation_get(dpy, xwin);
+
+       if (rotation == -1) {
+               rotation = 0;
+       }
+
+       if (rotation >= 0 && ad->rotate != NULL)
+               elm_win_rotation_with_resize_set(win, rotation);
+
+       return 0;
+}
+
+static Eina_Bool __rotate(void *data, int type, void *event)
+{
+       struct appdata *ad = data;
+
+       Ecore_X_Event_Client_Message *ev = event;
+
+       if (!event)
+               return ECORE_CALLBACK_RENEW;
+
+       if (ev->message_type == ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE)
+               __as_rotate(ad->dpy, ad->xwin, ad->win, ad);
+
+       return 0;
+}
+#endif
+
+static Eina_Bool s_key_registered;
+
+static
+Eina_Bool __key_press_cb(void *data, int type, void *event)
+{
+       Evas_Event_Key_Down *ev = event;
+
+       if (!s_key_registered) {
+               _E("Key is not registered");
+               return ECORE_CALLBACK_RENEW;
+       }
+
+       if (!ev) {
+               _E("Invalid event object");
+               return ECORE_CALLBACK_RENEW;
+       }
+
+       _D("key press - %s", ev->keyname);
+
+       if ((strcmp(ev->keyname, KEY_END) == 0) ||
+               (strcmp(ev->keyname, "Escape") == 0)) {
+               elm_exit();
+       }
+
+       return ECORE_CALLBACK_RENEW;
+}
+
+static void __register_key_handler(void *data)
+{
+       struct appdata *ad = (struct appdata *)data;
+
+       ad->key_up = ecore_event_handler_add(ECORE_EVENT_KEY_UP,
+                                                                               __key_press_cb, ad);
+       if (!ad->key_up) {
+               _E("Failed to register a key up event handler");
+       }
+
+       _D("Key handler is registered");
+       s_key_registered = EINA_TRUE;
+}
+
+void _unregister_key_handler(void *data)
+{
+       struct appdata *ad = (struct appdata *)data;
+
+       if (ad->key_up) {
+               ecore_event_handler_del(ad->key_up);
+               ad->key_up = NULL;
+       }
+
+       _D("Unregister key handler is invoked");
+       s_key_registered = EINA_FALSE;
+}
+
+static void __grab_key(void *data)
+{
+       struct appdata *ad = (struct appdata *)data;
+
+       _D("Grab home / back key.");
+
+       utilx_grab_key(ad->dpy, ad->xwin, KEY_HOME, SHARED_GRAB);
+
+       utilx_grab_key(ad->dpy, ad->xwin, KEY_BACK, TOP_POSITION_GRAB);
+
+       __register_key_handler(ad);
+}
+
+static void __ungrab_key(void *data)
+{
+       struct appdata *ad = (struct appdata *)data;
+
+       _unregister_key_handler(ad);
+
+       _D("Ungrab home / back key.");
+
+       utilx_ungrab_key(ad->dpy, ad->xwin, KEY_HOME);
+
+       utilx_ungrab_key(ad->dpy, ad->xwin, KEY_BACK);
+}
+
+static int __lang_changed(void *dummy, void *data)
+{
+       char* lang = NULL;
+
+       lang = vconf_get_str(VCONFKEY_LANGSET);
+       if(lang) {
+               LOGD("lang : %s", lang);
+               elm_language_set((const char*)lang);
+               free(lang);
+       } else {
+               LOGW("language get error");
+       }
+
+       popup_update_by_lang_changed_sig(data);
+
+       return 0;
+}
+
+static Eina_Bool __window_destory_event_cb(void *data, int type, void *event)
+{
+       struct appdata *ad = data;
+       Ecore_X_Event_Window_Hide *ev;
+
+       if((!event) || (!data)) {
+               _E("input param of transient cb is null");
+               return ECORE_CALLBACK_CANCEL;
+       }
+
+       ev = event;
+
+       if(ev->win == ad->caller_xwin) {
+               _D("caller window(%d) is destroyed. app-selector will be terminated after window lower", ad->caller_xwin);
+               elm_win_lower(ad->win);
+               elm_exit();
+       } else {
+               _D("__window_destory_event_cb : %d", ev->win);
+       }
+
+       return ECORE_CALLBACK_RENEW;
+}
+
+static int __aul_sub_app_cb(void *data)
+{
+       struct appdata *ad = data;
+
+       _D("aul sub app cb. caller request terminate event");
+       elm_win_lower(ad->win);
+       elm_exit();
+
+       return 0;
+}
+
+/* A app --> Popup --> B app (B app transient for App) : B app will be located between A app and Popup */
+static void __transient_for_set_app(void *data)
+{
+       struct appdata *ad = data;
+       int num = 0,i = 0,pid = 0;
+       Ecore_X_Window *wins;
+       Ecore_X_Window childwin;
+       Ecore_X_Window_Attributes attrs;
+
+       if(ad->caller_pid <= 0) {
+               _E("get CALLER PID ERROR for transient app");
+               return;
+       } else {
+               _SD("CALLER PID(%d)", ad->caller_pid);
+       }
+
+       if (is_reset == 1) {
+               if(ecore_x_icccm_transient_for_get(ad->xwin)){
+                       ecore_x_icccm_transient_for_unset(ad->xwin);
+               }
+       }
+
+
+       /* Below logic is for covering mini app(floating window) case */
+       wins = ecore_x_window_children_get(ecore_x_window_root_first_get(), &num);
+       Ecore_X_Atom E_ILLUME_USER_CREATED_WINDOW = ecore_x_atom_get("_E_USER_CREATED_WINDOW");
+
+       if (wins) {
+               /* Searching top window */
+               for (i = 0; i < num; i++) {
+                       int ret;
+                       ret = ecore_x_window_prop_window_get(wins[i], E_ILLUME_USER_CREATED_WINDOW, &childwin, 1);
+                       if((ret < 1) || (!childwin))
+                               continue;
+
+                       ecore_x_window_attributes_get(childwin, &attrs);
+                       if ( (attrs.visible == 0) || (attrs.viewable == 0) )
+                               continue;
+
+                       //char *wname = NULL, *wclass = NULL,*wmname= NULL;
+                       //ecore_x_icccm_name_class_get(childwin, &wname, &wclass);
+                       //ecore_x_netwm_name_get(childwin, &wmname);
+                       ecore_x_netwm_pid_get(childwin, &pid);
+                       if(ad->caller_pid == pid) {
+                               _D("caller xid : %d", childwin);
+
+                               ad->caller_xwin = childwin;
+
+                               aul_set_subapp(__aul_sub_app_cb, data);
+                               ecore_x_icccm_transient_for_set(ad->xwin, childwin);
+                               ecore_x_window_client_manage(childwin);
+                               ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DESTROY, __window_destory_event_cb, ad);
+                               free(wins);
+                               return;
+                       }
+               }
+               free(wins);
+       } else {
+               _E("x window children get error");
+       }
+}
+
+void _transient_for_unset_app(void *data)
+{
+       struct appdata *ad = data;
+
+       /* transient for unset */
+       if(ecore_x_icccm_transient_for_get(ad->xwin)){
+               _D("unset transient");
+               ecore_x_icccm_transient_for_unset(ad->xwin);
+       }
+}
+
+static int __app_create(void *data)
+{
+       struct appdata *ad = (struct appdata *)data;
+       Evas_Object *win;
+       Evas_Object *ly;
+       int r;
+
+       /* create window */
+       win = __create_win(PACKAGE);
+       if (win == NULL)
+               return -1;
+       ad->win = win;
+
+       /* Base Layout */
+       ly = __create_layout_main(ad->win);
+       if (!ly)
+               return -1;
+
+       ad->layout = ly;
+
+       edje_object_signal_emit(_EDJ(ly), "elm,bg,show,transparent", "elm");
+
+       ad->dpy = ecore_x_display_get();
+       ad->xwin = elm_win_xwindow_get(win);
+#ifdef ROTATE_USING_X_CLIENT
+       ad->rotate = ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE,
+                                                        __rotate, (void *)ad);
+       __as_rotate(ad->dpy, ad->xwin, win, ad);
+#else
+       ecore_x_icccm_name_class_set(ad->xwin, WIN_PROP_NAME, WIN_PROP_NAME);
+       if (elm_win_wm_rotation_supported_get(ad->win)) {
+               int rots[4] = { 0, 90, 180, 270 };
+               elm_win_wm_rotation_available_rotations_set(ad->win, (const int*)(&rots), 4);
+       } else {
+               _E("win rotation no supported");
+       }
+#endif
+
+       evas_object_show(win);
+
+       /* init internationalization */
+       r = appcore_set_i18n(PACKAGE, LOCALEDIR);
+       if (r)
+               return -1;
+
+       __grab_key(ad);
+
+       appcore_set_event_callback(APPCORE_EVENT_LANG_CHANGE, __lang_changed, ad);
+
+       return 0;
+}
+
+static int __app_init_with_bundle(void *data)
+{
+       struct appdata *ad = data;
+
+       load_app_select_popup(ad);
+
+       return 0;
+}
+
+static int __app_terminate(void *data)
+{
+       struct appdata *ad = data;
+       const char *val_noti = NULL;
+       const char *val_launch = NULL;
+       int ret;
+
+       _D("app_terminate");
+
+       if(exit_timer) {
+               ecore_timer_del(exit_timer);
+               exit_timer = NULL;
+       }
+
+       if(ecore_x_handler) {
+               ecore_event_handler_del(ecore_x_handler);
+               ecore_x_handler = NULL;
+       }
+
+       if(ad->rotate) {
+               ecore_event_handler_del(ad->rotate);
+               ad->rotate = NULL;
+       }
+
+       _transient_for_unset_app(data);
+
+       val_noti = bundle_get_val(ad->kb, "__APP_SVC_CALLER_NOTI__");
+       val_launch = bundle_get_val(ad->kb, "__APP_SVC_START_INFO__");
+
+       /* For native C++ app */
+       if(val_noti) {
+               /* Cancel case. START_INFO is set when app is launched successful */
+               if(aul_app_is_running(val_noti))
+               {
+                       if(!val_launch) {
+                               bundle_add(ad->kb, "__APP_SVC_START_INFO__", "c");
+                       }
+
+                       ret = aul_launch_app(val_noti, ad->kb);
+                       if(ret < AUL_R_OK) {
+                               _E("noti for natie app is failed(%d)", ret);
+                       }
+               }
+       /* For C app */
+       } else {
+               /* Cancel case. START_INFO is set when app is launched successful */
+               if(!val_launch) {
+                       do {
+                               bundle *kb;
+                               int ret_val;
+                               const char *pid = NULL;
+                               char callee_pid[20]={0,};
+
+                               pid = bundle_get_val(ad->kb, AUL_K_CALLER_PID);
+                               if(pid == NULL) {
+                                       _E("get CALLER PID ERROR");
+                                       break;
+                               } else {
+                                       _D("CALLER PID(%s)", pid);
+                               }
+
+                               kb = bundle_create();
+                               if(kb == NULL) {
+                                       _E("bundle create error");
+                                       break;
+                               }
+                               bundle_add(kb, AUL_K_SEND_RESULT, "1");
+                               bundle_add(kb, AUL_K_CALLER_PID, pid);
+
+                               snprintf(callee_pid,20,"%d",getpid());
+                               bundle_add(kb, AUL_K_CALLEE_PID, (const char*)callee_pid);
+
+                               ret_val = app_send_cmd_with_noreply(-2, 7, kb); /* 7 is APP_CANCEL */
+                               if(ret_val != AUL_R_OK) {
+                                       _E("app_send_cmd error(%d)", ret_val);
+                               }
+
+                               bundle_free(kb);
+                       } while (0);
+               }
+       }
+
+       clear_list_info(ad);
+
+       if (ad->layout) {
+               evas_object_del(ad->layout);
+               ad->layout = NULL;
+       }
+
+       if (ad->popup) {
+               evas_object_del(ad->popup);
+               ad->popup = NULL;
+       }
+
+       if (ad->win) {
+               evas_object_del(ad->win);
+               ad->win = NULL;
+       }
+
+       if (ad->kb) {
+               bundle_free(ad->kb);
+               ad->kb = NULL;
+       }
+
+       __ungrab_key(ad);
+
+       return 0;
+}
+
+static int __app_pause(void *data)
+{
+       _D("app_pause");
+
+       if(enable_pause_terminate) {
+               _D("pause_terminate is true. app will be terminated.");
+               elm_exit();
+       }
+
+       return 0;
+}
+
+static int __app_resume(void *data)
+{
+       _D("app_resume");
+
+       return 0;
+}
+
+static int __app_reset(bundle *b, void *data)
+{
+       struct appdata *ad = data;
+       char *str = NULL;
+       int ret = 0;
+
+       if (ad->kb) {
+               bundle_free(ad->kb);
+               ad->kb = NULL;
+       }
+
+       ad->kb = bundle_dup(b);
+
+       ad->window_id = (char *)bundle_get_val(ad->kb, "__APP_SVC_K_WIN_ID__");
+       _D("window id is %s", ad->window_id);
+
+       str = (char *)bundle_get_val(ad->kb, AUL_K_CALLER_PID);
+       _D("caller pid is %s", str);
+
+       if (str)
+               ad->caller_pid = atoi(str);
+       else
+               ad->caller_pid = -1;
+
+       ad->control_op = (char *)appsvc_get_operation(ad->kb);
+       ad->control_uri = (char *)appsvc_get_uri(ad->kb);
+       ad->control_mime = (char *)appsvc_get_mime(ad->kb);
+
+       _D("control_op is %s", ad->control_op);
+       _D("control_uri is %s", ad->control_uri);
+       _D("control_mime is %s", ad->control_mime);
+
+       ret = bundle_get_type(ad->kb, APP_SVC_K_SELECTOR_EXTRA_LIST);
+
+       ad->extra_list = NULL;
+       ad->extra_list_cnt = 0;
+
+       if(ret != BUNDLE_TYPE_NONE) {
+               if(ret & BUNDLE_TYPE_ARRAY) {
+                       ad->extra_list = (char**)appsvc_get_data_array(b, APP_SVC_K_SELECTOR_EXTRA_LIST , &(ad->extra_list_cnt));
+                       _D("extra list cnt : %d", ad->extra_list_cnt);
+               } else {
+                       str = (char*)appsvc_get_data(b, APP_SVC_K_SELECTOR_EXTRA_LIST );
+                       if(str) {
+                               ad->extra_list = (char**)&str;
+                               ad->extra_list_cnt = 1;
+                       }
+               }
+       }
+
+       if (!ad->control_op) {
+               load_info_popup(ad, dgettext("sys_string", "IDS_COM_BODY_NO_APPLICATIONS_CAN_PERFORM_THIS_ACTION"));
+               return 0;
+       }
+
+       __transient_for_set_app(ad);
+
+       /*
+          If AUL_K_ARGV0 is not NULL, the situation is launching(fork & exec).
+          else the situation is being received a reset event(old relaunch evet)
+        */
+       if (is_reset == 0) {
+               __app_init_with_bundle(data);
+               is_reset = 1;
+               evas_object_show(ad->win);
+       } else {
+               update_app_list(data);  /*(reset event) */
+               elm_win_activate(ad->win);
+       }
+
+       return 0;
+}
+
+EXPORT_API int main(int argc, char *argv[])
+{
+       struct appdata ad;
+       struct appcore_ops ops = {
+               .create = __app_create,
+               .terminate = __app_terminate,
+               .pause = __app_pause,
+               .resume = __app_resume,
+               .reset = __app_reset,
+       };
+
+       memset(&ad, 0x0, sizeof(struct appdata));
+       ops.data = &ad;
+
+       return appcore_efl_main(PACKAGE, &argc, &argv, &ops);
+}
diff --git a/app-selector.h b/app-selector.h
new file mode 100755 (executable)
index 0000000..5742125
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2012  Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+
+ *     http://floralicense.org/license
+
+ * 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 __APP_COMMON_H__
+#define __APP_COMMON_H__
+
+#include <Elementary.h>
+#include <bundle.h>
+#include <dlog.h>
+#include <X11/Xatom.h>
+#include <X11/Xutil.h>
+
+
+#undef LOG_TAG
+#define LOG_TAG "APP-SELECTOR"
+
+#define _E(fmt, arg...) LOGE("[%s,%d] "fmt,__FUNCTION__,__LINE__,##arg)
+#define _D(fmt, arg...) LOGD("[%s,%d] "fmt,__FUNCTION__,__LINE__,##arg)
+
+#define _SE(fmt, arg...) SECURE_LOGE(fmt,##arg)
+#define _SD(fmt, arg...) SECURE_LOGD(fmt,##arg)
+
+
+#if !defined(PACKAGE)
+#  define PACKAGE "app-selector"
+#endif
+
+#if !defined(LOCALEDIR)
+#  define LOCALEDIR "/usr/apps/org.tizen.app-selector/res/locale"
+#endif
+
+#define SYSSTRING "sys_string"
+
+#define ICON_PATH PREFIX"/share/icon"
+
+#define NAME_BUF_LEN (128)
+#define _EDJ(x)        elm_layout_edje_get(x)
+
+#if !defined(_)
+#define _(msgid) gettext(msgid)
+#endif
+
+#if !defined(N_)
+#define N_(msgid) gettext_noop(msgid)
+#endif
+
+struct appdata {
+       Evas_Object *win;
+       Evas_Object *layout;
+
+       Ecore_Event_Handler *key_up;
+       Ecore_Event_Handler *rotate;
+
+       Evas_Object *popup;
+
+       Eina_List *app_list;
+
+       Display *dpy;
+       Ecore_X_Window xwin;
+
+       bundle *kb;
+       int caller_pid;
+       Ecore_X_Window caller_xwin;
+
+       char *window_id;
+       char *control_op;
+       char *control_mime;
+       char *control_uri;
+       char **extra_list;
+       int extra_list_cnt;
+       /* add more variables here */
+};
+
+struct _select_app_info {
+       char *pkg_name;
+       char *app_name;
+       char *app_id;
+       char *app_path;
+       char *app_icon_path;
+       struct appdata *ad;
+       Elm_Object_Item *it;
+};
+
+#endif                         /* __APP_COMMON_H__ */
diff --git a/data/app-selector.edc b/data/app-selector.edc
new file mode 100644 (file)
index 0000000..1d76487
--- /dev/null
@@ -0,0 +1,3 @@
+collections {
+#include "groups/popup_custom.edc"
+}
diff --git a/data/groups/popup_custom.edc b/data/groups/popup_custom.edc
new file mode 100644 (file)
index 0000000..0a7d33d
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2012  Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+
+ *     http://floralicense.org/license
+
+ * 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.
+ *
+ */
+
+//No button: Height = 408 - (2 + 68)
+group { name: "app-selector/popup/layout/title_content";
+   parts {
+      part { name: "elm.swallow.content";
+         scale: 1;
+         type: SWALLOW;
+         description { state: "default" 0.0;
+            min: 0 338;
+            max: -1 338;
+         }
+      }
+   }
+}
+
+//No title and button present: Height  = 408 - 2
+group { name: "app-selector/popup/layout/default";
+   parts {
+      part { name: "elm.swallow.content";
+         scale: 1;
+         type: SWALLOW;
+         description { state: "default" 0.0;
+            min: 0 406;
+            max: -1 406;
+         }
+      }
+   }
+}
+
+//No title and button present: Height  = 480 - 2
+group { name: "app-selector/popup/layout/full";
+   parts {
+      part { name: "elm.swallow.content";
+         scale: 1;
+         type: SWALLOW;
+         description { state: "default" 0.0;
+            min: 0 478;
+            max: -1 478;
+         }
+      }
+   }
+}
+
+
diff --git a/org.tizen.app-selector-wearable.efl b/org.tizen.app-selector-wearable.efl
new file mode 100644 (file)
index 0000000..bbd2c7e
--- /dev/null
@@ -0,0 +1,45 @@
+org.tizen.app-selector system::homedir rwxat- ------
+org.tizen.app-selector system::vconf rwxat- ------
+org.tizen.app-selector system::media rwxat- ------
+org.tizen.app-selector system::share rwxat- ------
+org.tizen.app-selector pulseaudio rwxat- ------
+e17 org.tizen.app-selector -w---- ------
+org.tizen.app-selector sys-assert::core rwxat- ------
+org.tizen.app-selector privacy-manager::db r----l ------
+org.tizen.app-selector pkgmgr::db rw---l ------
+org.tizen.app-selector system::vconf_inhouse rw---- ------
+org.tizen.app-selector system::vconf_setting rw---- ------
+org.tizen.app-selector system::vconf_privacy rw---- ------
+org.tizen.app-selector system::vconf_system rw---- ------
+org.tizen.app-selector system::vconf_multimedia rw---- ------
+org.tizen.app-selector system::vconf_network rw---- ------
+org.tizen.app-selector system::vconf_misc rw---- ------
+org.tizen.app-selector device::app_logging -w---- ------
+org.tizen.app-selector device::sys_logging -w---- ------
+org.tizen.app-selector org.tizen.w-idle-clock-weather2 rwx--- ------
+org.tizen.app-selector org.tizen.idle-clock-pedometer rwx--- ------
+org.tizen.app-selector org.tizen.w-idle-clock-shortcut2 rwx--- ------
+org.tizen.app-selector org.tizen.idle-clock-event rwx--- ------
+org.tizen.app-selector org.tizen.idle-clock-dual rwx--- ------
+org.tizen.app-selector org.tizen.w-idle-clock-analog3 rwx--- ------
+org.tizen.app-selector org.tizen.w-idle-clock-analog1 rwx--- ------
+org.tizen.app-selector org.tizen.idle-clock-digital rwx--- ------
+org.tizen.app-selector org.tizen.w-idle-clock-analog2 rwx--- ------
+org.tizen.app-selector ecore::lock rwxat- ------
+org.tizen.app-selector system::use_internet r----- ------
+org.tizen.app-selector xorg rw---- ------
+org.tizen.app-selector isf r-x--- ------
+org.tizen.app-selector syslogd -w---- ------
+org.tizen.app-selector ail::db rw---- ------
+org.tizen.app-selector net.wifi-qs --x--- ------
+org.tizen.app-selector sound_server rw---- ------
+org.tizen.app-selector dbus r----- ------
+stest-service org.tizen.app-selector r-x--- ------
+org.tizen.app-selector stest-service -w---- ------
+org.tizen.app-selector app-svc::db rw---- ------
+org.tizen.app-selector aul::launch --x--- ------
+org.tizen.volume org.tizen.app-selector rw---- ------
+org.tizen.app-selector tts-server rwx--- ------
+org.tizen.app-selector svi-data r-x--- ------
+org.tizen.app-selector aul r----- ------
+org.tizen.app-selector systemd-journal --x--- ------
diff --git a/org.tizen.app-selector-wearable.manifest b/org.tizen.app-selector-wearable.manifest
new file mode 100644 (file)
index 0000000..2161ef7
--- /dev/null
@@ -0,0 +1,11 @@
+<manifest>
+       <define>
+               <domain name="org.tizen.app-selector" />
+       </define>
+       <request>
+               <domain name="org.tizen.app-selector" />
+       </request>
+       <assign>
+               <filesystem path="/usr/apps/org.tizen.app-selector/bin/app-selector" exec_label="org.tizen.app-selector" />
+       </assign>
+</manifest>
diff --git a/org.tizen.app-selector-wearable.xml.in b/org.tizen.app-selector-wearable.xml.in
new file mode 100755 (executable)
index 0000000..9e31221
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.app-selector" version="@APP_SELECTOR_VERSION@" install-location="internal-only">
+       <label>Application Selection Popup</label>
+       <author email="sewook7.park@samsung.com" href="www.samsung.com">Sewook Park</author>
+       <description>Application Selection Popup</description>
+       <ui-application appid="org.tizen.app-selector" exec="/usr/apps/org.tizen.app-selector-wearable/bin/app-selector" nodisplay="true" multiple="false" type="capp" taskmanage="false">
+               <label>Application Selection Popup</label>
+       </ui-application>
+</manifest>
diff --git a/packaging/org.tizen.app-selector-wearable.spec b/packaging/org.tizen.app-selector-wearable.spec
new file mode 100644 (file)
index 0000000..62b8b5d
--- /dev/null
@@ -0,0 +1,70 @@
+Name:       org.tizen.app-selector-wearable
+Summary:    Application selector
+Version:    0.1.57
+Release:    1
+Group:      TO_BE/FILLED_IN
+License:    Flora-1.1
+Source0:    %{name}-%{version}.tar.gz
+BuildRequires:  cmake
+BuildRequires:  gettext-tools
+BuildRequires:  edje-tools
+BuildRequires:  pkgconfig(appcore-efl)
+BuildRequires:  pkgconfig(aul)
+BuildRequires:  pkgconfig(utilX)
+BuildRequires:  pkgconfig(ecore-x)
+BuildRequires:  pkgconfig(eina)
+BuildRequires:  pkgconfig(evas)
+BuildRequires:  pkgconfig(ecore)
+BuildRequires:  pkgconfig(ecore-file)
+BuildRequires:  pkgconfig(edje)
+BuildRequires:  pkgconfig(appsvc)
+BuildRequires:  pkgconfig(xcomposite)
+BuildRequires:  pkgconfig(xext)
+BuildRequires:  pkgconfig(efl-assist)
+BuildRequires:  pkgconfig(pkgmgr-info)
+BuildRequires:  hash-signer
+
+%description
+SLP application selector
+%prep
+%setup -q
+
+
+%build
+%if 0%{?sec_build_binary_debug_enable}
+export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
+export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
+export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
+%endif
+export CFLAGS="$CFLAGS -Wall -Werror -Wno-unused-function"
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DAPP_SELECTOR_VERSION="%{version}"
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+#Signing
+%define tizen_sign_base /usr/apps/%{name}
+%define tizen_sign 1
+%define tizen_author_sign 1
+%define tizen_dist_sign 1
+%define tizen_sign_level platform
+mkdir -p %{buildroot}/usr/share/license
+install LICENSE %{buildroot}/usr/share/license/%{name}
+
+%post
+/usr/bin/signing-client/hash-signer-client.sh -a -d -p platform /usr/apps/%{name}
+%files
+%manifest %{name}.manifest
+%defattr(-,root,root,-)
+/usr/apps/%{name}/bin/*
+/usr/apps/%{name}/res/edje/*
+/usr/share/packages/%{name}.xml
+/etc/smack/accesses.d/%{name}.efl
+#Signing
+/usr/apps/%{name}/author-signature.xml
+/usr/apps/%{name}/signature1.xml
+/usr/share/license/%{name}