summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKim Kibum <kb0929.kim@samsung.com>2012-04-29 16:58:18 +0900
committerKim Kibum <kb0929.kim@samsung.com>2012-04-29 16:58:18 +0900
commitc715cb7ca4829e7966c0e2516ae46c43c0dc627b (patch)
tree5f064d9aaafb8bf95ef6b4826d4290dd4d9c2ec6
parent2b9618b28ea406642973a138dab1b1d9fd66452a (diff)
downloadapp-manager-c715cb7ca4829e7966c0e2516ae46c43c0dc627b.tar.gz
app-manager-c715cb7ca4829e7966c0e2516ae46c43c0dc627b.tar.bz2
app-manager-c715cb7ca4829e7966c0e2516ae46c43c0dc627b.zip
upload tizen1.0 source
-rwxr-xr-xCMakeLists.txt7
-rwxr-xr-xcapi-appfw-app-manager.pc.in2
-rwxr-xr-xdebian/changelog10
-rwxr-xr-xdebian/control6
-rwxr-xr-xinclude/app_manager.h2
-rwxr-xr-xpackaging/capi-appfw-app-manager.spec10
-rwxr-xr-xsrc/app_manager.c122
7 files changed, 84 insertions, 75 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2f768c0..5d95bd9 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,10 +10,11 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX})
SET(INC_DIR include)
INCLUDE_DIRECTORIES(${INC_DIR})
-SET(dependents "dlog vconf aul ail capi-base-common")
+SET(requires "capi-base-common dlog vconf aul ail pkgmgr")
+SET(pc_requires "capi-base-common")
INCLUDE(FindPkgConfig)
-pkg_check_modules(${fw_name} REQUIRED ${dependents})
+pkg_check_modules(${fw_name} REQUIRED ${requires})
FOREACH(flag ${${fw_name}_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
@@ -51,7 +52,7 @@ INSTALL(
)
SET(PC_NAME ${fw_name})
-SET(PC_REQUIRED ${dependents})
+SET(PC_REQUIRED ${pc_requires})
SET(PC_LDFLAGS -l${fw_name})
SET(PC_CFLAGS -I\${includedir}/appfw)
diff --git a/capi-appfw-app-manager.pc.in b/capi-appfw-app-manager.pc.in
index 0a03940..f0c4fb4 100755
--- a/capi-appfw-app-manager.pc.in
+++ b/capi-appfw-app-manager.pc.in
@@ -11,5 +11,5 @@ Description: @PACKAGE_DESCRIPTION@
Version: @VERSION@
Requires: @PC_REQUIRED@
Libs: -L${libdir} @PC_LDFLAGS@
-Cflags: -I${includedir} @PC_CFLAGS@
+Cflags: -I${includedir}
diff --git a/debian/changelog b/debian/changelog
index 3b3f33d..b7c47e4 100755
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+capi-appfw-app-manager (0.1.0-9) unstable; urgency=low
+
+ * Updated build configuration
+ * App-list APIs are re-implemented by package-manager lib
+ * Updated for AIL API changes
+ * Git: api/app-manager
+ * Tag: capi-appfw-app-manager_0.1.0-9
+
+ -- Junghyuk Park <junghyuk.park@samsung.com> Thu, 15 Mar 2012 11:37:29 +0900
+
capi-appfw-app-manager (0.1.0-6) unstable; urgency=low
* Added version numbering
diff --git a/debian/control b/debian/control
index 611cf94..45102ab 100755
--- a/debian/control
+++ b/debian/control
@@ -3,16 +3,16 @@ Source: capi-appfw-app-manager
Section: libs
Priority: extra
Maintainer: Woongsuk Cho <ws77.cho@samsung.com>, junghyuk park <junghyuk.park@samsung.com>
-Build-Depends: debhelper (>= 5), dlog-dev, libaul-1-dev, capi-base-common-dev, libail-0-dev, libvconf-dev
+Build-Depends: debhelper (>= 5), dlog-dev, libaul-1-dev, capi-base-common-dev, libail-0-dev, libvconf-dev, libpkgmgr-client-dev
Package: capi-appfw-app-manager
Architecture: any
-Depends: ${shilbs:Depends}, ${misc:Depends}
+Depends: ${shlibs:Depends}, ${misc:Depends}
Description: The Application Manager API provides functions to get information about running applications.
Package: capi-appfw-app-manager-dev
Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, capi-appfw-app-manager (= ${Source-Version}), dlog-dev, libaul-1-dev, capi-base-common-dev, libail-0-dev, libvconf-dev
+Depends: ${shlibs:Depends}, ${misc:Depends}, capi-appfw-app-manager (= ${Source-Version}), capi-base-common-dev
Description: The Application Manager API provides functions to get information about running applications. (DEV)
Package: capi-appfw-app-manager-dbg
diff --git a/include/app_manager.h b/include/app_manager.h
index 5dac9e4..72362b2 100755
--- a/include/app_manager.h
+++ b/include/app_manager.h
@@ -179,6 +179,7 @@ int app_manager_get_app_version(const char *package, char **version);
* @return 0 on success, otherwise a negative error value.
* @retval #APP_MANAGER_ERROR_NONE On Successful
* @retval #APP_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
* @post It will invoke app_manager_app_list_changed_cb() when the list of installed application changes.
* @see app_manager_unset_app_list_changed_cb()
* @see app_manager_app_list_changed_cb()
@@ -190,7 +191,6 @@ int app_manager_set_app_list_changed_cb(app_manager_app_list_changed_cb callback
*
* @return 0 on success, otherwise a negative error value.
* @retval #APP_MANAGER_ERROR_NONE Successful
- * @retval #APP_MANAGER_ERROR_DB_FAILED Database error occurred
* @see app_manager_set_app_list_changed_cb()
* @see app_manager_app_list_changed_cb()
*/
diff --git a/packaging/capi-appfw-app-manager.spec b/packaging/capi-appfw-app-manager.spec
index aedf7bd..9c47400 100755
--- a/packaging/capi-appfw-app-manager.spec
+++ b/packaging/capi-appfw-app-manager.spec
@@ -10,6 +10,7 @@ BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(vconf)
BuildRequires: pkgconfig(aul)
BuildRequires: pkgconfig(ail)
+BuildRequires: pkgconfig(pkgmgr)
BuildRequires: pkgconfig(capi-base-common)
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
@@ -31,10 +32,8 @@ The Application Manager API provides functions to get information about running
%build
-FULLVER=%{version}
-MAJORVER=`echo ${FULLVER} | cut -d '.' -f 1`
-cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=${FULLVER} -DMAJORVER=${MAJORVER}
-
+MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
+cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
make %{?jobs:-j%jobs}
@@ -48,10 +47,11 @@ rm -rf %{buildroot}
%files
-%{_libdir}/libcapi-appfw-app-manager.so*
+%{_libdir}/libcapi-appfw-app-manager.so.*
%files devel
%{_includedir}/appfw/app_manager.h
+%{_libdir}/libcapi-appfw-app-manager.so
%{_libdir}/pkgconfig/*.pc
diff --git a/src/app_manager.c b/src/app_manager.c
index cf87e86..219fc66 100755
--- a/src/app_manager.c
+++ b/src/app_manager.c
@@ -24,6 +24,7 @@
#include <aul_service.h>
#include <vconf.h>
#include <ail.h>
+#include <package-manager.h>
#include <dlog.h>
#include <app_manager_private.h>
@@ -35,16 +36,10 @@
#define LOG_TAG "TIZEN_N_APP_MANAGER"
-#define MENU_PKG_VCONF_KEY "memory/menuscreen/desktop"
-
-#define EVENT_CREATE "create"
-#define EVENT_UPDATE "update"
-#define EVENT_DELETE "delete"
-
typedef struct {
app_manager_app_running_cb cb;
void *user_data;
- bool *foreach_break;
+ bool foreach_break;
} running_apps_foreach_cb_context;
typedef struct {
@@ -52,9 +47,9 @@ typedef struct {
void *user_data;
} installed_apps_foreach_cb_context;
+static pkgmgr_client *package_manager = NULL;
static app_manager_app_list_changed_cb app_list_changed_cb = NULL;
-
-static void app_manager_meun_pkg_changed(keynode_t* node, void *data);
+static void *app_list_changed_cb_data = NULL;
static int foreach_running_app_cb_broker(const aul_app_info * appcore_app_info, void *appcore_user_data)
{
@@ -88,11 +83,11 @@ static int foreach_running_app_cb_broker(const aul_app_info * appcore_app_info,
foreach_cb_context = (running_apps_foreach_cb_context *)appcore_user_data;
- if (foreach_cb_context->cb != NULL && *(foreach_cb_context->foreach_break) == false)
+ if (foreach_cb_context->cb != NULL && foreach_cb_context->foreach_break == false)
{
if (foreach_cb_context->cb(appcore_app_info->pkg_name, foreach_cb_context->user_data) == false)
{
- *(foreach_cb_context->foreach_break) = true;
+ foreach_cb_context->foreach_break = true;
}
}
@@ -170,12 +165,10 @@ static int app_manager_ail_error_handler(ail_error_e ail_error, const char *func
int app_manager_foreach_app_running(app_manager_app_running_cb callback, void *user_data)
{
- bool foreach_break = false;
-
running_apps_foreach_cb_context foreach_cb_context = {
.cb = callback,
.user_data = user_data,
- .foreach_break = &foreach_break
+ .foreach_break = false
};
if (callback == NULL)
@@ -253,7 +246,7 @@ int app_manager_is_running(const char *package, bool *is_running)
return APP_MANAGER_ERROR_NONE;
}
-static int app_manager_get_appinfo(const char *package, ail_prop_str_e property, char **value)
+static int app_manager_get_appinfo(const char *package, const char *property, char **value)
{
ail_error_e ail_error;
ail_appinfo_h appinfo;
@@ -321,83 +314,88 @@ int app_manager_get_app_version(const char *package, char** version)
return app_manager_get_appinfo(package, AIL_PROP_VERSION_STR, version);
}
-int app_manager_set_app_list_changed_cb(app_manager_app_list_changed_cb callback, void* user_data)
+static app_manger_event_type_e app_manager_app_list_pkgmgr_event(const char *value)
{
- if (callback == NULL)
+ if (!strcasecmp(value, "install"))
{
- LOGE("[%s] INVALID_PARAMETER(0x%08x) : invalid callback", __FUNCTION__, APP_MANAGER_ERROR_INVALID_PARAMETER);
- return APP_MANAGER_ERROR_INVALID_PARAMETER;
+ return APP_MANAGER_EVENT_INSTALLED;
}
-
- if (app_list_changed_cb == NULL)
+ else if (!strcasecmp(value, "uninstall"))
+ {
+ return APP_MANAGER_EVENT_UNINSTALLED;
+ }
+ else if (!strcasecmp(value, "update"))
+{
+ return APP_MANAGER_EVENT_UPDATED;
+ }
+ else
{
- vconf_notify_key_changed(MENU_PKG_VCONF_KEY, app_manager_meun_pkg_changed, user_data);
+ return APP_MANAGER_ERROR_INVALID_PARAMETER;
}
+}
- app_list_changed_cb = callback;
+static int app_manager_app_list_changed_cb_broker(int id, const char *type, const char *package, const char *key, const char *val, const void *msg, void *data)
+ {
+ static int event_id = -1;
+ static app_manger_event_type_e event_type;
- return APP_MANAGER_ERROR_NONE;
+ if (!strcasecmp(key, "start"))
+ {
+ event_id = id;
+ event_type = app_manager_app_list_pkgmgr_event(val);
}
-
-int app_manager_unset_app_list_changed_cb()
-{
- if (app_list_changed_cb != NULL)
+ else if (!strcasecmp(key, "end") && !strcasecmp(val, "ok") && id == event_id)
{
- if (vconf_ignore_key_changed(MENU_PKG_VCONF_KEY, app_manager_meun_pkg_changed))
+ if (app_list_changed_cb != NULL && event_type >= 0)
{
- LOGE("[%s] DB_FAILED(0x%08x)", __FUNCTION__, APP_MANAGER_ERROR_DB_FAILED);
- return APP_MANAGER_ERROR_DB_FAILED;
+ app_list_changed_cb(event_type, package, app_list_changed_cb_data);
}
- }
- app_list_changed_cb = NULL;
+ event_id = -1;
+ event_type = -1;
+ }
return APP_MANAGER_ERROR_NONE;
}
-static void app_manager_meun_pkg_changed(keynode_t* node, void *data)
+int app_manager_set_app_list_changed_cb(app_manager_app_list_changed_cb callback, void* user_data)
+{
+ if (callback == NULL)
{
- char *pkg_event;
- char type[10];
- char package[1024];
-
- pkg_event = vconf_get_str(vconf_keynode_get_name(node));
- if(!pkg_event) {
- LOGE("[%s] failed to get the package event");
- return;
+ LOGE("[%s] INVALID_PARAMETER(0x%08x)", __FUNCTION__, APP_MANAGER_ERROR_INVALID_PARAMETER);
+ return APP_MANAGER_ERROR_INVALID_PARAMETER;
}
- if (sscanf(pkg_event, "%10[^:]:%1023s", type, package) != 2)
+ if (app_list_changed_cb == NULL)
{
- LOGE("[%s] failed to parse the package event format : [%s], [%s]", __FUNCTION__, type, package);
- }
+ package_manager = pkgmgr_client_new(PC_LISTENING);
-
- if(app_list_changed_cb == NULL)
+ if (package_manager == NULL)
{
- return;
+ LOGE("[%s] OUT_OF_MEMORY(0x%08x)", __FUNCTION__, APP_MANAGER_ERROR_OUT_OF_MEMORY);
+ return APP_MANAGER_ERROR_OUT_OF_MEMORY;
}
- if(!strcasecmp(type, EVENT_CREATE))
- {
- // A new application has been installed.
- app_list_changed_cb(APP_MANAGER_EVENT_INSTALLED, package, data);
+ pkgmgr_client_listen_status(package_manager, app_manager_app_list_changed_cb_broker, NULL);
}
- else if( !strcasecmp(type, EVENT_UPDATE))
- {
- // An existing application has been updated.
- app_list_changed_cb(APP_MANAGER_EVENT_UPDATED , package, data);
+
+ app_list_changed_cb = callback;
+ app_list_changed_cb_data = user_data;
+
+ return APP_MANAGER_ERROR_NONE;
}
- else if( !strcasecmp(type, EVENT_DELETE))
+int app_manager_unset_app_list_changed_cb()
{
- // An existing application has been uninstalled.
- app_list_changed_cb(APP_MANAGER_EVENT_UNINSTALLED , package, data);
- }
- else
+ if (app_list_changed_cb != NULL)
{
- LOGE("[%s] invalid event : type(%s)", __FUNCTION__, type);
+ pkgmgr_client_free(package_manager);
+ package_manager = NULL;
}
+ app_list_changed_cb = NULL;
+ app_list_changed_cb_data = NULL;
+
+ return APP_MANAGER_ERROR_NONE;
}