N_SE-39067 : fix proper appid handling for activeapp
authorYoung Ik Cho <youngik.cho@samsung.com>
Sat, 8 Jun 2013 04:11:59 +0000 (13:11 +0900)
committerYoung Ik Cho <youngik.cho@samsung.com>
Sat, 8 Jun 2013 04:16:26 +0000 (13:16 +0900)
Change-Id: Ic169560a9d537cc1812fc2f4d6502311ea9a1f6f
Signed-off-by: Young Ik Cho <youngik.cho@samsung.com>
src/app/FApp_AppArg.cpp
src/app/FApp_AppManagerImpl.cpp
src/app/FApp_Aul.cpp
src/app/inc/FApp_Aul.h

index 25a6f3c..bad6ac0 100644 (file)
@@ -45,6 +45,7 @@
 #include "FApp_AppControlEventArg.h"
 #include "FApp_AppArg.h"
 #include "FApp_AppMessageImpl.h"
+#include "FApp_Aul.h"
 #include "FAppPkg_PackageManagerImpl.h"
 
 using namespace Tizen::Base;
@@ -613,22 +614,9 @@ _AppArg::GetCalleeAppId(void) const
 {
        const char* pBundleValue = bundle_get_val(__pBundle, AUL_K_CALLEE_APPID);
 
-       String retVal = pBundleValue;
+       const AppId retVal = pBundleValue;
 
-       String temp;
-       // [INFO] ugly code for submode callee
-       retVal.SubString(11, temp);
-       if (temp == L"_AppControl")
-       {
-               String id;
-               retVal.SubString(0, 10, id);
-               const String& name = _PackageManagerImpl::GetInstance()->GetDefaultAppExecutableName(id);
-
-               retVal = id + L'.' + name;
-               SysLog(NID_APP, "Converted caller Id is %ls", retVal.GetPointer());
-       }
-
-       return retVal;
+       return _Aul::GetRealAppId(retVal);
 }
 
 
index 3bde180..624196d 100644 (file)
@@ -1236,12 +1236,12 @@ _AppManagerImpl::RemoveActiveAppEventListener(IActiveAppEventListener& listener)
 result
 _AppManagerImpl::GetActiveApp(AppId& appId)
 {
-       unsigned int windowId = GetActiveWindow();
-       int processId = GetProcessId(windowId);
+       const unsigned int windowId = GetActiveWindow();
+       const int processId = GetProcessId(windowId);
        char pkgname[255] = {0, };
        aul_app_get_pkgname_bypid(processId, pkgname, 255);
-       // TODO: Translate it to package name --> AppId
-       appId = pkgname;
+       
+       appId = _Aul::GetRealAppId(String(pkgname));
        return E_SUCCESS;
 }
 
index b416b33..7f20cd5 100644 (file)
@@ -290,7 +290,9 @@ _Aul::GetAppType(const String& category)
        return ret;
 }
 
-bool _Aul::IsInstalled(const AppId& appId)
+
+bool
+_Aul::IsInstalled(const AppId& appId)
 {
        String packageId;
        packageId = _PackageManagerImpl::GetPackageIdByAppId(appId);
@@ -298,6 +300,31 @@ bool _Aul::IsInstalled(const AppId& appId)
        return _PackageManagerImpl::GetInstance()->IsPackageInstalled(packageId);
 }
 
+
+AppId
+_Aul::GetRealAppId(const AppId& appId)
+{
+       String temp;
+       // [INFO] ugly code for submode callee
+       appId.SubString(11, temp);
+       if (temp == L"_AppControl")
+       {
+               String id;
+               appId.SubString(0, 10, id);
+               const String& name = _PackageManagerImpl::GetInstance()->GetDefaultAppExecutableName(id);
+
+               const String retVal = id + L'.' + name;
+               SysLog(NID_APP, "Converted caller Id is %ls", retVal.GetPointer());
+
+               return retVal;
+       }
+       else
+       {
+               return appId;
+       }
+}
+
+
 result
 _Aul::_DesktopFile::MakePath(const AppId& appId, char* path, int size)
 {
index 48eb982..0d79ade 100644 (file)
@@ -63,6 +63,8 @@ public:
 
        static bool IsInstalled(const AppId& appId);
 
+       _OSP_LOCAL_ static AppId GetRealAppId(const AppId& appId);
+
 public:
        /**
         * This is static helper class for desktop file.