}
}
break;
+ case BUNDLE_TYPE_BYTE:
+ bundle_keyval_get_basic_val(const_cast<bundle_keyval_t*>(pVal), reinterpret_cast<void**>(&pStr), &size);
+
+ SysLog(NID_IO, "Bundle byte value = %s, size = %d", pStr, size);
+
+ if (pStr)
+ {
+ ByteBuffer* pBuffer = new (std::nothrow) ByteBuffer();
+ SysTryLog(NID_IO, pBuffer != null, "The memory is insufficient.");
+ result r = pBuffer->Construct(size);
+ SysTryLog(NID_IO, r == E_SUCCESS, "Constructing pBuffer is failed.");
+
+ pBuffer->SetArray((const byte*)pStr, 0, size);
+ pBuffer->Flip();
+
+ pMap->Add(new (std::nothrow) String(pKey), pBuffer);
+ }
+ break;
default:
SysLog(NID_APP, "Invalid type for %s : %d", pKey, type);
break;
else if (typeid(*pObj) == typeid(const ByteBuffer))
{
SysLog(NID_APP, "ByteBuffer type");
+ const ByteBuffer* pBuffer = static_cast<const ByteBuffer*>(pObj);
+
+ std::unique_ptr<char[]> pBundleKey(_StringConverter::CopyToCharArrayN(*pKey));
+ bundle_add_byte(b, pBundleKey.get(), pBuffer->GetPointer(), pBuffer->GetLimit());
}
}
}
static const wchar_t PACKAGE_FILTER_EXTERNAL_STORAGE[] = L"http://tizen.org/package/externalstorage";
static const wchar_t PACKAGE_FILTER_APP_SETTING[] = L"http://tizen.org/package/appsetting";
+// PackageFilter(internal)
+static const wchar_t PACKAGE_FILTER_TPK[] = L"http://tizen.org/package/tpk";
+
// PackageAppFilter
static const wchar_t PACKAGE_APP_FILTER_MENUICON_VISIBLE[] = L"http://tizen.org/package/app/menuiconvisible";
static const wchar_t PACKAGE_APP_FILTER_CATEGORY_HOMEAPP[] = L"http://tizen.org/category/homeapp";
#include <FIoDbEnumerator.h>
#include <FIoDbStatement.h>
#include <FIoFile.h>
+#include <FIoDirectory.h>
#include <FBase_StringConverter.h>
#include "FAppPkg_PackageManagerImpl.h"
res = pkgmgrinfo_appinfo_get_icon(__pAppInfoHandle, &pMenuIcon);
if (res == PMINFO_R_OK)
{
- SysLog(NID_APP, "pkgmgrinfo_appinfo_get_icon(): MenuIcon = [%s]", pMenuIcon);
String menuIcon(pMenuIcon);
SetAppMenuIconPath(menuIcon);
}
res = pkgmgrinfo_appinfo_get_setting_icon(__pAppInfoHandle, &pSettingIcon);
if (res == PMINFO_R_OK)
{
- SysLog(NID_APP, "pkgmgrinfo_appinfo_get_setting_icon(): SettingIcon = [%s]", pSettingIcon);
String settingIcon(pSettingIcon);
SetAppSettingIconPath(settingIcon);
}
res = pkgmgrinfo_appinfo_get_notification_icon(__pAppInfoHandle, &pNotificationIcon);
if (res == PMINFO_R_OK)
{
- SysLog(NID_APP, "pkgmgrinfo_appinfo_get_notification_icon(): NotificationIcon = [%s]", pNotificationIcon);
String notificationIcon(pNotificationIcon);
SetAppNotificationIconPath(notificationIcon);
}
if (File::IsFileExist(__appTempIconPath) == true)
{
File::Remove(__appTempIconPath);
+
+ String tmp(L"/tmp/__icon/");
+ Directory::Remove(tmp, true);
}
}
result = pkgmgrinfo_pkginfo_get_pkgname(__packageInfoHandle, &pPackage);
if (result == PMINFO_R_OK)
{
- SysLog(NID_APP, "pkgmgrinfo_pkginfo_get_pkgname(): package = [%s]", pPackage);
String package(pPackage);
__id = package;
}
result = pkgmgrinfo_pkginfo_get_version(__packageInfoHandle, &pVersion);
if (result == PMINFO_R_OK)
{
- SysLog(NID_APP, "pkgmgrinfo_pkginfo_get_version(): version = [%s]", pVersion);
String version(pVersion);
__version = version;
}
result = pkgmgrinfo_pkginfo_get_type(__packageInfoHandle, &pType);
if (result == PMINFO_R_OK)
{
- SysLog(NID_APP, "pkgmgrinfo_pkginfo_get_type(): type = [%s]", pType);
String type(pType);
__type = type;
}
result = pkgmgrinfo_pkginfo_get_label(__packageInfoHandle, &pName);
if (result == PMINFO_R_OK)
{
- SysLog(NID_APP, "pkgmgrinfo_pkginfo_get_label(): name = [%s]", pName);
String Name(pName);
__displayName = Name;
}
result = pkgmgrinfo_pkginfo_get_icon(__packageInfoHandle, &pIconPath);
if (result == PMINFO_R_OK)
{
- SysLog(NID_APP, "pkgmgrinfo_pkginfo_get_icon(): iconpath = [%s]", pIconPath);
String path(pIconPath);
__appIconPath = path;
}
result = pkgmgrinfo_pkginfo_is_removable(__packageInfoHandle, &removable);
if (result == PMINFO_R_OK)
{
- SysLog(NID_APP, "pkgmgrinfo_pkginfo_is_removable(): removable = [%d]", removable);
-
if (removable == false)
{
__uninstallable = false;
result = pkgmgrinfo_pkginfo_is_preload(__packageInfoHandle, &preloaded);
if (result == PMINFO_R_OK)
{
- SysLog(NID_APP, "pkgmgrinfo_pkginfo_is_preload(): preloaded = [%d]", preloaded);
-
if (preloaded == false)
{
__downloaded = true;
result = pkgmgrinfo_pkginfo_get_description(__packageInfoHandle, &pDescription);
if (result == PMINFO_R_OK)
{
- SysLog(NID_APP, "pkgmgrinfo_pkginfo_get_description(): description = [%s]", pDescription);
String description(pDescription);
__description = description;
}
result = pkgmgrinfo_pkginfo_get_author_name(__packageInfoHandle, &pAuthor);
if (result == PMINFO_R_OK)
{
- SysLog(NID_APP, "pkgmgrinfo_pkginfo_get_author_name(): author = [%s]", pAuthor);
String author(pAuthor);
__author = author;
}
result = pkgmgrinfo_pkginfo_get_installed_storage(__packageInfoHandle, &storage);
if (result == PMINFO_R_OK)
{
- SysLog(NID_APP, "pkgmgrinfo_pkginfo_get_installed_storage(): storage = [%d]", storage);
if (storage == PMINFO_EXTERNAL_STORAGE)
{
__externalStorage = true;
result = pkgmgrinfo_pkginfo_get_url(__packageInfoHandle, &pUrl);
if (result == PMINFO_R_OK)
{
- SysLog(NID_APP, "pkgmgrinfo_pkginfo_get_url(): url = [%s]", pUrl);
String url(pUrl);
__url = url;
}
result = pkgmgrinfo_pkginfo_get_mainappid(__packageInfoHandle, &pMainAppId);
if (result == PMINFO_R_OK)
{
- SysLog(NID_APP, "pkgmgrinfo_pkginfo_get_mainappid(): mainApp = [%s]", pMainAppId);
AppId mainAppId(pMainAppId);
__mainAppId = mainAppId;
}
result = pkgmgrinfo_pkginfo_get_storeclientid(__packageInfoHandle, &pStoreClientId);
if (result == PMINFO_R_OK)
{
- SysLog(NID_APP, "pkgmgrinfo_pkginfo_get_storeclientid(): storeClientId = [%s]", pStoreClientId);
String storeClientId(pStoreClientId);
__storeClientId = storeClientId;
}
result = pkgmgrinfo_pkginfo_get_root_path(__packageInfoHandle, &pRootPath);
if (result == PMINFO_R_OK)
{
- SysLog(NID_APP, "pkgmgrinfo_pkginfo_get_root_path(): rootPath = [%s]", pRootPath);
String rootPath(pRootPath);
__appRootPath = rootPath;
}
SysLog(NID_APP, "pkgmgrinfo_pkginfo_get_root_path() is failed. result = [%d]", result);
}
+ SysLog(NID_APP, "package(%ls), version(%ls), type(%ls), displayName(%ls), uninstallable(%d), downloaded(%d), "
+ "externalStorage(%d), mainApp(%ls), storeClient(%ls), appRootPath(%ls)",
+ __id.GetPointer(), __version.GetPointer(), __type.GetPointer(), __displayName.GetPointer(), __uninstallable, __downloaded,
+ __externalStorage, __mainAppId.GetPointer(), __storeClientId.GetPointer(), __appRootPath.GetPointer());
+
return r;
}
return E_SYSTEM;
}
- // optionalData = 12345abcde:StoreClientId=XXXXX12345.TizenStore
- AppId StoreClientId = _AppInfo::GetApplicationId();
+ // optionalData = 12345abcde:StoreClientId=XXXXX12345
+ PackageId StoreClientId = _AppInfo::GetPackageId();
String optionalData;
optionalData.Append(packageId);
optionalData.Append(":StoreClientId=");
res = pkgmgrinfo_pkginfo_filter_add_bool(handle, PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING, value);
SysTryCatch(NID_APP, res == PMINFO_R_OK, , E_SYSTEM, "pkgmgrinfo_pkginfo_filter_add_bool(APPSETTING, %d) is failed. [%d]", value, res);
}
+ else if ((*pKey) == PACKAGE_FILTER_TPK)
+ {
+ SysTryCatch(NID_APP, value == true, , E_SYSTEM, "Value(false) is invalid for PACKAGE_FILTER_TPK.");
+
+ res = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_TYPE, "tpk");
+ SysTryCatch(NID_APP, res == PMINFO_R_OK, , E_SYSTEM, "pkgmgrinfo_pkginfo_filter_add_string(TYPE, tpk) is failed. [%d]", res);
+ }
else if ((*pKey) == PACKAGE_FILTER_EXTERNAL_STORAGE)
{
String installedStorage;
void
String::Reverse(void)
{
- if (*__pRefCount > 0)
+ if (*__pRefCount > 1)
{
result r = CopyOnWrite(__capacity);
SysTryReturnVoidResult(NID_BASE, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed.");
void
String::ToLowerCase(void)
{
- if (*__pRefCount > 0)
+ if (*__pRefCount > 1)
{
result r = CopyOnWrite(__capacity);
SysTryReturnVoidResult(NID_BASE, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed.");
--lastIndex;
}
- // trim right
- if (lastIndex < __length)
+ bool trimRight = lastIndex < __length;
+ bool trimLeft = startIndex > 0;
+
+ if (!trimRight && !trimLeft) // nothing to trim
+ {
+ return;
+ }
+
+ if (*__pRefCount > 1)
+ {
+ result r = CopyOnWrite(__capacity);
+ SysTryReturnVoidResult(NID_BASE, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed");
+ }
+
+ if (trimRight)
{
Remove(lastIndex, __length - lastIndex);
}
- // trim left
- if (startIndex > 0)
+ if (trimLeft)
{
Remove(0, startIndex);
}
_IpcClient::_IpcClient(void)
: __pReverseSource(null)
+ , __fdCount(0)
, __pFdLock(null)
, __pListener(null)
{
struct HelloMessage
{
int pid;
- int reverse;
+ bool reverse;
+ char pkgId[256];
+ char appExecutableName[256];
};
result
socketNameLength = socketName.size() + 1;
SysTryReturnResult(NID_IO, socketNameLength < 108, E_INVALID_ARG, "Server name is too long.");
+ if (__fdCount == 0)
+ {
+ // Set an pkgId
+ String pkgId = _AppInfo::GetPackageId();
+ int length = (pkgId.GetLength() + 1) * sizeof(wchar_t);
+ if (length > 255)
+ {
+ length = 255;
+ }
+
+ SysTryReturnResult(NID_IO, pkgId.GetLength() > 0, E_SYSTEM, "AppId dose not exist.");
+
+ memcpy(helloMessage.pkgId, pkgId.GetPointer(), length);
+
+ // Set an executableName
+ String appExecutableName = _AppInfo::GetAppExecutableName();
+ length = (appExecutableName.GetLength() + 1) * sizeof(wchar_t);
+ if (length > 255)
+ {
+ length = 255;
+ }
+
+ if (appExecutableName.GetLength() != 0)
+ {
+ memcpy(helloMessage.appExecutableName, appExecutableName.GetPointer(), length);
+ }
+ }
+
client = socket(AF_UNIX, SOCK_STREAM, 0);
SysTryCatch(NID_IO, client != -1, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Failed to create a socket : %s.", strerror(errno));
}
else
{
+ ++__fdCount;
+
ReleaseFd(client);
}
GSource* __pReverseSource;
std::vector <int> __fds;
+ int __fdCount;
Tizen::Base::Runtime::Mutex* __pFdLock;
Tizen::Base::String __name;
_IIpcClientEventListener* __pListener;
SysTryReturnResult(NID_SEC_CERT, pName != null, E_PARSING_FAILED, "Failed to get certificate issuer name.");
__tbsCert.SetIssuerName(pName);
-
+ free(pName);
return E_SUCCESS;
}
__x509IsSelfSign = false;
}
+ free(pSubject);
return r;
}
__tbsCert.SetPublicKeyInfo(pubKeyLen, pPubKey);
OPENSSL_free(pPubKey);
+ EVP_PKEY_free(pKey);
return r;
}
_IpcServer* pIpcServer; /**< the pointer to an _ IpcServer */
GIOChannel* pReverseChannel; /**< the channel for sending reverse message */
std::vector <struct _ChannelInfo*> channels; /**< the set of channels associated with a client */
- Tizen::Base::String appId;
+ Tizen::Base::String pkgId;
+ Tizen::Base::String appExecutableName;
};
Tizen::Base::String __name;
#include <ipc/ipc_message.h>
-#include <app_manager.h>
-
#include <FBaseRtMutex.h>
#include <FBaseSysLog.h>
#include <FBase_StringConverter.h>
struct HelloMessage
{
int pid;
- int reverse; // if the connection is for reverse message
+ bool reverse; // true if the connection is for reverse message
+ char pkgId[256];
+ char appExecutableName[256];
};
gboolean
server = g_io_channel_unix_get_fd(source);
client = accept(server, (struct sockaddr*) &clientAddress, &clientLen);
- SysTryCatch(NID_IO, client != -1, ,E_SYSTEM, "[E_SYSTEM] Accept failed.");
+ SysTryCatch(NID_IO, client != -1, , E_SYSTEM, "[E_SYSTEM] Accept failed.");
read(client, &helloMessage, sizeof(helloMessage));
+ helloMessage.pkgId[255] = '\0';
+ helloMessage.appExecutableName[255] = '\0';
pChannel = g_io_channel_unix_new(client);
SysTryCatch(NID_IO, pChannel != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Not enough memory.");
pClientInfo->pIpcServer = pIpcServer;
pClientInfo->clientId = helloMessage.pid;
-
- char* pAppId = NULL;
- int ret = app_manager_get_app_id(helloMessage.pid, &pAppId);
- SysTryCatch(NID_IO, ret >= 0, delete pClientInfo, E_SYSTEM, "[E_SYSTEM] Failed to get_app_id: %d", ret);
-
- pClientInfo->appId = pAppId;
- free(pAppId);
-
+ pClientInfo->pkgId.Append((wchar_t*) helloMessage.pkgId);
+ pClientInfo->appExecutableName.Append((wchar_t*) helloMessage.appExecutableName);
pClientInfo->pReverseChannel = null;
pIpcServer->__clients[helloMessage.pid] = pClientInfo;
+
pIpcServer->__pCurrentClientInfo = pClientInfo;
pIpcServer->__pListener->OnIpcClientConnected(*pIpcServer, helloMessage.pid);
pIpcServer->__pCurrentClientInfo = null;
if (__pCurrentClientInfo)
{
- String pkgId;
- __pCurrentClientInfo->appId.SubString(0, 10, pkgId);
-
- return pkgId;
+ return __pCurrentClientInfo->pkgId;
}
return nullString;
if (__pCurrentClientInfo)
{
- String appName;
- __pCurrentClientInfo->appId.SubString(11, appName);
-
- return appName;
+ return __pCurrentClientInfo->appExecutableName;
}
return nullString;
if (__pCurrentClientInfo)
{
- String pkgId;
- __pCurrentClientInfo->appId.SubString(0, 10, pkgId);
-
- return pkgId;
+ return __pCurrentClientInfo->pkgId;
}
return nullString;
if (__pCurrentClientInfo)
{
- return __pCurrentClientInfo->appId;
+ String appId(__pCurrentClientInfo->pkgId);
+ appId.Append(L'.');
+ appId.Append(__pCurrentClientInfo->appExecutableName);
+
+ return appId;
}
return nullString;
batteryLevel = BATTERY_CRITICAL;
break;
case VCONFKEY_SYSMAN_BAT_LEVEL_LOW:
- batteryLevel = BATTERY_EMPTY;
+ batteryLevel = BATTERY_LOW;
break;
case VCONFKEY_SYSMAN_BAT_LEVEL_HIGH:
- batteryLevel = BATTERY_EMPTY;
+ batteryLevel = BATTERY_HIGH;
break;
case VCONFKEY_SYSMAN_BAT_LEVEL_FULL:
- batteryLevel = BATTERY_EMPTY;
+ batteryLevel = BATTERY_FULL;
break;
default:
SysLogException(NID_SYS, E_SYSTEM, "Unavailable battery level is required.");