#include <bundle.h>
#include <appsvc/appsvc.h>
#include <vconf.h>
+#include <pkgmgr-info.h>
#include <FBaseObject.h>
#include <FBaseString.h>
}
+String
+_Aul::GetMainAppId(const char* appid)
+{
+ pkgmgrinfo_appinfo_h handle = NULL;
+ int ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ {
+ return String();
+ }
+
+ char* mainid = NULL;
+ ret = pkgmgrinfo_appinfo_get_submode_mainid(handle, &mainid);
+ SysTryLog(NID_APP, ret == PMINFO_R_OK, "Cannot get main id for %s.", appid);
+
+ const String tmp = String(mainid);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return tmp;
+}
+
+
AppId
_Aul::GetRealAppId(const AppId& appId)
{
String temp;
- // [INFO] ugly code for submode callee
appId.SubString(11, temp);
if (temp == String(SUBMODE_NAME))
{
- 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;
+ std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId));
+ const String& main = GetMainAppId(pAppId.get());
+ if (!main.IsEmpty())
+ {
+ SysLog(NID_APP, "main Id is %ls", main.GetPointer());
+ return main;
+ }
}
+
+ return appId;
}
} } // Tizen::App