Bug Fix for : TIVI-1843, TIVI-1820, TIVI-1786. 68/10268/3 accepted/tizen/20131003.215820 accepted/tizen/20131003.220120 submit/tizen/20131003.205538
authorHayato Nakamura <hayato.nakamura@mail.toyota-td.jp>
Thu, 26 Sep 2013 04:49:23 +0000 (13:49 +0900)
committerHayato Nakamura <hayato.nakamura@mail.toyota-td.jp>
Thu, 3 Oct 2013 01:39:38 +0000 (10:39 +0900)
Bug Fix for : TIVI-1436, TIVI-1741, TIVI-1787, TIVI- 1815, TIVI-1816, TIVI-1836, TIVI-1900, TIVI-1905

Change-Id: I1f994719d98e60e2a5c278f2c08d37b276ed05bf
Signed-off-by: Hayato Nakamura <hayato.nakamura@mail.toyota-td.jp>
100 files changed:
data/lib/systemd/user/ico-system-controller.service
data/lib/systemd/user/ico-uxf-wait-launchpad-ready.path
include/ico_syc_inputctl.h
include/ico_syc_msg_cmd_def.h
include/ico_syc_public.h
include/ico_syc_type.h
include/ico_syc_winctl.h
lib/apps-framework/ico_syc_common.c
lib/apps-framework/ico_syc_inputctl.c
lib/apps-framework/ico_syc_winctl.c
lib/system-controller/CicoSCAilItems.cpp
lib/system-controller/CicoSCAilItems.h
lib/system-controller/CicoSCAulItems.cpp
lib/system-controller/CicoSCAulItems.h
lib/system-controller/CicoSCCommand.cpp
lib/system-controller/CicoSCCommand.h
lib/system-controller/CicoSCConf.h
lib/system-controller/CicoSCDisplay.cpp
lib/system-controller/CicoSCDisplay.h
lib/system-controller/CicoSCDisplayZone.cpp
lib/system-controller/CicoSCInputController.cpp
lib/system-controller/CicoSCInputController.h
lib/system-controller/CicoSCLifeCycleController.cpp
lib/system-controller/CicoSCLifeCycleController.h
lib/system-controller/CicoSCPolicyManager.cpp
lib/system-controller/CicoSCResourceManager.cpp
lib/system-controller/CicoSCResourceManager.h
lib/system-controller/CicoSCServer.cpp
lib/system-controller/CicoSCSystemConfig.cpp
lib/system-controller/CicoSCSystemConfig.h
lib/system-controller/CicoSCUserManager.cpp
lib/system-controller/CicoSCUserManager.h
lib/system-controller/CicoSCWayland.cpp
lib/system-controller/CicoSCWayland.h
lib/system-controller/CicoSCWindow.cpp
lib/system-controller/CicoSCWindow.h
lib/system-controller/CicoSCWindowController.cpp
lib/system-controller/CicoSCWindowController.h
lib/system-controller/CicoSCWlInputMgrIF.cpp
lib/system-controller/CicoSCWlInputMgrIF.h
lib/system-controller/CicoSCWlWinMgrIF.cpp
packaging/ico-uxf-homescreen.changes
packaging/ico-uxf-homescreen.spec
res/org.tizen.ico.homescreen/res/config/app_attr.conf
res/org.tizen.ico.homescreen/res/config/homescreen.conf [moved from res/org.tizen.ico.homescreen/res/apps/org.tizen.ico.homescreen/homescreen.conf with 62% similarity]
res/org.tizen.ico.homescreen/res/config/menu_categoryid.conf [new file with mode: 0644]
res/org.tizen.ico.homescreen/res/images/pageDownCursor.png [new file with mode: 0644]
res/org.tizen.ico.homescreen/res/images/pageUpCursor.png [new file with mode: 0644]
res/org.tizen.ico.system-controller/res/config/app_attr.conf
res/org.tizen.ico.system-controller/res/config/policy.json
res/org.tizen.ico.system-controller/res/config/system.xml
src/homescreen/CicoHSAppHistory.cpp
src/homescreen/CicoHSAppHistory.h
src/homescreen/CicoHSAppHistoryExt.cpp [new file with mode: 0644]
src/homescreen/CicoHSAppHistoryExt.h [new file with mode: 0644]
src/homescreen/CicoHSAppInfo.cpp
src/homescreen/CicoHSAppInfo.h
src/homescreen/CicoHSBackWindow.cpp
src/homescreen/CicoHSControlBarTouch.cpp
src/homescreen/CicoHSControlBarWindow.cpp
src/homescreen/CicoHSControlBarWindow.h
src/homescreen/CicoHSFlickInputWindow.cpp [new file with mode: 0644]
src/homescreen/CicoHSFlickInputWindow.h [new file with mode: 0644]
src/homescreen/CicoHSFlickTouch.cpp [new file with mode: 0644]
src/homescreen/CicoHSFlickTouch.h [new file with mode: 0644]
src/homescreen/CicoHSMenuTile.cpp
src/homescreen/CicoHSMenuTile.h
src/homescreen/CicoHSMenuTouch.cpp
src/homescreen/CicoHSMenuTouch.h
src/homescreen/CicoHSMenuWindow.cpp
src/homescreen/CicoHSMenuWindow.h
src/homescreen/CicoHSWindow.h
src/homescreen/CicoHSWindowController.cpp
src/homescreen/CicoHSWindowController.h
src/homescreen/CicoHomeScreen.cpp
src/homescreen/CicoHomeScreen.h
src/homescreen/CicoHomeScreenCommon.h
src/homescreen/CicoHomeScreenConfig.cpp
src/homescreen/CicoHomeScreenConfig.h
src/homescreen/CicoOnScreenAction.cpp
src/homescreen/CicoSCAilItems.cpp
src/homescreen/CicoSCAilItems.h
src/homescreen/CicoSCAulItems.cpp
src/homescreen/CicoSCAulItems.h
src/homescreen/CicoSCConf.h
src/homescreen/CicoSCLifeCycleController.cpp
src/homescreen/CicoSCLifeCycleController.h
src/homescreen/CicoSCSystemConfig.cpp
src/homescreen/CicoSCSystemConfig.h
src/homescreen/CicoStatusBarControlWindow.cpp
src/homescreen/Cico_aul_listen_app.cpp [new file with mode: 0644]
src/homescreen/Cico_aul_listen_app.h [new file with mode: 0644]
src/homescreen/Makefile.am
src/homescreen/home_screen_main.cpp
src/syscond/CicoEFLApp.cpp
src/syscond/CicoSysConDaemon.cpp
src/syscond/Makefile.am
tests/system-controller/apps-framework/tst_inputctl.c
tool/kill_syscond.sh
tool/start_syscond.sh

index b4b4974..0e08d98 100644 (file)
@@ -1,13 +1,12 @@
 [Unit]
 Description=ico system controller
 Requires=weston.service
+Wants=ico-device-input-controller.service
+Wants=ico-vic-carsim.service
 Before=weston.service
-Before=ico-app-meter.service
 
 [Service]
 Environment=TIZEN_PLATFORMLOGGING_MODE=1
 Environment=TIZEN_DLOG_LEVEL=1
 Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%U/dbus/user_bus_socket
-#Environment=XDG_RUNTIME_DIR=/run/user/5000
-Type=oneshot
 ExecStart=/usr/bin/launch_app org.tizen.ico.system-controller
index e8cce6b..7e80cbe 100644 (file)
@@ -1,4 +1,4 @@
-Description=Path activation for ico-system-controller
+Description=Path activation for ico-system-controller
 
 [Path]
 PathExists=/tmp/amd_ready
index 524adcf..3fc97b8 100644 (file)
@@ -96,6 +96,7 @@ int ico_syc_delete_input(const char *appid, const char *device, int input);
  * @param[in]   surface                 window's surface id
  * @param[in]   type                    device type of input event
  * @param[in]   deviceno                input device number
+ * @param[in]   time                    input event time(ms), if 0 auto generate
  * @param[in]   code                    input event code
  * @param[in]   value                   input event value
  * @return      result
@@ -105,7 +106,7 @@ int ico_syc_delete_input(const char *appid, const char *device, int input);
  */
 /*--------------------------------------------------------------------------*/
 int ico_syc_send_input(const char *appid, int surface, int type,
-                       int deviceno, int code, int value);
+                       int deviceno, int time, int code, int value);
 
 
 #ifdef __cplusplus
index 997956c..ee0f1d7 100644 (file)
@@ -54,6 +54,7 @@ extern "C" {
 #define MSG_PRMKEY_KEY          (char *)"keycode"
 #define MSG_PRMKEY_DEVICE       (char *)"deviceno"
 #define MSG_PRMKEY_EV_TYPE      (char *)"ev_type"
+#define MSG_PRMKEY_EV_TIME      (char *)"ev_time"
 #define MSG_PRMKEY_EV_CODE      (char *)"ev_code"
 #define MSG_PRMKEY_EV_VAL       (char *)"ev_value"
 #define MSG_PRMKEY_POS_X        (char *)"pos_x"
@@ -127,6 +128,7 @@ extern "C" {
 #define MSG_CMD_CHANGE_ACTIVE       0x00010006
 #define MSG_CMD_CHANGE_LAYER        0x00010007
 #define MSG_CMD_CHANGE_ATTR         0x00010008
+#define MSG_CMD_NAME                0x00010009
 #define MSG_CMD_MAP_THUMB           0x00010011
 #define MSG_CMD_UNMAP_THUMB         0x00010012
 #define MSG_CMD_SHOW_LAYER          0x00010020
index a4731c9..a9aa621 100644 (file)
@@ -22,9 +22,18 @@ extern "C" {
 /*============================================================================*/
 /* definition                                                                 */
 /*============================================================================*/
+/* login user name bundle key name */
 #define ICO_SYC_APP_BUNDLE_KEY1 "HS_PARAM_U"
+
+/* Individual history file of the logged-in user. parameter key */
 #define ICO_SYC_APP_BUNDLE_KEY2 "HS_PARAM_D"
 
+/* History file of common. parameter key */
+#define ICO_SYC_APP_BUNDLE_KEY3 "HS_PARAM_DD"
+
+/* change user status flag file. parameter key */
+#define ICO_SYC_APP_BUNDLE_KEY4 "HS_PARAM_FLG"
+
 #ifdef __cplusplus
 }
 #endif
index c711ca5..7c5827c 100644 (file)
@@ -56,7 +56,8 @@ typedef enum _event_id {
     ICO_SYC_EV_INPUT_SET            = 16, /* set input region */
     ICO_SYC_EV_INPUT_UNSET          = 17, /* unset input region */
     ICO_SYC_EV_LASTINFO             = 18, /* notify the last information */
-    ICO_SYC_EV_STATE_CHANGE         = 19  /* notify changed state */
+    ICO_SYC_EV_STATE_CHANGE         = 19, /* notify changed state */
+    ICO_SYC_EV_WIN_NAME             = 20  /* notify window name */
 } ico_syc_ev_e;
 
 /*
@@ -171,6 +172,7 @@ typedef struct _win_info {
 typedef struct _win_attr {
     char *appid;    /* application id */
     char *name;     /* window's surface name */
+    char *zone;     /* window's current zone name */
     int  surface;   /* window's surface id */
     int  nodeid;    /* ecu number and display number in the ecu */
     int  layer;     /* id of layer that the application's window is on */
index e0f3534..c147051 100644 (file)
@@ -39,6 +39,11 @@ typedef enum _window_show {
 /*
  * animation information
  */
+#define ICO_SYC_WIN_SURF_RAISE      0x01000000
+#define ICO_SYC_WIN_SURF_LOWER      0x02000000
+#define ICO_SYC_WIN_SURF_NOCHANGE   0x04000000
+#define ICO_SYC_WIN_SURF_NORESCTL   0x40000000
+#define ICO_SYC_WIN_SURF_FLAGS      0xff000000
 typedef struct _animation_info {
     char *name;     /* name of animation (ex. fade,slide,zoom etc..) */
     int  time;      /* millisecond time to show the transition's animation */
index d3ab6d6..ba9d3c6 100644 (file)
@@ -296,6 +296,9 @@ static int _get_event_from_cmd(int command)
     case MSG_CMD_NOTIFY_CHANGED_STATE:
         event = ICO_SYC_EV_STATE_CHANGE;
         break;
+    case MSG_CMD_NAME:
+        event = ICO_SYC_EV_WIN_NAME;
+        break;
     default:
         break;
     }
@@ -339,6 +342,7 @@ _exec_callback(void *user_data)
         case ICO_SYC_EV_WIN_CREATE:
         case ICO_SYC_EV_WIN_DESTROY:
         case ICO_SYC_EV_WIN_ACTIVE:
+        case ICO_SYC_EV_WIN_NAME:
             ico_syc_cb_win(syc_callback, user_data, event,
                            recv_data->data, recv_data->len);
             break;
index f5e5dd4..15f0100 100644 (file)
@@ -26,7 +26,7 @@ static msg_t _create_add_input_msg(const char *appid, const char *device,
 static msg_t _create_del_input_msg(const char *appid,
                                   const char *device, int input);
 static msg_t _create_send_input_msg(const char *appid, int surface, int type,
-                                   int deviceno, int code, int value);
+                                   int deviceno, int time, int code, int value);
 
 /*============================================================================*/
 /* static function                                                            */
@@ -144,6 +144,7 @@ _create_del_input_msg(const char *appid, const char *device, int input)
  * @param[in]   surface                 window's surface id
  * @param[in]   type                    device type of input event
  * @param[in]   deviceno                input device number
+ * @param[in]   time                    input event time(ms)
  * @param[in]   code                    input event code
  * @param[in]   value                   input event value
  * @return      json generator
@@ -153,7 +154,7 @@ _create_del_input_msg(const char *appid, const char *device, int input)
 /*--------------------------------------------------------------------------*/
 static msg_t
 _create_send_input_msg(const char *appid, int surface, int type,
-                       int deviceno, int code, int value)
+                       int deviceno, int time, int code, int value)
 {
     JsonObject *obj     = NULL;
     JsonObject *argobj  = NULL;
@@ -176,6 +177,7 @@ _create_send_input_msg(const char *appid, int surface, int type,
     json_object_set_int_member(argobj, MSG_PRMKEY_SURFACE, surface);
     json_object_set_int_member(argobj, MSG_PRMKEY_EV_TYPE, type);
     json_object_set_int_member(argobj, MSG_PRMKEY_DEVICE, deviceno);
+    json_object_set_int_member(argobj, MSG_PRMKEY_EV_TIME, time);
     json_object_set_int_member(argobj, MSG_PRMKEY_EV_CODE, code);
     json_object_set_int_member(argobj, MSG_PRMKEY_EV_VAL, value);
     json_object_set_object_member(obj, MSG_PRMKEY_ARG, argobj);
@@ -278,6 +280,7 @@ ico_syc_delete_input(const char *appid, const char *device, int input)
  * @param[in]   surface                 window's surface id
  * @param[in]   type                    device type of input event
  * @param[in]   deviceno                input device number
+ * @param[in]   time                    input event time
  * @param[in]   code                    input event code
  * @param[in]   value                   input event value
  * @return      result
@@ -288,7 +291,7 @@ ico_syc_delete_input(const char *appid, const char *device, int input)
 /*--------------------------------------------------------------------------*/
 ICO_API int
 ico_syc_send_input(const char *appid, int surface, int type,
-                   int deviceno, int code, int value)
+                   int deviceno, int time, int code, int value)
 {
     int ret = ICO_SYC_ERR_NONE;
     msg_t msg;
@@ -300,7 +303,7 @@ ico_syc_send_input(const char *appid, int surface, int type,
     }
 
     /* make message */
-    msg = _create_send_input_msg(appid, surface, type, deviceno, code, value);
+    msg = _create_send_input_msg(appid, surface, type, deviceno, time, code, value);
     /* send message */
     ret = ico_syc_send_msg(msg);
     /* free send message */
index c3fa0e2..ed6bd5c 100644 (file)
@@ -588,6 +588,7 @@ ico_syc_cb_win_attr(ico_syc_callback_t callback, void *user_data,
     /* set data */
     win_attr->appid = strdup(ico_syc_get_str_member(obj, MSG_PRMKEY_APPID));
     win_attr->name = strdup(ico_syc_get_str_member(argobj, MSG_PRMKEY_WINNAME));
+    win_attr->zone = strdup(ico_syc_get_str_member(argobj, MSG_PRMKEY_ZONE));
     win_attr->surface = ico_syc_get_int_member(argobj, MSG_PRMKEY_SURFACE);
     win_attr->nodeid = ico_syc_get_int_member(argobj, MSG_PRMKEY_NODE);
     win_attr->layer = ico_syc_get_int_member(argobj, MSG_PRMKEY_LAYER);
@@ -606,6 +607,7 @@ ico_syc_cb_win_attr(ico_syc_callback_t callback, void *user_data,
     g_object_unref(parser);
     if (win_attr->appid != NULL) free(win_attr->appid);
     if (win_attr->name != NULL) free(win_attr->name);
+    if (win_attr->zone != NULL) free(win_attr->zone);
     free(win_attr);
 
     return;
index 327e6ca..39e1769 100644 (file)
@@ -511,7 +511,7 @@ bool CicoSCAilItems::categoryParseCategory(const string& s)
  */
 bool CicoSCAilItems::categoryParseGetValue(const std::string& s,
                                            const std::string& k,
-                                           std::string val)
+                                           std::string val)
 {
     ICO_TRA("start, %s, %s", s.c_str(), k.c_str());
     const char* ps = s.c_str();
@@ -539,7 +539,7 @@ bool CicoSCAilItems::categoryParseGetValue(const std::string& s,
         ICO_TRA("end NG");
         return false;
     }
-    val = ps[c2];
+    val = s.substr(c2);
     ICO_TRA("end %s", val.c_str());
     return true;
 }
index 600707d..8539f67 100644 (file)
@@ -53,7 +53,7 @@ protected: // member method
     bool categoryParseKind(const std::string& s);
     bool categoryParseCategory(const std::string& s);
     bool categoryParseGetValue(const std::string& s, const std::string& k,
-                               std::string val);
+                               std::string val);
     bool categoryGetDisplay(const std::string& disp, const std::string& layer,
                             const std::string& zone);
     bool categoryGetSound(const std::string& sound, const std::string& zone);
index f3c84b2..661f7ff 100644 (file)
@@ -37,14 +37,15 @@ CicoSCAulItems::CicoSCAulItems()
     m_memcgroup = -1;
     m_defCgrpCpu.clear();
     m_defCgrpMem.clear();
+    m_aulstt = AUL_R_OK;
 }
 
 /**
  * @brief AUL Items class constructor
  */
 CicoSCAulItems::CicoSCAulItems(const char* appid, int pid, int ctgry,
-                               const CicoSCWindow* obj)
-    :m_appid(appid), m_pid(pid), m_category(ctgry)
+                               int aulstt, const CicoSCWindow* obj)
+    :m_appid(appid), m_pid(pid), m_category(ctgry), m_aulstt(aulstt)
 {
     ICO_TRA("constructor %s, %d, %x", appid? appid: "(NIL)", pid, obj);
     enterWindow(obj);
@@ -82,6 +83,7 @@ CicoSCAulItems::CicoSCAulItems(const CicoSCAulItems& s)
 #endif
     m_defCgrpCpu = s.m_defCgrpCpu;
     m_defCgrpMem = s.m_defCgrpMem;
+    m_aulstt = s.m_aulstt;
 }
 
 /**
@@ -132,7 +134,7 @@ void CicoSCAulItems::enterWindow(const CicoSCWindow* obj)
 }
 
 /**
- * @breif removw CicoSCWindow pointer
+ * @brief removw CicoSCWindow pointer
  * @param obj remove target
  */
 void CicoSCAulItems::rmWindow(const CicoSCWindow* obj)
@@ -152,7 +154,7 @@ void CicoSCAulItems::rmWindow(const CicoSCWindow* obj)
 }
 
 /**
- * @breif get cgroup data by /proc/[pid]/cgroup file
+ * @brief get cgroup data by /proc/[pid]/cgroup file
  * @parm pid target pid number
  * @param m store cgroup memory directory data
  * @param c store cgroup cpu,cpuacct directory data
@@ -203,3 +205,21 @@ bool CicoSCAulItems::getPidCgroupInfo(int pid, string& m, string& c)
     return bR;
 }
 
+/**
+ * @breif appid update
+ */
+void CicoSCAulItems::update_appid()
+{
+    if (AUL_R_OK == m_aulstt) {
+        return;
+    }
+    ICO_TRA("update start %d, %s", m_aulstt, m_appid.c_str());
+    char buf[255];
+    buf[0] = '\0'; // STOP CODE
+    m_aulstt = aul_app_get_appid_bypid(m_pid, buf, sizeof(buf));
+    if (AUL_R_OK == m_aulstt) {
+        m_appid = buf;
+    }
+    ICO_TRA("update end %d, %s", m_aulstt, m_appid.c_str());
+    return ;
+}
index 2903e5d..61c90a2 100644 (file)
@@ -16,7 +16,6 @@
 class CicoSCWindow;
 #endif
 
-
 /**
  * @brief System controller unit
  *        application life cycle information data
@@ -26,7 +25,7 @@ class CicoSCWindow;
 class CicoSCAulItems {
 public: // member method
     CicoSCAulItems();
-    CicoSCAulItems(const char* appid, int pid, int ctgry,
+    CicoSCAulItems(const char* appid, int pid, int ctgry, int aulstt,
                    const CicoSCWindow* obj=NULL);
     CicoSCAulItems(const CicoSCAulItems& raul);
     ~CicoSCAulItems();
@@ -34,6 +33,7 @@ public: // member method
     const CicoSCAulItems* p() const;
     void enterWindow(const CicoSCWindow* obj);
     void rmWindow(const CicoSCWindow* obj);
+    void update_appid();
 protected: // member method
     bool getPidCgroupInfo(int pid, std::string& m, std::string& c);
 private: // member method
@@ -49,35 +49,8 @@ public: // member aria
 protected: // member aria
     std::string m_defCgrpCpu;
     std::string m_defCgrpMem;
+    int m_aulstt;
 
-#if 0 // TODO mk_k
-//    std::string m_icon; // icon file path
-    bool m_active; //
-    bool m_supend; //
-    std::string m_group;
-    int  m_nodeID;
-    std::string m_location;
-    std::string m_animation;
-    int m_animationTime;
-    bool m_autoStart; // auto start flag
-    bool m_memnuOverlap;
-    int  m_invisibleCPU;
-    int  m_kindID;
-    int  m_categoryID;
-    int  m_displayZoneNum; // display zone number
-    int  m_soundZoneNum;  // sound zone number
-    int  m_inputDevNum;   // input device number
-    int  m_display;
-    int  m_sound;
-    int  m_input;
-
-
-
-    std::string m_name;
-    std::string m_execPath;
-    std::string m_type;
-    bool m_resumeShow
-#endif
 };
 
 inline const CicoSCAulItems* CicoSCAulItems::p() const
index 772ba06..cec8a1f 100644 (file)
@@ -74,7 +74,7 @@ CicoSCCommand::~CicoSCCommand()
 int
 CicoSCCommand::parseMessage(const char *message)
 {
-    ICO_DBG("CicoSCCommand::parseMessage Enter(%s)", message);
+//    ICO_DBG("CicoSCCommand::parseMessage Enter(%s)", message);
     try {
         stringstream jsonString(message);
         ptree root;
@@ -110,11 +110,11 @@ CicoSCCommand::parseMessage(const char *message)
     catch (std::exception const& e)
     {
         ICO_WRN("catch exception %s", e.what());
-        ICO_DBG("CicoSCCommand::parseMessage Leave(EINVAL)");
+//        ICO_ERR("CicoSCCommand::parseMessage Leave(EINVAL)");
         return ICO_SYC_EINVAL;
     }
 
-    ICO_DBG("CicoSCCommand::parseMessage Leave(EOK)");
+//    ICO_DBG("CicoSCCommand::parseMessage Leave(EOK)");
     return ICO_SYC_EOK;
 }
 
@@ -256,6 +256,9 @@ CicoSCCommand::parseWinCtrlOpt(const ptree & root)
     options->zone          = getStrValue(root, "arg.zone");
     options->animation     = getStrValue(root, "arg.anim_name");
     options->animationTime = getIntValue(root, "arg.anim_time");
+    if (-1 == options->animationTime) {
+        options->animationTime = 0;
+    }
     options->x             = getIntValue(root, "arg.pos_x");
     options->y             = getIntValue(root, "arg.pos_y");
     options->width         = getIntValue(root, "arg.width");
@@ -286,6 +289,7 @@ CicoSCCommand::parseWinCtrlOpt(const ptree & root)
  *      "alloc_type": (int) allocation type
  *      "keycode":    (int) key code
  *      "ev_type":    (int) event type
+ *      "ev_time":    (int) event time
  *      "ev_code":    (int) event cord
  *      "ev_value":   (int) event value
  *    }
@@ -306,6 +310,7 @@ CicoSCCommand::parseInputDevCtrlOpt(const ptree & root)
     options->fix       = getIntValue(root, "arg.alloc_type");
     options->keycode   = getIntValue(root, "arg.keycode");
     options->evtype    = getIntValue(root, "arg.ev_type");
+    options->evtime    = getIntValue(root, "arg.ev_time");
     options->evcode    = getIntValue(root, "arg.ev_code");
     options->evvalue   = getIntValue(root, "arg.ev_value");
 }
@@ -323,7 +328,7 @@ CicoSCCommand::parseInputDevCtrlOpt(const ptree & root)
  *    "arg": {
  *      "user":     (string) user name
  *      "password": (string) user password
- *      "lastinof": (string) infomation of application last state
+ *      "lastinof": (string) information of application last state
  *    }
  *  }
  *  </pre>
index 3fdedba..1145afd 100644 (file)
@@ -52,7 +52,7 @@ public:
     /// default constructor
     CicoSCCmdWinCtrlOpt()
         : nodeid(0), displayid(0), layerid(0),
-          zone(""), surfaceid(-1), animation(""), animationTime(-1),
+          zone(""), surfaceid(-1), animation(""), animationTime(0),
           x(-1), y(-1), width(-1), height(-1), raise(-1),
           visible(-1), active(-1), framerate(0), stride(-1), format(-1) {}
 
@@ -104,7 +104,7 @@ public:
     /// default constructor
     CicoSCCmdInputDevCtrlOpt()
         : device(""), input(-1), surfaceid(-1), deviceno(-1),
-          fix(-1), keycode(-1), evtype(-1), evcode(-1),
+          fix(-1), keycode(-1), evtype(-1), evtime(0), evcode(-1),
           evvalue(-1) {}
 
     /// destructor
@@ -115,9 +115,9 @@ public:
     {
         ICO_DBG("InputCtrlOpt: "
                 "device=%s input=%d surfaceid=0x%08X deviceno=%d "
-                "fix=%d keycode=%d evtype=%d evcode=%d evvalue=%d",
+                "fix=%d keycode=%d evtype=%d evtime=%d evcode=%d evvalue=%d",
                 device.c_str(), input, surfaceid, deviceno,
-                fix, keycode, evtype, evcode, evvalue);
+                fix, keycode, evtype, evtime, evcode, evvalue);
     }
 
     std::string device;     //!< name of input device
@@ -127,6 +127,7 @@ public:
     int         fix;        //!< status of fix
     int         keycode;    //!< code of key
     int         evtype;     //!< type of event
+    int         evtime;     //!< time of event
     int         evcode;     //!< code of event
     int         evvalue;    //!< value of event
 };
@@ -169,7 +170,7 @@ public:
     /// default constructor
     CicoSCCmdResCtrlOpt()
         : dispres(false), dispzone(""), winname(""), surfaceid(-1),
-          animation(""), animationTime(-1),
+          animation(""), animationTime(0),
           soundres(false), soundzone(""), soundname(""), adjust(0),
           inputres(false), device(""), input(0), type(0) {}
 
index eaab789..b822500 100644 (file)
@@ -213,8 +213,12 @@ public:
     int         width;   ///< display width resolution
     int         height;  ///< display height resolution
     int         inch;    ///< display inch size
-    std::vector<CicoSCLayerConf*>        layerConfList;  // layer config list
-    std::vector<CicoSCDisplayZoneConf*>  zoneConfList;   // zone config list
+
+    // layer config list
+    std::vector<CicoSCLayerConf*> layerConfList;
+
+    // zone config list
+    std::vector<CicoSCDisplayZoneConf*> zoneConfList;
 };
 
 //==========================================================================
index 2b0f376..694c289 100644 (file)
@@ -73,4 +73,28 @@ CicoSCDisplay::dump(void)
         const_cast<CicoSCLayer*>(*itr)->dump();
     }
 }
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  find CicoSCDisplayZone instance by fullname
+ */
+//--------------------------------------------------------------------------
+CicoSCDisplayZone*
+CicoSCDisplay::findDisplayZonebyFullName(const string & fullname)
+{
+//    ICO_DBG("CicoSCDisplay:findDisplayZonebyFullName Enter"
+//            "(fullname=%s)", fullname.c_str());
+    std::map<unsigned int, CicoSCDisplayZone*>::iterator itr;
+    itr = zoneList.begin();
+    for (; itr != zoneList.end(); ++itr) {
+        if (itr->second->fullname == fullname) {
+//            ICO_DBG("CicoSCDisplay:findDisplayZonebyFullName Leave(found)");
+            return itr->second;
+        }
+    }
+
+//    ICO_DBG("CicoSCDisplay:findDisplayZonebyFullName Leave(not found)");
+    return NULL;
+}
 // vim:set expandtab ts=4 sw=4:
index 8afbedd..35ab4a4 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <string>
 #include <vector>
+#include <map>
 
 //==========================================================================
 //  Forward declaration
@@ -43,6 +44,9 @@ public:
     // dump log this class member variables
     void dump(void);
 
+    // find display zone
+    CicoSCDisplayZone* findDisplayZonebyFullName(const string & fullname);
+
 private:
     /// assignment operator
     CicoSCDisplay& operator=(const CicoSCDisplay &object);
@@ -68,8 +72,11 @@ public:
     int         orientation; ///< screen orientation
     std::string name;        ///< display name
 
-    std::vector<CicoSCLayer*>       layerList; ///< list of display layer
-    std::vector<CicoSCDisplayZone*> zoneList;  ///< list of display zone
+    /// list of display layer
+    std::vector<CicoSCLayer*> layerList;
+
+    /// list of display zone
+    std::map<unsigned int, CicoSCDisplayZone*> zoneList;
 };
 #endif  // __CICO_SC_DISPLAY_H__
 // vim:set expandtab ts=4 sw=4:
index 4e31cf4..8a4cb1c 100644 (file)
@@ -24,7 +24,7 @@
  */
 //--------------------------------------------------------------------------
 CicoSCDisplayZone::CicoSCDisplayZone()
-    : zoneid(-1), x(-1), y(-1), width(-1), height(-1)
+    : zoneid(-1), x(-1), y(-1), width(-1), height(-1), fullname("")
 {
 }
 
@@ -45,7 +45,8 @@ CicoSCDisplayZone::~CicoSCDisplayZone()
 void
 CicoSCDisplayZone::dump(void)
 {
-    ICO_DBG("CicoSCDisplayZone: zoneid=%d x=%d y=%d width=%d height=%d",
-            zoneid, x, y, width, height);
+    ICO_DBG("CicoSCDisplayZone: zoneid=%d "
+            "x=%d y=%d width=%d height=%d fullname=%s",
+            zoneid, x, y, width, height, fullname.c_str());
 }
 // vim:set expandtab ts=4 sw=4:
index aec799a..b16f678 100644 (file)
@@ -30,6 +30,8 @@ using namespace std;
 #include "CicoSCSystemConfig.h"
 #include "CicoSCConf.h"
 #include "CicoSCCommand.h"
+#include "CicoSCServer.h"
+#include "CicoSCMessage.h"
 
 //--------------------------------------------------------------------------
 /**
@@ -116,7 +118,7 @@ CicoSCInputController::handleCommand(const CicoSCCommand *cmd)
     case MSG_CMD_SEND_INPUT:
         opt = static_cast<CicoSCCmdInputDevCtrlOpt*>(cmd->opt);
         sendInputEvent(cmd->appid, opt->surfaceid, opt->evtype,
-                       opt->deviceno, opt->evcode, opt->evvalue);
+                       opt->deviceno, opt->evtime, opt->evcode, opt->evvalue);
         break;
     case MSG_CMD_SET_REGION:
         set_opt = static_cast<CicoSCCmdInputDevSettingOpt*>(cmd->opt);
@@ -198,10 +200,11 @@ CicoSCInputController::delInputApp(const string &appid,
  *
  *  @param [in] appid     application id
  *  @param [in] surfaceid surface id
- *  @param [in] type      //TODO
+ *  @param [in] type      device type
  *  @param [in] deviceno  input device number
- *  @param [in] code      //TODO
- *  @param [in] value     //TODO
+ *  @param [in] time      event time
+ *  @param [in] code      event code
+ *  @param [in] value     event value
  */
 //--------------------------------------------------------------------------
 int
@@ -209,15 +212,16 @@ CicoSCInputController::sendInputEvent(const string &appid,
                                       int          surfaceid,
                                       int          type,
                                       int          deviceno,
+                                      int          time,
                                       int          code,
                                       int          value)
 {
     ICO_DBG("CicoSCInputController::sendInputEvent Enter"
-            "(appid=%s surfaceid=0x%08X type=%d dev_no=%d code=%d value=%d)",
-            appid.c_str(), surfaceid, type, deviceno, code, value);
+            "(appid=%s surfaceid=0x%08X type=%d dev_no=%d time=%d code=%d value=%d)",
+            appid.c_str(), surfaceid, type, deviceno, time, code, value);
 
     CicoSCWlInputMgrIF::sendInputEvent(appid.c_str(), surfaceid,
-                                       type, deviceno, code, value);
+                                       type, deviceno, time, code, value);
 
     ICO_DBG("CicoSCInputController::sendInputEvent Leave(EOK)");
     return ICO_SYC_EOK;
@@ -225,7 +229,7 @@ CicoSCInputController::sendInputEvent(const string &appid,
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  set input region informantion
+ *  @brief  set input region information
  *
  *  @param [in] appid     application id
  *  @param [in] winname   window name
@@ -277,7 +281,7 @@ CicoSCInputController::setInputRegion(const string &appid,
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  unset input region informantion
+ *  @brief  unset input region information
  *
  *  @param [in] appid     application id
  *  @param [in] winname   window name
@@ -443,17 +447,15 @@ CicoSCInputController::inputCB(void               *data,
             "time=%d device=%s input=%d code=%d state=%d",
             time, device, input, code, state);
 
-    // TODO send message
-#if 0
-    CicoSCMessage message;
-    message.addElement("command", ICO_SYC_EV_WIN_CREATE);
-    message.addElement("appid", TODO);
-    message.addElement("arg.device", device);
-    message.addElement("arg.input", input);
-    message.addElement("arg.code", code);
-    message.addElement("arg.state", state);
-    CicoSCServer::getInstance()->sendMessage(message);
-#endif
+    // send message
+    CicoSCMessage *message = new CicoSCMessage();
+    message->addRootObject("command", ICO_SYC_EV_WIN_CREATE);
+    message->addArgObject("device", device);
+    message->addArgObject("time", time);
+    message->addArgObject("input", input);
+    message->addArgObject("code", code);
+    message->addArgObject("state", state);
+    CicoSCServer::getInstance()->sendMessageToHomeScreen(message);
 
     ICO_DBG("CicoSCInputController::inputCB Leave");
 }
index e1e83ea..ec24262 100644 (file)
@@ -66,10 +66,11 @@ public:
                        int               surfaceid,
                        int               type,
                        int               deviceno,
+                       int               time,
                        int               code,
                        int               value);
 
-    // set input region informantion
+    // set input region information
     int setInputRegion(const std::string &appid,
                        const std::string &winname,
                        int x,
@@ -84,7 +85,7 @@ public:
                        int cursor_height,
                        int attr);
 
-    // unset input region informantion
+    // unset input region information
     int unsetInputRegion(const std::string &appid,
                          const std::string &winname,
                          int x,
index fe3980c..a3db10e 100644 (file)
@@ -94,6 +94,39 @@ static int CSCLCCapp_dead_handler(int pid, void *data)
     return CSCLCCapp_dead_handlerX(pid, x);
 }
 
+/**
+ * @brief This API get application appid by pid
+ * @param pid
+ * @param appid store appid string
+ * @param len appid buffer size
+ * @ret aul_app_get_appid_bypid return value
+ * @retval AUL_R_OK    - success
+ * @retval AUL_R_ERROR - no such a appid
+ */
+int Xaul_app_get_appid_bypid(int pid, char *appid, int len)
+{
+    int r = aul_app_get_appid_bypid(pid, appid, len);
+    if (AUL_R_OK == r) {
+        return r;
+    }
+    char fn[128];
+    sprintf(fn, "/proc/%d/cmdline", pid);
+    string tmp;
+    ifstream ifs(fn);
+    ifs >> tmp;
+    ifs.close();
+    const char* p = tmp.c_str();
+    int sz = strlen(p);
+    int i = sz - 2;
+    while (0 <= i) {
+        if ('/' == p[i]) {
+            strncpy(appid, &p[i+1], len);
+            break; // break of while i
+        }
+        i--;
+    }
+    return r;
+}
 
 /**
  * @brief contractor
@@ -103,6 +136,7 @@ CicoSCLifeCycleController::CicoSCLifeCycleController()
     m_gconf = (GKeyFile*)NULL;
     m_pc = (pkgmgr_client*)NULL;
     m_RC = new CicoSCSysResourceController;
+    ailRenewFlagOff();
     initAIL();
     initAUL();
 }
@@ -307,19 +341,20 @@ int CicoSCLifeCycleController::suspend(int pid)
 }
 
 /**
- * @brief appid is runnning check
+ * @brief appid is running check
  * @param appid package
  * @return running status
- * @retval true is runnning
- * @retval false not runnning
+ * @retval true is running
+ * @retval false not running
  */
-bool CicoSCLifeCycleController::isRunning(const char* appid) const
+bool CicoSCLifeCycleController::isRunning(const char* appid)
 {
     ICO_TRA("start %s", appid);
     bool r = false;
 #if 0 // TODO mk_k
     vector<CicoSCAulItems>::iterator it;
     for (it = m_aul.begin(); it != m_aul.end(); ++it) {
+        it->update_appid();
         if (0 == strcasecmp(it->m_appid.c_str(), appid)) {
             r = true;
             break;
@@ -328,6 +363,7 @@ bool CicoSCLifeCycleController::isRunning(const char* appid) const
 #else
     int sz = m_aul.size();
     for (int i = 0; i < sz; i++) {
+        m_aul[i].update_appid();
         if (0 == strcasecmp(m_aul[i].m_appid.c_str(), appid)) {
             r = true;
             break;
@@ -339,13 +375,13 @@ bool CicoSCLifeCycleController::isRunning(const char* appid) const
 }
 
 /**
- * @brief appid is runnning check
+ * @brief appid is running check
  * @param appid package
  * @return running status
- * @retval true is runnning
- * @retval false not runnning
+ * @retval true is running
+ * @retval false not running
  */
-bool CicoSCLifeCycleController::isRunning(const std::string& appid) const
+bool CicoSCLifeCycleController::isRunning(const std::string& appid)
 {
     return isRunning((const char*)appid.c_str());
 }
@@ -379,7 +415,7 @@ const CicoSCAilItems* CicoSCLifeCycleController::findAIL(const char* appid) cons
  */
 const CicoSCAilItems* CicoSCLifeCycleController::findAIL(const std::string& appid) const
 {
-    ICO_TRA("call findAIL(const chr*)");
+//    ICO_TRA("call findAIL(const char*)");
     return findAIL((const char*)appid.c_str());
 }
 
@@ -395,6 +431,7 @@ bool CicoSCLifeCycleController::getPIDs(const char* appid, std::vector<int>& pid
 #if 0 // TODO mk_k
     vector<CicoSCAulItems>::iterator it;
     for (it = m_aul.begin(); it != m_aul.end(); ++it) {
+        it->update_appid();
         if (0 == strcasecmp(it->m_appid.c_str(), appid)) {
             pids.push_back(it->m_pid);
             r = true;
@@ -403,7 +440,8 @@ bool CicoSCLifeCycleController::getPIDs(const char* appid, std::vector<int>& pid
 #else
     int sz = m_aul.size();
     for (int i = 0; i < sz; i++) {
-        const CicoSCAulItems* t = m_aul[i].p();
+        CicoSCAulItems* t = (CicoSCAulItems*)m_aul[i].p();
+        t->update_appid();
         if (0 == strcasecmp(t->m_appid.c_str(), appid)) {
             pids.push_back(t->m_pid);
             r = true;
@@ -429,13 +467,14 @@ bool CicoSCLifeCycleController::getPIDs(std::string& appid, std::vector<int>& pi
  * @param appid target application appid
  * @return pid
  */
-const CicoSCAulItems* CicoSCLifeCycleController::findAUL(int pid) const
+const CicoSCAulItems* CicoSCLifeCycleController::findAUL(int pid)
 {
     ICO_TRA("start %d", pid);
     const CicoSCAulItems* r = NULL;
     int sz = m_aul.size();
     for (int i = 0; i < sz; i++) {
-        const CicoSCAulItems* t = m_aul[i].p();
+        CicoSCAulItems* t = (CicoSCAulItems*)m_aul[i].p();
+        t->update_appid();
         if (t->m_pid == pid) {
             r = t;
             ICO_DBG("find %d -> %s", pid, t->m_appid.c_str());
@@ -452,18 +491,24 @@ const CicoSCAulItems* CicoSCLifeCycleController::findAUL(int pid) const
  */
 void CicoSCLifeCycleController::initAIL()
 {
-    ICO_TRA("start");
+    ICO_TRA("start %x", m_pc);
     createAilItems();
     if ((pkgmgr_client*)NULL == m_pc) {
         m_pc = pkgmgr_client_new(PC_LISTENING);
+        ICO_TRA("pkgmgr client new %x", m_pc);
         int r = pkgmgr_client_listen_status(m_pc, CSCLCCpkgmgr_handler,
                                             (void*)this);
-        if (PKGMGR_R_OK != r) {
+        ICO_TRA("pkgmgr_client_listen_status %d", r);
+//        if (PKGMGR_R_OK != r)
+        // pkgmgr_client_listen_status return is
+        // request_id (>0) if success, error code(<0) if fail
+        // PKGMGR_R_OK success (PKGMGR_R_OK is 0)
+        if (0 > r) {
             pkgmgr_client_free(m_pc);
             m_pc = NULL;
         }
     }
-    ICO_TRA("end");
+    ICO_TRA("end %x", m_pc);
 }
 
 /**
@@ -500,7 +545,7 @@ void CicoSCLifeCycleController::renewAIL()
     vector<CicoSCAilItems> old = m_ail;
     m_ail.clear();
     int cnt =0;
-    while (true == createAilItems()) {
+    while (false == createAilItems()) {
         if (cnt > 500) {
             m_ail.clear();
             m_ail = old;
@@ -550,6 +595,7 @@ void CicoSCLifeCycleController::renewAIL()
     }
 #endif
     old.clear();
+    ailRenewFlagOn();
     ICO_TRA("end");
     return;
 }
@@ -815,13 +861,14 @@ void CicoSCLifeCycleController::initAUL()
  * @brief
  */
 void CicoSCLifeCycleController::enterAUL(const char* appid, int pid,
-                                         const CicoSCWindow* obj)
+                                         const CicoSCWindow* obj, int aulstt)
 {
     ICO_TRA("start");
     bool bPushBack = true;
     int sz = m_aul.size();
     for (int i = 0; i < sz; i++) {
-        CicoSCAulItems* t = (CicoSCAulItems*)m_aul[i].p();
+        CicoSCAulItems* t = (CicoSCAulItems*) m_aul[i].p();
+        t->update_appid();
         if (t->m_pid == pid) {
             bPushBack = false;  // push_back flag off
             if (NULL == obj) {
@@ -844,7 +891,7 @@ void CicoSCLifeCycleController::enterAUL(const char* appid, int pid,
         if ((NULL != ailObj) && (0 != ailObj)) {
             ctgry = ailObj->m_categoryID;
         }
-        CicoSCAulItems entryAUL(appid, pid, ctgry, obj);
+        CicoSCAulItems entryAUL(appid, pid, ctgry, aulstt, obj);
         m_aul.push_back(entryAUL);
         if (-1 != entryAUL.m_cpucgroup) {
             m_RC->entryCgroupCPU(pid, entryAUL.m_cpucgroup);
@@ -879,16 +926,16 @@ bool CicoSCLifeCycleController::removeAUL(int pid)
  */
 int CSCLCCapp_launch_handlerX(int pid, CicoSCLifeCycleController* x)
 {
-    ICO_TRA("start");
+    ICO_TRA("start %d, %x", pid, x);
     if ((NULL == x) || (0 == x)) {
         ICO_TRA("end user data is NULL");
         return -1;
     }
     char appid[255];
     memset(appid, 0, sizeof(appid));
-    aul_app_get_appid_bypid(pid, appid, sizeof(appid)); // pid to appid
-    ICO_DBG("added %s, %d", appid, pid);
-    x->enterAUL(appid,pid);
+    int iR = Xaul_app_get_appid_bypid(pid, appid, sizeof(appid)); // pid to appid
+    ICO_DBG("%d=aul_app_get_appid_bypid  %d , %s", iR, pid, appid);
+    x->enterAUL(appid, pid, NULL, iR);
     ICO_TRA("end %s %d", appid, pid);
     return 0;
 }
@@ -902,7 +949,7 @@ int CSCLCCapp_launch_handlerX(int pid, CicoSCLifeCycleController* x)
  */
 int CSCLCCapp_dead_handlerX(int pid, CicoSCLifeCycleController* x)
 {
-    ICO_TRA("start");
+    ICO_TRA("start %d, %x", pid, x);
     if ((NULL == x) || (0 == x)) {
         ICO_TRA("end user data is NULL");
         return -1;
@@ -915,3 +962,16 @@ int CSCLCCapp_dead_handlerX(int pid, CicoSCLifeCycleController* x)
     return 0;
 }
 
+/**
+ * @brief AUL infomaton list
+ * @return AUL information item list Container
+ */
+const std::vector<CicoSCAulItems>& CicoSCLifeCycleController::getAulList()
+{
+    int sz = m_aul.size();
+    for (int i = 0; i < sz; i++) {
+        CicoSCAulItems* t = (CicoSCAulItems*)m_aul[i].p();
+        t->update_appid();
+    }
+    return m_aul;
+}
index 6cdf7f5..4d0f680 100644 (file)
@@ -46,24 +46,26 @@ public:
     int suspend(const std::string& appid);
     int suspend(int pid);
     // run application check
-    bool isRunning(const char* appid) const;
-    bool isRunning(const std::string& appid) const;
+    bool isRunning(const char* appid);
+    bool isRunning(const std::string& appid);
 
     const std::vector<CicoSCAilItems>& getAilList() const;
     const CicoSCAilItems* findAIL(const char* appid) const;
     const CicoSCAilItems* findAIL(const std::string& appid) const;
+    bool isAilRenew() const;
+    void ailRenewFlagOff();
 
-    const std::vector<CicoSCAulItems>& getAulList() const;
+    const std::vector<CicoSCAulItems>& getAulList();
 // TODO mk_k Should I think about the multiple return values start
 /*
     const CicoSCAulItems* findAUL(const char* appid) const;
     const CicoSCAulItems* findAUL(const std::string& appid) const;
 */
-    const CicoSCAulItems* findAUL(int pid) const;
+    const CicoSCAulItems* findAUL(int pid);
     bool getPIDs(const char* appid, std::vector<int>& pids) const;
     bool getPIDs(std::string& appid, std::vector<int>& pids) const;
-    void enterAUL(const char* appid, int pid, const CicoSCWindow* obj=NULL);
-
+    void enterAUL(const char* appid, int pid, const CicoSCWindow* obj = NULL,
+                  int aulstt = AUL_R_OK);
 
 protected:
     void initAIL();
@@ -77,6 +79,7 @@ protected:
                                  const char *val, const void *pmsg,
                                  CicoSCLifeCycleController *x);
     void renewAIL();
+    void ailRenewFlagOn();
     void initAUL();
     friend int CSCLCCapp_launch_handlerX(int pid,
                                          CicoSCLifeCycleController *x);
@@ -98,6 +101,7 @@ protected:
     GKeyFile* m_gconf;
     pkgmgr_client* m_pc;
     CicoSCSysResourceController* m_RC;
+    bool m_ailRenew;
 };
 
 /**
@@ -112,15 +116,30 @@ const std::vector<CicoSCAilItems>& CicoSCLifeCycleController::getAilList() const
 
 
 /**
- * @brief AUL infomaton list
- * @return AUL information item list Container
+ * @brief AIL change flag is on?
+ * @ret bool
+ * @retval true change flag on
+ * @retval false change flag off
  */
-inline
-const std::vector<CicoSCAulItems>& CicoSCLifeCycleController::getAulList() const
+inline bool CicoSCLifeCycleController::isAilRenew() const
 {
-    return m_aul;
+    return m_ailRenew;
 }
 
+/**
+ * @brief AIL change flag off set
+ */
+inline void CicoSCLifeCycleController::ailRenewFlagOff()
+{
+    m_ailRenew = false;
+}
 
+/**
+ * @brief AIL change flag on set
+ */
+inline void CicoSCLifeCycleController::ailRenewFlagOn()
+{
+    m_ailRenew = true;
+}
 
 #endif // CICOSCLIFECYCLECONTROLLER_H
index d861f43..9e6fe48 100644 (file)
@@ -777,7 +777,7 @@ CicoSCPolicyManager::acquireSoundResource(int type, int zoneid, int priority)
 bool
 CicoSCPolicyManager::releaseSoundResource(int type, int zoneid)
 {
-    ICO_DBG("CicoSCPolicyManager::acquireDisplayResource Enter"
+    ICO_DBG("CicoSCPolicyManager::acquireSoundResource Enter"
             "(type=%d zoneid=%d)", type, zoneid);
 
     bool chg = false;
@@ -797,7 +797,7 @@ CicoSCPolicyManager::releaseSoundResource(int type, int zoneid)
         }
     }
 
-    ICO_DBG("CicoSCPolicyManager::acquireDisplayResource Leave(%s)",
+    ICO_DBG("CicoSCPolicyManager::acquireSoundResource Leave(%s)",
             chg ? "true" : "false");
 
     return true;
index a7cfc78..f5d42d7 100644 (file)
@@ -124,8 +124,7 @@ CicoSCResourceManager::CicoSCResourceManager()
             vector<CicoSCDisplayZoneConf*>::iterator itr2;
             itr2 = (*itr)->zoneConfList.begin();
             for (; itr2 != (*itr)->zoneConfList.end(); ++itr2) {
-                m_curDispResReq[(*itr2)->id] = NULL;
-                m_dispReqQueue[(*itr2)->id]  = l;
+                m_curDispResOwerReq[(*itr2)->id] = NULL;
             }
         }
     }
@@ -280,6 +279,7 @@ CicoSCResourceManager::setInputController(CicoSCInputController *inputCtrl)
     m_inputCtrl = inputCtrl;
 }
 
+#if 0
 resource_request_t * 
 CicoSCResourceManager::popDispResReq(resource_request_t *req)
 {
@@ -304,6 +304,7 @@ CicoSCResourceManager::popDispResReq(resource_request_t *req)
     ICO_DBG("CicoSCResourceManager::popDispResReq Leave(NULL)");
     return NULL;
 }
+#endif
 
 resource_request_t *
 CicoSCResourceManager::popSoundResReq(resource_request_t *req)
@@ -386,36 +387,61 @@ CicoSCResourceManager::acquireDisplayResource(resource_request_t *newreq,
         return true;
     }
 
-    resource_request_t *req = NULL;
-    // equal current request?
-    CompDisplayResourceRequest comp(newreq);
-    resource_request_t *curreq = m_curDispResReq[newreq->dispzoneid];
-    if ((NULL != curreq) && (true == comp(curreq))) {
-        ICO_DBG("already acquired appid=%s pid=%d surfaceid=0x%08X",
-                curreq->appid, curreq->pid, curreq->surfaceid);
-        ICO_DBG("CicoSCResourceManager::acquireDisplayResource Leave(true)");
-        // is change zone?
-        if (newreq->dispzoneid == curreq->dispzoneid) {
-            // free new request
-            delResourceRequest(newreq);
+    // if exist current ower request, pop request
+    resource_request_t *req = findCurDispResOwerReq(newreq);
+    int chgzone = -1;
+    if (NULL != req) {
+        ICO_DBG("dispzoneid=%d/%d zone=%s/%s",
+                req->dispzoneid, newreq->dispzoneid,
+                req->dispzone, newreq->dispzone);
+        if (req->dispzoneid != newreq->dispzoneid) {
+            req = popCurDispResOwerReq(req);
+            chgzone = newreq->dispzoneid;
+        }
+        else {
+            ICO_DBG("already ower appid=%s", req->appid);
+            ICO_DBG("CicoSCResourceManager::acquireDisplayResource Leave(true)");
             return true;
         }
-        req = curreq;
-        curreq->dispzoneid = newreq->dispzoneid;
-        delResourceRequest(newreq);
     }
-    else {
-        // watting request?
-        req = popDispResReq(newreq);
-        if (NULL == req) {
+
+    // if exist in wating request list, pop request
+    if (NULL == req) {
+        req = popWaitingDispResReq(newreq);
+        if (NULL != req) {
+            ICO_DBG("dispzoneid=%d/%d zone=%s/%s",
+                    req->dispzoneid, newreq->dispzoneid,
+                    req->dispzone, newreq->dispzone);
+            if (req->dispzoneid != newreq->dispzoneid) {
+                chgzone = newreq->dispzoneid;
+            }
+        }
+        else {
             req = newreq;
         }
     }
 
+    // 
+    if (req != newreq) {
+        // update request data
+        req->dispzoneid = newreq->dispzoneid;
+        if (NULL != req->dispzone) free(req->dispzone);
+        req->dispzone = strdup(newreq->dispzone);
+        if (NULL != req->animation) free(req->animation);
+        req->animation = strdup(newreq->animation);
+        req->animationTime = newreq->animationTime;
+
+        // delete new request
+        delResourceRequest(newreq);
+    }
+    
     if (false == control) {
-        ICO_DBG("Enqueue waiting display request queue zone=%d req=0x%08x",
-                req->dispzoneid, req);
-        m_dispReqQueue[req->dispzoneid].push_front(req);
+        ICO_DBG("Enqueue waiting display resource request"
+                "(req=0x%08x appid=%s)", req, req->appid);
+        m_waitingDispResReq.push_front(req);
+#if 1   //DEBUG
+        dumpWaitingDispResReq();
+#endif  //DEBUG
         return true;
     }
 
@@ -424,12 +450,15 @@ CicoSCResourceManager::acquireDisplayResource(resource_request_t *newreq,
                                                      req->dispzoneid,
                                                      req->prio);
     if (true == state) {
-        updateDisplayResource(req);
+        updateDisplayResource(req, chgzone);
     }
     else {
-        ICO_DBG("Enqueue waiting display request queue zone=%d req=0x%08x",
-                req->dispzoneid, req);
-        m_dispReqQueue[req->dispzoneid].push_front(req);
+        ICO_DBG("Enqueue waiting display resource request"
+                "(req=0x%08x appid=%s)", req, req->appid);
+        m_waitingDispResReq.push_front(req);
+#if 1   //DEBUG
+        dumpWaitingDispResReq();
+#endif  //DEBUG
     }
 
 
@@ -440,59 +469,32 @@ CicoSCResourceManager::acquireDisplayResource(resource_request_t *newreq,
 void
 CicoSCResourceManager::releaseDisplayResource(resource_request_t *newreq)
 {
-    ICO_DBG("CicoSCResourceManager::releaseDisplayResource Enter");
+    ICO_DBG("CicoSCResourceManager::releaseDisplayResource Enter"
+            "(newreq=0x%08x)", newreq);
 
-    bool curchg = false;
-    CompDisplayResourceRequest comp(newreq);
-    for (int i = 0; i < (int)m_curDispResReq.size(); ++i) {
-         if (NULL == m_curDispResReq[i]) {
-            continue;
-         }
-
-         if (true == comp(m_curDispResReq[i])) {
-            if (NULL != m_winCtrl) {
-                // hide current window
-                m_winCtrl->hide(m_curDispResReq[i]->surfaceid, NULL, 0);
-            }
-            delResourceRequest(newreq);
-            delResourceRequest(m_curDispResReq[i]);
-            m_curDispResReq[i] = NULL;
-            curchg = true;
-            break;
-         }
+    // if exist current ower request, pop request
+    resource_request_t *req = popCurDispResOwerReq(newreq);
+    if (NULL == req) {
+        // if exist in wating request list, pop request
+        req = popWaitingDispResReq(newreq);
     }
 
-    // If current request is not changed, 
-    // remove the request from the waiting queue.
-    if (false == curchg) {
-       resource_request_t *req = popDispResReq(newreq);
-        if (NULL != req) {
-            delResourceRequest(req);
-            req = NULL;
-        }
-        delResourceRequest(newreq);
-        ICO_DBG("CicoSCResourceManager::releaseDisplayResource Leave");
-        return;
+    if (NULL != req) {
+        delResourceRequest(req);
     }
-
-    map<int, list<resource_request_t*> >::iterator itr;
-    itr = m_dispReqQueue.begin();
-    for (; itr != m_dispReqQueue.end(); ++itr) {
-        list<resource_request_t*>::iterator itr2;
-        itr2 = itr->second.begin();
-        for (; itr2 !=  itr->second.end(); ++itr2) {
-            int type = (*itr2)->resid & RESID_TYPE_MASK;
-            bool active = m_policyMgr->acquireDisplayResource(type,
-                                                         (*itr2)->dispzoneid,
-                                                         (*itr2)->prio);
-            if (true == active) {
-                resource_request_t* req = *itr2;
-                ICO_DBG("Dequeue waiting display request queue "
-                        "zone=%d req=0x%08x", itr->first, *itr2);
-                itr->second.erase(itr2);
-                updateDisplayResource(req);
-                break;
-            }
+    delResourceRequest(newreq);
+
+    list<resource_request_t*>::iterator itr;
+    itr = m_waitingDispResReq.begin();
+    for (; itr != m_waitingDispResReq.end(); ++itr) {
+        int type = (*itr)->resid & RESID_TYPE_MASK;
+        bool active = m_policyMgr->acquireDisplayResource(type,
+                                                         (*itr)->dispzoneid,
+                                                         (*itr)->prio);
+        if (true == active) {
+            resource_request_t* popreq = popWaitingDispResReq(*itr);
+            updateDisplayResource(popreq);
+            break;
         }
     }
 
@@ -776,7 +778,8 @@ CicoSCResourceManager::newResourceRequest(int resid,
         req->id     = opt->input;
     }
 
-    ICO_DBG("CicoSCResourceManager::newResourceRequest Leave");
+    ICO_DBG("CicoSCResourceManager::newResourceRequest Leave"
+            "(req=0x%08x appid=%s)", req, req->appid);
     return req;
 }
 
@@ -819,108 +822,96 @@ CicoSCResourceManager::receiveChangedState(int state)
         updateDisplayResourceRegulation(state);
         updateSoundResourceRegulation(state);
         updateInputResourceRegulation(state);
-#if 0
-        bool curchg = false;
-        for (int i = 0; i < (int)m_curDispResReq.size(); ++i) {
-             if (NULL == m_curDispResReq[i]) {
-                continue;
-             }
-             int type = m_curDispResReq[i]->resid & RESID_TYPE_MASK;
-             bool active = m_policyMgr->acquireDisplayResource(type,
-                                                             m_curDispResReq[i]->dispzoneid,
-                                                             m_curDispResReq[i]->prio);
-            if (false == active) {
-                if (NULL != m_winCtrl) {
-                    // hide current window
-                    m_winCtrl->hide(m_curDispResReq[i]->surfaceid, NULL, 0);
-                }
-                // state change to waiting
-                m_curDispResReq[i]->state = RES_STATE_WAITING;
-                // enqueue request
-                ICO_DBG("Enqueue waiting display request queue "
-                        "zone=%d req=0x%08x", i, m_curDispResReq[i]);
-                m_dispReqQueue[i].push_front(m_curDispResReq[i]);
-                // initialize current zone request
-                m_curDispResReq[i] = NULL;
-                curchg = true;
-             }
-        }
-
-        if ((false == curchg) && (STID_DRVREGULATION_ON == state)) {
-            ICO_DBG("CicoSCResourceManager::receiveChangedState Leave");
-            return;
-        }
-
-        map<int, list<resource_request_t*> >::iterator itr;
-        itr = m_dispReqQueue.begin();
-        for (; itr != m_dispReqQueue.end(); ++itr) {
-            list<resource_request_t*>::iterator itr2;
-            itr2 = itr->second.begin();
-            for (; itr2 !=  itr->second.end(); ++itr2) {
-                if (NULL != m_curDispResReq[itr->first]) {
-                    continue;
-                }
-                int type = (*itr2)->resid & RESID_TYPE_MASK;
-                bool active = m_policyMgr->acquireDisplayResource(type,
-                                                             (*itr2)->dispzoneid,
-                                                             (*itr2)->prio);
-                if (true == active) {
-                    resource_request_t* req = *itr2;
-                    ICO_DBG("Dequeue waiting display request queue "
-                            "zone=%d req=0x%08x", itr->first, *itr2);
-                    itr->second.erase(itr2);
-                    updateDisplayResource(req);
-                    break;
-                }
-            }
-        }
-#endif
     }
 
     ICO_DBG("CicoSCResourceManager::receiveChangedState Leave");
 }
 
 void
-CicoSCResourceManager::updateDisplayResource(resource_request_t *req)
+CicoSCResourceManager::updateDisplayResource(resource_request_t *req,
+                                             int chgzoneid)
 {
     ICO_DBG("CicoSCResourceManager::updateDisplayResource Enter"
             "(req=0x%08x)", req);
-    for (int i = 0; i < (int)m_curDispResReq.size(); ++i) {
-        ICO_DBG("zoneid=%d active=%d current=0x%08x",
-                i, m_policyMgr->getDispZoneState(i), m_curDispResReq[i]);
-
-        if (NULL == m_curDispResReq[i]) {
-            continue;
+    std::map<unsigned int, resource_request_t*>::iterator itr;
+    itr = m_curDispResOwerReq.find(req->dispzoneid);
+    if ((m_curDispResOwerReq.end() != itr) && (NULL != itr->second)) {
+        // already ower
+        if (itr->second == req) {
+            ICO_DBG("already ower appid=%s pid=%d surfaceid=0x%08X",
+                    req->appid, req->pid, req->surfaceid);
+            return;
         }
-
-        if ((i == req->dispzoneid) ||
-            (false == m_policyMgr->getDispZoneState(i))) {
-
+        resource_request_t *popreq = popCurDispResOwerReq(itr->second);
+        if (NULL != popreq) {
             if (NULL != m_winCtrl) {
                 // hide current window
-                m_winCtrl->hide(m_curDispResReq[i]->surfaceid, NULL, 0);
+                m_winCtrl->hide(popreq->surfaceid, NULL, 0);
             }
+
             // state change to waiting
-            m_curDispResReq[i]->state = RES_STATE_WAITING;
+            popreq->state = RES_STATE_WAITING;
             // enqueue request
-            ICO_DBG("Enqueue waiting display request queue "
-                    "zone=%d req=0x%08x", i, m_curDispResReq[i]);
-            m_dispReqQueue[i].push_front(m_curDispResReq[i]);
-            // initialize current zone request
-            m_curDispResReq[i] = NULL;
+            ICO_DBG("Enqueue waiting display resource request"
+                    "(req=0x%08x appid=%s", popreq, popreq->appid);
+            m_waitingDispResReq.push_front(popreq);
+#if 1   //DEBUG
+        dumpWaitingDispResReq();
+#endif  //DEBUG
         }
     }
-
-    if (req != m_curDispResReq[req->dispzoneid]) {
-        if (NULL != m_winCtrl) {
+        
+    if (NULL != m_winCtrl) {
+        if (-1 == chgzoneid) {
             // show request window
-            m_winCtrl->show(req->surfaceid, req->animation,req->animationTime);
+            m_winCtrl->show(req->surfaceid, req->animation, req->animationTime);
+        }
+        else {
+            // move request window
+            m_winCtrl->setGeometry(req->surfaceid, req->dispzone,
+                                   req->animation, req->animationTime,
+                                   req->animation, req->animationTime);
+            m_winCtrl->show(req->surfaceid, NULL, 0);
+        }
+    }
+    // state change to acquired
+    req->state = RES_STATE_ACQUIRED;
+    // update current zone request
+    ICO_DBG("Enqueue current display resource ower request"
+            "(req=0x%08x zoneid=%d appid=%s)",
+            req, req->dispzoneid, req->appid);
+    m_curDispResOwerReq[req->dispzoneid] = req;
+#if 1   //DEBUG
+    dumpCurDispResOwerReq();
+#endif  //DEBUG
+
+    // if current zone ower not exist after zone change
+    if (-1 != chgzoneid) {
+        list<resource_request_t*>::iterator itr;
+        itr = m_waitingDispResReq.begin();
+        for (; itr !=  m_waitingDispResReq.end(); ++itr) {
+            if (m_curDispResOwerReq[(*itr)->dispzoneid] != NULL) {
+                continue;
+            }
+            int type = (*itr)->resid & RESID_TYPE_MASK;
+            bool active = false;
+            active = m_policyMgr->acquireDisplayResource(type,
+                                                         (*itr)->dispzoneid,
+                                                         (*itr)->prio);
+            if (true == active) {
+                resource_request_t* req = *itr;
+                ICO_DBG("Dequeue waiting display resource request"
+                        "(req=0x%08x appid=%s)", *itr, (*itr)->appid);
+                m_waitingDispResReq.erase(itr);
+#if 1   //DEBUG
+                dumpWaitingDispResReq();
+#endif  //DEBUG
+                updateDisplayResource(req);
+                break;
+            }
         }
-        // state change to acquired
-        req->state = RES_STATE_ACQUIRED;
-        // update current zone request
-        m_curDispResReq[req->dispzoneid] = req;
     }
+
     ICO_DBG("CicoSCResourceManager::updateDisplayResource Leave");
 }
 
@@ -1012,65 +1003,78 @@ CicoSCResourceManager::updateDisplayResourceRegulation(int state)
     ICO_DBG("CicoSCResourceManager::updateDisplayResourceRegulation Enter"
             "(state=%d)", state);
 
-    bool curchg = false;
-    for (int i = 0; i < (int)m_curDispResReq.size(); ++i) {
-        resource_request_t *current = m_curDispResReq[i];
-        if (NULL == current) {
-            continue;
-        }
-
-        int type = current->resid & RESID_TYPE_MASK;
-        bool active = false;
-        active = m_policyMgr->acquireDisplayResource(type,
-                                                     current->dispzoneid,
-                                                     current->prio);
-        if (false == active) {
-            if (NULL != m_winCtrl) {
-                // hide current window
-                m_winCtrl->hide(current->surfaceid, NULL, 0);
+    if (STID_DRVREGULATION_ON == state) {
+        bool curchg = false;
+        std::map<unsigned int, resource_request_t*>::iterator itr;
+        itr = m_curDispResOwerReq.begin();
+        for (; itr != m_curDispResOwerReq.end(); ++itr) {
+            resource_request_t *current = itr->second;
+            if (NULL == current) {
+                continue;
             }
-            // state change to waiting
-            current->state = RES_STATE_WAITING;
-            // enqueue request
-            ICO_DBG("Enqueue waiting display request queue "
-                    "zone=%d req=0x%08x", i, current);
-            m_dispReqQueue[i].push_front(current);
-            // initialize current zone request
-            m_curDispResReq[i] = NULL;
-            curchg = true;
-         }
-    }
 
-    if ((false == curchg) && (STID_DRVREGULATION_ON == state)) {
-        ICO_DBG("CicoSCResourceManager::updateDisplayResourceRegulation Leave");
-        return;
-    }
+            int type = current->resid & RESID_TYPE_MASK;
+            bool active = false;
+            active = m_policyMgr->acquireDisplayResource(type,
+                                                         current->dispzoneid,
+                                                         current->prio);
+            if (false == active) {
+                if (NULL != m_winCtrl) {
+                    // hide current window
+                    // TODO animation?
+                    m_winCtrl->hide(current->surfaceid, NULL, 0);
+                }
+                curchg = true;
+            }
+        }
 
-    map<int, list<resource_request_t*> >::iterator itr;
-    itr = m_dispReqQueue.begin();
-    for (; itr != m_dispReqQueue.end(); ++itr) {
-        if (NULL != m_curDispResReq[itr->first]) {
-            continue;
+        if (false == curchg) {
+            ICO_DBG("CicoSCResourceManager::updateDisplayResourceRegulation "
+                    "Leave");
+            return;
         }
 
         list<resource_request_t*>::iterator itr2;
-        itr2 = itr->second.begin();
-        for (; itr2 !=  itr->second.end(); ++itr2) {
+        itr2 = m_waitingDispResReq.begin();
+        for (; itr2 !=  m_waitingDispResReq.end(); ++itr2) {
             int type = (*itr2)->resid & RESID_TYPE_MASK;
             bool active = false;
             active = m_policyMgr->acquireDisplayResource(type,
                                                          (*itr2)->dispzoneid,
                                                          (*itr2)->prio);
             if (true == active) {
-                resource_request_t* req = *itr2;
-                ICO_DBG("Dequeue waiting display request queue "
-                        "zone=%d req=0x%08x", itr->first, *itr2);
-                itr->second.erase(itr2);
-                updateDisplayResource(req);
+                if (NULL != m_winCtrl) {
+                    // show current window
+                    // TODO animation?
+                    m_winCtrl->show((*itr2)->surfaceid, NULL, 0);
+                }
                 break;
             }
         }
     }
+    else if (STID_DRVREGULATION_OFF == state) {
+        std::map<unsigned int, resource_request_t*>::iterator itr;
+        itr = m_curDispResOwerReq.begin();
+        for (; itr != m_curDispResOwerReq.end(); ++itr) {
+            resource_request_t *current = itr->second;
+            if (NULL == current) {
+                continue;
+            }
+
+            int type = current->resid & RESID_TYPE_MASK;
+            bool active = false;
+            active = m_policyMgr->acquireDisplayResource(type,
+                                                         current->dispzoneid,
+                                                         current->prio);
+            if (true == active) {
+                if (NULL != m_winCtrl) {
+                    // hide current window
+                    // TODO animation?
+                    m_winCtrl->show(current->surfaceid, NULL, 0);
+                }
+            }
+        }
+    }
 
     ICO_DBG("CicoSCResourceManager::updateDisplayResourceRegulation Leave");
 }
@@ -1206,4 +1210,168 @@ CicoSCResourceManager::updateInputResourceRegulation(int state)
 
     ICO_DBG("CicoSCResourceManager::updateDisplayResourceRegulation Leave");
 }
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief   find currnet dipalay resource ower request
+ *
+ *  @param [in] request  compare requset
+ *  
+ *  @return request object on same requeset found, NULL on not found
+ */
+//--------------------------------------------------------------------------
+resource_request_t *
+CicoSCResourceManager::findCurDispResOwerReq(resource_request_t *req)
+{
+    if (NULL == req) {
+        ICO_WRN("invalid argument. req is null");
+        return NULL;
+    }
+    std::map<unsigned int, resource_request_t*>::iterator itr;
+    itr = m_curDispResOwerReq.begin();
+    for (; itr != m_curDispResOwerReq.end(); ++itr) {
+        CompDisplayResourceRequest comp(req);
+        if (true == comp(itr->second)) {
+            return itr->second;
+        }
+    }
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  pop currnet dipalay resource ower request from list
+ *
+ *  @param [in] request  compare requset
+ *  
+ *  @return request object on same requeset found, NULL on not found
+ */
+//--------------------------------------------------------------------------
+resource_request_t *
+CicoSCResourceManager::popCurDispResOwerReq(resource_request_t *req)
+{
+    if (NULL == req) {
+        ICO_WRN("invalid argument. req is null");
+        return NULL;
+    }
+    std::map<unsigned int, resource_request_t*>::iterator itr;
+    itr = m_curDispResOwerReq.begin();
+    for (; itr != m_curDispResOwerReq.end(); ++itr) {
+        CompDisplayResourceRequest comp(req);
+        if (true == comp(itr->second)) {
+            ICO_DBG("Dequeue current display reoursce ower request"
+                    "(req=0x%08x zoneid=%d appid=%s)",
+                    itr->second, itr->first, itr->second->appid);
+            resource_request_t *findreq = itr->second;
+            itr->second = NULL;
+#if 1   //DEBUG
+            dumpCurDispResOwerReq();
+#endif  //DEBUG
+            return findreq;
+        }
+    }
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief   dump currnet dipalay resource ower request
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCResourceManager::dumpCurDispResOwerReq(void)
+{
+    std::map<unsigned int, resource_request_t*>::iterator itr;
+    itr = m_curDispResOwerReq.begin();
+    for (; itr != m_curDispResOwerReq.end(); ++itr) {
+        if (NULL == itr->second) {
+            ICO_DBG("current req=0x%08x zone=%02d:(null) appid=(null)",
+                    itr->second, itr->first);
+        }
+        else {
+            ICO_DBG("current req=0x%08x zone=%02d:%s appid=%s",
+                    itr->second, itr->first, itr->second->dispzone,
+                    itr->second->appid);
+        }
+    }
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  find waiting dipalay resource request
+ *
+ *  @param [in] request  compare requset
+ *  
+ *  @return request object on same requeset found, NULL on not found
+ */
+//--------------------------------------------------------------------------
+resource_request_t *
+CicoSCResourceManager::findWaitingDispResReq(resource_request_t *req)
+{
+    if (NULL == req) {
+        ICO_WRN("invalid argument. req is null");
+        return NULL;
+    }
+    CompDisplayResourceRequest comp(req);
+    std::list<resource_request_t*>::iterator itr;
+    itr = find_if(m_waitingDispResReq.begin(), m_waitingDispResReq.end(), comp);
+    if (m_waitingDispResReq.end() != itr) {
+        return *itr;
+    }
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  pop waiting dipalay resource request from waiting list
+ *
+ *  @param [in] request  compare requset
+ *  
+ *  @return request object on same requeset found, NULL on not found
+ */
+//--------------------------------------------------------------------------
+resource_request_t *
+CicoSCResourceManager::popWaitingDispResReq(resource_request_t *req)
+{
+    if (NULL == req) {
+        ICO_WRN("invalid argument. req is null");
+        return NULL;
+    }
+    CompDisplayResourceRequest comp(req);
+    std::list<resource_request_t*>::iterator itr;
+    itr = find_if(m_waitingDispResReq.begin(), m_waitingDispResReq.end(), comp);
+    if (m_waitingDispResReq.end() != itr) {
+        ICO_DBG("Dequeue waiting display resource request"
+                "(req=0x%08x zone:%02d:%s appid=%s)",
+                *itr, (*itr)->dispzoneid, (*itr)->dispzone, (*itr)->appid);
+        resource_request_t *findreq = *itr;
+        m_waitingDispResReq.erase(itr);
+#if 1   //DEBUG
+        dumpWaitingDispResReq();
+#endif  //DEBUG
+        return findreq;
+    }
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  dump waiting dipalay resource request
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCResourceManager::dumpWaitingDispResReq(void)
+{
+    std::list<resource_request_t*>::iterator itr;
+    itr = m_waitingDispResReq.begin();
+    for (; itr != m_waitingDispResReq.end(); ++itr) {
+        if (NULL == *itr) {
+            ICO_DBG("waiting req=null");
+        }
+        else {
+            ICO_DBG("waiting req=0x%08x zone=%02d:%s appid=%s",
+                    *itr, (*itr)->dispzoneid, (*itr)->dispzone, (*itr)->appid);
+        }
+    }
+}
 // vim:set expandtab ts=4 sw=4:
index 92dbbee..558759f 100644 (file)
@@ -97,7 +97,7 @@ private:
 
     resource_request_t * popInputResReq(resource_request_t *req);
 
-    void updateDisplayResource(resource_request_t *req);
+    void updateDisplayResource(resource_request_t *req, int chgzoneid=-1);
     void updateSoundResource(resource_request_t *req);
     void updateInputResource(resource_request_t *req);
 
@@ -105,17 +105,25 @@ private:
     void updateSoundResourceRegulation(int state);
     void updateInputResourceRegulation(int state);
 
+    resource_request_t * findCurDispResOwerReq(resource_request_t *req);
+    resource_request_t * popCurDispResOwerReq(resource_request_t *req);
+    void dumpCurDispResOwerReq(void);
+
+    resource_request_t * findWaitingDispResReq(resource_request_t *req);
+    resource_request_t * popWaitingDispResReq(resource_request_t *req);
+    void dumpWaitingDispResReq(void);
+
 private:
     CicoSCPolicyManager       *m_policyMgr;
     CicoSCWindowController    *m_winCtrl;
     CicoSCInputController     *m_inputCtrl;
 
     // pair zoneid and request
-    map<int, resource_request_t*> m_curDispResReq;
-    map<int, resource_request_t*> m_curSoundResReq;
-    map<int, resource_request_t*> m_curInputResReq;
+    std::map<unsigned int, resource_request_t*> m_curDispResOwerReq;
+    std::map<int, resource_request_t*> m_curSoundResReq;
+    std::map<int, resource_request_t*> m_curInputResReq;
 
-    map<int, list<resource_request_t*> > m_dispReqQueue;
+    std::list<resource_request_t*> m_waitingDispResReq;
     map<int, list<resource_request_t*> > m_soundReqQueue;
     map<int, list<resource_request_t*> > m_inputReqQueue;
 };
index 2ecb395..7f7c477 100644 (file)
@@ -251,7 +251,7 @@ CicoSCServer::delPollFd(CicoSCUwsHandler *handler)
 void
 CicoSCServer::dispatch(const CicoSCUwsHandler *handler)
 {
-    ICO_DBG("CicoSCServer::dispatch Enter(handler=0x%08x)", handler);
+//    ICO_DBG("CicoSCServer::dispatch Enter(handler=0x%08x)", handler);
 
     if (NULL == handler) {
         ICO_WRN("handler is null");
@@ -311,11 +311,11 @@ CicoSCServer::dispatch(const CicoSCUwsHandler *handler)
     Eina_Bool flag = ecore_main_fd_handler_active_get(handler->ecoreFdHandler,
                                                       ECORE_FD_WRITE);
     if (EINA_TRUE == flag) {
-        ICO_DBG("start send message");
+//        ICO_DBG("start send message");
         list<CicoSCMessage*>::iterator send_itr;
         send_itr = m_sendMsgQueue.begin();
         while (send_itr != m_sendMsgQueue.end()) {
-            ICO_DBG("m_sendMsgQueue.size=%d", m_sendMsgQueue.size());
+//            ICO_DBG("m_sendMsgQueue.size=%d", m_sendMsgQueue.size());
             CicoSCMessage* msg = *send_itr;
             CicoSCUwsHandler *sendHandler = findUwsHandler(msg->getSendToAppid());
             if (handler != sendHandler) {
@@ -327,8 +327,8 @@ CicoSCServer::dispatch(const CicoSCUwsHandler *handler)
             if ((NULL != sendHandler) && (true == sendHandler->serviceFlag)) {
                 ICO_DBG("<<<SEND appid=%s id=0x%08x msg=%s",
                         sendHandler->appid.c_str(), sendHandler->id, msg->getData());
-                ICO_DBG("called: ico_usw_send called(context=0x%08x id=0x%08x)",
-                        sendHandler->uwsContext, sendHandler->id);
+//                ICO_DBG("called: ico_usw_send called(context=0x%08x id=0x%08x)",
+//                        sendHandler->uwsContext, sendHandler->id);
                 ico_uws_send(sendHandler->uwsContext, sendHandler->id,
                              (unsigned char *)msg->getData(),
                              strlen(msg->getData()));
@@ -345,7 +345,7 @@ CicoSCServer::dispatch(const CicoSCUwsHandler *handler)
         ecore_main_fd_handler_active_set(handler->ecoreFdHandler, flags);
     }
 
-    ICO_DBG("CicoSCServer::dispatch Leave");
+//    ICO_DBG("CicoSCServer::dispatch Leave");
 }
 
 //--------------------------------------------------------------------------
@@ -444,7 +444,7 @@ CicoSCServer::uwsReceiveEventCB(const struct ico_uws_context *context,
 Eina_Bool
 CicoSCServer::ecoreFdCallback(void *data, Ecore_Fd_Handler *ecoreFdhandler)
 {
-    ICO_DBG("CicoSCServer::ecoreFdCallback Enter");
+//    ICO_DBG("CicoSCServer::ecoreFdCallback Enter");
 
     CicoSCUwsHandler *handler = NULL;
     handler =  static_cast<CicoSCServer*>(data)->findUwsHandler(ecoreFdhandler);
@@ -452,7 +452,7 @@ CicoSCServer::ecoreFdCallback(void *data, Ecore_Fd_Handler *ecoreFdhandler)
         static_cast<CicoSCServer*>(data)->dispatch(handler);
     }
 
-    ICO_DBG("CicoSCServer::ecoreFdCallback Leave");
+//    ICO_DBG("CicoSCServer::ecoreFdCallback Leave");
     return ECORE_CALLBACK_RENEW;
 }
 
@@ -474,7 +474,7 @@ CicoSCServer::receiveEventCB(const struct ico_uws_context *context,
                              const ico_uws_detail         *detail,
                              void                         *user_data)
 {
-    ICO_DBG("CicoSCServer::receiveEventCB Enter");
+//    ICO_DBG("CicoSCServer::receiveEventCB Enter");
 
     // find handler
     CicoSCUwsHandler *handler = findUwsHandler(context, id);
@@ -546,7 +546,7 @@ CicoSCServer::receiveEventCB(const struct ico_uws_context *context,
     default:
         break;
     }
-    ICO_DBG("CicoSCServer::receiveEventCB Leave");
+//    ICO_DBG("CicoSCServer::receiveEventCB Leave");
 }
 
 //--------------------------------------------------------------------------
@@ -566,8 +566,8 @@ CicoSCServer::findUwsHandler(const struct ico_uws_context *context,
     list<CicoSCUwsHandler*>::iterator itr;
     itr = m_uwsHandlerList.begin();
     for (; itr != m_uwsHandlerList.end(); ++itr) {
-        ICO_DBG("handler->context=%p handler->id=%p context=%p id=%p",
-                (*itr)->uwsContext, (*itr)->id, context, id);
+//        ICO_DBG("handler->context=%p handler->id=%p context=%p id=%p",
+//                (*itr)->uwsContext, (*itr)->id, context, id);
         if (((*itr)->uwsContext == context) &&
             ((*itr)->id == id)) {
             return *itr;
@@ -613,8 +613,8 @@ CicoSCServer::findUwsHandler(const string & appid)
     list<CicoSCUwsHandler*>::iterator itr;
     itr = m_uwsHandlerList.begin();
     for (; itr != m_uwsHandlerList.end(); ++itr) {
-        ICO_DBG("handler->id=%p handler->appid=%s appid=%s",
-                (*itr)->id, (*itr)->appid.c_str(), appid.c_str());
+//        ICO_DBG("handler->id=%p handler->appid=%s appid=%s",
+//                (*itr)->id, (*itr)->appid.c_str(), appid.c_str());
         if ((*itr)->appid == appid) {
             return *itr;
         }
index c02d6aa..7f15752 100644 (file)
@@ -1225,14 +1225,14 @@ const CicoSCDisplayZoneConf*
 CicoSCSystemConfig::findDisplayZoneConfbyName(const string & displayName,
                                               const string & zoneName)
 {
-    ICO_DBG("CicoSCSystemConfig::findDisplayZoneConfbyName Enter"
-            "(displayName=%s zoneNmae=%s)",
-            displayName.c_str(), zoneName.c_str());
+//    ICO_DBG("CicoSCSystemConfig::findDisplayZoneConfbyName Enter"
+//            "(displayName=%s zoneNmae=%s)",
+//            displayName.c_str(), zoneName.c_str());
 
     const CicoSCDisplayConf* displayConf = NULL;
     displayConf = findDisplayConfbyName(displayName);
     if (NULL == displayConf) {
-        ICO_DBG("CicoSCSystemConfig::findDisplayZoneConfbyName Leave(NULL)");
+//        ICO_DBG("CicoSCSystemConfig::findDisplayZoneConfbyName Leave(NULL)");
         return NULL;
     }
 
@@ -1242,13 +1242,13 @@ CicoSCSystemConfig::findDisplayZoneConfbyName(const string & displayName,
         const CicoSCDisplayZoneConf* conf = NULL;
         conf = const_cast<CicoSCDisplayZoneConf*>(*itr);
         if (zoneName == conf->name) {
-            ICO_DBG("CicoSCSystemConfig::findDisplayZoneConfbyName Leave"
-                    "(0x%08x)", conf);
+//            ICO_DBG("CicoSCSystemConfig::findDisplayZoneConfbyName Leave"
+//                    "(0x%08x)", conf);
             return conf;
         }
     }
 
-    ICO_DBG("CicoSCSystemConfig::findDisplayZoneConfbyName Leave(NULL)");
+//    ICO_DBG("CicoSCSystemConfig::findDisplayZoneConfbyName Leave(NULL)");
     return NULL;
 }
 
@@ -1286,9 +1286,9 @@ const CicoSCSoundZoneConf*
 CicoSCSystemConfig::findSoundZoneConfbyName(const string & soundName,
                                             const string & zoneName)
 {
-    ICO_DBG("CicoSCSystemConfig::findSoundZoneConfbyName Enter"
-            "(soundName=%s zoneNmae=%s)",
-            soundName.c_str(), zoneName.c_str());
+//    ICO_DBG("CicoSCSystemConfig::findSoundZoneConfbyName Enter"
+//            "(soundName=%s zoneNmae=%s)",
+//            soundName.c_str(), zoneName.c_str());
 
     const CicoSCSoundConf* soundConf = NULL;
     soundConf = findSoundConfbyName(soundName);
@@ -1395,6 +1395,31 @@ CicoSCSystemConfig::findAppKindConfbyName(const string & name)
  *  @param  [in]
  */
 //--------------------------------------------------------------------------
+const CicoSCDisplayZoneConf*
+CicoSCSystemConfig::findDisplayZoneConfbyId(int id)
+{
+    vector<CicoSCDisplayConf*>::iterator itr;
+    itr = m_displayConfList.begin();
+    for (; itr != m_displayConfList.end(); ++itr) {
+        vector<CicoSCDisplayZoneConf*>::iterator itr2;
+        itr2 = (*itr)->zoneConfList.begin();
+        for (; itr2 != (*itr)->zoneConfList.end(); ++itr2) {
+            if (id == (*itr2)->id) {
+                return *itr2;
+            }
+        }
+    }
+
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [in]
+ */
+//--------------------------------------------------------------------------
 const CicoSCSoundZoneConf*
 CicoSCSystemConfig::findSoundZoneConfbyId(int id)
 {
index d716412..3e8a1cd 100644 (file)
@@ -83,6 +83,8 @@ public:
     const CicoSCAppKindConf* findAppKindConfbyName(const string & name);
     const CicoSCCategoryConf* findCategoryConfbyName(const string & name);
 
+    const CicoSCDisplayZoneConf* findDisplayZoneConfbyId(int id);
+
     const CicoSCSoundZoneConf* findSoundZoneConfbyId(int id);
     const CicoSCCategoryConf* findCategoryConfbyId(int id);
     const CicoSCAppKindConf* findAppKindConfbyId(int id);
index 9db13b8..f6fa651 100644 (file)
@@ -43,6 +43,7 @@ using namespace boost::property_tree;
 #include "CicoSCConf.h"
 #include "CicoSCSystemConfig.h"
 
+using namespace std;
 
 //==========================================================================
 //
@@ -50,10 +51,15 @@ using namespace boost::property_tree;
 //
 //==========================================================================
 #define ICO_SYC_DEFAULT_PATH    "/home/app/ico"
-#define ICO_SYC_APP_INFO        "runnningApp.info"
+#define ICO_SYC_APP_INFO        "runningApp.info"
 #define ICO_SYC_APP_INFO_DEF    "defaultApps.info"
 #define ICO_SYC_LASTINFO_DIR    (char*)"/lastinfo/"
 #define ICO_SYC_LASTUSER_FILE   (char*)"/home/app/ico/lastuser.txt"
+#define ICO_SYC_CHGUSR_FLAG_DIR "/tmp/ico"
+#define ICO_SYC_CHGUSR_FLAG_FIL "changeUser.flag"
+
+void chkAndAddSlash(string& s);
+
 
 //==========================================================================
 //
@@ -70,6 +76,7 @@ CicoSCUserManager* CicoSCUserManager::ms_myInstance = NULL;
 CicoSCUserManager::CicoSCUserManager()
     : m_login("")
 {
+    // login-user application information file
     m_uConfig = CicoSCSystemConfig::getInstance()->getUserConf();
     if ((NULL == m_uConfig) || (true == m_uConfig->m_parent_dir.empty())) {
         m_parentDir = ICO_SYC_DEFAULT_PATH;
@@ -77,11 +84,18 @@ CicoSCUserManager::CicoSCUserManager()
     else {
         m_parentDir = m_uConfig->m_parent_dir;
     }
-    int sz = m_parentDir.size();
-    const char* p = m_parentDir.c_str();
-    if ('/' != p[sz-1]) {
-        m_parentDir += "/";
+    chkAndAddSlash(m_parentDir);
+
+    // flag file
+    m_flagPath = ICO_SYC_CHGUSR_FLAG_DIR;
+    struct stat st;
+    int ret = stat(m_flagPath.c_str(), &st);
+    if (0 != ret) {
+        mkdir(m_flagPath.c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
     }
+    chkAndAddSlash(m_flagPath);
+    m_flagPath += ICO_SYC_CHGUSR_FLAG_FIL;
+
 }
 
 //--------------------------------------------------------------------------
@@ -240,7 +254,8 @@ CicoSCUserManager::initialize(void)
         mkdir(root_dir.c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
     }
     // make user's directory
-    string user_dir = m_parentDir + m_login + "/";
+    string user_dir = m_parentDir + m_login;
+    chkAndAddSlash(user_dir);
     ret = stat(user_dir.c_str(), &st);
     if (0 != ret) {
         mkdir(user_dir.c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
@@ -308,7 +323,8 @@ CicoSCUserManager::changeUser(const string & name, const string & passwd)
     ICO_DBG("CicoSCUserManager::changeUser Enter"
             "(user=%s pass=%s)", name.c_str(), passwd.c_str());
 
-    ICO_DBG("change user \"%s\" -> \"%s\"", m_login.c_str(), name.c_str());
+    char tmpText[128];
+    sprintf(tmpText, "CHG USER[%s]->[%s]", m_login.c_str(), name.c_str());
 
     string oldUsr = m_login; /* get before login user */
     const CicoSCUser *conf = NULL;
@@ -326,16 +342,19 @@ CicoSCUserManager::changeUser(const string & name, const string & passwd)
         return;
     }
 
+    flagFileOn();
+
+#if 0
     // Imprinting to file, that file is application's running information 
     string usr_dir_old;
     getWorkingDir(oldUsr, usr_dir_old);
     string outfilename = usr_dir_old + ICO_SYC_APP_INFO;
     impritingLastApps(outfilename);
+#endif
 
     // killing running application and homeScreen
     killingAppsAndHS(oldUsr);
 
-
     // check wheather directory exists
     vector<string> mk_dir_info;
     mk_dir_info.push_back(m_uConfig->m_parent_dir);
@@ -358,7 +377,8 @@ CicoSCUserManager::changeUser(const string & name, const string & passwd)
     // change login user
     m_login = conf->name;
     ICO_DBG("login user changed (user=%s)", m_login.c_str());
-
+    ICO_INF("%s", tmpText);
+    flagFileOff();
     ICO_DBG("CicoSCUserManager::changeUser Leave(EOK)");
 }
 
@@ -479,7 +499,8 @@ bool CicoSCUserManager::killingAppsAndHS(const string&)
 void CicoSCUserManager::getWorkingDir(const string& usr, string& dir)
 {
     dir = m_parentDir;
-    dir += usr + "/";
+    dir += usr;
+    chkAndAddSlash(dir);
     return;
 }
 //--------------------------------------------------------------------------
@@ -496,23 +517,24 @@ bool CicoSCUserManager::launchHomescreenReq(const string& usr,
 {
     string usr_dir;
     getWorkingDir(usr, usr_dir);
-    string prmfn = usr_dir + ICO_SYC_APP_INFO;
-
-    const char* filepath = prmfn.c_str();
-    struct stat st;
-    if (0 != stat(filepath, &st)) {
-        string dir = m_parentDir;
-        dir += string(ICO_SYC_APP_INFO_DEF);
-        prmfn = dir;
-    }
+    // set login-user history file path
+    string a_prmfn = usr_dir + ICO_SYC_APP_INFO;
+    // set default history file path
+    string d_prmfn = m_parentDir + string(ICO_SYC_APP_INFO_DEF);
 
     bundle *b;
     b = bundle_create();
+    // bundle add login-user name
     bundle_add(b, ICO_SYC_APP_BUNDLE_KEY1, usr.c_str());
-    bundle_add(b, ICO_SYC_APP_BUNDLE_KEY2, prmfn.c_str());
+    // bundle add login-user history file path
+    bundle_add(b, ICO_SYC_APP_BUNDLE_KEY2, a_prmfn.c_str());
+    // bundle add default history file path
+    bundle_add(b, ICO_SYC_APP_BUNDLE_KEY3, d_prmfn.c_str());
+    // bundle add flag file path
+    bundle_add(b, ICO_SYC_APP_BUNDLE_KEY4, m_flagPath.c_str());
 
-    ICO_DBG("launch homescreen (user=%s, appid=%s, parm=%s)",
-            usr.c_str(), appid_hs.c_str(), prmfn.c_str());
+    ICO_DBG("launch homescreen (user=%s, appid=%s, parm=%s, %s)",
+            usr.c_str(), appid_hs.c_str(), a_prmfn.c_str(), d_prmfn.c_str());
 
     CicoSCLifeCycleController* oCSCLCC;
     oCSCLCC = CicoSCLifeCycleController::getInstance();
@@ -980,19 +1002,74 @@ CicoSCUserManager::setLastInfo(const string & appid, const string & info)
 const CicoSCUser*
 CicoSCUserManager::findUserConfbyName(const string & name)
 {
-    ICO_DBG("CicoSCUserManager::findUserConfbyName Enter (%s)", name.c_str());
+//    ICO_DBG("CicoSCUserManager::findUserConfbyName Enter (%s)", name.c_str());
 
     vector<CicoSCUser*>::iterator itr;
     itr = m_userList.begin();
     for (; itr != m_userList.end(); ++itr) {
         const CicoSCUser* conf = const_cast<CicoSCUser*>(*itr);
         if (name == conf->name) {
-            ICO_DBG("CicoSCUserManager::findUserConfbyName Leave(EOK)");
+//            ICO_DBG("CicoSCUserManager::findUserConfbyName Leave(%s)",
+//                    conf->name);
             return conf;
         }
     }
 
-    ICO_ERR("CicoSCUserManager::findUserConfbyName Leave(ENXIO)");
+//    ICO_DBG("CicoSCUserManager::findUserConfbyName Leave(NULL)");
     return NULL;
 }
+
+/**
+ * @brief flag file on(create)
+ */
+void CicoSCUserManager::flagFileOn(const char* text)
+{
+    if (true == m_flagPath.empty()) {
+        ICO_DBG("FLAG(FILE) empty");
+        return;
+    }
+    const char* f = m_flagPath.c_str();
+    ofstream oFlagFile;
+    oFlagFile.open(f, ios::trunc);
+    if ((NULL != text) && (0 != text) && (0 != strlen(text))) {
+        oFlagFile << text << endl;
+    }
+    oFlagFile.close();
+    ICO_DBG("FILE(%s) create(FLAG ON)", f);
+}
+
+/**
+ * @brief flag file off(remove)
+ */
+void CicoSCUserManager::flagFileOff()
+{
+    if (true == m_flagPath.empty()) {
+        ICO_DBG("FLAG(FILE) empty");
+        return;
+    }
+    const char* f = m_flagPath.c_str();
+    struct stat st;
+    int r = stat(f, &st);
+    if (0 != r) {
+        ICO_DBG("FILE(%s) is Nothing", f);
+        return;
+    }
+    remove(f);
+    ICO_DBG("FILE(%s) FLAG off(remove)", f);
+    return;
+}
+
+/**
+ * @brief directory last slash add
+ * @param s directory path string
+ */
+void chkAndAddSlash(string& s)
+{
+    int sz = s.size();
+    const char* p = s.c_str();
+    if ('/' != p[sz-1]) {
+        s += "/";
+    }
+}
+
 // vim:set expandtab ts=4 sw=4:
index 4e8f3f1..5c4bd34 100644 (file)
@@ -107,14 +107,19 @@ private:
     bool launchHomescreenReq(const std::string& usr,
                              const std::string& appid_hs);
 
+    // flag file control
+    void flagFileOn(const char* text = NULL);
+    void flagFileOff();
+
 private:
     static CicoSCUserManager*   ms_myInstance;  ///< CicoSCUserManager Object
 
     std::string                 m_login;           ///< Login User Name
     std::vector<CicoSCUser*>    m_userList;        ///< User List
     std::vector<std::string>    m_homescreenList;  ///< HomeScreen List
-    std::string                 m_parentDir;
+    std::string                 m_parentDir;       ///  login-user use directory
     const CicoSCUserConf*       m_uConfig;
+    std::string                 m_flagPath;        ///  history save control flag file
 };
 #endif  // __CICO_SC_USER_MANAGER_H__
 // vim:set expandtab ts=4 sw=4:
index 771917c..8241ea6 100644 (file)
@@ -174,8 +174,12 @@ CicoSCWayland::flushDisplay(void)
         ICO_ERR("wlDisplay == NULL");
         return;
     }
-    ICO_DBG("called: wl_display_flush(0x%08x)", (int)m_wlDisplay);
-    wl_display_flush(m_wlDisplay);
+//    ICO_DBG("called: wl_display_flush(0x%08x)", (int)m_wlDisplay);
+    int wlret = wl_display_flush(m_wlDisplay);
+    if (-1 == wlret) {
+        int error = wl_display_get_error(m_wlDisplay);
+        ICO_ERR("wayland error(%d)", error);
+    }
 }
 
 //--------------------------------------------------------------------------
@@ -190,8 +194,29 @@ CicoSCWayland::dispatchDisplay(void)
         ICO_ERR("wlDisplay == NULL");
         return;
     }
-    ICO_DBG("call wl_display_dispatch(0x%08x)", (int)m_wlDisplay);
-    wl_display_dispatch(m_wlDisplay);
+//    ICO_DBG("call wl_display_dispatch(0x%08x)", (int)m_wlDisplay);
+    int wlret = wl_display_dispatch(m_wlDisplay);
+    if (-1 == wlret) {
+        int error =  wl_display_get_error(m_wlDisplay);
+        ICO_ERR("wl_display_dispatch failed. error(%d)", error);
+    }
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  get wayland error
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCWayland::getError(void)
+{
+    if (NULL == m_wlDisplay) {
+        ICO_ERR("wlDisplay == NULL");
+        return -1;
+    }
+
+    ICO_DBG("fd=%d", wl_display_get_fd(m_wlDisplay));
+    return wl_display_get_error(m_wlDisplay);
 }
 
 //--------------------------------------------------------------------------
@@ -231,7 +256,15 @@ CicoSCWayland::addEcoreMainWlFdHandler(void)
         return ICO_SYC_EIO;
     }
     ecore_main_loop_iterate();
-    waylandFdHandler(NULL, m_ecoreFdHandler);
+
+    int arg = 0;
+    if (ioctl(m_wlFd, FIONREAD, &arg) < 0) {
+        ICO_WRN("ioclt(FIONREAD) failed. errno=%d:%s", errno, strerror(errno));
+        arg = 0;
+    }
+    if (arg > 0)   {
+        CicoSCWayland::getInstance()->dispatchDisplay();
+    }
 
     ICO_DBG("CicoSCWayland::addEcoreMainWlFdHandler Leave");
     return ICO_SYC_EOK;
@@ -263,11 +296,11 @@ CicoSCWayland::addWaylandIF(const char *name, CicoSCWaylandIF* interface)
  */
 //--------------------------------------------------------------------------
 void
-CicoSCWayland::globalCB(void *data,
+CicoSCWayland::globalCB(void               *data,
                         struct wl_registry *registry,
-                        uint32_t name,
-                        const char *interface,
-                        uint32_t version)
+                        uint32_t           name,
+                        const char         *interface,
+                        uint32_t           version)
 {
     map<string, CicoSCWaylandIF*>::iterator itr;
     itr = m_wlInterfaceList.find(interface);
@@ -288,7 +321,7 @@ CicoSCWayland::globalCB(void *data,
 /**
  *  @brief   wayland global callback
  *
- *  @param [in] data        user data(unused)
+ *  @param [in] data        user data
  *  @param [in] registry    wayland registry
  *  @param [in] name        wayland display Id(unused)
  *  @param [in] interface   wayland interface name
@@ -296,11 +329,11 @@ CicoSCWayland::globalCB(void *data,
  */
 //--------------------------------------------------------------------------
 void
-CicoSCWayland::wlGlobalCB(void       *data,
-                          struct     wl_registry *registry,
-                          uint32_t   name,
-                          const char *interface,
-                          uint32_t   version)
+CicoSCWayland::wlGlobalCB(void               *data,
+                          struct wl_registry *registry,
+                          uint32_t           name,
+                          const char         *interface,
+                          uint32_t           version)
 {
     if (NULL == data) {
         ICO_ERR("data == NULL");
@@ -324,24 +357,30 @@ CicoSCWayland::wlGlobalCB(void       *data,
 Eina_Bool
 CicoSCWayland::waylandFdHandler(void *data, Ecore_Fd_Handler *handler)
 {
-    ICO_DBG("waylandFdHandler: Enter");
-
-    int arg = 0;
+//    ICO_DBG("waylandFdHandler: Enter");
 
     CicoSCWayland::getInstance()->flushDisplay();
 
+    int arg = 0;
     if (ioctl(CicoSCWayland::getInstance()->getWlFd(), FIONREAD, &arg) < 0) {
-        ICO_WRN("ico_uxf_main_loop_iterate: ioclt(FIONREAD) Error %d", errno);
+        ICO_WRN("ioclt(FIONREAD) failed. errno=%d:%s", errno, strerror(errno));
         arg = 0;
     }
 
-    ICO_DBG("waylandFdHandler: arg(%d))", arg);
-    if (arg > 0)   {
+//    ICO_DBG("waylandFdHandler: arg(%d))", arg);
+    if (arg > 0) {
         CicoSCWayland::getInstance()->dispatchDisplay();
     }
 
+    if (0 == arg) {
+        ICO_ERR("wayland fd read error.");
+        ICO_DBG("called: ecore_main_loop_quit()");
+        ecore_main_loop_quit();
+        return ECORE_CALLBACK_CANCEL;
+    }
+
     CicoSCWayland::getInstance()->flushDisplay();
-    ICO_DBG("waylandFdHandler: Leave");
+//    ICO_DBG("waylandFdHandler: Leave");
     return ECORE_CALLBACK_RENEW ;
 }
 // vim:set expandtab ts=4 sw=4:
index d174687..94be850 100644 (file)
@@ -48,6 +48,9 @@ public:
     // dispatch display
     void dispatchDisplay(void);
 
+    // get wayland error
+    int getError(void);
+
     // get wayland file descriptor
     int getWlFd(void);
 
@@ -61,19 +64,19 @@ public:
     static Eina_Bool waylandFdHandler(void *data, Ecore_Fd_Handler *handler);
 
     // wayland global callback function
-    void globalCB(void *data,
+    void globalCB(void               *data,
                   struct wl_registry *registry,
-                  uint32_t name,
-                  const char *interface,
-                  uint32_t version);
+                  uint32_t           name,
+                  const char         *interface,
+                  uint32_t           version);
 
 private:
     // wayland standard callback function
-    static void wlGlobalCB(void       *data,
-                           struct     wl_registry *registry,
-                           uint32_t   name,
-                           const char *interface,
-                           uint32_t   version);
+    static void wlGlobalCB(void               *data,
+                           struct wl_registry *registry,
+                           uint32_t           name,
+                           const char         *interface,
+                           uint32_t           version);
 
 private:
     // default constructor
index cb6b6d7..2c6da18 100644 (file)
@@ -27,9 +27,9 @@ using namespace std;
  */
 //--------------------------------------------------------------------------
 CicoSCWindow::CicoSCWindow()
-    : surfaceid(-1),name(""), appid(""), pid(-1),
-      nodeid(-1), displayid(-1), layerid(-1), zoneid(-1), subwindow(0),
-      eventmask(0), x(-1), y(-1), width(-1), height(-1),
+    : surfaceid(-1), name(""), appid(""), pid(-1),
+      nodeid(-1), displayid(-1), layerid(-1), zone(""), zoneid(-1),
+      subwindow(0), eventmask(0), x(-1), y(-1), width(-1), height(-1),
       visible(false), raise(false), active(false)
 
 {
@@ -57,11 +57,12 @@ void
 CicoSCWindow::dump(void)
 {
     ICO_DBG("CicoSCWindow: surfaceid=0x%08X name=%s appid=%s pid=%d "
-            "nodeid=%d displayid=%d layerid=%d zoneid=%d "
+            "nodeid=%d displayid=%d layerid=%d zone=%s zoneid=%d "
             "subwindow=%d eventmask=%d x=%d y=%d width=%d height=%d "
             "visible=%s raise=%s active=%s",
             surfaceid, name.c_str(), appid.c_str(), pid, nodeid, displayid,
-            layerid, zoneid, subwindow, eventmask, x, y, width, height,
+            layerid, zone.c_str(), zoneid, subwindow, eventmask,
+            x, y, width, height,
             visible ? "true" : "false", raise ? "true" : "false",
             active ? "true" : "false");
 }
index 41ffa79..0122685 100644 (file)
@@ -60,6 +60,7 @@ public:
     int               nodeid;       ///< node id
     int               displayid;    ///< display id
     int               layerid;      ///< layer id
+    std::string       zone;         ///< display zone name
     int               zoneid;       ///< display zone id
     int               subwindow;    ///< main window(0) or sub window(!0)
     unsigned int      eventmask;    ///< Event to receive through this window
index 2817a97..2a50f10 100644 (file)
@@ -38,6 +38,8 @@ using namespace std;
 #include "CicoSCLayer.h"
 #include "CicoSCDisplayZone.h"
 #include "ico_syc_error.h"
+#include "ico_syc_type.h"
+#include "ico_syc_winctl.h"
 #include "CicoSCCommand.h"
 #include "ico_syc_msg_cmd_def.h"
 #include "CicoSCServer.h"
@@ -51,7 +53,7 @@ using namespace std;
  */
 //--------------------------------------------------------------------------
 CicoSCWindowController::CicoSCWindowController()
-    : m_resMgr(NULL)
+    : m_resMgr(NULL), m_physicalDisplayTotal(0)
 {
     CicoSCWayland* wayland = CicoSCWayland::getInstance();
     wayland->getInstance()->addWaylandIF(ICO_WL_WIN_MGR_IF, this);
@@ -116,13 +118,10 @@ CicoSCWindowController::initDB(void)
             zone->width    = (*itr3)->w;
             zone->height   = (*itr3)->h;
             zone->fullname = (*itr3)->fullname;
-            display->zoneList.push_back(zone);
+            display->zoneList[zone->zoneid] = zone;
         }
         display->dump();
         m_displayList.push_back(display);
-
-        display->dump();
-        m_displayList.push_back(display);
     }
 
     ICO_DBG("CicoSCWindowController::initDB: Leave");
@@ -178,27 +177,33 @@ CicoSCWindowController::show(int        surfaceid,
     // set animation request to Multi Window Manager
     int animaFlag = ICO_WINDOW_MGR_FLAGS_NO_CONFIGURE;
     int raiseFlag = ICO_WINDOW_MGR_V_NOCHANGE;
+    if (animationTime & ICO_SYC_WIN_SURF_RAISE) {
+        raiseFlag = ICO_WINDOW_MGR_RAISE_RAISE;
+        window->raise = true;
+    }
+    else if (animationTime & ICO_SYC_WIN_SURF_LOWER)    {
+        raiseFlag = ICO_WINDOW_MGR_RAISE_LOWER;
+        window->raise = false;
+    }
+    else if (((animationTime & ICO_SYC_WIN_SURF_NOCHANGE) == 0) &&
+             (false == window->raise))   {
+        raiseFlag = ICO_WINDOW_MGR_RAISE_RAISE;
+        window->raise = true;
+    }
     if ((NULL != animation) && (animation[0] != '\0')) {
         // set animation request to Multi Window Manager
         CicoSCWlWinMgrIF::setAnimation(window->surfaceid,
-                                       ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW,
-                                       animation, animationTime);
+                                    ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW,
+                                    animation, animationTime & ~ICO_SYC_WIN_SURF_FLAGS);
         animaFlag = ICO_WINDOW_MGR_FLAGS_ANIMATION;
     }
-    else {
-        if (false == window->raise) {
-            raiseFlag = ICO_WINDOW_MGR_RAISE_RAISE;
-            // update visible raise
-            window->raise = true;
-        }
-    }
 
     // set visible request to Multi Window Manager
     CicoSCWlWinMgrIF::setVisible(window->surfaceid,
                                  ICO_WINDOW_MGR_VISIBLE_SHOW,
                                  raiseFlag, animaFlag);
 
-    // flush display 
+    // flush display
     CicoSCWayland::getInstance()->flushDisplay();
 
     ICO_DBG("CicoSCWindowController::show Leave(EOK)");
@@ -243,7 +248,7 @@ CicoSCWindowController::hide(int        surfaceid,
     if ((NULL != animation) && (animation[0] != '\0')) {
         CicoSCWlWinMgrIF::setAnimation(window->surfaceid,
                                        ICO_WINDOW_MGR_ANIMATION_TYPE_HIDE,
-                                       animation, animationTime);
+                                       animation, animationTime & ~ICO_SYC_WIN_SURF_FLAGS);
         animaFlag = ICO_WINDOW_MGR_FLAGS_ANIMATION;
     }
 
@@ -252,7 +257,7 @@ CicoSCWindowController::hide(int        surfaceid,
                                     ICO_WINDOW_MGR_VISIBLE_HIDE,
                                     ICO_WINDOW_MGR_V_NOCHANGE, animaFlag);
 
-    // flush display 
+    // flush display
     CicoSCWayland::getInstance()->flushDisplay();
 
     ICO_DBG("CicoSCWindowController::hide Leave(EOK)");
@@ -308,7 +313,7 @@ CicoSCWindowController::resize(int        surfaceid,
                                       ICO_WINDOW_MGR_V_NOCHANGE,
                                       w, h, animaFlag);
 
-    // flush display 
+    // flush display
     CicoSCWayland::getInstance()->flushDisplay();
 
     ICO_DBG("CicoSCWindowController::resize Leave(EOK)");
@@ -317,7 +322,7 @@ CicoSCWindowController::resize(int        surfaceid,
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  move window(surface) size 
+ *  @brief  move window(surface) size
  *
  *  @param [in] surfaceid       wayland surface id
  *  @param [in] nodeid          node id
@@ -373,7 +378,7 @@ CicoSCWindowController::move(int        surfaceid,
                                       ICO_WINDOW_MGR_V_NOCHANGE,
                                       animaFlag);
 
-    // flush display 
+    // flush display
     CicoSCWayland::getInstance()->flushDisplay();
 
     ICO_DBG("CicoSCWindowController::move Leave(EOK)");
@@ -427,7 +432,7 @@ CicoSCWindowController::raise(int        surfaceid,
                                  ICO_WINDOW_MGR_V_NOCHANGE,
                                  ICO_WINDOW_MGR_RAISE_RAISE, animaFlag);
 
-    // flush display 
+    // flush display
     CicoSCWayland::getInstance()->flushDisplay();
 
     ICO_DBG("CicoSCWindowController::raise Leave(EOK)");
@@ -499,19 +504,46 @@ CicoSCWindowController::setGeometry(int        surfaceid,
                                    animation, moveAnimationTime);
 
     int moveNodeId = ICO_WINDOW_MGR_V_NOCHANGE;
-    if ((nodeid >= 0) && (nodeid != INT_MAX)) {
+    if (nodeid >= 0) {
         moveNodeId = nodeid;
     }
     else {
         moveNodeId = window->nodeid;
     }
 
+    if (m_physicalDisplayTotal <= (unsigned int)moveNodeId) {
+        ICO_WRN("nodeid(%d) is over physical display total(%d)",
+                m_physicalDisplayTotal, nodeid);
+        ICO_WRN("CicoSCWindowController::setGeometry Leave(EINVAL)");
+        return ICO_SYC_EINVAL;
+    }
+
+    int moveX = ICO_WINDOW_MGR_V_NOCHANGE;
+    if (0 <= x) {
+        moveX = x;
+    }
+
+    int moveY = ICO_WINDOW_MGR_V_NOCHANGE;
+    if (0 <= y) {
+        moveY = y;
+    }
+
+    int moveW = ICO_WINDOW_MGR_V_NOCHANGE;
+    if (0 <= w) {
+        moveW = w;
+    }
+
+    int moveH = ICO_WINDOW_MGR_V_NOCHANGE;
+    if (0 <= h) {
+        moveH = h;
+    }
+
     // set visible request to Multi Window Manager
     CicoSCWlWinMgrIF::setPositionsize(window->surfaceid, moveNodeId,
-                                      x, y, w, h,
+                                      moveX, moveY, moveW, moveH,
                                       ICO_WINDOW_MGR_FLAGS_ANIMATION);
 
-    // flush display 
+    // flush display
     CicoSCWayland::getInstance()->flushDisplay();
 
     ICO_DBG("CicoSCWindowController::setGeometry Leave(EOK)");
@@ -520,6 +552,92 @@ CicoSCWindowController::setGeometry(int        surfaceid,
 
 //--------------------------------------------------------------------------
 /**
+ *  @brief  set window(surface) geometry
+ *
+ *  @param [in] surfaceid           wayland surface id
+ *  @param [in] nodeid              node id
+ *  @param [in] zone                display zone name
+ *  @param [in] resizeAnimation     resize animation name
+ *  @param [in] resizeAnimationTime resize animation time
+ *  @param [in] moveAnimation       move animation name
+ *  @param [in] moveanimationTime   move animation time
+ *
+ *  @return ICO_SYC_EOK on success, other on error
+ *  @retval ICO_SYC_EOK         success
+ *  @retval ICO_SYC_ESRCH       error(not initialized)
+ *  @retval ICO_SYC_ENOENT      error(window dose not exist)
+ *  @retval ICO_SYC_EINVAL      error(zone is null, zone name is invalid)
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCWindowController::setGeometry(int        surfaceid,
+                                    const char *zone,
+                                    const char *resizeAnimation,
+                                    int        resizeAnimationTime,
+                                    const char *moveAnimation,
+                                    int        moveAnimationTime)
+{
+    ICO_DBG("CicoSCWindowController::setGeometry Enter"
+            "(surfaceid=0x%08X zone=%s "
+            "resizeAnimation=%s resizeAnimationTime=%d "
+            "moveAnimation=%s moveAnimationTime=%d)",
+            surfaceid, zone,
+            resizeAnimation, resizeAnimationTime,
+            moveAnimation, moveAnimationTime);
+
+    // find window information in window list
+    CicoSCWindow *window = findWindow(surfaceid);
+    if (NULL == window) {
+        ICO_WRN("CicoSCWindowController::setGeometry Leave(ENOENT)");
+        return ICO_SYC_ENOENT;
+    }
+
+    if ((NULL == zone) || ('\0' == zone[0])) {
+        ICO_WRN("CicoSCWindowController::setGeometry Leave(EINVAL)");
+        return ICO_SYC_EINVAL;
+    }
+
+    vector<CicoSCDisplay*>::iterator itr;
+    itr = m_displayList.begin();
+    CicoSCDisplayZone* dispzone = NULL;
+    int displayno = 0;
+    for (; itr != m_displayList.end(); ++itr) {
+        dispzone = (*itr)->findDisplayZonebyFullName(zone);
+        if (NULL != dispzone) {
+            displayno = (*itr)->displayno;
+            break;
+        }
+    }
+
+    if (NULL == dispzone) {
+        ICO_WRN("display zone name(%s) is invalid.", zone);
+        ICO_WRN("CicoSCWindowController::setGeometry Leave(EINVAL)");
+        return ICO_SYC_EINVAL;
+    }
+
+    if (m_physicalDisplayTotal <= (unsigned int)displayno) {
+        ICO_WRN("nodeid(%d) is over physical display total(%d)",
+                m_physicalDisplayTotal, displayno);
+        ICO_WRN("CicoSCWindowController::setGeometry Leave(EINVAL)");
+        return ICO_SYC_EINVAL;
+    }
+
+    // update window attr
+    window->zoneid = dispzone->zoneid;
+    window->zone = dispzone->fullname;
+
+    int ret = setGeometry(surfaceid, displayno,
+                          dispzone->x, dispzone->y,
+                          dispzone->width, dispzone->height,
+                          resizeAnimation, resizeAnimationTime,
+                          moveAnimation, moveAnimationTime);
+
+    ICO_DBG("CicoSCWindowController::setGeometry Leave(EOK)");
+    return ret;
+}
+
+//--------------------------------------------------------------------------
+/**
  *  @brief  lower window(surface)
  *
  *  @param [in] surfaceid       wayland surface id
@@ -564,7 +682,7 @@ CicoSCWindowController::lower(int        surfaceid,
     CicoSCWlWinMgrIF::setVisible(window->surfaceid, ICO_WINDOW_MGR_V_NOCHANGE,
                                  ICO_WINDOW_MGR_RAISE_LOWER, animaFlag);
 
-    // flush display 
+    // flush display
     CicoSCWayland::getInstance()->flushDisplay();
 
     ICO_DBG("CicoSCWindowController::lower Leave(EOK)");
@@ -588,7 +706,7 @@ int
 CicoSCWindowController::setWindowLayer(int surfaceid, int layerid)
 {
     ICO_DBG("CicoSCWindowController::setWindowLayer Enter"
-            "(surfaceid=0x%08X layerid=%d)", surfaceid, layerid);
+            "(surfaceid=0x%08X layerid=%x)", surfaceid, layerid);
 
     // find window information in window list
     CicoSCWindow *window = findWindow(surfaceid);
@@ -600,8 +718,13 @@ CicoSCWindowController::setWindowLayer(int surfaceid, int layerid)
     // find layer information in layer list
     CicoSCLayer* layer = findLayer(window->displayid, layerid);
     if (NULL == layer) {
-        ICO_WRN("CicoSCWindowController::setWindowLayer Leave(ENOENT)");
-        return ICO_SYC_ENOENT;
+        // check special layer
+        if ((layerid != ICO_WINDOW_MGR_V_LAYER_INPUT) &&
+            (layerid != ICO_WINDOW_MGR_V_LAYER_CURSOR)) {
+            ICO_WRN("CicoSCWindowController::setWindowLayer Leave(ENOENT[disp=%d,layer=%d])",
+                    window->displayid, layerid);
+            return ICO_SYC_ENOENT;
+        }
     }
 
     // update window attr
@@ -610,7 +733,7 @@ CicoSCWindowController::setWindowLayer(int surfaceid, int layerid)
     // set window layer request to Multi Window Manager
     CicoSCWlWinMgrIF::setWindowLayer(window->surfaceid, window->layerid);
 
-    // flush display 
+    // flush display
     CicoSCWayland::getInstance()->flushDisplay();
 
     ICO_DBG("CicoSCWindowController::setWindowLayer Leave(EOK)");
@@ -619,7 +742,7 @@ CicoSCWindowController::setWindowLayer(int surfaceid, int layerid)
 
 //--------------------------------------------------------------------------
 /**
- *  @brief   show layer 
+ *  @brief   show layer
  *
  *  @param [in] displayid   display id
  *  @param [in] layerid     layer id
@@ -645,7 +768,7 @@ CicoSCWindowController::showLayer(int displayid, int layerid)
 
     CicoSCWlWinMgrIF::setLayerVisible(layerid, ICO_WINDOW_MGR_VISIBLE_SHOW);
 
-    // flush display 
+    // flush display
     CicoSCWayland::getInstance()->flushDisplay();
 
     ICO_DBG("CicoSCWindowController::showLayer Leave(EOK)");
@@ -654,7 +777,7 @@ CicoSCWindowController::showLayer(int displayid, int layerid)
 
 //--------------------------------------------------------------------------
 /**
- *  @brief   show layer 
+ *  @brief   show layer
  *
  *  @param [in] displayid   display id
  *  @param [in] layerid     layer id
@@ -681,7 +804,7 @@ CicoSCWindowController::hideLayer(int displayid, int layerid)
 
     CicoSCWlWinMgrIF::setLayerVisible(layerid, ICO_WINDOW_MGR_VISIBLE_HIDE);
 
-    // flush display 
+    // flush display
     CicoSCWayland::getInstance()->flushDisplay();
 
     ICO_DBG("CicoSCWindowController::hideVisible Leave(EOK)");
@@ -704,13 +827,6 @@ CicoSCWindowController::hideLayer(int displayid, int layerid)
 int
 CicoSCWindowController::active(int surfaceid, int target)
 {
-#if 0
-    Ico_Uxf_Mng_Window  *winmng;
-    Ico_Uxf_Mng_Process *proc;
-    Ico_Uxf_Mng_Process *aproc;
-    int                 hash;
-#endif
-
     ICO_DBG("CicoSCWindowController::active Enter"
             "(surfaceid=0x%08X, target=%08X)", surfaceid, target);
 
@@ -723,21 +839,13 @@ CicoSCWindowController::active(int surfaceid, int target)
 
     if (target < 0) {
         target = ICO_WINDOW_MGR_ACTIVE_POINTER  |
-                 ICO_WINDOW_MGR_ACTIVE_KEYBOARD |
-                 ICO_WINDOW_MGR_ACTIVE_SELECTED;
+                 ICO_WINDOW_MGR_ACTIVE_KEYBOARD;
     }
 
     // set active request to Multi Window Manager
     CicoSCWlWinMgrIF::setActive(window->surfaceid, target);
 
-    // TODO
-    // set visible request to Multi Window Manager
-    CicoSCWlWinMgrIF::setVisible(window->surfaceid,
-                                 ICO_WINDOW_MGR_V_NOCHANGE,
-                                 ICO_WINDOW_MGR_RAISE_RAISE,
-                                 ICO_WINDOW_MGR_FLAGS_NO_CONFIGURE);
-
-    // flush display 
+    // flush display
     CicoSCWayland::getInstance()->flushDisplay();
 
     // update visible attr
@@ -761,30 +869,6 @@ CicoSCWindowController::active(int surfaceid, int target)
         }
     }
 
-    // TODO update active application
-#if 0
-    /* reset all active application without this application    */
-    aproc = NULL;
-    for (hash = 0; hash < ICO_UXF_MISC_HASHSIZE; hash++)    {
-        proc = gIco_Uxf_Api_Mng.Hash_ProcessId[hash];
-        while (proc)    {
-            if (proc->attr.mainwin.window == window)    {
-                aproc = proc;
-            }
-            else    {
-                if (target == 0)    {
-                    proc->attr.active = 0;
-                }
-                else    {
-                    proc->attr.active &= ~target;
-                }
-            }
-            proc = proc->nextidhash;
-        }
-    }
-    aproc->attr.active = target;
-#endif
-
     ICO_DBG("CicoSCWindowController::active Leave(EOK)");
     return ICO_SYC_EOK;
 }
@@ -855,9 +939,9 @@ CicoSCWindowController::unmapSurface(int surfaceid)
 }
 
 //--------------------------------------------------------------------------
-/** 
+/**
  *  @brief   wayland surface create callback
- *  
+ *
  *  @param [in] data            user data(unused)
  *  @param [in] ico_window_mgr  wayland ico_window_mgr plugin interface
  *  @param [in] surfaceid       ico_window_mgr surface Id
@@ -906,13 +990,15 @@ CicoSCWindowController::createdCB(void                  *data,
         window->zoneid  = ailItem->m_displayZone;
         window->nodeid  = ailItem->m_nodeID;
         if ((window->displayid >= 0) && (window->zoneid >= 0)) {
-            // TODO at error try catch
-            CicoSCDisplay* display = m_displayList.at(window->displayid);
-            CicoSCDisplayZone *zone = display->zoneList.at(window->zoneid);
-            window->x       = zone->x;
-            window->y       = zone->y;
-            window->width   = zone->width;
-            window->height  = zone->height;
+
+            const CicoSCDisplayZone* zone = findDisplayZone(window->zoneid);
+            if (NULL != zone) {
+                window->zone   = zone->fullname;
+                window->x      = zone->x;
+                window->y      = zone->y;
+                window->width  = zone->width;
+                window->height = zone->height;
+            }
         }
     }
     else{
@@ -932,6 +1018,7 @@ CicoSCWindowController::createdCB(void                  *data,
     CicoSCMessage *message = new CicoSCMessage();
     message->addRootObject("command", MSG_CMD_CREATE);
     message->addRootObject("appid", window->appid);
+    message->addRootObject("pid", window->pid);
     message->addArgObject("surface", window->surfaceid);
     message->addArgObject("winname", window->name);
     CicoSCServer::getInstance()->sendMessageToHomeScreen(message);
@@ -945,7 +1032,7 @@ CicoSCWindowController::createdCB(void                  *data,
         cmd.appid = window->appid;
         cmd.pid   = window->pid;
         cmd.opt = opt;
-        
+
         opt->dispres   = true;
         opt->winname   = window->name;
         opt->surfaceid = window->surfaceid;
@@ -963,7 +1050,7 @@ CicoSCWindowController::createdCB(void                  *data,
         CicoSCSystemConfig *sysconf = CicoSCSystemConfig::getInstance();
         const CicoSCDefaultConf *defconf = sysconf->getDefaultConf();
         if (NULL != defconf) {
-            const CicoSCSoundZoneConf *zoneconf = 
+            const CicoSCSoundZoneConf *zoneconf =
                 sysconf->findSoundZoneConfbyId(defconf->soundzone);
             if (NULL != zoneconf) {
                 opt->soundzone = zoneconf->fullname;
@@ -1013,19 +1100,11 @@ CicoSCWindowController::nameCB(void                  *data,
 
     // send message
     CicoSCMessage *message = new CicoSCMessage();
-    message->addRootObject("command", MSG_CMD_CHANGE_ATTR);
+    message->addRootObject("command", MSG_CMD_NAME);
     message->addRootObject("appid", window->appid);
+    message->addRootObject("pid", window->pid);
     message->addArgObject("surface", window->surfaceid);
     message->addArgObject("winname", window->name);
-    message->addArgObject("node", window->nodeid);
-    message->addArgObject("layer", window->layerid);
-    message->addArgObject("pos_x", window->x);
-    message->addArgObject("pos_y", window->y);
-    message->addArgObject("width", window->width);
-    message->addArgObject("height", window->height);
-    message->addArgObject("raise", window->raise ? 1 : 0);
-    message->addArgObject("visible", window->visible ? 1 : 0);
-    message->addArgObject("active", window->active ? 1 : 0);
     CicoSCServer::getInstance()->sendMessageToHomeScreen(message);
 
     ICO_DBG("CicoSCWindowController::nameCB Leave");
@@ -1045,7 +1124,8 @@ CicoSCWindowController::destroyedCB(void                  *data,
                                     struct ico_window_mgr *ico_window_mgr,
                                     uint32_t              surfaceid)
 {
-    ICO_DBG("CicoSCWindowController::destroyedCB Enter");
+    ICO_DBG("CicoSCWindowController::destroyedCB Enter"
+            "(surfaceid=0x%08X)", surfaceid);
 
     CicoSCWindow *window = findWindow(surfaceid);
     if (NULL == window) {
@@ -1057,6 +1137,7 @@ CicoSCWindowController::destroyedCB(void                  *data,
     CicoSCMessage *message = new CicoSCMessage();
     message->addRootObject("command", MSG_CMD_DESTROY);
     message->addRootObject("appid", window->appid);
+    message->addRootObject("pid", window->pid);
     message->addArgObject("surface", window->surfaceid);
     message->addArgObject("winname", window->name);
     CicoSCServer::getInstance()->sendMessageToHomeScreen(message);
@@ -1071,7 +1152,7 @@ CicoSCWindowController::destroyedCB(void                  *data,
         cmd.appid = window->appid;
         cmd.pid   = window->pid;
         cmd.opt = opt;
-        
+
         opt->dispres   = true;
         opt->winname   = window->name;
         opt->surfaceid = window->surfaceid;
@@ -1088,7 +1169,7 @@ CicoSCWindowController::destroyedCB(void                  *data,
         CicoSCSystemConfig *sysconf = CicoSCSystemConfig::getInstance();
         const CicoSCDefaultConf *defconf = sysconf->getDefaultConf();
         if (NULL != defconf) {
-            const CicoSCSoundZoneConf *zoneconf = 
+            const CicoSCSoundZoneConf *zoneconf =
                 sysconf->findSoundZoneConfbyId(defconf->soundzone);
             if (NULL != zoneconf) {
                 opt->soundzone = zoneconf->fullname;
@@ -1101,7 +1182,7 @@ CicoSCWindowController::destroyedCB(void                  *data,
     // delete window in list
     m_windowList.erase(window->surfaceid);
     delete(window);
+
     ICO_DBG("CicoSCWindowController::destroyedCB Leave");
 }
 
@@ -1154,10 +1235,21 @@ CicoSCWindowController::visibleCB(void                  *data,
         return;
     }
 
+    // update attr
+    window->visible = newVisible;
+    window->raise = newRaise;
+
     // notify homescreen
     CicoSCMessage *message = new CicoSCMessage();
     message->addRootObject("command", MSG_CMD_CHANGE_ATTR);
     message->addRootObject("appid", window->appid);
+    const CicoSCDisplayZone* zone = findDisplayZone(window->zoneid);
+    if (NULL != zone) {
+        message->addArgObject("zone", zone->fullname);
+    }
+    else {
+        message->addArgObject("zone", "");
+    }
     message->addArgObject("surface", window->surfaceid);
     message->addArgObject("winname", window->name);
     message->addArgObject("node", window->nodeid);
@@ -1203,8 +1295,8 @@ CicoSCWindowController::configureCB(void                  *data,
                                     int32_t               hint)
 {
     ICO_DBG("CicoSCWindowController::configureCB Enter"
-            "surfaceid=0x%08X node=%d layer=%d x=%d y=%d "
-            "width=%d height=%d hint=%d",
+            "(surfaceid=0x%08X node=%d layer=%d x=%d y=%d "
+            "width=%d height=%d hint=%d)",
             surfaceid, node, layer, x, y, width, height, hint);
 
     CicoSCWindow *window = findWindow(surfaceid);
@@ -1231,6 +1323,13 @@ CicoSCWindowController::configureCB(void                  *data,
     CicoSCMessage *message = new CicoSCMessage();
     message->addRootObject("command", MSG_CMD_CHANGE_ATTR);
     message->addRootObject("appid", window->appid);
+    const CicoSCDisplayZone* zone = findDisplayZone(window->zoneid);
+    if (NULL != zone) {
+        message->addArgObject("zone", zone->fullname);
+    }
+    else {
+        message->addArgObject("zone", "");
+    }
     message->addArgObject("surface", window->surfaceid);
     message->addArgObject("winname", window->name);
     message->addArgObject("node", window->nodeid);
@@ -1269,7 +1368,17 @@ CicoSCWindowController::activeCB(void                  *data,
 
     CicoSCWindow *window = findWindow(surfaceid);
     if (NULL == window) {
-        ICO_DBG("CicoSCWindowController::activeCB Leave");
+        ICO_DBG("CicoSCWindowController::activeCB Leave(not found window)");
+        return;
+    }
+
+    if (0 == active) {
+        ICO_DBG("CicoSCWindowController::activeCB Leave(not active)");
+        return;
+    }
+
+    if (0 != window->active) {
+        ICO_DBG("CicoSCWindowController::activeCB Leave(already active)");
         return;
     }
 
@@ -1277,10 +1386,15 @@ CicoSCWindowController::activeCB(void                  *data,
     CicoSCMessage *message = new CicoSCMessage();
     message->addRootObject("command", MSG_CMD_CHANGE_ACTIVE);
     message->addRootObject("appid", window->appid);
+    message->addRootObject("pid", window->pid);
     message->addArgObject("surface", window->surfaceid);
     message->addArgObject("winname", window->name);
     CicoSCServer::getInstance()->sendMessageToHomeScreen(message);
 
+    if (true == window->visible) {
+        (void)notifyResourceManager(window->surfaceid, NULL, NULL, 0);
+    }
+
     ICO_DBG("CicoSCWindowController::activeCB Leave");
 }
 
@@ -1367,14 +1481,18 @@ CicoSCWindowController::mapSurfaceCB(void                  *data,
                                      struct ico_window_mgr *ico_window_mgr,
                                      int32_t               event,
                                      uint32_t              surfaceid,
+                                     uint32_t              type,
+                                     uint32_t              target,
                                      int32_t               width,
                                      int32_t               height,
                                      int32_t               stride,
-                                     int32_t               format)
+                                     uint32_t               format)
 {
     ICO_DBG("CicoSCWindowController::mapSurfaceCB Enter"
-            "(event=%d surface=%d width=%d height=%d stride=%d format=%d)",
-            event, surfaceid, width, height, stride, format);
+            "(event=%d surface=%d type=%d target=%d "
+            "width=%d height=%d stride=%d format=%d)",
+            event, surfaceid, type, target,
+            width, height, stride, format);
 
     CicoSCWindow *window = findWindow(surfaceid);
     if (NULL == window) {
@@ -1429,12 +1547,18 @@ CicoSCWindowController::outputGeometryCB(void             *data,
             x, y, physical_width, physical_height,
             subpixel, make, model, transform);
 
+    ++m_physicalDisplayTotal;
     if (0 == m_displayList.size()) {
-        ICO_DBG("CicoSCWlWinMgrIF::outputGeometryCB Leave(display is zero");
+        ICO_DBG("CicoSCWlWinMgrIF::outputGeometryCB Leave(display is zero)");
         return;
     }
 
-    CicoSCDisplay* display = m_displayList.at(0);
+    if (m_displayList.size() < m_physicalDisplayTotal) {
+        ICO_WRN("CicoSCWlWinMgrIF::outputGeometryCB Leave(display total unmatch)");
+        return;
+    }
+
+    CicoSCDisplay* display = m_displayList.at(m_physicalDisplayTotal-1);
     switch (transform) {
     case WL_OUTPUT_TRANSFORM_90:
     case WL_OUTPUT_TRANSFORM_270:
@@ -1538,21 +1662,21 @@ CicoSCWindowController::findWindow(int surfaceid)
 CicoSCLayer*
 CicoSCWindowController::findLayer(int displayid, int layerid)
 {
-    CicoSCDisplay* display = NULL;
-    CicoSCLayer* layer = NULL;
-    try {
-        display = m_displayList.at(displayid);
-        layer = display->layerList.at(layerid);
-    }
-    catch (const std::exception& e) {
-        ICO_ERR("catch exception %s", e.what());
-        return NULL;
-    }
-    catch (...) {
-        ICO_ERR("catch exception unknown");
-        return NULL;
+    vector<CicoSCDisplay*>::iterator itr;
+    itr = m_displayList.begin();
+    for (; itr != m_displayList.end(); ++itr) {
+        if ((*itr)->displayid != displayid) {
+            continue;
+        }
+        vector<CicoSCLayer*>::iterator itr2;
+        itr2 = (*itr)->layerList.begin();
+        for (; itr2 != (*itr)->layerList.end(); ++itr2) {
+            if ((*itr2)->layerid == layerid) {
+                return *itr2;
+            }
+        }
     }
-    return layer;
+    return NULL;
 }
 
 //--------------------------------------------------------------------------
@@ -1566,19 +1690,15 @@ CicoSCWindowController::findDisplayZone(int zoneid)
     vector<CicoSCDisplay*>::iterator itr;
     itr = m_displayList.begin();
     for (; itr != m_displayList.end(); ++itr) {
-        vector<CicoSCDisplayZone*>::iterator itr2;
-        itr2 = (*itr)->zoneList.begin();
-        for (; itr2 != (*itr)->zoneList.end(); ++itr2) {
-            if ((*itr2)->zoneid == zoneid) {
-                return *itr2;
-            }
+        std::map<unsigned int, CicoSCDisplayZone*>::iterator itr2;
+        itr2 = (*itr)->zoneList.find(zoneid);
+        if ((*itr)->zoneList.end() != itr2) {
+            return itr2->second;
         }
     }
     return NULL;
 }
 
-
-
 //--------------------------------------------------------------------------
 /**
  *  @brief  handle command
@@ -1589,33 +1709,55 @@ CicoSCWindowController::findDisplayZone(int zoneid)
 void
 CicoSCWindowController::handleCommand(const CicoSCCommand * cmd)
 {
-    ICO_DBG("CicoSCWindowController::handleCommand Enter(%d)", cmd->cmdid);
+//    ICO_DBG("CicoSCWindowController::handleCommand Enter(%d)", cmd->cmdid);
 
     CicoSCCmdWinCtrlOpt *opt = static_cast<CicoSCCmdWinCtrlOpt*>(cmd->opt);
 
     switch (cmd->cmdid) {
     case MSG_CMD_SHOW:
         ICO_DBG("command: MSG_CMD_SHOW");
-#if 1
-        (void)notifyResourceManager(opt->surfaceid,
-                                    opt->animation.c_str(),
-                                    opt->animationTime);
-#else
-        (void)show(opt->surfaceid, opt->animation.c_str(), opt->animationTime);
-#endif
+        if (opt->animationTime & ICO_SYC_WIN_SURF_NORESCTL) {
+            /* show command but not resource control (for HomeScreen)   */
+            (void)show(opt->surfaceid, opt->animation.c_str(), opt->animationTime);
+        }
+        else {
+            /* show command (normal)    */
+            (void)notifyResourceManager(opt->surfaceid,
+                                        NULL,
+                                        opt->animation.c_str(),
+                                        opt->animationTime);
+        }
         break;
     case MSG_CMD_HIDE:
         ICO_DBG("command: MSG_CMD_HIDE");
         (void)hide(opt->surfaceid, opt->animation.c_str(), opt->animationTime);
         break;
     case MSG_CMD_MOVE:
+    {
         ICO_DBG("command: MSG_CMD_MOVE");
-        (void)setGeometry(opt->surfaceid, opt->nodeid, opt->x, opt->y, 
-                          opt->width, opt->height, 
-                          opt->animation.c_str(), opt->animationTime,
-                          opt->animation.c_str(), opt->animationTime);
+        CicoSCWindow *window = findWindow(opt->surfaceid);
+        if (NULL == window) {
+            break;
+        }
+        if (true == opt->zone.empty()) {
+            (void)setGeometry(opt->surfaceid, opt->nodeid, opt->x, opt->y,
+                              opt->width, opt->height,
+                              opt->animation.c_str(), opt->animationTime,
+                              opt->animation.c_str(), opt->animationTime);
+        }
+        else if (opt->zone == window->zone) {
+            (void)setGeometry(opt->surfaceid, opt->zone.c_str(),
+                              opt->animation.c_str(), opt->animationTime,
+                              opt->animation.c_str(), opt->animationTime);
+        }
+        else {
+            (void)notifyResourceManager(opt->surfaceid,
+                                        opt->zone.c_str(),
+                                        opt->animation.c_str(),
+                                        opt->animationTime);
+        }
         break;
+    }
     case MSG_CMD_CHANGE_ACTIVE:
         ICO_DBG("command: MSG_CMD_CHANGE_ACTIVE");
         (void)active(opt->surfaceid, opt->active);
@@ -1645,17 +1787,18 @@ CicoSCWindowController::handleCommand(const CicoSCCommand * cmd)
         break;
     }
 
-    ICO_DBG("CicoSCWindowController::handleCommand Leave");
+//    ICO_DBG("CicoSCWindowController::handleCommand Leave");
 }
 
-int 
+int
 CicoSCWindowController::notifyResourceManager(int        surfaceid,
+                                              const char *zone,
                                               const char *animation,
                                               int        animationTime)
 {
     ICO_DBG("CicoSCWindowController::notifyResourceManager Enter"
-            "(surfaceid=0x%08X animation=%s animationTime=%d)",
-            surfaceid, animation, animationTime);
+            "(surfaceid=0x%08X zone=%s animation=%s animationTime=%d)",
+            surfaceid, zone, animation, animationTime);
 
     // find window information in window list
     CicoSCWindow *window = findWindow(surfaceid);
@@ -1671,20 +1814,25 @@ CicoSCWindowController::notifyResourceManager(int        surfaceid,
     cmd.appid = window->appid;
     cmd.pid   = window->pid;
     cmd.opt   = opt;
-    
+
     opt->dispres       = true;
     opt->winname       = window->name;
     opt->surfaceid     = window->surfaceid;
-    opt->animation     = animation;
+    opt->animation     = animation ? animation : "";
     opt->animationTime = animationTime;
     string fullname;
-    const CicoSCDisplayZone* zone = findDisplayZone(window->zoneid);
-    if (NULL != zone) {
-        opt->dispzone = zone->fullname;
+    if (NULL == zone) {
+        const CicoSCDisplayZone* zone = findDisplayZone(window->zoneid);
+        if (NULL != zone) {
+            opt->dispzone = zone->fullname;
+        }
+        else {
+            ICO_WRN("CicoSCWindowController::notifyResourceManager Leave(ENOENT)");
+            return ICO_SYC_ENOENT;
+        }
     }
     else {
-        ICO_WRN("CicoSCWindowController::notifyResourceManager Leave(ENOENT)");
-        return ICO_SYC_ENOENT;
+        opt->dispzone = zone;
     }
 #if 1
     opt->soundres  = true;
@@ -1693,7 +1841,7 @@ CicoSCWindowController::notifyResourceManager(int        surfaceid,
     CicoSCSystemConfig *sysconf = CicoSCSystemConfig::getInstance();
     const CicoSCDefaultConf *defconf = sysconf->getDefaultConf();
     if (NULL != defconf) {
-        const CicoSCSoundZoneConf *zoneconf = 
+        const CicoSCSoundZoneConf *zoneconf =
             sysconf->findSoundZoneConfbyId(defconf->soundzone);
         if (NULL != zoneconf) {
             opt->soundzone = zoneconf->fullname;
index c62f7fc..391a6e7 100644 (file)
@@ -87,6 +87,13 @@ public:
                     const char *moveAnimation,
                     int        moveAnimationTime);
 
+    int setGeometry(int        surfaceid,
+                    const char *zone,
+                    const char *resizeAnimation,
+                    int        resizeAnimationTime,
+                    const char *moveAnimation,
+                    int        moveAnimationTime);
+
     int raise(int surfaceid,
              const char  *animation,
              int         animationTime);
@@ -159,10 +166,12 @@ public:
                               struct ico_window_mgr *ico_window_mgr,
                               int32_t event,
                               uint32_t surfaceid,
+                              uint32_t type,
+                              uint32_t target,
                               int32_t width,
                               int32_t height,
                               int32_t stride,
-                              int32_t format);
+                              uint32_t format);
 
     virtual void outputGeometryCB(void *data,
                                   struct wl_output *wl_output,
@@ -199,6 +208,7 @@ private:
     const CicoSCDisplayZone * findDisplayZone(int zoneid);
 
     int notifyResourceManager(int        surfaceid,
+                              const char *zone,
                               const char *animation,
                               int        animationTime);
 
@@ -211,6 +221,9 @@ private:
     // display object list
     vector<CicoSCDisplay*>   m_displayList;
 
+    //
+    unsigned int m_physicalDisplayTotal;
+
 };
 #endif  // __CICO_SC_WINDOW_CONTROLLER_H__
 // vim:set expandtab ts=4 sw=4:
index c95a34f..e133269 100644 (file)
@@ -21,6 +21,7 @@
 using namespace std;
 
 #include "CicoSCWlInputMgrIF.h"
+#include "CicoSCWayland.h"
 #include "CicoLog.h"
 
 //--------------------------------------------------------------------------
@@ -82,7 +83,6 @@ CicoSCWlInputMgrIF::initInterface(void               *data,
             ICO_WRN("initInterface : Leave(binding failed)");
             return;
         }
-
         m_inputmgr = (struct ico_input_mgr_control*)wlProxy;
     }
     else if (0 == strcmp(interface, ICO_WL_EXINPUT_IF)) {
@@ -153,6 +153,8 @@ CicoSCWlInputMgrIF::addInputApp(const string &appid,
             appid.c_str(), device.c_str(), input, fix, keycode);
     ico_input_mgr_control_add_input_app(m_inputmgr,appid.c_str(),
                                         device.c_str(), input, fix, keycode);
+    // flush display
+    CicoSCWayland::getInstance()->flushDisplay();
 }
 
 //--------------------------------------------------------------------------
@@ -174,6 +176,8 @@ CicoSCWlInputMgrIF::delInputApp(const string &appid,
             appid.c_str(), device.c_str(), input);
     ico_input_mgr_control_del_input_app(m_inputmgr, appid.c_str(),
                                         device.c_str(), input);
+    // flush display
+    CicoSCWayland::getInstance()->flushDisplay();
 }
 
 //--------------------------------------------------------------------------
@@ -182,10 +186,11 @@ CicoSCWlInputMgrIF::delInputApp(const string &appid,
  *
  *  @param [in] appid     application id
  *  @param [in] surfaceid surface id
- *  @param [in] type      //TODO
+ *  @param [in] type      device type
  *  @param [in] deviceno  input device number
- *  @param [in] code      //TODO
- *  @param [in] value     //TODO
+ *  @param [in] time      event time
+ *  @param [in] code      event code
+ *  @param [in] value     event value
  */
 //--------------------------------------------------------------------------
 void
@@ -193,14 +198,17 @@ CicoSCWlInputMgrIF::sendInputEvent(const string &appid,
                                    int          surfaceid,
                                    int          type,
                                    int          deviceno,
+                                   int          time,
                                    int          code,
                                    int          value)
 {
     ICO_DBG("called: ico_input_mgr_control_send_input_event"
-            "(appid=%s surfaceid=0x%08X type=%d deviceno=%d code=%d value=%d)",
-            appid.c_str(), surfaceid, type, deviceno, code, value);
+            "(appid=<%s> surfaceid=0x%08X type=%d deviceno=%d time=%d code=%d value=%d)",
+            appid.c_str(), surfaceid, type, deviceno, time, code, value);
     ico_input_mgr_control_send_input_event(m_inputmgr, appid.c_str(), surfaceid,
-                                           type, deviceno, code, value);
+                                           type, deviceno, time, code, value);
+    // flush display
+    CicoSCWayland::getInstance()->flushDisplay();
 }
 
 //--------------------------------------------------------------------------
@@ -243,6 +251,8 @@ CicoSCWlInputMgrIF::setInputRegion(const string &target,
     ico_exinput_set_input_region(m_exinput, target.c_str(), x, y,
                                  width, height, hotspot_x, hotspot_y, cursor_x,
                                  cursor_y, cursor_width, cursor_height,attr);
+    // flush display
+    CicoSCWayland::getInstance()->flushDisplay();
 }
 
 //--------------------------------------------------------------------------
@@ -268,6 +278,8 @@ CicoSCWlInputMgrIF::unsetInputRegion(const string &target,
             target.c_str(), x, y, width, height);
     ico_exinput_unset_input_region(m_exinput, target.c_str(),
                                    x, y, width, height);
+    // flush display
+    CicoSCWayland::getInstance()->flushDisplay();
 }
 
 //--------------------------------------------------------------------------
@@ -300,7 +312,7 @@ CicoSCWlInputMgrIF::capabilitiesCB(void               *data,
 //--------------------------------------------------------------------------
 /**
  *  @brief  callback to application for input code information
- *  
+ *
  *  @param [in] data        user data
  *  @param [in] ico_exinput wayland ico_exinput interface
  *  @param [in] device      input device name
@@ -322,7 +334,7 @@ CicoSCWlInputMgrIF::codeCB(void               *data,
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  callback to application for switch input 
+ *  @brief  callback to application for switch input
  *
  *  @param [in] data        user data
  *  @param [in] ico_exinput wayland ico_exinput interface
@@ -406,7 +418,7 @@ CicoSCWlInputMgrIF::wlCapabilitiesCB(void               *data,
 //--------------------------------------------------------------------------
 /**
  *  @brief  callback to application for input code information
- *  
+ *
  *  @param [in] data        user data
  *  @param [in] ico_exinput wayland ico_exinput interface
  *  @param [in] device      input device name
@@ -438,7 +450,7 @@ CicoSCWlInputMgrIF::wlCodeCB(void               *data,
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  callback to application for switch input 
+ *  @brief  callback to application for switch input
  *
  *  @param [in] data        user data
  *  @param [in] ico_exinput wayland ico_exinput interface
index 1fcbde8..271561e 100644 (file)
@@ -73,7 +73,7 @@ protected:
     CicoSCWlInputMgrIF();
 
     // destructor
-    ~CicoSCWlInputMgrIF();
+    virtual ~CicoSCWlInputMgrIF();
 
     // assignment operator
     CicoSCWlInputMgrIF& operator=(const CicoSCWlInputMgrIF &object);
@@ -98,6 +98,7 @@ protected:
                         int               surfaceid,
                         int               type,
                         int               deviceno,
+                        int               time,
                         int               code,
                         int               value);
 
index 9766203..8288317 100644 (file)
@@ -639,7 +639,7 @@ CicoSCWlWinMgrIF::wlCreatedCB(void                  *data,
                               int32_t               pid,
                               const char            *appid)
 {
-    ICO_DBG("CicoSCWlWinMgrIF::wlCreatedCB Enter");
+//    ICO_DBG("CicoSCWlWinMgrIF::wlCreatedCB Enter");
     if (NULL == data) {
         ICO_WRN("wlCreatedCB : data is null");
         return;
@@ -647,7 +647,7 @@ CicoSCWlWinMgrIF::wlCreatedCB(void                  *data,
     static_cast<CicoSCWlWinMgrIF*>(data)->createdCB(data, ico_window_mgr,
                                                     surfaceid, winname,
                                                     pid, appid);
-    ICO_DBG("CicoSCWlWinMgrIF::wlCreatedCB Leave");
+//    ICO_DBG("CicoSCWlWinMgrIF::wlCreatedCB Leave");
 }
 
 //--------------------------------------------------------------------------
@@ -666,7 +666,7 @@ CicoSCWlWinMgrIF::wlNameCB(void                  *data,
                            uint32_t              surfaceid,
                            const char            *winname)
 {
-    ICO_DBG("CicoSCWlWinMgrIF::wlNameCB Enter");
+//    ICO_DBG("CicoSCWlWinMgrIF::wlNameCB Enter");
 
     if (NULL == data) {
         ICO_WRN("wlNameCB: data is null");
@@ -674,7 +674,7 @@ CicoSCWlWinMgrIF::wlNameCB(void                  *data,
     }
     static_cast<CicoSCWlWinMgrIF*>(data)->nameCB(data, ico_window_mgr,
                                                  surfaceid, winname);
-    ICO_DBG("CicoSCWlWinMgrIF::wlNameCB Leave");
+//    ICO_DBG("CicoSCWlWinMgrIF::wlNameCB Leave");
 }
 
 //--------------------------------------------------------------------------
@@ -691,7 +691,7 @@ CicoSCWlWinMgrIF::wlDestroyedCB(void                  *data,
                                 struct ico_window_mgr *ico_window_mgr,
                                 uint32_t              surfaceid)
 {
-    ICO_DBG("CicoSCWlWinMgrIF::wlDestroyedCB Enter");
+//    ICO_DBG("CicoSCWlWinMgrIF::wlDestroyedCB Enter");
 
     if (NULL == data) {
         ICO_WRN("wlDestroyedCB: data is null");
@@ -699,7 +699,7 @@ CicoSCWlWinMgrIF::wlDestroyedCB(void                  *data,
     }
     static_cast<CicoSCWlWinMgrIF*>(data)->destroyedCB(data, ico_window_mgr,
                                                       surfaceid);
-    ICO_DBG("CicoSCWlWinMgrIF::wlDestroyedCB Leave");
+//    ICO_DBG("CicoSCWlWinMgrIF::wlDestroyedCB Leave");
 }
 
 //--------------------------------------------------------------------------
@@ -725,7 +725,7 @@ CicoSCWlWinMgrIF::wlVisibleCB(void                  *data,
                               int32_t               raise,
                               int32_t               hint)
 {
-    ICO_DBG("CicoSCWlWinMgrIF::wlVisibleCB Enter");
+//    ICO_DBG("CicoSCWlWinMgrIF::wlVisibleCB Enter");
 
     if (NULL == data) {
         ICO_WRN("wlVisibleCB: data is null");
@@ -734,7 +734,7 @@ CicoSCWlWinMgrIF::wlVisibleCB(void                  *data,
     static_cast<CicoSCWlWinMgrIF*>(data)->visibleCB(data, ico_window_mgr,
                                                     surfaceid, visible,
                                                     raise, hint);
-    ICO_DBG("CicoSCWlWinMgrIF::wlVisibleCB Leave");
+//    ICO_DBG("CicoSCWlWinMgrIF::wlVisibleCB Leave");
 }
 
 //--------------------------------------------------------------------------
@@ -765,7 +765,7 @@ CicoSCWlWinMgrIF::wlConfigureCB(void                  *data,
                                 int32_t               height,
                                 int32_t               hint)
 {
-    ICO_DBG("CicoSCWlWinMgrIF::wlConfigureCB Enter");
+//    ICO_DBG("CicoSCWlWinMgrIF::wlConfigureCB Enter");
 
     if (NULL == data) {
         ICO_WRN("wlConfigureCB: data is null");
@@ -775,7 +775,7 @@ CicoSCWlWinMgrIF::wlConfigureCB(void                  *data,
                                                       surfaceid, node, layer,
                                                       x, y, width, height,
                                                       hint);
-    ICO_DBG("CicoSCWlWinMgrIF::wlConfigureCB Leave");
+//    ICO_DBG("CicoSCWlWinMgrIF::wlConfigureCB Leave");
 }
 //--------------------------------------------------------------------------
 /**
@@ -794,7 +794,7 @@ CicoSCWlWinMgrIF::wlActiveCB(void                  *data,
                              uint32_t              surfaceid,
                              int32_t               active)
 {
-    ICO_DBG("CicoSCWlWinMgrIF::wlActiveCB Enter");
+//    ICO_DBG("CicoSCWlWinMgrIF::wlActiveCB Enter");
 
     if (NULL == data) {
         ICO_WRN("wlActiveCB: data is null");
@@ -802,7 +802,7 @@ CicoSCWlWinMgrIF::wlActiveCB(void                  *data,
     }
     static_cast<CicoSCWlWinMgrIF*>(data)->activeCB(data, ico_window_mgr,
                                                    surfaceid, active);
-    ICO_DBG("CicoSCWlWinMgrIF::wlActiveCB Leave");
+//    ICO_DBG("CicoSCWlWinMgrIF::wlActiveCB Leave");
 }
 
 //--------------------------------------------------------------------------
@@ -822,7 +822,7 @@ CicoSCWlWinMgrIF::wlLayerVisibleCB(void                  *data,
                                    uint32_t              layer,
                                    int32_t               visible)
 {
-    ICO_DBG("CicoSCWlWinMgrIF::wlLayerVisibleCB Enter");
+//    ICO_DBG("CicoSCWlWinMgrIF::wlLayerVisibleCB Enter");
 
     if (NULL == data) {
         ICO_WRN("wlLayerVisibleCB: data is null");
@@ -830,7 +830,7 @@ CicoSCWlWinMgrIF::wlLayerVisibleCB(void                  *data,
     }
     static_cast<CicoSCWlWinMgrIF*>(data)->layerVisibleCB(data, ico_window_mgr,
                                                          layer, visible);
-    ICO_DBG("CicoSCWlWinMgrIF::wlLayerVisibleCB Leave");
+//    ICO_DBG("CicoSCWlWinMgrIF::wlLayerVisibleCB Leave");
 }
 
 //--------------------------------------------------------------------------
@@ -849,7 +849,7 @@ CicoSCWlWinMgrIF::wlAppSurfacesCB(void                  *data,
                                   const char            *appid,
                                   struct wl_array       *surfaces)
 {
-    ICO_DBG("CicoSCWlWinMgrIF::wlAppSurfacesCB Enter");
+//    ICO_DBG("CicoSCWlWinMgrIF::wlAppSurfacesCB Enter");
 
     if (NULL == data) {
         ICO_WRN("wlAppSurfacesCB: data is null");
@@ -857,7 +857,7 @@ CicoSCWlWinMgrIF::wlAppSurfacesCB(void                  *data,
     }
     static_cast<CicoSCWlWinMgrIF*>(data)->appSurfacesCB(data, ico_window_mgr,
                                                         appid, surfaces);
-    ICO_DBG("CicoSCWlWinMgrIF::wlAppSurfacesCB Leave");
+//    ICO_DBG("CicoSCWlWinMgrIF::wlAppSurfacesCB Leave");
 }
 
 //--------------------------------------------------------------------------
@@ -888,7 +888,7 @@ CicoSCWlWinMgrIF::wlMapSurfaceCB(void                  *data,
                                  int32_t               stride,
                                  uint32_t              format)
 {
-    ICO_DBG("CicoSCWlWinMgrIF::wlMapSurfaceCB Enter");
+//    ICO_DBG("CicoSCWlWinMgrIF::wlMapSurfaceCB Enter");
 
     if (NULL == data) {
         ICO_WRN("wlMapSurfaceCB: data is null");
@@ -899,7 +899,7 @@ CicoSCWlWinMgrIF::wlMapSurfaceCB(void                  *data,
                                                        type, target,
                                                        width, height,
                                                        stride, format);
-    ICO_DBG("CicoSCWlWinMgrIF::wlMapSurfaceCB Leave");
+//    ICO_DBG("CicoSCWlWinMgrIF::wlMapSurfaceCB Leave");
 }
 
 //--------------------------------------------------------------------------
@@ -930,7 +930,7 @@ CicoSCWlWinMgrIF::wlOutputGeometryCB(void             *data,
                                      const char       *model,
                                      int32_t          transform)
 {
-    ICO_DBG("CicoSCWlWinMgrIF::wlOutputGeometryCB Enter");
+//    ICO_DBG("CicoSCWlWinMgrIF::wlOutputGeometryCB Enter");
 
     if (NULL == data) {
         ICO_WRN("wlOutputGeometryCB: data is null");
@@ -944,7 +944,7 @@ CicoSCWlWinMgrIF::wlOutputGeometryCB(void             *data,
                                                            make,
                                                            model,
                                                            transform);
-    ICO_DBG("CicoSCWlWinMgrIF::wlOutputGeometryCB Leave");
+//    ICO_DBG("CicoSCWlWinMgrIF::wlOutputGeometryCB Leave");
 }
 
 //--------------------------------------------------------------------------
@@ -967,7 +967,7 @@ CicoSCWlWinMgrIF::wlOutputModeCB(void             *data,
                                  int32_t          height,
                                  int32_t          refresh)
 {
-    ICO_DBG("CicoSCWlWinMgrIF::wlOutputModeCB Enter");
+//    ICO_DBG("CicoSCWlWinMgrIF::wlOutputModeCB Enter");
 
     if (NULL == data) {
         ICO_WRN("wlOutputGeometryCB: data is null");
@@ -975,6 +975,6 @@ CicoSCWlWinMgrIF::wlOutputModeCB(void             *data,
     }
     static_cast<CicoSCWlWinMgrIF*>(data)->outputModeCB(data, wl_output, flags,
                                                        width, height, refresh);
-    ICO_DBG("CicoSCWlWinMgrIF::wlOutputModeCB Leave");
+//    ICO_DBG("CicoSCWlWinMgrIF::wlOutputModeCB Leave");
 }
 // vim:set expandtab ts=4 sw=4:
index b331c35..21d60e4 100644 (file)
@@ -1,3 +1,16 @@
+* Thu Sep 26 2013 Shibata Makoto <shibata@mac.tec.toyota.co.jp> accepted/tizen/20130919.204217@93c93da
+- 0.9.04 release
+-- addition of the application operation history.
+-- change of the interface of the ico-uxf-weston-plugin.
+-- BugFix: TIVI-1436,1741,1786,1787,1815,1816,1820,1836,1843,1900,1905
+-- Renewal of a menu at the time of installation/uninstallation.
+-- The start method is changed to the Wants target of the service file for ico-uxf-device-input-controller and ico-vic-carsimurator.
+-- Shortcut addition.
+-- bugfix : display history order is not reproduced.
+-- bugfix: when show app in second display, crash homescreen
+-- bugfix: the prev swipe operation, failure occurs to the next swipe
+-- updated homescreen service file.(delete Type=oneshot) 
+
 * Thu Sep 19 2013 Shibata Makoto <shibata@mac.tec.toyota.co.jp> accepted/tizen/20130911.211140@65dbd1c
 - 0.9.03 release.
 -- Additional functions of policy and resource management.
index 1e9fc24..019cfc1 100644 (file)
@@ -1,14 +1,14 @@
 Name:       ico-uxf-homescreen
 Summary:    Sample homescreen and system controller
-Version:    0.9.03
-Release:    1.1
+Version:    0.9.04
+Release:    1.2
 Group:         Graphics & UI Framework/Automotive UI
 License:    Apache-2.0
 URL:        ""
 Source0:    %{name}-%{version}.tar.bz2
 
 BuildRequires: pkgconfig(wayland-client) >= 1.2
-BuildRequires: ico-uxf-weston-plugin-devel >= 0.9.04
+BuildRequires: ico-uxf-weston-plugin-devel >= 0.9.05
 BuildRequires: pkgconfig(glib-2.0)
 BuildRequires: pkgconfig(ecore)
 BuildRequires: pkgconfig(ecore-wayland)
@@ -32,7 +32,7 @@ BuildRequires: pkgconfig(murphy-resource)
 BuildRequires: boost-devel
 BuildRequires: ico-uxf-utilities-devel >= 0.2.04
 Requires: weston >= 1.2
-Requires: ico-uxf-weston-plugin >= 0.9.04
+Requires: ico-uxf-weston-plugin >= 0.9.05
 Requires: ico-uxf-utilities >= 0.2.04
 
 %description
@@ -109,8 +109,8 @@ rm -f /home/app/layout.txt
 /usr/lib/systemd/user/ico-system-controller.service
 /usr/lib/systemd/user/ico-uxf-wait-launchpad-ready.path
 /usr/lib/systemd/user/weston.target.wants/ico-uxf-wait-launchpad-ready.path
-%attr(755,app,app) /home/app/ico
 %attr(644,app,app) /home/app/ico/defaultApps.info
+%attr(755,app,app) /home/app/ico
 /home/app/ico/defaultApps.info
 
 %files system-controller-devel
index ca28016..2abe477 100644 (file)
@@ -1,20 +1,27 @@
-## OpenPF System Configurations
-##  /opt/apps/org.tizen.ico.homescreen/res/config/app_attr.conf
-##     May-15-2013
-
+# OpenPF System Configurations
+#  /usr/apps/org.tizen.ico.homescreen/res/config/app_attr.conf
+#  Sep-30-2013
 #
-## default attributes for each application
+
 [app-attributes]
+# attributes of HomeScreen
+org.tizen.ico.homescreen=Menu;kind=HomeScreen;run=Center;noauto;type=menu
+org.tizen.ico.onscreen=Menu;kind=HomeScreen;run=Center;noauto;type=menu
+org.tizen.ico.statusbar=Menu;kind=HomeScreen;run=Center;noauto;type=menu
+org.tizen.ico.app-samplenavi=Map
+
 # attrinutes of native applictions
-org.tizen.soft-keyboard=Menu;SysApp;dispzone=SysApp;layer=SoftKeyboard
+org.tizen.soft-keyboard=Menu;kind=SysApp;dispzone=SysApp;layer=SoftKeyboard
 org.tizen.setting=CarSetting;kind=SysApp.audio
 org.tizen.music-player=Map
+
 # attributes of web applications
-DemoMeterApp=Map
+MediaPlayer=Map
+MyMediaPlayer=Map
+MeterWidget=Map
 GhostCluster=Map
 WinkerLeft=Camera.Left;kind=Maker;dispzone=SysApp.Left;layer=InterruptApp
 WinkerLeft.1=NoDisplay;auto;Animation=Slide.toRight;invisiblecpu=no;noconfigure
 WinkerRight=Camera.Right;kind=Maker;dispzone=SysApp.Right;layer=InterruptApp
 WinkerRight.1=NoDisplay;auto;Animation=Slide.toLeft;invisiblecpu=no;noconfigure
-#
 
@@ -23,3 +23,26 @@ bgimage=/opt/share/settings/Wallpapers/Home_default.jpg
 #configuration for sounds
 sound_default=/usr/share/sounds/mm-camcorder/af_succeed.wav
 
+[app_history]
+timer=10
+manage_off_app=org.tizen.ico.homescreen;org.tizen.ico.statusbar
+write_off_app=org.tizen.ico.login
+
+[switchzone]
+# trigger switch keyname
+keyname=m
+
+# move zone name
+movezone=Mid.Left
+
+# move animation
+# animation : animation name
+# animatime : animation time [ms]
+animation=Fade
+animatime=400
+
+[controlbar]
+shortcut_app0=t8j6HTRpuz.MediaPlayer
+shortcut_app1=
+shortcut_app2=
+shortcut_app3=
diff --git a/res/org.tizen.ico.homescreen/res/config/menu_categoryid.conf b/res/org.tizen.ico.homescreen/res/config/menu_categoryid.conf
new file mode 100644 (file)
index 0000000..47b5fdd
--- /dev/null
@@ -0,0 +1,2 @@
+3
+10
diff --git a/res/org.tizen.ico.homescreen/res/images/pageDownCursor.png b/res/org.tizen.ico.homescreen/res/images/pageDownCursor.png
new file mode 100644 (file)
index 0000000..e4e8983
Binary files /dev/null and b/res/org.tizen.ico.homescreen/res/images/pageDownCursor.png differ
diff --git a/res/org.tizen.ico.homescreen/res/images/pageUpCursor.png b/res/org.tizen.ico.homescreen/res/images/pageUpCursor.png
new file mode 100644 (file)
index 0000000..9e07669
Binary files /dev/null and b/res/org.tizen.ico.homescreen/res/images/pageUpCursor.png differ
index a1d5db3..2abe477 100644 (file)
@@ -1,6 +1,6 @@
 # OpenPF System Configurations
 #  /usr/apps/org.tizen.ico.homescreen/res/config/app_attr.conf
-#  Jul-26-2013
+#  Sep-30-2013
 #
 
 [app-attributes]
@@ -16,7 +16,9 @@ org.tizen.setting=CarSetting;kind=SysApp.audio
 org.tizen.music-player=Map
 
 # attributes of web applications
-DemoMeterApp=Map
+MediaPlayer=Map
+MyMediaPlayer=Map
+MeterWidget=Map
 GhostCluster=Map
 WinkerLeft=Camera.Left;kind=Maker;dispzone=SysApp.Left;layer=InterruptApp
 WinkerLeft.1=NoDisplay;auto;Animation=Slide.toRight;invisiblecpu=no;noconfigure
index 832c3dc..f2bc077 100644 (file)
@@ -1,7 +1,7 @@
 "stateMachine":{
   "name":"Policy",
   "value":1,
-  "initial":[1001,2001,3001,3101,4001,5001,9001,10001,11001,12003,13009,14999,15999,16999,17999,20999,22999,30001,30101],
+  "initial":[1001,2001,3001,3101,4001,5001,9001,10001,11999,12003,13009,14999,15999,16999,17999,20999,22999,30001,30101],
   "state":{
     "name":"Driving",
     "value":1000,
       "event":{ "name":"EV10000","value":10000, "transition":10001, "guardCondition":[{"operator":"=","value":1}]},
       "event":{ "name":"EV10000","value":10000, "transition":10002, "guardCondition":[{"operator":"=","value":2}]},
       "event":{ "name":"EV10000","value":10000, "transition":10003, "guardCondition":[{"operator":"=","value":3}]}
+    },
+    "state":{
+      "name":"Display0NoOwer",
+      "value":10999,
+      "event":{ "name":"EV10000","value":10000, "transition":11001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV10000","value":10000, "transition":11002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV10000","value":10000, "transition":11003, "guardCondition":[{"operator":"=","value":3}]}
     }
   },
 
     "state":{
       "name":"Display1Zone1",
       "value":11001,
-      "event":{ "name":"EV10000","value":11000, "transition":11001, "guardCondition":[{"operator":"=","value":1}]},
-      "event":{ "name":"EV10000","value":11000, "transition":11002, "guardCondition":[{"operator":"=","value":2}]},
-      "event":{ "name":"EV10000","value":11000, "transition":11003, "guardCondition":[{"operator":"=","value":3}]}
+      "event":{ "name":"EV10000","value":10000, "transition":11001, "guardCondition":[{"operator":"=","value":20}]},
+      "event":{ "name":"EV10000","value":10000, "transition":11002, "guardCondition":[{"operator":"=","value":21}]},
+      "event":{ "name":"EV10000","value":10000, "transition":11003, "guardCondition":[{"operator":"=","value":22}]},
+      "event":{ "name":"EV11999","value":11999, "transition":11999}
     },
     "state":{
       "name":"Display1Zone2",
       "value":11002,
-      "event":{ "name":"EV10000","value":11000, "transition":11001, "guardCondition":[{"operator":"=","value":1}]},
-      "event":{ "name":"EV10000","value":11000, "transition":11002, "guardCondition":[{"operator":"=","value":2}]},
-      "event":{ "name":"EV10000","value":11000, "transition":11003, "guardCondition":[{"operator":"=","value":3}]}
+      "event":{ "name":"EV10000","value":10000, "transition":11001, "guardCondition":[{"operator":"=","value":20}]},
+      "event":{ "name":"EV10000","value":10000, "transition":11002, "guardCondition":[{"operator":"=","value":21}]},
+      "event":{ "name":"EV10000","value":10000, "transition":11003, "guardCondition":[{"operator":"=","value":22}]},
+      "event":{ "name":"EV11999","value":11999, "transition":11999}
     },
     "state":{
       "name":"Display1Zone3",
       "value":11003,
-      "event":{ "name":"EV10000","value":11000, "transition":11001, "guardCondition":[{"operator":"=","value":1}]},
-      "event":{ "name":"EV10000","value":11000, "transition":11002, "guardCondition":[{"operator":"=","value":2}]},
-      "event":{ "name":"EV10000","value":11000, "transition":11003, "guardCondition":[{"operator":"=","value":3}]}
+      "event":{ "name":"EV10000","value":10000, "transition":11001, "guardCondition":[{"operator":"=","value":20}]},
+      "event":{ "name":"EV10000","value":10000, "transition":11002, "guardCondition":[{"operator":"=","value":21}]},
+      "event":{ "name":"EV10000","value":10000, "transition":11003, "guardCondition":[{"operator":"=","value":22}]},
+      "event":{ "name":"EV11999","value":11999, "transition":11999}
+    },
+    "state":{
+      "name":"Display1NoOwer",
+      "value":11999,
+      "event":{ "name":"EV10000","value":10000, "transition":11001, "guardCondition":[{"operator":"=","value":20}]},
+      "event":{ "name":"EV10000","value":10000, "transition":11002, "guardCondition":[{"operator":"=","value":21}]},
+      "event":{ "name":"EV10000","value":10000, "transition":11003, "guardCondition":[{"operator":"=","value":22}]}
     }
   },
 
index f922de3..0d92acb 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
-     OpenPF System Configurations 
+     OpenPF System Configurations
     /opt/apps/org.tizen.ico.homescreen/res/config/system.conf
 -->
 
@@ -70,7 +70,7 @@
                 <overlap>Full;UpperLeft;UpperRight</overlap>
             </zone>
             <zone id="3" name="Lower">
-                <geometry x="0" y="height-64-128/2+64" w="dispw" h="disph-64-128/2"/>
+                <geometry x="0" y="heigh-64-128/2+64" w="dispw" h="disph-64-128/2"/>
                 <overlap>Full;LowerLeft;LowerRight</overlap>
             </zone>
             <zone id="4" name="UpperLeft">
             </zone>
         </zones>
     </display>
+    <display id="1" name="Mid">
+        <node>Center</node>
+        <no>1</no>
+        <wayland>waylnad-0</wayland>
+        <type>center</type>
+        <width>1280</width>
+        <height>480</height>
+        <inch>101</inch>
+        <layers>
+            <layer id="2" name="Application">
+                <type>2</type>
+                <menuoverlap>false</menuoverlap>
+            </layer>
+        </layers>
+        <zones>
+            <zone id="20" name="Full">
+                <geometry x="0" y="0" w="dispw" h="disph"/>
+                <overlap>Left;Right</overlap>
+            </zone>
+            <zone id="21" name="Left">
+                <geometry x="0" y="0" w="320" h="disph"/>
+                <overlap>Full</overlap>
+            </zone>
+            <zone id="22" name="Right">
+                <geometry x="960" y="0" w="320" h="disph"/>
+                <overlap>Full</overlap>
+            </zone>
+        </zones>
+    </display>
 </displays>
 
 <sounds>
index 7bad292..c72ef0a 100644 (file)
  *
  * @date    Sep-16-2013
  */
+#include <iostream>
+#include <fstream>
 #include <string>
 #include <list>
+#include <vector>
+#include <utility>
+#include <cstdio>
+#include <aul/aul.h>
+#include <sys/stat.h>
 #include "CicoHSAppHistory.h"
 #include "CicoLog.h"
 
@@ -23,18 +30,39 @@ using namespace std;
  */
 CicoHSAppHistory::CicoHSAppHistory()
 {
+    ICO_DBG("constructor");
     m_user.clear();
     m_path.clear();
+    m_flagPath.clear();
+    homeSwipe();
 }
 
 /**
  * @brief constructor
  * @param user login user name
- * @param path application list
+ * @param path application list file path
+ * @param flagpath control flag file path
  */
-CicoHSAppHistory::CicoHSAppHistory(const char* user, const char* path)
-    :m_user(user), m_path(path)
+CicoHSAppHistory::CicoHSAppHistory(const char* user, const char* path,
+                                   const char* flagpath)
+    :m_user(user), m_path(path), m_flagPath(flagpath)
 {
+    ICO_DBG("constructor %s, %s, %s", user, path, flagpath);
+    homeSwipe();
+}
+
+/**
+ * @brief constructor
+ * @param user login user name
+ * @param path application list file path
+ * @param flagpath control flag file path
+ */
+CicoHSAppHistory::CicoHSAppHistory(const string& user, const string& path,
+                                   const string& flagpath)
+    :m_user(user), m_path(path), m_flagPath(flagpath)
+{
+    ICO_DBG("constructor %s, %s, %s", user.c_str(), path.c_str(), flagpath.c_str());
+    homeSwipe();
 }
 
 /**
@@ -43,63 +71,242 @@ CicoHSAppHistory::CicoHSAppHistory(const char* user, const char* path)
  */
 CicoHSAppHistory::~CicoHSAppHistory()
 {
+    writeAppHistory();
     m_user.clear();
     m_path.clear();
+    m_flagPath.clear();
 }
 
 /**
  * @brief added application id to list
  * @param app target application id
+ * @ret bool
+ * @retval true added ok
+ * @retval false added ng
  */
-void CicoHSAppHistory::addAppHistory(const string& app)
+bool CicoHSAppHistory::addAppHistory(const string& app)
 {
-    ICO_TRA("CicoHSAppHistory::addAppHistory(%s) start(%d)", app.c_str(),
-            (int)m_appHistoryList.size());
-    delAppHistory(app);
-    if (0 == m_appHistoryList.size()) {
-        m_appHistoryList.push_back(app);
+    const char* tgt = app.c_str();
+    ICO_TRA("start(%s, %d)", tgt, (int)m_appHistoryList.size());
+    if (true == filterChk(m_filterM, tgt)) {
+       ICO_TRA("end false");
+       return false;
     }
-    else {
-        list<string>::iterator p = m_appHistoryList.begin();
-        m_appHistoryList.insert(p, 1, app);
-    }
-    ICO_TRA("CicoHSAppHistory::addAppHistory() end()",
-            (int)m_appHistoryList.size());
+    m_appHistoryList.remove(app);
+    m_appHistoryList.push_front(app);
+    homeSwipe();
+    ICO_TRA("end (true, %d)", (int)m_appHistoryList.size());
+    return true;
 }
 
 /**
  * @brief delete application id to list
  * @param app target application id
+ * @ret bool
+ * @retval true added ok
+ * @retval false added ng
  */
-void CicoHSAppHistory::delAppHistory(const string& app)
+bool CicoHSAppHistory::delAppHistory(const string& app)
 {
-    ICO_TRA("CicoHSAppHistory::delAppHistory(%s) start(%d)", app.c_str(),
-            (int)m_appHistoryList.size());
-    m_appHistoryList.remove(app);
-    ICO_TRA("CicoHSAppHistory::delAppHistory() end(%d)",
-            (int)m_appHistoryList.size());
+    int sz = m_appHistoryList.size();
+    ICO_TRA("start(%s, %d)", app.c_str(), sz);
+    bool r = false;
+    if (false == isFlag()) {
+        m_appHistoryList.remove(app);
+        int sztmp = sz;
+        sz = m_appHistoryList.size();
+        if (sz != sztmp) {
+            r = true;
+            homeSwipe();
+        }
+    }
+    ICO_TRA("end(%s, %d)", r? "true": "false", sz);
+    return r;
 }
 
 /**
  * @brief priority change list
  * @param app target application id
+ * @ret bool
+ * @retval true added ok
+ * @retval false added ng
  */
-void CicoHSAppHistory::moveHistoryHead(const string& app)
+bool CicoHSAppHistory::moveHistoryHead(const string& app)
 {
-    ICO_TRA("CicoHSAppHistory::moveHistoryHead(%s) start(%d)", app.c_str(),
-            (int)m_appHistoryList.size());
-//    delAppHistory(app);
-    bool b = false;
+    ICO_TRA("start(%s, %d)", app.c_str(), (int)m_appHistoryList.size());
+    bool r = false;
     list<string>::iterator p = m_appHistoryList.begin();
     for (; p != m_appHistoryList.end(); ++p) {
         if (app == *p) {
-            b = true; // app is exist
+            r = true; // app is exist
             break; // break of for p
         }
     }
-    if (true == b) { // application exist ?
-        addAppHistory(app);
+    if (true == r) { // application exist ?
+        r = addAppHistory(app);
+        homeSwipe();
+    }
+    ICO_TRA("end(%s %d)", r? "true": "false", (int)m_appHistoryList.size());
+    return r;
+}
+
+/**
+ * @brief is flag status check(system-controller control flag)
+ * @ret bool
+ * @retval true: flag on (flag file exist)
+ * @retval false flag off
+ */
+bool CicoHSAppHistory::isFlag()
+{
+    ICO_DBG("start");
+    struct stat stat_buf;
+    if (0 != stat(m_flagPath.c_str(), &stat_buf)) {
+        ICO_DBG("end false");
+        return false;
+    }
+    ICO_DBG("end true");
+    return true;
+}
+
+/**
+ * @brief flag off(force)
+ * @ret bool
+ * @retval true flag on -> off
+ * @retval false  flag is off
+ */
+bool CicoHSAppHistory::force_flagoff()
+{
+    ICO_DBG("start");
+    if (true == isFlag()) {
+        remove(m_flagPath.c_str());
+        ICO_DBG("end true");
+        return true;
     }
-    ICO_TRA("CicoHSAppHistory::moveHistoryHead() end");
+    ICO_DBG("end false");
+    return false;
 }
 
+/**
+ * @brief write application history
+ */
+bool CicoHSAppHistory::writeAppHistory()
+{
+    ICO_DBG("start(%d)", (int)m_appHistoryList.size());
+    if (true == m_path.empty()) {
+        ICO_DBG("end false file none");
+        return false;
+    }
+    vector<string> vs;
+    list<string>::iterator p = m_appHistoryList.begin();
+    for (; p != m_appHistoryList.end(); ++p) {
+        if (true == (*p).empty()) {
+            continue;
+        }
+        if (true == filterChk(m_filterW, (*p).c_str())) {
+            continue;   // continue of for p
+        }
+        vs.push_back(*p);
+    }
+    if (0 == vs.size()) {
+        remove(m_path.c_str());
+        ICO_DBG("end remove file");
+        return true;
+    }
+    ofstream ofs;
+    ofs.open(m_path.c_str(), ios::trunc);
+    vector<string>::iterator it = vs.begin();
+    for (; it != vs.end(); ++it) {
+        ofs << *it << endl;
+    }
+    ofs.close();
+    ICO_DBG("end write size(%d)", (int)vs.size());
+    return false;
+}
+
+/**
+ * @brief string match check
+ * @param filter string chek targets
+ * @param tgt string chek target
+ * @return bool
+ * @retval true match
+ * @retval false no match
+ */
+bool CicoHSAppHistory::filterChk(vector<string>& filter, const char* tgt) const
+{
+    ICO_DBG("start %d", filter.size());
+    bool r = false;
+    vector<string>::iterator fil = filter.begin(); // iterator set begin
+    while(fil != filter.end()) {  // loop to the last data
+        if (*fil == tgt) {
+            r = true;
+            break;  // break of while fil
+        }
+        ++fil;
+    }
+    ICO_DBG("end %s %s", tgt, r? "true": "false");
+    return r;
+}
+
+/**
+ * @brief next swipe app and appid get
+ * @ret  appid
+ * @retval empty is stopped
+ */
+const string& CicoHSAppHistory::nextSwipe()
+{
+    m_swipeStr.clear();
+    if (m_swipeCurr == m_appHistoryList.begin()) {
+        ICO_DBG("Next empty! stoped");
+        return m_swipeStr;
+    }
+    --m_swipeCurr;
+    m_swipeStr = *m_swipeCurr;
+    ICO_DBG("Next %s", m_swipeStr.c_str());
+    return m_swipeStr;
+}
+
+/**
+ * @brief Previous swipe app and appid get
+ * @ret  appid
+ * @retval empty is stopped
+ */
+const string& CicoHSAppHistory::prevSwipe()
+{
+    m_swipeStr.clear();
+    ++m_swipeCurr;
+    if (m_swipeCurr == m_appHistoryList.end()) {
+        --m_swipeCurr;
+        ICO_DBG("Prev empty! stoped");
+        return m_swipeStr;
+    }
+    m_swipeStr = *m_swipeCurr;
+    ICO_DBG("Prev %s", m_swipeStr.c_str());
+    return m_swipeStr;
+}
+
+/**
+ * @brief home position set
+ * @ret appid
+ * @retval empty is Not running application
+ */
+const string& CicoHSAppHistory::homeSwipe()
+{
+    m_swipeStr.clear();
+    m_swipeCurr = m_appHistoryList.begin();
+    if (m_appHistoryList.end() != m_swipeCurr) {
+        m_swipeStr = *m_swipeCurr;
+    }
+    return m_swipeStr;
+}
+
+/**
+ * @param get current swipe appid
+ */
+const std::string& CicoHSAppHistory::getSwipeCurrentAppid()
+{
+    m_swipeStr.clear();
+    if (m_appHistoryList.end() != m_swipeCurr) {
+        m_swipeStr = *m_swipeCurr;
+    }
+    return m_swipeStr;
+}
index 19c0ef5..2a89667 100644 (file)
 
 #include <string>
 #include <list>
+#include <vector>
+#include <utility>
 
 class CicoHSAppHistory
 {
 public:
     CicoHSAppHistory();
-    CicoHSAppHistory(const char* user, const char* path);
-    ~CicoHSAppHistory();
+    CicoHSAppHistory(const char* user, const char* path, const char* flagpath);
+    CicoHSAppHistory(const std::string& user, const std::string& path,
+                     const std::string& flagpath);
+    virtual ~CicoHSAppHistory();
 
     // get
     const std::string& getUser() const;
@@ -30,14 +34,33 @@ public:
     const std::list<std::string>& getAppHistory() const;
 
     // operate
-    void addAppHistory(const std::string& app);
-    void delAppHistory(const std::string& app);
-    void moveHistoryHead(const std::string& app);
+    virtual bool addAppHistory(const std::string& app);
+    virtual bool delAppHistory(const std::string& app);
+    virtual bool moveHistoryHead(const std::string& app);
+
+    // swipe operate
+    virtual const std::string& prevSwipe();
+    virtual const std::string& nextSwipe();
+    virtual const std::string& getSwipeCurrentAppid();
+    virtual const std::string& homeSwipe();
+
+    bool isFlag();
+    bool force_flagoff();
+    void setFilterManage(std::vector<std::string>& filter);
+    void setFilterWrite(std::vector<std::string>& filter);
+protected:
+    bool writeAppHistory();
+    bool filterChk(std::vector<std::string>& filter, const char* tgt) const;
 
 protected:
-    std::string         m_user;
-    std::string         m_path;
-    std::list<std::string>   m_appHistoryList;
+    std::string         m_user;     // login-user name
+    std::string         m_path;     // history application file path
+    std::string         m_flagPath; // flag file path
+    std::list<std::string>   m_appHistoryList;  // history application list
+    std::vector<std::string> m_filterM;   // history manage filter string
+    std::vector<std::string> m_filterW;   // history write filter string
+    std::list<std::string>::iterator m_swipeCurr;
+    std::string         m_swipeStr;
 };
 
 /**
@@ -50,7 +73,7 @@ inline const std::string& CicoHSAppHistory::getUser() const
 }
 
 /**
- * @breif get file path
+ * @brief get file path
  * @ret file path
  */
 inline const std::string& CicoHSAppHistory::getPath() const
@@ -67,5 +90,24 @@ inline const std::list<std::string>& CicoHSAppHistory::getAppHistory() const
 {
     return m_appHistoryList;
 }
-#endif // CICOHSAPPHISTORY_H
 
+/**
+ * @brief set filter manage off
+ * @param filter filter keywords
+ */
+inline void CicoHSAppHistory::setFilterManage(std::vector<std::string>& filter)
+{
+    m_filterM = filter;   // history manage filter string
+}
+
+/**
+ * @brief set filter write off
+ * @param filter filter keywords
+ */
+inline void CicoHSAppHistory::setFilterWrite(std::vector<std::string>& filter)
+{
+    m_filterW = filter;   // history write filter string
+}
+
+
+#endif // CICOHSAPPHISTORY_H
diff --git a/src/homescreen/CicoHSAppHistoryExt.cpp b/src/homescreen/CicoHSAppHistoryExt.cpp
new file mode 100644 (file)
index 0000000..bf1dc88
--- /dev/null
@@ -0,0 +1,684 @@
+/*
+ * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0.  The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+/**
+ * @brief   Homescreen application history sequence manager
+ *
+ * @date    Sep-16-2013
+ */
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <list>
+#include <vector>
+#include <utility>
+#include <cstdio>
+#include <aul/aul.h>
+#include <sys/stat.h>
+#include <Ecore.h>
+
+#include "CicoHSAppHistory.h"
+#include "CicoHSAppHistoryExt.h"
+#include "Cico_aul_listen_app.h"
+#include "CicoLog.h"
+
+using namespace std;
+
+#define DEFAULT_WAIT_TIME 5.0
+
+extern int Xaul_app_get_appid_bypid(int pid, char *appid, int len);
+
+/**
+ * @brief applications are launched. callback function
+ * @param pid
+ * @param data user data
+ * @ret   int
+ * @retval 0: success
+ * @retval not 0: fail
+ */
+static int ico_CHSAHapp_launch_handler(int pid, void *data)
+{
+    if ((NULL == data) || (0 == data)) {
+        ICO_DBG("user data is NULL");
+        return -1;
+    }
+    CicoHSAppHistoryExt *o = (CicoHSAppHistoryExt*) data;
+    char appid[255];
+    memset(appid, 0, sizeof(appid));
+    int iR = Xaul_app_get_appid_bypid(pid, appid, sizeof(appid));
+    ICO_DBG("%d=aul_app_get_appid_bypid  %d , %s", iR, pid, appid);
+    return o->appLaunch(pid, appid, iR);
+}
+
+/**
+ * @brief applications die. callback function
+ * @param pid
+ * @param data user data
+ * @ret   int
+ * @retval 0: success
+ * @retval not 0: fail
+ */
+static int ico_CHSAHapp_dead_handler(int pid, void *data)
+{
+    if ((NULL == data) || (0 == data)) {
+        ICO_DBG("user data is NULL");
+        return -1;
+    }
+    CicoHSAppHistoryExt *o = (CicoHSAppHistoryExt*) data;
+    return o->appDead(pid);
+}
+
+/**
+ * @brief aplication select determined time out
+ * @param data user data
+ * @ret Eina_Bool
+ * @retval ECORE_CALLBACK_CANCEL(EINA_FALSE) stop event handling
+ */
+static Eina_Bool ico_CHSAHE_timeout(void *data)
+{
+    CHSAHE_data_t* data_t = (CHSAHE_data_t*) data;
+    CicoHSAppHistoryExt* obj = (CicoHSAppHistoryExt*) data_t->pObj;
+    if ((NULL == obj) || (0 == obj)) {
+        ICO_DBG("INVALID PARAMETER %x, %d, %x", data_t, data_t->id, obj);
+        return ECORE_CALLBACK_CANCEL;
+    }
+    obj->determined(data_t);
+    return ECORE_CALLBACK_CANCEL;
+}
+
+/**
+ * @brief constructor
+ */
+CicoHSAppHistoryExt::CicoHSAppHistoryExt()
+    :CicoHSAppHistory()
+{
+    resetCounter();
+    setHandler();
+    setWaitTime(DEFAULT_WAIT_TIME);
+    m_lastStartupApp.clear();
+}
+
+/**
+ * @brief constructor
+ * @param user login user name
+ * @param path application list file path
+ * @param flagpath control flag file path
+ */
+CicoHSAppHistoryExt::CicoHSAppHistoryExt(const char* user, const char* path,
+                                         const char* flagpath)
+    :CicoHSAppHistory(user, path, flagpath)
+{
+    resetCounter();
+    setHandler();
+    setWaitTime(DEFAULT_WAIT_TIME);
+    m_lastStartupApp.clear();
+}
+
+/**
+ * @brief constructor
+ * @param user login user name
+ * @param path application list file path
+ * @param flagpath control flag file path
+ */
+CicoHSAppHistoryExt::CicoHSAppHistoryExt(const string& user,
+                                         const string& path,
+                                         const string& flagpath)
+    :CicoHSAppHistory(user, path, flagpath)
+{
+    resetCounter();
+    setHandler();
+    setWaitTime(DEFAULT_WAIT_TIME);
+    m_lastStartupApp.clear();
+}
+
+/**
+ * @brief destructor
+ *
+ */
+CicoHSAppHistoryExt::~CicoHSAppHistoryExt()
+{
+}
+
+/**
+ * @brief set aul launch/dead handler
+ */
+void CicoHSAppHistoryExt::setHandler()
+{
+    ICO_DBG("start");
+    aul_listen_app_launch_signal_add(ico_CHSAHapp_launch_handler, (void*)this);
+    aul_listen_app_dead_signal_add(ico_CHSAHapp_dead_handler, (void*)this);
+    ICO_DBG("end %x", this);
+}
+
+/**
+ * @brief applications are launched. callback function
+ * @param pid
+ * @param appid
+ * @ret   int
+ * @retval 0: success
+ * @retval not 0: fail
+ */
+int CicoHSAppHistoryExt::appLaunch(int pid, const char* appid, int aulstt)
+{
+    ICO_DBG("start %d, %s", pid, appid);
+    m_vppa.push_back(pairPidAppid(pid, appid));
+    m_aulstt.push_back(aulstt);
+    addAppHistory(appid);
+    ICO_DBG("end 0");
+    return 0;
+}
+
+/**
+ * @brief applications die. callback function
+ * @param pid
+ * @ret   int
+ * @retval 0: success
+ * @retval not 0: fail
+ */
+int CicoHSAppHistoryExt::appDead(int pid)
+{
+    ICO_DBG("start %d", pid);
+    bool bBINGO = false;
+    string appid;
+    vector<pairPidAppid>::iterator it = m_vppa.begin(); // iterator set begin
+    vector<int>::iterator itas = m_aulstt.begin(); // iterator set begin
+    while(it != m_vppa.end()) {  // loop to the last data
+        if ((*it).first == pid) {
+            appid = (*it).second;
+            m_vppa.erase(it);
+            m_aulstt.erase(itas);
+            bBINGO = true;
+            break;  // break of while it
+        }
+        ++it;   // next data
+        ++itas;
+    }
+    if (false == bBINGO) {
+        ICO_DBG("end not 0");
+        return -1;
+    }
+    bool bExist = false;
+    it = m_vppa.begin(); // iterator set begin
+    itas = m_aulstt.begin();
+    while(it != m_vppa.end()) {  // loop to the last data
+        update_appid((*it).first, (*it).second, *itas);
+        if ((*it).second == appid) {    // maluti running ?
+            bExist = true;   // appid exist
+            ICO_DBG("exist %s is %d", appid.c_str(), (*it).first);
+            break;  // break of while it
+        }
+        ++it;   // next data
+        ++itas;   // next data
+    }
+
+    vector<pairBoolPidAppid>::iterator itvpbpa = m_vpbpa.begin();
+    while (itvpbpa != m_vpbpa.end()) {
+        if ((*itvpbpa).second.first == pid) {
+            m_vpbpa.erase(itvpbpa);
+            break;
+        }
+        ++itvpbpa;
+    }
+
+    if (true == bExist) {
+        ICO_DBG("end 0");
+        return 0;
+    }
+
+    delAppHistory(appid);
+    ICO_DBG("end 0");
+    return 0;
+}
+
+/**
+ * @brief pid to appid convert
+ * @param pid
+ * @param appid
+ * @ret bool
+ * @retval true convert success
+ * @retval false convert fail
+ */
+bool CicoHSAppHistoryExt::getAppid(int pid, string& appid)
+{
+    bool r = false;
+    vector<pairPidAppid>::iterator it = m_vppa.begin(); // iterator set begin
+    vector<int>::iterator itas = m_aulstt.begin(); // iterator set begin
+    while(it != m_vppa.end()) {  // loop to the last data
+        update_appid((*it).first, (*it).second, *itas);
+        if ((*it).first == pid) {
+            appid = (*it).second;
+            r = true;
+            ICO_DBG("pid to appid %d %s", pid, appid.c_str());
+            break;  // break of while it
+        }
+        ++it;   // next data
+        ++itas;
+    }
+    ICO_DBG("CHSAHgetAppid %s", r? "true": "false");
+    return r;
+}
+
+/**
+ * @brief select app
+ * @param pid
+ */
+void CicoHSAppHistoryExt::selectApp(int pid)
+{
+    string appid;
+    if (false == getAppid(pid, appid)) {
+        ICO_DBG("NG pis(%d)", pid);
+        return;
+    }
+    selectApp(appid);
+}
+
+/**
+ * @brief select app
+ * @param appid
+ */
+void CicoHSAppHistoryExt::selectApp(const string& appid)
+{
+    if (false == appid.empty()) {
+        selectApp(appid.c_str());
+    }
+}
+
+/**
+ * @brief select app
+ * @param appid
+ */
+void CicoHSAppHistoryExt::selectApp(const char* appid)
+{
+    CHSAHE_data_t* data = new CHSAHE_data_t;
+    data->id = nextCounter();
+    data->pObj = this;
+    ICO_DBG("timer set(%x) %s, %d", data, appid, data->id);
+    ecore_timer_add(m_waitTimer, ico_CHSAHE_timeout, data);
+    m_lCdt.push_back(data);
+    m_currentAppid = appid;
+}
+
+/**
+ * @brief determined applicationselect
+ * @param data is id value and delete(free) target
+ */
+void CicoHSAppHistoryExt::determined(CHSAHE_data_t* data)
+{
+    ICO_DBG("start %x.id(%d)", data, data->id);
+    int id = data->id;       // counter id get
+    int sz1 = m_lCdt.size(); // size get
+    m_lCdt.remove(data);     // delete request
+    if ((int)m_lCdt.size() != sz1) { // is size change
+        ICO_DBG("free %x", data);
+        delete data;        // area free
+    }
+    if (true == m_currentAppid.empty()) {
+        ICO_DBG("end appid lost");
+        return;
+    }
+    if (id == getCounter()) {
+        ICO_DBG("Match id");
+        moveHistoryHead(m_currentAppid);
+        m_currentAppid.clear();
+    }
+    ICO_DBG("end");
+}
+
+/**
+ * @brief active app receve event
+ * @param pid
+ */
+void CicoHSAppHistoryExt::activeApp(int pid)
+{
+    string appid;
+    if (false == getAppid(pid, appid)) {
+        ICO_DBG("NG pid(%d)", pid);
+        return;
+    }
+    activeApp(appid);
+}
+
+/**
+ * @brief active app receve event
+ * @param appid
+ */
+void CicoHSAppHistoryExt::activeApp(const string& appid)
+{
+    if (false == appid.empty()) {
+        activeApp(appid.c_str());
+    }
+}
+
+/**
+ * @brief active app receve event
+ * @param appid
+ */
+void CicoHSAppHistoryExt::activeApp(const char* appid)
+{
+    ICO_DBG("start %s", appid);
+    if (true == m_currentAppid.empty()) {
+#if 1
+        moveHistoryHead(appid);
+#endif
+        ICO_DBG("end current none");
+        return;
+    }
+    if (m_currentAppid == appid) { // touch operate app
+        moveHistoryHead(m_currentAppid);
+        m_currentAppid.clear();
+        ICO_DBG("end touch operate app");
+        return;
+    }
+    ICO_DBG("end  no match curr(%s)", m_currentAppid.c_str());
+#if 1
+    moveHistoryHead(appid);
+#endif
+#if 1
+    m_currentAppid.clear();
+#endif
+    return;
+}
+
+bool CicoHSAppHistoryExt::chgChk()
+{
+    string tmp(m_bkTmp);
+    m_bkTmp.clear();
+    int i = 0;
+    list<string>::iterator p = m_appHistoryList.begin();
+    while (p != m_appHistoryList.end()) {
+        if (i != 0) {
+            m_bkTmp += ',';
+        }
+        m_bkTmp += *p;
+        i++;
+        ++p;
+    }
+    if (tmp == m_bkTmp) {
+        ICO_DBG("false, %s", m_bkTmp.c_str());
+        return false;
+    }
+    ICO_DBG("true, %d %d", m_bkTmp.size(), tmp.size());
+    return true;
+}
+bool CicoHSAppHistoryExt::addAppHistory(const string& app)
+{
+    bool r;
+    r = CicoHSAppHistory::addAppHistory(app);
+    if (true == chgChk()) {
+        writeAppHistory();
+    }
+    return r;
+}
+bool CicoHSAppHistoryExt::delAppHistory(const string& app)
+{
+    bool r;
+    r = CicoHSAppHistory::delAppHistory(app);
+    if (true == chgChk()) {
+        writeAppHistory();
+    }
+    return r;
+}
+/**
+ * @brief move history
+ * @param appid
+ */
+bool CicoHSAppHistoryExt::moveHistoryHead(const string& app)
+{
+    bool r;
+    r = CicoHSAppHistory::moveHistoryHead(app);
+    if (true == chgChk()) {
+        writeAppHistory();
+    }
+    return r;
+}
+
+/**
+ * @breief update appid 
+ * @param pid
+ * @param appid  update appid store string
+ * @param aulstt value is AUL_R_OK then no update
+ *               value is no AUL_R_OK then update
+ *               rerurn value is AUL_R_OK(success) / not AUL_R_OK(fail)
+ */
+void CicoHSAppHistoryExt::update_appid(int pid, string& appid, int& aulstt)
+{
+    if (AUL_R_OK == aulstt) {
+        return;
+    }
+    ICO_TRA("update start %d", aulstt);
+    char buf[255];
+    buf[0] = '\0'; // STOP CODE
+    aulstt = aul_app_get_appid_bypid(pid, buf, sizeof(buf));
+    if (AUL_R_OK == aulstt) {
+        ICO_DBG("update appid %s -> %s", appid.c_str(), buf);
+        appid = buf;
+    }
+    ICO_TRA("update end %d", aulstt);
+    return;
+}
+
+/**
+ * @brief next swipe app and appid get
+ * @ret  appid
+ * @retval empty is stopped
+ */
+const string& CicoHSAppHistoryExt::nextSwipe()
+{
+    m_swipeStr.clear();
+    if (false == m_lastStartupApp.empty()) {
+        ICO_DBG("Next empty! stoped");
+        return m_swipeStr;
+    }
+    if (m_swipeCurr == m_appHistoryList.begin()) {
+        ICO_DBG("Next empty! stoped");
+        return m_swipeStr;
+    }
+    --m_swipeCurr;
+    m_swipeStr = *m_swipeCurr;
+    if (true == update_pairPidAppid(m_swipeStr)) {
+        *m_swipeCurr = m_swipeStr;
+    }
+    ICO_DBG("Next %s", m_swipeStr.c_str());
+    return m_swipeStr;
+}
+
+/**
+ * @brief Previous swipe app and appid get
+ * @ret  appid
+ * @retval empty is stopped
+ */
+const string& CicoHSAppHistoryExt::prevSwipe()
+{
+    m_swipeStr.clear();
+    if (false == m_lastStartupApp.empty()) {
+        ICO_DBG("Next empty! stoped");
+        return m_swipeStr;
+    }
+    ++m_swipeCurr;
+    if (m_swipeCurr == m_appHistoryList.end()) {
+        --m_swipeCurr;
+        ICO_DBG("Prev empty! stoped");
+        return m_swipeStr;
+    }
+    m_swipeStr = *m_swipeCurr;
+    if (true == update_pairPidAppid(m_swipeStr)) {
+        *m_swipeCurr = m_swipeStr;
+    }
+    ICO_DBG("Prev %s", m_swipeStr.c_str());
+    return m_swipeStr;
+}
+
+/**
+ * @brief home position set
+ * @ret appid
+ * @retval empty is Not running application
+ */
+const string& CicoHSAppHistoryExt::homeSwipe()
+{
+    m_swipeStr.clear();
+    m_swipeCurr = m_appHistoryList.begin();
+    if (m_appHistoryList.end() != m_swipeCurr) {
+        m_swipeStr = *m_swipeCurr;
+        if (true == update_pairPidAppid(m_swipeStr)) {
+            *m_swipeCurr = m_swipeStr;
+        }
+    }
+    return m_swipeStr;
+}
+
+/**
+ * @brief get swipe current appid
+ * @ret appid
+ */
+const string& CicoHSAppHistoryExt::getSwipeCurrentAppid()
+{
+    m_swipeStr.clear();
+    if (m_appHistoryList.end() != m_swipeCurr) {
+        m_swipeStr = *m_swipeCurr;
+        if (true == update_pairPidAppid(m_swipeStr)) {
+            *m_swipeCurr = m_swipeStr;
+        }
+    }
+    ICO_DBG("current %s", m_swipeStr.c_str());
+    return m_swipeStr;
+}
+
+/**
+ * @breif update appid by vector<pairPidAppid>
+ * @param appid target appid and update appide store
+ * @ret bool
+ * @retval true update appid
+ * @retval false no update
+ */
+bool CicoHSAppHistoryExt::update_pairPidAppid(string& appid)
+{
+    ICO_DBG("start(%s)", appid.c_str());
+    bool r = false; // return value is no update
+    vector<pairPidAppid>::iterator itV = m_vppa.begin();
+    vector<int>::iterator itAS = m_aulstt.begin();
+    while (itV != m_vppa.end()) {
+        if (AUL_R_OK != *itAS) {
+            if (0 == appid.compare((*itV).second)) {
+                update_appid((*itV).first, (*itV).second, *itAS);
+                if (AUL_R_OK == *itAS) {
+                    appid = (*itV).second; // get update appid
+                    r = true;  // return value is update
+                }
+                break;
+            }
+        }
+        ++itV;
+        ++itAS;
+    }
+    ICO_DBG("end(%s)", appid.c_str());
+    return r;
+}
+
+/**
+ * @brief update appid all
+ */
+void CicoHSAppHistoryExt::update_appid()
+{
+    ICO_DBG("start");
+#if 0
+    list<string>::iterator his_appid = m_appHistoryList.begin();
+    while (his_appid != m_appHistoryList.end()) {
+        string appid = *his_appid;
+        if (true == update_pairPidAppid(appid)) {
+            *his_appid = appid;
+        }
+        ++his_appid;
+    }
+#else
+    vector<pairPidAppid>::iterator itV = m_vppa.begin();
+    vector<int>::iterator itAS = m_aulstt.begin();
+    while (itV != m_vppa.end()) {
+        if (AUL_R_OK != *itAS) {
+            string appid_o;
+            update_appid((*itV).first, (*itV).second, *itAS);
+            if (AUL_R_OK == *itAS) {
+                list<string>::iterator it_h = m_appHistoryList.begin();
+                while (it_h != m_appHistoryList.end()) {
+                    if (0 ==appid_o.compare(*it_h)) {
+                        *it_h = (*itV).second;
+                    }
+                    ++it_h;
+                }
+            }
+        }
+        ++itV;
+        ++itAS;
+    }
+#endif
+    ICO_DBG("end");
+}
+
+/**
+ * @brief start check item add
+ * @param pid
+ * @param appid
+ * @param display posi
+ */
+void CicoHSAppHistoryExt::startupCheckAdd(int pid, const std::string& appid,
+                                          bool d)
+{
+    ICO_DBG("add pid=%d, appid=%s", pid, appid.c_str());
+    m_vpbpa.push_back(pairBoolPidAppid(false, pairPidAppid(pid, appid)));
+    if (false == d) {
+       m_lastStartupApp = appid;
+    } 
+}
+
+/**
+ * @brief start-up Entry Finish
+ * @param pid
+ */
+void CicoHSAppHistoryExt::startupEntryFinish(int pid)
+{
+    vector<pairBoolPidAppid>::iterator it = m_vpbpa.begin();
+    while (it != m_vpbpa.end()) {
+        if ((*it).second.first == pid) {
+            ICO_DBG("FINISH!! %d, %s", (*it).second.first,
+                    (*it).second.second.c_str());
+            (*it).first = true;
+            break;  // break of while
+        }
+        it++;
+    }
+}
+
+/**
+ * @brief is finish start-up check
+ * @ret bool
+ * @retval true finish
+ * @retval false start-up continue
+ */
+bool CicoHSAppHistoryExt::isFinish()
+{
+    bool bR = true;
+    vector<pairBoolPidAppid>::iterator it = m_vpbpa.begin();
+    while (it != m_vpbpa.end()) {
+        if (false == (*it).first) {
+            bR = false;
+            break; // brek of while
+        }
+        it++;
+    }
+    ICO_DBG("%s", bR? "true": "false");
+    return bR;
+}
+
+/**
+ * @brief stop startup check
+ */
+void CicoHSAppHistoryExt::stopStartupCheck()
+{
+    ICO_DBG("stop");
+    m_vpbpa.clear();
+    m_lastStartupApp.clear();
+}
diff --git a/src/homescreen/CicoHSAppHistoryExt.h b/src/homescreen/CicoHSAppHistoryExt.h
new file mode 100644 (file)
index 0000000..f3f297f
--- /dev/null
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0.  The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+/**
+ * @brief   Homescreen application history sequence manager
+ *
+ * @date    Sep-16-2013
+ */
+#ifndef CICOHSAPPHISTORYEXT_H
+#define CICOHSAPPHISTORYEXT_H
+
+#include <string>
+#include <vector>
+#include <list>
+#include <utility>
+#include "CicoHSAppHistory.h"
+
+/**
+ * ecore timer void data typedef
+ */
+typedef struct t_CHSAHE_data {
+    int   id;
+    void* pObj;
+} CHSAHE_data_t;
+
+/**
+ * pid appid convert data item
+ */
+typedef std::pair<int, std::string> pairPidAppid;
+
+/**
+ * order of the start-up window
+ */
+typedef std::pair<bool, pairPidAppid> pairBoolPidAppid;
+
+class CicoHSAppHistoryExt :public CicoHSAppHistory
+{
+public:
+    CicoHSAppHistoryExt();
+    CicoHSAppHistoryExt(const char* user, const char* path, const char* flagpath);
+    CicoHSAppHistoryExt(const std::string& user, const std::string& path,
+                        const std::string& flagpath);
+    virtual ~CicoHSAppHistoryExt();
+    void setWaitTime(double msec);
+
+    // operate
+    virtual bool addAppHistory(const std::string& app);
+    virtual bool delAppHistory(const std::string& app);
+    virtual bool moveHistoryHead(const std::string& app);
+
+    // AUL I/F
+    int appLaunch(int pid, const char* appid, int aulstt);
+    int appDead(int pid);
+
+    // pid to appid converter
+    bool getAppid(int pid, std::string& appid);
+
+    // flick operation I/F
+    void selectApp(int pid);
+    void selectApp(const std::string& appid);
+    void selectApp(const char* appid);
+
+    // time out selected app
+    void determined(CHSAHE_data_t* data);
+
+    // touch operation I/F
+    void activeApp(int pid);
+    void activeApp(const std::string& appid);
+    void activeApp(const char* appid);
+
+    // swipe operate
+    const std::string& prevSwipe();
+    const std::string& nextSwipe();
+    const std::string& getSwipeCurrentAppid();
+    const std::string& homeSwipe();
+
+    void update_appid(int pid, std::string& appid, int& aulstt);
+    bool update_pairPidAppid(std::string& appid);
+    void update_appid();
+
+    // order of the start-up window
+    void startupCheckAdd(int pid, const std::string& appid, bool d = false);
+    bool isStartupChecking() const;
+    void startupEntryFinish(int pid);
+    bool isFinish();
+    void stopStartupCheck();
+    const std::string& lastStartupApp() const;
+
+protected:
+    enum {
+        COUNTER_START = 1,
+        COUNTER_MAX = 30000
+    };
+    virtual void setHandler();
+    int resetCounter();
+    int getCounter();
+    int nextCounter();
+    bool chgChk();
+
+protected:
+    std::vector<pairPidAppid> m_vppa;
+    std::vector<int> m_aulstt;
+    int   m_cnt;
+    std::string m_currentAppid;
+    std::list<CHSAHE_data_t*> m_lCdt;
+    double   m_waitTimer;    // ex.) 1sec = 1.0
+    std::string m_bkTmp;
+    std::vector<pairBoolPidAppid> m_vpbpa;
+    std::string m_lastStartupApp;
+};
+
+/**
+ * @brief counter reset
+ * @ret reset counter value
+ */
+inline int CicoHSAppHistoryExt::resetCounter()
+{
+    m_cnt = COUNTER_START;
+    return m_cnt;
+}
+
+/**
+ * @brief get counter value
+ * @ret  counter value
+ */
+inline int CicoHSAppHistoryExt::getCounter()
+{
+    return m_cnt;
+}
+
+/**
+ * @brief next counter value
+ * @ret next counter value
+ */
+inline int CicoHSAppHistoryExt::nextCounter()
+{
+    m_cnt++;
+    if (COUNTER_MAX < m_cnt) {
+        resetCounter();
+    }
+    return m_cnt;
+}
+
+/**
+ * @brief set wait timer val
+ * @param sec wait time ex.) 1.0 == 1sec
+ */
+inline void CicoHSAppHistoryExt::setWaitTime(double sec)
+{
+    m_waitTimer = sec;
+}
+
+/**
+ * @brief get start-up checking state
+ * @ret  bool
+ * @retval true cheking
+ * @retval false no checking
+ */
+inline bool CicoHSAppHistoryExt::isStartupChecking() const
+{
+    if (0 == m_vpbpa.size()) {
+        return  false;
+    }
+    return true;
+}
+
+
+
+inline const std::string& CicoHSAppHistoryExt::lastStartupApp() const
+{
+    return m_lastStartupApp;
+}
+
+#endif // CICOHSAPPHISTORYEXT_H
+
index d07c145..036f8f5 100644 (file)
  * http://www.apache.org/licenses/LICENSE-2.0
  *
  */
+
+//==========================================================================
 /**
- * @brief   Application info
+ *  @file   CicoHSAppInfo
  *
- * @date    Aug-08-2013
+ *  @brief  This file is implimention of CicoHSAppInfo class
  */
-#include "CicoHSAppInfo.h"
+//==========================================================================
 
+#include "CicoHSAppInfo.h"
+#include "CicoSCSystemConfig.h"
+#include "CicoSCConf.h"
 
-/*============================================================================*/
-/* functions                                                                  */
-/*============================================================================*/
-/*--------------------------------------------------------------------------*/
+//==========================================================================
+//  public functions
+//==========================================================================
+//--------------------------------------------------------------------------
 /**
- * @brief   CicoHSAppInfo::CicoHSAppInfo
- *          Constractor
+ *  @brief  constractor
  *
- * @param[in]   appid    application id
- * @return      none
+ *  @param [in] appid   application id
  */
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
 CicoHSAppInfo::CicoHSAppInfo(const char *appid)
+    : m_appid(appid), m_category(0), m_window_num(0), m_last_surface(0)
 {
-    for(int ii = 0;ii < ICO_HS_APP_MAX_WINDOW_NUM;ii++){
-        window_info_i[ii].valid = false;
-    }
-
-    window_num = 0;
-    last_surface = 0;
-    if(appid == NULL){
-        return;
-    } 
-    strncpy(this->appid,appid,ICO_HS_MAX_PROCESS_NAME);
-
-    life_cycle_controller = CicoSCLifeCycleController::getInstance();
+    memset(m_window_info_i, 0, sizeof(m_window_info_i));
+    m_life_cycle_controller = CicoSCLifeCycleController::getInstance();
 }
 
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
 /**
- * @brief   CicoHSAppInfo::~CicoHSAppInfo
- *          Destractor
- *
- * @param[in]   none
- * @return      none
+ *  @brief   destractor
  */
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
 CicoHSAppInfo::~CicoHSAppInfo(void)
 {
-
 }
 
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
 /**
- * @brief   CicoHSAppInfo::GetAppId
- *          get application id
+ *  @brief  set window information
  *
- * @param[in]   none
- * @return      application id
+ *  @param [in] wininfo     window information
+ *  @return OK or ERROR
  */
-/*--------------------------------------------------------------------------*/
-char*
-CicoHSAppInfo::GetAppId(void)
+//--------------------------------------------------------------------------
+int
+CicoHSAppInfo::AddWindowInfo(ico_syc_win_info_t *wininfo)
 {
-    return appid;
-}
 
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   CicoHSAppInfo::SetWindowInfo
- *          set window information
- *
- * @param[in]   idx              index
- * @param[in]   window info      window information
- * @return      void
- */
-/*--------------------------------------------------------------------------*/
-void 
-CicoHSAppInfo::SetWindowInfo(ico_hs_window_info *hs_window_info,ico_syc_win_info_t *window_info)
-{
-    hs_window_info->showed = false;
-    if(window_info->appid != NULL){
-        strncpy(hs_window_info->appid,window_info->appid,
-                ICO_HS_MAX_PROCESS_NAME);
-    }
-    if(window_info->name != NULL){
-        strncpy(hs_window_info->name,window_info->name,
-                ICO_HS_MAX_WINDOW_NAME);
+    if (NULL == wininfo) {
+        ICO_ERR("wininfo is null.");
+        return ICO_ERROR;
     }
-    hs_window_info->surface = window_info->surface;
-}
 
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   CicoHSAppInfo::GetFreeWindowInfoBuffer
- *          get internal window info buffer
- *
- * @param[in]   none
- * @return      buffer
- */
-/*--------------------------------------------------------------------------*/
-ico_hs_window_info *
-CicoHSAppInfo::GetFreeWindowInfoBuffer(void)
-{
-    ico_hs_window_info *tmp_win_info;
-    for(int ii = 0;ii < ICO_HS_APP_MAX_WINDOW_NUM;ii++){
-        if(window_info_i[ii].valid == false){
-           tmp_win_info = &window_info_i[ii];
-           tmp_win_info->valid = true;
-           return tmp_win_info;
-        }
-    }
-    return NULL;
-}
+    ICO_TRA("CicoHSAppInfo::AddWindowInfo Enter(appid=%s surface=%d",
+            wininfo->appid, wininfo->surface);
 
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   CicoHSAppInfo::FreeWindowInfoBuffer
- *          get internal window info buffer
- *
- * @param[in]   name          window name
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-void
-CicoHSAppInfo::FreeWindowInfo(const char *name)
-{
-    for(std::vector<ico_hs_window_info*>::iterator it_window_info = 
-                 window_info.begin();
-        it_window_info != window_info.end();
-        it_window_info++){
-        if((strncmp(name,(*it_window_info)->name,
-            ICO_HS_MAX_WINDOW_NAME) == 0)){
-            (*it_window_info)->valid = false;
-            window_info.erase(it_window_info);
-            --window_num;
-            break;
+    // if exist window information, update current window information
+    std::vector<ico_hs_window_info*>::iterator itr;
+    itr = this->m_window_info.begin();
+    for (; itr != this->m_window_info.end(); ++itr) {
+        if (wininfo->surface == (*itr)->surface) {
+            /*update*/
+            SetWindowInfo(*itr, wininfo);
+            ICO_TRA("CicoHSAppInfo::AddWindowInfo Leave(OK)");
+            return ICO_OK;
         }
     }
-}
 
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   CicoHSAppInfo::SetWindowAttr
- *          set window attribute
- *
- * @param[in]   idx              index
- * @param[in]   window_attr      window attribute
- * @return      void
- */
-/*--------------------------------------------------------------------------*/
-void 
-CicoHSAppInfo::SetWindowAttr(ico_hs_window_info *hs_window_info,ico_syc_win_attr_t *window_attr)
-{
-    if(window_attr->appid != NULL){
-        strncpy(hs_window_info->appid,window_attr->appid,
-                ICO_HS_MAX_PROCESS_NAME);
-    }
-    if(window_attr->name != NULL){ 
-        strncpy(hs_window_info->name,window_attr->name,
-                ICO_HS_MAX_WINDOW_NAME);
-    }
-    hs_window_info->surface = window_attr->surface;
-    hs_window_info->nodeid = window_attr->nodeid;
-    hs_window_info->layer = window_attr->layer;
-    hs_window_info->pos_x = window_attr->pos_x;
-    hs_window_info->pos_y = window_attr->pos_y;
-    hs_window_info->width = window_attr->width;
-    hs_window_info->height = window_attr->height;
-    hs_window_info->raise = window_attr->raise;
-    hs_window_info->visible = window_attr->visible;
-    hs_window_info->active = window_attr->active;
+    // if not exit window information, create window information
+    ico_hs_window_info *tmp_win_info = GetFreeWindowInfoBuffer();
+    if (tmp_win_info == NULL) {
+        ICO_ERR("CicoHSAppInfo::AddWindowInfo Leave(ERR)");
+        return ICO_ERROR;
+    }   
+    SetWindowInfo(tmp_win_info, wininfo);
+    this->m_window_info.push_back(tmp_win_info);
+    ++m_window_num;
 
+    ICO_TRA("CicoHSAppInfo::AddWindowInfo Leave(OK)");
+    return ICO_OK;
 }
 
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
 /**
- * @brief   CicoHSAppInfo::SetWindowAttr
- *          set window attribute
+ *  @brief   set window attribute
  *
- * @param[in]   window_attr      window information
- * @return      OK or ERROR
+ *  @param [in]   winattr   window attribute
+ *  @return OK or ERROR
  */
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
 int
-CicoHSAppInfo::AddWindowAttr(ico_syc_win_attr_t *window_attr)
+CicoHSAppInfo::AddWindowAttr(ico_syc_win_attr_t *winattr)
 {
-    for(std::vector<ico_hs_window_info*>::iterator it_window_info = 
-                 window_info.begin();
-        it_window_info != window_info.end();
-        it_window_info++){
-        if((strncmp(window_attr->name,(*it_window_info)->name,
-            ICO_HS_MAX_WINDOW_NAME) == 0)){
+    if (NULL == winattr) {
+        ICO_ERR("winattr is null.");
+        return ICO_ERROR;
+    }
+
+    ICO_TRA("CicoHSAppInfo::AddWindowAttr Enter(appid=%s surface=%d",
+            winattr->appid, winattr->surface);
+
+    // if exist window information, update current window information
+    std::vector<ico_hs_window_info*>::iterator itr;
+    itr = m_window_info.begin();
+    for (; itr != m_window_info.end(); itr++){
+        if (winattr->surface == (*itr)->surface) {
             /*update*/
-            SetWindowAttr(*it_window_info,window_attr);
+            SetWindowAttr(*itr, winattr);
+            ICO_TRA("CicoHSAppInfo::AddWindowAttr Leave(OK)");
             return ICO_OK;
         }
     }
 
+    // if not exit window information, create window information
     ico_hs_window_info *tmp_win_info = GetFreeWindowInfoBuffer();
-    if(tmp_win_info == NULL){
+    if (tmp_win_info == NULL){
+        ICO_TRA("CicoHSAppInfo::AddWindowAttr Leave(ERR)");
         return ICO_ERROR;
     }   
  
-    SetWindowAttr(tmp_win_info,window_attr);
-    window_info.push_back(tmp_win_info);
-    ++window_num;
+    SetWindowAttr(tmp_win_info, winattr);
+    m_window_info.push_back(tmp_win_info);
+    ++m_window_num;
   
+    ICO_TRA("CicoHSAppInfo::AddWindowAttr Leave(OK)");
     return ICO_OK;
 }
 
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
 /**
- * @brief   CicoHSAppInfo::SetWindowInfo
- *          set window information
+ *  @brief  free window information
  *
- * @param[in]   window info      window information
- * @return      OK or ERROR
+ *  @param [in] name    window name
  */
-/*--------------------------------------------------------------------------*/
-int
-CicoHSAppInfo::AddWindowInfo(ico_syc_win_info_t *window_info)
+//--------------------------------------------------------------------------
+void
+CicoHSAppInfo::FreeWindowInfo(const char *name)
 {
-    for(std::vector<ico_hs_window_info*>::iterator it_window_info 
-                 = this->window_info.begin();
-        it_window_info != this->window_info.end();
-        it_window_info++){
-        if((strncmp(window_info->name,(*it_window_info)->name,
-            ICO_HS_MAX_WINDOW_NAME) == 0)){
-            /*update*/
-            SetWindowInfo(*it_window_info,window_info);
-            return ICO_OK;
+    std::vector<ico_hs_window_info*>::iterator itr;
+    itr = m_window_info.begin();
+    for (; itr != m_window_info.end(); ++itr) {
+        if (0 == strncmp(name,(*itr)->name, ICO_HS_MAX_WINDOW_NAME)) {
+            (*itr)->valid = false;
+            m_window_info.erase(itr);
+            --m_window_num;
+            break;
         }
     }
-    
-    ico_hs_window_info *tmp_win_info = GetFreeWindowInfoBuffer();
-    if(tmp_win_info == NULL){
-        return ICO_ERROR;
-    }   
-    SetWindowInfo(tmp_win_info,window_info);
-    this->window_info.push_back(tmp_win_info);
-    ++window_num;
+}
 
-    return ICO_OK;
+//--------------------------------------------------------------------------
+/**
+ *  @brief  get application id
+ *
+ *  @return application id
+ */
+//--------------------------------------------------------------------------
+const char*
+CicoHSAppInfo::GetAppId(void)
+{
+    return m_appid.c_str();
 }
 
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
 /**
- * @brief   CicoHSAppInfo::GetWindowNum
- *          get number of window 
+ *  @brief  get number of window 
  *
- * @param[in]   none
- * @return      window num
+ *  @return number of window
  */
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
 int 
 CicoHSAppInfo::GetWindowNum(void)
 {
-    return window_num;
+    return m_window_num;
 }
 
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
 /**
- * @brief   CicoHSAppInfo::GetWindowInfo
- *          get window information 
+ *  @brief  get window information 
  *
- * @param[in]   idx index
- * @return      window information
+ *  @param[in]   name   window name
+ *  @return window information
  */
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
 ico_hs_window_info*
 CicoHSAppInfo::GetWindowInfo(const char* name)
 {
-    for(std::vector<ico_hs_window_info*>::iterator it_window_info 
-                = window_info.begin();
-        it_window_info != window_info.end();
-        it_window_info++){
-        if((strncmp(name,(*it_window_info)->name,ICO_HS_MAX_WINDOW_NAME) == 0)){
-            return *it_window_info;
+    std::vector<ico_hs_window_info*>::iterator itr;
+    itr = m_window_info.begin();
+    for (; itr != m_window_info.end(); ++itr) {
+        if(0 == strncmp(name,(*itr)->name, ICO_HS_MAX_WINDOW_NAME)) {
+            return *itr;
         }
     }
-    return NULL;  
+    return NULL;
 }
 
 /*--------------------------------------------------------------------------*/
 /**
- * @brief   CicoHSAppInfo::SetShowed
- *          set showing status;          
+ * @brief   CicoHSAppInfo::GetWindowInfo
+ *          get window information
  *
- * @param[in]   showed     showing status 
- * @return      none
+ * @param[in]   idx index(0-n)
+ * @return      window information
  */
 /*--------------------------------------------------------------------------*/
-void
-CicoHSAppInfo::SetShowed(ico_hs_window_info *info,bool showed)
+ico_hs_window_info*
+CicoHSAppInfo::GetWindowInfo(int idx)
 {
-    info->showed = showed;
+    int     i = 0;
+
+    for (std::vector<ico_hs_window_info*>::iterator it_window_info
+                = m_window_info.begin();
+        it_window_info != m_window_info.end();
+        it_window_info++){
+        if (i >= idx)   {
+            return *it_window_info;
+        }
+        i ++;
+    }
+    return NULL;
 }
 
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
 /**
- * @brief   CicoHSAppInfo::GetShowed
- *          get showing status;          
+ *  @brief  get window information 
  *
- * @param[in]    none
- * @return      showing status 
+ *  @param[in]   surface    surface id
+ *  @return window information
  */
-/*--------------------------------------------------------------------------*/
-bool
-CicoHSAppInfo::GetShowed(ico_hs_window_info *info)
+//--------------------------------------------------------------------------
+ico_hs_window_info*
+CicoHSAppInfo::GetWindowInfobySurface(int surface)
 {
-    return info->showed;
+    std::vector<ico_hs_window_info*>::iterator itr;
+    itr = m_window_info.begin();
+    for (; itr != m_window_info.end(); ++itr) {
+        if ((*itr)->surface == surface) {
+            return *itr;
+        }
+    }
+    return NULL;  
 }
-/*--------------------------------------------------------------------------*/
+
+//--------------------------------------------------------------------------
 /**
- * @brief   CicoHSAppInfo::Execute
- *          execute application 
+ *  @brief   launch application 
  *
- * @param[in]   none
- * @return      none
+ *  @return 0 on success, other on error
  */
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
 int
 CicoHSAppInfo::Execute(void)
 {
-    /*call execute api*/
-    int ret = life_cycle_controller->launch(appid);    
+    // call launch api
+    int ret = m_life_cycle_controller->launch(m_appid);    
     if(ret < 0){
         return ret;
     }
-  
+
     return ret;
 }
 
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
 /*
- * @brief   CicoHSAppInfo::Terminate
- *          terminate application 
+ *  @brief  terminate application 
  *
- * @param[in]   none
- * @return      none
+ *  @return 0 on success, other on error
  */
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
 int
 CicoHSAppInfo::Terminate(void)
 {
-    /*call Terminate api*/
-    int ret = life_cycle_controller->terminate(appid);    
+    // call terminate api
+    int ret = m_life_cycle_controller->terminate(m_appid);    
     if(ret < 0){
         return ret;
     }
@@ -359,31 +291,180 @@ CicoHSAppInfo::Terminate(void)
    return ret;
 }
 
-
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
 /**
- * @brief   CicoHSAppInfo::GetStatus
- *          get status 
+ *  @brief  get status 
  *
- * @param[in]   none
- * @return      status
+ *  @return application running status
+ *  @retval true    running
+ *  @retval false   not running
  */
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
 bool 
 CicoHSAppInfo::GetStatus(void)
 {
-    return life_cycle_controller->isRunning(appid);
+    return m_life_cycle_controller->isRunning(m_appid);
 }
 
-
+//--------------------------------------------------------------------------
+/**
+ *  @brief  set last surface id
+ *
+ *  @param [in] last surface id
+ */
+//--------------------------------------------------------------------------
 void 
 CicoHSAppInfo::SetLastSurface(int last_surface)
 {
-    this->last_surface = last_surface;
+    m_last_surface = last_surface;
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  get last surface id
+ *
+ *  @return surface id
+ */
+//--------------------------------------------------------------------------
 int 
 CicoHSAppInfo::GetLastSurface(void)
 {
-    return last_surface;
+    return m_last_surface;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  get default zone name
+ *
+ *  @return zone name
+ */
+//--------------------------------------------------------------------------
+const char *
+CicoHSAppInfo::GetDefaultZone(void)
+{
+    m_life_cycle_controller = CicoSCLifeCycleController::getInstance();
+    const CicoSCAilItems* ailItem = m_life_cycle_controller->findAIL(m_appid);
+
+    CicoSCSystemConfig *sysConf = CicoSCSystemConfig::getInstance();
+    const CicoSCDisplayZoneConf *zoneConf = NULL;
+    if (NULL != ailItem) {
+        zoneConf = sysConf->findDisplayZoneConfbyId(ailItem->m_displayZone);
+    }
+    else {
+        const CicoSCDefaultConf* defConf = sysConf->getDefaultConf();
+        zoneConf = sysConf->findDisplayZoneConfbyId(defConf->displayzone);
+    }
+        
+    if (NULL == zoneConf) {
+        return NULL;
+    }
+
+    return zoneConf->fullname.c_str();
+}
+
+//==========================================================================
+//  private method
+//==========================================================================
+//--------------------------------------------------------------------------
+/**
+ *  @brief   set window information
+ *
+ *  @param [in] hs_wininfo  window information
+ *  @param [in] wininfo     window information from system-controller
+ */
+//--------------------------------------------------------------------------
+void 
+CicoHSAppInfo::SetWindowInfo(ico_hs_window_info *hs_wininfo,
+                             ico_syc_win_info_t *wininfo)
+{
+    ICO_TRA("CicoHSAppInfo::SetWindowInfo Enter"
+            "(winifo=%p appid=%s winname=%s surface=%d)",
+            hs_wininfo,
+            wininfo->appid, wininfo->name, wininfo->surface);
+
+    // set application id
+    if(wininfo->appid != NULL){
+        strncpy(hs_wininfo->appid, wininfo->appid, ICO_HS_MAX_PROCESS_NAME);
+    }
+
+    // set window name(window title)
+    if(wininfo->name != NULL){
+        strncpy(hs_wininfo->name, wininfo->name, ICO_HS_MAX_WINDOW_NAME);
+    }
+    // set surface id
+    hs_wininfo->surface = wininfo->surface;
+
+    ICO_TRA("CicoHSAppInfo::SetWindowInfo Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  set window attribute
+ *
+ *  @param [in] hs_wininfo  window information
+ *  @param [in] winattr     window attribute
+ */
+//--------------------------------------------------------------------------
+void 
+CicoHSAppInfo::SetWindowAttr(ico_hs_window_info *hs_wininfo,
+                             ico_syc_win_attr_t *winattr)
+{
+    ICO_TRA("CicoHSAppInfo::SetWindowAttr Enter"
+            "(winifo=%p "
+            "appid=%s winname=%s zone=%s surface=%d nodeid=%d layer=%d "
+            "x/y=%d/%d w/h=%d/%d raise=%d visible=%d active=%d)",
+            hs_wininfo,
+            winattr->appid, winattr->name, winattr->zone,
+            winattr->surface, winattr->nodeid, winattr->layer,
+            winattr->pos_x, winattr->pos_y, winattr->width, winattr->height,
+            winattr->raise, winattr->visible, winattr->active);
+
+    if (winattr->appid != NULL) {
+        strncpy(hs_wininfo->appid, winattr->appid, ICO_HS_MAX_PROCESS_NAME);
+    }
+
+    if (winattr->name != NULL) { 
+        strncpy(hs_wininfo->name, winattr->name, ICO_HS_MAX_WINDOW_NAME);
+    }
+
+    if (winattr->zone != NULL) { 
+        strncpy(hs_wininfo->zone, winattr->zone, ICO_HS_MAX_ZONE_NAME);
+    }
+
+    hs_wininfo->surface = winattr->surface;
+    hs_wininfo->nodeid  = winattr->nodeid;
+    hs_wininfo->layer   = winattr->layer;
+    hs_wininfo->pos_x   = winattr->pos_x;
+    hs_wininfo->pos_y   = winattr->pos_y;
+    hs_wininfo->width   = winattr->width;
+    hs_wininfo->height  = winattr->height;
+    hs_wininfo->raise   = winattr->raise;
+    hs_wininfo->visible = winattr->visible;
+    hs_wininfo->active  = winattr->active;
+
+    ICO_TRA("CicoHSAppInfo::SetWindowAttr Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ * @brief   CicoHSAppInfo::GetFreeWindowInfoBuffer
+ *          get internal window info buffer
+ *
+ * @param[in]   none
+ * @return      buffer
+ */
+//--------------------------------------------------------------------------
+ico_hs_window_info *
+CicoHSAppInfo::GetFreeWindowInfoBuffer(void)
+{
+    ico_hs_window_info *tmp_win_info;
+    for (int ii = 0; ii < ICO_HS_APP_MAX_WINDOW_NUM; ii++) {
+        if (m_window_info_i[ii].valid == false) {
+           tmp_win_info = &m_window_info_i[ii];
+           tmp_win_info->valid = true;
+           return tmp_win_info;
+        }
+    }
+    return NULL;
 }
+// vim: set expandtab ts=4 sw=4:
index 77bb3cf..eaf8bdf 100644 (file)
@@ -6,13 +6,17 @@
  * http://www.apache.org/licenses/LICENSE-2.0
  *
  */
+
+//==========================================================================
 /**
- * @brief   Application info
+ *  @file   CicoHSAppInfo.h
  *
- * @date    Aug-08-2013
+ *  @brief  This file is definition of CicoHSAppInfo class
  */
+//==========================================================================
 #ifndef __CICO_HS_APP_INFO_H__
 #define __CICO_HS_APP_INFO_H__
+
 #include <stdio.h>
 #include <pthread.h>
 #include <libwebsockets.h>
 #define ICO_HS_APPLICATION_FULL_SCREEN_HEIGHT 1728
 
 #define ICO_HS_MAX_WINDOW_NAME 64
+#define ICO_HS_MAX_ZONE_NAME 64
 
 typedef struct _ico_hs_window_info{
     bool valid;
-    bool showed;
     char appid[ICO_HS_MAX_PROCESS_NAME];
     char name[ICO_HS_MAX_WINDOW_NAME];
+    char zone[ICO_HS_MAX_ZONE_NAME];
     int  surface;
     int  nodeid;
     int  layer;
@@ -49,44 +54,98 @@ typedef struct _ico_hs_window_info{
     int  active;
 }ico_hs_window_info;
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ */
+//--------------------------------------------------------------------------
 class CicoHSAppInfo
 {
-  public:
+public:
+    // constructor
     CicoHSAppInfo(const char *appid);
+
+    // destructor
     ~CicoHSAppInfo(void);
-    char *GetAppId(void);
-    ico_hs_window_info* GetWindowInfo(const char* name);
-    void SetWindowInfo(ico_hs_window_info *hs_window_info,
-                       ico_syc_win_info_t *window_info);
-    void SetWindowAttr(ico_hs_window_info *hs_window_info,
-                       ico_syc_win_attr_t *window_info);
+
+    // add window information
+    int AddWindowInfo(ico_syc_win_info_t *wininfo);
+
+    // add window attribute
+    int AddWindowAttr(ico_syc_win_attr_t *winattr);
+
+    // free window information
     void FreeWindowInfo(const char *name);
-    int AddWindowInfo(ico_syc_win_info_t *window_info);
-    int AddWindowAttr(ico_syc_win_attr_t *window_info);
+
+    // get application id
+    const char * GetAppId(void);
+
+    // get tatal count window information
     int GetWindowNum(void);
-    void SetShowed(ico_hs_window_info *info,bool showed);
-    bool GetShowed(ico_hs_window_info *info);
-    
+
+    // get window information by window name
+    ico_hs_window_info* GetWindowInfo(const char* name);
+
+    // get window iformation by index
+    ico_hs_window_info* GetWindowInfo(int idx);
+
+    // get window information by surface id
+    ico_hs_window_info* GetWindowInfobySurface(int surface);
+
+    // launch application
     int Execute(void);
+
+    // terminate application
     int Terminate(void);
+
+    // get application running status
     bool GetStatus(void);
    
+    // set last surface id
     void SetLastSurface(int last_surface);
+
+    // get last surface id
     int GetLastSurface(void);
-  private:
-    ico_hs_window_info *GetFreeWindowInfoBuffer(void);
 
-    char appid[ICO_HS_MAX_PROCESS_NAME];
-    int category;
-    int window_num;
-    int last_surface;
-    ico_hs_window_info window_info_i[ICO_HS_APP_MAX_WINDOW_NUM];
-    std::vector<ico_hs_window_info *> window_info;
-    CicoSCLifeCycleController *life_cycle_controller;
-   
-  protected:
+    // get default zone name
+    const char * GetDefaultZone(void);
+
+private:
+    // default constructor
+    CicoHSAppInfo();
+
+    // assignment operator
     CicoHSAppInfo operator=(const CicoHSAppInfo&);
+
+    // copy constructor
     CicoHSAppInfo(const CicoHSAppInfo&);
-};
-#endif
 
+    // set window information
+    void SetWindowInfo(ico_hs_window_info *hs_wininfo,
+                       ico_syc_win_info_t *wininfo);
+
+    // set window attribute
+    void SetWindowAttr(ico_hs_window_info *hs_wininfo,
+                       ico_syc_win_attr_t *winattr);
+
+    // get ico_hs_window_info from freebuffer
+    ico_hs_window_info* GetFreeWindowInfoBuffer(void);
+
+private:
+    /// application id
+    std::string m_appid;
+    /// application category
+    int m_category;
+    /// total window count
+    int m_window_num;
+    /// last surface id
+    int m_last_surface;
+    /// window information free list
+    ico_hs_window_info m_window_info_i[ICO_HS_APP_MAX_WINDOW_NUM];
+    /// window information list
+    std::vector<ico_hs_window_info *> m_window_info;
+    /// life cycle controller instance
+    CicoSCLifeCycleController *m_life_cycle_controller;
+};
+#endif  // __CICO_HS_APP_INFO_H__
+// vim: set expandtab ts=4 sw=4:
index fb4cba0..d7430d1 100644 (file)
@@ -12,6 +12,7 @@
  * @date    Aug-08-2013
  */
 #include "CicoHSBackWindow.h"
+#include "CicoHomeScreenResourceConfig.h"
 
 /*============================================================================*/
 /* functions                                                                  */
index 0848de4..08e4e12 100644 (file)
@@ -66,8 +66,8 @@ CicoHSControlBarTouch::Finalize(void)
 void
 CicoHSControlBarTouch::TouchDownControlBar(void *data, Evas *evas, Evas_Object *obj, void *event_info)
 {
-   Evas_Event_Mouse_Down *info;
-   int button_id;
+//   Evas_Event_Mouse_Down *info;
+//   int button_id;
 
 }
 
@@ -86,13 +86,14 @@ CicoHSControlBarTouch::TouchDownControlBar(void *data, Evas *evas, Evas_Object *
 void
 CicoHSControlBarTouch::TouchUpControlBar(void *data, Evas *evas, Evas_Object *obj, void *event_info)
 {
-   Evas_Event_Mouse_Up *info;
-   int sub = 0;
+//   Evas_Event_Mouse_Up *info;
+//   int sub = 0;
    ICO_DBG("CicoHSControlBarTouch::TouchUpControlBar start");  
    if(data == NULL){
         ctl_bar_window->TouchHome();
    }else{
-     
+        ICO_DBG("CicoHSControlBarTouch::TouchUpControlBar appid = [%s]",(const char *)data);  
+        ctl_bar_window->TouchShortcut((const char *)data); 
    }
    ICO_DBG("CicoHSControlBarTouch::TouchUpControlBar end");  
 }
index 969ae48..4afb781 100644 (file)
@@ -13,6 +13,8 @@
  */
 #include "CicoHSControlBarWindow.h"
 #include "CicoHSControlBarTouch.h"
+#include "CicoHomeScreenConfig.h"
+#include "CicoHomeScreenResourceConfig.h"
 #include "CicoHomeScreen.h"
 #include "CicoHSSystemState.h"
 
@@ -35,6 +37,24 @@ CicoHSControlBarWindow::CicoHSControlBarWindow(void)
     CicoHomeScreenResourceConfig::GetImagePath(img_dir_path,
         ICO_HS_MAX_PATH_BUFF_LEN);
 
+    CicoHomeScreenConfig config;
+    config.Initialize(ICO_HOMESCREEN_CONFIG_FILE);
+    const char *value = config.ConfigGetString("switchzone", "keyname", NULL);
+    changeZoneKeyName = value[0];
+
+    char tmp_str[16];
+    for (unsigned int ii = 0; ii < ICO_HS_CONTROL_BAR_SHORTCUT_MAX_NUM; ii++) {
+        sprintf(tmp_str, ICO_HS_CONTROL_BAR_CONFIG_SHORTCUT_APP"%d", ii);
+        value = config.ConfigGetString(ICO_HS_CONFIG_CONTROL_BAR, tmp_str, NULL);
+        if ((NULL != value) && (0 != strcmp(value, "none"))) {
+            shortcut_appid[ii] = value;
+            ICO_DBG("shortcut_appid[%d] = [%s]", ii, shortcut_appid[ii]);
+        }
+        else {
+            shortcut_appid[ii] = NULL;
+            ICO_DBG("shortcut_appid[%d] = NULL", ii);
+        }
+    }
 }
 
 /*--------------------------------------------------------------------------*/
@@ -64,7 +84,8 @@ CicoHSControlBarWindow::~CicoHSControlBarWindow(void)
  */
 /*--------------------------------------------------------------------------*/
 int 
-CicoHSControlBarWindow::CreateControlBarWindow(int pos_x,int pos_y,int width,int height)
+CicoHSControlBarWindow::CreateControlBarWindow(int pos_x, int pos_y,
+                                               int width, int height)
 {
     int ret;
     char img_path[ICO_HS_MAX_PATH_BUFF_LEN];
@@ -78,39 +99,164 @@ CicoHSControlBarWindow::CreateControlBarWindow(int pos_x,int pos_y,int width,int
     /* get evas */
     evas = ecore_evas_get(window);
     if (!evas) {
-        ICO_DBG("CicoHSControlBarWindow::CreateControlBarWindow: could not get evas.");
+        ICO_ERR("ecore_evas_get failed.");
+        ICO_DBG("CicoHSControlBarWindow::CreateControlBarWindow Leave(ERROR)");
         return ICO_ERROR;
     }
 
-    /*control bar back*/
-       background = evas_object_rectangle_add(evas);
+    // create background evas object
+    background = evas_object_rectangle_add(evas);
+
+    // add callback functions
+    evas_object_event_callback_add(background, EVAS_CALLBACK_KEY_DOWN, 
+                                   CicoHSControlBarWindow::evasKeyDownCB, this);
+
+    evas_object_focus_set(background, EINA_FALSE);     
+    Eina_Bool eret = evas_object_key_grab(background, "m", 0, 0, EINA_TRUE);
+    if (EINA_FALSE == eret) {
+        ICO_WRN("evas_object_key_grab failed.");
+    }
+
+    // set background coloer
     evas_object_color_set(background,128,128,128,255);
+
+    // change window geometry
     evas_object_move(background, 0, 0);
     evas_object_resize(background, width,height);
+
+    // show window
     evas_object_show(background);
 
-    /*home button*/
-    /* image file name*/
-    snprintf(img_path,sizeof(img_path),"%s%s",img_dir_path,ICO_HS_IMAGE_FILE_CONTROL_BAR_BUTTON_DAY);
+    // home button
+    // image file name
+    snprintf(img_path, sizeof(img_path), "%s%s",
+             img_dir_path, ICO_HS_IMAGE_FILE_CONTROL_BAR_BUTTON_DAY);
 
-    /* set object*/
+    // set object
     menu_btn = evas_object_image_filled_add(evas);
+
+    // preload image
+    snprintf(img_path,sizeof(img_path),"%s%s",img_dir_path,
+             ICO_HS_IMAGE_FILE_CONTROL_BAR_BUTTON_DAY2);
+    evas_object_image_file_set(menu_btn, img_path, NULL);
+
+    snprintf(img_path,sizeof(img_path),"%s%s",img_dir_path,
+             ICO_HS_IMAGE_FILE_CONTROL_BAR_BUTTON_NIHGT);
+    evas_object_image_file_set(menu_btn, img_path, NULL);
+
+    snprintf(img_path,sizeof(img_path),"%s%s",img_dir_path,
+             ICO_HS_IMAGE_FILE_CONTROL_BAR_BUTTON_NIHGT2);
     evas_object_image_file_set(menu_btn, img_path, NULL);
-    evas_object_move(menu_btn, (width/2) - (ICO_HS_CONTROL_BAR_MENU_BTN_WIDTH /2),
-                      ICO_HS_CONTROL_BAR_MENU_BTN_START_POS_Y);
+
+    // load fisrt show icon image 
+    snprintf(img_path,sizeof(img_path),"%s%s",img_dir_path,
+             ICO_HS_IMAGE_FILE_CONTROL_BAR_BUTTON_DAY);
+    evas_object_image_file_set(menu_btn, img_path, NULL);
+
+    evas_object_move(menu_btn,
+                     (width/2) - (ICO_HS_CONTROL_BAR_MENU_BTN_WIDTH /2),
+                     ICO_HS_CONTROL_BAR_MENU_BTN_START_POS_Y);
     evas_object_resize(menu_btn, ICO_HS_CONTROL_BAR_MENU_BTN_WIDTH, 
-                       ICO_HS_CONTROL_BAR_MENU_BTN_HEIGHT);;
+                       ICO_HS_CONTROL_BAR_MENU_BTN_HEIGHT);
     evas_object_event_callback_add(menu_btn, EVAS_CALLBACK_MOUSE_DOWN,
-                                   CicoHSControlBarTouch::TouchDownControlBar,NULL);
+                                   CicoHSControlBarTouch::TouchDownControlBar,
+                                   NULL);
     evas_object_event_callback_add(menu_btn, EVAS_CALLBACK_MOUSE_UP,
-                                   CicoHSControlBarTouch::TouchUpControlBar,NULL);
+                                   CicoHSControlBarTouch::TouchUpControlBar,
+                                   NULL);
     evas_object_show(menu_btn);    
+
+    /* shortcut */
+    AddShortcut(evas, width);
  
     return ICO_OK;
 }
 
 /*--------------------------------------------------------------------------*/
 /**
+ * @brief   CicoHSControlBarWindow::AddShortcut
+ *          shortcut addition (control bar)
+ *
+ * @param[in]   evas     Evas Object
+ * @param[in]   width    width
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSControlBarWindow::AddShortcut(Evas *evas, int width)
+{
+    ICO_DBG("CicoHSControlBarWindow::AddShortcut Enter");
+
+    int escPosX;
+    int x;
+    int tmp_space;
+    int s_cnt = 0;
+    const char *tmp_appid;
+    CicoSCLifeCycleController *life_cycle_controller;
+
+    /* menu button x position */
+    escPosX = (width / 2) - (ICO_HS_CONTROL_BAR_MENU_BTN_WIDTH / 2);
+
+    life_cycle_controller = CicoSCLifeCycleController::getInstance();
+
+    tmp_space = (width - (ICO_HS_CONTROL_BAR_MENU_BTN_WIDTH
+                * ICO_HS_CONTROL_BAR_BTN_MAX_NUM))
+                / (ICO_HS_CONTROL_BAR_BTN_MAX_NUM + 1);
+    ICO_DBG("CicoHSControlBarWindow::AddShortcut tmp_space = [%d]",
+            tmp_space);
+
+    for (unsigned ii = 0; ii < ICO_HS_CONTROL_BAR_BTN_MAX_NUM; ii++) {
+        x = (ICO_HS_CONTROL_BAR_SHORTCUT_BTN_WIDTH * ii) +
+            (tmp_space * (ii + 1));
+
+        if ((x <= escPosX) &&
+           ((x + ICO_HS_CONTROL_BAR_SHORTCUT_BTN_WIDTH) >= escPosX)) {
+            /* The position of a menu button is skipped */
+            continue;
+        }
+        ICO_DBG("CicoHSControlBarWindow::AddShortcut x = [%d]", x);
+
+        tmp_appid = (const char *)(shortcut_appid[s_cnt]);
+        if (tmp_appid == NULL) {
+            /* No shortcut appid */
+            s_cnt++;
+            continue;
+        }
+
+        /* get APP information */
+        std::vector<CicoSCAilItems> aillist =
+        life_cycle_controller->getAilList();
+
+        /* add shortcut object */
+        for (unsigned int kk = 0; kk < aillist.size(); kk++ ) {
+            if (strncmp(aillist[kk].m_appid.c_str(), tmp_appid,
+                ICO_HS_MAX_PROCESS_NAME) == 0) {
+                ICO_DBG("CicoHSControlBarWindow::AddShortcut tmp_appid = [%s]",
+                        tmp_appid);
+                shortcut[s_cnt] = evas_object_image_filled_add(evas);
+                evas_object_image_file_set(shortcut[s_cnt],
+                                  aillist[kk].m_icon.c_str(), NULL);
+                evas_object_move(shortcut[s_cnt], x,
+                                  ICO_HS_CONTROL_BAR_SHORTCUT_BTN_START_POS_Y);
+                evas_object_resize(shortcut[s_cnt],
+                                  ICO_HS_CONTROL_BAR_SHORTCUT_BTN_WIDTH,
+                                  ICO_HS_CONTROL_BAR_SHORTCUT_BTN_HEIGHT);
+                evas_object_event_callback_add(shortcut[s_cnt],
+                                  EVAS_CALLBACK_MOUSE_UP,
+                                  CicoHSControlBarTouch::TouchUpControlBar,
+                                  tmp_appid);
+                evas_object_show(shortcut[s_cnt]);
+            }
+        }
+        s_cnt++;
+    }
+
+    ICO_DBG("CicoHSControlBarWindow::AddShortcut Leave");
+    return;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
  * @brief   CicoHSControlBarWindow::FreeControlBarWindow
  *          free window (control bar)
  *
@@ -161,7 +307,6 @@ CicoHSControlBarWindow::SetNightMode(void)
     if (true == state) {
         ICO_DBG("ICO_SYC_STATE_ON");
         evas_object_color_set(background,0,0,0,255);
-        evas_object_show(background);    
         if (true == CicoHSSystemState::getInstance()->getRegulation()) {
             ICO_DBG("Regulation=ON");
             snprintf(img_path,sizeof(img_path),"%s%s",img_dir_path,
@@ -173,12 +318,10 @@ CicoHSControlBarWindow::SetNightMode(void)
                      ICO_HS_IMAGE_FILE_CONTROL_BAR_BUTTON_NIHGT);
         }
         evas_object_image_file_set(menu_btn, img_path, NULL);
-        evas_object_show(menu_btn);    
     }
     else {
         ICO_DBG("ICO_SYC_STATE_OFF");
         evas_object_color_set(background,128,128,128,255);
-        evas_object_show(background);    
         if (true == CicoHSSystemState::getInstance()->getRegulation()) {
             ICO_DBG("Regulation=ON");
             snprintf(img_path,sizeof(img_path),"%s%s",img_dir_path,
@@ -190,11 +333,7 @@ CicoHSControlBarWindow::SetNightMode(void)
                      ICO_HS_IMAGE_FILE_CONTROL_BAR_BUTTON_DAY);
         }
         evas_object_image_file_set(menu_btn, img_path, NULL);
-        evas_object_show(menu_btn);    
     }
-    evas_render(evas);
-    ico_syc_hide(appid, surface, NULL);
-    ico_syc_show(appid, surface, NULL);
 
     ICO_DBG("CicoHSControlBarWindow::SetNightMode Leave");
 }
@@ -241,16 +380,27 @@ CicoHSControlBarWindow::SetRegulation(void)
         }
     }
     evas_object_image_file_set(menu_btn, img_path, NULL);
-    evas_object_show(menu_btn);    
-    evas_render(evas);
-    ico_syc_hide(appid, surface, NULL);
-    ico_syc_show(appid, surface, NULL);
 
     ICO_DBG("CicoHSControlBarWindow::SetRegulation Leave");
 }
 
 /*--------------------------------------------------------------------------*/
 /**
+ * @brief   CicoHSControlBarWindow::GetChangeZoneKeyName
+ *          get change zone key name
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+char
+CicoHSControlBarWindow::GetChangeZoneKeyName(void)
+{
+    return changeZoneKeyName;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
  * @brief   CicoHSControlBarWindow::SetMenuWindowID
  *          set appid and surface
  *
@@ -264,4 +414,53 @@ CicoHSControlBarWindow::SetWindowID(const char *appid,int surface)
     strncpy(this->appid,appid,ICO_HS_MAX_PROCESS_NAME);
     this->surface = surface;
 }
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  key up event callback function
+ *
+ *  @pamam [in] data    user data
+ *  @param [in] evas    evas instcance
+ *  @param [in] obj     evas object instcance
+ *  @param [in] info    event information(Evas_Event_Key_Down)
+ */
+//--------------------------------------------------------------------------
+void
+CicoHSControlBarWindow::evasKeyDownCB(void *data, Evas *evas,
+                                      Evas_Object *obj, void *info)
+{
+    Evas_Event_Key_Down *evinfo = NULL;
+    evinfo = (Evas_Event_Key_Down*)info;
+    CicoHSControlBarWindow *ctrlbarwin = (CicoHSControlBarWindow*)(data);
+
+    ICO_DBG("KeyDownCB: keyname=%s, key=%d",
+            evinfo->keyname, (char)*evinfo->key);
+
+    if (evinfo->keyname[0] == ctrlbarwin->GetChangeZoneKeyName()) {
+        CicoHomeScreen::ChangeZone();
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSControlBarWindow::TouchShortcut
+ *          touch shortcut button
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSControlBarWindow::TouchShortcut(const char *appid)
+{
+    ICO_DBG("CicoHSControlBarWindow::TouchShortcut Enter");
+
+    if (appid != NULL) {
+        ICO_DBG("CicoHSControlBarWindow::TouchShortcut appid = [%s]", appid);
+        CicoHomeScreen::ExecuteApp(appid);
+    }
+
+    ICO_DBG("CicoHSControlBarWindow::TouchShortcut Leave");
+}
+
 // vim: set expandtab ts=4 sw=4:
index 11b1396..beaff1a 100644 (file)
 #define ICO_HS_CONTROL_BAR_MENU_BTN_WIDTH 108
 #define ICO_HS_CONTROL_BAR_MENU_BTN_HEIGHT 108
 
+#define ICO_HS_CONTROL_BAR_SHORTCUT_BTN_START_POS_Y 10
+#define ICO_HS_CONTROL_BAR_SHORTCUT_BTN_WIDTH 108
+#define ICO_HS_CONTROL_BAR_SHORTCUT_BTN_HEIGHT 108
+
+#define ICO_HS_CONTROL_BAR_SHORTCUT_MAX_NUM 4
+#define ICO_HS_CONTROL_BAR_BTN_MAX_NUM (ICO_HS_CONTROL_BAR_SHORTCUT_MAX_NUM + 1)
+#define ICO_HS_CONTROL_BAR_CONFIG_SHORTCUT_APP "shortcut_app"
+#define ICO_HS_CONFIG_CONTROL_BAR "controlbar"
+
 class CicoHSControlBarWindow :public CicoHSWindow
 {
   public:
@@ -49,20 +58,34 @@ class CicoHSControlBarWindow :public CicoHSWindow
 
     void SetNightMode(void);
     void SetRegulation(void);
+    char GetChangeZoneKeyName(void);
+    void AddShortcut(Evas *evas, int width);
+    void TouchShortcut(const char *appid);
+
+protected:
+    // assignment operator
+    CicoHSControlBarWindow operator=(const CicoHSControlBarWindow&);
 
-  private:
+    // copy constructor
+    CicoHSControlBarWindow(const CicoHSControlBarWindow&);
+
+private:
+    // key down event callback function
+    static void evasKeyDownCB(void *data, Evas *evas,
+                              Evas_Object *obj, void *info);
+private:
     /* for window control */
     char appid[ICO_HS_MAX_PROCESS_NAME];
     int surface;
 
     char img_dir_path[ICO_HS_MAX_PATH_BUFF_LEN];
-    Evas *evas;         /* evas object */
-    Evas_Object *background;
-    Evas_Object *menu_btn;
+    Evas        *evas;          ///! evas instance
+    Evas_Object *background;    ///! background evas object instance
+    Evas_Object *menu_btn;      ///! menu button evas object instance
+    char changeZoneKeyName;     ///! change zone key name
+    const char *shortcut_appid[ICO_HS_CONTROL_BAR_SHORTCUT_MAX_NUM];
+    Evas_Object *shortcut[ICO_HS_CONTROL_BAR_SHORTCUT_MAX_NUM];
 
-  protected:
-    CicoHSControlBarWindow operator=(const CicoHSControlBarWindow&);
-    CicoHSControlBarWindow(const CicoHSControlBarWindow&);
 };
 #endif
 // vim: set expandtab ts=4 sw=4:
diff --git a/src/homescreen/CicoHSFlickInputWindow.cpp b/src/homescreen/CicoHSFlickInputWindow.cpp
new file mode 100644 (file)
index 0000000..65ac5bf
--- /dev/null
@@ -0,0 +1,264 @@
+/*
+ * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0.  The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+/**
+ * @brief   flick input window
+ *
+ * @date    Sep-20-2013
+ */
+#include "CicoHSFlickInputWindow.h"
+#include "CicoHSFlickTouch.h"
+#include "CicoHomeScreen.h"
+#include "CicoHSSystemState.h"
+
+/*============================================================================*/
+/* functions                                                                  */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSFlickInputWindow::CicoHSFlickInputWindow
+ *          Constractor
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+CicoHSFlickInputWindow::CicoHSFlickInputWindow(void)
+{
+    ICO_DBG("CicoHSFlickInputWindow::CicoHSFlickInputWindow: constractor");
+    evas = NULL;
+    background = NULL;
+    setuped = false;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSFlickInputWindow::~CicoHSFlickInputWindow
+ *          Destractor
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+CicoHSFlickInputWindow::~CicoHSFlickInputWindow(void)
+{
+    ICO_DBG("CicoHSFlickInputWindow::CicoHSFlickInputWindow: destractor");
+    /* not somthing to do */
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSFlickInputWindow::CreateFlickInputWindow
+ *          crate window (flick input window)
+ *
+ * @param[in]   pos_x    position x
+ * @param[in]   pos_y    position y
+ * @param[in]   width    width
+ * @param[in]   height   height
+ * @param[in]   subname  flick input window sub name
+ * @return      OK or ERRROR
+ */
+/*--------------------------------------------------------------------------*/
+int
+CicoHSFlickInputWindow::CreateFlickInputWindow(int pos_x, int pos_y,
+                                               int width, int height, const char *subname)
+{
+    int ret;
+
+    ICO_DBG("CreateFlickInputWindow: start(%s,x/y=%d/%d,w/h=%d/%d)",
+            subname ? subname : "(null)", pos_x, pos_y, width, height);
+
+    /*create window*/
+    if (subname)    {
+        snprintf(winname, sizeof(winname), "%s_%s",
+                 ICO_HS_FLICK_INPUT_WINDOW_TITLE, subname);
+    }
+    else    {
+        strncpy(winname, ICO_HS_FLICK_INPUT_WINDOW_TITLE, ICO_SYC_MAX_WINNAME_LEN);
+    }
+    winname[ICO_SYC_MAX_WINNAME_LEN-1] = 0;
+    ICO_DBG("CreateFlickInputWindow: winname=%s", winname);
+    ret = CreateWindow(winname, pos_x, pos_y, width, height, EINA_TRUE);
+    if(ret != ICO_OK){
+        ICO_CRI("CicoHSFlickInputWindow::CreateFlickInputWindow: can not create window");
+        return ret;
+    }
+
+    /* get evas */
+    evas = ecore_evas_get(window);
+    if (!evas) {
+        ICO_CRI("CicoHSFlickInputWindow::CreateFlickInputWindow: could not get evas.");
+        return ICO_ERROR;
+    }
+
+    /* background object(transparent)    */
+    background = evas_object_image_filled_add(evas);
+
+    /* set mouse/touch callback */
+    evas_object_event_callback_add(background, EVAS_CALLBACK_MOUSE_DOWN,
+                                       CicoHSFlickTouch::TouchDownFlick, this);
+    evas_object_event_callback_add(background, EVAS_CALLBACK_MOUSE_UP,
+                                       CicoHSFlickTouch::TouchUpFlick, this);
+
+    /* move and show window     */
+    evas_object_move(background, 0, 0);
+    evas_object_resize(background, width, height);
+    evas_object_show(background);
+
+    ICO_DBG("CreateFlickInputWindow: end");
+    return ICO_OK;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSFlickInputWindow::FreeFlickInputWindow
+ *          free window (flick input window)
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSFlickInputWindow::FreeFlickInputWindow(void)
+{
+    evas_object_del(background);
+    FreeWindow();
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSFlickInputWindow::SetupFlickWindow
+ *          initiale setup flick input window
+ *
+ * @param       none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSFlickInputWindow::SetupFlickWindow(void)
+{
+    ico_syc_win_move_t move;
+    ico_syc_animation_t show;
+
+    if (! setuped)  {
+        ICO_DBG("SetupFlickWindow: start");
+        setuped = true;
+        move.zone = NULL;
+        move.pos_x = pos_x;
+        move.pos_y = pos_y;
+        move.width = width;
+        move.height = height;
+        memset(&show, 0, sizeof(show));
+        show.time = ICO_SYC_WIN_SURF_RAISE;
+
+        /* move flick input window to TouchLayer    */
+        ico_syc_change_layer(appid, surface, HS_LAYER_TOUCH);
+        /* move window position and size            */
+        ico_syc_move(appid, surface, &move, NULL);
+        /* show and raise window                    */
+        ico_syc_show(appid, surface, &show);
+
+        /* show touch layer                         */
+        ico_syc_show_layer(HS_LAYER_TOUCH);
+
+        ICO_DBG("SetupFlickWindow: end");
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSFlickInputWindow::Show
+ *          show my window
+ *
+ * @param       none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSFlickInputWindow::Show(void)
+{
+    ico_syc_show(appid, surface, NULL);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSFlickInputWindow::Hide
+ *          hide my window
+ *
+ * @param       none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSFlickInputWindow::Hide(void)
+{
+    ico_syc_hide(appid, surface, NULL);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSFlickInputWindow::isMyWindowName
+ *          check window name
+ *
+ * @param[in]   winname     target window name
+ * @return      check result
+ * @retval      true        my window name is winname
+ * @retval      false       my window name is NOT winname
+ */
+/*--------------------------------------------------------------------------*/
+bool
+CicoHSFlickInputWindow::isMyWindowName(const char *winname)
+{
+    bool    ret;
+
+    ret = (strcmp(winname, this->winname)) ? false : true;
+    ICO_DBG("isMyWindowName: %s is %s", winname, ret ? "TRUE" : "FALSE");
+    return ret;
+}
+
+int
+CicoHSFlickInputWindow::GetPosX(void)
+{
+    return pos_x;
+}
+
+int
+CicoHSFlickInputWindow::GetPosY(void)
+{
+    return pos_y;
+}
+
+int
+CicoHSFlickInputWindow::GetWidth(void)
+{
+    return width;
+}
+
+int
+CicoHSFlickInputWindow::GetHeight(void)
+{
+    return height;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSFlickInputWindow::SetWindowID
+ *          set appid and surface
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSFlickInputWindow::SetWindowID(const char *appid, int surface)
+{
+    ICO_DBG("SetWindowID: appid=%s surface=%08x", appid, surface);
+    strncpy(this->appid, appid, ICO_HS_MAX_PROCESS_NAME);
+    this->surface = surface;
+}
+// vim: set expandtab ts=4 sw=4:
diff --git a/src/homescreen/CicoHSFlickInputWindow.h b/src/homescreen/CicoHSFlickInputWindow.h
new file mode 100644 (file)
index 0000000..f5c7b9c
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0.  The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+/**
+ * @brief   flick input window
+ *
+ * @date    Sep-20-2013
+ */
+#ifndef __CICO_HS_FLICKINPUT_WINDOW_H__
+#define __CICO_HS_FLICKINPUT_WINDOW_H__
+#include <stdio.h>
+#include <pthread.h>
+#include <libwebsockets.h>
+
+#include <unistd.h>
+#include <Eina.h>
+#include <Evas.h>
+#include <Ecore.h>
+#include <Ecore_Wayland.h>
+#include <Ecore_Evas.h>
+#include <Edje.h>
+
+#include "ico_syc_type.h"
+#include "CicoHomeScreenCommon.h"
+#include "CicoHomeScreenConfig.h"
+#include "CicoHSWindow.h"
+
+class CicoHSFlickInputWindow :public CicoHSWindow
+{
+  public:
+    CicoHSFlickInputWindow(void);
+    ~CicoHSFlickInputWindow(void);
+    int CreateFlickInputWindow(int pos_x, int pos_y,
+                               int width, int height, const char *subname = NULL);
+    void FreeFlickInputWindow(void);
+    void SetupFlickWindow(void);
+    void Show(void);
+    void Hide(void);
+    bool isMyWindowName(const char *winname);
+    int GetPosX(void);
+    int GetPosY(void);
+    int GetWidth(void);
+    int GetHeight(void);
+
+    void SetWindowID(const char *appid, int surface);
+
+  private:
+    /* for window control */
+    char appid[ICO_HS_MAX_PROCESS_NAME];
+    char winname[ICO_SYC_MAX_WINNAME_LEN];
+    int surface;
+    bool setuped;
+
+    Evas *evas;                         /* evas object          */
+    Evas_Object *background;            /* background object    */
+
+  protected:
+    CicoHSFlickInputWindow operator=(const CicoHSFlickInputWindow&);
+    CicoHSFlickInputWindow(const CicoHSFlickInputWindow&);
+};
+#endif  /*__CICO_HS_FLICKINPUT_WINDOW_H__*/
+// vim: set expandtab ts=4 sw=4:
diff --git a/src/homescreen/CicoHSFlickTouch.cpp b/src/homescreen/CicoHSFlickTouch.cpp
new file mode 100644 (file)
index 0000000..826ec74
--- /dev/null
@@ -0,0 +1,390 @@
+/*
+ * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0.  The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+/**
+ * @brief   touch action of menu
+ *
+ * @date    Sep^2--2013
+ */
+#include "CicoHSFlickTouch.h"
+#include "CicoHSAppInfo.h"
+#include "CicoHomeScreen.h"
+#include "ico_syc_inputctl.h"
+#include <linux/input.h>
+
+/*============================================================================*/
+/* static members                                                             */
+/*============================================================================*/
+CicoHSControlBarWindow* CicoHSFlickTouch::ctl_bar_window;
+CicoHSAppHistoryExt*    CicoHSFlickTouch::app_history;
+int CicoHSFlickTouch::full_width;
+int CicoHSFlickTouch::full_height;
+int CicoHSFlickTouch::touch_state_b_x;
+int CicoHSFlickTouch::touch_state_b_y;
+int CicoHSFlickTouch::touch_state_a_x;
+int CicoHSFlickTouch::touch_state_a_y;
+int CicoHSFlickTouch::touch_lasttime;
+
+Ecore_Timer *CicoHSFlickTouch::timer;
+bool CicoHSFlickTouch::long_act;
+
+int CicoHSFlickTouch::num_windows;
+CicoHSFlickInputWindow* CicoHSFlickTouch::flick_windows[ICO_HS_MAX_FLICKWINDOWS];
+
+/*============================================================================*/
+/* functions                                                                  */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSFlickTouch::Initialize
+ *          Initialize
+ *
+ * @param[in]   ctl_bar     instance of control bar window
+ * @param[in]   apphist     instance of application history control
+ * @param[in]   width       screen full width
+ * @param[in]   height      screen full height
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSFlickTouch::Initialize(CicoHSControlBarWindow* ctl_bar, CicoHSAppHistoryExt* apphist,
+                             int width, int height)
+{
+    timer = NULL;
+    num_windows = 0;
+    long_act = false;
+
+    ctl_bar_window = ctl_bar;
+    app_history = apphist;
+    full_width = width;
+    full_height = height;
+    touch_lasttime = 0;
+    ICO_DBG("Initialize: ctlbar=%08x apphist=%08x width=%d height=%d",
+            (int)ctl_bar, (int)apphist, width, height);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSFlickTouch::Finalize
+ *          Finalize
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSFlickTouch::Finalize(void)
+{
+  /*nothing to do*/
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSFlickTouch::TouchFlick
+ *          touch down action at flick input window
+ *
+ * @param[in]   data    CicoHSFlickInputWindow object
+ * @param[in]   evas    evas
+ * @param[in]   obj     object
+ * @param[in]   event_info    event information
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSFlickTouch::TouchDownFlick(void *data, Evas *evas, Evas_Object *obj, void *event_info)
+{
+    Evas_Event_Mouse_Down   *info;
+    CicoHSFlickInputWindow  *window;
+    struct timeval ctime;
+
+    info = reinterpret_cast<Evas_Event_Mouse_Down*>(event_info);
+    window = (CicoHSFlickInputWindow *)data;
+    touch_state_b_x = info->output.x + window->GetPosX();
+    touch_state_b_y = info->output.y + window->GetPosY();
+
+    gettimeofday(&ctime, NULL);
+    touch_lasttime = (ctime.tv_sec * 1000 + ctime.tv_usec/1000);
+
+    ICO_DBG("TouchDownFlick: x/y=%d/%d", touch_state_b_x, touch_state_b_y);
+
+    long_act = false;
+    timer = ecore_timer_add(ICO_HS_FLICK_TOUCH_LONG_PUSH_THREASHOLD_TIME_SECONDS,
+                            LongPushed,NULL);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   LongPushed::Touch timeout
+ *          touch down timeout called from ecore
+ *
+ * @param[in]   data    user data(unused)
+ * @return      fixed EINA_TRUE
+ */
+/*--------------------------------------------------------------------------*/
+Eina_Bool
+CicoHSFlickTouch::LongPushed(void *data)
+{
+    ICO_DBG("LongPushed: timedout");
+    long_act = true;
+    timer = NULL;
+
+#if 0           /* not yet support  */
+    /* send ABS_X/Y     */
+    ico_syc_send_input("\0", 0, ICO_SYC_INPUT_TYPE_TOUCH, 0, touch_lasttime - 2,
+                       ABS_Z, (touch_state_b_x << 16) | touch_state_b_y);
+    /* send TOUCH Down  */
+    ico_syc_send_input("\0", 0, ICO_SYC_INPUT_TYPE_TOUCH, 0, touch_lasttime - 1,
+                       BTN_TOUCH, 1);
+    /* send ABS_X/Y     */
+    ico_syc_send_input("\0", 0, ICO_SYC_INPUT_TYPE_TOUCH, 0, touch_lasttime,
+                       ABS_Z, (touch_state_b_x << 16) | touch_state_b_y);
+#endif
+    touch_state_b_x = 0;
+    touch_state_b_y = 0;
+
+    return ECORE_CALLBACK_CANCEL;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSFlickTouch::TouchUpFlick
+ *          touch up action at flick input window
+ *
+ * @param[in]   data    CicoHSFlickInputWindow object
+ * @param[in]   evas    evas
+ * @param[in]   obj     object
+ * @param[in]   event_info    event information
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSFlickTouch::TouchUpFlick(void *data, Evas *evas, Evas_Object *obj, void *event_info)
+{
+    Evas_Event_Mouse_Up     *info;
+    CicoHSFlickInputWindow  *window;
+    CicoHSAppInfo           *appinfo;
+    ico_hs_window_info      *wininfo;
+    ico_syc_animation_t     animation;
+    struct timeval ctime;
+    int sub;
+    int idx;
+    int flick = 0;
+    std::string histapp;
+    std::string curapp;
+
+    if(timer != NULL){
+        ecore_timer_del(timer);
+        timer = NULL;
+    }
+    /* long push*/
+    if(long_act == true){
+        ICO_DBG("TouchUpFlick: timedout");
+        long_act = false;
+        return;
+    }
+
+    info = reinterpret_cast<Evas_Event_Mouse_Up*>(event_info);
+    window = (CicoHSFlickInputWindow *)data;
+    touch_state_a_x = info->output.x + window->GetPosX();
+    touch_state_a_y = info->output.y + window->GetPosY();
+
+    ICO_DBG("TouchUpFlick: x/y=%d/%d->%d/%d",
+            touch_state_b_x, touch_state_b_y, touch_state_a_x, touch_state_a_y);
+    sub = touch_state_a_x - touch_state_b_x;
+
+    /* check slide left to right or right to left   */
+    if (sub > ICO_HS_FLICK_TOUCH_FLICK_THREASHOLD_DISTANCE) {
+        if (touch_state_b_x < ICO_HS_FLICK_TOUCH_FLICK_THREASHOLD_DISTANCE) {
+
+            /* flick at left side to right = back before application*/
+            ICO_DBG("TouchUpFlick: Flick left side to right");
+
+            /* get before application   */
+            curapp = app_history->getSwipeCurrentAppid();
+            histapp = app_history->prevSwipe();
+            ICO_DBG("TouchUpFlick: Flick left to right(cur/prev=%s/%s)",
+                    curapp.c_str(), histapp.c_str());
+            if (histapp.empty())    {
+                ICO_DBG("TouchUpFlick: Flick left to right(prev not exist)");
+            }
+            else    {
+                animation.time = ICO_HS_FLICK_TOUCH_FLICK_ANIMA_TIME |
+                                 ICO_SYC_WIN_SURF_RAISE | ICO_SYC_WIN_SURF_NORESCTL;
+
+                /* show before application with slide to right  */
+                appinfo = CicoHomeScreen::GetAppInfo(histapp.c_str());
+                if (appinfo)    {
+                    animation.name = (char *)"slide.toright";
+                    for (idx = 0; ; idx++)  {
+                        wininfo = appinfo->GetWindowInfo(idx);
+                        if (! wininfo)  break;
+                        ICO_DBG("TouchUpFlick: %s.%d surface=%08x",
+                                wininfo->appid, idx, wininfo->surface);
+                        ico_syc_show(wininfo->appid, wininfo->surface, &animation);
+                    }
+                }
+                else    {
+                    ICO_DBG("TouchUpFlick: prev app(%s) dose not exist", histapp.c_str());
+                }
+
+                /* hide current applicaiton with slide to right */
+                if (curapp.empty()) {
+                    ICO_DBG("TouchUpFlick: Flick left to right(current not exist)");
+                }
+                else    {
+                    animation.time = ICO_HS_FLICK_TOUCH_FLICK_ANIMA_TIME |
+                                     ICO_SYC_WIN_SURF_NORESCTL;
+                    appinfo = CicoHomeScreen::GetAppInfo(curapp.c_str());
+                    if (appinfo)    {
+                        animation.name = (char *)"slide.toleft";
+                        for (idx = 0; ; idx++)  {
+                            wininfo = appinfo->GetWindowInfo(idx);
+                            if (! wininfo)  break;
+                            ICO_DBG("TouchUpFlick: %s.%d surface=%08x",
+                                    wininfo->appid, idx, wininfo->surface);
+                            ico_syc_hide(wininfo->appid, wininfo->surface, &animation);
+                        }
+                    }
+                    else    {
+                        ICO_DBG("TouchUpFlick: current app(%s) dose not exist",
+                                curapp.c_str());
+                    }
+                }
+                /* set history timer                            */
+                app_history->selectApp(histapp.c_str());
+            }
+            flick = 1;
+        }
+        else    {
+            ICO_DBG("TouchUpFlick: Flick left to right, but nop");
+            flick = -1;
+        }
+    }
+    else if (sub < (-1 * ICO_HS_FLICK_TOUCH_FLICK_THREASHOLD_DISTANCE)) {
+        if (touch_state_b_x > (full_width - ICO_HS_FLICK_TOUCH_FLICK_THREASHOLD_DISTANCE)) {
+            /* flick at right side to left = go next applicaton     */
+
+            /* get next application     */
+            curapp = app_history->getSwipeCurrentAppid();
+            histapp = app_history->nextSwipe();
+            ICO_DBG("TouchUpFlick: Flick right to left(cur/next=%s/%s)",
+                    curapp.c_str(), histapp.c_str());
+            if (histapp.empty())    {
+                ICO_DBG("TouchUpFlick: Flick right to left(next not exist)");
+            }
+            else    {
+                animation.time = ICO_HS_FLICK_TOUCH_FLICK_ANIMA_TIME |
+                                 ICO_SYC_WIN_SURF_RAISE | ICO_SYC_WIN_SURF_NORESCTL;
+
+                /* show next application with slide to left     */
+                appinfo = CicoHomeScreen::GetAppInfo(histapp.c_str());
+                if (appinfo)    {
+                    animation.name = (char *)"slide.toleft";
+                    for (idx = 0; ; idx++)  {
+                        wininfo = appinfo->GetWindowInfo(idx);
+                        if (! wininfo)  break;
+                        ICO_DBG("TouchUpFlick: %s.%d surface=%08x",
+                                wininfo->appid, idx, wininfo->surface);
+                        ico_syc_show(wininfo->appid, wininfo->surface, &animation);
+                    }
+                }
+                else    {
+                    ICO_DBG("TouchUpFlick: next app(%s) dose not exist", histapp.c_str());
+                }
+
+                /* hide current applicaiton with slide to left  */
+                if (curapp.empty()) {
+                    ICO_DBG("TouchUpFlick: Flick right to left(current not exist)");
+                }
+                else    {
+                    animation.time = ICO_HS_FLICK_TOUCH_FLICK_ANIMA_TIME |
+                                     ICO_SYC_WIN_SURF_NORESCTL;
+                    appinfo = CicoHomeScreen::GetAppInfo(curapp.c_str());
+                    if (appinfo)    {
+                    animation.name = (char *)"slide.toright";
+                        for (idx = 0; ; idx++)  {
+                            wininfo = appinfo->GetWindowInfo(idx);
+                            if (! wininfo)  break;
+                            ICO_DBG("TouchUpFlick: %s.%d surface=%08x",
+                                    wininfo->appid, idx, wininfo->surface);
+                            ico_syc_hide(wininfo->appid, wininfo->surface, &animation);
+                        }
+                    }
+                    else    {
+                        ICO_DBG("TouchUpFlick: current app(%s) dose not exist",
+                                curapp.c_str());
+                    }
+                }
+                /* set history timer                            */
+                app_history->selectApp(histapp.c_str());
+            }
+            flick = 1;
+        }
+        else    {
+            ICO_DBG("TouchUpFlick: Flick right side to left, but nop");
+            flick = -1;
+        }
+    }
+
+#if 0       /* currently not support    */
+    /* check slide buttom to top or top to buttom   */
+    sub = touch_state_a_y - touch_state_b_y;
+    if (sub > ICO_HS_FLICK_TOUCH_FLICK_THREASHOLD_DISTANCE) {
+        if (touch_state_b_y < ICO_HS_FLICK_TOUCH_FLICK_THREASHOLD_DISTANCE) {
+            /* flick at top side to buttom = unknown    */
+            ICO_DBG("TouchUpFlick: Flick top side to buttom");
+        }
+        else    {
+            ICO_DBG("TouchUpFlick: Flick top side to buttom, but nop");
+        }
+    }
+    else if (sub < (-1 * ICO_HS_FLICK_TOUCH_FLICK_THREASHOLD_DISTANCE)) {
+        if (touch_state_b_y > (full_width - ICO_HS_FLICK_TOUCH_FLICK_THREASHOLD_DISTANCE)) {
+            /* flick at buttom side to top = show home menu screen  */
+            ICO_DBG("TouchUpFlick: Flick buttom side to top");
+            if (ctl_bar_window) {
+                ctl_bar_window->TouchHome();
+            }
+        }
+        else    {
+            ICO_DBG("TouchUpFlick: Flick buttom side to top, but nop");
+        }
+    }
+#endif
+    touch_state_b_x = 0;
+    touch_state_b_y = 0;
+
+#if 0           /* not yet support  */
+    if (flick <= 0) {
+        /* send touch press event   */
+        /* send ABS_X/Y     */
+        ico_syc_send_input("\0", 0, ICO_SYC_INPUT_TYPE_TOUCH, 0, touch_lasttime - 2,
+                           ABS_Z, (touch_state_b_x << 16) | touch_state_b_y);
+        /* send TOUCH Down  */
+        ico_syc_send_input("\0", 0, ICO_SYC_INPUT_TYPE_TOUCH, 0, touch_lasttime - 1,
+                           BTN_TOUCH, 1);
+        /* send ABS_X/Y     */
+        ico_syc_send_input("\0", 0, ICO_SYC_INPUT_TYPE_TOUCH, 0, touch_lasttime,
+                           ABS_Z, (touch_state_b_x << 16) | touch_state_b_y);
+
+        /* send touch release event */
+        gettimeofday(&ctime, NULL);
+        touch_lasttime = (ctime.tv_sec * 1000 + ctime.tv_usec/1000);
+
+        /* send ABS_X/Y     */
+        ico_syc_send_input("\0", 0, ICO_SYC_INPUT_TYPE_TOUCH, 0, touch_lasttime - 2,
+                           ABS_Z, (touch_state_a_x << 16) | touch_state_a_y);
+        /* send TOUCH Up    */
+        ico_syc_send_input("\0", 0, ICO_SYC_INPUT_TYPE_TOUCH, 0, touch_lasttime - 1,
+                           BTN_TOUCH, 0);
+        /* send ABS_X/Y     */
+        ico_syc_send_input("\0", 0, ICO_SYC_INPUT_TYPE_TOUCH, 0, touch_lasttime,
+                           ABS_Z, (touch_state_a_x << 16) | touch_state_a_y);
+    }
+#endif
+}
diff --git a/src/homescreen/CicoHSFlickTouch.h b/src/homescreen/CicoHSFlickTouch.h
new file mode 100644 (file)
index 0000000..ae425e4
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0.  The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+/**
+ * @brief   touch action of menu
+ *
+ * @date    Aug-08-2013
+ */
+#ifndef __CICO_HS_FLICK_TOUCH_H__
+#define __CICO_HS_FLICK_TOUCH_H__
+#include <stdio.h>
+#include <pthread.h>
+#include <libwebsockets.h>
+
+
+#include <unistd.h>
+#include "CicoHSFlickInputWindow.h"
+#include "CicoHSControlBarWindow.h"
+#include "CicoHSAppHistoryExt.h"
+
+#define ICO_HS_FLICK_TOUCH_FLICK_WIDTH 60
+#define ICO_HS_FLICK_TOUCH_FLICK_HEIGHT 60
+#define ICO_HS_FLICK_TOUCH_DISTANCE_XY 200
+#define ICO_HS_FLICK_TOUCH_FLICK_THREASHOLD_DISTANCE 100
+#define ICO_HS_FLICK_TOUCH_LONG_PUSH_THREASHOLD_TIME_SECONDS 2.5d
+#define ICO_HS_FLICK_TOUCH_FLICK_ANIMA_TIME 300
+
+#define ICO_HS_MAX_FLICKWINDOWS 4
+
+class CicoHSFlickTouch
+{
+  public:
+    static void Initialize(CicoHSControlBarWindow* ctl_bar, CicoHSAppHistoryExt *apphist,
+                           int width, int height);
+    static void Finalize(void);
+    static void TouchDownFlick(void *data, Evas *evas, Evas_Object *obj, void *event_info); 
+    static void TouchUpFlick(void *data, Evas *evas, Evas_Object *obj, void *event_info);
+    static Eina_Bool LongPushed(void *data);
+
+  private:
+    static CicoHSControlBarWindow* ctl_bar_window;
+    
+    static int full_width;
+    static int full_height;
+    static int touch_state_b_x;
+    static int touch_state_b_y;
+    static int touch_state_a_x;
+    static int touch_state_a_y;
+    static int touch_lasttime;
+
+    static Ecore_Timer *timer;
+    static bool long_act;
+    static int num_windows;
+    static CicoHSFlickInputWindow* flick_windows[ICO_HS_MAX_FLICKWINDOWS];
+    static CicoHSAppHistoryExt*    app_history;
+
+  protected:
+    CicoHSFlickTouch operator=(const CicoHSFlickTouch&);
+    CicoHSFlickTouch(const CicoHSFlickTouch&);
+};
+#endif
index 1edf5bf..6b27292 100644 (file)
@@ -32,7 +32,7 @@
  */
 /*--------------------------------------------------------------------------*/
 CicoHSMenuTile::CicoHSMenuTile(const char *appid,
-      const char *icon_image_path,int page,int position,int width,int height)
+      const char *icon_image_path,int page,int subpage, int position,int width,int height)
 {
     thumbnail = NULL;
     if(appid != NULL){
@@ -46,6 +46,7 @@ CicoHSMenuTile::CicoHSMenuTile(const char *appid,
     }
     ICO_DBG("CicoHSMEnutTile::CicoHSMenuTile:image_path %s:%s",appid,this->icon_image_path);
     this->page = page;
+    this->subpage = subpage;
     this->position = position;
     this->width = width;
     this->height = height;
@@ -304,6 +305,21 @@ CicoHSMenuTile::GetPage(void)
 
 /*--------------------------------------------------------------------------*/
 /**
+ * @brief   CicoHSMenuTile::GetSubPage
+ *          get sub page
+ *
+ * @param[in]   none
+ * @return      page
+ */
+/*--------------------------------------------------------------------------*/
+int
+CicoHSMenuTile::GetSubPage(void)
+{
+    return subpage;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
  * @brief   CicoHSMenuTile::GetPositionX
  *          get position x
  *
index cabb7c4..ecde752 100644 (file)
@@ -82,7 +82,7 @@ class CicoHSMenuTile
 {
   public:
     CicoHSMenuTile(const char *appid,const char *icon_image_path
-        ,int page,int position,int width,int height);
+        ,int page,int subpage,int position,int width,int height);
     ~CicoHSMenuTile(void);
     void CreateObject(Evas *evas);
     void FreeObject(void);
@@ -94,6 +94,7 @@ class CicoHSMenuTile
     int GetHeight(void);
     int GetPosition(void);
     int GetPage(void);
+    int GetSubPage(void);
     int GetPositionX(void);
     int GetPositionY(void);
     int GetAppIdx(void);
@@ -108,6 +109,7 @@ class CicoHSMenuTile
     char appid[ICO_HS_MAX_PROCESS_NAME];
     char icon_image_path[ICO_HS_MAX_PATH_BUFF_LEN];
     int page;
+    int subpage;
     int position;
     int width;
     int height;
index 54d43f7..e217f72 100644 (file)
@@ -85,27 +85,26 @@ CicoHSMenuTouch::TouchDownMenu(void *data, Evas *evas, Evas_Object *obj, void *e
     touch_state_b_y = info->output.y;
 
     char *appid = reinterpret_cast<char*>(data);
-    
+
     if(appid == NULL){
         return;
     }
 
     long_act = false;
     timer = ecore_timer_add(ICO_HS_MENU_TOUCH_LONG_PUSH_THREASHOLD_TIME_SECONDS,
-                           LongPushed,NULL);    
+                           LongPushed,NULL);
 }
 
 Eina_Bool
 CicoHSMenuTouch::LongPushed(void *data)
 {
    long_act = true;
-   ecore_timer_del(timer);
    timer = NULL;
 
    /*stop select*/
    menu_window->ChangeTerminateMode();
 
-   return EINA_TRUE;
+   return ECORE_CALLBACK_CANCEL;
 }
 
 
@@ -126,7 +125,8 @@ CicoHSMenuTouch::TouchUpMenu(void *data, Evas *evas, Evas_Object *obj, void *eve
 {
     Evas_Event_Mouse_Up *info;
     char *appid = reinterpret_cast<char*>(data);
-    int sub = 0;
+    int sub_x = 0;
+    int sub_y = 0;
 
     if(timer != NULL){
         ecore_timer_del(timer);
@@ -141,19 +141,35 @@ CicoHSMenuTouch::TouchUpMenu(void *data, Evas *evas, Evas_Object *obj, void *eve
     info = reinterpret_cast<Evas_Event_Mouse_Up*>(event_info);
     touch_state_a_x = info->output.x;
     touch_state_a_y = info->output.y;
-    sub = touch_state_a_x - touch_state_b_x;
-
-    /* menu slide*/
-    if( sub > ICO_HS_MENU_TOUCH_FLICK_THREASHOLD_DISTANCE){
-        menu_window->GoBackMenu();
-        touch_state_b_x = 0;
-        touch_state_b_y = 0;
-        return;
-    }else if(sub < (-1 * ICO_HS_MENU_TOUCH_FLICK_THREASHOLD_DISTANCE)){
-        menu_window->GoNextMenu();
-        touch_state_b_x = 0;
-        touch_state_b_y = 0;
-        return;
+    sub_x = touch_state_a_x - touch_state_b_x;
+    sub_y = touch_state_a_y - touch_state_b_y;
+    if (abs(sub_x) > abs(sub_y)) {
+
+        /* menu slide*/
+        if( sub_x > ICO_HS_MENU_TOUCH_FLICK_THREASHOLD_DISTANCE){
+            menu_window->GoBackMenu();
+            touch_state_b_x = 0;
+            touch_state_b_y = 0;
+            return;
+        }else if(sub_x < (-1 * ICO_HS_MENU_TOUCH_FLICK_THREASHOLD_DISTANCE)){
+            menu_window->GoNextMenu();
+            touch_state_b_x = 0;
+            touch_state_b_y = 0;
+            return;
+        }
+    }
+    else {
+        if( sub_y > ICO_HS_MENU_TOUCH_FLICK_THREASHOLD_DISTANCE){
+            menu_window->UpBackMenu();
+            touch_state_b_x = 0;
+            touch_state_b_y = 0;
+            return;
+        }else if(sub_y < (-1 * ICO_HS_MENU_TOUCH_FLICK_THREASHOLD_DISTANCE)){
+            menu_window->DownNextMenu();
+            touch_state_b_x = 0;
+            touch_state_b_y = 0;
+            return;
+        }
     }
 
     /*execute application*/
index 0245d09..c0f283c 100644 (file)
@@ -23,7 +23,7 @@
 
 #define ICO_HS_MENU_TOUCH_FLICK_THREASHOLD_DISTANCE 100
 #define ICO_HS_MENU_TOUCH_FLICK_THREASHOLD_TIME_MSECONDS 1000
-#define ICO_HS_MENU_TOUCH_LONG_PUSH_THREASHOLD_TIME_SECONDS 3
+#define ICO_HS_MENU_TOUCH_LONG_PUSH_THREASHOLD_TIME_SECONDS 2.5d
 
 class CicoHSMenuTouch
 {
index 59762e4..fbf1903 100644 (file)
@@ -13,6 +13,7 @@
  */
 #include "CicoHSMenuWindow.h"
 #include "CicoHSMenuTouch.h"
+#include "CicoHomeScreenResourceConfig.h"
 #include "CicoHomeScreen.h"
 #include "CicoHSSystemState.h"
 #include <stdio.h>
@@ -39,9 +40,7 @@ CicoHSMenuWindow::CicoHSMenuWindow(void)
     /*initialzie values*/
     terminate_mode = false;
 
-    current_page = 0;
-    all_tile_num = 0;
-    all_page_num = 0;
+    InitAppTiles();
 
     evas = NULL;
     canvas = NULL;
@@ -63,7 +62,7 @@ CicoHSMenuWindow::CicoHSMenuWindow(void)
     CicoHomeScreenResourceConfig::GetImagePath(img_dir_path,
                                                ICO_HS_MAX_PATH_BUFF_LEN);
 
-       m_showState = false;
+    m_showState = false;
 }
 
 /*--------------------------------------------------------------------------*/
@@ -100,11 +99,11 @@ CicoHSMenuWindow::SetMenuBack(void)
     /* set object*/ 
     rectangle = evas_object_rectangle_add(evas);
     if (true == CicoHSSystemState::getInstance()->getNightMode()) {
-               evas_object_color_set(rectangle,0,0,0,178); 
-       }
-       else {
-               evas_object_color_set(rectangle,120,120,120,178); 
-       }
+        evas_object_color_set(rectangle,0,0,0,178); 
+    }
+    else {
+        evas_object_color_set(rectangle,120,120,120,178); 
+    }
     evas_object_move(rectangle, 0, 0);
     evas_object_resize(rectangle, width,height);
     evas_object_show(rectangle);
@@ -179,6 +178,36 @@ CicoHSMenuWindow::GetLayout(const char *filename,CicoLayoutInfo *layout,int *num
 
 /*--------------------------------------------------------------------------*/
 /**
+ * @brief   CicoHSMenuWindow::GetCategory
+ *          read category file
+ *
+ * @param[in]   filename   category file name
+ * @param[out]  category   category data
+ * @param[out]  num        num of category
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void 
+CicoHSMenuWindow::GetCategory(const char *filename, int *category, int *num)
+{
+    int ret;
+    FILE *fp;
+    *num = 0;
+    fp = fopen(filename,"r");
+    if(fp == NULL){
+        return;
+    }
+    int idx =0;
+    while( ( ret = fscanf( fp, "%d", &category[idx] 
+        ) ) != EOF ){
+        idx++;
+    }
+    *num = idx;
+    fclose(fp);
+} 
+
+/*--------------------------------------------------------------------------*/
+/**
  * @brief   CicoHSMenuWindow::SetLayout
  *          write layout file
  *
@@ -211,6 +240,36 @@ CicoHSMenuWindow::SetLayout(const char *filename,CicoLayoutInfo *layout,int num)
 
 /*--------------------------------------------------------------------------*/
 /**
+ * @brief   CicoHSMenuWindow::InitAppTiles
+ *          Initialization object (tiles)
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuWindow::InitAppTiles(void)
+{
+    ICO_DBG("CicoHSMenuWindow::InitAppTiles Enter");
+
+    current_page = 0;
+    subcurrent_page = 0;
+
+    for (int ii = 0; ii < ICO_HS_MENU_MAX_MENU_CATEGORY_NUM; ii++){
+        category_info[ii].id= 0;
+        category_info[ii].page = 0;
+        category_info[ii].subpage_max = 0;
+        category_info[ii].tile_num = 0;
+    }
+
+    all_tile_num = 0;
+    all_page_num = 0;
+
+    ICO_DBG("CicoHSMenuWindow::InitAppTiles Leave");
+}
+
+/*--------------------------------------------------------------------------*/
+/**
  * @brief   CicoHSMenuWindow::SetAppTiles
  *          create object and show (tiles)
  *
@@ -222,70 +281,98 @@ int
 CicoHSMenuWindow::SetAppTiles(void)
 {
     int tile_num = 0;
+    int category_num = 0;
+    int category[ICO_HS_MENU_MAX_TILE_NUM];
+    int ctg_idx = 0;
+    int position = 0;
+    int page = 0;
+    int subpage = 0;
+    int page_num = 0;
     current_page = 0;
-    CicoLayoutInfo layout[ICO_HS_MENU_MAX_TILE_NUM];
    
-    /* get APP information*/
+    /* get APP information */
     std::vector<CicoSCAilItems> aillist = 
         life_cycle_controller->getAilList();
 
-    GetLayout(ICO_HS_MENU_LAYOUT_FILE_PATH,layout,&tile_num);
-    if(tile_num != 0){
-        /*layout file exist*/
-        all_page_num = 0;
-        for(int ii =0;ii < tile_num;ii++){
-            
-            /*put tile*/
-            menu_tile[ii] = 
-                new CicoHSMenuTile(aillist[layout[ii].appidx].m_appid.c_str(),
-                aillist[layout[ii].appidx].m_icon.c_str(),
-                layout[ii].page,layout[ii].position,
-                layout[ii].tile_width,layout[ii].tile_height);
-            /*update manu num*/
-            if(layout[ii].page >= all_page_num){
-                all_page_num = layout[ii].page + 1;
-            }
+    /* get category infomation */
+    GetCategory(ICO_HS_MENU_CATEGORY_FILE_PATH, category, &category_num);
+    ICO_DBG("CicoHSMenuWindow::SetAppTiles :category_num %d", category_num);
+
+    for (unsigned int ii = 0; ii < category_num ; ii++) {
+       ICO_DBG("CicoHSMenuWindow::SetAppTiles :category[%d] %d", ii, category[ii]);
+    }
+
+    /* other category add */
+    all_category_num = category_num + 1;
+
+    /* page set */
+    for (unsigned int ii = 0; ii < all_category_num ; ii++) {
+        if(ii == 0) {
+            /* other category */
+            category_info[ii].id = ICO_HS_MENU_OTHER_CATEGORY_ID;
+            category_info[ii].page = ii;
         }
-        /*menu num*/
-        all_tile_num = tile_num;  
-    }
-    else{
-        /*first time layout*/
-        for(unsigned int ii = 0; ii < aillist.size(); ii++) {
-            /*all application num*/
-            if((aillist[ii].m_noIcon) ||
-                    (strcmp(aillist[ii].m_group.c_str(), 
-                     ICO_HS_GROUP_SPECIAL) == 0)) {
-                ICO_DBG("CicoHSMenuWindow::SetAppTiles :ignore app %s %d",
-                        aillist[ii].m_appid.c_str(),aillist[ii].m_noIcon);
-                continue;
-            }         
-            ICO_DBG("CicoHSMenuWindow::SetAppTiles :SetApp %s %d",
+        else {
+            /* category */
+            category_info[ii].id = category[ii - 1];
+            category_info[ii].page = ii;
+        }
+    }
+
+    /*first time layout*/
+    for(unsigned int ii = 0; ii < aillist.size(); ii++) {
+
+        /*all application num*/
+        if((aillist[ii].m_noIcon) ||
+                (strcmp(aillist[ii].m_group.c_str(), 
+                ICO_HS_GROUP_SPECIAL) == 0)) {
+            ICO_DBG("CicoHSMenuWindow::SetAppTiles :ignore app appid = [%s] noIcon = [%d]",
                     aillist[ii].m_appid.c_str(),aillist[ii].m_noIcon);
-            /* put tile */
-            menu_tile[tile_num] = 
-                new CicoHSMenuTile(aillist[ii].m_appid.c_str(),
-                aillist[ii].m_icon.c_str(),
-                tile_num / ICO_HS_MENUTILE_NUM,tile_num % ICO_HS_MENUTILE_NUM,
-                ICO_HS_MENUTILE_WIDTH,ICO_HS_MENUTILE_HEIGHT);
-            /* layout data */
-            layout[tile_num].appidx = ii;
-            layout[tile_num].page = tile_num / ICO_HS_MENUTILE_NUM;
-            layout[tile_num].position = tile_num % ICO_HS_MENUTILE_NUM;
-            layout[tile_num].tile_width = ICO_HS_MENUTILE_WIDTH;
-            layout[tile_num].tile_height = ICO_HS_MENUTILE_HEIGHT;
-             
-            tile_num++;
-        }
-        /*write layout data*/
-        SetLayout(ICO_HS_MENU_LAYOUT_FILE_PATH,layout,tile_num);
-
-        /*menu num*/
-        all_tile_num = tile_num;    
-        all_page_num = all_tile_num / ICO_HS_MENUTILE_NUM;
-        if(all_tile_num % ICO_HS_MENUTILE_NUM){
-           ++all_page_num;
+            continue;
+        }         
+        ICO_DBG("CicoHSMenuWindow::SetAppTiles :SetApp appid = [%s] noIcon =[%d]",
+                aillist[ii].m_appid.c_str(),aillist[ii].m_noIcon);
+        ICO_DBG("CicoHSMenuWindow::SetAppTile :aillist[%d].m_categoryID = [%d]",
+                ii, aillist[ii].m_categoryID);
+
+        /* Categories */
+        for (ctg_idx = 0; ctg_idx < category_num ; ctg_idx++ ) {
+            if (aillist[ii].m_categoryID == category[ctg_idx]) {
+                SetCategoryInfo(category[ctg_idx]);
+                GetTileInfo(category[ctg_idx], &page, &subpage, &position);
+                break;
+            }
         }
+
+        /* Other categories */
+        if (ctg_idx == category_num) {
+            SetCategoryInfo(ICO_HS_MENU_OTHER_CATEGORY_ID);
+            GetTileInfo(ICO_HS_MENU_OTHER_CATEGORY_ID,
+                        &page, &subpage, &position);
+        }
+
+        /* put tile */
+        menu_tile[tile_num] = 
+            new CicoHSMenuTile(aillist[ii].m_appid.c_str(),
+            aillist[ii].m_icon.c_str(),page, subpage, position,
+            ICO_HS_MENUTILE_WIDTH,ICO_HS_MENUTILE_HEIGHT);
+
+        tile_num++;
+
+    }
+    /*menu num*/
+    all_tile_num = tile_num;    
+    all_page_num = all_category_num;
+
+    for(unsigned int ii = 0; ii < all_category_num ; ii++){
+        ICO_DBG("CicoHSMenuWindow::SetAppTile :category_info[%d].id = [%d]",
+                ii, category_info[ii].id);
+        ICO_DBG("CicoHSMenuWindow::SetAppTile :category_info[%d].subpage_max = [%d]",
+                ii, category_info[ii].subpage_max);
+        ICO_DBG("CicoHSMenuWindow::SetAppTile :category_info[%d].page = [%d]",
+                ii, category_info[ii].page);
+        ICO_DBG("CicoHSMenuWindow::SetAppTile :category_info[%d].tile_num = [%d]",
+                ii , category_info[ii].tile_num);
     }
    
     /*in case of over max num*/
@@ -303,6 +390,10 @@ CicoHSMenuWindow::SetAppTiles(void)
             /*out of window*/
             menu_tile[ii]->OffsetMove(width,0);
         }
+        if(menu_tile[ii]->GetSubPage() != 0){
+            /*out of window*/
+            menu_tile[ii]->OffsetMove(height,0);
+        }
     }
     return ICO_OK;
 }
@@ -326,6 +417,41 @@ CicoHSMenuWindow::FreeAppTiles(void)
         delete menu_tile[ii];
     }
 }
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::RenewAppTiles
+ *          renewal of a menu 
+ *
+ * @param   none
+ * @return  none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuWindow::RenewAppTiles(void)
+{
+    ICO_DBG("CicoHSMenuWindow::RenewAppTiles Enter");
+
+    int ret; 
+   
+    /* free app tiles */
+    FreeAppTiles();
+
+    /* initialization */
+    InitAppTiles();
+
+    /* set app tiles */
+    ret = SetAppTiles();
+    if(ret != ICO_OK){
+        ICO_ERR("CicoHSMenuWindow::RenewAppTiles: could not make tiles.");
+    }
+
+    /* update app info list */
+    CicoHomeScreen::RenewAppInfoList();
+
+    ICO_DBG("CicoHSMenuWindow::RenewAppTiles Leave");
+}
+
 /*--------------------------------------------------------------------------*/
 /**
  * @brief   CicoHSMenuWindow::SetPagePointer
@@ -422,7 +548,7 @@ CicoHSMenuWindow::SetTerminateButton(void)
     evas_object_color_set(terminate_back,0,0,0,178); 
     evas_object_move(terminate_back, 0, 0);
     evas_object_resize(terminate_back, width,height);
-
+    evas_object_layer_set(terminate_back, ICO_HS_MENU_TERMINATE_BUTTON_LAYER);
     /* set object*/
     snprintf(img_path,sizeof(img_path),"%s%s",
                      img_dir_path,ICO_HS_IMAGE_FILE_MENU_TERMINATE_YES);
@@ -440,6 +566,7 @@ CicoHSMenuWindow::SetTerminateButton(void)
     evas_object_move(terminate_button_yes, width / 2  - 100 - 64,
                                            height / 2 + 100);
     evas_object_resize(terminate_button_yes,100,64);
+    evas_object_layer_set(terminate_button_yes, ICO_HS_MENU_TERMINATE_BUTTON_LAYER);
 
     /* set object*/
     snprintf(img_path,sizeof(img_path),"%s%s",
@@ -458,6 +585,7 @@ CicoHSMenuWindow::SetTerminateButton(void)
     evas_object_move(terminate_button_no, width / 2  + 64,
                                            height / 2 + 100);
     evas_object_resize(terminate_button_no,100,64);
+    evas_object_layer_set(terminate_button_no, ICO_HS_MENU_TERMINATE_BUTTON_LAYER);
 
     /* set object*/
     snprintf(img_path,sizeof(img_path),"%s%s",
@@ -473,6 +601,7 @@ CicoHSMenuWindow::SetTerminateButton(void)
     evas_object_move(terminate_really, width / 2 - 100,
                                           height / 2 - 100);
     evas_object_resize(terminate_really,200,64);
+    evas_object_layer_set(terminate_really, ICO_HS_MENU_TERMINATE_BUTTON_LAYER);
     
     return ICO_OK;
 }
@@ -531,6 +660,80 @@ CicoHSMenuWindow::HideTerminateButton(void)
    evas_object_hide(terminate_button_no);
 }
 
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::SetPageCursor
+ *          create object and show (page cursor)
+ *
+ * @param[in]   none
+ * @return      ERROR or OK
+ */
+/*--------------------------------------------------------------------------*/
+int
+CicoHSMenuWindow::SetPageCursor(void)
+{
+    char img_path[ICO_HS_MAX_PATH_BUFF_LEN];
+
+    /* up cursor */
+    snprintf(img_path,sizeof(img_path),"%s%s",
+                 img_dir_path,ICO_HS_IMAGE_FILE_MENU_PAGE_UP_CURSOR);
+
+    /* set object*/
+    page_up_cursor = evas_object_image_filled_add(evas);
+    evas_object_image_file_set(page_up_cursor, img_path, NULL);
+    int err = evas_object_image_load_error_get(page_up_cursor);
+    if (err != EVAS_LOAD_ERROR_NONE) {
+        ICO_ERR("CicoHSMenuWindow::SetPagePointer: page up cursor image is not exist");
+        evas_object_del(page_up_cursor);
+        return ICO_ERROR;
+    }
+
+    evas_object_move(page_up_cursor, ICO_HS_MENU_PAGE_UP_CURSOR_START_POS_X,
+                     ICO_HS_MENU_PAGE_UP_CURSOR_START_POS_Y);
+    evas_object_resize(page_up_cursor,
+                     ICO_HS_MENU_PAGE_UP_CURSOR_WIDTH,
+                     ICO_HS_MENU_PAGE_UP_CURSOR_HEIGHT);
+
+    /* down cursor */
+    snprintf(img_path,sizeof(img_path),"%s%s",
+                 img_dir_path,ICO_HS_IMAGE_FILE_MENU_PAGE_DOWN_CURSOR);
+
+    /* set object*/
+    page_down_cursor = evas_object_image_filled_add(evas);
+    evas_object_image_file_set(page_down_cursor, img_path, NULL);
+    err = evas_object_image_load_error_get(page_down_cursor);
+    if (err != EVAS_LOAD_ERROR_NONE) {
+        ICO_ERR("CicoHSMenuWindow::SetPagePointer: page down cursor image is not exist");
+        evas_object_del(page_down_cursor);
+        return ICO_ERROR;
+    }
+
+    evas_object_move(page_down_cursor, ICO_HS_MENU_PAGE_DOWN_CURSOR_START_POS_X,
+                     ICO_HS_MENU_PAGE_DOWN_CURSOR_START_POS_Y);
+    evas_object_resize(page_down_cursor,
+                     ICO_HS_MENU_PAGE_DOWN_CURSOR_WIDTH,
+                     ICO_HS_MENU_PAGE_DOWN_CURSOR_HEIGHT);
+
+    DspCtrlPageCursor();
+     
+    return ICO_OK;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::FreePageCursor
+ *          free object (page cursor)
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuWindow::FreePageCursor(void)
+{
+    evas_object_del(page_up_cursor);
+    evas_object_del(page_down_cursor);
+}
 
 /*--------------------------------------------------------------------------*/
 /**
@@ -589,16 +792,29 @@ CicoHSMenuWindow::CreateMenuWindow(int pos_x,int pos_y,int width,int height)
         return ICO_ERROR;
     }
 
-    /* Page Pointer */
+    /* Page Cursor */
+    ret = SetPageCursor();
+    if(ret != ICO_OK){
+        ICO_ERR("CicoHSMenuWindow::CreateMenuWindow: could not make page cursor.");
+        FreePagePointer();
+        FreeAppTiles();
+        FreeMenuBack();
+        FreeWindow();
+        return ICO_ERROR;
+    }
+
+    /* Terminate Button */
     ret = SetTerminateButton();
     if(ret != ICO_OK){
         ICO_ERR("CicoHSMenuWindow::CreateMenuWindow: could not make teminate button.");
+        FreePageCursor();
         FreePagePointer();
         FreeAppTiles();
         FreeMenuBack();
         FreeWindow();
         return ICO_ERROR;
     }
+
     /* Initialize Action*/ 
     CicoHSMenuTouch::Initialize(this);
 
@@ -618,6 +834,7 @@ void
 CicoHSMenuWindow::FreeMenuWindow(void)
 {
     FreeTerminateButton();
+    FreePageCursor();
     FreePagePointer();
     FreeAppTiles();
     FreeMenuBack();
@@ -645,10 +862,11 @@ CicoHSMenuWindow::MoveToNextAnimation(void *data,double pos)
         if(menu_window_instance->menu_tile[ii] == NULL){
             continue;
         }
-        if(menu_window_instance->menu_tile[ii]->GetPage() != current_page -1){
+        if((menu_window_instance->menu_tile[ii]->GetPage() != current_page -1) || 
+           (menu_window_instance->menu_tile[ii]->GetSubPage() != 0)) {
             continue;
         }
-        
+
         menu_window_instance->menu_tile[ii]->OffsetMove(-1 * 
                               (menu_window_instance->width * frame),0);
     } 
@@ -657,7 +875,8 @@ CicoHSMenuWindow::MoveToNextAnimation(void *data,double pos)
         if(menu_window_instance->menu_tile[ii] == NULL){
             continue;
         }
-        if(menu_window_instance->menu_tile[ii]->GetPage()  != current_page){
+        if((menu_window_instance->menu_tile[ii]->GetPage() != current_page) ||
+          (menu_window_instance->menu_tile[ii]->GetSubPage() != 0)){
             continue;
         }
 
@@ -690,9 +909,11 @@ CicoHSMenuWindow::MoveToBackAnimation(void *data,double pos)
         if(menu_window_instance->menu_tile[ii] == NULL){
             continue;
         }
-        if(menu_window_instance->menu_tile[ii]->GetPage()  != current_page){
+        if((menu_window_instance->menu_tile[ii]->GetPage() != current_page) ||
+          (menu_window_instance->menu_tile[ii]->GetSubPage() != 0)){
             continue;
         }
+
         menu_window_instance->menu_tile[ii]->OffsetMove(-1 * 
                                  menu_window_instance->width + 
                                  (menu_window_instance->width * frame),0);
@@ -701,9 +922,11 @@ CicoHSMenuWindow::MoveToBackAnimation(void *data,double pos)
         if(menu_window_instance->menu_tile[ii] == NULL){
             continue;
         }
-        if(menu_window_instance->menu_tile[ii]->GetPage()  != current_page + 1){
+        if((menu_window_instance->menu_tile[ii]->GetPage()  != current_page + 1) ||
+          (menu_window_instance->menu_tile[ii]->GetSubPage()  != 0)){
             continue;
         }
+
         menu_window_instance->menu_tile[ii]->OffsetMove(menu_window_instance->width * frame,0);
     }
 
@@ -712,6 +935,107 @@ CicoHSMenuWindow::MoveToBackAnimation(void *data,double pos)
 
 /*--------------------------------------------------------------------------*/
 /**
+ * @brief   CicoHSMenuWindow::MoveToNextSubAnimation
+ *          animation parts (move to next)
+ *
+ * @param[in]   data    
+ * @param[in]   pos
+ * @return      EINA_TRUE
+ */
+/*--------------------------------------------------------------------------*/
+Eina_Bool
+CicoHSMenuWindow::MoveToNextSubAnimation(void *data,double pos)
+{
+    CicoCurrentPage *current_info;
+    double frame = ecore_animator_pos_map(pos, ECORE_POS_MAP_LINEAR, 0.5, 1);
+    current_info = (CicoCurrentPage *)(data);
+    
+    for(int ii = 0;ii < menu_window_instance->all_tile_num;ii++){
+        if(menu_window_instance->menu_tile[ii] == NULL){
+            continue;
+        }
+        if(menu_window_instance->menu_tile[ii]->GetSubPage() != current_info->subcurrent_page -1){
+            continue;
+        }
+        if(menu_window_instance->menu_tile[ii]->GetPage() != current_info->current_page){
+            continue;
+        }
+
+        menu_window_instance->menu_tile[ii]->OffsetMove(0, -1 * 
+                              (menu_window_instance->height * frame));
+    } 
+
+    for(int ii = 0;ii < menu_window_instance->all_tile_num;ii++){
+        if(menu_window_instance->menu_tile[ii] == NULL){
+            continue;
+        }
+        if(menu_window_instance->menu_tile[ii]->GetSubPage() != current_info->subcurrent_page){
+            continue;
+        }
+
+        if(menu_window_instance->menu_tile[ii]->GetPage() != current_info->current_page){
+            continue;
+        }
+
+        menu_window_instance->menu_tile[ii]->OffsetMove(0, menu_window_instance->height -
+                                   (menu_window_instance->height * frame));
+    }
+    
+    return EINA_TRUE;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::MoveToBackAnimation
+ *          animation parts (move to back)
+ *
+ * @param[in]   data    
+ * @param[in]   pos
+ * @return      EINA_TRUE
+ */
+/*--------------------------------------------------------------------------*/
+Eina_Bool
+CicoHSMenuWindow::MoveToBackSubAnimation(void *data,double pos)
+{
+
+    CicoCurrentPage *current_info;
+    double frame = ecore_animator_pos_map(pos, ECORE_POS_MAP_LINEAR, 0.5, 1);
+    current_info = (CicoCurrentPage *)(data);
+
+    for(int ii = 0;ii < menu_window_instance->all_tile_num;ii++){
+        if(menu_window_instance->menu_tile[ii] == NULL){
+            continue;
+        }
+        if(menu_window_instance->menu_tile[ii]->GetSubPage() != current_info->subcurrent_page){
+            continue;
+        }
+        if(menu_window_instance->menu_tile[ii]->GetPage() != current_info->current_page){
+            continue;
+        }
+
+        menu_window_instance->menu_tile[ii]->OffsetMove(0, -1 * 
+                                 menu_window_instance->height + 
+                                 (menu_window_instance->height * frame));
+    }
+    for(int ii = 0;ii < menu_window_instance->all_tile_num;ii++){
+        if(menu_window_instance->menu_tile[ii] == NULL){
+            continue;
+        }
+        if(menu_window_instance->menu_tile[ii]->GetSubPage() != current_info->subcurrent_page + 1){
+            continue;
+        }
+        if(menu_window_instance->menu_tile[ii]->GetPage() != current_info->current_page){
+            continue;
+        }
+
+        menu_window_instance->menu_tile[ii]->OffsetMove(0, menu_window_instance->height * frame);
+    }
+
+    return EINA_TRUE;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
  * @brief   CicoHSMenuWindow::GoNextMenu
  *          menu change to next
  *
@@ -723,17 +1047,25 @@ void
 CicoHSMenuWindow::GoNextMenu(void)
 {
     char img_path[ICO_HS_MAX_PATH_BUFF_LEN];
-    if(current_page >= all_page_num -1){
+
+    if((current_page >= all_page_num -1) || (subcurrent_page > 0)){
         return;
     }
+
     /*page pointer*/
     snprintf(img_path,sizeof(img_path),"%s%s",img_dir_path,ICO_HS_IMAGE_FILE_MENU_PAGEPOINTER_N);
     evas_object_image_file_set(page_pointer[current_page], img_path, NULL);
+
     /* increment*/
     ++current_page;
+
+    /* display cursor */
+    DspCtrlPageCursor();
+
     /*page pointer*/
     snprintf(img_path,sizeof(img_path),"%s%s",img_dir_path,ICO_HS_IMAGE_FILE_MENU_PAGEPOINTER_P);
     evas_object_image_file_set(page_pointer[current_page], img_path, NULL);
+
     /*tile*/    
     ecore_animator_frametime_set(1.0f / 30);
     ecore_animator_timeline_add(0.4, MoveToNextAnimation,
@@ -755,21 +1087,192 @@ CicoHSMenuWindow::GoBackMenu(void)
 {
     char img_path[ICO_HS_MAX_PATH_BUFF_LEN];
 
-    if(current_page <= 0){
+    if((current_page <= 0) || (subcurrent_page > 0)){
         return;
     }
+
     /*page pointer*/
     snprintf(img_path,sizeof(img_path),"%s%s",img_dir_path,ICO_HS_IMAGE_FILE_MENU_PAGEPOINTER_N);
     evas_object_image_file_set(page_pointer[current_page], img_path, NULL);
+
     /*decrement*/
     --current_page; 
+
+    /* display cursor */
+    DspCtrlPageCursor();
+
     /*page pointer*/
     snprintf(img_path,sizeof(img_path),"%s%s",img_dir_path,ICO_HS_IMAGE_FILE_MENU_PAGEPOINTER_P);
     evas_object_image_file_set(page_pointer[current_page], img_path, NULL);
+
     /*tile*/    
     ecore_animator_frametime_set(1.0f / 30);
     ecore_animator_timeline_add(0.4, MoveToBackAnimation,
                                 reinterpret_cast<void*>(current_page));
+
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::DownNextMenu
+ *          menu change to next
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuWindow::DownNextMenu(void)
+{
+    for (int i = 0; i < all_category_num; i++) {
+        if (category_info[i].tile_num > 0) {
+            if (current_page == category_info[i].page) {
+                if (subcurrent_page >= category_info[i].subpage_max){
+                    return;
+                }
+            }
+        }
+    }
+
+    /* increment*/
+    ++subcurrent_page;
+
+    /* display cursor */
+    DspCtrlPageCursor();
+
+    /* current page set */
+    current_info.current_page = current_page;
+    current_info.subcurrent_page = subcurrent_page;
+
+    /*tile*/    
+    ecore_animator_frametime_set(1.0f / 30);
+    ecore_animator_timeline_add(0.4, MoveToNextSubAnimation,
+                                (void*)(&current_info));
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::UpBackMenu
+ *          menu change to back
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuWindow::UpBackMenu(void)
+{
+    if(subcurrent_page <= 0){
+        return;
+    }
+
+    /*decrement*/
+    --subcurrent_page;
+
+    /* display cursor */
+    DspCtrlPageCursor();
+
+    /* current page set */
+    current_info.current_page = current_page;
+    current_info.subcurrent_page = subcurrent_page;
+
+    /*tile*/
+    ecore_animator_frametime_set(1.0f / 30);
+    ecore_animator_timeline_add(0.4, MoveToBackSubAnimation,
+                                (void*)(&current_info));
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::DspCtrlPageCursor
+ *          display control page cursor
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuWindow::DspCtrlPageCursor(void)
+{
+    int subpage_max = 0;
+    for (int i = 0; i < all_category_num ; i++) {
+        if (category_info[i].tile_num > 0) {
+            if (current_page == category_info[i].page) {
+                subpage_max = category_info[i].subpage_max;
+                break;
+            }
+        }
+    }
+    
+    if (subcurrent_page > 0) {
+        evas_object_show(page_up_cursor);
+    }
+    else {
+        evas_object_hide(page_up_cursor);
+    }
+
+    if (subcurrent_page < subpage_max) {
+        evas_object_show(page_down_cursor);
+    }
+    else {
+        evas_object_hide(page_down_cursor);
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::SetCategoryInfo
+ *          set category info
+ *
+ * @param[in]         id         menu category id
+ * @return            none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuWindow::SetCategoryInfo(int id)
+{
+    for (int i = 0; i < all_category_num ; i++) {
+        if (category_info[i].id == id) {
+            /* sub page max */
+            category_info[i].subpage_max = 
+                category_info[i].tile_num / ICO_HS_MENUTILE_NUM;
+
+            /* tile num */
+            category_info[i].tile_num++;
+        }
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::GetTileInfo
+ *          get tile info
+ *
+ * @param[in]       id         menu category id
+ * @param[out]      page       menu page
+ * @param[out]      subpage    menu sub page
+ * @param[out]      position   menu tile position
+ * @return          none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuWindow::GetTileInfo(int id, int *page, int *subpage, int *position)
+{
+    for (int i = 0; i < all_category_num ; i++) {
+        if (category_info[i].id == id) {
+            if (category_info[i].tile_num == 0) {
+                ICO_ERR("CicoHSMenuWindow::GetTileInfo: number of tiles is 0.");
+                return;
+            }
+
+            /* page */
+            *page = category_info[i].page;
+            /* sub page */      
+            *subpage = (category_info[i].tile_num -1) / ICO_HS_MENUTILE_NUM; 
+            /* pasition */
+            *position = (category_info[i].tile_num -1) % ICO_HS_MENUTILE_NUM;
+        }
+    }
 }
 
 /*--------------------------------------------------------------------------*/
@@ -800,12 +1303,23 @@ CicoHSMenuWindow::SetMenuWindowID(const char *appid,int surface)
 void
 CicoHSMenuWindow::Show(ico_syc_animation_t *animation)
 {
-       // if regulation == true, forbid show window.
+    ICO_DBG("CicoHSMenuWindow::Show Enter");
+
+    // if regulation == true, forbid show window.
     if (true == CicoHSSystemState::getInstance()->getRegulation()) {
-               return;
-       }
-       m_showState = true;
+        return;
+    }
+    m_showState = true;
+
+    if (true == life_cycle_controller->isAilRenew()) {
+        ICO_DBG("CicoHSMenuWindow::Show : renew app tiles");
+        RenewAppTiles();
+        life_cycle_controller->ailRenewFlagOff();
+    }
+
     ico_syc_show(appid,surface,animation);
+
+    ICO_DBG("CicoHSMenuWindow::Show Leave");
 }
 
 /*--------------------------------------------------------------------------*/
@@ -823,7 +1337,7 @@ CicoHSMenuWindow::Hide(ico_syc_animation_t *animation)
     if(terminate_mode == true){
         ChangeNormalMode();
     }
-       m_showState = false;
+    m_showState = false;
     ico_syc_hide(appid,surface,animation);
 }
 /*--------------------------------------------------------------------------*/
@@ -997,18 +1511,13 @@ CicoHSMenuWindow::SetThumbnail(const char *appid,int surface)
 void
 CicoHSMenuWindow::SetNightMode(void)
 {
-    ICO_DBG("CicoHSControlBarWindow::SetNightMode Enter");
+    ICO_DBG("CicoHSMenuWindow::SetNightMode Enter");
     if (true == CicoHSSystemState::getInstance()->getNightMode()) {
-               evas_object_color_set(rectangle,0,0,0,178); 
-       }
-       else {
-               evas_object_color_set(rectangle,120,120,120,178); 
-       }
-
-       // redraw
-       if (true == m_showState) {
-               Hide(NULL);
-               Show(NULL);
-       }
-    ICO_DBG("CicoHSControlBarWindow::SetNightMode Leave");
+        evas_object_color_set(rectangle,0,0,0,178); 
+    }
+    else {
+        evas_object_color_set(rectangle,120,120,120,178); 
+    }
+    ICO_DBG("CicoHSMenuWindow::SetNightMode Leave");
 }
+
index 78dee0c..e013d49 100644 (file)
 #define ICO_HS_MENU_PAGE_POINTER_WIDTH 64
 #define ICO_HS_MENU_PAGE_POINTER_HEIGHT 64
 
+#define ICO_HS_MENU_PAGE_UP_CURSOR_START_POS_X 50
+#define ICO_HS_MENU_PAGE_UP_CURSOR_START_POS_Y 50
+#define ICO_HS_MENU_PAGE_UP_CURSOR_WIDTH 64
+#define ICO_HS_MENU_PAGE_UP_CURSOR_HEIGHT 64
+
+#define ICO_HS_MENU_PAGE_DOWN_CURSOR_START_POS_X 50
+#define ICO_HS_MENU_PAGE_DOWN_CURSOR_START_POS_Y 1630
+#define ICO_HS_MENU_PAGE_DOWN_CURSOR_WIDTH 64
+#define ICO_HS_MENU_PAGE_DOWN_CURSOR_HEIGHT 64
+
 #define ICO_HS_MENU_HIDE_ANIMATION_SLIDE "Slide"
 #define ICO_HS_MENU_SHOW_ANIMATION_SLIDE "Slide"
 #define ICO_HS_MENU_HIDE_ANIMATION_FADE "Fade"
 #define ICO_HS_MENU_SHOW_ANIMATION_FADE "Fade"
-#define ICO_HS_MENU_ANIMATION_DURATION 200
+#define ICO_HS_MENU_ANIMATION_DURATION 300
+
+#define ICO_HS_MENU_OTHER_CATEGORY_ID -1
+
+/* Layer */
+#define ICO_HS_MENU_TERMINATE_BUTTON_LAYER 5
 
 typedef struct _CicoLayoutInfo{
    int appidx;
@@ -59,6 +74,18 @@ typedef struct _CicoLayoutInfo{
    int tile_height;
 }CicoLayoutInfo;
 
+typedef struct _CicoCurrentPage{
+    int current_page;
+    int subcurrent_page;
+}CicoCurrentPage;
+
+typedef struct _CicoCategoryInfo {
+    int id;
+    int page;
+    int subpage_max;
+    int tile_num;
+}CicoCategoryInfo;
+
 class CicoHSMenuWindow :public CicoHSWindow
 {
   public:
@@ -89,23 +116,40 @@ class CicoHSMenuWindow :public CicoHSWindow
     static Eina_Bool MoveDownAnimation(void *data,double pos);
     static Eina_Bool MoveUpAnimation(void *data,double pos);
     
-       void SetNightMode(void);
+    void SetNightMode(void);
+
+    void DspCtrlPageCursor(void);
+    void DownNextMenu(void);
+    void UpBackMenu(void);
+    static Eina_Bool MoveToNextSubAnimation(void *data,double pos);
+    static Eina_Bool MoveToBackSubAnimation(void *data,double pos);
 
   private:
     int SetMenuBack(void);
     void FreeMenuBack(void);
+    void InitAppTiles(void);
     int SetAppTiles(void);
     void FreeAppTiles(void);
+    void RenewAppTiles(void);
     int SetPagePointer(void);
     void FreePagePointer(void);
+    int SetPageCursor(void);
+    void FreePageCursor(void);
     int SetTerminateButton(void);
     void FreeTerminateButton(void);
     void GetLayout(const char *filename,CicoLayoutInfo *layout,int *num);
     void SetLayout(const char *filename,CicoLayoutInfo *layout,int num);
+    void GetCategory(const char *filename,int *category,int *num);
+    void SetCategoryInfo(int id);
+    void GetTileInfo(int id, int *page, int *subpage, int *position);
 
     bool terminate_mode;
     /*for menu control*/
     int current_page;
+    int subcurrent_page;
+    CicoCurrentPage current_info;
+    CicoCategoryInfo category_info[ICO_HS_MENU_MAX_MENU_CATEGORY_NUM];
+    int all_category_num;
     int all_tile_num;
     int all_page_num;
     /* image directory path */
@@ -119,6 +163,9 @@ class CicoHSMenuWindow :public CicoHSWindow
     CicoHSMenuTile *menu_tile[ICO_HS_MENU_MAX_TILE_NUM];
     /* Page pointer */
     Evas_Object *page_pointer[ICO_HS_MENU_MAX_MENU_PAGE_NUM]; 
+    /* Page cursor */
+    Evas_Object *page_up_cursor; 
+    Evas_Object *page_down_cursor; 
     /* for window control */
     char appid[ICO_HS_MAX_PROCESS_NAME];
     int surface;
@@ -131,7 +178,7 @@ class CicoHSMenuWindow :public CicoHSWindow
     CicoSCLifeCycleController *life_cycle_controller;
     /* my instance (for callback) */
     static CicoHSMenuWindow *menu_window_instance;
-       bool m_showState;
+    bool m_showState;
 
   protected:
     CicoHSMenuWindow operator=(const CicoHSMenuWindow&);
index f981c96..1beb633 100644 (file)
@@ -38,7 +38,7 @@ class CicoHSWindow
 {
   public:
     CicoHSWindow(void);
-    ~CicoHSWindow(void);
+    virtual ~CicoHSWindow(void);
     int CreateWindow(const char *title,int pos_x,int pos_y,int width,int height,int alpha);
     void FreeWindow(void);
     void WindowSetting(int pos_x,int pos_y,int width,int height,int alpha);
index d9e1678..57e42e6 100644 (file)
  */
 #include "CicoHSWindowController.h"
 
+Ecore_Evas *CicoHSWindowController::ms_ecoreEvas = NULL;
+
 /*============================================================================*/
 /* functions                                                                  */
 /*============================================================================*/
 /*--------------------------------------------------------------------------*/
 /**
+ * @brief   CicoHSWindowController::CicoHSWindowController
+ *          Constructor
+ */
+/*--------------------------------------------------------------------------*/
+CicoHSWindowController::CicoHSWindowController()
+{
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSWindowController::CicoHSWindowController
+ *          Destructor
+ */
+/*--------------------------------------------------------------------------*/
+CicoHSWindowController::~CicoHSWindowController()
+{
+}
+
+/*--------------------------------------------------------------------------*/
+/**
  * @brief   CicoHSWindowController::Initialize
  *          Initialize
  *
@@ -63,20 +85,23 @@ CicoHSWindowController::Finalize(void)
  */
 /*--------------------------------------------------------------------------*/
 void
-CicoHSWindowController::GetFullScreenSize(int orientation,int *width,int *height)
+CicoHSWindowController::GetFullScreenSize(int orientation,
+                                          int *width, int *height)
 {
-    int display_width, display_height;
-    Ecore_Evas *window;
-    ICO_DBG("CicoHSWindowController::GetFullScreenSize:ecore_evas_new start");
-    window = ecore_evas_new(NULL,0,0,1,1,"frame=0");
-    ICO_DBG("CicoHSWindowController::GetFullScreenSize: ecore_evas_new return 0x%x",window);
-    /* processing one cycle */
-//    ecore_main_loop_iterate();
+    ICO_DBG("CicoHSWindowController::GetFullScreenSize Enter");
+
+    int display_width  = 0;
+    int display_height = 0;
+
+    ms_ecoreEvas = ecore_evas_new(NULL, 0, 0, 1, 1, "frame=0");
 
     /* getting size of screen */
     /* home screen size is full of display*/
-    
     ecore_wl_screen_size_get(&display_width, &display_height);
+
+    ICO_DBG("ecore_wl_screen_size_get => w/h=%d/%d",
+            display_width, display_height);
+
     if (orientation == ICO_ORIENTATION_VERTICAL) {
         *width = display_width > display_height ?
                                  display_height : display_width;
@@ -89,6 +114,9 @@ CicoHSWindowController::GetFullScreenSize(int orientation,int *width,int *height
         *height = (display_width < display_height ?
                                    display_width : display_height);
     }
+
+    ICO_DBG("CicoHSWindowController::GetFullScreenSize Leave(w/h=%d/%d)",
+            *width, *height);
 }
 
 /*--------------------------------------------------------------------------*/
index ad023b5..e3524d5 100644 (file)
 class CicoHSWindowController
 {
   public:
+    CicoHSWindowController();
+    ~CicoHSWindowController();
     static void Initialize(void);
     static void Finalize(void);
     static void GetFullScreenSize(int orientation,int *width,int *height);
     static void StartEcoreLoop(void);
     static void QuitEcoreLoop(void);
-  private:
+
   protected:
     CicoHSWindowController operator=(const CicoHSWindowController&);
     CicoHSWindowController(const CicoHSWindowController&);
+  private:
+    static Ecore_Evas *ms_ecoreEvas;
 };
 
 #endif
index de17e7f..94018b7 100644 (file)
  *
  * @date    Aug-08-2013
  */
+#include <string>
+#include <vector>
+#include <cstdlib>
+#include "CicoHSAppHistory.h"
+#include "CicoHSAppHistoryExt.h"
 #include "CicoHomeScreen.h"
 #include "CicoHSSystemState.h"
+#include "CicoSCLifeCycleController.h"
+#include "CicoSCConf.h"
+
+using namespace std;
 
 /*============================================================================*/
 /* static members                                                             */
@@ -22,6 +31,26 @@ CicoHomeScreen * CicoHomeScreen::hs_instance;
 /*============================================================================*/
 /* functions                                                                  */
 /*============================================================================*/
+/**
+ * @brief split string
+ * @param s split target
+ * @param d
+ * @param e store split word
+ */
+#if 1
+void split(const string &s, char d, vector<string> &e);
+#else
+void split(const string &s, char d, vector<string> &e)
+{
+    stringstream ss(s);
+    string it;
+    while (getline(ss, it, d)) {
+        e.push_back(it);
+    }
+    return;
+}
+#endif
+
 /*--------------------------------------------------------------------------*/
 /**
  * @brief   CicoHomeScreen::CicoHomeScreen
@@ -37,11 +66,12 @@ CicoHomeScreen::CicoHomeScreen(void)
     for(int ii = 0;ii < ICO_HS_MAX_APP_NUM;ii++){
         apps_info[ii] = NULL;
     }
+    active_appinfo = NULL;
 
     hs_app_info = NULL;
     sb_app_info = NULL;
     os_app_info = NULL;
+
     full_width = 1;
     full_height = 1;
     menu_width = 1;
@@ -50,6 +80,7 @@ CicoHomeScreen::CicoHomeScreen(void)
     bg_height = 1;
     ctl_bar_width = 1;
     ctl_bar_height = 1;
+    num_flick_input_windows = 0;
 
     menu_window = NULL;
     back_window = NULL;
@@ -60,6 +91,11 @@ CicoHomeScreen::CicoHomeScreen(void)
     config = NULL;
     hs_instance = NULL;
 
+    m_appHis = NULL;
+
+    life_cycle_controller = CicoSCLifeCycleController::getInstance();
+
+    sub_display_appinfo = NULL;
 }
 
 /*--------------------------------------------------------------------------*/
@@ -74,6 +110,9 @@ CicoHomeScreen::CicoHomeScreen(void)
 CicoHomeScreen::~CicoHomeScreen(void)
 {
     /* Do not somthing to do */
+    if (NULL != m_appHis) {
+        delete m_appHis;
+    }
 }
 
 /*--------------------------------------------------------------------------*/
@@ -154,17 +193,17 @@ CicoHomeScreen::CreateAppInfoList(void)
     /* get APP information*/
     std::vector<CicoSCAilItems> aillist = life_cycle_controller->getAilList();
 
-    for(int ii = 0; ii < ICO_HS_MAX_APP_NUM; ii++) {
-        if(apps_info[ii] != NULL){
+    for (int ii = 0; ii < ICO_HS_MAX_APP_NUM; ii++) {
+        if (apps_info[ii] != NULL)  {
             delete apps_info[ii];
         }
     }
 
     /*create instance*/
     application_num = 0;
-    for(unsigned int ii = 0; 
-        (ii < aillist.size()) && (ii < ICO_HS_MAX_APP_NUM);
-        ii++) {
+    for (unsigned int ii = 0;
+         (ii < aillist.size()) && (ii < ICO_HS_MAX_APP_NUM);
+         ii++)  {
         apps_info[ii] = new CicoHSAppInfo(aillist[ii].m_appid.c_str());
         application_num++;
     }
@@ -182,9 +221,13 @@ CicoHomeScreen::CreateAppInfoList(void)
 CicoHSAppInfo *
 CicoHomeScreen::GetAppInfo(const char *appid)
 {
-    for(int ii = 0;ii < application_num;ii++){
-        if(strcmp(apps_info[ii]->GetAppId(),appid) == 0){
-            return apps_info[ii];
+    if (NULL == appid) {
+        return NULL;
+    }
+
+    for (int ii = 0;ii < hs_instance->application_num;ii++) {
+        if (strcmp(hs_instance->apps_info[ii]->GetAppId(),appid) == 0)   {
+            return hs_instance->apps_info[ii];
         }
     }
     return NULL;
@@ -202,8 +245,8 @@ CicoHomeScreen::GetAppInfo(const char *appid)
 bool
 CicoHomeScreen::GetAppStatus(const char *appid)
 {
-    for(int ii = 0;ii < hs_instance->application_num;ii++){
-        if(strcmp(hs_instance->apps_info[ii]->GetAppId(),appid) == 0){
+    for (int ii = 0;ii < hs_instance->application_num;ii++) {
+        if (strcmp(hs_instance->apps_info[ii]->GetAppId(),appid) == 0)  {
             return hs_instance->apps_info[ii]->GetStatus();
         }
     }
@@ -212,8 +255,93 @@ CicoHomeScreen::GetAppStatus(const char *appid)
 
 /*--------------------------------------------------------------------------*/
 /**
+ * @brief   change active window
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::ChangeActive(const char * appid, int surface)
+{
+    CicoHSAppInfo *appinfo = hs_instance->GetAppInfo(appid);
+    if (appinfo == NULL)    {
+        return;
+    }
+    appinfo->SetLastSurface(surface);
+
+    // if window invisible, not update active information
+    ico_hs_window_info* wininfo = appinfo->GetWindowInfobySurface(surface);
+    if (0 != wininfo->visible) {
+        hs_instance->SetActiveAppInfo(appid);
+        hs_instance->setActiveApp(appid);
+        ico_syc_change_active(appid, surface);
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   change application display zone for active window 
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::ChangeZone(void)
+{
+    ICO_TRA("CicoHomeScreen::ChangeZone Enter");
+
+    CicoHSAppInfo* appinfo = hs_instance->GetSubDisplayAppInfo();
+    // if sub display not exist showed appliction,
+    // get main display showed application informaiton
+    if (NULL == appinfo) {
+        appinfo = hs_instance->GetActiveAppInfo();
+        if (NULL == appinfo) {
+            ICO_TRA("CicoHomeScreen::ChangeZone Leave(not found appinfo)");
+            return;
+        }
+    }
+
+    int surface = appinfo->GetLastSurface();
+    ICO_TRA("appid=%s, lastsurface=%d",
+            appinfo->GetAppId(), appinfo->GetLastSurface());
+    ico_hs_window_info* wininfo = appinfo->GetWindowInfobySurface(surface);
+    if (NULL == wininfo) {
+        ICO_TRA("CicoHomeScreen::ChangeZone Leave(not found wininfo)");
+        return;
+    }
+    ICO_DBG("wininfo=%p", wininfo);
+
+    const char *dispzone = hs_instance->moveZoneName;
+    if (NULL != hs_instance->GetSubDisplayAppInfo()) {
+        dispzone = appinfo->GetDefaultZone();
+    }
+
+    if (NULL == dispzone) {
+        return;
+    }
+
+    ICO_DBG("change zone: \"%s\"->\"%s\"", wininfo->zone, dispzone);
+    ico_syc_win_move_t move = {
+        .zone   = (char*)dispzone,
+        .pos_x  = 0,
+        .pos_y  = 0,
+        .width  = 0,
+        .height = 0
+    };
+    ico_syc_move(wininfo->appid, wininfo->surface, &move,
+                 &hs_instance->moveZoneAnimation);
+
+    if (NULL != hs_instance->GetSubDisplayAppInfo()) {
+        hs_instance->SetSubDisplayAppInfo(NULL);
+        hs_instance->ChangeActive(wininfo->appid, wininfo->surface);
+    }
+    else {
+        hs_instance->SetSubDisplayAppInfo(wininfo->appid);
+    }
+    ICO_TRA("CicoHomeScreen::ChangeZone Leave");
+}
+
+/*--------------------------------------------------------------------------*/
+/**
  * @brief   CicoHomeScreen::GetWindowInfo
- *          get window info 
+ *          get window info
  *
  * @param[in]   appinfo    application info
  * @param[in]   window    window name
@@ -228,6 +356,22 @@ CicoHomeScreen::GetWindowInfo(CicoHSAppInfo *appinfo,const char *window)
 
 /*--------------------------------------------------------------------------*/
 /**
+ * @brief   CicoHomeScreen::GetWindowInfo
+ *          get window info 
+ *
+ * @param[in]   appinfo    application info
+ * @param[in]   surface    surface id
+ * @return      Window info
+ */
+/*--------------------------------------------------------------------------*/
+ico_hs_window_info *
+CicoHomeScreen::GetWindowInfo(CicoHSAppInfo *appinfo, int surface)
+{
+    return appinfo->GetWindowInfobySurface(surface);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
  * @brief   CicoHomeScreen::UpdateTile
  *          update tile image
  *
@@ -239,22 +383,128 @@ void
 CicoHomeScreen::UpdateTile(const char *appid)
 {
     CicoHSAppInfo *appinfo = GetAppInfo(appid);
-    if(appinfo == NULL){
+    if (appinfo == NULL)    {
         return;
     }
-    if(appinfo->GetStatus() == false){
+    if (appinfo->GetStatus() == false)  {
         //show icon
         menu_window->ValidMenuIcon(appid);
         ICO_DBG("CicoHomeScreen::UpdateTile: show menuIcon %s",appid);
-    }else{
+    }
+    else    {
         //show thumbnail
         menu_window->ValidThumbnail(appid,appinfo->GetLastSurface());
-        ICO_DBG("CicoHomeScreen::ExecuteApp_i: raise app %s",appid);
+        ICO_DBG("CicoHomeScreen::UpdateTile: raise app %s",appid);
     }
 }
 
 /*--------------------------------------------------------------------------*/
 /**
+ *  @brief  set current active application information
+ *
+ *  @param [in] appid    application id
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::SetActiveAppInfo(const char *appid)
+{
+    CicoHSAppInfo* appinfo = NULL;
+    if (NULL != appid) {
+        appinfo = GetAppInfo(appid);
+
+        // if active window is HomeScreen/StatusBar/OnScreen,
+        // not update active application information
+        ICO_DBG("appinfo=%08x hs_app_info=%08x sb_app_info=%08x os_app_info=%08x",
+                appinfo, hs_app_info, sb_app_info, os_app_info);
+        if ((appinfo == hs_app_info) ||
+            (appinfo == sb_app_info) ||
+            (appinfo == os_app_info)) {
+            return;
+        }
+    }
+
+    ICO_DBG("active application changed. \"%s\"->\"%s\"",
+            active_appinfo ? active_appinfo->GetAppId() : "unknown",
+            appinfo ? appinfo->GetAppId() : "unknown");
+    active_appinfo = appinfo;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ *  @brief  update current active application information
+ *
+ *  @param [in] appid    application id
+ */
+/*--------------------------------------------------------------------------*/
+CicoHSAppInfo *
+CicoHomeScreen::GetActiveAppInfo(void)
+{
+    return active_appinfo;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ *  @brief  set current sub display application information
+ *
+ *  @param [in] appid    application id
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::SetSubDisplayAppInfo(const char *appid)
+{
+    if (NULL == appid) {
+        if (NULL == sub_display_appinfo) {
+            ICO_WRN("already not use");
+            return;
+        }
+        ICO_DBG("sub display appinfo changed. \"%s\"->\"none\"",
+                sub_display_appinfo->GetAppId());
+        sub_display_appinfo = NULL;
+        return;
+    }
+
+    // if sub_display_appinfo is not NULL,
+    // not update sub display application information
+    if (NULL != sub_display_appinfo) {
+        ICO_WRN("sub display use. appid=%s",
+                sub_display_appinfo->GetAppId());
+        return;
+    }
+
+    CicoHSAppInfo* appinfo = GetAppInfo(appid);
+
+    // if sub display appinfo is HomeScreen/StatusBar/OnScreen,
+    // not update sub display application information
+    ICO_DBG("appinfo=%08x hs_app_info=%08x sb_app_info=%08x os_app_info=%08x",
+            appinfo, hs_app_info, sb_app_info, os_app_info);
+    if ((appinfo == hs_app_info) ||
+        (appinfo == sb_app_info) ||
+        (appinfo == os_app_info)) {
+        return;
+    }
+
+    if (NULL != appinfo) {
+        ICO_DBG("sub display appinfo changed. \"none\"->\"%s\"",
+                appinfo->GetAppId());
+        sub_display_appinfo = appinfo;
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ *  @brief  update current sub display application information
+ *
+ *  @param [in] appid    application id
+ */
+/*--------------------------------------------------------------------------*/
+CicoHSAppInfo *
+CicoHomeScreen::GetSubDisplayAppInfo(void)
+{
+    return sub_display_appinfo;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
  * @brief   CicoHomeScreen::ExecuteApp_i
  *          execute and showing application
  *
@@ -266,21 +516,23 @@ void
 CicoHomeScreen::ExecuteApp_i(const char *appid)
 {
     CicoHSAppInfo *appinfo = GetAppInfo(appid);
-    if(appinfo == NULL){
+    if (appinfo == NULL)    {
         return;
     }
 
-    if(appinfo->GetStatus() == false){
+    if (appinfo->GetStatus() == false)  {
         //execute
         appinfo->Execute();
         ICO_DBG("CicoHomeScreen::ExecuteApp_i: execute app %s",appid);
-    }else{
+    }
+    else    {
         //raise
         RaiseApplicationWindow(appinfo->GetAppId(),appinfo->GetLastSurface());
         ICO_DBG("CicoHomeScreen::ExecuteApp_i: raise app %s",appid);
+        m_appHis->moveHistoryHead(appid);
     }
     /* hide HomeScreen layer                        */
-    if(GetMode() == ICO_HS_MODE_MENU){
+    if (GetMode() == ICO_HS_MODE_MENU)  {
         ChangeMode(ICO_HS_SHOW_HIDE_PATTERN_FADE);
     }
 }
@@ -297,9 +549,9 @@ CicoHomeScreen::ExecuteApp_i(const char *appid)
 void
 CicoHomeScreen::TerminateApp_i(const char *appid)
 {
-    if(appid != NULL){
+    if (appid != NULL)  {
         CicoHSAppInfo *appinfo = GetAppInfo(appid);
-        if(appinfo == NULL){
+        if (appinfo == NULL)    {
             return;
         }
 
@@ -307,7 +559,7 @@ CicoHomeScreen::TerminateApp_i(const char *appid)
         appinfo->Terminate();
     }
     /* hide HomeScreen layer                        */
-    if(GetMode() == ICO_HS_MODE_MENU){
+    if (GetMode() == ICO_HS_MODE_MENU)  {
         ChangeMode(ICO_HS_SHOW_HIDE_PATTERN_FADE);
     }
 }
@@ -317,55 +569,56 @@ CicoHomeScreen::TerminateApp_i(const char *appid)
  * @brief   CicoHomeScreen::ShowHomeScreenWindow
  *          show window (home screen)
  *
- * @param[in]   win attr    window attribute
+ * @param[in]   win info    window information
  * @return      none
  */
 /*--------------------------------------------------------------------------*/
 void
-CicoHomeScreen::ShowHomeScreenWindow(ico_syc_win_attr_t *win_attr)
+CicoHomeScreen::ShowHomeScreenWindow(ico_syc_win_info_t *win_info)
 {
     ico_syc_win_move_t move;
     int layer;
     move.zone = NULL;
     move.pos_x = 0;
     move.width = full_width;
-  
-    if(strncmp(win_attr->name,ICO_HS_BACK_WINDOW_TITLE,
+
+    if(strncmp(win_info->name,ICO_HS_BACK_WINDOW_TITLE,
                ICO_MAX_TITLE_NAME_LEN) == 0){
         move.pos_y = ICO_HS_STATUSBAR_WINDOW_HEIGHT;
         move.height = full_height - ICO_HS_STATUSBAR_WINDOW_HEIGHT -
                       ICO_HS_CONTROLBAR_WINDOW_HEIGHT;
         layer = HS_LAYER_BACKGROUND;
-    }else if(strncmp(win_attr->name,ICO_HS_CONTROL_BAR_WINDOW_TITLE,
+    }else if(strncmp(win_info->name,ICO_HS_CONTROL_BAR_WINDOW_TITLE,
              ICO_MAX_TITLE_NAME_LEN) == 0){
         move.pos_y = full_height - ICO_HS_CONTROLBAR_WINDOW_HEIGHT;
         move.height = ICO_HS_CONTROLBAR_WINDOW_HEIGHT;
         layer = HS_LAYER_TOUCH;
-    }else if(strncmp(win_attr->name,ICO_HS_MENU_WINDOW_TITLE,
+    }else if(strncmp(win_info->name,ICO_HS_MENU_WINDOW_TITLE,
              ICO_MAX_TITLE_NAME_LEN) == 0){
         move.pos_y = ICO_HS_STATUSBAR_WINDOW_HEIGHT;
-        move.height = full_height - ICO_HS_STATUSBAR_WINDOW_HEIGHT - 
+        move.height = full_height - ICO_HS_STATUSBAR_WINDOW_HEIGHT -
                       ICO_HS_CONTROLBAR_WINDOW_HEIGHT;
         layer = HS_LAYER_HOMESCREEN;
-    }else{
+    }
+    else    {
         /*do nothing*/
         return;
     }
 
-    ico_syc_change_layer(win_attr->appid,win_attr->surface,layer);
-    ICO_DBG("CicoHomeScreen::ShowHomeScreenWindow: id(%s) name(%s) surface(%d) pos(%d,%d) size(%d,%d)",win_attr->appid,
-            win_attr->name,win_attr->surface,move.pos_x,move.pos_y,
+    ico_syc_change_layer(win_info->appid,win_info->surface,layer);
+    ICO_DBG("CicoHomeScreen::ShowHomeScreenWindow: id(%s) name(%s) surface(%d) pos(%d,%d) size(%d,%d)",win_info->appid,
+            win_info->name,win_info->surface,move.pos_x,move.pos_y,
             move.width,move.height);
-    ico_syc_move(win_attr->appid,win_attr->surface,&move,NULL);
+    ico_syc_move(win_info->appid,win_info->surface,&move,NULL);
     
     /*first time menu is unvisible*/
-    if((strncmp(win_attr->name,ICO_HS_MENU_WINDOW_TITLE,
+    if((strncmp(win_info->name,ICO_HS_MENU_WINDOW_TITLE,
              ICO_MAX_TITLE_NAME_LEN) == 0) && 
        (GetMode() == ICO_HS_MODE_APPLICATION)){
         return;
     }
 
-    ico_syc_show(win_attr->appid, win_attr->surface,NULL);
+    ico_syc_show(win_info->appid, win_info->surface,NULL);
 }
 
 /*--------------------------------------------------------------------------*/
@@ -373,12 +626,12 @@ CicoHomeScreen::ShowHomeScreenWindow(ico_syc_win_attr_t *win_attr)
  * @brief   CicoHomeScreen::ShowStatusBarWindow
  *          show window (home screen)
  *
- * @param[in]   win attr    window attribute
+ * @param[in]   win info    window information
  * @return      none
  */
 /*--------------------------------------------------------------------------*/
 void
-CicoHomeScreen::ShowStatusBarWindow(ico_syc_win_attr_t *win_attr)
+CicoHomeScreen::ShowStatusBarWindow(ico_syc_win_info_t *win_info)
 {
     ico_syc_win_move_t move;
     int layer;
@@ -389,29 +642,54 @@ CicoHomeScreen::ShowStatusBarWindow(ico_syc_win_attr_t *win_attr)
     move.height = ICO_HS_STATUSBAR_WINDOW_HEIGHT;
     layer = HS_LAYER_HOMESCREEN;
 
-    ico_syc_change_layer(win_attr->appid,win_attr->surface,layer);
-    ICO_DBG("CicoHomeScreen::ShowStatusBarWindow: id(%s) name(%s) surface(%d) pos(%d,%d) size(%d,%d)",win_attr->appid,
-            win_attr->name,win_attr->surface,move.pos_x,move.pos_y,
+    ico_syc_change_layer(win_info->appid,win_info->surface,layer);
+    ICO_DBG("CicoHomeScreen::ShowStatusBarWindow: id(%s) name(%s) surface(%d) "
+            "pos(%d,%d) size(%d,%d)",win_info->appid,
+            win_info->name,win_info->surface,move.pos_x,move.pos_y,
             move.width,move.height);
-    ico_syc_move(win_attr->appid,win_attr->surface,&move,NULL);
-    ico_syc_show(win_attr->appid, win_attr->surface,NULL);
+    ico_syc_move(win_info->appid,win_info->surface,&move,NULL);
+    ico_syc_show(win_info->appid, win_info->surface,NULL);
 }
+
 /*--------------------------------------------------------------------------*/
 /**
  * @brief   CicoHomeScreen::ShowApplicationWindow
  *          show window (application)
  *
- * @param[in]   win attr    window attribute
+ * @param[in]   win info    window information
  * @return      none
  */
 /*--------------------------------------------------------------------------*/
 void
-CicoHomeScreen::ShowApplicationWindow(ico_syc_win_attr_t *win_attr)
+CicoHomeScreen::ShowApplicationWindow(ico_syc_win_info_t *win_info)
 {
+    ICO_DBG("CicoHomeScreen::ShowApplicationWindow Enter");
+
+    CicoSCLifeCycleController *lifecycle =
+        CicoSCLifeCycleController::getInstance();
+    const CicoSCAilItems* ailItem = lifecycle->findAIL(win_info->appid);
+    if (NULL == ailItem) {
+        ICO_WRN("ailItem not found.");
+        ICO_DBG("CicoHomeScreen::ShowApplicationWindow Leave");
+        return;
+    }
+    int zoneid = ailItem->m_displayZone;
+
+    ICO_DBG("zoneid=%d", zoneid);
+    const CicoSCDisplayZoneConf* dispZoneConf =
+        CicoSCSystemConfig::getInstance()->findDisplayZoneConfbyId(zoneid);
+    if (NULL == dispZoneConf) {
+        ICO_WRN("display zone config not found.");
+        ICO_DBG("CicoHomeScreen::ShowApplicationWindow Leave");
+        return;
+    }
+    ICO_DBG("appid=%s zoneid=%d:%s",
+            win_info->appid, zoneid, dispZoneConf->fullname.c_str());
 
     ico_syc_win_move_t move;
     int layer;
-    move.zone = 0;
+
+    move.zone = (char*)dispZoneConf->fullname.c_str();
     move.pos_x = 0;
     move.width = full_width;
     move.pos_y = ICO_HS_STATUSBAR_WINDOW_HEIGHT;
@@ -419,10 +697,31 @@ CicoHomeScreen::ShowApplicationWindow(ico_syc_win_attr_t *win_attr)
                   ICO_HS_CONTROLBAR_WINDOW_HEIGHT;
     layer = HS_LAYER_APPLICATION;
     
-    ico_syc_change_layer(win_attr->appid,win_attr->surface,layer);
-    ico_syc_move(win_attr->appid,win_attr->surface,&move,NULL);
-    ico_syc_show(win_attr->appid, win_attr->surface,NULL);
+    ico_syc_change_layer(win_info->appid,win_info->surface,layer);
+    ico_syc_move(win_info->appid,win_info->surface,&move,NULL);
+    ico_syc_animation_t animation;
+    animation.name = (char*)ICO_HS_MENU_HIDE_ANIMATION_FADE;
+    animation.time = ICO_HS_MENU_ANIMATION_DURATION;
+#if 0
+    ico_syc_show(win_info->appid, win_info->surface, &animation);
+#else
+    const string& lastStartupApp = m_appHis->lastStartupApp();
+    if (true == lastStartupApp.empty()) {
+        ICO_DBG("show (empty) %s", win_info->appid);
+        ico_syc_show(win_info->appid, win_info->surface, &animation);
+    }
+    else if (0 == lastStartupApp.compare(win_info->appid)) {
+        ICO_DBG("show (last) %s", win_info->appid);
+        ico_syc_show(win_info->appid, win_info->surface, &animation);
+    }
+    else {
+        ICO_DBG("hide (no last) %s", win_info->appid);
+        ico_syc_hide(win_info->appid, win_info->surface, &animation);
+    }
+#endif
+    ICO_DBG("CicoHomeScreen::ShowApplicationWindow Leave");
 }
+
 /*--------------------------------------------------------------------------*/
 /**
  * @brief   CicoHomeScreen::RaiseApplicationWindow
@@ -436,15 +735,18 @@ CicoHomeScreen::ShowApplicationWindow(ico_syc_win_attr_t *win_attr)
 void
 CicoHomeScreen::RaiseApplicationWindow(const char *appid,int surface)
 {
-    ico_syc_show(appid, surface,NULL);
+    ico_syc_show(appid, surface, NULL);
+    ico_syc_change_active(appid, surface);
+    hs_instance->SetActiveAppInfo(appid);
 }
+
 /*--------------------------------------------------------------------------*/
 /**
  * @brief   CicoHomeScreen::EventCallBack
  *          callback for system controller
  *
  * @param[in]   event      kind of event
- * @param[in]   detail     detail 
+ * @param[in]   detail     detail
  * @param[in]   user_data  user data
  * @return      none
  */
@@ -453,196 +755,248 @@ void
 CicoHomeScreen::EventCallBack(const ico_syc_ev_e event,
                               const void *detail,void *user_data)
 {
+    int     idx;
+
     ICO_DBG("CicoHomeScreen::EventCallBack: start (event %d)",event);
-    if(event == ICO_SYC_EV_WIN_CREATE){
-        ico_syc_win_info_t *win_info = 
+
+    if (event == ICO_SYC_EV_WIN_CREATE) {
+        ico_syc_win_info_t *win_info =
             reinterpret_cast<ico_syc_win_info_t*>(const_cast<void*>(detail));
         ICO_DBG("CicoHomeScreen::EventCallBack : win create %s %i",
-                win_info->appid,win_info->surface); 
+                win_info->appid,win_info->surface);
         /*only save information*/
-        if(strncmp(win_info->appid, hs_instance->GetHsPackageName(),
-                   ICO_HS_MAX_PROCESS_NAME) == 0){
-           /*Home Screen*/
-           hs_instance->hs_app_info->AddWindowInfo(win_info);
+        if (strncmp(win_info->appid, hs_instance->GetHsPackageName(),
+                    ICO_HS_MAX_PROCESS_NAME) == 0)  {
+            /*Home Screen*/
+            hs_instance->hs_app_info->AddWindowInfo(win_info);
+
+            /*when Menu window*/
+            if(strncmp(win_info->name,ICO_HS_MENU_WINDOW_TITLE,
+                       ICO_MAX_TITLE_NAME_LEN) == 0){
+                hs_instance->menu_window->SetMenuWindowID(win_info->appid,
+                                                          win_info->surface);
+            }
+            else if(strncmp(win_info->name,ICO_HS_CONTROL_BAR_WINDOW_TITLE,
+                            ICO_MAX_TITLE_NAME_LEN) == 0){
+                hs_instance->ctl_bar_window->SetWindowID(win_info->appid,
+                                                         win_info->surface);
+            }
+            else    {
+                if (win_info->name[0] == 0) {
+                  /* null name, nothing to do */
+                    return;
+                }
+                for (idx = 0; idx < hs_instance->num_flick_input_windows; idx++)    {
+                    if (hs_instance->flick_input_windows[idx]->
+                                         isMyWindowName(win_info->name)) {
+                        hs_instance->flick_input_windows[idx]->
+                                         SetWindowID(win_info->appid, win_info->surface);
+                        hs_instance->flick_input_windows[idx]->SetupFlickWindow();
+                        break;
+                    }
+                }
+            }
+
+            /*show window*/
+            hs_instance->ShowHomeScreenWindow(win_info);
         }else if(strncmp(win_info->appid, 
                          hs_instance->GetSbPackageName(),
-                         ICO_HS_MAX_PROCESS_NAME) == 0){
+                         ICO_HS_MAX_PROCESS_NAME) == 0) {
             /*Status Bar*/
             hs_instance->sb_app_info->AddWindowInfo(win_info);
+
+            /*show window*/
+            hs_instance->ShowStatusBarWindow(win_info);
         }else if(strncmp(win_info->appid, 
                          hs_instance->GetOsPackageName(),
+                         ICO_HS_MAX_PROCESS_NAME) == 0) {
+            /*On Screen*/
+            hs_instance->os_app_info->AddWindowInfo(win_info);
+        }
+        else    {
+            /*Application*/
+            CicoHSAppInfo *appinfo = hs_instance->GetAppInfo(win_info->appid);
+            if(appinfo == NULL){
+                return;
+            }
+            appinfo->AddWindowInfo(win_info);
+
+            appinfo->SetLastSurface(win_info->surface);
+            hs_instance->ShowApplicationWindow(win_info);
+            ico_syc_change_active(win_info->appid,win_info->surface);
+            hs_instance->SetActiveAppInfo(win_info->appid);
+            hs_instance->UpdateTile(win_info->appid);
+
+            hs_instance->startupCheck(win_info->appid);
+
+        }
+    }else if(event == ICO_SYC_EV_WIN_NAME){
+        ico_syc_win_info_t *win_info = 
+            reinterpret_cast<ico_syc_win_info_t*>(const_cast<void*>(detail));
+        ICO_DBG("CicoHomeScreen::EventCallBack : win info %s %s %d",
+                win_info->appid,win_info->name,win_info->surface); 
+
+        if(strncmp(win_info->appid, hs_instance->GetHsPackageName(),
+                   ICO_HS_MAX_PROCESS_NAME) == 0){
+            /*Home Screen*/
+            hs_instance->hs_app_info->AddWindowInfo(win_info);
+
+            /*when Menu window*/
+            if(strncmp(win_info->name,ICO_HS_MENU_WINDOW_TITLE,
+                       ICO_MAX_TITLE_NAME_LEN) == 0){
+                hs_instance->menu_window->SetMenuWindowID(win_info->appid,
+                                                          win_info->surface);
+            }
+            else if(strncmp(win_info->name,ICO_HS_CONTROL_BAR_WINDOW_TITLE,
+                            ICO_MAX_TITLE_NAME_LEN) == 0){
+                hs_instance->ctl_bar_window->SetWindowID(win_info->appid,
+                                                         win_info->surface);
+            }
+            else    {
+                for (idx = 0; idx < hs_instance->num_flick_input_windows; idx++)    {
+                    if (hs_instance->flick_input_windows[idx]->
+                                         isMyWindowName(win_info->name)) {
+                        hs_instance->flick_input_windows[idx]->
+                                         SetWindowID(win_info->appid, win_info->surface);
+                        hs_instance->flick_input_windows[idx]->SetupFlickWindow();
+                        break;
+                    }
+                }
+            }
+
+            /*show window*/
+            hs_instance->ShowHomeScreenWindow(win_info);
+        }else if(strncmp(win_info->appid, hs_instance->GetSbPackageName(),
+                         ICO_HS_MAX_PROCESS_NAME) == 0){
+            /*Status Bar*/
+            hs_instance->sb_app_info->AddWindowInfo(win_info);
+        }else if(strncmp(win_info->appid, hs_instance->GetOsPackageName(),
                          ICO_HS_MAX_PROCESS_NAME) == 0){
             /*On Screen*/
             hs_instance->os_app_info->AddWindowInfo(win_info);
         }else{
             /*Application*/
-            CicoHSAppInfo *appinfo = 
-                       hs_instance->GetAppInfo(win_info->appid);
+            CicoHSAppInfo *appinfo = hs_instance->GetAppInfo(win_info->appid);
             if(appinfo == NULL){
                 return;
             }
             appinfo->AddWindowInfo(win_info);
         }
-    }
-    else if(event == ICO_SYC_EV_WIN_DESTROY){
+    }else if(event == ICO_SYC_EV_WIN_DESTROY){
         ico_syc_win_info_t *win_info = 
             reinterpret_cast<ico_syc_win_info_t*>(const_cast<void*>(detail));
         ICO_DBG("CicoHomeScreen::EventCallBack : win delete %s %i",
-                win_info->appid,win_info->surface); 
+                win_info->appid,win_info->surface);
         /*only save information*/
-        if(strncmp(win_info->appid, hs_instance->GetHsPackageName(),
-                   ICO_HS_MAX_PROCESS_NAME) == 0){
+        if (strncmp(win_info->appid, hs_instance->GetHsPackageName(),
+                    ICO_HS_MAX_PROCESS_NAME) == 0)  {
             hs_instance->hs_app_info->FreeWindowInfo(win_info->name);
-        }else if(strncmp(win_info->appid, 
+        }
+        else if (strncmp(win_info->appid,
                          hs_instance->GetSbPackageName(),
-                         ICO_HS_MAX_PROCESS_NAME) == 0){
+                         ICO_HS_MAX_PROCESS_NAME) == 0) {
             hs_instance->sb_app_info->FreeWindowInfo(win_info->name);
-        }else if(strncmp(win_info->appid, 
+        }
+        else if (strncmp(win_info->appid,
                          hs_instance->GetOsPackageName(),
-                         ICO_HS_MAX_PROCESS_NAME) == 0){
+                         ICO_HS_MAX_PROCESS_NAME) == 0) {
             hs_instance->os_app_info->FreeWindowInfo(win_info->name);
-        }else{
+        }
+        else    {
             /*Application*/
-            CicoHSAppInfo *appinfo = 
+            CicoHSAppInfo *appinfo =
                        hs_instance->GetAppInfo(win_info->appid);
-            if(appinfo == NULL){
+            if (appinfo == NULL)    {
                 return;
             }
             hs_instance->UpdateTile(win_info->appid);
             appinfo->FreeWindowInfo(win_info->name);
+
+            // udate active application information
+            CicoHSAppInfo *active_appinfo = hs_instance->GetActiveAppInfo();
+            if (appinfo == active_appinfo) {
+                hs_instance->SetActiveAppInfo(NULL);
+            }
         }
     }
-    else if(event == ICO_SYC_EV_WIN_ACTIVE){
-        ico_syc_win_info_t *win_info = 
+    else if (event == ICO_SYC_EV_WIN_ACTIVE)    {
+        ico_syc_win_info_t *win_info =
             reinterpret_cast<ico_syc_win_info_t*>(const_cast<void*>(detail));
-        /*if application*/ 
-        CicoHSAppInfo *appinfo = hs_instance->GetAppInfo(win_info->appid);
-        if(appinfo == NULL){
-            return;
-        }
-        appinfo->SetLastSurface(win_info->surface);
+        hs_instance->ChangeActive(win_info->appid, win_info->surface);
     }
-    else if(event == ICO_SYC_EV_WIN_ATTR_CHANGE){
-        ico_syc_win_attr_t *win_attr = 
+    else if (event == ICO_SYC_EV_WIN_ATTR_CHANGE)   {
+        ico_syc_win_attr_t *win_attr =
             reinterpret_cast<ico_syc_win_attr_t*>(const_cast<void*>(detail));
         ICO_DBG("CicoHomeScreen::EventCallBack : win attr %s %s %d",
-                win_attr->appid,win_attr->name,win_attr->surface); 
-        if(strncmp(win_attr->appid, hs_instance->GetHsPackageName(),
-                   ICO_HS_MAX_PROCESS_NAME) == 0){
+                win_attr->appid,win_attr->name,win_attr->surface);
+        if (strncmp(win_attr->appid, hs_instance->GetHsPackageName(),
+                    ICO_HS_MAX_PROCESS_NAME) == 0)  {
             /*Home Screen*/
             hs_instance->hs_app_info->AddWindowAttr(win_attr);
-            /*when Menu window*/
-            if(strncmp(win_attr->name,ICO_HS_MENU_WINDOW_TITLE,
-                       ICO_MAX_TITLE_NAME_LEN) == 0){
-                hs_instance->menu_window->SetMenuWindowID(win_attr->appid,
-                    win_attr->surface);
-            }
-            else if(strncmp(win_attr->name,ICO_HS_CONTROL_BAR_WINDOW_TITLE,
-                            ICO_MAX_TITLE_NAME_LEN) == 0){
-                hs_instance->ctl_bar_window->SetWindowID(win_attr->appid,
-                                                         win_attr->surface);
-            }
-            ico_hs_window_info * l_win_info = 
-                     hs_instance->GetWindowInfo(hs_instance->hs_app_info,
-                                                win_attr->name);
-            if(l_win_info == NULL){
-                return;
-            }
-            if(hs_instance->hs_app_info->GetShowed(l_win_info) == true){
-                return; 
-            }
-            /*show window*/
-            hs_instance->ShowHomeScreenWindow(win_attr);
-            hs_instance->hs_app_info->SetShowed(l_win_info,true);
         }else if(strncmp(win_attr->appid, hs_instance->GetSbPackageName(),
                          ICO_HS_MAX_PROCESS_NAME) == 0){
             /*Status Bar*/
             hs_instance->sb_app_info->AddWindowAttr(win_attr);
-            ico_hs_window_info * l_win_info = 
-                     hs_instance->GetWindowInfo(hs_instance->sb_app_info,
-                                                win_attr->name);
-            if(l_win_info == NULL){
-                return;
-            }
-            if(hs_instance->sb_app_info->GetShowed(l_win_info) == true){
-                return; 
-            }
-            hs_instance->ShowStatusBarWindow(win_attr);
-            hs_instance->sb_app_info->SetShowed(l_win_info,true);
         }else if(strncmp(win_attr->appid, hs_instance->GetOsPackageName(),
                          ICO_HS_MAX_PROCESS_NAME) == 0){
             /*On Screen*/
             hs_instance->os_app_info->AddWindowAttr(win_attr);
-        }else{
+        }
+        else    {
             ICO_DBG("CicoHomeScreen::EventCallBack : application window %s %s",
-                win_attr->appid,win_attr->name); 
+                    win_attr->appid,win_attr->name);
             /*Application*/
             CicoHSAppInfo *appinfo = hs_instance->GetAppInfo(win_attr->appid);
-            if(appinfo == NULL){
-                return;
-            }
-            ico_hs_window_info * l_win_info = 
-                      hs_instance->GetWindowInfo(appinfo,
-                                                win_attr->name);
-            if(l_win_info == NULL){
+            if (appinfo == NULL)    {
                 return;
             }
-            if(appinfo->GetShowed(l_win_info) == true){
-                return; 
-            }
-            
             appinfo->AddWindowAttr(win_attr);
-            appinfo->SetLastSurface(win_attr->surface);
-            hs_instance->ShowApplicationWindow(win_attr);
-            ico_syc_change_active(win_attr->appid,win_attr->surface);
-            hs_instance->UpdateTile(win_attr->appid);
-            hs_instance->hs_app_info->SetShowed(l_win_info,true);
         }
     }
-    else if(event == ICO_SYC_EV_THUMB_CHANGE){
-        ico_syc_thumb_info_t *thumb_info = 
+    else if (event == ICO_SYC_EV_THUMB_CHANGE)  {
+        ico_syc_thumb_info_t *thumb_info =
             reinterpret_cast<ico_syc_thumb_info_t*>(const_cast<void*>(detail));
         CicoHSAppInfo *appinfo = hs_instance->GetAppInfo(thumb_info->appid);
         ICO_DBG("CicoHomeScreen::EventCallBack : ICO_SYC_EV_THUMB_CHANGE %s",
                 thumb_info->appid);
-        if(appinfo == NULL){
+        if (appinfo == NULL)    {
             return;
         }
         //show icon
         hs_instance->menu_window->SetThumbnail(thumb_info->appid,thumb_info->surface);
     }
-    else if(event == ICO_SYC_EV_LAYER_ATTR_CHANGE){
-   
+    else if (event == ICO_SYC_EV_LAYER_ATTR_CHANGE) {
+
     }
-    else if(event == ICO_SYC_EV_USERLIST){
-   
+    else if (event == ICO_SYC_EV_USERLIST)  {
+
     }
-    else if(event == ICO_SYC_EV_AUTH_FAIL){
-   
+    else if (event == ICO_SYC_EV_AUTH_FAIL) {
+
     }
-    else if(event == ICO_SYC_EV_RES_ACQUIRE){
-   
+    else if (event == ICO_SYC_EV_RES_ACQUIRE) {
+
     }
-    else if(event == ICO_SYC_EV_RES_DEPRIVE){
-   
+    else if (event == ICO_SYC_EV_RES_DEPRIVE)   {
+
     }
-    else if(event == ICO_SYC_EV_RES_WAITING){
-   
+    else if (event == ICO_SYC_EV_RES_WAITING)   {
+
     }
-    else if(event == ICO_SYC_EV_RES_REVERT){
-   
+    else if (event == ICO_SYC_EV_RES_REVERT)    {
+
     }
-    else if(event == ICO_SYC_EV_RES_RELEASE){
-   
+    else if (event == ICO_SYC_EV_RES_RELEASE)   {
+
     }
-    else if(event == ICO_SYC_EV_INPUT_SET){
-   
+    else if (event == ICO_SYC_EV_INPUT_SET) {
+
     }
-    else if(event == ICO_SYC_EV_INPUT_UNSET){
-   
+    else if (event == ICO_SYC_EV_INPUT_UNSET)   {
+
     }
-    else if(event == ICO_SYC_EV_STATE_CHANGE) {
-        ico_syc_state_info_t *state_info = 
+    else if (event == ICO_SYC_EV_STATE_CHANGE)  {
+        ico_syc_state_info_t *state_info =
             reinterpret_cast<ico_syc_state_info_t*>(const_cast<void*>(detail));
 
         ICO_DBG("RECV: ICO_SYC_EV_STATE_CHANGE(id=%d state=%d)",
@@ -651,23 +1005,15 @@ CicoHomeScreen::EventCallBack(const ico_syc_ev_e event,
             // set regulation state
             CicoHSSystemState::getInstance()->setRegulation(
                 (state_info->state == ICO_SYC_STATE_ON) ? true : false);
-            // regulation action
-            ico_syc_animation_t animation;
-            animation.name = (char*)ICO_HS_MENU_HIDE_ANIMATION_SLIDE;
-            animation.time = ICO_HS_MENU_ANIMATION_DURATION;
-            hs_instance->menu_window->Hide(&animation);
-            hs_instance->ctl_bar_window->SetRegulation();
+            ecore_main_loop_thread_safe_call_async(CicoHomeScreen::SetRegulation, NULL);
         }
         else if (ICO_SYC_STATE_NIGHTMODE == state_info->id) {
             // set night mode state
             CicoHSSystemState::getInstance()->setNightMode(
                 (state_info->state == ICO_SYC_STATE_ON) ? true : false);
-            // night mode action
-            hs_instance->ctl_bar_window->SetNightMode();
-            hs_instance->menu_window->SetNightMode();
+            ecore_main_loop_thread_safe_call_async(CicoHomeScreen::SetNightMode, NULL);
         }
     }
-
     ICO_DBG("CicoHomeScreen::EventCallBack: end");
 }
 
@@ -680,10 +1026,10 @@ CicoHomeScreen::EventCallBack(const ico_syc_ev_e event,
  * @return      OK
  */
 /*--------------------------------------------------------------------------*/
-int 
+int
 CicoHomeScreen::StartRelations(void)
 {
-    int ret; 
+    int ret;
     strncpy(sb_package_name,
             (char *)config->ConfigGetString(ICO_HS_CONFIG_HOMESCREEN,
                                              ICO_HS_CONFIG_SB,
@@ -694,17 +1040,17 @@ CicoHomeScreen::StartRelations(void)
                                              ICO_HS_CONFIG_ONS,
                                              ICO_HS_APPID_DEFAULT_ONS),
             ICO_HS_MAX_PROCESS_NAME);
+// TODO
+#if 0 
     /* start onscreen & statusbar apps */
-#if 0
-    os_app_info = new CicoHSAppInfo(os_package_name);
+    os_app_info = GetAppInfo(os_package_name);
     ret = os_app_info->Execute();
     if (ret < 0) {
         ICO_WRN("execute failed(%s) err=%d", os_package_name, ret);
     } 
 #endif
 
-    sb_app_info = new CicoHSAppInfo(sb_package_name); 
+    sb_app_info = GetAppInfo(sb_package_name); 
     ret = sb_app_info->Execute();
     if (ret < 0) {
         ICO_WRN("execute failed(%s) err=%d", sb_package_name, ret);
@@ -717,57 +1063,56 @@ CicoHomeScreen::StartRelations(void)
  * @brief   CicoHomeScreen::Initialize
  *          Initialize
  *
- * @param[in]   orientation    vertical or horizontal 
- * @param[in]   config         config 
+ * @param[in]   orientation    vertical or horizontal
+ * @param[in]   config         config
  * @return      OK or ERROR
  */
 /*--------------------------------------------------------------------------*/
-int 
+int
 CicoHomeScreen::Initialize(int orientation,CicoHomeScreenConfig *config)
 {
-    
-    ICO_DBG("CicoHomeScreen::Initialize: start"); 
+
+    ICO_DBG("CicoHomeScreen::Initialize: start");
     /*save instance pointer */
     hs_instance = this;
 
     /*config copy*/
     this->config = config;
 
+    /*Get application info*/
+    CreateAppInfoList();
+
     /* get pkg name (home screen,status bar,on screen)*/
     char *pkg;
-    ICO_DBG("CicoHomeSceen::Initialize: %s: %s", 
+    ICO_DBG("CicoHomeSceen::Initialize: %s: %s",
             getenv("HOME"), getenv("PKG_NAME"));
     pkg = getenv("PKG_NAME");
     memset(hs_package_name, 0, ICO_HS_MAX_PROCESS_NAME);
-    if(pkg){
+    if (pkg)    {
         strncpy(hs_package_name, pkg, ICO_HS_MAX_PROCESS_NAME);
     }
-    else{
+    else    {
         strncpy(hs_package_name, ICO_HS_PROC_DEFAULT_HOMESCREEN,
                 ICO_HS_MAX_PROCESS_NAME);
     }
 
     /* Initialize WindowController */
     CicoHSWindowController::Initialize();
-    ICO_DBG("CicoHomeScreen::Initialize: window controller initialized"); 
-    
-    ICO_DBG("CicoHomeScreen::Initialize: start connect to systemcontroller"); 
+    ICO_DBG("CicoHomeScreen::Initialize: window controller initialized");
+
+    ICO_DBG("CicoHomeScreen::Initialize: start connect to systemcontroller");
     ico_syc_connect(EventCallBack,NULL);
-    ICO_DBG("CicoHomeScreen::Initialize: end connect to systemcontroller"); 
-    
-    /*init lifecycle controller*/
-    CicoSCSystemConfig::getInstance()->load(ICO_HS_LIFECYCLE_CONTROLLER_SETTING_PATH);
-    life_cycle_controller = CicoSCLifeCycleController::getInstance();
-    
+    ICO_DBG("CicoHomeScreen::Initialize: end connect to systemcontroller");
+
     /*initialize system controller*/
     /*my info*/
-    ICO_DBG("CicoHomeScreen::Initialize: get package name %s",hs_package_name); 
-    hs_app_info = new CicoHSAppInfo(hs_package_name); 
-    
-    /*start home statusbar and onscreen*/ 
+    ICO_DBG("CicoHomeScreen::Initialize: get package name %s",hs_package_name);
+    hs_app_info = GetAppInfo(hs_package_name);
+
+    /*start home statusbar and onscreen*/
     StartRelations();
-    ICO_DBG("CicoHomeScreen::Initialize: start relation apps"); 
+    ICO_DBG("CicoHomeScreen::Initialize: start relation apps");
+
     /* Get screen size */
     CicoHSWindowController::GetFullScreenSize(orientation,
                                               &full_width,&full_height);
@@ -776,7 +1121,7 @@ CicoHomeScreen::Initialize(int orientation,CicoHomeScreenConfig *config)
 
     /* MenuScreen Window Size */
     menu_width = full_width;
-    menu_height = full_height - ICO_HS_STATUSBAR_WINDOW_HEIGHT - 
+    menu_height = full_height - ICO_HS_STATUSBAR_WINDOW_HEIGHT -
                   ICO_HS_CONTROLBAR_WINDOW_HEIGHT;
 
     /* BackGround Window Size */
@@ -787,6 +1132,20 @@ CicoHomeScreen::Initialize(int orientation,CicoHomeScreenConfig *config)
     ctl_bar_width = full_width;
     ctl_bar_height = ICO_HS_CONTROLBAR_WINDOW_HEIGHT;
 
+    // load switch display zone config
+    moveZoneName = config->ConfigGetString("switchzone", "movezone", NULL);
+
+    moveZoneAnimation.name = (char*)config->ConfigGetString("switchzone",
+                                                            "animation",
+                                                            ICO_HS_ANIMATION_FADE);
+
+    moveZoneAnimation.time = config->ConfigGetInteger("switchzone",
+                                                      "animatime", 400);
+    
+    // debug log
+    ICO_DBG("moveZoneName=%s animation=%s time=%d",
+            moveZoneName, moveZoneAnimation.name, moveZoneAnimation.time);
+
     ICO_DBG("CicoHomeScreen::Initialize: end"); 
 
     return ICO_OK;
@@ -794,14 +1153,71 @@ CicoHomeScreen::Initialize(int orientation,CicoHomeScreenConfig *config)
 
 /*--------------------------------------------------------------------------*/
 /**
+ * @brief   CicoHomeScreen::InitializeAppHistory
+ *          Initialize application History Manager
+ *
+ * @param[in]   user   login-user name
+ * @param[in]   path   history write file path
+ * @param[in]   flagpath control flag file path
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::InitializeAppHistory(const string& user, const string& path,
+                                     const string& flagpath)
+{
+    ICO_DBG("start %s, %s, %s", user.c_str(), path.c_str(), flagpath.c_str());
+    if (NULL != m_appHis) {
+        ICO_DBG("end");
+        return;
+    }
+    m_appHis = new CicoHSAppHistoryExt(user, path, flagpath);
+    m_appHis->force_flagoff();
+
+    const char* val;
+    val = config->ConfigGetString(ICO_HS_CONFIG_HISTORY,
+                                  ICO_HS_CONFIG_HSTRY_KEY1,
+                                  ICO_HS_CONFIG_HSTRY_DEF1);
+    ICO_DBG("timer = %s", val);
+    double dV = atof(val);
+    m_appHis->setWaitTime(dV);
+
+    val = config->ConfigGetString(ICO_HS_CONFIG_HISTORY,
+                                  ICO_HS_CONFIG_HSTRY_KEY2,
+                                  ICO_HS_CONFIG_HSTRY_DEF2);
+    vector<string> vvM;
+    if ((NULL != val) && (0 != val) && (0 != strlen(val))) {
+        string tmpM(val);
+        split(tmpM, ICO_HS_CONFIG_HSTRY_SPL, vvM);
+    }
+    if (0 != vvM.size()) {
+        ICO_DBG("manage off = %s split=%d", val, (int)vvM.size());
+        m_appHis->setFilterManage(vvM);
+    }
+    val = config->ConfigGetString(ICO_HS_CONFIG_HISTORY,
+                                  ICO_HS_CONFIG_HSTRY_KEY3,
+                                  ICO_HS_CONFIG_HSTRY_DEF3);
+    vector<string> vvW;
+    if ((NULL != val) && (0 != val) && (0 != strlen(val))) {
+        string tmpW(val);
+        split(tmpW, ICO_HS_CONFIG_HSTRY_SPL, vvW);
+    }
+    if (0 != vvW.size()) {
+        ICO_DBG("write off = %s, split=%d", val, (int)vvW.size());
+        m_appHis->setFilterWrite(vvW);
+    }
+    ICO_DBG("end");
+}
+
+/*--------------------------------------------------------------------------*/
+/**
  * @brief   CicoHomeScreen::Finalize
  *          Finalize
  *
- * @param[in]   none 
+ * @param[in]   none
  * @return      none
  */
 /*--------------------------------------------------------------------------*/
-void 
+void
 CicoHomeScreen::Finalize(void)
 {
     /* Finalize WindowController */
@@ -809,7 +1225,7 @@ CicoHomeScreen::Finalize(void)
 
     ico_syc_disconnect();
 
-    delete hs_app_info;   
+    delete hs_app_info;
 }
 
 /*--------------------------------------------------------------------------*/
@@ -817,7 +1233,7 @@ CicoHomeScreen::Finalize(void)
  * @brief   CicoHomeScreen::CreateMenuWindow
  *          create menu window
  *
- * @param[in]   none 
+ * @param[in]   none
  * @return      none
  */
 /*--------------------------------------------------------------------------*/
@@ -825,10 +1241,12 @@ void
 CicoHomeScreen::CreateMenuWindow(void)
 {
     /*create window*/
+    ICO_DBG("CicoHomeScreen::CreateMenuWindow: start");
     menu_window = new CicoHSMenuWindow();
     menu_window->CreateMenuWindow(ICO_HS_WINDOW_POS_X,ICO_HS_WINDOW_POS_Y,
-                                  menu_width,menu_height);  
-    menu_window->ShowWindow(); 
+                                  menu_width,menu_height);
+    menu_window->ShowWindow();
+    ICO_DBG("CicoHomeScreen::CreateMenuWindow: end");
 }
 
 /*--------------------------------------------------------------------------*/
@@ -836,26 +1254,27 @@ CicoHomeScreen::CreateMenuWindow(void)
  * @brief   CicoHomeScreen::DeleteMenuWindow
  *          delete menu window
  *
- * @param[in]   none 
+ * @param[in]   none
  * @return      none
  */
 /*--------------------------------------------------------------------------*/
 void
 CicoHomeScreen::DeleteMenuWindow(void)
 {
-    if(menu_window == NULL){
+    if (menu_window == NULL)    {
         return;
     }
     menu_window->FreeMenuWindow();
     delete menu_window;
 
 }
+
 /*--------------------------------------------------------------------------*/
 /**
  * @brief   CicoHomeScreen::UpdateMenuWindow
  *          update menu window
  *
- * @param[in]   none 
+ * @param[in]   none
  * @return      none
  */
 /*--------------------------------------------------------------------------*/
@@ -871,7 +1290,7 @@ CicoHomeScreen::UpDateMenuWindow(void)
  * @brief   CicoHomeScreen::CreateBackWindow
  *          create back window
  *
- * @param[in]   none 
+ * @param[in]   none
  * @return      none
  */
 /*--------------------------------------------------------------------------*/
@@ -879,10 +1298,11 @@ void
 CicoHomeScreen::CreateBackWindow(void)
 {
     /*create window*/
+    ICO_DBG("CicoHomeScreen::CreateBackWindow");
     back_window = new CicoHSBackWindow();
     back_window->CreateBackWindow(ICO_HS_WINDOW_POS_X,ICO_HS_WINDOW_POS_Y,
-                                  bg_width,bg_height);  
-    back_window->ShowWindow(); 
+                                  bg_width,bg_height);
+    back_window->ShowWindow();
 }
 
 /*--------------------------------------------------------------------------*/
@@ -890,19 +1310,18 @@ CicoHomeScreen::CreateBackWindow(void)
  * @brief   CicoHomeScreen::CreateBackWindow
  *          create back window
  *
- * @param[in]   none 
+ * @param[in]   none
  * @return      none
  */
 /*--------------------------------------------------------------------------*/
 void
 CicoHomeScreen::DeleteBackWindow(void)
 {
-    if(back_window == NULL){
+    if (back_window == NULL)    {
         return;
     }
     back_window->FreeBackWindow();
     delete back_window;
-
 }
 
 /*--------------------------------------------------------------------------*/
@@ -910,7 +1329,7 @@ CicoHomeScreen::DeleteBackWindow(void)
  * @brief   CicoHomeScreen::UpDateBackWindow
  *          update back window
  *
- * @param[in]   none 
+ * @param[in]   none
  * @return      none
  */
 /*--------------------------------------------------------------------------*/
@@ -926,7 +1345,7 @@ CicoHomeScreen::UpDateBackWindow(void)
  * @brief   CicoHomeScreen::CreateControlBarWindow
  *          create control bar window
  *
- * @param[in]   none 
+ * @param[in]   none
  * @return      none
  */
 /*--------------------------------------------------------------------------*/
@@ -934,31 +1353,103 @@ void
 CicoHomeScreen::CreateControlBarWindow(void)
 {
     /*create window*/
+    ICO_DBG("CicoHomeScreen::CreateControlBarWindow");
     ctl_bar_window = new CicoHSControlBarWindow();
-    ctl_bar_window->CreateControlBarWindow(ICO_HS_MENU_WINDOW_POS_X,bg_height - 
+    ctl_bar_window->CreateControlBarWindow(ICO_HS_MENU_WINDOW_POS_X,bg_height -
                                            ctl_bar_height,ctl_bar_width,
-                                           ctl_bar_height);  
-    ctl_bar_window->ShowWindow(); 
+                                           ctl_bar_height);
+    ctl_bar_window->ShowWindow();
 }
 
 /*--------------------------------------------------------------------------*/
 /**
- * @brief   CicoHomeScreen::CreateControlBarWindow
+ * @brief   CicoHomeScreen::DeleteControlBarWindow
  *          delete control bar window
  *
- * @param[in]   none 
+ * @param[in]   none
  * @return      none
  */
 /*--------------------------------------------------------------------------*/
 void
 CicoHomeScreen::DeleteControlBarWindow(void)
 {
-    if(ctl_bar_window == NULL){
+    if (ctl_bar_window == NULL) {
         return;
     }
     ctl_bar_window->FreeControlBarWindow();
     delete ctl_bar_window;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::CreateFlickInputWindow
+ *          create flick input windows
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::CreateFlickInputWindow(void)
+{
+    ICO_DBG("CicoHomeScreen::CreateFlickInputWindow: start");
+    /* TODO: cullentry FlickInput windows is fixed size, need configuration ?   */
+    /* left side window     */
+    flick_input_windows[0] = new CicoHSFlickInputWindow();
+    flick_input_windows[0]->
+            CreateFlickInputWindow(ICO_HS_WINDOW_POS_X,
+                                   ICO_HS_WINDOW_POS_Y + ICO_HS_FLICK_TOUCH_DISTANCE_XY,
+                                   ICO_HS_FLICK_TOUCH_FLICK_WIDTH,
+                                   full_height - (ICO_HS_FLICK_TOUCH_DISTANCE_XY*2), "left");
+    flick_input_windows[0]->ShowWindow();
+
+    /* right side window    */
+    flick_input_windows[1] = new CicoHSFlickInputWindow();
+    flick_input_windows[1]->
+            CreateFlickInputWindow(full_width - ICO_HS_FLICK_TOUCH_FLICK_WIDTH,
+                                   ICO_HS_WINDOW_POS_Y + ICO_HS_FLICK_TOUCH_DISTANCE_XY,
+                                   ICO_HS_FLICK_TOUCH_FLICK_WIDTH,
+                                   full_height - (ICO_HS_FLICK_TOUCH_DISTANCE_XY*2), "right");
+    flick_input_windows[1]->ShowWindow();
+
+#if 0       /* currently not support(not fix specification) */
+    /* buttom side window   */
+    flick_input_windows[2] = new CicoHSFlickInputWindow();
+    flick_input_windows[2]->
+            CreateFlickInputWindow(ICO_HS_WINDOW_POS_X,
+                                   full_height - ICO_HS_FLICK_TOUCH_FLICK_HEIGHT,
+                                   full_width, ICO_HS_FLICK_TOUCH_FLICK_WIDTH, "buttom");
+
+    flick_input_windows[2]->ShowWindow();
+    num_flick_input_windows = 3;
+#else
+    num_flick_input_windows = 2;
+#endif
+    ICO_DBG("CicoHomeScreen::CreateFlickInputWindow: end");
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::DeleteFlickInputWindow
+ *          delete flick input windows
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::DeleteFlickInputWindow(void)
+{
+    int idx;
 
+    for (idx = 0; idx < num_flick_input_windows; idx++) {
+        if (flick_input_windows[idx])   {
+            flick_input_windows[idx]->FreeFlickInputWindow();
+            delete flick_input_windows[idx];
+            flick_input_windows[idx] = NULL;
+        }
+    }
+    num_flick_input_windows = 0;
 }
 
 /*--------------------------------------------------------------------------*/
@@ -966,7 +1457,7 @@ CicoHomeScreen::DeleteControlBarWindow(void)
  * @brief   CicoHomeScreen::StartLoop
  *          start ecore loop
  *
- * @param[in]   none 
+ * @param[in]   none
  * @return      none
  */
 /*--------------------------------------------------------------------------*/
@@ -981,25 +1472,27 @@ CicoHomeScreen::StartLoop(void)
  * @brief   CicoHomeScreen::StartHomeScreen
  *          start home screen
  *
- * @param[in]   none 
+ * @param[in]   none
  * @return      none
  */
 /*--------------------------------------------------------------------------*/
 void
 CicoHomeScreen::StartHomeScreen()
 {
-    /*Get application info*/
-    CreateAppInfoList();
-
     /*Create window*/
-    CreateBackWindow();
+    CreateControlBarWindow();
 
     /*Create window*/
-    CreateControlBarWindow();
+    CreateBackWindow();
 
     /*Create window*/
     CreateMenuWindow();
 
+    /*Create FlickInput window*/
+    CicoHSFlickTouch::Initialize(hs_instance->ctl_bar_window, hs_instance->m_appHis,
+                                 full_width, full_height);
+    CreateFlickInputWindow();
+
     /*Show Home Screen*/
     ShowHomeScreenLayer();
 
@@ -1021,6 +1514,7 @@ CicoHomeScreen::GetMode(void)
 {
     return mode;
 }
+
 /*--------------------------------------------------------------------------*/
 /**
  * @brief   CicoHomeScreen::SetMode
@@ -1035,44 +1529,57 @@ CicoHomeScreen::SetMode(int mode)
 {
     this->mode = mode;
 }
+
 /*--------------------------------------------------------------------------*/
 /**
  * @brief   CicoHomeScreen::ChangeMode
  *          Change status
  *
- * @param[in]   none 
+ * @param[in]   none
  * @return      none
  */
 /*--------------------------------------------------------------------------*/
 void
 CicoHomeScreen::ChangeMode(int pattern)
 {
-    if(hs_instance->menu_window == NULL){
-        return; 
+    int idx;
+
+    if (hs_instance->menu_window == NULL)   {
+        return;
     }
 
-    if(hs_instance->GetMode() == ICO_HS_MODE_MENU){
+    if (hs_instance->GetMode() == ICO_HS_MODE_MENU) {
         ico_syc_animation_t animation;
-        if(pattern == ICO_HS_SHOW_HIDE_PATTERN_SLIDE){
+        if (pattern == ICO_HS_SHOW_HIDE_PATTERN_SLIDE)  {
             animation.name = (char*)ICO_HS_MENU_HIDE_ANIMATION_SLIDE;
-        }else{
+        }
+        else    {
             animation.name = (char*)ICO_HS_MENU_HIDE_ANIMATION_FADE;
         }
         animation.time = ICO_HS_MENU_ANIMATION_DURATION;
         hs_instance->menu_window->Hide(&animation);
+        for (idx = 0; idx < hs_instance->num_flick_input_windows; idx++)    {
+            hs_instance->flick_input_windows[idx]->Show();
+        }
         hs_instance->SetMode(ICO_HS_MODE_APPLICATION);
-    }else if(hs_instance->GetMode() ==ICO_HS_MODE_APPLICATION){
+    }
+    else if (hs_instance->GetMode() ==ICO_HS_MODE_APPLICATION)  {
         ico_syc_animation_t animation;
-        if(pattern == ICO_HS_SHOW_HIDE_PATTERN_SLIDE){
+        if (pattern == ICO_HS_SHOW_HIDE_PATTERN_SLIDE)  {
             animation.name = (char*)ICO_HS_MENU_SHOW_ANIMATION_SLIDE;
-        }else{
+        }
+        else    {
             animation.name = (char*)ICO_HS_MENU_SHOW_ANIMATION_FADE;
         }
         animation.time = ICO_HS_MENU_ANIMATION_DURATION;
         hs_instance->menu_window->Show(&animation);
+        for (idx = 0; idx < hs_instance->num_flick_input_windows; idx++)    {
+            hs_instance->flick_input_windows[idx]->Hide();
+        }
         hs_instance->SetMode(ICO_HS_MODE_MENU);
     }
 }
+
 /*--------------------------------------------------------------------------*/
 /**
  * @brief   CicoHomeScreen::ExecuteApp
@@ -1087,6 +1594,7 @@ CicoHomeScreen::ExecuteApp(const char*appid)
 {
     hs_instance->ExecuteApp_i(appid);
 }
+
 /*--------------------------------------------------------------------------*/
 /**
  * @brief   CicoHomeScreen::TerminateApp
@@ -1101,4 +1609,251 @@ CicoHomeScreen::TerminateApp(const char*appid)
 {
     hs_instance->TerminateApp_i(appid);
 }
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::setActiveApp
+ *          active(touch operate app) notice
+ *
+ * @param[in]   appid
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::setActiveApp(const char* appid)
+{
+    if ((NULL == appid) || (0 == appid) || (0 == strlen(appid))) {
+        return;
+    }
+    if (NULL != m_appHis) {
+        m_appHis->activeApp(appid);
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::SetNightMode
+ *          set night mode theme
+ *
+ * @param[in]   data    user data
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::SetNightMode(void* data)
+{
+    ICO_DBG("CicoHomeScreen::SetNightMode Enter");
+   // night mode action
+    hs_instance->ctl_bar_window->SetNightMode();
+    hs_instance->menu_window->SetNightMode();
+    ICO_DBG("CicoHomeScreen::SetNightMode Leave");
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::SetRegulation
+ *          regulation action and set regualtion theme
+ *
+ * @param[in]   data    user data
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::SetRegulation(void* data)
+{
+    ICO_DBG("CicoHomeScreen::SetRegulation Enter");
+    // regulation action
+    hs_instance->ctl_bar_window->SetRegulation();
+    ico_syc_animation_t animation;
+    animation.name = (char*)ICO_HS_MENU_HIDE_ANIMATION_SLIDE;
+    animation.time = ICO_HS_MENU_ANIMATION_DURATION;
+    hs_instance->menu_window->Hide(&animation);
+    ICO_DBG("CicoHomeScreen::SetRegulation Leave");
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::RenewAppInfoList_i
+ *          renewal application info list
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::RenewAppInfoList_i(void)
+{
+    int ii = 0;
+    int kk = 0;
+    CicoHSAppInfo *tmp_apps_info[ICO_HS_MAX_APP_NUM];
+    int tmp_application_num = 0;
+    const char *appid_p = 0;
+
+    for(ii = 0; ii < ICO_HS_MAX_APP_NUM; ii++){
+        tmp_apps_info[ii] = NULL;
+    }
+
+    /* get APP information*/
+    std::vector<CicoSCAilItems> aillist = life_cycle_controller->getAilList();
+
+    /*create instance*/
+    for ( ii = 0;
+         (ii < (int)aillist.size()) && (ii < ICO_HS_MAX_APP_NUM);
+         ii++)  {
+        ICO_DBG("aillist[%d].m_appid.c_str() = %s",
+                 ii, aillist[ii].m_appid.c_str()); 
+
+        for (kk = 0; kk < ICO_HS_MAX_APP_NUM; kk++) {
+            if (apps_info[kk] == NULL) {
+                continue;
+            }
+
+            if (strcmp(aillist[ii].m_appid.c_str(),
+                apps_info[kk]->GetAppId()) == 0) {
+
+                tmp_apps_info[ii] = apps_info[kk];
+                ICO_DBG("shift aillist[%d].m_appid.c_str() = %s",
+                         ii, aillist[ii].m_appid.c_str());
+                break;
+            }
+        }
+        if (kk == ICO_HS_MAX_APP_NUM) {
+            tmp_apps_info[ii] = new CicoHSAppInfo(aillist[ii].m_appid.c_str());
+            ICO_DBG("create aillist[%d].m_appid.c_str() = %s",
+                     ii, aillist[ii].m_appid.c_str());
+        }
+        tmp_application_num++;
+    }
+
+    /* delete instance */
+    for (ii = 0; ii < ICO_HS_MAX_APP_NUM; ii++) {
+        if (apps_info[ii] == NULL) {
+            continue;
+        }
+        appid_p = apps_info[ii]->GetAppId();
+        for ( kk = 0; kk < tmp_application_num; kk++) {
+            if (strcmp(appid_p, tmp_apps_info[kk]->GetAppId()) == 0) { 
+                break;
+            }
+        }
+        if (kk == tmp_application_num) {
+            delete apps_info[ii];
+            ICO_DBG("delete apps_info[%d]->GetAppId() = %s",
+                    ii, appid_p);
+        }
+    }
+
+    /* set apps info */
+    for ( ii = 0; ii < ICO_HS_MAX_APP_NUM; ii++) {
+        apps_info[ii] = tmp_apps_info[ii];
+    }
+
+    application_num = tmp_application_num;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::RenewAppInfoList
+ *          renewal appinfolist
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::RenewAppInfoList(void)
+{
+    ICO_DBG("CicoHomeScreen::RenewAppInfoList Enter");
+    hs_instance->RenewAppInfoList_i();
+    ICO_DBG("CicoHomeScreen::RenewAppInfoList Leave");
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::startupCheckAdd
+ *          start-up application infomation add
+ *
+ * @param[in]  pid
+ * @param[in]  appid
+ * @return     none
+ */
+/*--------------------------------------------------------------------------*/
+void CicoHomeScreen::startupCheckAdd(int pid, const std::string& appid)
+{
+    if (NULL != m_appHis) {
+        m_appHis->startupCheckAdd(pid, appid);
+    }
+}
+
+void CicoHomeScreen::startupCheck(const char* appid)
+{
+    ICO_DBG("start");
+    if (NULL == life_cycle_controller) {
+        ICO_DBG("end");
+        return;
+    }
+    if (NULL == m_appHis) {
+        ICO_DBG("end");
+        return;
+    }
+    if (false == m_appHis->isStartupChecking()) {
+        ICO_DBG("end");
+        return;
+    }
+    m_appHis->update_appid();
+    vector<int> pids;
+    life_cycle_controller->getPIDs(appid, pids);
+    if (0 == pids.size()) {
+        ICO_DBG("end");
+        return;
+    }
+    vector<int>::iterator it = pids.begin();
+    while (it != pids.end()) {
+        m_appHis->startupEntryFinish(*it);
+        ++it;
+    }
+    if (false == m_appHis->isFinish()) {
+        ICO_DBG("end");
+        return;
+    }
+    list<string> h = m_appHis->getAppHistory();
+    string last = m_appHis->lastStartupApp();
+    list<string>::iterator it_h = h.begin();
+    if (true == last.empty()) {
+        list<string>::iterator it_hb = h.end();
+        --it_hb;
+        last = *it_hb;
+    }
+   
+    list<string>::reverse_iterator rit_h = h.rbegin();
+    while(rit_h != h.rend()) {
+        CicoHSAppInfo *ai = GetAppInfo((*rit_h).c_str());
+        if (ai == NULL) {
+            ++rit_h;
+            continue;
+        }
+        ICO_DBG("Raise %s", (*rit_h).c_str());
+        {
+            const char* appid = ai->GetAppId();
+            int surface = ai->GetLastSurface();
+        
+            if (0 != last.compare(appid)) {
+                ico_syc_show(appid, surface, NULL);
+                ico_syc_hide(appid, surface, NULL);
+            }
+        }
+        ++rit_h;
+    }
+
+    CicoHSAppInfo *ai = GetAppInfo(last.c_str());
+    if (ai != NULL) {
+        const char* appid = ai->GetAppId();
+        int surface = ai->GetLastSurface();
+        ico_syc_show(appid, surface, NULL);
+        ico_syc_change_active(appid, surface);
+        hs_instance->SetActiveAppInfo(appid);
+    }
+        
+    m_appHis->stopStartupCheck();
+    ICO_DBG("end");
+}
+
 // vim: set expandtab ts=4 sw=4:
index a9857e6..7597198 100644 (file)
 #include "CicoHSMenuWindow.h"
 #include "CicoHSBackWindow.h"
 #include "CicoHSControlBarWindow.h"
+#include "CicoHSFlickTouch.h"
 #include "CicoHSWindowController.h"
 #include "CicoHSAppInfo.h"
 
 #include "CicoSCSystemConfig.h"
 #include "CicoSCLifeCycleController.h"
+#include "CicoHSAppHistoryExt.h"
 
 /* display position and size */
 #define ICO_HS_WINDOW_POS_X 0
-#define ICO_HS_WINDOW_POS_Y 0 
+#define ICO_HS_WINDOW_POS_Y 0
 #define ICO_HS_STATUSBAR_WINDOW_HEIGHT 64
 #define ICO_HS_MENU_WINDOW_POS_X ICO_HS_WINDOW_POS_X
 #define ICO_HS_MENU_WINDOW_POS_Y ICO_HS_STATUSBAR_WINDOW_HEIGHT
 
 #define ICO_HS_APP_STATUS_ERR -1
 
+#define ICO_HS_CHANGE_ZONE_MAX  10
+
 class CicoHomeScreen
 {
   public:
     CicoHomeScreen(void);
     ~CicoHomeScreen(void);
     int Initialize(int orientation,CicoHomeScreenConfig *config);
+    void InitializeAppHistory(const std::string& user, const std::string& path,
+                              const std::string& flagpath);
     void Finalize(void);
     int StartRelations();
     void CreateMenuWindow(void);
@@ -82,23 +88,41 @@ class CicoHomeScreen
     void UpDateBackWindow(void);
     void CreateControlBarWindow(void);
     void DeleteControlBarWindow(void);
+    void CreateFlickInputWindow(void);
+    void DeleteFlickInputWindow(void);
     void StartLoop(void);
     char *GetHsPackageName(void);
     char *GetSbPackageName(void);
     char *GetOsPackageName(void);
     void ShowHomeScreenLayer(void);
-    void ShowHomeScreenWindow(ico_syc_win_attr_t *win_attr);
-    void ShowStatusBarWindow(ico_syc_win_attr_t *win_attr);
-    void ShowApplicationWindow(ico_syc_win_attr_t *win_attr);
+    void ShowHomeScreenWindow(ico_syc_win_info_t *win_info);
+    void ShowStatusBarWindow(ico_syc_win_info_t *win_info);
+    void ShowApplicationWindow(ico_syc_win_info_t *win_info);
     void RaiseApplicationWindow(const char *appid,int surface);
     static void ChangeMode(int pattern);
     static void ExecuteApp(const char *appid);
     static void TerminateApp(const char *appid);
     static bool GetAppStatus(const char *appid);
+    void ChangeActive(const char *appid, int surface);
+    static void ChangeZone(void);
+    static CicoHSAppInfo *GetAppInfo(const char *appid);
     void SetMode(int mode);
     int GetMode(void);
     void StartHomeScreen();
     void UpdateTile(const char *appid);
+    static void RenewAppInfoList(void);
+
+    void setActiveApp(const char* appid);
+    // update current active application information
+    void SetActiveAppInfo(const char *appid);
+    CicoHSAppInfo* GetActiveAppInfo(void);
+
+    // update current sub displaye applicatin information
+    void SetSubDisplayAppInfo(const char *appid);
+    CicoHSAppInfo* GetSubDisplayAppInfo(void);
+    // order of the start-up window
+    void startupCheckAdd(int pid, const std::string& appid);
+    void startupCheck(const char* appid);
 
   private:
     int GetProcessWindow(const char *appid);
@@ -106,12 +130,19 @@ class CicoHomeScreen
     void ExecuteApp_i(const char *appid);
     void TerminateApp_i(const char *appid);
     void CreateAppInfoList(void);
-    CicoHSAppInfo *GetAppInfo(const char *appid);
     ico_hs_window_info *GetWindowInfo(CicoHSAppInfo* appinfo,const char *window);
+    ico_hs_window_info *GetWindowInfo(CicoHSAppInfo* appinfo,int surface);
+
+    static void SetNightMode(void* data);
+    static void SetRegulation(void* data);
+
+    void RenewAppInfoList_i(void);
 
     /*application control(do not use now)*/
     int application_num;
     CicoHSAppInfo *apps_info[ICO_HS_MAX_APP_NUM];
+    // current active application information
+    CicoHSAppInfo *active_appinfo;
     /*application info*/
     CicoHSAppInfo *hs_app_info;
     CicoHSAppInfo *sb_app_info;
@@ -128,7 +159,9 @@ class CicoHomeScreen
     /*Window Instances*/
     CicoHSMenuWindow* menu_window;
     CicoHSBackWindow* back_window;
-    CicoHSControlBarWindow* ctl_bar_window; 
+    CicoHSControlBarWindow* ctl_bar_window;
+    int num_flick_input_windows;
+    CicoHSFlickInputWindow* flick_input_windows[ICO_HS_MAX_FLICKWINDOWS];
     /*mode*/
     int mode;
     /*configuration*/
@@ -137,6 +170,18 @@ class CicoHomeScreen
     static CicoHomeScreen *hs_instance;
 
     CicoSCLifeCycleController* life_cycle_controller;
+    CicoHSAppHistoryExt* m_appHis;
+
+    // current sub display appinfo
+    CicoHSAppInfo *sub_display_appinfo;
+
+  public:
+    // swith trigger zone rotation list
+    const char* moveZoneName;
+
+    // move zone animation information
+    ico_syc_animation_t moveZoneAnimation;
+
 
   protected:
     CicoHomeScreen operator=(const CicoHomeScreen&);
index 4962888..780b186 100644 (file)
@@ -14,7 +14,8 @@
 #ifndef __CICO_HOMESCREEN_COMMON_H__
 #define __CICO_HOMESCREEN_COMMON_H__
 
-#include "CicoLog.h"
+#include <ico_log.h>
+#include <ico_window_mgr-client-protocol.h>
 
 #define ICO_OK 0
 #define ICO_ERROR -1
 #define ICO_HS_MENU_WINDOW_TITLE "ico_hs_menuwindow"
 #define ICO_HS_BACK_WINDOW_TITLE "ico_hs_backwindow"
 #define ICO_HS_CONTROL_BAR_WINDOW_TITLE "ico_hs_controlbarwindow"
+#define ICO_HS_FLICK_INPUT_WINDOW_TITLE "ico_hs_flickinputwindow"
 
 /*path of layaout file*/
 #define ICO_HS_MENU_LAYOUT_FILE_PATH "/home/app/layout.txt"
 
+/* max number of category in menu*/
+#define ICO_HS_MENU_MAX_MENU_CATEGORY_NUM 64
+
+/*path of category file*/
+#define ICO_HS_MENU_CATEGORY_FILE_PATH "/usr/apps/org.tizen.ico.homescreen/res/config/menu_categoryid.conf"
+
 /*path of back window*/
 #define ICO_HS_BACK_WINDOW_IMAGE_FILE_PATH "/opt/usr/media/Images/Home_default.jpg"
 
 #define ICO_HS_IMAGE_FILE_MENU_BACK_GROUND "bg.png"
 #define ICO_HS_IMAGE_FILE_MENU_PAGEPOINTER_P "pagePointer_p.png"
 #define ICO_HS_IMAGE_FILE_MENU_PAGEPOINTER_N "pagePointer_n.png"
+
+#define ICO_HS_IMAGE_FILE_MENU_PAGE_UP_CURSOR "pageUpCursor.png"
+#define ICO_HS_IMAGE_FILE_MENU_PAGE_DOWN_CURSOR "pageDownCursor.png"
+
 #define ICO_HS_IMAGE_FILE_MENU_TERMINATE_REALLY "button_really.png"
 #define ICO_HS_IMAGE_FILE_MENU_TERMINATE_YES "button_yes.png"
 #define ICO_HS_IMAGE_FILE_MENU_TERMINATE_NO "button_no.png"
@@ -81,6 +93,7 @@
 #define ICO_HS_CONFIG_ONSCREEN      "onscreen"
 #define ICO_HS_CONFIG_STATUBAR      "statusbar"
 #define ICO_HS_CONFIG_SOUND         "sound"
+#define ICO_HS_CONFIG_HISTORY       "app_history"
 
 /*misc*/
 #define HS_DISPLAY_HOMESCREEN   0           /* HomeScreen target display Id     */
 #define HS_LAYER_HOMESCREEN     2         /* layer of HomeScreen menu */
 #define HS_LAYER_SOFTKEYBOARD   3         /* layer of Software Keyboard  */
 #define HS_LAYER_INTERRUPTAPP   4         /* layer of Interrupted Application */
-#define HS_LAYER_TOUCH          5         /* layer of TouchPanel */
 #define HS_LAYER_ONSCREEN       6         /* layer of OnScreen   */
-#define HS_LAYER_CURSOR         7         /* layer of Cursor   */
-
-
+#define HS_LAYER_TOUCH          ICO_WINDOW_MGR_V_LAYER_INPUT
+                                          /* layer of TouchPanel input */
+#define HS_LAYER_CURSOR         ICO_WINDOW_MGR_V_LAYER_CURSOR
+                                            /* layer of Cursor   */
+
+/* config history name */
+#define ICO_HS_CONFIG_HSTRY_KEY1      "timer"
+#define ICO_HS_CONFIG_HSTRY_DEF1      "1"
+#define ICO_HS_CONFIG_HSTRY_KEY2      "manage_off_app"
+#define ICO_HS_CONFIG_HSTRY_DEF2      "org.tizen.ico.homescreen;org.tizen.ico.statusbar"
+#define ICO_HS_CONFIG_HSTRY_KEY3      "write_off_app"
+#define ICO_HS_CONFIG_HSTRY_DEF3      "org.tizen.ico.login"
+#define ICO_HS_CONFIG_HSTRY_SPL       ';'
+
+#define ICO_HS_ANIMATION_SLIDE      "Slide"
+#define ICO_HS_ANIMATION_SLIDE      "Slide"
+#define ICO_HS_ANIMATION_FADE       "Fade"
+#define ICO_HS_ANIMATION_FADE       "Fade"
+#define ICO_HS_ANIMATION_DURATION   (400)
 
 #endif
 
index 9e0c163..9244f4e 100644 (file)
@@ -6,32 +6,46 @@
  * http://www.apache.org/licenses/LICENSE-2.0
  *
  */
+
+//==========================================================================
 /**
- * @brief   load configuratoin file
+ *  @file   CicoHomeScreenConfig
  *
- * @date    Feb-15-2013
+ *  @brief  This file is implementation of CicoHomeScreenConfig class
  */
+//==========================================================================
+
 #include "CicoHomeScreenConfig.h"
+#include "CicoHomeScreenResourceConfig.h"
 
-/*============================================================================*/
-/* functions                                                                  */
-/*============================================================================*/
-/*--------------------------------------------------------------------------*/
+//==========================================================================
+//  public functions
+//==========================================================================
+//--------------------------------------------------------------------------
 /**
  * @brief   CicoHomeScreenConfig::CicoHomeScreenConfig
  *          Constractor
- *
- * @param[in]   none
- * @return      none
  */
-/*--------------------------------------------------------------------------*/
-CicoHomeScreenConfig::CicoHomeScreenConfig(void)
+//--------------------------------------------------------------------------
+CicoHomeScreenConfig::CicoHomeScreenConfig()
+    : m_gKeyFile(NULL)
 {
-    config_key = NULL;
-    is_open_config = FALSE;
 }
 
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
+/**
+ * @brief   CicoHomeScreenConfig::CicoHomeScreenConfig
+ *          destructor
+ */
+//--------------------------------------------------------------------------
+CicoHomeScreenConfig::~CicoHomeScreenConfig()
+{
+    if (NULL != m_gKeyFile) {
+        g_key_file_free(m_gKeyFile);
+    }
+}
+
+//--------------------------------------------------------------------------
 /**
  * @brief   CicoHomeScreenConfig::Initialize
  *          read and initialize for homescreen configuration
@@ -41,7 +55,7 @@ CicoHomeScreenConfig::CicoHomeScreenConfig(void)
  * @retval      ICO_HS_OK           success
  * @retval      ICO_HS_ERR          error
  */
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
 int
 CicoHomeScreenConfig::Initialize(const char *conf)
 {
@@ -49,12 +63,12 @@ CicoHomeScreenConfig::Initialize(const char *conf)
     char path[ICO_HS_TEMP_BUF_SIZE];
     GString *filepath;
 
-    if(is_open_config == TRUE) {
+    if (NULL != m_gKeyFile) {
         /*if initialize was done*/
-        return ICO_HS_ERR;
+        return ICO_HS_OK;
     }
 
-    config_key = g_key_file_new();
+    m_gKeyFile = g_key_file_new();
     
     filepath = g_string_new("test");
     CicoHomeScreenResourceConfig::GetConfPath(path, sizeof(path));
@@ -63,9 +77,11 @@ CicoHomeScreenConfig::Initialize(const char *conf)
         return ICO_HS_ERR;
     }
 
-    g_key_file_load_from_file(config_key, filepath->str,
-                              static_cast<GKeyFileFlags>(G_KEY_FILE_KEEP_COMMENTS
-                                      | G_KEY_FILE_KEEP_TRANSLATIONS), &error);
+    // load config file
+    g_key_file_load_from_file(m_gKeyFile, filepath->str,
+                              (GKeyFileFlags)(G_KEY_FILE_KEEP_COMMENTS |
+                                              G_KEY_FILE_KEEP_TRANSLATIONS),
+                              &error);
     if (error != NULL) {
         ICO_WRN("%s: %s", filepath->str, error->message);
         g_error_free(error);
@@ -73,12 +89,6 @@ CicoHomeScreenConfig::Initialize(const char *conf)
     }
 
     g_string_free(filepath, TRUE);
-    if (error != NULL) {
-        ICO_WRN("%s: %s", filepath->str, error->message);
-        g_error_free(error);
-        is_open_config = TRUE;
-        return ICO_HS_ERR;
-    }
 
     return ICO_HS_OK;
 }
@@ -100,14 +110,14 @@ CicoHomeScreenConfig::ConfigGetInteger(const char *group_name, const char *key,
 {
     GError *error = NULL;
 
-    if (config_key == NULL) {
+    if (m_gKeyFile == NULL) {
         /* if initialize is didn't yet */
         if (Initialize(ICO_HOMESCREEN_CONFIG_FILE) != ICO_HS_OK) {
             return default_value;
         }
     }
 
-    int value = g_key_file_get_integer(config_key, group_name, key, &error);
+    int value = g_key_file_get_integer(m_gKeyFile, group_name, key, &error);
     if (error != NULL) {
         ICO_WRN("%s", error->message);
         g_error_free(error);
@@ -134,14 +144,14 @@ CicoHomeScreenConfig::ConfigGetString(const char *group_name, const char *key,
 {
     GError *error = NULL;
 
-     if (config_key == NULL) {
+     if (m_gKeyFile == NULL) {
         /* if initialize is didn't yet */
         if (Initialize(ICO_HOMESCREEN_CONFIG_FILE) != ICO_HS_OK) {
             return default_value;
         }
     }
 
-    const char *value = g_key_file_get_string(config_key, group_name, key,
+    const char *value = g_key_file_get_string(m_gKeyFile, group_name, key,
                                               &error);
     if (error != NULL) {
         ICO_WRN("%s", error->message);
@@ -150,4 +160,4 @@ CicoHomeScreenConfig::ConfigGetString(const char *group_name, const char *key,
     }
     return value;
 }
-
+// vim:set expandtab ts=4 sw=4:
index 62ad740..0d4cc10 100644 (file)
@@ -1,5 +1,3 @@
-#ifndef __CICOHOMESCREENCONFIG_H__
-#define __CICOHOMESCREENCONFIG_H__
 /*
  * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
  *
@@ -8,47 +6,62 @@
  * http://www.apache.org/licenses/LICENSE-2.0
  *
  */
+
+//==========================================================================
 /**
- * @brief   load configuratoin file
+ *  @file   CicoHomeScreenConfig
  *
- * @date    Feb-15-2013
+ *  @brief  This file is definition of CicoHomeScreenConfig class
  */
+//==========================================================================
+#ifndef __CICO_HOMESCREEN_CONFIG_H__
+#define __CICO_HOMESCREEN_CONFIG_H__
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
 #include <glib.h>
 
-#include "CicoHomeScreenCommon.h"
-#include "CicoHomeScreenResourceConfig.h"
-
-/*============================================================================*/
-/* definition                                                                 */
-/*============================================================================*/
+//==========================================================================
+//  definition
+//==========================================================================
 #define ICO_HOMESCREEN_CONFIG_FILE "homescreen.conf"
 #define ICO_ONSCREEN_CONFIG_FILE   "onscreen.conf"
 #define ICO_STATUSBAR_CONFIG_FILE  "statusbar.conf"
 
-/*============================================================================*/
-/* Class Declaration (CicoHomeScreenConfig)                               */
-/*============================================================================*/
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ */
+//--------------------------------------------------------------------------
 class CicoHomeScreenConfig
 {
-  public:
+public:
+    // constructor
     CicoHomeScreenConfig();
+
+    // destructor
+    ~CicoHomeScreenConfig();
+
+    // intialize
     int Initialize(const char *conf);
+
+    // get integer value
     int ConfigGetInteger(const char *group_name, 
-                         const char *key, int default_value);
-    const char* ConfigGetString(const char *group_name, const char *key,
-                   const char *default_value);
-  private:
-    GKeyFile *config_key;
-    gboolean is_open_config;
-
-  protected:
-    CicoHomeScreenConfig operator = (const CicoHomeScreenConfig&);
+                         const char *key,
+                         int        default_value);
+
+    // get string value
+    const char* ConfigGetString(const char *group_name,
+                                const char *key,
+                                const char *default_value);
+
+private:
+    // assignment operator
+    CicoHomeScreenConfig operator=(const CicoHomeScreenConfig&);
+
+    // copy constructor
     CicoHomeScreenConfig(const CicoHomeScreenConfig&);
-};
 
-#endif
+private:
+    GKeyFile *m_gKeyFile;
+};
+#endif  // __CICO_HOMESCREEN_CONFIG_H__
+// vim: set expandtab ts=4 sw=4:
index 2459929..6a1ef77 100644 (file)
@@ -250,7 +250,7 @@ CicoOnScreenAction::EcoreEvent(void *data)
  *
  * @param[in]   data                user data
  * @param[in]   obj                 evas object of the button
- * @param[in]   event_info          evas event infomation
+ * @param[in]   event_info          evas event information
  * @return      none
  */
 /*--------------------------------------------------------------------------*/
@@ -283,7 +283,7 @@ CicoOnScreenAction::TouchUpEdje(void *data, Evas *evas, Evas_Object *obj, void *
  *
  * @param[in]   data                user data
  * @param[in]   obj                 evas object of the button
- * @param[in]   event_info          evas event infomation
+ * @param[in]   event_info          evas event information
  * @return      none
  */
 /*--------------------------------------------------------------------------*/
index d942ab7..c4676b3 100644 (file)
@@ -511,7 +511,7 @@ bool CicoSCAilItems::categoryParseCategory(const string& s)
  */
 bool CicoSCAilItems::categoryParseGetValue(const std::string& s,
                                            const std::string& k,
-                                           std::string val)
+                                           std::string val)
 {
     ICO_TRA("start, %s, %s", s.c_str(), k.c_str());
     const char* ps = s.c_str();
@@ -539,7 +539,7 @@ bool CicoSCAilItems::categoryParseGetValue(const std::string& s,
         ICO_TRA("end NG");
         return false;
     }
-    val = ps[c2];
+    val = s.substr(c2);
     ICO_TRA("end %s", val.c_str());
     return true;
 }
index f6cbde2..596dd50 100644 (file)
@@ -53,7 +53,7 @@ protected: // member method
     bool categoryParseKind(const std::string& s);
     bool categoryParseCategory(const std::string& s);
     bool categoryParseGetValue(const std::string& s, const std::string& k,
-                               std::string val);
+                               std::string val);
     bool categoryGetDisplay(const std::string& disp, const std::string& layer,
                             const std::string& zone);
     bool categoryGetSound(const std::string& sound, const std::string& zone);
index 05f8014..b8ccee1 100644 (file)
@@ -30,6 +30,7 @@ CicoSCAulItems::CicoSCAulItems()
     ICO_TRA("CicoSCAulItems::CicoSCAulItems");
     m_appid.clear(); // appid
     m_pid = 0; // pid
+    m_aulstt = AUL_R_OK;
     m_defCgrpCpu.clear();
     m_defCgrpMem.clear();
 }
@@ -37,9 +38,9 @@ CicoSCAulItems::CicoSCAulItems()
 /**
  * @brief AUL Items class constructor
  */
-CicoSCAulItems::CicoSCAulItems(const char* appid, int pid,
+CicoSCAulItems::CicoSCAulItems(const char* appid, int pid, int aulstt,
                                const CicoSCWindow* obj)
-    :m_appid(appid), m_pid(pid)
+    :m_appid(appid), m_pid(pid), m_aulstt(aulstt)
 {
     ICO_TRA("CicoSCAulItems::CicoSCAulItems");
     enterWindow(obj);
@@ -53,6 +54,7 @@ CicoSCAulItems::CicoSCAulItems(const CicoSCAulItems& s)
 {
     m_appid = s.m_appid;
     m_pid = s.m_pid;
+    m_aulstt = s.m_aulstt;
 #if 1 // TODO mk_k
     m_CSCWptrs = s.m_CSCWptrs;
 #else
@@ -113,7 +115,7 @@ void CicoSCAulItems::enterWindow(const CicoSCWindow* obj)
 }
 
 /**
- * @breif removw CicoSCWindow pointer
+ * @brief removw CicoSCWindow pointer
  * @param obj remove target
  */
 void CicoSCAulItems::rmWindow(const CicoSCWindow* obj)
@@ -133,7 +135,7 @@ void CicoSCAulItems::rmWindow(const CicoSCWindow* obj)
 }
 
 /**
- * @breif get cgroup data by /proc/[pid]/cgroup file
+ * @brief get cgroup data by /proc/[pid]/cgroup file
  * @parm pid target pid number
  * @param m store cgroup memory directory data
  * @param c store cgroup cpu,cpuacct directory data
@@ -184,3 +186,21 @@ bool CicoSCAulItems::getPidCgroupInfo(int pid, string& m, string& c)
     return bR;
 }
 
+/**
+ * @breif appid update
+ */
+void CicoSCAulItems::update_appid()
+{
+    if (AUL_R_OK == m_aulstt) {
+        return;
+    }
+    ICO_TRA("update start %d, %s", m_aulstt, m_appid.c_str());
+    char buf[255];
+    buf[0] = '\0'; // STOP CODE
+    m_aulstt = aul_app_get_appid_bypid(m_pid, buf, sizeof(buf));
+    if (AUL_R_OK == m_aulstt) {
+        m_appid = buf;
+    }
+    ICO_TRA("update end %d, %s", m_aulstt, m_appid.c_str());
+    return ;
+}
index 7d12b2b..b3773c0 100644 (file)
@@ -19,20 +19,22 @@ class CicoSCWindow;
 
 /**
  * @brief System controller unit
- *        application life cycle infomation data
+ *        application life cycle information data
  *
  */
 
 class CicoSCAulItems {
 public: // member method
     CicoSCAulItems();
-    CicoSCAulItems(const char* appid, int pid, const CicoSCWindow* obj=NULL);
+    CicoSCAulItems(const char* appid, int pid, int aulstt,
+                   const CicoSCWindow* obj=NULL);
     CicoSCAulItems(const CicoSCAulItems& raul);
     ~CicoSCAulItems();
 
     const CicoSCAulItems* p() const;
     void enterWindow(const CicoSCWindow* obj);
     void rmWindow(const CicoSCWindow* obj);
+    void update_appid();
 protected: // member method
     bool getPidCgroupInfo(int pid, std::string& m, std::string& c);
 private: // member method
@@ -45,35 +47,7 @@ public: // member aria
 protected: // member aria
     std::string m_defCgrpCpu;
     std::string m_defCgrpMem;
-
-#if 0 // TODO mk_k
-//    std::string m_icon; // icon file path
-    bool m_active; //
-    bool m_supend; //
-    std::string m_group;
-    int  m_nodeID;
-    std::string m_location;
-    std::string m_animation;
-    int m_animationTime;
-    bool m_autoStart; // auto start flag
-    bool m_memnuOverlap;
-    int  m_invisibleCPU;
-    int  m_kindID;
-    int  m_categoryID;
-    int  m_displayZoneNum; // display zone number
-    int  m_soundZoneNum;  // sound zone number
-    int  m_inputDevNum;   // input device number
-    int  m_display;
-    int  m_sound;
-    int  m_input;
-
-
-
-    std::string m_name;
-    std::string m_execPath;
-    std::string m_type;
-    bool m_resumeShow
-#endif
+    int m_aulstt;
 };
 
 inline const CicoSCAulItems* CicoSCAulItems::p() const
index 8b5a969..7dc56a5 100644 (file)
 /**
  *  @file   CicoSCConf.h
  *
- *  @brief  
+ *  @brief  This file is definition of SystemConfigs
  */
 //==========================================================================
 #ifndef __CICO_SC_CONF_H__
 #define __CICO_SC_CONF_H__
 
-#include <boost/property_tree/ptree.hpp>
-#include <boost/property_tree/xml_parser.hpp>
-#include <boost/foreach.hpp>
-
 #include <string>
-#include <map>
 #include <vector>
-using namespace std;
-using namespace boost;
-using namespace boost::property_tree;
+#include <sstream>
 
-#include "CicoLog.h"
+#include <ico_log.h>
    
+//==========================================================================
+/**
+ *  @brief  enumeration of node type
+ */
+//==========================================================================
 typedef enum _node_type {
-    ICO_NODETYPE_CENTER     = 0,    //!< Center display
-    ICO_NODETYPE_METER      = 1,    //!< Meter display
-    ICO_NODETYPE_REMOTE     = 2,    //!< Information device(mobile device)
-    ICO_NODETYPE_PASSENGER  = 3,    //!< Passenger display
-    ICO_NODETYPE_REAR       = 4,    //!< Rear-seat entertainment
-    ICO_NODETYPE_REARLEFT   = 5,    //!< Rear-seat entertainment(Left)
-    ICO_NODETYPE_REARRIGHT  = 6,    //!< Rear-seat entertainment(right)
+    ICO_NODETYPE_CENTER     = 0,    ///< Center display
+    ICO_NODETYPE_METER      = 1,    ///< Meter display
+    ICO_NODETYPE_REMOTE     = 2,    ///< Information device(mobile device)
+    ICO_NODETYPE_PASSENGER  = 3,    ///< Passenger display
+    ICO_NODETYPE_REAR       = 4,    ///< Rear-seat entertainment
+    ICO_NODETYPE_REARLEFT   = 5,    ///< Rear-seat entertainment(Left)
+    ICO_NODETYPE_REARRIGHT  = 6,    ///< Rear-seat entertainment(right)
 } ico_nodetype_e;
 
+//==========================================================================
+/**
+ *  @brief  enumeration of display type
+ */
+//==========================================================================
 typedef enum _display_type {
-    ICO_DISPLAYTYPE_CENTER    = 0,  //!< Center display           
-    ICO_DISPLAYTYPE_METER     = 1,  //!< Meter display            
-    ICO_DISPLAYTYPE_REMOTE    = 2,  //!< Information device(mobile device)
-    ICO_DISPLAYTYPE_PASSENGER = 3,  //!< Passenger display        
-    ICO_DISPLAYTYPE_REAR      = 4,  //!< Rear-seat display        
-    ICO_DISPLAYTYPE_REARLEFT  = 5,  //!< Rear-seat display(left)  
-    ICO_DISPLAYTYPE_REARRIGHT = 6,  //!< Rear-seat display(right) 
+    ICO_DISPLAYTYPE_CENTER    = 0,  ///< Center display
+    ICO_DISPLAYTYPE_METER     = 1,  ///< Meter display
+    ICO_DISPLAYTYPE_REMOTE    = 2,  ///< Information device(mobile device)
+    ICO_DISPLAYTYPE_PASSENGER = 3,  ///< Passenger display
+    ICO_DISPLAYTYPE_REAR      = 4,  ///< Rear-seat display
+    ICO_DISPLAYTYPE_REARLEFT  = 5,  ///< Rear-seat display(left)
+    ICO_DISPLAYTYPE_REARRIGHT = 6,  ///< Rear-seat display(right)
 } ico_display_type_e;
 
+//==========================================================================
+/**
+ *  @brief  enumeration of policy type
+ */
+//==========================================================================
 typedef enum _policy {
-    ICO_POLICY_ALWAYS         = 0,  //!< No control
-    ICO_POLICY_RUNNING        = 1,  //!< Runnning only
-    ICO_POLICY_PARKED         = 2,  //!< Parked only
-    ICO_POLICY_SHIFT_PARKING  = 3,  //!< Shift-position is park
-    ICO_POLICY_SHIFT_REVERSES = 4,  //!< Shift-position is reverses
-    ICO_POLICY_BLINKER_LEFT   = 5,  //!< Blinker is left
-    ICO_POLICY_BLINKER_RIGHT  = 6,  //!< Blinker is right
+    ICO_POLICY_ALWAYS         = 0,  ///< No control
+    ICO_POLICY_RUNNING        = 1,  ///< Running only
+    ICO_POLICY_PARKED         = 2,  ///< Parked only
+    ICO_POLICY_SHIFT_PARKING  = 3,  ///< Shift-position is park
+    ICO_POLICY_SHIFT_REVERSES = 4,  ///< Shift-position is reverses
+    ICO_POLICY_BLINKER_LEFT   = 5,  ///< Blinker is left
+    ICO_POLICY_BLINKER_RIGHT  = 6,  ///< Blinker is right
 } ico_policy_e;
 
+//==========================================================================
+/**
+ *  @brief  enumeration of application privilege
+ */
+//==========================================================================
 typedef enum _privilege {
-    ICO_PRIVILEGE_ALMIGHTY       = 0,   //!< almighty privilege
-    ICO_PRIVILEGE_SYSTEM         = 1,   //!< system level
-    ICO_PRIVILEGE_SYSTEM_AUDIO   = 2,   //!< system level(audio only)
-    ICO_PRIVILEGE_SYSTEM_VISIBLE = 3,   //!< system level(visible only)
-    ICO_PRIVILEGE_MAKER          = 4,   //!< maker level
-    ICO_PRIVILEGE_CERTIFICATE    = 5,   //!< certificated
-    ICO_PRIVILEGE_NONE           = 6,   //!< no privilege
+    ICO_PRIVILEGE_ALMIGHTY       = 0,   ///< almighty privilege
+    ICO_PRIVILEGE_SYSTEM         = 1,   ///< system level
+    ICO_PRIVILEGE_SYSTEM_AUDIO   = 2,   ///< system level(audio only)
+    ICO_PRIVILEGE_SYSTEM_VISIBLE = 3,   ///< system level(visible only)
+    ICO_PRIVILEGE_MAKER          = 4,   ///< maker level
+    ICO_PRIVILEGE_CERTIFICATE    = 5,   ///< certificated
+    ICO_PRIVILEGE_NONE           = 6,   ///< no privilege
 } ico_privilege_e;
 
-#define ICO_SYC_CONFIG_APPATTR  "app_attr.conf"
+#define ICO_SYC_CONFIG_APPATTR  "app_attr.conf" //TODO
 
 //==========================================================================
 /**
- *  @brief  
+ *  @brief  This class holds display information of system config
  */
 //==========================================================================
 class CicoSCNodeConf
 {
 public:
+    /// default constructor
     CicoSCNodeConf()
-        : id(-1), name(""), address(""), type(-1) { }
+        : id(-1), name(""), address(""), type(-1) {}
+
+    /// destructor
+    virtual ~CicoSCNodeConf() {}
 
+    /// dump log this class member variables
     void dumpConf(void)
     {
-        ICO_DBG("node : id(%d) name(%s) address(%s) type(%d)",
+        ICO_DBG("node: id=%d name=%s address=%s type=%d",
                  id, name.c_str(), address.c_str(), type);
     }
 
-    int    id;      //!< node id
-    string name;    //!< node name
-    string address; //!< node ip address
-    int    type;    //!< node type
+public:
+    int         id;      ///< node id
+    std::string name;    ///< node name
+    std::string address; ///< node ip address
+    int         type;    ///< node type
 };
 
 //==========================================================================
 /**
- *  @brief  
+ *  @brief  This class holds layer information of system config
  */
 //==========================================================================
 class CicoSCLayerConf
 {
 public:
+    /// default constructor
     CicoSCLayerConf()
         : id(-1), name(""), type(-1), menuoverlap(false) {}
+
+    /// destructor
+    virtual ~CicoSCLayerConf() {}
+
+    /// dump log this class member variables
     void dumpConf(void)
     {
-        ICO_DBG("\tlayer : id(%d) name(%s) type(%d) menuoverlap(%s)",
-                id, name.c_str(), type,
-                menuoverlap ? "true" : "false");
+        ICO_DBG("  layer: id=%d name=%s type=%d menuoverlap=%s",
+                id, name.c_str(), type, menuoverlap ? "true" : "false");
     }
-    int    id;          //!< layer id
-    string name;        //!< layer name
-    int    type;        //!< layer type
-    bool   menuoverlap; //!< menu overlap flag
+
+public:
+    int         id;          ///< layer id
+    std::string name;        ///< layer name
+    int         type;        ///< layer type
+    bool        menuoverlap; ///< menu overlap flag
 };
 
 //==========================================================================
 /**
- *  @brief  
+ *  @brief  This class holds display zone information of system config
  */
 //==========================================================================
 class CicoSCDisplayZoneConf
 {
 public:
+    /// default constructor
     CicoSCDisplayZoneConf()
-        : id(-1), name(""), x(-1), y(-1), w(-1), h(-1){}
+        : id(-1), name(""), fullname(""), x(-1), y(-1), w(-1), h(-1) {}
+
+    /// destructor
+    virtual ~CicoSCDisplayZoneConf() {}
+
+    /// dump log this class member variables
     void dumpConf(void)
     {
-        ICO_DBG("\tdisplay zone : id(%d) name(%s) x(%d) y(%d) "
-                 "w(%d) h(%d) overlap(%s)",
-                 id, name.c_str(), x, y, w, h, overlapStr.c_str());
+        ICO_DBG("  zone: id=%d name=%s fullname=%s x=%d y=%d "
+                 "w=%d h=%d overlap=%s",
+                 id, name.c_str(), fullname.c_str(),
+                 x, y, w, h, overlapStr.c_str());
     }
-    int    id;      //!< display zone id
-    string name;    //!< display zone name
-    int    x;       //!< display zone x position
-    int    y;       //!< display zone y position
-    int    w;       //!< display zone width
-    int    h;       //!< display zone height
-    string overlapStr;
-    vector<bool> overlap;
+
+public:
+    int    id;              ///< display zone id
+    std::string name;       ///< display zone name
+    std::string fullname;   ///< display zone name
+    int    x;               ///< display zone x position
+    int    y;               ///< display zone y position
+    int    w;               ///< display zone width
+    int    h;               ///< display zone height
+    std::string overlapStr; ///< display overlap
+    std::vector<bool> overlap;  ///< display enable table
 
 };
 
 //==========================================================================
 /**
- *  @brief  
+ *  @brief  This class holds display information of system config
  */
 //==========================================================================
 class CicoSCDisplayConf
 {
 public:
+    /// default constructor
     CicoSCDisplayConf()
         : id(-1), name(""), node(-1), no(-1),
-          type(-1), width(-1), height(-1), inch(-1){}
+          type(-1), width(-1), height(-1), inch(-1) {}
+
+    /// destructor
+    virtual ~CicoSCDisplayConf() {}
+
+    /// dump log this class member variables
     void dumpConf(void)
     {
-        ICO_DBG("display : id(%d) name(%s) node(%d) no(%d)"
-                "type(%d), width(%d) height(%d) inch(%d)",
+        ICO_DBG("display: id=%d name=%s node=%d no=%d "
+                "type=%d width=%d height=%d inch=%d",
                 id, name.c_str(), node, no, type, width, height, inch);
     }
-    int    id;
-    string name;
-    int    node;
-    int    no;
-    int    type;
-    int    width;
-    int    height;
-    int    inch;
-    vector<CicoSCLayerConf*> layerConfList;
-    vector<CicoSCDisplayZoneConf*>  zoneConfList;
+
+public:
+    int         id;      ///< display id
+    std::string name;    ///< display name
+    int         node;    ///< display node id
+    int         no;      ///< display number
+    int         type;    ///< display type
+    int         width;   ///< display width resolution
+    int         height;  ///< display height resolution
+    int         inch;    ///< display inch size
+    std::vector<CicoSCLayerConf*>        layerConfList;  // layer config list
+    std::vector<CicoSCDisplayZoneConf*>  zoneConfList;   // zone config list
 };
 
 //==========================================================================
 /**
- *  @brief  
+ *  @brief  This class holds sound zone information of system config
  */
 //==========================================================================
 class CicoSCSoundZoneConf
 {
 public:
+    /// default constructor
     CicoSCSoundZoneConf()
-        : id(-1), name(""){}
+        : id(-1), name(""), fullname("") {}
+
+    /// destructor
+    virtual ~CicoSCSoundZoneConf() {}
+
+    /// dump log this class member variables
     void dumpConf(void)
     {
-        ICO_DBG("\tsound zone : id(%d) name(%s)", id, name.c_str());
+        ICO_DBG(" zone: id=%d name=%s fullname=%s",
+                id, name.c_str(), fullname.c_str());
     }
-    int    id;
-    string name;
+
+public:
+    int         id;         ///< sound zone id
+    std::string name;       ///< sound zone name
+    std::string fullname;   ///< sound zone full name
 };
 
 //==========================================================================
 /**
- *  @brief  
+ *  @brief  This class holds sound information of system config
  */
 //==========================================================================
 class CicoSCSoundConf
 {
 public:
+    /// default constructor
     CicoSCSoundConf()
-        : id(-1), name(""), no(-1){}
+        : id(-1), name(""), no(-1) {}
+
+    /// destructor
+    virtual ~CicoSCSoundConf() {}
+
+    /// dump log this class member variables
     void dumpConf(void)
     {
-        ICO_DBG("sound : id(%d) name(%s) no(%d)", id, name.c_str(), no);
+        ICO_DBG("sound: id=%d name=%s no=%d", id, name.c_str(), no);
     }
-    int    id;
-    string name;
-    int    no;
-    vector<CicoSCSoundZoneConf*>  zoneConfList;
+
+public:
+    int    id;          ///< sound id
+    std::string name;   ///< sound name
+    int    no;          ///< sound number
+    std::vector<CicoSCSoundZoneConf*>  zoneConfList; ///< sound config list
 };
 
 //==========================================================================
 /**
- *  @brief  
+ *  @brief  This class holds category information of system config
  */
 //==========================================================================
 class CicoSCCategoryConf
 {
 public:
+    /// default constructor
     CicoSCCategoryConf()
         : id(-1), name(""), type(""),
-          view(-1), sound(-1), input(-1), priority(0){}
+          view(-1), sound(-1), input(-1), priority(0), rctrl(-1) {}
+
+    /// destructor
+    virtual ~CicoSCCategoryConf() {}
+
+    /// dump log this class member variables
     void dumpConf(void)
     {
-        ICO_DBG("category : id(%d) name(%s) type(%s)"
-                 "view(%d) sound(%d) input(%d) priority(%d)",
+        ICO_DBG("category: id=%d name=%s type=%s "
+                 "view=%d sound=%d input=%d priority=%d",
                  id, name.c_str(), type.c_str(),
                  view, sound, input, priority);
     }
-    int id;
-    string name;
-    string type;
-    int view;
-    int sound;
-    int input;
-    int priority;
+
+public:
+    int         id;         ///< category id
+    std::string name;       ///< category name
+    std::string type;       ///< category type
+    int         view;       ///< category view
+    int         sound;      ///< category sound
+    int         input;      ///< category input
+    int         priority;   ///< category priority
+    int         rctrl;      ///< resource control information
 };
 
 //==========================================================================
 /**
- *  @brief  
+ *  @brief  This class holds application kind information of system config
  */
 //==========================================================================
 class CicoSCAppKindConf
 {
 public:
+    enum _privilege {
+        PRIVILEGE_ALMIGHTY       = 0, ///< almighty privilege
+        PRIVILEGE_SYSTEM         = 1, ///< system level
+        PRIVILEGE_SYSTEM_AUDIO   = 2, ///< system level(audio only)
+        PRIVILEGE_SYSTEM_VISIBLE = 3, ///< system level(visible only)
+        PRIVILEGE_MAKER          = 4, ///< maker level
+        PRIVILEGE_CERTIFICATE    = 5, ///< certificated
+        PRIVILEGE_NONE           = 6, ///< no privilege
+    };
+
+    /// default constructor
     CicoSCAppKindConf()
         : id(-1), name(""), privilege(-1), priority(0){}
+
+    /// destructor
+    virtual ~CicoSCAppKindConf() {}
+
+    /// dump log this class member variables
     void dumpConf(void)
     {
-        ICO_DBG("appkind : id(%d) name(%s) priority(%d) priority(%d)",
+        ICO_DBG("appkind: id=%d name=%s priority=%d priority=%d",
                  id, name.c_str(), privilege, priority);
     }
-    int id;
-    string name;
-    int privilege;
-    int priority;
+
+public:
+    int         id;         ///< application kind id
+    std::string name;       ///< application kind name
+    int         privilege;  ///< application privilege
+    int         priority;   ///< application priority
 };
 
 //==========================================================================
 /**
- *  @brief  
+ *  @brief  This class holds input device switch information of system config
  */
 //==========================================================================
 class CicoSCSwitchConf
 {
 public:
+    /// default constructor
     CicoSCSwitchConf()
         : id(-1), name(""), appid(""), keycode(0){}
+
+    /// destructor
+    virtual ~CicoSCSwitchConf() {}
+
+    /// dump log this class member variables
     void dumpConf(void)
     {
-        ICO_DBG("\tswitch : id(%d) name(%s) appid(%s)",
+        ICO_DBG("  switch: id=%d name=%s appid=%s",
                  id, name.c_str(), appid.c_str());
     }
-    int    id;
-    string name;
-    string appid;
-    int    keycode;
+
+public:
+    int         id;         ///< input device switch id
+    std::string name;       ///< input device switch name
+    std::string appid;      ///< fixed assign apllication name
+    int         keycode;    ///< keycode of input device switch
 };
 
 //==========================================================================
 /**
- *  @brief  
+ *  @brief  This class holds input device information of system config
  */
 //==========================================================================
 class CicoSCInputDevConf
 {
 public:
+    /// default constructor
     CicoSCInputDevConf()
-        : id(-1), name(""){}
+        : id(-1), name("") {}
+
+    /// destructor
+    virtual ~CicoSCInputDevConf() {}
+
+    /// dump log this class member variables
     void dumpConf(void)
     {
-        ICO_DBG("inputdev : id(%d) name(%s)", id, name.c_str());
+        ICO_DBG("inputdev: id=%d name=%s", id, name.c_str());
     }
-    int id;
-    string name;
-    vector<CicoSCSwitchConf*> switchConfList;
+
+public:
+    int         id;     ///< input device id
+    std::string name;   ///< input device name
+    std::vector<CicoSCSwitchConf*> switchConfList;  ///< switch list
 };
 
 //==========================================================================
 /**
- *  @brief  
+ *  @brief  This class holds default information of system config
  */
 //==========================================================================
 class CicoSCDefaultConf
 {
 public:
+    /// default constructor
     CicoSCDefaultConf()
         : topdir(""), confdir(""),
           node(-1), appkind(-1), category(-1), display(-1), 
           layer(-1), displayzone(-1), sound(-1), soundzone(-1),
           inputdev(-1), inputsw(-1) {};
+
+    /// destructor
+    virtual ~CicoSCDefaultConf() {}
+
+    /// dump log this class member variables
+    void dumpConf(void)
+    {
+        ICO_DBG("default: topdir=%s confdir=%s "
+                "node=%d appkind=%d category=%d "
+                "display=%d layer=%d displayzone=%d "
+                "sound=%d soundzone=%d inputdev=%d inputsw=%d",
+                topdir.c_str(), confdir.c_str(),
+                node, appkind, category, display, layer, displayzone,
+                sound, soundzone, inputdev, inputsw);
+    }
+
+public:
+    std::string topdir;         ///< top directory path
+    std::string confdir;        ///< config directory path
+    int         node;           ///< default application node id
+    int         appkind;        ///< default application kind
+    int         category;       ///< default application category
+    int         display;        ///< default application display
+    int         layer;          ///< default application display layer
+    int         displayzone;    ///< default application display zone
+    int         sound;          ///< default application sound
+    int         soundzone;      ///< default application sound zone
+    int         inputdev;       ///< default input device
+    int         inputsw;        ///< default input device switch
+};
+
+//==========================================================================
+/**
+ *  @brief  This class holds cpu resource group information of system config
+ */
+//==========================================================================
+class CicoSCCpuResourceGrp
+{
+public:
+    /// default constructor
+    CicoSCCpuResourceGrp()
+        :m_id(-1), m_bDoIt(false), m_grpNm("") {}
+
+    /// destructor
+    virtual ~CicoSCCpuResourceGrp() {}
+
+    /// dump log this class member variables
     void dumpConf(void)
     {
-        ICO_DBG("default : topdir(%s) confdir(%s) "
-                 "node(%d) appkind(%d) category(%d) "
-                 "display(%d) layer(%d) displayzone(%d) "
-                 "sound(%d)" "soundzone(%d) "
-                 "inputdev(%d) inputsw(%d)",
-                 topdir.c_str(), confdir.c_str(),
-                 node, appkind, category,
-                 display, layer, displayzone,
-                 sound, soundzone,
-                 inputdev, inputsw);
+        std::stringstream hightlist;
+        {
+            std::vector<int>::iterator itr = m_hight.begin();
+            for (; itr != m_hight.end(); ++itr) {
+                hightlist << " " << *itr;
+            }
+
+        }
+
+        std::stringstream lowlist;
+        {
+            std::vector<int>::iterator itr = m_low.begin();
+            for (; itr != m_low.end(); ++itr) {
+                lowlist << " " << *itr;
+            }
+
+        }
+
+        ICO_DBG("cpu reousrce group; id=%d doIt=%s grpNm=%s, high=%d, low=%d",
+                m_id, m_bDoIt? "true": "false", m_grpNm.c_str(),
+                hightlist.str().c_str(), lowlist.str().c_str());
+    };
+
+public:
+    int              m_id;      ///< cpu resource group id
+    bool             m_bDoIt;   ///< cpu resouce control enable flag
+    std::string      m_grpNm;   ///< cpu resource group name
+    std::vector<int> m_hight;   ///< hight threshold list
+    std::vector<int> m_low;     ///< low threshold list
+};
+
+//==========================================================================
+/**
+ *  @brief  This class holds system resource information of system config
+ */
+//==========================================================================
+class CicoSCResourceConf
+{
+public:
+    /// default constructor
+    CicoSCResourceConf()
+        :m_bDoIt(false), m_bLog(false), m_cpuCGRPPath(""), m_sampling(-1),
+         m_retryCnt(5), m_lowLimitVal(25), m_highLimitVal(90) {}
+
+    /// destructor
+    virtual ~CicoSCResourceConf() {}
+
+    /// dump log this class member variables
+    void dumpConf(void)
+    {
+        ICO_DBG("do:%s, log:%s, dir:%s, smpl:%d r:%d l:%d h:%d sz:%d",
+                m_bDoIt? "true": "false", m_bLog? "true": "false",
+                m_cpuCGRPPath.c_str(), m_sampling, m_retryCnt, m_lowLimitVal,
+                m_highLimitVal, m_cpuCtrl.size());
     }
-    string topdir;
-    string confdir;
-    int node;
-    int appkind;
-    int category;
-    int display;
-    int layer;
-    int displayzone;
-    int sound;
-    int soundzone;
-    int inputdev;
-    int inputsw;
+
+public:
+    bool        m_bDoIt;        ///< resource control enable flag
+    bool        m_bLog;         ///< resource control log enable flag
+    std::string m_cpuCGRPPath;  ///< cpu cgroup path
+    int         m_sampling;     ///< sampling period
+    int         m_retryCnt;     ///< retry count
+    int         m_lowLimitVal;  ///< low limit value
+    int         m_highLimitVal; ///< high limit value
+    std::vector<CicoSCCpuResourceGrp*> m_cpuCtrl; ///< cpu control config list
 };
 
 //==========================================================================
index c607699..e00f9ca 100644 (file)
@@ -23,6 +23,7 @@
 #include "CicoSCLifeCycleController.h"
 #include "CicoSCConf.h"
 #include "CicoSCSystemConfig.h"
+#include "Cico_aul_listen_app.h"
 
 using namespace std;
 
@@ -111,12 +112,47 @@ static int CSCLCCapp_dead_handler(int pid, void *data)
 
 
 /**
+ * @brief This API get application appid by pid
+ * @param pid
+ * @param appid store appid string
+ * @param len appid buffer size
+ * @ret aul_app_get_appid_bypid return value
+ * @retval AUL_R_OK    - success
+ * @retval AUL_R_ERROR - no such a appid
+ */
+int Xaul_app_get_appid_bypid(int pid, char *appid, int len)
+{
+    int r = aul_app_get_appid_bypid(pid, appid, len);
+    if (AUL_R_OK == r) {
+        return r;
+    }
+    char fn[128];
+    sprintf(fn, "/proc/%d/cmdline", pid);
+    string tmp;
+    ifstream ifs(fn);
+    ifs >> tmp;
+    ifs.close();
+    const char* p = tmp.c_str();
+    int sz = strlen(p);
+    int i = sz - 2;
+    while (0 <= i) {
+        if ('/' == p[i]) {
+            strncpy(appid, &p[i+1], len);
+            break; // break of while i
+        }
+        i--;
+    }
+    return r;
+}
+
+/**
  * @brief contractor
  */
 CicoSCLifeCycleController::CicoSCLifeCycleController()
 {
     m_gconf = (GKeyFile*)NULL;
     m_pc = (pkgmgr_client*)NULL;
+    ailRenewFlagOff();
     initAIL();
     initAUL();
 }
@@ -321,28 +357,33 @@ int CicoSCLifeCycleController::suspend(int pid)
 }
 
 /**
- * @brief appid is runnning check
+ * @brief appid is running check
  * @param appid package
  * @return running status
- * @retval true is runnning
- * @retval false not runnning
+ * @retval true is running
+ * @retval false not running
  */
-bool CicoSCLifeCycleController::isRunning(const char* appid) const
+bool CicoSCLifeCycleController::isRunning(const char* appid)
 {
     ICO_TRA("start %s", appid);
     bool r = false;
 #if 0 // TODO mk_k
-    vector<CicoSCAulItems>::iterator it;
-    for (it = m_aul.begin(); it != m_aul.end(); ++it) {
-        if (0 == strcasecmp(it->m_appid.c_str(), appid)) {
+    vector<CicoSCAulItems>::iterator it = m_aul.begin();
+    while (it != m_aul.end()) {
+        it->update_appid();
+        ICO_DBG("%s == %s", it->m_appid.c_str(), appid);
+        if (it->m_appid == appid) {
             r = true;
-            break;
+            break;  // break of while it
         }
+        ++it;
     }
 #else
     int sz = m_aul.size();
     for (int i = 0; i < sz; i++) {
-        if (0 == strcasecmp(m_aul[i].m_appid.c_str(), appid)) {
+        m_aul[i].update_appid();
+        ICO_DBG("%s == %s", m_aul[i].m_appid.c_str(), appid);
+        if (m_aul[i].m_appid == appid) {
             r = true;
             break;
         }
@@ -353,13 +394,13 @@ bool CicoSCLifeCycleController::isRunning(const char* appid) const
 }
 
 /**
- * @brief appid is runnning check
+ * @brief appid is running check
  * @param appid package
  * @return running status
- * @retval true is runnning
- * @retval false not runnning
+ * @retval true is running
+ * @retval false not running
  */
-bool CicoSCLifeCycleController::isRunning(const std::string& appid) const
+bool CicoSCLifeCycleController::isRunning(const std::string& appid)
 {
     return isRunning((const char*)appid.c_str());
 }
@@ -409,6 +450,7 @@ bool CicoSCLifeCycleController::getPIDs(const char* appid, std::vector<int>& pid
 #if 0 // TODO mk_k
     vector<CicoSCAulItems>::iterator it;
     for (it = m_aul.begin(); it != m_aul.end(); ++it) {
+        it->update_appid();
         if (0 == strcasecmp(it->m_appid.c_str(), appid)) {
             pids.push_back(it->m_pid);
             r = true;
@@ -417,7 +459,8 @@ bool CicoSCLifeCycleController::getPIDs(const char* appid, std::vector<int>& pid
 #else
     int sz = m_aul.size();
     for (int i = 0; i < sz; i++) {
-        const CicoSCAulItems* t = m_aul[i].p();
+        CicoSCAulItems* t = (CicoSCAulItems*)m_aul[i].p();
+        t->update_appid();
         if (0 == strcasecmp(t->m_appid.c_str(), appid)) {
             pids.push_back(t->m_pid);
             r = true;
@@ -443,14 +486,15 @@ bool CicoSCLifeCycleController::getPIDs(std::string& appid, std::vector<int>& pi
  * @param appid target application appid
  * @return pid
  */
-const CicoSCAulItems* CicoSCLifeCycleController::findAUL(int pid) const
+const CicoSCAulItems* CicoSCLifeCycleController::findAUL(int pid)
 {
     ICO_TRA("start %d", pid);
     const CicoSCAulItems* r = NULL;
     int sz = m_aul.size();
     for (int i = 0; i < sz; i++) {
-        const CicoSCAulItems* t = m_aul[i].p();
+        CicoSCAulItems* t = (CicoSCAulItems*)m_aul[i].p();
         if (t->m_pid == pid) {
+            t->update_appid();
             r = t;
             ICO_DBG("find %d -> %s", pid, t->m_appid.c_str());
             break; // break of for
@@ -462,22 +506,27 @@ const CicoSCAulItems* CicoSCLifeCycleController::findAUL(int pid) const
 
 
 /**
- * @brief ail infomation data initialization
+ * @brief ail information data initialization
  */
 void CicoSCLifeCycleController::initAIL()
 {
-    ICO_TRA("start");
+    ICO_TRA("start %x", m_pc);
     createAilItems();
     if ((pkgmgr_client*)NULL == m_pc) {
         m_pc = pkgmgr_client_new(PC_LISTENING);
         int r = pkgmgr_client_listen_status(m_pc, CSCLCCpkgmgr_handler,
                                             (void*)this);
-        if (PKGMGR_R_OK != r) {
+        ICO_TRA("pkgmgr_xxxx %x, %d", m_pc, r);
+//        if (PKGMGR_R_OK != r)
+        // pkgmgr_client_listen_status return is
+        // request_id (>0) if success, error code(<0) if fail
+        // PKGMGR_R_OK success (PKGMGR_R_OK is 0)
+        if (0 > r) {
             pkgmgr_client_free(m_pc);
             m_pc = NULL;
         }
     }
-    ICO_TRA("end");
+    ICO_TRA("end %x", m_pc);
 }
 
 /**
@@ -512,7 +561,7 @@ void CicoSCLifeCycleController::renewAIL()
     vector<CicoSCAilItems> old = m_ail;
     m_ail.clear();
     int cnt =0;
-    while (true == createAilItems()) {
+    while (false == createAilItems()) {
         if (cnt > 500) {
             m_ail.clear();
             m_ail = old;
@@ -562,6 +611,7 @@ void CicoSCLifeCycleController::renewAIL()
     }
 #endif
     old.clear();
+    ailRenewFlagOn();
     return;
 }
 
@@ -647,7 +697,7 @@ ail_cb_ret_e CSCLCCail_list_appinfo_cbX(const ail_appinfo_h appinfo,
 }
 
 /**
- * @brief create infomation ail data
+ * @brief create information ail data
  * @retval true success
  * @retval false fail create
  */
@@ -712,7 +762,7 @@ bool CicoSCLifeCycleController::createAilItems()
 }
 
 /**
- * @brief ail infomation data add one item
+ * @brief ail information data add one item
  * @param sPkg string package (appid)
  * @param sIco string icon full path
  * @param sNm string name
@@ -808,13 +858,13 @@ void CicoSCLifeCycleController::getCategory(const char* sPkg, const char* sNm,
 }
 
 /**
- * @brief aul infomation data initialization
+ * @brief aul information data initialization
  */
 void CicoSCLifeCycleController::initAUL()
 {
     ICO_TRA("start");
-    aul_listen_app_launch_signal(CSCLCCapp_launch_handler, (void*)this);
-    aul_listen_app_dead_signal(CSCLCCapp_dead_handler, (void*)this);
+    aul_listen_app_launch_signal_add(CSCLCCapp_launch_handler, (void*)this);
+    aul_listen_app_dead_signal_add(CSCLCCapp_dead_handler, (void*)this);
     ICO_TRA("end");
 }
 
@@ -822,7 +872,7 @@ void CicoSCLifeCycleController::initAUL()
  * @brief
  */
 void CicoSCLifeCycleController::enterAUL(const char* appid, int pid,
-                                         const CicoSCWindow* obj)
+                                         const CicoSCWindow* obj, int aulstt)
 {
     ICO_TRA("start");
     bool bPushBack = true;
@@ -845,8 +895,8 @@ void CicoSCLifeCycleController::enterAUL(const char* appid, int pid,
     }
     if (true == bPushBack) { // push back flag on?
         // AUL list Unregistered
-        ICO_DBG("push_back(AUL(%s, %d, %x))", appid, pid, obj);
-        m_aul.push_back(CicoSCAulItems(appid, pid, obj));
+        ICO_DBG("push_back(AUL(%s, %d, %d, %x))", appid, pid, aulstt, obj);
+        m_aul.push_back(CicoSCAulItems(appid, pid, aulstt, obj));
     }
     ICO_TRA("end");
 }
@@ -877,15 +927,16 @@ bool CicoSCLifeCycleController::removeAUL(int pid)
  */
 int CSCLCCapp_launch_handlerX(int pid, CicoSCLifeCycleController* x)
 {
-    ICO_TRA("start");
+    ICO_TRA("start %d, %x", pid, x);
     if ((NULL == x) || (0 == x)) {
         ICO_TRA("end user data is NULL");
         return -1;
     }
     char appid[255];
-    aul_app_get_appid_bypid(pid, appid, sizeof(appid));
-    ICO_DBG("added %s, %d", appid, pid);
-    x->enterAUL(appid,pid);
+    memset(appid, 0, sizeof(appid));
+    int iR = Xaul_app_get_appid_bypid(pid, appid, sizeof(appid));
+    ICO_DBG("%d=aul_app_get_appid_bypid  %d , %s", iR, pid, appid);
+    x->enterAUL(appid, pid, NULL, iR);
     ICO_TRA("end %s %d", appid, pid);
     return 0;
 }
@@ -912,3 +963,17 @@ int CSCLCCapp_dead_handlerX(int pid, CicoSCLifeCycleController* x)
     return 0;
 }
 
+/**
+ * @brief AUL information list
+ * @return AUL information item list Container
+ */
+const vector<CicoSCAulItems>& CicoSCLifeCycleController::getAulList()
+{
+    int sz = m_aul.size();
+    for (int i = 0; i < sz; i++) {
+        CicoSCAulItems* t = (CicoSCAulItems*)m_aul[i].p();
+        t->update_appid();
+    }
+    return m_aul;
+}
+
index 3f4adfc..8a35950 100644 (file)
@@ -13,6 +13,7 @@
 #include <map>
 #include <ail.h>
 #include <package-manager.h>
+#include <aul/aul.h>
 
 #include "CicoSCAilItems.h"
 #include "CicoSCAulItems.h"
@@ -42,23 +43,26 @@ public:
     int suspend(const std::string& appid);
     int suspend(int pid);
     // run application check
-    bool isRunning(const char* appid) const;
-    bool isRunning(const std::string& appid) const;
+    bool isRunning(const char* appid);
+    bool isRunning(const std::string& appid);
 
     const std::vector<CicoSCAilItems>& getAilList() const;
     const CicoSCAilItems* findAIL(const char* appid) const;
     const CicoSCAilItems* findAIL(const std::string& appid) const;
+    bool isAilRenew() const;
+    void ailRenewFlagOff();
 
-    const std::vector<CicoSCAulItems>& getAulList() const;
+    const std::vector<CicoSCAulItems>& getAulList();
 // TODO mk_k Should I think about the multiple return values start
 /*
     const CicoSCAulItems* findAUL(const char* appid) const;
     const CicoSCAulItems* findAUL(const std::string& appid) const;
 */
-    const CicoSCAulItems* findAUL(int pid) const;
+    const CicoSCAulItems* findAUL(int pid);
     bool getPIDs(const char* appid, std::vector<int>& pids) const;
     bool getPIDs(std::string& appid, std::vector<int>& pids) const;
-    void enterAUL(const char* appid, int pid, const CicoSCWindow* obj=NULL);
+    void enterAUL(const char* appid, int pid, const CicoSCWindow* obj = NULL,
+                  int aulstt = AUL_R_OK);
 
 
 protected:
@@ -73,6 +77,7 @@ protected:
                                  const char *val, const void *pmsg,
                                  CicoSCLifeCycleController *x);
     void renewAIL();
+    void ailRenewFlagOn();
     void initAUL();
     friend int CSCLCCapp_launch_handlerX(int pid,
                                          CicoSCLifeCycleController *x);
@@ -93,11 +98,12 @@ protected:
     std::vector<CicoSCAulItems> m_aul;
     GKeyFile* m_gconf;
     pkgmgr_client* m_pc;
+    bool m_ailRenew;
 };
 
 /**
- * @brief AIL infomaton list
- * @return AIL infomation item list Container
+ * @brief AIL information list
+ * @return AIL information item list Container
  */
 inline
 const std::vector<CicoSCAilItems>& CicoSCLifeCycleController::getAilList() const
@@ -107,15 +113,30 @@ const std::vector<CicoSCAilItems>& CicoSCLifeCycleController::getAilList() const
 
 
 /**
- * @brief AUL infomaton list
- * @return AUL infomation item list Container
+ * @brief AIL change flag is on?
+ * @ret bool
+ * @retval true change flag on
+ * @retval false change flag off
  */
-inline
-const std::vector<CicoSCAulItems>& CicoSCLifeCycleController::getAulList() const
+inline bool CicoSCLifeCycleController::isAilRenew() const
 {
-    return m_aul;
+    return m_ailRenew;
 }
 
+/**
+ * @brief AIL change flag off set
+ */
+inline void CicoSCLifeCycleController::ailRenewFlagOff()
+{
+    m_ailRenew = false;
+}
 
+/**
+ * @brief AIL change flag on set
+ */
+inline void CicoSCLifeCycleController::ailRenewFlagOn()
+{
+    m_ailRenew = true;
+}
 
 #endif // CICOSCLIFECYCLECONTROLLER_H
index 33ccd06..00e7c62 100644 (file)
@@ -11,7 +11,7 @@
 /**
  *  @file   CicoSCSystemConfig.cpp
  *
- *  @brief  
+ *  @brief  This file implementation of CicoSCSystemConfig class
  */
 /*========================================================================*/    
 
@@ -50,7 +50,7 @@ CicoSCSystemConfig::CicoSCSystemConfig()
 
     // 
     m_categoryTalbe[""]              = ICO_POLICY_ALWAYS;
-    m_categoryTalbe["alway"]         = ICO_POLICY_ALWAYS;
+    m_categoryTalbe["always"]        = ICO_POLICY_ALWAYS;
     m_categoryTalbe["run"]           = ICO_POLICY_RUNNING;
     m_categoryTalbe["park"]          = ICO_POLICY_PARKED;
     m_categoryTalbe["shift_park"]    = ICO_POLICY_SHIFT_PARKING;
@@ -68,9 +68,8 @@ CicoSCSystemConfig::CicoSCSystemConfig()
     m_privilegeTable["certificate"]    = ICO_PRIVILEGE_CERTIFICATE;
     m_privilegeTable["none"]           = ICO_PRIVILEGE_NONE;
     m_privilegeTable[""]               = ICO_PRIVILEGE_NONE;
-
+    m_resourceConf = NULL;
     m_userConf = NULL;
-
 }
 
 //--------------------------------------------------------------------------
@@ -103,7 +102,7 @@ CicoSCSystemConfig::getInstance(void)
 /**
  *  @brief  Get instance of CicoSCSystemConfig
  *
- *  @param  [IN]    confFile    config file name
+ *  @param  [in]    confFile    config file name
  *  @return 0 on success, other on error
  */
 //--------------------------------------------------------------------------
@@ -122,7 +121,7 @@ CicoSCSystemConfig::load(const string & confFile)
     createInputDevList(root);
     createDefaultConf(root);
     createLogConf(root);
-
+    createResourceConf(root);
     createUserConf(root);
 
     return 0;   //TODO
@@ -132,7 +131,20 @@ CicoSCSystemConfig::load(const string & confFile)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
+ */
+//--------------------------------------------------------------------------
+const vector<CicoSCNodeConf*>&
+CicoSCSystemConfig::getNodeConfList(void) const
+{
+    return m_nodeConfList;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 const vector<CicoSCDisplayConf*>&
@@ -145,7 +157,59 @@ CicoSCSystemConfig::getDisplayConfList(void) const
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
+ */
+//--------------------------------------------------------------------------
+const vector<CicoSCSoundConf*>&
+CicoSCSystemConfig::getSoundConfList(void) const
+{
+    return m_soundConfList;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [in]
+ */
+//--------------------------------------------------------------------------
+const vector<CicoSCInputDevConf*> &
+CicoSCSystemConfig::getInputDevConfList(void) const
+{
+    return m_inputDevConfList;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [in]
+ */
+//--------------------------------------------------------------------------
+const vector<CicoSCCategoryConf*> &
+CicoSCSystemConfig::getCategoryConfList(void) const
+{
+    return m_categoryConfList;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [in]
+ */
+//--------------------------------------------------------------------------
+const vector<CicoSCAppKindConf*> &
+CicoSCSystemConfig::getAppKindConfList(void) const
+{
+    return m_appKindConfList;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 void
@@ -203,7 +267,7 @@ CicoSCSystemConfig::createNodeConfList(const ptree & root)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 void
@@ -302,7 +366,7 @@ CicoSCSystemConfig::createDisplayConfList(const ptree & root)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 void
@@ -353,12 +417,12 @@ CicoSCSystemConfig::createLayerConf(const ptree::value_type & child,
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 void
 CicoSCSystemConfig::createDisplayZoneConf(const ptree::value_type & child,
-                                   CicoSCDisplayConf* displayConf)
+                                          CicoSCDisplayConf* displayConf)
 {
     ptree zones = child.second.get_child("zones");
     BOOST_FOREACH (const ptree::value_type& zone, zones) {
@@ -407,12 +471,13 @@ CicoSCSystemConfig::createDisplayZoneConf(const ptree::value_type & child,
         }
 
         CicoSCDisplayZoneConf* zoneConf = new CicoSCDisplayZoneConf();
-        zoneConf->id   = id.get();
-        zoneConf->name = name.get();
-        zoneConf->x    = calcGeometryExpr(x.get(), displayConf);
-        zoneConf->y    = calcGeometryExpr(y.get(), displayConf);
-        zoneConf->w    = calcGeometryExpr(w.get(), displayConf);
-        zoneConf->h    = calcGeometryExpr(h.get(), displayConf);
+        zoneConf->id         = id.get();
+        zoneConf->name       = name.get();
+        zoneConf->fullname   = displayConf->name + "." + name.get();
+        zoneConf->x          = calcGeometryExpr(x.get(), displayConf);
+        zoneConf->y          = calcGeometryExpr(y.get(), displayConf);
+        zoneConf->w          = calcGeometryExpr(w.get(), displayConf);
+        zoneConf->h          = calcGeometryExpr(h.get(), displayConf);
         zoneConf->overlapStr = overlap.get();
         displayConf->zoneConfList.push_back(zoneConf);
 
@@ -424,7 +489,7 @@ CicoSCSystemConfig::createDisplayZoneConf(const ptree::value_type & child,
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 void
@@ -469,7 +534,7 @@ CicoSCSystemConfig::createSoundConfList(const ptree & root)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 void
@@ -492,14 +557,11 @@ CicoSCSystemConfig::createSoundZoneConf(const ptree::value_type & child,
         if (false == name.is_initialized()) {
             continue;
         }
-#if 0
-        cout << "id=" << id.get() << endl;
-        cout << "name=" << name.get() << endl;
-#endif
 
         CicoSCSoundZoneConf* zoneConf = new CicoSCSoundZoneConf();
-        zoneConf->id   = id.get();
-        zoneConf->name = name.get();
+        zoneConf->id       = id.get();
+        zoneConf->name     = name.get();
+        zoneConf->fullname = soundConf->name + "." + name.get();
         soundConf->zoneConfList.push_back(zoneConf);
 
         zoneConf->dumpConf();
@@ -510,7 +572,7 @@ CicoSCSystemConfig::createSoundZoneConf(const ptree::value_type & child,
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 void
@@ -531,12 +593,6 @@ CicoSCSystemConfig::createPortConf(const ptree & root)
             continue;
         }
 
-#if 0
-        cout << "id=" << id.get() << endl;
-        cout << "name=" << name.get() << endl;
-        cout << "port=" << child.second.data() << endl;
-#endif
-
         switch (id.get()) {
         case 0:
             // TODO
@@ -555,7 +611,7 @@ CicoSCSystemConfig::createPortConf(const ptree & root)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 void
@@ -571,6 +627,7 @@ CicoSCSystemConfig::createCategoryConf(const ptree & root)
         optional<string> sound;
         optional<string> input;
         optional<int> priority = optional<int>(-1);
+        optional<int> r_ctrl = optional<int>(-1);
         
         id = child.second.get_optional<int>("<xmlattr>.id");
         if (false == id.is_initialized()) {
@@ -600,15 +657,10 @@ CicoSCSystemConfig::createCategoryConf(const ptree & root)
         if (false == priority.is_initialized()) {
             continue;
         }
-#if 0
-        cout << "id=" << id.get() << endl;
-        cout << "name=" << name.get() << endl;
-        cout << "type=" << type.get() << endl;
-        cout << "view=" << view.get() << endl;
-        cout << "sound=" << sound.get() << endl;
-        cout << "input=" << input.get() << endl;
-        cout << "priority=" << priority.get() << endl;
-#endif
+        r_ctrl = child.second.get_optional<int>("r_ctrl");
+        if (false == r_ctrl.is_initialized()) {
+            continue;
+        }
 
         CicoSCCategoryConf* categoryConf = new CicoSCCategoryConf();
         categoryConf->id       = id.get();
@@ -618,6 +670,7 @@ CicoSCSystemConfig::createCategoryConf(const ptree & root)
         categoryConf->sound    = m_categoryTalbe[sound.get()];
         categoryConf->input    = m_categoryTalbe[input.get()];
         categoryConf->priority = priority.get();
+        categoryConf->rctrl    = r_ctrl.get();
         m_categoryConfList.push_back(categoryConf);
         categoryConf->dumpConf();
     }
@@ -627,7 +680,7 @@ CicoSCSystemConfig::createCategoryConf(const ptree & root)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 void
@@ -661,13 +714,6 @@ CicoSCSystemConfig::createAppKindConf(const ptree & root)
             continue;
         }
 
-#if 0
-        cout << "id=" << id.get() << endl;
-        cout << "name=" << name.get() << endl;
-        cout << "privilege=" << privilege.get() << endl;
-        cout << "priority=" << priority.get() << endl;
-#endif
-
         CicoSCAppKindConf* appKindConf = new CicoSCAppKindConf();
         appKindConf->id        = id.get();
         appKindConf->name      = name.get();
@@ -682,7 +728,7 @@ CicoSCSystemConfig::createAppKindConf(const ptree & root)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 void
@@ -703,10 +749,6 @@ CicoSCSystemConfig::createInputDevList(const ptree & root)
         if (false == name.is_initialized()) {
             continue;
         }
-#if 0
-        cout << "id=" << id.get() << endl;
-        cout << "name=" << name.get() << endl;
-#endif
                                                 
         CicoSCInputDevConf* inputDevConf = new CicoSCInputDevConf();
         inputDevConf->id   = id.get();
@@ -722,7 +764,7 @@ CicoSCSystemConfig::createInputDevList(const ptree & root)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 void
@@ -750,12 +792,6 @@ CicoSCSystemConfig::createSwitchList(const ptree::value_type & child,
             continue;
         }
 
-#if 0
-        cout << "id=" << id.get() << endl;
-        cout << "name=" << name.get() << endl;
-        cout << "appid=" << appid.get() << endl;
-#endif
-
         CicoSCSwitchConf* switchConf = new CicoSCSwitchConf();
         switchConf->id    = id.get();
         switchConf->name  = name.get();
@@ -769,7 +805,7 @@ CicoSCSystemConfig::createSwitchList(const ptree::value_type & child,
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 void
@@ -839,19 +875,6 @@ CicoSCSystemConfig::createDefaultConf(const ptree & root)
         ICO_WRN("default.inputdsw element not found");
     }
 
-#if 0
-    cout << "node=" << node.get() << endl;
-    cout << "appkind=" << appkind.get() << endl;
-    cout << "category=" << category.get() << endl;
-    cout << "display=" << display.get() << endl;
-    cout << "layer=" << layer.get() << endl;
-    cout << "displayzone=" << displayzone.get() << endl;
-    cout << "sound=" << sound.get() << endl;
-    cout << "soundzone=" << soundzone.get() << endl;
-    cout << "inputdev=" << inputdev.get() << endl;
-    cout << "inputsw=" << inputsw.get() << endl;
-#endif
-
     m_defaultConf = new CicoSCDefaultConf();
 
     m_defaultConf->node        = getNodeIdbyName(node.get());
@@ -899,7 +922,7 @@ CicoSCSystemConfig::createDefaultConf(const ptree & root)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 void
@@ -911,20 +934,128 @@ CicoSCSystemConfig::createLogConf(const ptree & root)
     int loglevel  = logNode.get<int>("loglevel");
     bool logflush = logNode.get<bool>("logflush");
 
-#if 0
-    cout << "loglevel=" << loglevel << endl;
-    cout << "logflush=" << logflush << endl;
-#endif
-
     m_loglevel = loglevel;
     m_logflush = logflush;
 }
 
 //--------------------------------------------------------------------------
 /**
+ *  @brief  resource config class object create
+ *
+ *  @param  [in]
+ */
+//--------------------------------------------------------------------------
+void getArray(ptree& t, vector<int>& vec);
+static const char* g_resource_cpu = "systemconfig.resource_cpu_control";
+void
+CicoSCSystemConfig::createResourceConf(const ptree & root)
+{
+    m_resourceConf = new CicoSCResourceConf;
+    ptree rc = root.get_child(g_resource_cpu);
+    bool b = false;
+    optional<string> opts = rc.get_optional<string>("do_it");
+    if (true == opts.is_initialized()) {
+        string v = opts.get();
+        if (0 == v.compare("yes")) {
+            b = true;
+        }
+    }
+    m_resourceConf->m_bDoIt = b;
+    if (false == b) {
+        return;
+    }
+
+    string dirnm;
+    optional<string> opts2 = rc.get_optional<string>("ctrl_dir_path");
+    if (true == opts2.is_initialized()) {
+        dirnm = opts2.get();
+    }
+    else {
+        dirnm = "/sys/fs/cgroup/cpu,cpuacct/SCprivate";
+    }
+    m_resourceConf->m_cpuCGRPPath = dirnm;
+
+    opts = rc.get_optional<string>("sampling_wait");
+    if (true == opts.is_initialized()) {
+        m_resourceConf->m_sampling = atoi(opts.get().c_str());
+    }
+
+    opts = rc.get_optional<string>("log");
+    if (true == opts.is_initialized()) {
+        string v = opts.get();
+        if (0 == v.compare("true")) {
+            m_resourceConf->m_bLog = true;
+        }
+    }
+
+    opts = rc.get_optional<string>("retry_cnt");
+    if (true == opts.is_initialized()) {
+        m_resourceConf->m_retryCnt = atoi(opts.get().c_str());
+    }
+
+    opts = rc.get_optional<string>("low_limit_value");
+    if (true == opts.is_initialized()) {
+        m_resourceConf->m_lowLimitVal = atoi(opts.get().c_str());
+    }
+
+    opts = rc.get_optional<string>("high_limit_value");
+    if (true == opts.is_initialized()) {
+        m_resourceConf->m_highLimitVal = atoi(opts.get().c_str());
+    }
+
+    BOOST_FOREACH(ptree::value_type& child, rc) {
+        optional<int> id = optional<int>(-1);
+        optional<string> name;
+        id = child.second.get_optional<int>("<xmlattr>.id");
+        if (false == id.is_initialized()) {
+            continue;
+        }
+        name = child.second.get_optional<string>("<xmlattr>.name");
+        if (false == name.is_initialized()) {
+            continue;
+        }
+        ptree pth = child.second.get_child("hight_array");
+        ptree ptl = child.second.get_child("low_array");
+
+        CicoSCCpuResourceGrp* obj = new CicoSCCpuResourceGrp;
+        obj->m_id    = id.get();
+        obj->m_bDoIt = b;
+        obj->m_grpNm = name.get();
+        getArray(pth, obj->m_hight);
+        getArray(ptl, obj->m_low);
+        m_resourceConf->m_cpuCtrl.push_back(obj);
+    }
+    m_resourceConf->dumpConf();
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  user config class object create
+ *
+ *  @param  [in]
+ */
+//--------------------------------------------------------------------------
+static const char* g_login_user_conf = "systemconfig.login_user";
+void
+CicoSCSystemConfig::createUserConf(const ptree & root)
+{
+    m_userConf = new CicoSCUserConf;
+    ptree rc = root.get_child(g_login_user_conf);
+    optional<string> opts = rc.get_optional<string>("parent_dir");
+    if (true == opts.is_initialized()) {
+        string v = opts.get();
+        if (v.empty()) {
+            m_userConf->m_parent_dir = v;
+        }
+    }
+    m_userConf->dumpConf();
+}
+
+//--------------------------------------------------------------------------
+/**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 int
@@ -1012,7 +1143,7 @@ CicoSCSystemConfig::calcGeometryExpr(const string & expr,
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 const CicoSCNodeConf*
@@ -1034,7 +1165,7 @@ CicoSCSystemConfig::findNodeConfbyName(const string & name)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 const CicoSCDisplayConf*
@@ -1057,7 +1188,7 @@ CicoSCSystemConfig::findDisplayConfbyName(const string & name)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 const CicoSCLayerConf*
@@ -1087,16 +1218,21 @@ CicoSCSystemConfig::findLayerConfbyName(const string & displayName,
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 const CicoSCDisplayZoneConf*
 CicoSCSystemConfig::findDisplayZoneConfbyName(const string & displayName,
                                               const string & zoneName)
 {
+    ICO_DBG("CicoSCSystemConfig::findDisplayZoneConfbyName Enter"
+            "(displayName=%s zoneNmae=%s)",
+            displayName.c_str(), zoneName.c_str());
+
     const CicoSCDisplayConf* displayConf = NULL;
     displayConf = findDisplayConfbyName(displayName);
     if (NULL == displayConf) {
+        ICO_DBG("CicoSCSystemConfig::findDisplayZoneConfbyName Leave(NULL)");
         return NULL;
     }
 
@@ -1106,10 +1242,13 @@ CicoSCSystemConfig::findDisplayZoneConfbyName(const string & displayName,
         const CicoSCDisplayZoneConf* conf = NULL;
         conf = const_cast<CicoSCDisplayZoneConf*>(*itr);
         if (zoneName == conf->name) {
+            ICO_DBG("CicoSCSystemConfig::findDisplayZoneConfbyName Leave"
+                    "(0x%08x)", conf);
             return conf;
         }
     }
 
+    ICO_DBG("CicoSCSystemConfig::findDisplayZoneConfbyName Leave(NULL)");
     return NULL;
 }
 
@@ -1117,7 +1256,7 @@ CicoSCSystemConfig::findDisplayZoneConfbyName(const string & displayName,
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 const CicoSCSoundConf*
@@ -1140,13 +1279,17 @@ CicoSCSystemConfig::findSoundConfbyName(const string & name)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 const CicoSCSoundZoneConf*
 CicoSCSystemConfig::findSoundZoneConfbyName(const string & soundName,
                                             const string & zoneName)
 {
+    ICO_DBG("CicoSCSystemConfig::findSoundZoneConfbyName Enter"
+            "(soundName=%s zoneNmae=%s)",
+            soundName.c_str(), zoneName.c_str());
+
     const CicoSCSoundConf* soundConf = NULL;
     soundConf = findSoundConfbyName(soundName);
     if (NULL == soundConf) {
@@ -1170,7 +1313,7 @@ CicoSCSystemConfig::findSoundZoneConfbyName(const string & soundName,
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 const CicoSCInputDevConf*
@@ -1193,7 +1336,7 @@ CicoSCSystemConfig::findInputDevConfbyName(const string & name)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 const CicoSCSwitchConf*
@@ -1226,7 +1369,7 @@ CicoSCSystemConfig::findSwitchConfbyName(const string & inputDevName,
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 const CicoSCAppKindConf*
@@ -1249,7 +1392,57 @@ CicoSCSystemConfig::findAppKindConfbyName(const string & name)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
+ */
+//--------------------------------------------------------------------------
+const CicoSCDisplayZoneConf*
+CicoSCSystemConfig::findDisplayZoneConfbyId(int id)
+{
+    vector<CicoSCDisplayConf*>::iterator itr;
+    itr = m_displayConfList.begin();
+    for (; itr != m_displayConfList.end(); ++itr) {
+        vector<CicoSCDisplayZoneConf*>::iterator itr2;
+        itr2 = (*itr)->zoneConfList.begin();
+        for (; itr2 != (*itr)->zoneConfList.end(); ++itr2) {
+            if (id == (*itr2)->id) {
+                return *itr2;
+            }
+        }
+    }
+
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [in]
+ */
+//--------------------------------------------------------------------------
+const CicoSCSoundZoneConf*
+CicoSCSystemConfig::findSoundZoneConfbyId(int id)
+{
+    vector<CicoSCSoundConf*>::iterator itr;
+    itr = m_soundConfList.begin();
+    for (; itr != m_soundConfList.end(); ++itr) {
+        vector<CicoSCSoundZoneConf*>::iterator itr2;
+        itr2 = (*itr)->zoneConfList.begin();
+        for (; itr2 != (*itr)->zoneConfList.end(); ++itr2) {
+            if (id == (*itr2)->id) {
+                return *itr2;
+            }
+        }
+    }
+
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 const CicoSCCategoryConf*
@@ -1273,7 +1466,51 @@ CicoSCSystemConfig::findCategoryConfbyName(const string & name)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
+ */
+//--------------------------------------------------------------------------
+const CicoSCCategoryConf*
+CicoSCSystemConfig::findCategoryConfbyId(int id)
+{
+    vector<CicoSCCategoryConf*>::iterator itr;
+    itr = m_categoryConfList.begin();
+    for (; itr != m_categoryConfList.end(); ++itr) {
+        const CicoSCCategoryConf* conf = NULL;
+        conf = const_cast<CicoSCCategoryConf*>(*itr);
+        if (id == conf->id) {
+            return conf;
+        }
+    }
+
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [in]
+ */
+//--------------------------------------------------------------------------
+const CicoSCAppKindConf *
+CicoSCSystemConfig::findAppKindConfbyId(int id)
+{
+    vector<CicoSCAppKindConf*>::iterator itr;
+    itr = m_appKindConfList.begin();
+    for (; itr != m_appKindConfList.end(); ++itr) {
+        if (id == (*itr)->id) {
+            return *itr;
+        }
+    }
+
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 const CicoSCDefaultConf*
@@ -1286,7 +1523,7 @@ CicoSCSystemConfig::getDefaultConf(void)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 int
@@ -1305,7 +1542,7 @@ CicoSCSystemConfig::getNodeIdbyName(const string & name)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 int
@@ -1324,7 +1561,7 @@ CicoSCSystemConfig::getDisplayIdbyName(const string & name)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 int
@@ -1344,7 +1581,7 @@ CicoSCSystemConfig::getLayerIdfbyName(const string & displayName,
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 int
@@ -1364,7 +1601,33 @@ CicoSCSystemConfig::getDizplayZoneIdbyName(const string & displayName,
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCSystemConfig::getDizplayZoneIdbyFullName(const string & zoneFullName)
+{
+    string::size_type index = zoneFullName.find(".", 0);
+    if (string::npos == index) {
+        return -1;
+    }
+    string displayName = zoneFullName.substr(0, index);
+    string zoneName    = zoneFullName.substr(index+1);
+
+    const CicoSCDisplayZoneConf* conf = NULL;
+    conf = findDisplayZoneConfbyName(displayName, zoneName);
+    if (NULL == conf) {
+        return -1;
+    }
+
+    return conf->id;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 int
@@ -1383,7 +1646,7 @@ CicoSCSystemConfig::getSoundIdbyName(const string & name)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 int
@@ -1403,7 +1666,33 @@ CicoSCSystemConfig::getSoundZoneIdbyName(const string & soundName,
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCSystemConfig::getSoundZoneIdbyFullName(const string & zoneFullName)
+{
+    string::size_type index = zoneFullName.find(".", 0);
+    if (string::npos == index) {
+        return -1;
+    }
+    string soundName = zoneFullName.substr(0, index);
+    string zoneName  = zoneFullName.substr(index+1);
+
+    const CicoSCSoundZoneConf* conf = NULL;
+    conf = findSoundZoneConfbyName(soundName, zoneName);
+    if (NULL == conf) {
+        return -1;
+    }
+
+    return conf->id;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 int
@@ -1422,7 +1711,7 @@ CicoSCSystemConfig::getInputDevIdbyName(const string & name)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 int
@@ -1442,7 +1731,7 @@ CicoSCSystemConfig::getSwitchIdbyName(const string & inputDevName,
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 int
@@ -1461,7 +1750,7 @@ CicoSCSystemConfig::getAppKindIdbyName(const string & name)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 int
@@ -1476,47 +1765,45 @@ CicoSCSystemConfig::getCategoryIdbyName(const string & name)
     return conf->id;
 }
 
-#if 0
 //--------------------------------------------------------------------------
 /**
- *  @brief  
+ *  @brief  get category config object class
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
-int main(int argc, char* argv[]) {
-    if (argc < 2) {
-        cerr << "ptree_format filename" << endl;
-        exit(-1);
+const CicoSCCategoryConf*
+CicoSCSystemConfig::getCategoryObjbyCaategoryID(int id)
+{
+    if (-1 == id) {
+        return NULL;
     }
-    
-    CicoSCSystemConfig::getInstance()->load(argv[1]);
-
-    return 0;
+    vector<CicoSCCategoryConf*>::iterator itr;
+    itr = m_categoryConfList.begin();
+    for (; itr != m_categoryConfList.end(); ++itr) {
+        const CicoSCCategoryConf* conf = NULL;
+        conf = const_cast<CicoSCCategoryConf*>(*itr);
+        if (id == conf->id) {
+            //return const_cast<CicoSCCategoryConf*>(itr->pointer);
+            return conf;
+        }
+    }
+    return NULL;
 }
-#endif
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  user config class object create
+ *  @brief  array xml tree to vector<int>
  *
  *  @param  [in]
  */
 //--------------------------------------------------------------------------
-static const char* g_login_user_conf = "systemconfig.login_user";
-void
-CicoSCSystemConfig::createUserConf(const ptree & root)
+void getArray(ptree& t, vector<int>& vec)
 {
-    m_userConf = new CicoSCUserConf;
-    ptree rc = root.get_child(g_login_user_conf);
-    optional<string> opts = rc.get_optional<string>("parent_dir");
-    if (true == opts.is_initialized()) {
-        string v = opts.get();
-        if (v.empty()) {
-            m_userConf->m_parent_dir = v;
-        }
+    vec.clear();
+    BOOST_FOREACH (const ptree::value_type& child, t) {
+        const int value = lexical_cast<int>(child.second.data());
+        vec.push_back(value);
     }
-    m_userConf->dumpConf();
 }
-
 // vim:set expandtab ts=4 sw=4:
index 2b4a3dd..3e8a1cd 100644 (file)
@@ -11,7 +11,7 @@
 /**
  *  @file   CicoSCSystemConfig.h
  *
- *  @brief  
+ *  @brief  This file is definition of CicoSCSystemConfig class
  */
 //==========================================================================
 #ifndef __CICO_SC_SYSTEM_CONFIG_H__
@@ -20,6 +20,7 @@
 #include <boost/property_tree/ptree.hpp>
 #include <boost/property_tree/xml_parser.hpp>
 #include <boost/foreach.hpp>
+#include <boost/lexical_cast.hpp>
 
 #include <string>
 #include <map>
@@ -28,6 +29,10 @@ using namespace std;
 using namespace boost;
 using namespace boost::property_tree;
     
+//==========================================================================
+//  Forward declaration
+//==========================================================================
+#ifndef __CICO_SC_CONF_H__
 class CicoSCNodeConf;
 class CicoSCLayerConf;
 class CicoSCDisplayZoneConf;
@@ -39,8 +44,15 @@ class CicoSCAppKindConf;
 class CicoSCSwitchConf;
 class CicoSCInputDevConf;
 class CicoSCDefaultConf;
+class CicoSCResourceConf;
 class CicoSCUserConf;
+#endif
 
+//==========================================================================
+/**
+ *  @brief  This class has function of access to system config information
+ */
+//==========================================================================
 class CicoSCSystemConfig 
 {
 public:
@@ -48,12 +60,12 @@ public:
 
     int load(const string & confFile);
 
-    //vector<CicoSCNodeConf*> m_nodeConfList;
-    const vector<CicoSCDisplayConf*>& getDisplayConfList(void) const;
-    //vector<CicoSCSoundConf*> m_soundConfList;
-    //vector<CicoSCInputDevConf*> m_inputDevConfList;
-    //vector<CicoSCCategoryConf*> m_categoryConfList;
-    //vector<CicoSCAppKindConf*> m_appKindConfList;
+    const vector<CicoSCNodeConf*> &    getNodeConfList(void) const;
+    const vector<CicoSCDisplayConf*> & getDisplayConfList(void) const;
+    const vector<CicoSCSoundConf*> &   getSoundConfList(void) const;
+    const vector<CicoSCInputDevConf*> &  getInputDevConfList(void) const;
+    const vector<CicoSCCategoryConf*> & getCategoryConfList(void) const;
+    const vector<CicoSCAppKindConf*> &  getAppKindConfList(void) const;
 
     const CicoSCNodeConf* findNodeConfbyName(const string & name);
     const CicoSCDisplayConf* findDisplayConfbyName(const string & name);
@@ -71,23 +83,37 @@ public:
     const CicoSCAppKindConf* findAppKindConfbyName(const string & name);
     const CicoSCCategoryConf* findCategoryConfbyName(const string & name);
 
+    const CicoSCDisplayZoneConf* findDisplayZoneConfbyId(int id);
+
+    const CicoSCSoundZoneConf* findSoundZoneConfbyId(int id);
+    const CicoSCCategoryConf* findCategoryConfbyId(int id);
+    const CicoSCAppKindConf* findAppKindConfbyId(int id);
+
     const CicoSCDefaultConf* getDefaultConf(void);
 
+
     int getNodeIdbyName(const string & name);
     int getDisplayIdbyName(const string & name);
     int getLayerIdfbyName(const string & displayName,
                           const string & layerName);
     int getDizplayZoneIdbyName(const string & displayName,
                                const string & zoneName);
+    int getDizplayZoneIdbyFullName(const string & zoneFullName);
     int getSoundIdbyName(const string & name);
-    
+
     int getSoundZoneIdbyName(const string & soundName,
                              const string & zoneName);
+    int getSoundZoneIdbyFullName(const string & zoneFullName);
     int getInputDevIdbyName(const string & name);
     int getSwitchIdbyName(const string & inputDevName,
                           const string & switchName);
     int getAppKindIdbyName(const string & name);
     int getCategoryIdbyName(const string & name);
+    const CicoSCResourceConf* getResourceConf() const
+    {
+        return m_resourceConf;
+    };
+    const CicoSCCategoryConf* getCategoryObjbyCaategoryID(int id);
 
     const CicoSCUserConf* getUserConf() const 
     {
@@ -125,11 +151,11 @@ private:
                           CicoSCInputDevConf* inputDevConf);
     void createDefaultConf(const ptree & root);
     void createLogConf(const ptree & root);
+    void createResourceConf(const ptree & root);
+    void createUserConf(const ptree & root);
 
     int calcGeometryExpr(const string & expr, CicoSCDisplayConf* conf);
 
-    void createUserConf(const ptree & root);
-
 private:
     static CicoSCSystemConfig* ms_myInstance;
     string m_confFile;
@@ -148,6 +174,7 @@ private:
     int m_loglevel;
     bool  m_logflush;
     CicoSCDefaultConf *m_defaultConf;
+    CicoSCResourceConf *m_resourceConf;
     CicoSCUserConf *m_userConf;
 };
 #endif  // __CICO_SC_SYSTEM_CONFIG_H__
index f349974..4e4715c 100644 (file)
@@ -36,7 +36,7 @@ CicoStatusBarControlWindow::CicoStatusBarControlWindow()
     moveH = 0;
     window = NULL;
     shtct_list = NULL;
-   
+
     /* Initialize a new system of Ecore_Evas */
     ecore_evas_init();
 }
@@ -119,8 +119,8 @@ CicoStatusBarControlWindow::Finalize(void)
  * @return      none
  */
 /*--------------------------------------------------------------------------*/
-void 
-CicoStatusBarControlWindow::SetInstanceForClock(CicoStatusBarControlWindow *instance_tmp) 
+void
+CicoStatusBarControlWindow::SetInstanceForClock(CicoStatusBarControlWindow *instance_tmp)
 {
     instance = instance_tmp;
 }
@@ -128,7 +128,7 @@ CicoStatusBarControlWindow::SetInstanceForClock(CicoStatusBarControlWindow *inst
 /*--------------------------------------------------------------------------*/
 /**
  * @brief   CicoStatusBarControlWindow::CreateEcoreEvas
- *          make new ecore_evas 
+ *          make new ecore_evas
  *
  * @param[in]   none
  * @return      0:success -1:failed
@@ -146,8 +146,8 @@ CicoStatusBarControlWindow::CreateEcoreEvas(void)
         return -1;
     }
     ecore_evas_callback_delete_request_set(window,QuitEcoreLoop);
-  
-    return 0; 
+
+    return 0;
 }
 
 /*--------------------------------------------------------------------------*/
@@ -186,7 +186,7 @@ CicoStatusBarControlWindow::QuitEcoreLoop(Ecore_Evas *ee)
 /*--------------------------------------------------------------------------*/
 /**
  * @brief   CicoStatusBarControlWindow::ResizeWindow
- *          resize window 
+ *          resize window
  *
  * @param[in]   orientation     setting ICO_ONS_HORIZONTAL or ICO_ONS_VERTICAL
  *                              (if config is existing,this value is ignored)
@@ -197,7 +197,7 @@ void
 CicoStatusBarControlWindow::ResizeWindow(int orientation)
 {
     int width_tmp, height_tmp;
-  
+
     /* load configuration */
     if (homescreen_config != NULL) {
        orientation = homescreen_config->ConfigGetInteger(ICO_HS_CONFIG_STATUBAR,
@@ -246,13 +246,13 @@ CicoStatusBarControlWindow::ShowWindow(void)
 /*--------------------------------------------------------------------------*/
 /**
  * @brief   CicoStatusBarControlWindow::InitEvas
- *          initialize evas 
+ *          initialize evas
  *
  * @param[in]   none
  * @return      0:OK -1:NG
  */
 /*--------------------------------------------------------------------------*/
-int 
+int
 CicoStatusBarControlWindow::InitEvas(void)
 {
     Evas_Object *canvas;
@@ -273,7 +273,7 @@ CicoStatusBarControlWindow::InitEvas(void)
     evas_object_move(canvas, 0, ICO_SB_POS_Y);
     evas_object_resize(canvas, width, ICO_HS_SIZE_SB_HEIGHT);
     evas_object_show(canvas);
-   
+
     return 0;
 
 }
@@ -300,19 +300,19 @@ CicoStatusBarControlWindow::ShowClockHour(struct tm *t_st)
     else {
         ampm_index = ICO_SB_TIME_PM;
     }
-    sprintf(file, "%s%s", respath, 
+    sprintf(file, "%s%s", respath,
                 time_data[ampm_index]->GetFileName());
     evas_object_image_file_set(ampm, file, NULL);
-   
+
     //Hour
     sprintf(file, "%s%s", respath,
             time_data[(t_st->tm_hour % ICO_SB_TIME_AMPM_THRESHOLD) / 10]->GetFileName());
     evas_object_image_file_set(hour1, file, NULL);
-    
+
     sprintf(file, "%s%s", respath,
             time_data[(t_st->tm_hour % ICO_SB_TIME_AMPM_THRESHOLD) % 10]->GetFileName());
     evas_object_image_file_set(hour2, file, NULL);
-  
+
     /*Makes the given Evas object visible*/
     evas_object_show(ampm);
     evas_object_show(hour1);
@@ -382,7 +382,7 @@ CicoStatusBarControlWindow::UpdateTime(void *thread_data)
 /*--------------------------------------------------------------------------*/
 /**
  * @brief   CicoStatusBarControlWindow::ShowClock
- *          show the clock's 
+ *          show the clock's
  *
  * @param[in]   none
  * @return      none
@@ -394,7 +394,7 @@ CicoStatusBarControlWindow::ShowClock(void)
     Evas_Object *colon;
     time_t timer;
     struct tm *t_st;
-    char file[ICO_SB_BUF_SIZE]; 
+    char file[ICO_SB_BUF_SIZE];
     /* ... */
     ampm = evas_object_image_filled_add(evas);
     hour1 = evas_object_image_filled_add(evas);
@@ -402,7 +402,7 @@ CicoStatusBarControlWindow::ShowClock(void)
     min1 = evas_object_image_filled_add(evas);
     min2 = evas_object_image_filled_add(evas);
     colon = evas_object_image_filled_add(evas);
+
     /* This function will make layout change */
     evas_object_move(ampm, moveH + ICO_SB_POS_AMPM_X, ICO_SB_POS_AMPM_Y);
     evas_object_move(hour1, moveH + ICO_SB_POS_HOUR1_X, ICO_SB_POS_HOUR1_Y);
@@ -410,7 +410,7 @@ CicoStatusBarControlWindow::ShowClock(void)
     evas_object_move(min1, moveH + ICO_SB_POS_MIN1_X, ICO_SB_POS_MIN1_Y);
     evas_object_move(min2, moveH + ICO_SB_POS_MIN2_X, ICO_SB_POS_MIN2_Y);
     evas_object_move(colon, moveH + ICO_SB_POS_COLON_X, ICO_SB_POS_COLON_Y);
+
     /* This function will make size change of picture */
     evas_object_resize(ampm, ICO_SB_SIZE_AMPM_W, ICO_SB_SIZE_AMPM_H);
     evas_object_resize(hour1, ICO_SB_SIZE_NUM_W, ICO_SB_SIZE_NUM_H);
@@ -418,7 +418,7 @@ CicoStatusBarControlWindow::ShowClock(void)
     evas_object_resize(min1, ICO_SB_SIZE_NUM_W, ICO_SB_SIZE_NUM_H);
     evas_object_resize(min2, ICO_SB_SIZE_NUM_W, ICO_SB_SIZE_NUM_H);
     evas_object_resize(colon, ICO_SB_SIZE_COLON_W, ICO_SB_SIZE_COLON_H);
+
     /* Makes the given Evas object visible */
     evas_object_show(ampm);
     evas_object_show(hour1);
@@ -432,7 +432,7 @@ CicoStatusBarControlWindow::ShowClock(void)
     t_st = localtime(&timer);
     ShowClockHour(t_st);
     ShowClockMinutes(t_st);
-  
+
     /* Set the image file */
     for (int ii = 0; ii < ICO_SB_TIME_IMG_PARTS; ii++) {
         time_data[ii]->SetTimeImg(evas_object_image_filled_add(evas));
@@ -442,18 +442,16 @@ CicoStatusBarControlWindow::ShowClock(void)
     sprintf(file, "%s%s", respath, fname_colon);
     evas_object_image_file_set(colon, file, NULL);
 
-
     ecore_timer_add(ICO_SB_TIMEOUT, UpdateTime, NULL);
-
 }
 
 /*--------------------------------------------------------------------------*/
 /**
  * @brief   CicoStatusBarControlWindow::EvasObjectImageFileSetAndShow
- *          set the evas object image file and show it 
+ *          set the evas object image file and show it
  *
  * @param[in]   obj    evas object
- * @param[in]   img    image 
+ * @param[in]   img    image
  * @return      none
  */
 /*--------------------------------------------------------------------------*/
diff --git a/src/homescreen/Cico_aul_listen_app.cpp b/src/homescreen/Cico_aul_listen_app.cpp
new file mode 100644 (file)
index 0000000..6e14ed5
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0.  The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+/**
+ * @brief   Homescreen application aul handler multi support
+ *
+ * @date    Sep-23-2013
+ */
+#include <iostream>
+#include <string>
+#include <vector>
+#include <aul/aul.h>
+
+using namespace std;
+
+
+//bool aul_listen_app_launch_signal_del(int (*func) (int, void *));
+//bool aul_listen_app_dead_signal_del(int (*func) (int, void *));
+
+static vector<void*> launch_f;
+static vector<void*> launch_p;
+static vector<void*> dead_f;
+static vector<void*> dead_p;
+
+/**
+ * @brief aul launch handler
+ * @param pid
+ * @param data user data
+ */
+static int app_launch_handler(int pid, void *data)
+{
+    vector<void*>::iterator itf = launch_f.begin();
+    vector<void*>::iterator itp = launch_p.begin();
+    while(itf != launch_f.end()) {
+        void* f = *itf;
+        void* p = *itp;
+        int (*fnc)(int, void*) = (int (*)(int, void*))f;
+        fnc(pid, p);
+        ++itf;
+        ++itp;
+    }
+    return 0;
+}
+
+/**
+ * @brief aul dead handler
+ * @param pid
+ * @param data user data
+ */
+static int app_dead_handler(int pid, void *data)
+{
+    vector<void*>::iterator itf = dead_f.begin();
+    vector<void*>::iterator itp = dead_p.begin();
+    while(itf != dead_f.end()) {
+        void* f = *itf;
+        void* p = *itp;
+        int (*fnc)(int, void*) = (int (*)(int, void*))f;
+        fnc(pid, p);
+        ++itf;
+        ++itp;
+    }
+    return 0;
+}
+
+/**
+ * @ init. aul callback
+ */
+void initAulListenXSignal()
+{
+    aul_listen_app_launch_signal(app_launch_handler, NULL);
+    aul_listen_app_dead_signal(app_dead_handler, NULL);
+}
+
+/**
+ * @brief aul_listien_app_launch_signal multi
+ * @param func callback function
+ * @param data user data
+ */
+bool aul_listen_app_launch_signal_add(int (*func) (int, void *), void *data)
+{
+    launch_f.push_back((void*)func);
+    launch_p.push_back(data);
+    return true;
+}
+
+/**
+ * @brief aul_listien_app_dead_signal multi
+ * @param func callback function
+ * @param data user data
+ */
+bool aul_listen_app_dead_signal_add(int (*func) (int, void *), void *data)
+{
+    dead_f.push_back((void*)func);
+    dead_p.push_back(data);
+    return true;
+}
diff --git a/src/homescreen/Cico_aul_listen_app.h b/src/homescreen/Cico_aul_listen_app.h
new file mode 100644 (file)
index 0000000..f650e3b
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0.  The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+/**
+ * @brief   Homescreen application aul handler multi support
+ *
+ * @date    Sep-23-2013
+ */
+#ifndef CICO_AUL_LISTEN_APP_H
+#define CICO_AUL_LISTEN_APP_H
+
+int aul_listen_app_launch_signal_add(int (*func) (int, void *), void *data);
+int aul_listen_app_dead_signal_add(int (*func) (int, void *), void *data);
+void initAulListenXSignal();
+
+#endif
index b864e2d..b3e2647 100644 (file)
@@ -6,7 +6,7 @@ COMMON_LIBS = -lm -lwebsockets -lico-uxf-weston-plugin
 
 noinst_PROGRAMS   = \
        HomeScreen      \
-       StatusBar               
+       StatusBar
 
 HomeScreen_SOURCES = \
        home_screen_main.cpp    \
@@ -28,8 +28,12 @@ HomeScreen_SOURCES = \
        CicoHomeScreenResourceConfig.cpp        \
        CicoHomeScreenSound.cpp \
        CicoHomeScreenSoundConfig.cpp   \
-       CicoHSAppHistory.cpp \
-    CicoHSSystemState.cpp
+       CicoHSSystemState.cpp   \
+       CicoHSFlickTouch.cpp    \
+       CicoHSFlickInputWindow.cpp \
+       CicoHSAppHistory.cpp    \
+       CicoHSAppHistoryExt.cpp \
+       Cico_aul_listen_app.cpp
 
 HomeScreen_CFLAGS= \
     $(EFL_CFLAGS) \
@@ -75,7 +79,7 @@ HomeScreen_LDADD = \
 #      CicoHomeScreenResourceConfig.cpp        \
 #      CicoHomeScreenSound.cpp \
 #        CicoHomeScreenSoundConfig.cpp
-#OnScreen_CXXFLAGS = -I../include $(EFL_CFLAGS) $(OPT_CFLAGS) $(WL_CFLAGS) $(AUL_CFLAGS) $(UWS_CFLAGS) -I/usr/include/ico-util
+#OnScreen_CXXFLAGS = -I../include $(EFL_CFLAGS) $(OPT_CFLAGS) $(WL_CFLAGS) $(AUL_CFLAGS) $(UWS_CFLAGS) -I/usr/include/ico-uxf-weston-plugin -I/usr/include/ico-util
 #OnScreen_LDADD = $(EFL_LIBS) $(OPT_LIBS) $(WL_LIBS) $(COMMON_LIBS) $(AUL_LIBS) $(UWS_LIBS) ../apps_controller/libico_syc-apc.a ../ico-app-framework/.libs/libico-app-fw-efl.so ../ico-app-framework/.libs/libico-app-fw.so
 
 StatusBar_SOURCES = \
@@ -91,20 +95,24 @@ StatusBar_CFLAGS = \
             $(OPT_CFLAGS) \
             $(WL_CFLAGS) \
             $(AUL_CFLAGS) \
-            $(UWS_CFLAGS) 
+            $(UWS_CFLAGS) \
+               -I/usr/include/ico-uxf-weston-plugin \
+               -I/usr/include/ico-util
 StatusBar_CXXFLAGS = \
             $(EFL_CFLAGS) \
             $(OPT_CFLAGS) \
             $(WL_CFLAGS) \
             $(AUL_CFLAGS) \
-            $(UWS_CFLAGS) 
+            $(UWS_CFLAGS) \
+               -I/usr/include/ico-uxf-weston-plugin \
+               -I/usr/include/ico-util
 StatusBar_LDADD = \
             $(EFL_LIBS) \
             $(OPT_LIBS) \
             $(WL_LIBS) \
             $(COMMON_LIBS) \
             $(AUL_LIBS) \
-            $(UWS_LIBS) 
+            $(UWS_LIBS)
 
 SUFFIXES = .edc .edj
 
@@ -114,7 +122,7 @@ BUILT_SOURCES = \
        appli_list.edj  \
        appli_kill.edj
 
-.edc.edj:  
+.edc.edj:
        edje_cc $< -id ../../res/org.tizen.ico.homescreen/res/images -fd ../../res/org.tizen.ico.homescreen/res/images -sd ../../res/org.tizen.ico.homescreen/res/sounds -o $@
 
 CLEANFILES = $(BUILT_SOURCES)
@@ -139,6 +147,8 @@ install-exec-hook:
        install -m 0644 $(top_srcdir)/res/org.tizen.ico.homescreen/res/images/api_all_on.png $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/images
        install -m 0644 $(top_srcdir)/res/org.tizen.ico.homescreen/res/images/pagePointer_n.png $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/images
        install -m 0644 $(top_srcdir)/res/org.tizen.ico.homescreen/res/images/pagePointer_p.png $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/images
+       install -m 0644 $(top_srcdir)/res/org.tizen.ico.homescreen/res/images/pageDownCursor.png $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/images
+       install -m 0644 $(top_srcdir)/res/org.tizen.ico.homescreen/res/images/pageUpCursor.png $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/images
        install -m 0644 $(top_srcdir)/res/org.tizen.ico.homescreen/res/images/button_really.png $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/images
        install -m 0644 $(top_srcdir)/res/org.tizen.ico.homescreen/res/images/button_no.png $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/images
        install -m 0644 $(top_srcdir)/res/org.tizen.ico.homescreen/res/images/button_yes.png $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/images
index d5113dd..ff630a5 100644 (file)
@@ -14,6 +14,7 @@
 
 #include <fstream>
 #include <string>
+#include <vector>
 #include <iostream>
 #include <cstdio>
 #include <bundle.h>
 #include "ico_syc_public.h"
 #include "CicoSCConf.h"
 #include "CicoSCSystemConfig.h"
+#include "Cico_aul_listen_app.h"
 
 using namespace std;
 
 string g_login_user_name;
 
-bool launchApps(const string& filepath);
+static Eina_Bool launchApps(void* data);
+/**
+ * ecore timer void data typedef
+ */
+typedef struct t_launcApps_data {
+    string filePath;
+    string filePathD;
+    CicoHomeScreen *hs;
+} launcApps_data_t;
+
 
 /*--------------------------------------------------------------------------*/
 /**
@@ -53,6 +64,8 @@ main(int argc, char *argv[])
 
     ico_log_open("HomeScreen");
 
+    // load system config
+    CicoSCSystemConfig::getInstance()->load(ICO_HS_LIFECYCLE_CONTROLLER_SETTING_PATH);
 
     /* init configuration */
     ICO_DBG("main: config initialize start");
@@ -60,64 +73,90 @@ main(int argc, char *argv[])
     config->Initialize(ICO_HOMESCREEN_CONFIG_FILE);
     ICO_DBG("main: config initialize end");
 
-    /* PARAM GET LOGIN USER */
+    /* get LOGIN-USER parameter */
     bundle *b = bundle_import_from_argv(argc, argv); // import from argc+argv
     const char* valusr = bundle_get_val(b, ICO_SYC_APP_BUNDLE_KEY1);
     const char* valpath = bundle_get_val(b, ICO_SYC_APP_BUNDLE_KEY2);
+    const char* valpathD = bundle_get_val(b, ICO_SYC_APP_BUNDLE_KEY3);
+    const char* valFlagPath = bundle_get_val(b, ICO_SYC_APP_BUNDLE_KEY4);
     if ((NULL != valusr) && (0 != valusr)) {
         g_login_user_name = valusr;
     }
     else {
         g_login_user_name.clear();
     }
-    string user_start_apps_path;
+    launcApps_data_t x;
+    x.hs = NULL;
+
     if ((NULL != valpath) && (0 != valpath)) {
-        user_start_apps_path = valpath;
+        x.filePath = valpath;
+    }
+    else {
+        x.filePath.clear();
+    }
+
+    if ((NULL != valpathD) && (0 != valpathD)) {
+        x.filePathD = valpathD;
+    }
+    else {
+        x.filePathD.clear();
+    }
+    string flagPath;
+    if ((NULL != valFlagPath) && (0 != valFlagPath)) {
+        flagPath = valFlagPath;
     }
     else {
-        user_start_apps_path.clear();
+        flagPath.clear();
     }
-    ICO_DBG("PARAM=\"%s\", \"%s\"", g_login_user_name.c_str(),
-            user_start_apps_path.c_str());
+    ICO_DBG("PARAM=\"%s\", \"%s\", \"%s\", \"%s\"", g_login_user_name.c_str(),
+            x.filePath.c_str(), x.filePathD.c_str(), flagPath.c_str());
     bundle_free(b);
-    valusr = valpath = NULL;
-    
+    valusr = valpath = valpathD = valFlagPath = NULL;
+
     /* init home screen soud */
     ICO_DBG("main: sound initialize start");
     CicoHomeScreenSound *sound = new CicoHomeScreenSound();
     sound->Initialize(config);
     ICO_DBG("main: sound initialize end");
-    
+
+    /*AUL Listen Signal set(launch/dead)*/
+    initAulListenXSignal();
+
     /*create homescreen*/
     ICO_DBG("main: homescreen initialize start");
     CicoHomeScreen *home_screen = new CicoHomeScreen();
-    
+
     ret = home_screen->Initialize(ICO_ORIENTATION_VERTICAL,config);
     if(ret != ICO_OK){
         ICO_ERR("main: homescreen initialize failed");
         /*clear all classes*/
-        delete home_screen;   
-        delete sound;   
+        delete home_screen;
+        delete sound;
         delete config;
         exit(8);
     }
     ICO_DBG("main: homescreen initialize end");
 
     ICO_DBG("main: create homescreen ");
-    launchApps(user_start_apps_path);
+    /* application history class init. before call launchApps */
+    home_screen->InitializeAppHistory(g_login_user_name, x.filePath, flagPath);
+    /* application history launch */
+    x.hs = home_screen;
+    ecore_timer_add(0.01, launchApps, &x);
+
     /*home screen start and go into main loop*/
     home_screen->StartHomeScreen();
-  
+
     ICO_DBG("main: end homescreen");
-    
+
     /* when loop is terminated */
     /* delete homescreen */
     home_screen->Finalize();
+
     /*clear all classes*/
-    delete home_screen;   
+    delete home_screen;
 
-    delete sound;   
+    delete sound;
 
     delete config;
 
@@ -129,34 +168,43 @@ main(int argc, char *argv[])
  * @brief   launch applications
  *
  * @param   filepath  start applications list file path
+ * @param   filepathD defalt start applications list file path
  * @return  bool
  * @retval  true  success
  * @retval  false fail
  */
 /*--------------------------------------------------------------------------*/
-bool launchApps(const string& filepath)
+static Eina_Bool launchApps(void* data)
 {
-    ICO_DBG("launcApps start = %s", filepath.c_str());
+    launcApps_data_t* x = (launcApps_data_t*) data;
+    ICO_DBG("launcApps start");
+    string fpath(x->filePath);
     struct stat stat_buf;
-    if (0 != stat(filepath.c_str(), &stat_buf)) {
-        ICO_DBG("launcApps end false(%d, %s)", errno, filepath.c_str());
-        return false;
+    if (0 != stat(fpath.c_str(), &stat_buf)) {
+        ICO_DBG("launcApps end false(%d, %s)", errno, fpath.c_str());
+        fpath = x->filePathD;
+        if (0 != stat(fpath.c_str(), &stat_buf)) {
+            ICO_DBG("launcApps end false(%d, %s)", errno, fpath.c_str());
+            return ECORE_CALLBACK_CANCEL;
+        }
     }
-    int i = 0;
-    bool rb = false;
+    vector<string> apps;
     string tagApp;
-    ifstream ifs(filepath.c_str());
+    ifstream ifs(fpath.c_str());
     while(ifs >> tagApp) {
-        i++;
         if (true == tagApp.empty()) {
             continue;
         }
-        int r = aul_launch_app(tagApp.c_str(), NULL);
-        ICO_DBG("aul_launch_app %d:appid(%s), r(%d)", i, tagApp.c_str(), r);
-        if (AUL_R_OK == r) {
-            rb = true;
+        apps.push_back(tagApp);
+    }
+    int sz = apps.size();
+    for (int i =sz; i > 0; i--) {
+        int pid = aul_launch_app(apps[i-1].c_str(), NULL);
+        ICO_DBG("aul_launch_app %d:appid(%s), pid(%d)", i, apps[i-1].c_str(), pid);
+        if ((0 < pid) && (NULL != x->hs)) {
+            x->hs->startupCheckAdd(pid, apps[i-1]);
         }
     }
-    ICO_DBG("launcApps end %s", rb? "true": "false");
-    return rb;
+    ICO_DBG("launcApps end read is %s", fpath.c_str());
+    return ECORE_CALLBACK_CANCEL;
 }
index 973bf7d..29c923a 100644 (file)
@@ -41,8 +41,8 @@ app_event_callback_s CicoEFLApp::m_appEventCB = {
  */
 CicoEFLApp::CicoEFLApp()
 {
-    ICO_DBG("CicoEFLApp::CicoEFLApp Enter");
-    ICO_DBG("CicoEFLApp::CicoEFLApp Leave");
+//    ICO_DBG("CicoEFLApp::CicoEFLApp Enter");
+//    ICO_DBG("CicoEFLApp::CicoEFLApp Leave");
 }
 
 /**
@@ -50,8 +50,8 @@ CicoEFLApp::CicoEFLApp()
  */
 CicoEFLApp::~CicoEFLApp()
 {
-    ICO_DBG("CicoEFLApp::~CicoEFLApp Enter");
-    ICO_DBG("CicoEFLApp::~CicoEFLApp Leave");
+//    ICO_DBG("CicoEFLApp::~CicoEFLApp Enter");
+//    ICO_DBG("CicoEFLApp::~CicoEFLApp Leave");
 }
 
 /**
index 7b43b2f..65c6266 100644 (file)
@@ -36,8 +36,8 @@
  */
 CicoSysConDaemon::CicoSysConDaemon()
 {
-    ICO_DBG("CicoSysConDaemon::CicoSysConDaemon Enter");
-    ICO_DBG("CicoSysConDaemon::CicoSysConDaemon Leave");
+//    ICO_DBG("CicoSysConDaemon::CicoSysConDaemon Enter");
+//    ICO_DBG("CicoSysConDaemon::CicoSysConDaemon Leave");
 }
 
 /**
@@ -45,8 +45,8 @@ CicoSysConDaemon::CicoSysConDaemon()
  */
 CicoSysConDaemon::~CicoSysConDaemon()
 {
-    ICO_DBG("CicoSysConDaemon::~CicoSysConDaemon Enter");
-    ICO_DBG("CicoSysConDaemon::~CicoSysConDaemon Leave");
+//    ICO_DBG("CicoSysConDaemon::~CicoSysConDaemon Enter");
+//    ICO_DBG("CicoSysConDaemon::~CicoSysConDaemon Leave");
 }
 
 bool
index c532725..73c7040 100644 (file)
@@ -67,7 +67,7 @@ install-exec-hook:
        install -m 0755 IcoSysconDaemon $(INSTALL_ROOT)/usr/apps/org.tizen.ico.system-controller/bin
        install -m 0644 ../../data/share/packages/org.tizen.ico.system-controller.xml $(INSTALL_ROOT)/usr/share/packages
        install -m 0644 $(top_srcdir)/res/org.tizen.ico.system-controller/res/config/* $(INSTALL_ROOT)/usr/apps/org.tizen.ico.system-controller/res/config
-       install -d -m 0744 app $(INSTALL_ROOT)/home/app/ico
+       install -d -m 0755 app $(INSTALL_ROOT)/home/app/ico
        install -m 0644 $(top_srcdir)/res/org.tizen.ico.system-controller/res/ico/* $(INSTALL_ROOT)/home/app/ico
        chown -fHR app $(INSTALL_ROOT)/home/app; set $?=0
        chgrp -fHR app $(INSTALL_ROOT)/home/app; set $?=0
index 276a4fd..9c6ad3b 100644 (file)
@@ -38,7 +38,7 @@ static void tst_add_input(const char *appid, const char *device,
 static void tst_delete_input(const char *appid, const char *device,
                              int input);
 static void tst_send_input(const char *appid, int surface, int ev_type,
-                           int deviceno, int ev_code, int ev_value);
+                           int deviceno, int ev_time, int ev_code, int ev_value);
 static Eina_Bool ico_syc_inputctl_test(void *data);
 
 /* ----------------------------------------------- */
@@ -82,13 +82,13 @@ tst_delete_input(const char *appid, const char *device, int input)
 /* test send input */
 static void
 tst_send_input(const char *appid, int surface, int ev_type,
-               int deviceno, int ev_code, int ev_value)
+               int deviceno, int ev_time, int ev_code, int ev_value)
 {
     int ret;
     char *func = "ico_syc_send_input";
 
     ret = ico_syc_send_input(appid, surface, ev_type, deviceno,
-                             ev_code, ev_value);
+                             ev_time, ev_code, ev_value);
     if (ret != 0) {
         print_ng("%s (ret: %d)", func, ret);
         return;
@@ -110,6 +110,7 @@ ico_syc_inputctl_test(void *data)
     int surface         = 12345;
     int ev_type         = ICO_SYC_INPUT_TYPE_POINTER;
     int deviceno        = 123;
+    int ev_time         = 2345;
     int ev_code         = 1;
     int ev_value        = 1;
 
@@ -120,7 +121,7 @@ ico_syc_inputctl_test(void *data)
     usleep(5000);
     tst_delete_input(appid, device, input);
     usleep(5000);
-    tst_send_input(appid, surface, ev_type, deviceno, ev_code, ev_value);
+    tst_send_input(appid, surface, ev_type, deviceno, ev_time, ev_code, ev_value);
 
     printf("##### ico_syc_inputctl API Test End #####\n");
     printf("\n");
index 1ebab11..91224b6 100755 (executable)
@@ -1,15 +1,28 @@
 #!/bin/sh
-killall ico_ictl-touch_egalax 2> /dev/null
+killall ico_dic-gtforce 2> /dev/null
+killall ico-vic-carsim 2> /dev/null
 killall weston 2> /dev/null
 killall IcoSysconDaemon 2> /dev/null
+killall MeterApp 2> /dev/null
 
-sleep 2
+killall GV3ySIINq7.GhostCluster 2> /dev/null
+killall lYjFlj49Q4.saythis 2> /dev/null
+killall WJT8vAfaMa.MyMediaPlayer 2> /dev/null
+killall AKsMREAjt9.MeterWidget 2> /dev/null
+killall t8j6HTRpuz.MediaPlayer 2> /dev/null
+killall ODBQpKvkS1.Settings 2> /dev/null
+killall ico-app-samplepkgins 2> /dev/null
+killall ico-app-vicsample 2> /dev/null
+killall ico-app-soundsample 2> /dev/null
+
+sleep 1
 
-killall -9 DummyHomeScreen 2> /dev/null
 killall -9 HomeScreen 2> /dev/null
 killall -9 IcoSysconDaemon 2> /dev/null
+killall -9 MeterApp 2> /dev/null
 killall -9 weston 2> /dev/null
-killall -9 ico_ictl-touch_egalax 2> /dev/null
+killall -9 ico_dic-gtforce 2> /dev/null
+killall -9 ico-vic-carsim 2> /dev/null
 
 killall -9 OnScreen 2> /dev/null
 killall -9 StatusBar 2> /dev/null
@@ -22,10 +35,16 @@ killall -9 dialer 2> /dev/null
 killall -9 calculator 2> /dev/null
 killall -9 memo 2> /dev/null
 killall -9 smartsearch 2> /dev/null
-killall -9 ico-app-soundsample 2> /dev/null
 killall -9 GV3ySIINq7.GhostCluster 2> /dev/null
+killall -9 lYjFlj49Q4.saythis 2> /dev/null
+killall -9 WJT8vAfaMa.MyMediaPlayer 2> /dev/null
+killall -9 AKsMREAjt9.MeterWidget 2> /dev/null
 killall -9 t8j6HTRpuz.MediaPlayer 2> /dev/null
-killall -9 WJT8vAfaMa.DemoAudioApp 2> /dev/null
+killall -9 ODBQpKvkS1.Settings 2> /dev/null
+killall -9 ico-app-samplepkgins 2> /dev/null
+killall -9 ico-app-soundsample 2> /dev/null
+killall -9 ico-app-vicsample 2> /dev/null
+
 killall -9 WebProcess 2> /dev/null
 killall -9 WebProcess 2> /dev/null
 killall -9 ico-app-login 2> /dev/null
@@ -34,3 +53,5 @@ killall -9 WebProcess 2> /dev/null
 kill -9 `ps ax | grep wrt_launchpad_daemon_candidate | grep -v grep | cut -c1-6` 2> /dev/null
 killall -9 WebProcess 2> /dev/null
 kill -9 `ps ax | grep wrt_launchpad_daemon_candidate | grep -v grep | cut -c1-6` 2> /dev/null
+killall -9 WebProcess 2> /dev/null
+kill -9 `ps ax | grep wrt_launchpad_daemon_candidate | grep -v grep | cut -c1-6` 2> /dev/null
index 2d0626e..de48d59 100755 (executable)
@@ -2,34 +2,34 @@
 
 # 1. Delete log file
 /bin/mkdir /var/log/ico > /dev/null 2>&1
-/bin/mkdir /tmp/ico > /dev/null 2>&1
 /bin/chmod -R 0777 /var/log/ico > /dev/null 2>&1
 /bin/chmod -R 0777 /tmp/ico > /dev/null 2>&1
 /bin/rm -f /var/log/ico/* /var/log/weston.log > /dev/null 2>&1
-/bin/rm -f /tmp/ico/* > /dev/null 2>&1
 /bin/rm -f /opt/share/crash/core.* > /dev/null 2>&1
-/usr/bin/pkg_initdb > /dev/null 2>&1
-/usr/bin/ail_initdb > /dev/null 2>&1
+/bin/rm -f /opt/share/crash/info/* > /dev/null 2>&1
 
-# 2. Start Device Input Controller for eGalax TouchPanel
-#/usr/bin/ico_ictl-touch_egalax -t
-/usr/bin/ico_ictl-touch_egalax
-sleep 0.3
-
-# 4 start some daemons
-## if pulseaudio dose not start ... kick pulseaudio
-/bin/ps ax | /bin/grep pulseaudio | /bin/grep -v grep > /dev/null
-if [ "$?" = "1" ] ; then
-       /usr/bin/pulseaudio --log-level=4 --log-target=file:/var/log/ico/pulse.log --system -D
-       sleep 0.5
-fi
+# 2. Setup Environment Valiables
+export XDG_RUNTIME_DIR=/run/user/5000
+/bin/mkdir /run/user/5000 > /dev/null 2>&1
+/usr/bin/chown 5000 /run/user/5000
+/usr/bin/chgrp 5000 /run/user/5000
+/bin/rm -f /run/user/5000/wayland*
 
 # 3. Start Weston
-/bin/ps ax | /bin/grep weston | /bin/grep -v grep > /dev/null
-if [ "$?" = "1" ] ; then
-       #/usr/bin/weston-launch --user app -- -i0 --backend=fbdev-backend.so --log=/var/log/ico/weston.log &
-       /usr/bin/weston-launch --user app -- -i0 --log=/var/log/ico/weston.log &
-       sync;sync
-fi
+echo "export XDG_RUNTIME_DIR=/run/user/5000" > /etc/profile.d/start_syscond.sh
+/usr/bin/weston-launch --user app -- -i0 $WESTON_BACKEND --log=/var/log/ico/weston.log &
+/usr/bin/sync;/usr/bin/sync
+/usr/bin/sleep 0.2
+/usr/bin/ico_dic-gtforce -d &
+
+# 4. Start MeterApp
+/usr/bin/MeterApp > /dev/null 2>&1 &
+/usr/bin/sleep 0.3
 
+# 5. Start System Controller
 /usr/bin/launch_app org.tizen.ico.system-controller &
+
+# 6. End of shell
+/usr/bin/sleep 2
+/bin/rm -f /etc/profile.d/start_syscond.sh
+