#include <aul.h>
#include <app.h>
#include <appsvc/appsvc.h>
+#include <Ecore_X.h>
#include <FBaseInteger.h>
#include <FBaseColArrayList.h>
using namespace Tizen::Base::Utility;
using namespace Tizen::App::Package;
+
+extern "C" int appsvc_allow_transient_app(bundle*, Ecore_X_Window);
+
namespace Tizen { namespace App
{
static const char OSP_V_REQUEST_TYPE_MAP_INSERT[] = "map_insert";
static const char OSP_V_REQUEST_TYPE_MAP_UPDATE[] = "map_update";
static const char OSP_V_REQUEST_TYPE_MAP_DELETE[] = "map_delete";
-static const char BUNDLE_KEY_WINDOW[] = "__APP_SVC_K_WIN_ID__";
static const char BUNDLE_KEY_PREFIX_AUL[] = "__AUL_";
static const char BUNDLE_KEY_PREFIX_SERVICE[] = "__APP_SVC_";
static const char BUNDLE_KEY_PREFIX_OSP[] = "__OSP_";
AppId
_AppArg::GetCallerAppId(void) const
{
- pid_t callerPid = GetCallerPid();
- SysTryReturn(NID_APP, callerPid > 0, L"", E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Wrong process id: %d.", callerPid);
+ const char* pBundleValue = bundle_get_val(__pBundle, AUL_K_CALLER_APPID);
- char appId[PATH_MAX] = {0, };
- SysTryReturn(NID_APP, aul_app_get_appid_bypid(callerPid, appId, sizeof(appId)) == AUL_R_OK, L"", E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Object not found for %d.", callerPid);
-
- return String(appId);
+ return String(pBundleValue);
}
AppId
_AppArg::GetCalleeAppId(void) const
{
- const char* pBundleValue = bundle_get_val(__pBundle, AUL_K_CALLEE_PID);
-
- SysTryReturn(NID_APP, pBundleValue != null, L"", E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Object not found.");
+ const char* pBundleValue = bundle_get_val(__pBundle, AUL_K_CALLEE_APPID);
- pid_t calleePid = atoi(pBundleValue);
- SysTryReturn(NID_APP, calleePid > 0, L"", E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Wrong process id: %d.", calleePid);
-
- char appId[PATH_MAX] = {0, };
- SysTryReturn(NID_APP, aul_app_get_appid_bypid(calleePid, appId, sizeof(appId)) == AUL_R_OK, L"", E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Object not found for %d.", calleePid);
+ String retVal = pBundleValue;
String temp;
- String retVal = appId;
// [INFO] ugly code for submode callee
retVal.SubString(11, temp);
if (temp == L"_AppControl")
void
-_AppArg::SaveCalleeAppId(void)
-{
- const AppId& appId = GetCalleeAppId();
-
- std::unique_ptr<char[]> pVal(_StringConverter::CopyToCharArrayN(appId));
-
- appsvc_add_data(__pBundle, OSP_K_CALLEE_APPID, pVal.get());
-}
-
-
-void
_AppArg::AddListFromBundle(ArrayList* pList, bundle* bk, const char* key)
{
bundle* pBundle = bk;
result
_AppArg::UpdateWindowHandle(bundle* pBundle, long handle)
{
- if (handle == -1)
- {
- SysLog(NID_APP, "Invalid window handle.");
- return E_SUCCESS;
- }
-
- char handleName[32] = {0, };
- snprintf(handleName, 32, "%ld", handle);
+ appsvc_allow_transient_app(pBundle, handle);
- bundle_add(pBundle, BUNDLE_KEY_WINDOW, handleName);
SysLog(NID_APP, "Window Handle 0x%x added.", handle);
return E_SUCCESS;