Sync with the latest tizen 2.x 24/48224/1
authorSung-jae Park <nicesj.park@samsung.com>
Wed, 16 Sep 2015 11:31:41 +0000 (20:31 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Wed, 16 Sep 2015 11:31:41 +0000 (20:31 +0900)
Change-Id: I2ea7f782ae483d6d98042a888b2c51d9691e2bbf

12 files changed:
include/package.h
include/slave_life.h
packaging/data-provider-master.spec
pkgmgr_widget/common/include/common.h
pkgmgr_widget/common/src/common.c
src/instance.c
src/io.c
src/package.c
src/server.c
src/shared_fd_service.c
src/slave_life.c
src/utility_service.c

index fe6e9c4..bc92e8e 100644 (file)
@@ -89,6 +89,8 @@ extern void package_add_ctx_info(struct pkg_info *pkginfo, struct context_info *
 extern void package_del_ctx_info(struct pkg_info *pkginfo, struct context_info *info);
 extern void package_set_direct_input(struct pkg_info *info, int direct_input);
 extern int package_direct_input(const struct pkg_info *info);
+extern void package_set_auto_align(struct pkg_info *info, int auto_align);
+extern int package_auto_align(const struct pkg_info *info);
 extern const char *package_hw_acceleration(struct pkg_info *info);
 extern int package_set_hw_acceleration(struct pkg_info *info, const char *hw_acceleration);
 
@@ -120,7 +122,7 @@ extern int package_is_enabled(const char *appid);
 extern int package_faulted(struct pkg_info *info, int broadcast);
 extern char *package_get_pkgid(const char *appid);
 
-extern int package_instance_count(struct pkg_info *info);
+extern int package_instance_count(struct pkg_info *info, int include_deleting);
 extern char *package_meta_tag(const char *appid, const char *meta_tag);
 
 /* End of a file */
index aebc949..1afb032 100644 (file)
@@ -166,7 +166,7 @@ extern int slave_set_pid(struct slave_node *slave, pid_t pid);
 extern void slave_load_package(struct slave_node *slave);
 extern void slave_unload_package(struct slave_node *slave);
 extern int const slave_loaded_package(struct slave_node *slave);
-extern struct slave_node *slave_find_available(const char *slave_pkgname, const char *abi, int secured, int network, const char *hw_acceleration);
+extern struct slave_node *slave_find_available(const char *slave_pkgname, const char *abi, int secured, int network, const char *hw_acceleration, int auto_align);
 
 extern double const slave_ttl(const struct slave_node *slave);
 
index 97ee029..6b94f1f 100644 (file)
@@ -2,7 +2,7 @@
 
 Name: data-provider-master
 Summary: Master service provider for widgetes
-Version: 1.2.0
+Version: 1.3.0
 Release: 1
 Group: Applications/Core Applications
 License: Flora-1.1
@@ -133,7 +133,7 @@ CREATE TABLE groupmap (option_id INTEGER PRIMARY KEY AUTOINCREMENT, id INTEGER,
 CREATE TABLE i18n ( pkgid TEXT NOT NULL, lang TEXT COLLATE NOCASE, name TEXT, icon TEXT, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE);
 CREATE TABLE option ( pkgid TEXT NOT NULL, option_id INTEGER, key TEXT NOT NULL, value TEXT NOT NULL, FOREIGN KEY(option_id) REFERENCES groupmap(option_id), FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE);
 CREATE TABLE pkgmap ( pkgid TEXT PRIMARY KEY NOT NULL, appid TEXT, uiapp TEXT, prime INTEGER, category TEXT DEFAULT 'http://tizen.org/category/default' );
-CREATE TABLE provider ( pkgid TEXT PRIMARY KEY NOT NULL, network INTEGER, abi TEXT, secured INTEGER, box_type INTEGER, box_src TEXT, box_group TEXT, gbar_type INTEGER, gbar_src TEXT, gbar_group TEXT, libexec TEXT, timeout INTEGER, period TEXT, script TEXT, pinup INTEGER, count INTEGER, direct_input INTEGER DEFAULT 0, hw_acceleration TEXT DEFAULT '', FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE);
+CREATE TABLE provider ( pkgid TEXT PRIMARY KEY NOT NULL, network INTEGER, abi TEXT, secured INTEGER, box_type INTEGER, box_src TEXT, box_group TEXT, gbar_type INTEGER, gbar_src TEXT, gbar_group TEXT, libexec TEXT, timeout INTEGER, period TEXT, script TEXT, pinup INTEGER, count INTEGER, direct_input INTEGER DEFAULT 0, hw_acceleration TEXT DEFAULT '', auto_align INTEGER DEFAULT 0, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE);
 EOF
 
 %pre
index 9c2441a..ab23b11 100644 (file)
@@ -38,7 +38,7 @@
 #define ErrPrintWithConsole(format, arg...)    do { fprintf(stderr, "[%s/%s:%d] " format, basename(__FILE__), __func__, __LINE__, ##arg); SECURE_LOGE("[\e[32m%s/%s\e[0m:%d] " format, basename(__FILE__), __func__, __LINE__, ##arg); } while (0)
 #endif
 
-#define CUR_VER 5
+#define CUR_VER 6
 #define DEFAULT_CATEGORY       "http://tizen.org/category/default"
 
 extern int begin_transaction(void);
index 37aa3bc..7dd623e 100644 (file)
@@ -42,8 +42,6 @@
 #define ErrPrintWithConsole(format, arg...)    do { fprintf(stderr, "[%s/%s:%d] " format, basename(__FILE__), __func__, __LINE__, ##arg); SECURE_LOGE("[\e[32m%s/%s\e[0m:%d] " format, basename(__FILE__), __func__, __LINE__, ##arg); } while (0)
 #endif
 
-#define CUR_VER 5
-#define DEFAULT_CATEGORY       "http://tizen.org/category/default"
 #define SCHEME_HTTP    "http://"
 #define SCHEME_HTTPS   "https://"
 #define SCHEME_FILE    "file://"
  *
  *
  * provider
- * +-------+---------+-----+---------+----------+---------+-----------+---------+--------+----------+---------+---------+--------+--------+-------+-----------------------+
- * | pkgid | network | abi | secured | box_type | box_src | box_group | gbar_type | gbar_src | gbar_group | libexec | timeout | period | script | pinup | count(from ver 4) | direct_input | hw_acceleration |
- * +-------+---------+-----+---------+----------+---------+-----------+---------+--------+----------+---------+---------+--------+--------+-------+-----------------------+-------|---------------|
- * |   -   |    -    |  -  |    -    |     -    |    -    |     -     |    -    |    -   |     -    |     -   |    -    |    -   |    -   |   -   |           -           |   -   |       -       |
- * +-------+---------+-----+---------+----------+---------+-----------+---------+--------+----------+---------+---------+--------+--------+-------+-----------------------+-------|---------------|
- * CREATE TABLE provider ( pkgid TEXT PRIMARY KEY NOT NULL, network INTEGER, abi TEXT, secured INTEGER, box_type INTEGER, box_src TEXT, box_group TEXT, gbar_type TEXT, gbar_src TEXT, gbar_group TEXT, libexec TEXT, timeout INTEGER, period TEXT, script TEXT, pinup INTEGER, count INTEGER, direct_input INTEGER DEFAULT 0, hw_acceleration TEXT DEFAULT 'none', FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid))
+ * +-------+---------+-----+---------+----------+---------+-----------+-----------+----------+------------+---------+---------+--------+--------+-------+-------------------+--------------+-----------------+------------+
+ * | pkgid | network | abi | secured | box_type | box_src | box_group | gbar_type | gbar_src | gbar_group | libexec | timeout | period | script | pinup | count(from ver 4) | direct_input | hw_acceleration | auto_align |
+ * +-------+---------+-----+---------+----------+---------+-----------+-----------+----------+------------+---------+---------+--------+--------+-------+-------------------+--------------|-----------------+------------+
+ * |   -   |    -    |  -  |    -    |     -    |    -    |     -     |     -     |     -    |      -     |     -   |    -    |    -   |    -   |   -   |         -         |       -      |        -        |      -     |
+ * +-------+---------+-----+---------+----------+---------+-----------+-----------+----------+------------+---------+---------+--------+--------+-------+-------------------+--------------|-----------------+------------+
+ * CREATE TABLE provider ( pkgid TEXT PRIMARY KEY NOT NULL, network INTEGER, abi TEXT, secured INTEGER, box_type INTEGER, box_src TEXT, box_group TEXT, gbar_type TEXT, gbar_src TEXT, gbar_group TEXT, libexec TEXT, timeout INTEGER, period TEXT, script TEXT, pinup INTEGER, count INTEGER, direct_input INTEGER DEFAULT 0, hw_acceleration TEXT DEFAULT 'none', auto_align INTEGER DEFAULT 0, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid))
  *
  * = box_type = { text | buffer | script | image }
  * = gbar_type = { text | buffer | script }
@@ -201,6 +199,7 @@ struct widget {
        xmlChar *gbar_group;
        xmlChar *gbar_size; /* Default PD size */
        xmlChar *hw_acceleration;
+       int auto_align;
 
        struct dlist *i18n_list;
        struct dlist *group_list;
@@ -222,7 +221,7 @@ static struct {
        const char *dbfile;
        sqlite3 *handle;
 } s_info = {
-       .dbfile = "/usr/dbspace/.widget.db",
+       .dbfile = "/opt/dbspace/.widget.db",
        .handle = NULL,
 };
 
@@ -323,7 +322,7 @@ static inline void abspath(const char* pBuffer, char* pRet)
 
 static inline xmlChar *abspath_strdup(xmlChar *src)
 {
-       return xmlMalloc(xmlStrlen(src) + 2);
+       return xmlMalloc(xmlStrlen(src) + 3);
 }
 
 int begin_transaction(void)
@@ -560,6 +559,32 @@ static void upgrade_to_version_5(void)
        }
 }
 
+/**
+ * From version 5 to 6
+ * "provider" table should have "auto_align" column.
+ * "auto_align" will be used for selecting engine for rendering of widget window.
+ * If it is "true", the widget will creates auto-alignment enabled window buffer.
+ */
+static void upgrade_to_version_6(void)
+{
+       char *err;
+       static const char *ddl;
+
+       /**
+        * Step 1
+        * Create a new column "auto_align" for provider table
+        */
+       ddl = "ALTER TABLE provider ADD COLUMN auto_align INTEGER DEFAULT 0";
+       if (sqlite3_exec(s_info.handle, ddl, NULL, NULL, &err) != SQLITE_OK) {
+               ErrPrint("Failed to execute the DDL (%s)\n", err);
+               return;
+       }
+
+       if (sqlite3_changes(s_info.handle) == 0) {
+               ErrPrint("No chages to DB\n");
+       }
+}
+
 /*!
  * \note
  * From version 3 to 4
@@ -721,6 +746,8 @@ void db_upgrade_db_schema(void)
                upgrade_to_version_4();
        case 4:
                upgrade_to_version_5();
+       case 5:
+               upgrade_to_version_6();
        default:
                /* Need to update version */
                DbgPrint("Old version: %d\n", version);
@@ -854,7 +881,7 @@ static inline int db_create_provider(void)
                   "abi TEXT, secured INTEGER, box_type INTEGER, " \
                   "box_src TEXT, box_group TEXT, gbar_type INTEGER, " \
                   "gbar_src TEXT, gbar_group TEXT, libexec TEXT, timeout INTEGER, period TEXT, script TEXT, pinup INTEGER, "\
-                  "count INTEGER, direct_input INTEGER DEFAULT 0, hw_acceleration TEXT DEFAULT 'none', "\
+                  "count INTEGER, direct_input INTEGER DEFAULT 0, hw_acceleration TEXT DEFAULT 'none', auto_align INTEGER DEFAULT 0, "\
                   "FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE)";
 
        if (sqlite3_exec(s_info.handle, ddl, NULL, NULL, &err) != SQLITE_OK) {
@@ -917,6 +944,7 @@ static int db_insert_provider(struct widget *widget)
        char *period = (char *)widget->period;
        char *script = (char *)widget->script;
        char *hw_acceleration = (char *)widget->hw_acceleration;
+       int auto_align = widget->auto_align;
 
        if (!abi) {
                abi = "c";
@@ -938,7 +966,7 @@ static int db_insert_provider(struct widget *widget)
                hw_acceleration = "none";
        }
 
-       dml = "INSERT INTO provider ( pkgid, network, abi, secured, box_type, box_src, box_group, gbar_type, gbar_src, gbar_group, libexec, timeout, period, script, pinup, count, direct_input, hw_acceleration) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
+       dml = "INSERT INTO provider ( pkgid, network, abi, secured, box_type, box_src, box_group, gbar_type, gbar_src, gbar_group, libexec, timeout, period, script, pinup, count, direct_input, hw_acceleration, auto_align) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
        ret = sqlite3_prepare_v2(s_info.handle, dml, -1, &stmt, NULL);
        if (ret != SQLITE_OK) {
                ErrPrintWithConsole("Error: %s\n", sqlite3_errmsg(s_info.handle));
@@ -1070,6 +1098,13 @@ static int db_insert_provider(struct widget *widget)
                goto out;
        }
 
+       ret = sqlite3_bind_int(stmt, 19, auto_align);
+       if (ret != SQLITE_OK) {
+               ErrPrintWithConsole("Error: %s\n", sqlite3_errmsg(s_info.handle));
+               ret = -EIO;
+               goto out;
+       }
+
        ret = 0;
        if (sqlite3_step(stmt) != SQLITE_DONE) {
                ErrPrintWithConsole("Error: %s\n", sqlite3_errmsg(s_info.handle));
@@ -2323,7 +2358,17 @@ static void update_size_info(struct widget *widget, int idx, xmlNodePtr node)
                }
        }
 
-       if (xmlHasProp(node, (const xmlChar *)"need_frame")) {
+       if (xmlHasProp(node, (const xmlChar *)"need-frame")) {
+               xmlChar *need_frame;
+
+               need_frame = xmlGetProp(node, (const xmlChar *)"need-frame");
+               if (need_frame) {
+                       widget->need_frame[idx] = !xmlStrcasecmp(need_frame, (const xmlChar *)"true");
+                       xmlFree(need_frame);
+               } else {
+                       widget->need_frame[idx] = widget->default_need_frame;
+               }
+       } else if (xmlHasProp(node, (const xmlChar *)"need_frame")) {
                xmlChar *need_frame;
 
                need_frame = xmlGetProp(node, (const xmlChar *)"need_frame");
@@ -2337,7 +2382,18 @@ static void update_size_info(struct widget *widget, int idx, xmlNodePtr node)
                widget->need_frame[idx] = widget->default_need_frame;
        }
 
-       if (xmlHasProp(node, (const xmlChar *)"touch_effect")) {
+
+       if (xmlHasProp(node, (const xmlChar *)"touch-effect")) {
+               xmlChar *touch_effect;
+
+               touch_effect = xmlGetProp(node, (const xmlChar *)"touch-effect");
+               if (touch_effect) {
+                       widget->touch_effect[idx] = !xmlStrcasecmp(touch_effect, (const xmlChar *)"true");
+                       xmlFree(touch_effect);
+               } else {
+                       widget->touch_effect[idx] = widget->default_touch_effect;
+               }
+       } else if (xmlHasProp(node, (const xmlChar *)"touch_effect")) {
                xmlChar *touch_effect;
 
                touch_effect = xmlGetProp(node, (const xmlChar *)"touch_effect");
@@ -2351,7 +2407,17 @@ static void update_size_info(struct widget *widget, int idx, xmlNodePtr node)
                widget->touch_effect[idx] = widget->default_touch_effect;
        }
 
-       if (xmlHasProp(node, (const xmlChar *)"mouse_event")) {
+       if (xmlHasProp(node, (const xmlChar *)"mouse-event")) {
+               xmlChar *mouse_event;
+
+               mouse_event = xmlGetProp(node, (const xmlChar *)"mouse-event");
+               if (mouse_event) {
+                       widget->mouse_event[idx] = !xmlStrcasecmp(mouse_event, (const xmlChar *)"true");
+                       xmlFree(mouse_event);
+               } else {
+                       widget->mouse_event[idx] = widget->default_mouse_event;
+               }
+       } else if (xmlHasProp(node, (const xmlChar *)"mouse_event")) {
                xmlChar *mouse_event;
 
                mouse_event = xmlGetProp(node, (const xmlChar *)"mouse_event");
@@ -2484,9 +2550,25 @@ static void update_box(struct widget *widget, xmlNodePtr node)
                }
        }
 
-       if (!xmlHasProp(node, (const xmlChar *)"mouse_event")) {
-               widget->default_mouse_event = 0;
-       } else {
+       /**
+        * @note
+        * mouse_event is internal style name of attribute.
+        * It should be replaced with "mouse-event" for public one.
+        * But we should keep the old style also.
+        * Try to find "mouse_event" first and if it fails, try to find "mouse-event"
+        */
+       if (xmlHasProp(node, (const xmlChar *)"mouse-event")) {
+               xmlChar *mouse_event;
+
+               mouse_event = xmlGetProp(node, (const xmlChar *)"mouse-event");
+               if (!mouse_event) {
+                       ErrPrint("mouse_event is NIL\n");
+                       widget->default_mouse_event = 0;
+               } else {
+                       widget->default_mouse_event = !xmlStrcasecmp(mouse_event, (const xmlChar *)"true");
+                       xmlFree(mouse_event);
+               }
+       } else if (xmlHasProp(node, (const xmlChar *)"mouse_event")) {
                xmlChar *mouse_event;
 
                mouse_event = xmlGetProp(node, (const xmlChar *)"mouse_event");
@@ -2497,11 +2579,22 @@ static void update_box(struct widget *widget, xmlNodePtr node)
                        widget->default_mouse_event = !xmlStrcasecmp(mouse_event, (const xmlChar *)"true");
                        xmlFree(mouse_event);
                }
+       } else {
+               widget->default_mouse_event = 0;
        }
 
-       if (!xmlHasProp(node, (const xmlChar *)"touch_effect")) {
-               widget->default_touch_effect = 0;
-       } else {
+       if (xmlHasProp(node, (const xmlChar *)"touch-effect")) {
+               xmlChar *touch_effect;
+
+               touch_effect = xmlGetProp(node, (const xmlChar *)"touch-effect");
+               if (!touch_effect) {
+                       ErrPrint("default touch_effect is NIL\n");
+                       widget->default_touch_effect = 0;
+               } else {
+                       widget->default_touch_effect = !xmlStrcasecmp(touch_effect, (const xmlChar *)"true");
+                       xmlFree(touch_effect);
+               }
+       } else if (xmlHasProp(node, (const xmlChar *)"touch_effect")) {
                xmlChar *touch_effect;
 
                touch_effect = xmlGetProp(node, (const xmlChar *)"touch_effect");
@@ -2512,11 +2605,22 @@ static void update_box(struct widget *widget, xmlNodePtr node)
                        widget->default_touch_effect = !xmlStrcasecmp(touch_effect, (const xmlChar *)"true");
                        xmlFree(touch_effect);
                }
+       } else {
+               widget->default_touch_effect = 0;
        }
 
-       if (!xmlHasProp(node, (const xmlChar *)"need_frame")) {
-               widget->default_need_frame = 0;
-       } else {
+       if (xmlHasProp(node, (const xmlChar *)"need-frame")) {
+               xmlChar *need_frame;
+
+               need_frame = xmlGetProp(node, (const xmlChar *)"need-frame");
+               if (!need_frame) {
+                       ErrPrint("default need_frame is NIL\n");
+                       widget->default_need_frame = 0;
+               } else {
+                       widget->default_need_frame = !xmlStrcasecmp(need_frame, (const xmlChar *)"true");
+                       xmlFree(need_frame);
+               }
+       } else if (xmlHasProp(node, (const xmlChar *)"need_frame")) {
                xmlChar *need_frame;
 
                need_frame = xmlGetProp(node, (const xmlChar *)"need_frame");
@@ -2527,6 +2631,8 @@ static void update_box(struct widget *widget, xmlNodePtr node)
                        widget->default_need_frame = !xmlStrcasecmp(need_frame, (const xmlChar *)"true");
                        xmlFree(need_frame);
                }
+       } else {
+               widget->default_need_frame = 0;
        }
 
        for (node = node->children; node; node = node->next) {
@@ -3077,16 +3183,11 @@ static int has_meta_tag(const char *appid, const char *meta_tag)
                return 0;
        }
 
-       /**
-        * @todo
-        * Need to find a replacement of this API
-        *
        ret = pkgmgrinfo_appinfo_get_metadata_value(handle, meta_tag, &value);
        if (ret != PMINFO_R_OK) {
                pkgmgrinfo_appinfo_destroy_appinfo(handle);
                return 0;
        }
-       */
 
        ret = value && value[0] != '\0';
 
@@ -3216,6 +3317,12 @@ int db_install_widget(xmlNodePtr node, const char *appid)
                }
        }
 
+       if (xmlHasProp(node, (const xmlChar *)"auto-align")) {
+               tmp = xmlGetProp(node, (const xmlChar *)"auto-align");
+               widget->auto_align = tmp && !xmlStrcasecmp(tmp, (const xmlChar *)"true");
+               xmlFree(tmp);
+       }
+
        if (xmlHasProp(node, (const xmlChar *)"abi")) {
                widget->abi = xmlGetProp(node, (const xmlChar *)"abi");
                if (!widget->abi) {
@@ -3477,6 +3584,7 @@ int db_install_watchapp(xmlNodePtr node, const char *appid)
        widget->default_touch_effect = 0;
        widget->default_need_frame = 0;
        widget->size_list = WIDGET_SIZE_TYPE_2x2;
+       widget->auto_align = 0;
 
        /**
         * @note
index d9e0d0b..c1498ca 100644 (file)
@@ -1139,6 +1139,14 @@ HAPI struct packet *instance_duplicate_packet_create(const struct packet *packet
 
        inst->state = INST_ACTIVATED;
 
+       if (inst->requested_state == INST_DESTROYED) {
+               /**
+                * In this case, we should destroy the instance.
+                */
+               DbgPrint("Destroy Instance\n");
+               instance_destroy(inst, WIDGET_DESTROY_TYPE_DEFAULT);
+       }
+
        instance_create_widget_buffer(inst, WIDGET_CONF_DEFAULT_PIXELS);
        instance_broadcast_created_event(inst);
        instance_thaw_updator(inst);
index 9f59fdd..d5316d4 100644 (file)
--- a/src/io.c
+++ b/src/io.c
@@ -100,7 +100,7 @@ static inline int build_client_info(struct pkg_info *info)
 
 static inline int build_provider_info(struct pkg_info *info)
 {
-       static const char *dml = "SELECT provider.network, provider.abi, provider.secured, provider.box_type, provider.box_src, provider.box_group, provider.gbar_type, provider.gbar_src, provider.gbar_group, provider.libexec, provider.timeout, provider.period, provider.script, provider.pinup, pkgmap.appid, provider.direct_input, provider.hw_acceleration, pkgmap.category FROM provider, pkgmap WHERE pkgmap.pkgid = ? AND provider.pkgid = ?";
+       static const char *dml = "SELECT provider.network, provider.abi, provider.secured, provider.box_type, provider.box_src, provider.box_group, provider.gbar_type, provider.gbar_src, provider.gbar_group, provider.libexec, provider.timeout, provider.period, provider.script, provider.pinup, pkgmap.appid, provider.direct_input, provider.hw_acceleration, pkgmap.category, provider.auto_align FROM provider, pkgmap WHERE pkgmap.pkgid = ? AND provider.pkgid = ?";
        sqlite3_stmt *stmt;
        int ret;
        const char *tmp;
@@ -192,6 +192,7 @@ static inline int build_provider_info(struct pkg_info *info)
        package_set_direct_input(info, sqlite3_column_int(stmt, 15));
        package_set_hw_acceleration(info, (const char *)sqlite3_column_text(stmt, 16));
        package_set_category(info, (const char *)sqlite3_column_text(stmt, 17));
+       package_set_auto_align(info, sqlite3_column_int(stmt, 18));
 
        sqlite3_reset(stmt);
        sqlite3_clear_bindings(stmt);
index e064d22..63e2b61 100644 (file)
@@ -114,9 +114,6 @@ struct pkg_info {
                unsigned int height;
        } gbar;
 
-       int network;
-       int secured;
-       int direct_input;
        char *script; /* script type: edje, ... */
        char *abi;
        char *hw_acceleration;
@@ -132,7 +129,18 @@ struct pkg_info {
        Eina_List *inst_list;
        Eina_List *ctx_list;
 
-       int is_uninstalled;
+       union _pkg_flags {
+               struct _pkg_field {
+                       unsigned int network: 1;
+                       unsigned int secured: 1;
+                       unsigned int direct_input: 1;
+                       unsigned int auto_align: 1;
+                       unsigned int is_uninstalled: 1;
+
+                       unsigned int reserved: 27;
+               } field;
+               unsigned int mask;
+       } flags;
 };
 
 static struct {
@@ -464,7 +472,7 @@ static inline int load_conf(struct pkg_info *info)
        }
 
        info->widget.timeout = parser_timeout(parser);
-       info->network = parser_network(parser);
+       info->flags.field.network = parser_network(parser);
 
        info->widget.period = parser_period(parser);
        if (info->widget.period < 0.0f) {
@@ -495,7 +503,7 @@ static inline int load_conf(struct pkg_info *info)
                return WIDGET_ERROR_OUT_OF_MEMORY;
        }
 
-       info->secured = parser_secured(parser);
+       info->flags.field.secured = parser_secured(parser);
        info->widget.pinup = parser_pinup(parser);
 
        parser_get_gbar_size(parser, &info->gbar.width, &info->gbar.height);
@@ -801,12 +809,12 @@ HAPI void package_set_period(struct pkg_info *info, double period)
 
 HAPI const int const package_secured(const struct pkg_info *info)
 {
-       return info->secured;
+       return info->flags.field.secured;
 }
 
 HAPI void package_set_secured(struct pkg_info *info, int secured)
 {
-       info->secured = secured;
+       info->flags.field.secured = secured;
 }
 
 HAPI const char * const package_script(const struct pkg_info *info)
@@ -1077,22 +1085,32 @@ HAPI int package_set_libexec(struct pkg_info *info, const char *libexec)
 
 HAPI int package_network(struct pkg_info *info)
 {
-       return info->network;
+       return info->flags.field.network;
 }
 
 HAPI void package_set_network(struct pkg_info *info, int network)
 {
-       info->network = network;
+       info->flags.field.network = network;
 }
 
 HAPI void package_set_direct_input(struct pkg_info *info, int direct_input)
 {
-       info->direct_input = direct_input;
+       info->flags.field.direct_input = direct_input;
 }
 
 HAPI int package_direct_input(const struct pkg_info *info)
 {
-       return info->direct_input;
+       return info->flags.field.direct_input;
+}
+
+HAPI void package_set_auto_align(struct pkg_info *info, int auto_align)
+{
+       info->flags.field.auto_align = auto_align;
+}
+
+HAPI int package_auto_align(const struct pkg_info *info)
+{
+       return info->flags.field.auto_align;
 }
 
 HAPI const enum widget_gbar_type const package_gbar_type(const struct pkg_info *info)
@@ -1170,7 +1188,7 @@ static inline int assign_new_slave(const char *slave_pkgname, struct pkg_info *i
        }
 
        DbgPrint("New slave[%s] is assigned for %s (using %s / abi[%s] / accel[%s]\n", s_name, info->widget_id, slave_pkgname, info->abi, info->hw_acceleration);
-       info->slave = slave_create(s_name, info->secured, info->abi, slave_pkgname, info->network, info->hw_acceleration);
+       info->slave = slave_create(s_name, info->flags.field.secured, info->abi, slave_pkgname, info->flags.field.network, info->hw_acceleration);
        DbgFree(s_name);
        if (!info->slave) {
                /*!
@@ -1209,7 +1227,7 @@ HAPI int package_add_instance(struct pkg_info *info, struct inst_info *inst)
                        return WIDGET_ERROR_OUT_OF_MEMORY;
                }
 
-               info->slave = slave_find_available(slave_pkgname, info->abi, info->secured, info->network, info->hw_acceleration);
+               info->slave = slave_find_available(slave_pkgname, info->abi, info->flags.field.secured, info->flags.field.network, info->hw_acceleration, info->flags.field.auto_align);
                if (!info->slave) {
                        int ret;
 
@@ -1229,7 +1247,7 @@ HAPI int package_add_instance(struct pkg_info *info, struct inst_info *inst)
                (void)slave_event_callback_add(info->slave, SLAVE_EVENT_ACTIVATE, slave_activated_cb, info);
                (void)slave_event_callback_add(info->slave, SLAVE_EVENT_FAULT, slave_fault_cb, info);
 
-               if (info->secured || (WIDGET_IS_INHOUSE(package_abi(info)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL)) {
+               if (info->flags.field.secured || (WIDGET_IS_INHOUSE(package_abi(info)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL)) {
                        (void)slave_event_callback_add(info->slave, SLAVE_EVENT_PAUSE, slave_paused_cb, info);
                        (void)slave_event_callback_add(info->slave, SLAVE_EVENT_RESUME, slave_resumed_cb, info);
 
@@ -1265,7 +1283,7 @@ HAPI int package_del_instance(struct pkg_info *info, struct inst_info *inst)
                slave_event_callback_del(info->slave, SLAVE_EVENT_DEACTIVATE, slave_deactivated_cb, info);
                slave_event_callback_del(info->slave, SLAVE_EVENT_ACTIVATE, slave_activated_cb, info);
 
-               if (info->secured || (WIDGET_IS_INHOUSE(package_abi(info)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL)) {
+               if (info->flags.field.secured || (WIDGET_IS_INHOUSE(package_abi(info)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL)) {
                        slave_event_callback_del(info->slave, SLAVE_EVENT_PAUSE, slave_paused_cb, info);
                        slave_event_callback_del(info->slave, SLAVE_EVENT_RESUME, slave_resumed_cb, info);
 
@@ -1277,7 +1295,7 @@ HAPI int package_del_instance(struct pkg_info *info, struct inst_info *inst)
                info->slave = NULL;
        }
 
-       if (info->is_uninstalled) {
+       if (info->flags.field.is_uninstalled) {
                package_destroy(info);
        }
 
@@ -1352,7 +1370,7 @@ static int io_uninstall_cb(const char *pkgid, const char *widget_id, int prime,
                return 0;
        }
 
-       info->is_uninstalled = 1;
+       info->flags.field.is_uninstalled = 1;
 
        /*!
         * \NOTE
@@ -1710,7 +1728,7 @@ HAPI int const package_fault_count(struct pkg_info *info)
        return info ? info->fault_count : 0;
 }
 
-HAPI int package_instance_count(struct pkg_info *info)
+HAPI int package_instance_count(struct pkg_info *info, int include_deleting)
 {
        Eina_List *l;
        struct inst_info *inst;
@@ -1726,6 +1744,7 @@ HAPI int package_instance_count(struct pkg_info *info)
                        break;
                case INST_DESTROYED:
                case INST_REQUEST_TO_DESTROY:
+                       count += !!include_deleting;
                default:
                        break;
                }
index b8916e6..6e7684f 100644 (file)
@@ -1458,8 +1458,8 @@ static struct packet *client_new(pid_t pid, int handle, const struct packet *pac
        } else if (util_free_space(WIDGET_CONF_IMAGE_PATH) <= WIDGET_CONF_MINIMUM_SPACE) {
                ErrPrint("Not enough space\n");
                ret = WIDGET_ERROR_FILE_NO_SPACE_ON_DEVICE;
-       } else if (max_count && max_count <= package_instance_count(info)) {
-               ErrPrint("Reached to the max count of widgets %d, %d\n", max_count, package_instance_count(info));
+       } else if (max_count && max_count <= package_instance_count(info, 1)) {
+               ErrPrint("Reached to the max count of widgets %d, %d\n", max_count, package_instance_count(info, 1));
                ret = WIDGET_ERROR_CANCELED;
        } else {
                struct inst_info *inst;
@@ -9956,17 +9956,17 @@ HAPI int server_init(void)
                ErrPrint("Failed to create a info socket\n");
        }
 
-       s_info.slave_fd = com_core_packet_server_init_with_permission(SLAVE_SOCKET, s_slave_table, NULL);
+       s_info.slave_fd = com_core_packet_server_init_with_permission("sdlocal://"SLAVE_SOCKET, s_slave_table, NULL);
        if (s_info.slave_fd < 0) {
                ErrPrint("Failed to create a slave socket\n");
        }
 
-       s_info.client_fd = com_core_packet_server_init_with_permission(CLIENT_SOCKET, s_client_table, NULL);
+       s_info.client_fd = com_core_packet_server_init_with_permission("sdlocal://"CLIENT_SOCKET, s_client_table, NULL);
        if (s_info.client_fd < 0) {
                ErrPrint("Failed to create a client socket\n");
        }
 
-       s_info.service_fd = com_core_packet_server_init_with_permission(SERVICE_SOCKET, s_service_table, NULL);
+       s_info.service_fd = com_core_packet_server_init_with_permission("sdlocal://"SERVICE_SOCKET, s_service_table, NULL);
        if (s_info.service_fd < 0) {
                ErrPrint("Faild to create a service socket\n");
        }
index e2d16b5..d153882 100644 (file)
@@ -132,9 +132,9 @@ HAPI int shared_fd_service_init(void)
         * 4. Send accepted FD to provider via result packet.
         * 5. Provider will send a packet to the viewer via that FD.
         */
-       s_info.fd = com_core_packet_server_init(SHARED_SOCKET, s_table);
+       s_info.fd = com_core_packet_server_init("sdlocal://"SHARED_SOCKET, s_table);
        if (s_info.fd < 0) {
-               ErrPrint("Failed to make a server for %s\n", SHARED_SOCKET);
+               ErrPrint("Failed to make a server for %s\n", "sdlocal://"SHARED_SOCKET);
        }
 
        return WIDGET_ERROR_NONE;
index 9284afa..d5b24a8 100644 (file)
@@ -68,18 +68,29 @@ struct slave_node {
        char *name;
        char *abi;
        char *pkgname;
-       int secured;    /* Only A package(widget) is loaded for security requirements */
        int refcnt;
        int fault_count;
        int critical_fault_count;
        enum slave_state state;
-       int network;
 
        int loaded_instance;
        int loaded_package;
 
-       int reactivate_instances;
-       int reactivate_slave;
+       union _slave_flags {
+               struct _slave_fields {
+                       unsigned int reactivate_instances: 1;
+                       unsigned int reactivate_slave: 1;
+                       unsigned int secured: 1;        /* Only A package(widget) is loaded for security requirements */
+                       unsigned int network: 1;
+                       unsigned int auto_align: 1;
+                       unsigned int valid: 1;
+                       unsigned int is_watch: 1;       /*!< Specialized field. Only for the WATCH */
+                       unsigned int wait_deactivation: 1;
+
+                       unsigned int reserved: 24;
+               } field;
+               unsigned int mask;
+       } flags;
 
        pid_t pid;
 
@@ -116,19 +127,14 @@ struct slave_node {
 #endif
 
        char *hw_acceleration;
-       int valid;
        char *extra_bundle_data;
 
-       int is_watch;   /*!< Specialized field. Only for the WATCH */
-
        struct _resource {
                struct _memory {
                        unsigned int soft;
                        unsigned int hard;
                } memory;
        } resources;
-
-       int wait_deactivation;
 };
 
 struct event {
@@ -235,7 +241,7 @@ static struct slave_node *slave_deactivate(struct slave_node *slave, int no_time
                (void)slave_rpc_disconnect(slave);
        } else if (slave->terminate_timer) {
                ErrPrint("Terminate timer is already fired (%d)\n", slave->pid);
-       } else if (!slave->extra_bundle_data && ((!no_timer && !slave->secured) || slave_is_app(slave)) && (!slave_is_watch(slave) && WIDGET_CONF_SLAVE_TERMINATE_TIME > 0.0f)) {
+       } else if (!slave->extra_bundle_data && ((!no_timer && !slave->flags.field.secured) || slave_is_app(slave)) && (!slave_is_watch(slave) && WIDGET_CONF_SLAVE_TERMINATE_TIME > 0.0f)) {
                DbgPrint("Fire the terminate timer: %d (%d)\n", slave->pid, slave_is_app(slave));
                slave->terminate_timer = ecore_timer_add(WIDGET_CONF_SLAVE_TERMINATE_TIME, terminate_timer_cb, slave);
                if (!slave->terminate_timer) {
@@ -395,10 +401,10 @@ static inline struct slave_node *create_slave_node(const char *name, int is_secu
                }
        }
 
-       slave->secured = is_secured;
+       slave->flags.field.secured = is_secured;
        slave->pid = (pid_t)-1;
        slave->state = SLAVE_TERMINATED;
-       slave->network = network;
+       slave->flags.field.network = network;
        slave->relaunch_count = WIDGET_CONF_SLAVE_RELAUNCH_COUNT;
 
        xmonitor_add_event_callback(XMONITOR_PAUSED, xmonitor_pause_cb, slave);
@@ -505,7 +511,7 @@ HAPI int slave_expired_ttl(struct slave_node *slave)
        }
 
        if (!slave_is_app(slave)
-               && !slave->secured
+               && !slave->flags.field.secured
                && !(WIDGET_IS_INHOUSE(slave_abi(slave)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL))
        {
                return 0;
@@ -555,7 +561,7 @@ HAPI struct slave_node *slave_create(const char *name, int is_secured, const cha
 
        slave = find_slave(name);
        if (slave) {
-               if (slave->secured != is_secured) {
+               if (slave->flags.field.secured != is_secured) {
                        ErrPrint("Exists slave and creating slave's security flag is not matched\n");
                }
                return slave;
@@ -748,6 +754,7 @@ static bundle *create_slave_param(struct slave_node *slave)
                bundle_add_str(param, WIDGET_CONF_BUNDLE_SLAVE_SECURED, ((WIDGET_IS_INHOUSE(slave_abi(slave)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL) || slave_is_secured(slave)) ? "true" : "false");
                bundle_add_str(param, WIDGET_CONF_BUNDLE_SLAVE_ABI, slave_abi(slave));
                bundle_add_str(param, WIDGET_CONF_BUNDLE_SLAVE_HW_ACCELERATION, slave->hw_acceleration);
+               bundle_add_str(param, WIDGET_CONF_BUNDLE_SLAVE_AUTO_ALIGN, slave->flags.field.auto_align ? "true" : "false");
        } else {
                ErrPrint("Failed to create a bundle\n");
        }
@@ -882,7 +889,7 @@ HAPI int slave_activate(struct slave_node *slave)
        }
 
        if (WIDGET_CONF_DEBUG_MODE || g_conf.debug_mode) {
-               DbgPrint("Debug Mode enabled. name[%s] secured[%d] abi[%s]\n", slave_name(slave), slave->secured, slave->abi);
+               DbgPrint("Debug Mode enabled. name[%s] secured[%d] abi[%s]\n", slave_name(slave), slave->flags.field.secured, slave->abi);
        } else {
                bundle *param;
 
@@ -958,7 +965,7 @@ HAPI int slave_give_more_ttl(struct slave_node *slave)
        double delay;
 
        if (!(WIDGET_IS_INHOUSE(slave_abi(slave)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL)
-               && ((!slave_is_app(slave) && !slave->secured) || !slave->ttl_timer))
+               && ((!slave_is_app(slave) && !slave->flags.field.secured) || !slave->ttl_timer))
        {
                return WIDGET_ERROR_INVALID_PARAMETER;
        }
@@ -976,7 +983,7 @@ HAPI int slave_give_more_ttl(struct slave_node *slave)
 HAPI int slave_freeze_ttl(struct slave_node *slave)
 {
        if (!(WIDGET_IS_INHOUSE(slave_abi(slave)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL)
-               && ((!slave_is_app(slave) && !slave->secured) || !slave->ttl_timer))
+               && ((!slave_is_app(slave) && !slave->flags.field.secured) || !slave->ttl_timer))
        {
                return WIDGET_ERROR_INVALID_PARAMETER;
        }
@@ -990,7 +997,7 @@ HAPI int slave_thaw_ttl(struct slave_node *slave)
        double delay;
 
        if (!(WIDGET_IS_INHOUSE(slave_abi(slave)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL)
-               && ((!slave_is_app(slave) && !slave->secured) || !slave->ttl_timer))
+               && ((!slave_is_app(slave) && !slave->flags.field.secured) || !slave->ttl_timer))
        {
                return WIDGET_ERROR_INVALID_PARAMETER;
        }
@@ -1023,7 +1030,7 @@ HAPI int slave_activated(struct slave_node *slave)
         */
        if (!slave->extra_bundle_data /* Launched by SDK Viewer */
                && !slave_is_watch(slave) /* Not a watch */
-               && ((WIDGET_IS_INHOUSE(slave_abi(slave)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL) || slave->secured == 1 || slave_is_app(slave))
+               && ((WIDGET_IS_INHOUSE(slave_abi(slave)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL) || slave->flags.field.secured == 1 || slave_is_app(slave))
                && WIDGET_CONF_SLAVE_TTL > 0.0f)
        {
                DbgPrint("Slave deactivation timer is added (%s - %lf)\n", slave_name(slave), WIDGET_CONF_SLAVE_TTL);
@@ -1532,13 +1539,13 @@ HAPI struct slave_node *slave_find_by_name(const char *name)
        return NULL;
 }
 
-HAPI struct slave_node *slave_find_available(const char *slave_pkgname, const char *abi, int secured, int network, const char *hw_acceleration)
+HAPI struct slave_node *slave_find_available(const char *slave_pkgname, const char *abi, int secured, int network, const char *hw_acceleration, int auto_align)
 {
        Eina_List *l;
        struct slave_node *slave;
 
        EINA_LIST_FOREACH(s_info.slave_list, l, slave) {
-               if (slave->secured != secured) {
+               if (slave->flags.field.secured != secured) {
                        continue;
                }
 
@@ -1569,13 +1576,17 @@ HAPI struct slave_node *slave_find_available(const char *slave_pkgname, const ch
                        }
                }
 
-               if (slave->secured) {
+               if (slave->flags.field.auto_align != auto_align) {
+                       continue;
+               }
+
+               if (slave->flags.field.secured) {
                        if (slave->loaded_package == 0) {
                                DbgPrint("Found secured slave - has no instances (%s)\n", slave_name(slave));
                                return slave;
                        }
-               } else if (slave->network == network) {
-                       DbgPrint("slave[%s] loaded_package[%d] net: [%d]\n", slave_name(slave), slave->loaded_package, slave->network);
+               } else if (slave->flags.field.network == network) {
+                       DbgPrint("slave[%s] loaded_package[%d] net: [%d]\n", slave_name(slave), slave->loaded_package, slave->flags.field.network);
                        if (!strcasecmp(abi, WIDGET_CONF_DEFAULT_ABI)) {
                                int max_load;
                                if (g_conf.slave_max_load < 0) {
@@ -1720,7 +1731,7 @@ HAPI struct slave_node *slave_unload_instance(struct slave_node *slave)
 
 HAPI const int const slave_is_secured(const struct slave_node *slave)
 {
-       return slave->secured;
+       return slave->flags.field.secured;
 }
 
 HAPI const int const slave_is_app(const struct slave_node *slave)
@@ -1969,17 +1980,17 @@ HAPI double const slave_ttl(const struct slave_node *slave)
 
 HAPI void slave_set_reactivate_instances(struct slave_node *slave, int reactivate)
 {
-       slave->reactivate_instances = reactivate;
+       slave->flags.field.reactivate_instances = !!reactivate;
 }
 
 HAPI int slave_need_to_reactivate_instances(struct slave_node *slave)
 {
-       return slave->reactivate_instances;
+       return slave->flags.field.reactivate_instances;
 }
 
 HAPI void slave_set_reactivation(struct slave_node *slave, int flag)
 {
-       slave->reactivate_slave = flag;
+       slave->flags.field.reactivate_slave = flag;
 }
 
 HAPI int slave_need_to_reactivate(struct slave_node *slave)
@@ -2028,17 +2039,17 @@ HAPI int slave_need_to_reactivate(struct slave_node *slave)
                reactivate = 1;
        }
 
-       return reactivate && slave->reactivate_slave;
+       return reactivate && slave->flags.field.reactivate_slave;
 }
 
 HAPI int slave_network(const struct slave_node *slave)
 {
-       return slave->network;
+       return slave->flags.field.network;
 }
 
 HAPI void slave_set_network(struct slave_node *slave, int network)
 {
-       slave->network = network;
+       slave->flags.field.network = network;
 }
 
 HAPI int slave_deactivate_all(int reactivate, int reactivate_instances, int no_timer)
@@ -2148,17 +2159,17 @@ HAPI int slave_priority(struct slave_node *slave)
 
 HAPI int slave_valid(const struct slave_node *slave)
 {
-    if (!slave->valid) {
+    if (!slave->flags.field.valid) {
         DbgPrint("slave is invalid");
     }
 
-    return slave->valid;
+    return slave->flags.field.valid;
 }
 
 HAPI void slave_set_valid(struct slave_node *slave)
 {
     DbgPrint("slave is set valid\n");
-    slave->valid = 1;
+    slave->flags.field.valid = 1;
 }
 
 HAPI void slave_set_extra_bundle_data(struct slave_node *slave, const char *extra_bundle_data)
@@ -2188,7 +2199,7 @@ HAPI const char *slave_extra_bundle_data(struct slave_node *slave)
 
 HAPI int slave_is_watch(struct slave_node *slave)
 {
-       return slave ? slave->is_watch : 0;
+       return slave ? slave->flags.field.is_watch : 0;
 }
 
 HAPI void slave_set_is_watch(struct slave_node *slave, int flag)
@@ -2197,7 +2208,7 @@ HAPI void slave_set_is_watch(struct slave_node *slave, int flag)
                return;
        }
 
-       slave->is_watch = flag;
+       slave->flags.field.is_watch = flag;
 }
 
 HAPI int slave_set_resource_limit(struct slave_node *slave, unsigned int soft, unsigned int hard)
@@ -2236,12 +2247,12 @@ HAPI int slave_get_resource_limit(struct slave_node *slave, unsigned int *soft,
 
 HAPI void slave_set_wait_deactivation(struct slave_node *slave, int wait)
 {
-       slave->wait_deactivation = !!wait;
+       slave->flags.field.wait_deactivation = !!wait;
 }
 
 HAPI int slave_wait_deactivation(struct slave_node *slave)
 {
-       return slave->wait_deactivation;
+       return slave->flags.field.wait_deactivation;
 }
 
 /* End of a file */
index e893eab..e861f5b 100644 (file)
@@ -409,7 +409,7 @@ int utility_service_init(void)
                return WIDGET_ERROR_ALREADY_STARTED;
        }
 
-       s_info.svc_ctx = service_common_create(UTILITY_SOCKET, UTILITY_SMACK_LABEL, service_thread_main, NULL);
+       s_info.svc_ctx = service_common_create("sdlocal://"UTILITY_SOCKET, UTILITY_SMACK_LABEL, service_thread_main, NULL);
        if (!s_info.svc_ctx) {
                ErrPrint("Unable to activate service thread\n");
                return WIDGET_ERROR_FAULT;