Fix Uninstallation failure in managed application UI
authorDongeup Ham <dongeup.ham@samsung.com>
Mon, 12 Nov 2012 10:16:19 +0000 (19:16 +0900)
committerDongeup Ham <dongeup.ham@samsung.com>
Mon, 12 Nov 2012 10:16:19 +0000 (19:16 +0900)
Change-Id: I4e1961b28a66df974226304d9bb1c85ae7cf8949

inc/InstallerDefs.h
src/Util/InstallerUtil.cpp
src/Util/InstallerUtil.h
src/XmlHandler/XmlWriter.cpp
src/backend/backend.cpp

index 731a799..3e89413 100755 (executable)
@@ -21,7 +21,7 @@
 #ifndef _INSTALLER_DEFS_H_
 #define _INSTALLER_DEFS_H_
 
-#define OSP_INSTALLER_VERSION "osp-installer version = [2012/11/09]_RC[1]"
+#define OSP_INSTALLER_VERSION "osp-installer version = [2012/11/12]_RC[1]"
 
 #define DIR_BIN                                L"/bin"
 #define DIR_INFO                       L"/info"
index afdea15..b6f4ed7 100755 (executable)
@@ -411,3 +411,26 @@ InstallerUtil::CreateSymlinkForAppDirectory(const String& inPath, String& outPat
        return true;
 }
 
+bool
+InstallerUtil::DumpLog(const char* pBuf)
+{
+       char temp[4096] = {0};
+       TryReturn(pBuf, false, "[osp-installer] pBuf is null");
+
+       int bufLen = strlen(pBuf);
+       strncpy(temp, pBuf, sizeof(temp));
+
+       char *pStart = &temp[0];
+
+       for (int i = 0; i < bufLen; i++)
+       {
+               if (temp[i] == '\n')
+               {
+                       temp[i] = 0;
+                       AppLogTag(OSP_INSTALLER, "%s", pStart);
+                       pStart = temp + i + 1;
+               }
+       }
+
+       return true;
+}
index fa91af7..a83a7b8 100755 (executable)
@@ -61,6 +61,8 @@ public:
 
        static bool CreateSymlinkForAppDirectory(const Osp::Base::String& inPath, Osp::Base::String& outPath);
 
+       static bool DumpLog(const char* pBuf);
+
 private:
        InstallerUtil(const InstallerUtil& value);
        InstallerUtil& operator =(const InstallerUtil& source);
index 5d82efa..86e39d5 100755 (executable)
@@ -31,6 +31,7 @@
 
 #include "InstallerDefs.h"
 #include "XmlWriter.h"
+#include "InstallerUtil.h"
 
 using namespace Osp::Base;
 using namespace Osp::Base::Collection;
@@ -65,7 +66,8 @@ XmlWriter::~XmlWriter(void)
                AppLogTag(OSP_INSTALLER, "------------------------------------------");
                AppLogTag(OSP_INSTALLER, "%ls is generated", __xmlFilePath.GetPointer());
                AppLogTag(OSP_INSTALLER, "------------------------------------------");
-               AppLogTag(OSP_INSTALLER, "%s", __pXmlBuffer->content);
+               // AppLogTag(OSP_INSTALLER, "%s", __pXmlBuffer->content);
+               InstallerUtil::DumpLog((const char*)__pXmlBuffer->content);
        }
 
        if (__pXmlWriter)
index b72cdff..597e5de 100755 (executable)
@@ -97,7 +97,7 @@ main(int argc, char **argv)
        case PKGMGR_REQ_INSTALL:
                {
                        errorType = manager.Request(path, INSTALLER_OPERATION_INSTALL, REQUESTER_TYPE_NORMAL);
-
+                       appId = manager.GetAppId();
                        if (_pi != 0)
                        {
                                char resultBuf[128] = {0};
@@ -135,6 +135,7 @@ main(int argc, char **argv)
 
                        AppLogTag(OSP_INSTALLER, "requestAppId = %ls", requestAppId.GetPointer());
                        ret = manager.Request(requestAppId, INSTALLER_OPERATION_UNINSTALL, REQUESTER_TYPE_NORMAL);
+                       appId = manager.GetAppId();
 
                        if (_pi != 0)
                        {
@@ -202,7 +203,6 @@ __osp_installer_report_result(const String& appId, int errorType)
                }
                else
                {
-                       manager.PrintResult();
                        snprintf(resultBuf, sizeof(resultBuf), "%ls", appId.GetPointer());
                }
 
@@ -217,10 +217,11 @@ __osp_installer_report_result(const String& appId, int errorType)
        ret = pkgmgr_installer_send_signal(_pi, pPkgType, resultBuf, pKey, pValue);
        AppLogTag(OSP_INSTALLER, "------------------------------------------");
        AppLogTag(OSP_INSTALLER, "pkgmgr_installer_send_signal");
-       AppLogTag(OSP_INSTALLER, " # type = [%s]", pPkgType);
-       AppLogTag(OSP_INSTALLER, " # key = [%s]", pKey);
-       AppLogTag(OSP_INSTALLER, " # val = [%s]", pValue);
-       AppLogTag(OSP_INSTALLER, " # ret = [%s]", (ret == 0)?"success":"failure");
+       AppLogTag(OSP_INSTALLER, " # type   = [%s]", pPkgType);
+       AppLogTag(OSP_INSTALLER, " # pkg id = [%s]", resultBuf);
+       AppLogTag(OSP_INSTALLER, " # key    = [%s]", pKey);
+       AppLogTag(OSP_INSTALLER, " # val    = [%s]", pValue);
+       AppLogTag(OSP_INSTALLER, " # ret    = [%s]", (ret == 0)?"success":"failure");
        AppLogTag(OSP_INSTALLER, "------------------------------------------");
 
        pkgmgr_installer_free(_pi);