BuildRequires: gettext-tools
BuildRequires: pkgconfig(security-server)
BuildRequires: pkgconfig(badge)
+BuildRequires: pkgconfig(appinfo) >= 0.1.0
# runtime requires
Requires: capi-appfw-application
Requires: capi-security-privilege-manager
Requires: chromium
Requires: message-port
-Requires: osp-env-config
+Requires: osp-env-config >= 1.2.2.1
Requires: sqlite
Requires: iniparser
INCLUDE(FindPkgConfig)
pkg_check_modules(pkgs REQUIRED
alarm-service
+ appinfo
aul
appsvc
bundle
#include <dlog.h>
#include <privilege-control.h>
#include <pkgmgr-info.h>
+#include <appinfo.h>
#include <FOspConfig.h>
#define LOG_IO_TAG "LOADER"
-#define MAX_PACKAGE_ID 20
+#define MAX_PACKAGE_ID 10
#define MAX_APP_EXECUTABLE_NAME 230
#define MAX_PACKAGE_NAME 100
#define MAX_PR_NAME 16
static int
-GetAppIdAppExecutableNameFromPathNew(const char appName[], char* appId, char* exeName)
+GetPackageIdAppExecutableNameFromPath(const char appName[], char* appId, char* exeName)
{
char buffer[PATH_MAX];
return 0;
}
-static int
-GetAppIdAppExecutableNameFromPath(const char appName[], char* appId, char* exeName)
-{
- const char* begin = NULL;
- const char* end = NULL;
- const int path_len = strlen(appName);
-
- // Calculate the header
- const char* p = strstr(appName, "/apps/org.tizen.");
- if (p == NULL)
- {
- return GetAppIdAppExecutableNameFromPathNew(appName, appId, exeName);
- }
-
- begin = p + 15;
-
- end = strchr(begin + 1, '/');
- if (end == NULL)
- {
- LOG(LOG_DEBUG, LOG_IO_TAG, "Tizen::Io, Improper appname %s", appName);
- return -1;
- }
-
- int len = end - begin - 1;
-
- if (len > MAX_PACKAGE_ID)
- {
- LOG(LOG_DEBUG, LOG_IO_TAG, "Tizen::Io, Improper appname %s with length %d", appName, len);
- len = MAX_PACKAGE_ID;
- //return -1;
- }
-
- strncpy(appId, begin + 1, len);
- LOG(LOG_DEBUG, LOG_IO_TAG, "Tizen::Io, app is %s", appId);
-
- int exe_len = 0;
-
- if (path_len > len + 21)
- {
- exe_len = std::min(MAX_APP_EXECUTABLE_NAME - 1, path_len - len - 21);
- strncpy(exeName, end + 5, exe_len);
- }
-
- LOG(LOG_DEBUG, LOG_IO_TAG, "Tizen::Io, exeName is %s", exeName);
-
- return 0;
-}
-
static void
PrintArgs(int argc, char* argv[])
{
bool bCommand = false;
- char packageId[MAX_PACKAGE_ID];
+ char packageId[MAX_PACKAGE_ID + 1];
char exeName[MAX_APP_EXECUTABLE_NAME];
char fullPath[PATH_MAX];
- memset(packageId, 0, MAX_PACKAGE_ID);
- memset(exeName, 0, MAX_APP_EXECUTABLE_NAME);
+ memset(packageId, 0, sizeof(packageId));
+ memset(exeName, 0, sizeof(exeName));
memset(fullPath, 0, PATH_MAX);
LOG(LOG_DEBUG, LOG_IO_TAG, "Tizen::Io, %s, %d > executable binary path: %s", __func__, __LINE__, pArgv[0]);
LOG(LOG_DEBUG, LOG_IO_TAG, "Tizen::Io, %s, %d > processed binary path: %s", __func__, __LINE__, fullPath);
// convert package path to packageId
- GetAppIdAppExecutableNameFromPath(fullPath, packageId, exeName);
+ GetPackageIdAppExecutableNameFromPath(fullPath, packageId, exeName);
// acquire appId from packageId and exec
char appId[MAX_PACKAGE_ID + MAX_APP_EXECUTABLE_NAME + 2] = {0, };
DoPreExec(packageId, fullPath);
// adjust privilege
- AdjustPrivilege(packageId);
+ AdjustPrivilege(appId);
}
AdjustCapability();
}
- // dlopen will load Osp_Initialize() internally as __attribute__((constructor))
- //Osp_Initialize();
+ appinfo_init(appId, 0);
+ appinfo_set_argv(argc, pArgv);
+
InitAppInfo(packageId, exeName, argc, pArgv, -1);
AdjustHwAccInfo(appId);
#include <notification/notification.h>
#include <appsvc/appsvc.h>
#include <vconf.h>
+#include <appinfo.h>
#include <FBaseInteger.h>
#include <FBaseColArrayList.h>
SysLogTag(NID_APP, "LAUNCH","[%ls:<Initialize Application>:start]", _AppInfo::GetAppExecutableName().GetPointer());
result r = E_SUCCESS;
int eflResult = APP_ERROR_NONE;
- int argc = _AppInfo::GetArgc();
- char** pArgv = _AppInfo::GetArgv();
+ int argc = 0;
+ char** pArgv = NULL;
_IAppManager* pAppManager = null;
_AppImpl* pAppImpl = _AppImpl::GetInstance();
// SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] Application registration failed.", GetErrorMessage(r));
// }
+ appinfo_get_argv(&argc, &pArgv);
eflResult = app_efl_main(&argc, &pArgv, &state_handler, this);
SysTryLog(NID_APP, eflResult == APP_ERROR_NONE, "app_efl_main failed with error (%d): Unknown", eflResult);
#include <new>
#include <fcntl.h>
+#include <appinfo.h>
+
#include <FBaseErrors.h>
#include <FAppPkgPackageInfo.h>
-
#include <FBaseSysLog.h>
+
#include <FBaseRt_Process.h>
+#include <FBase_StringConverter.h>
#include "FAppPkg_PackageInfoImpl.h"
#include "FApp_AppInfo.h"
-#include "FApp_Aul.h"
-#include "FApp_AppArg.h"
using namespace Tizen::App::Package;
using namespace Tizen::Base;
const int MAX_APIVERSION = 8;
const int MAX_APPID = 10;
const char PACKAGE_PATH_FORMAT[] = "/opt/usr/apps/0000000000/";
-const char PACKAGE_PATH_FORMAT2[] = "/opt/apps/0000000000/";
const char PATH_ROOT[] = "/opt/usr/apps/";
-const char PATH_ROOT2[] = "/opt/apps/";
const char APPINFO_FILE_PATH[] = "info/version.info";
const char COMPAT_FILE_PATH[] = "info/compat.info";
const char VIRTUAL_ROOT_FILE_PATH[] = "info/virtual.info";
, __appRootDirFd(-1)
, __appHandlerType(_APP_HANDLER_NONE)
, __parentWindowHandle(-1)
- , __apiVersion(_API_VERSION_2_2)
, __pAppName(null)
, __pAppVersion(null)
- , __argc(0)
- , __pArgv(null)
, __isPackageInfoInitialized(false)
- , __isOspCompat(false)
, __isSubMode(false)
, __isVirtualRoot(false)
{
result
+_AppInfo::Construct(void)
+{
+ SysAssertf(appinfo_is_initialized() == 1, "appinfo is not initialized.");
+
+ FBase_Initialize();
+
+ return E_SUCCESS;
+}
+
+
+result
_AppInfo::Construct(const char* packageId, const char* exeName, int argc, char* argv[])
{
SysAssertf(packageId != null, "Valid appId required to launch application.");
+ SysAssertf(appinfo_is_initialized() == 1, "appinfo is not initialized.");
- FBase_Initialize();
+ FBase_Initialize();
__appExecutableName = exeName;
__packageId = packageId;
__isSubMode = true;
__appExecutableName = name;
- SysLog(NID_APP, "Executable name is changed to %ls.", __appExecutableName.GetPointer());
+
+ std::unique_ptr<char[]> pActualExec(_StringConverter::CopyToCharArrayN(name));
+ appinfo_update_submode_execname_and_appid(pActualExec.get());
+ SysLog(NID_APP, "Executable name is changed to %s.", pActualExec.get());
}
__appId = __packageId + L'.' + __appExecutableName;
{
char appInfoPath[PATH_MAX] = {0, };
-#if 0
- const int len = strlen(PACKAGE_PATH_FORMAT2);
- strncpy(appInfoPath, PACKAGE_PATH_FORMAT2, len);
- appInfoPath[len] = '\0';
- // due to possible dependency problem, FIoFile is not used
- // app root path first
-
- strncpy(appInfoPath + strlen(PATH_ROOT2), packageId, MAX_APPID);
-#else
- // [FIXME] temporary code for directory location migration
- int len = strlen(PACKAGE_PATH_FORMAT2);
- strncpy(appInfoPath, PACKAGE_PATH_FORMAT2, len);
+ int len = strlen(PACKAGE_PATH_FORMAT);
+ strncpy(appInfoPath, PACKAGE_PATH_FORMAT, len);
appInfoPath[len] = '\0';
- strncpy(appInfoPath + strlen(PATH_ROOT2), packageId, MAX_APPID);
+ strncpy(appInfoPath + strlen(PATH_ROOT), packageId, MAX_APPID);
- if (euidaccess(appInfoPath, R_OK) != 0)
- {
- len = strlen(PACKAGE_PATH_FORMAT);
- strncpy(appInfoPath, PACKAGE_PATH_FORMAT, len);
- appInfoPath[len] = '\0';
-
- strncpy(appInfoPath + strlen(PATH_ROOT), packageId, MAX_APPID);
- }
-#endif
// app root directory file descriptor
__appRootDirFd = open(appInfoPath, O_RDONLY | O_CLOEXEC | O_DIRECTORY);
-
__appRootPath = appInfoPath;
SysLog(NID_APP, "App root directory (%s:%d) open.", appInfoPath, __appRootDirFd);
fclose(pFile);
// fd is closed when the stream is closed by fclose();
- __apiVersion = GetApiVersionFromStr(apiVersion);
-
- __argc = argc;
- __pArgv = argv;
+ appinfo_set_api_version(appinfo_get_api_version_from_str(apiVersion));
// to reduce package manager overhead, libc API is used
if (faccessat(__appRootDirFd, COMPAT_FILE_PATH, F_OK, 0) == 0)
{
SysLog(NID_APP, "OSP compatibility mode on.");
- __isOspCompat = true;
+ appinfo_set_compat(1);
}
if (faccessat(__appRootDirFd, VIRTUAL_ROOT_FILE_PATH, F_OK, 0) == 0)
}
}
+ SysLog(NID_APP, "New appinfo [%s][%s.%s].", appinfo_get_appid(), appinfo_get_packageid(), appinfo_get_execname());
SysLog(NID_APP, "AppInfo initialization finished [%ls][%ls.%ls][%d].",
- __appId.GetPointer(), __packageId.GetPointer(), __appExecutableName.GetPointer(), __apiVersion);
+ __appId.GetPointer(), __packageId.GetPointer(), __appExecutableName.GetPointer(), appinfo_get_api_version());
}
return E_SUCCESS;
{
SysAssertf(appId != null, "Valid appId required to launch application.");
- FBase_Initialize();
+ FBase_Initialize();
__appId = appId;
}
__appRootDirFd = open(appRoot, O_RDONLY | O_CLOEXEC | O_DIRECTORY);
- __apiVersion = _API_VERSION_2_1;
+ appinfo_set_api_version(APP_INFO_VERSION_2_2);
__appType = type;
__appRootPath = appRoot;
__appRootPath.Append(L'/');
}
- SysLog(NID_APP, "AppInfo initialization finished [%ls][%ls.%ls][%ls][%d].", __appId.GetPointer(), __packageId.GetPointer(), __appExecutableName.GetPointer(), __appRootPath.GetPointer(), __apiVersion);
+ SysLog(NID_APP, "AppInfo initialization finished [%ls][%ls.%ls][%ls][%d].", __appId.GetPointer(), __packageId.GetPointer(), __appExecutableName.GetPointer(), __appRootPath.GetPointer(), appinfo_get_api_version());
return E_SUCCESS;
}
}
-// [FIXME] refactoring to use hash
-_ApiVersion
-_AppInfo::GetApiVersionFromStr(const char* pVer)
-{
- String ver(pVer);
- ver.Trim();
-
- if (ver == L"2.2")
- {
- return _API_VERSION_2_2;
- }
- else if (ver == L"2.1")
- {
- return _API_VERSION_2_1;
- }
- else if (ver == L"2.0")
- {
- return _API_VERSION_2_0;
- }
- else if (ver == L"1.2")
- {
- return _API_VERSION_1_2;
- }
- else if (ver == L"1.1")
- {
- return _API_VERSION_1_1;
- }
- else if (ver == L"1.0.2")
- {
- return _API_VERSION_1_0_2;
- }
- else if (ver == L"1.0")
- {
- return _API_VERSION_1_0;
- }
- else
- {
- return _API_VERSION_2_2;
- }
-}
-
-
_ApiVersion
_AppInfo::GetApiVersion(void)
{
- return GetAppInfo()->__apiVersion;
+ return static_cast<_ApiVersion>(appinfo_get_api_version());
}
bool
_AppInfo::IsOspCompat(void)
{
- return GetAppInfo()->__isOspCompat;
+ return (appinfo_is_compat() == 1);
}
bool
result
_AppInfo::SetApiVersion(_ApiVersion v)
{
- GetAppInfo()->__apiVersion = v;
+ appinfo_set_api_version(static_cast<app_info_version_e>(v));
return E_SUCCESS;
}
int
-_AppInfo::GetArgc(void)
-{
- return GetAppInfo()->__argc;
-}
-
-
-char**
-_AppInfo::GetArgv(void)
-{
- return GetAppInfo()->__pArgv;
-}
-
-
-int
_AppInfo::GetAppHandlerType(void)
{
return GetAppInfo()->__appHandlerType;
static void SetAppType(_AppType appType);
/**
- * Gets the argument count.
- *
- * @return argc
- */
- _OSP_LOCAL_ static int GetArgc(void);
-
- /**
- * Gets the argument.
- *
- * @return argv
- */
- _OSP_LOCAL_ static char** GetArgv(void);
-
- /**
* Gets the application handler type.
*
* @return appHandlerType
*/
static void UpdatePackageInfo(bool update);
+ _OSP_LOCAL_ result Construct(void);
+
_OSP_LOCAL_ result Construct(const char* appId, const char* exeName, int argc, char* pArgv[]);
_OSP_LOCAL_ result Construct(const char* appId, const char* appRoot, _AppType type = _APP_TYPE_UI_APP);
_AppInfo& operator =(const _AppInfo& source);
- _OSP_LOCAL_ static Tizen::Base::_ApiVersion GetApiVersionFromStr(const char* pVer);
-
_OSP_LOCAL_ result UpdateAppInfoFromPackageInfo(const PackageId& packageId);
private:
int __appRootDirFd;
int __appHandlerType;
int __parentWindowHandle;
- Tizen::Base::_ApiVersion __apiVersion;
AppId __appId;
PackageId __packageId;
Tizen::Base::String __appExecutableName;
Tizen::Base::String __appRootPath;
Tizen::Base::String* __pAppName;
Tizen::Base::String* __pAppVersion;
- int __argc;
- char** __pArgv;
bool __isPackageInfoInitialized;
- bool __isOspCompat;
bool __isSubMode;
bool __isVirtualRoot;
}; // _AppInfo
* @file FBaseCharacter.cpp
* @brief This is the implementation file for Char class.
*/
-#include <wctype.h>
+#include <cwctype>
+
+#include <appinfo.h>
+
#include <FBaseCharacter.h>
-#include <FApp_AppInfo.h>
#include <FBaseSysLog.h>
+
#include "FBase_CharacterImpl.h"
namespace Tizen { namespace Base
bool
Character::IsLetter(wchar_t ch)
{
-
- if (Tizen::App::_AppInfo::GetApiVersion() == _API_VERSION_2_0 && Tizen::App::_AppInfo::IsOspCompat())
+ if ((appinfo_get_api_version() == APP_INFO_VERSION_2_0) && (appinfo_is_compat() == 1))
{
return(iswalpha(ch) != 0);
}
* @brief This file defines the diagnostics types.
*/
-#include <vconf.h>
-#include <dlog.h>
-#include <assert.h>
-#include <stdio.h>
+#include <cassert>
+#include <cstdio>
+#include <cstring>
#include <unistd.h>
-#include <string.h>
#include <sys/syscall.h>
#include <sys/types.h>
+
+#include <vconf.h>
+#include <dlog.h>
+#include <appinfo.h>
+
#include <FAppTypes.h>
#include <FBaseLog.h>
#include <FBaseSysLog.h>
+
#include "FBase_Log.h"
#include "FBase_StringConverter.h"
-#include "FApp_AppInfo.h"
extern "C" {
#include <iniparser.h>
}
using namespace Tizen::Base;
-using namespace Tizen::Io;
-using namespace Tizen::Base::Collection;
-using namespace Tizen::App;
#ifdef LOG_TAG
#undef LOG_TAG
if (unlikely(!appNameLoaded))
{
appNameLoaded = true;
- char* pAppName = _StringConverter::CopyToCharArrayN(_AppInfo::GetAppExecutableName());
- strncpy(appName, pAppName, LOG_MODULE_NAME_LEN_MAX);
- delete [] pAppName;
+ strncpy(appName, appinfo_get_execname(), LOG_MODULE_NAME_LEN_MAX);
}
snprintf(logTag, LOG_MODULE_NAME_LEN_MAX, "%s", appName);