2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file FSysRuntimeInfo.cpp
19 * @brief This is the implementation file for _RuntimeInfoImpl class.
22 * This file contains the implementation of _RuntimeInfoImpl class.
25 #include <unique_ptr.h>
32 #include <app_storage.h>
34 #include <runtime_info.h>
39 #include <FBaseRtEvent.h>
40 #include <FBaseRtIEventArg.h>
41 #include <FBaseRtIEventListener.h>
42 #include <FBaseRtThread.h>
43 #include <FBaseSysLog.h>
44 #include <FApp_AppInfo.h>
45 #include <FBase_StringConverter.h>
47 #include "FSys_EnvironmentImpl.h"
48 #include "FSys_RuntimeInfoImpl.h"
49 #include "FSys_RuntimeClient.h"
50 #include "FSys_RuntimeClientEx.h"
52 using namespace Tizen::App;
53 using namespace Tizen::Base;
54 using namespace Tizen::Base::Runtime;
58 namespace Tizen { namespace System
61 #ifndef VCONFKEY_SERVICE_READY
62 #define VCONFKEY_SERVICE_READY "memory/deviced/boot_power_on"
65 static const wchar_t* _ALLOCATED_MEMORY = L"AllocatedMemory";
66 static const wchar_t* _MEMORY_ALLOCATED = L"http://tizen.org/runtime/memory.allocated";
67 static const wchar_t* _MEMORY_ALLOCATED_SELF = L"http://tizen.org/runtime/memory.allocated.self";
69 static const wchar_t* _AVAILABLE_EXTERNAL_STORAGE = L"AvailableExternalStorage";
70 static const wchar_t* _STORAGE_AVAILABLE_EXTERNAL = L"http://tizen.org/runtime/storage.available.external";
72 static const wchar_t* _AVAILABLE_INTERNAL_STORAGE = L"AvailableInternalStorage";
73 static const wchar_t* _STORAGE_AVAILABLE_INTERNAL = L"http://tizen.org/runtime/storage.available.internal";
75 static const wchar_t* _AVAILABLE_MEDIA_STORAGE = L"AvailableMediaStorage";
76 static const wchar_t* _STORAGE_AVAILABLE_INTERNAL_MEDIA = L"http://tizen.org/runtime/storage.available.internal.media";
78 static const wchar_t* _BATTERY_LEVEL = L"BatteryLevel";
79 static const wchar_t* _CHARGING = L"IsCharging";
81 static const wchar_t* _CPU_CORE_ALL_USAGE = L"http://tizen.org/runtime/cpu.core.all.usage";
83 static const wchar_t* _MAX_ALLOCATABLE_MEMORY = L"MaxAllocatableMemory";
84 static const wchar_t* _AVAILABLE_VIDEO_MEMORY = L"AvailableVideoMemory";
85 static const wchar_t* _ALLOCATED_VIDEO_MEMORY = L"AllocatedVideoMemory";
86 static const wchar_t* _AVAILABLE_MEMORY = L"AvailableMemory";
87 static const wchar_t* _MEMORY_AVAILABLE = L"http://tizen.org/runtime/memory.available";
88 static const wchar_t* _MEMORY_AVAILABLE_VIDEO = L"http://tizen.org/runtime/memory.available.video";
89 static const wchar_t* _MEMORY_ALLOCATED_VIDEO = L"http://tizen.org/runtime/memory.allocated.video";
91 static const wchar_t* _STORAGE_ALLOCATED_INTERNAL_APPLICATION = L"http://tizen.org/runtime/storage.allocated.internal.application";
92 static const wchar_t* _STORAGE_ALLOCATED_INTERNAL_AUDIO = L"http://tizen.org/runtime/storage.allocated.internal.audio";
93 static const wchar_t* _STORAGE_ALLOCATED_INTERNAL_VIDEO = L"http://tizen.org/runtime/storage.allocated.internal.video";
94 static const wchar_t* _STORAGE_ALLOCATED_INTERNAL_IMAGE = L"http://tizen.org/runtime/storage.allocated.internal.image";
95 static const wchar_t* _STORAGE_ALLOCATED_INTERNAL_DOWNLOAD = L"http://tizen.org/runtime/storage.allocated.internal.download";
96 static const wchar_t* _STORAGE_ALLOCATED_EXTERNAL_APPLICATION = L"http://tizen.org/runtime/storage.allocated.external.application";
97 static const wchar_t* _STORAGE_ALLOCATED_EXTERNAL_AUDIO = L"http://tizen.org/runtime/storage.allocated.external.audio";
98 static const wchar_t* _STORAGE_ALLOCATED_EXTERNAL_VIDEO = L"http://tizen.org/runtime/storage.allocated.external.video";
99 static const wchar_t* _STORAGE_ALLOCATED_EXTERNAL_IMAGE = L"http://tizen.org/runtime/storage.allocated.external.image";
100 static const wchar_t* _STORAGE_ALLOCATED_EXTERNAL_DOWNLOAD = L"http://tizen.org/runtime/storage.allocated.external.download";
102 static const wchar_t _BOOT_STATUS_KEY[] = L"http://tizen.org/runtime/system.status";
103 static const wchar_t _BOOT_STATUS_INITIALIZING[] = L"initializing";
104 static const wchar_t _BOOT_STATUS_READY[] = L"ready";
107 static const int _RUNTIME_INFO_EVENT_TYPE_INT = 101;
108 static const int _RUNTIME_INFO_EVENT_TYPE_LONGLONG = 102;
111 static const char* const _PROC_SYSTEM_MEMORY_INFO = "/proc/meminfo";
112 static const char* const _PROC_PROCESS_MEMORY_INFO = "/proc/self/status";
113 static const char* const _PROC_STAT = "/proc/stat";
115 static const char* const _PROC_KEY_SYSTEM_MEMORY_TOTAL = "MemTotal";
116 static const char* const _PROC_KEY_SYSTEM_MEMORY_FREE = "MemFree";
117 static const char* const _PROC_KEY_PROCESS_MEMORY = "VmSize";
119 static const char* const _ROOT_PATH = "/";
121 static const int _MAX_BUFFER_LENGTH = 1024;
123 static const int _CPU_USAGE_EVALUATION_INTERVAL = 1000000; //1 sec
127 unsigned long long user;
128 unsigned long long system;
129 unsigned long long nice;
130 unsigned long long idle;
131 unsigned long long wait;
132 unsigned long long hi;
133 unsigned long long si;
134 unsigned long long zero;
137 bool read_proc_stat(procstat_t *p)
142 fp = fopen(_PROC_STAT, "r");
148 ret = fscanf(fp, "%s %llu %llu %llu %llu %llu %llu %llu %llu",
176 void diff_proc_stat(procstat_t *a, procstat_t *b, procstat_t *d)
178 d->user = a->user - b->user;
179 d->system = a->system - b->system;
180 d->nice = a->nice - b->nice;
181 d->idle = a->idle - b->idle;
182 d->wait = a->wait - b->wait;
183 d->hi = a->hi - b->hi;
184 d->si = a->si - b->si;
185 d->zero = a->zero - b->zero;
188 class _RuntimeInfoEventArg : public IEventArg
191 _RuntimeInfoEventArg()
195 , errorCode(E_SUCCESS)
196 , DirectoryPath(null)
201 ~_RuntimeInfoEventArg()
203 if(DirectoryPath != null)
205 delete [] DirectoryPath;
211 long long longLongValue;
214 IEventListener* pListener;
217 class _RuntimeInfoEvent : public Event
220 void FireImpl(IEventListener& listener, const IEventArg& arg)
222 const _RuntimeInfoEventArg* runtimeArg = dynamic_cast<const _RuntimeInfoEventArg*> (&arg);
224 if(runtimeArg == null)
226 SysLogException(NID_SYS, E_SYSTEM, "Argument is null.");
230 switch(runtimeArg->Type)
232 case _RUNTIME_INFO_EVENT_TYPE_INT:
234 IRuntimeInfoGetIntAsyncResultListener* pIntListener = dynamic_cast<IRuntimeInfoGetIntAsyncResultListener*>(&listener);
236 if(pIntListener == runtimeArg->pListener)
238 pIntListener->OnResultReceivedForGetValueAsync(runtimeArg->intValue, runtimeArg->errorCode);
239 RemoveListener(listener);
243 case _RUNTIME_INFO_EVENT_TYPE_LONGLONG:
245 IRuntimeInfoGetLonglongAsyncResultListener* pLonglongListener = dynamic_cast<IRuntimeInfoGetLonglongAsyncResultListener*>(&listener);
246 if(pLonglongListener == runtimeArg->pListener)
248 pLonglongListener->OnResultReceivedForGetValueAsync(runtimeArg->longLongValue, runtimeArg->errorCode);
249 RemoveListener(listener);
257 _RuntimeInfoEvent runtimeInfoEvent;
259 _RuntimeInfoImpl::_RuntimeInfoImpl(void)
263 _RuntimeInfoImpl::~_RuntimeInfoImpl(void)
268 _RuntimeInfoImpl::GetValue(const String& key, String& value)
270 if (key == _BOOT_STATUS_KEY)
273 const int errorCode = vconf_get_int(VCONFKEY_SERVICE_READY, &bootReady);
276 value = (bootReady == 1 ) ? _BOOT_STATUS_READY : _BOOT_STATUS_INITIALIZING;
285 return E_OBJ_NOT_FOUND;
290 _RuntimeInfoImpl::GetValue(const String& key, int& value)
294 result r = E_OBJ_NOT_FOUND;
296 if (key == _BATTERY_LEVEL)
298 return GetBatteryLevel(value);
300 else if (key == _ALLOCATED_MEMORY || key == _ALLOCATED_VIDEO_MEMORY)
302 r = GetFromProc(_PROC_PROCESS_MEMORY_INFO, _PROC_KEY_PROCESS_MEMORY, free_size);
303 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to get memory size.");
304 value = free_size * 1024;
306 else if (key == _AVAILABLE_MEMORY || key == _AVAILABLE_VIDEO_MEMORY || key == _MAX_ALLOCATABLE_MEMORY)
308 r = GetFromProc(_PROC_SYSTEM_MEMORY_INFO, _PROC_KEY_SYSTEM_MEMORY_FREE, free_size);
309 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to get memory size.");
310 value = free_size * 1024;
316 _RuntimeInfoImpl::GetValue(const String& key, long long& value)
319 long long total_size = 0;
320 long long free_size =0;
321 result r = E_OBJ_NOT_FOUND;
323 if (key == _MEMORY_AVAILABLE || key == _MEMORY_AVAILABLE_VIDEO)
325 r = GetFromProcLonglong(_PROC_SYSTEM_MEMORY_INFO, _PROC_KEY_SYSTEM_MEMORY_FREE, free_size);
326 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to get memory size.");
327 value = free_size * 1024;
329 else if (key == _MEMORY_ALLOCATED || key == _MEMORY_ALLOCATED_VIDEO)
331 r = GetFromProcLonglong(_PROC_SYSTEM_MEMORY_INFO, _PROC_KEY_SYSTEM_MEMORY_TOTAL, total_size);
332 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to get memory size.");
333 r = GetFromProcLonglong(_PROC_SYSTEM_MEMORY_INFO, _PROC_KEY_SYSTEM_MEMORY_FREE, free_size);
334 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to get memory size.");
335 value = (total_size - free_size) * 1024;
337 else if (key == _MEMORY_ALLOCATED_SELF)
339 r = GetFromProcLonglong(_PROC_PROCESS_MEMORY_INFO, _PROC_KEY_PROCESS_MEMORY, free_size);
340 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to get memory size.");
341 value = free_size * 1024;
343 else if (key == _AVAILABLE_INTERNAL_STORAGE)
345 return GetAvailableInternalStorage(value);
347 else if (key == _AVAILABLE_EXTERNAL_STORAGE)
349 return GetAvailableExternalStorage(value);
351 else if (key == _AVAILABLE_MEDIA_STORAGE)
353 return GetAvailableMediaStorage(value);
355 else if(key == _STORAGE_AVAILABLE_INTERNAL)
357 return GetAvailableInternalStorage(value);
359 else if(key == _STORAGE_AVAILABLE_EXTERNAL)
361 return GetAvailableExternalStorage(value);
363 else if(key == _STORAGE_AVAILABLE_INTERNAL_MEDIA)
365 return GetAvailableMediaStorage(value);
369 SysLogException(NID_SYS, r, "Key[%ls] is not valid.", key.GetPointer());
375 _RuntimeInfoImpl::GetDirectorySize(const char* path)
382 char command[512] = {0,};
383 char fileName[512] = {0,};
387 Tizen::App::App* pApp = Tizen::App::App::GetInstance();
393 String appId(pApp->GetAppId());
394 unique_ptr <char> appIdPath(_StringConverter::CopyToCharArrayN(appId));
396 ret = sprintf(fileName, "/tmp/size_of_directory_%s.tmp", appIdPath.get());
399 SysLogException(NID_SYS, E_SYSTEM, "It is failed to write file path.");
403 ret = sprintf(command, "rm -rf %s", fileName);
406 SysLogException(NID_SYS, E_SYSTEM, "It is failed to write remove command.");
410 ret = system(command);
414 SysLogException(NID_SYS, E_SYSTEM, "It is failed to execute command[%s].", command);
417 ret = sprintf(command, "du -skb -P %s >> %s", path, fileName);
420 SysLogException(NID_SYS, E_SYSTEM, "It is failed to write du command.");
424 ret = system(command);
427 SysLogException(NID_SYS, E_SYSTEM, "It is failed to execute command[%s].", command);
432 pFile = fopen(fileName, "r");
438 ret = fscanf(pFile, "%lld", &size);
454 ret = sprintf(command, "rm -rf %s", fileName);
457 SysLogException(NID_SYS, E_SYSTEM, "It is failed to write remove command.");
461 ret = system(command);
464 SysLogException(NID_SYS, E_SYSTEM, "It is failed to execute command[%s].", command);
472 _RuntimeInfoImpl::GetValue(const String& key, double& value)
474 return E_OBJ_NOT_FOUND;
478 _RuntimeInfoImpl::GetValue(const String& key, bool& value)
480 if (key == _CHARGING)
482 return IsChargingMode(value);
486 return E_OBJ_NOT_FOUND;
491 _RuntimeInfoImpl::GetValue(const String& key, UuId& value)
493 return E_OBJ_NOT_FOUND;
497 _RuntimeInfoImpl::GetBatteryLevel(int& value)
499 int batteryValue = -1;
500 batteryValue = device_get_battery_pct();
501 SysTryReturnResult(NID_SYS, !(batteryValue < 0 || value > 100), E_SYSTEM, "[E_SYSTEM] device_get_battery_pct return %d", batteryValue);
502 value = batteryValue;
508 _RuntimeInfoImpl::IsChargingMode(bool& value)
510 bool chargeState = false;
512 ret = runtime_info_get_value_bool(RUNTIME_INFO_KEY_BATTERY_IS_CHARGING, &chargeState);
513 SysTryReturnResult(NID_SYS, ret == 0, E_SYSTEM, "[E_SYSTEM] runtime_info_get_value_bool returns %d.", ret);
520 _RuntimeInfoImpl::GetAvailableInternalStorage(long long& value)
523 result r = E_SUCCESS;
525 r = GetCapacity(_ROOT_PATH, total, value);
526 SysTryReturn(NID_SYS, !IsFailed(r), E_SYSTEM, r, "[E_SYSTEM] system error has occurred. ");
531 _RuntimeInfoImpl::GetAvailableExternalStorage(long long& value)
533 int sdCardStatus = 0;
537 ret = vconf_get_int(VCONFKEY_SYSMAN_MMC_STATUS, &sdCardStatus);
538 SysTryReturn(NID_SYS, !(ret < 0), E_SYSTEM, E_SYSTEM, "[E_SYSTEM] vconf_get_int VCONFKEY_SYSMAN_MMC_STATUS failed");
540 if(sdCardStatus == 0)
545 char* directoryPath = _StringConverter::CopyToCharArrayN(_EnvironmentImpl::GetExternalStoragePath());
546 SysTryReturnResult(NID_SYS, directoryPath != null, E_SYSTEM, "It is failed to get external directory path.");
547 result r = GetCapacity(directoryPath, total, value);
548 delete [] directoryPath;
553 _RuntimeInfoImpl::GetAvailableMediaStorage(long long& value)
557 char* directoryPath = _StringConverter::CopyToCharArrayN(_EnvironmentImpl::GetMediaPath());
558 SysTryReturnResult(NID_SYS, directoryPath != null, E_SYSTEM, "It is failed to get media directory path.");
559 result r = GetCapacity(directoryPath, total, value);
560 delete [] directoryPath;
565 _RuntimeInfoImpl::GetCapacity(const char* path, long long& totalSize, long long& availableSize)
568 if (statfs(path, &fs) < 0)
570 SysLogException(NID_SYS, E_SYSTEM, "[E_SYSTEM] statfs() failed");
574 totalSize = static_cast< long long >(fs.f_bsize) * static_cast< long long >(fs.f_blocks);
575 availableSize = static_cast< long long >(fs.f_bsize) * static_cast< long long >(fs.f_bavail);
581 _RuntimeInfoImpl::GetFromProcLonglong(const char* path, const char* key, long long& value)
583 FILE* pStream = null;
584 char line[_MAX_BUFFER_LENGTH] = {0, };
585 char fieldName[_MAX_BUFFER_LENGTH] = {0, };
586 long long keyValue = 0;
587 pStream = fopen(path, "r");
588 SysTryReturnResult(NID_SYS, pStream != null, E_SYSTEM, "%s open is failed.", path);
590 while (fgets(line, sizeof(line), pStream))
592 if (sscanf(line, "%s %lld %*s", fieldName, &keyValue) == 2)
594 if (strncmp(fieldName, key, static_cast< int >(strlen(key))) == 0)
604 SysLogException(NID_SYS, E_OBJ_NOT_FOUND, "it can't find %s field", key);
605 return E_OBJ_NOT_FOUND;
609 _RuntimeInfoImpl::GetFromProc(const char* path, const char* key, int& value)
611 FILE* pStream = null;
612 char line[_MAX_BUFFER_LENGTH] = {0, };
613 char fieldName[_MAX_BUFFER_LENGTH] = {0, };
615 pStream = fopen(path, "r");
616 SysTryReturnResult(NID_SYS, pStream != null, E_SYSTEM, "%s open is failed.", path);
618 while (fgets(line, sizeof(line), pStream))
620 if (sscanf(line, "%s %d %*s", fieldName, &keyValue) == 2)
622 if (strncmp(fieldName, key, static_cast< int >(strlen(key))) == 0)
632 SysLogException(NID_SYS, E_OBJ_NOT_FOUND, "it can't find %s field", key);
633 return E_OBJ_NOT_FOUND;
637 _RuntimeInfoImpl::GetDirectorySizeAsync(void* data)
643 _RuntimeInfoEventArg* pEventArg = (_RuntimeInfoEventArg*)data;
644 long long size = _RuntimeInfoImpl::GetDirectorySize(pEventArg->DirectoryPath);
646 if(pEventArg == null)
648 SysLogException(NID_SYS, E_OUT_OF_MEMORY, "It is failed to create instance of _RuntimeInfoEventArg");
651 pEventArg->Type = _RUNTIME_INFO_EVENT_TYPE_LONGLONG;
652 pEventArg->longLongValue = size;
653 SysLog(NID_SYS, "Fire event %x %s %lld", pEventArg, pEventArg->DirectoryPath, size);
654 runtimeInfoEvent.Fire(*pEventArg);
660 _RuntimeInfoImpl::GetCpuUsageAsync(void* data)
662 result r = E_SUCCESS;
665 procstat_t first, second, diffrence;
666 unsigned long long total, usage;
668 if(read_proc_stat(&first) != false)
670 usleep(_CPU_USAGE_EVALUATION_INTERVAL);
671 if(read_proc_stat(&second) != false)
673 diff_proc_stat(&second, &first, &diffrence);
674 total = diffrence.user + diffrence.system
675 + diffrence.nice + diffrence.idle
676 + diffrence.wait + diffrence.hi
678 usage = 10000 - (diffrence.idle * 10000 / total);
692 _RuntimeInfoEventArg* pEventArg = (_RuntimeInfoEventArg*) data;
693 if(pEventArg == null)
695 SysLogException(NID_SYS, E_OUT_OF_MEMORY, "It is failed to create instance of _RuntimeInfoEventArg");
698 pEventArg->errorCode = r;
699 pEventArg->Type = _RUNTIME_INFO_EVENT_TYPE_INT;
700 pEventArg->intValue = value;
702 runtimeInfoEvent.Fire(*pEventArg);
708 _RuntimeInfoImpl::GetValueAsync(const String& key, IRuntimeInfoGetIntAsyncResultListener* listener)
710 result r = E_SUCCESS;
712 SysTryReturnResult(NID_SYS, listener != null, E_INVALID_ARG, "listener is null");
714 if (key == _CPU_CORE_ALL_USAGE)
718 runtimeInfoEvent.AddListener(*listener);
723 _RuntimeInfoEventArg* pEventArg = new (std::nothrow) _RuntimeInfoEventArg();
724 pEventArg->pListener = listener;
725 thr_id = pthread_create(&p_thread, null, GetCpuUsageAsync, pEventArg);
726 pthread_detach(p_thread);
730 SysLogException(NID_SYS, E_INVALID_ARG, "Required key[%ls] is not valid", key.GetPointer());
737 _RuntimeInfoImpl::GetValueAsync(const String& key, IRuntimeInfoGetLonglongAsyncResultListener* listener)
741 result r = E_SUCCESS;
742 String directoryPath;
744 SysTryReturnResult(NID_SYS, listener != null, E_INVALID_ARG, "listener is null");
746 if(key == _STORAGE_ALLOCATED_INTERNAL_APPLICATION)
748 directoryPath.Append(_EnvironmentImpl::GetPredefinedPath(PREDEFINED_DIRECTORY_APPLICATIONS));
750 else if (key == _STORAGE_ALLOCATED_INTERNAL_AUDIO)
752 directoryPath.Append(_EnvironmentImpl::GetPredefinedPath(PREDEFINED_DIRECTORY_SOUNDS));
754 else if (key == _STORAGE_ALLOCATED_INTERNAL_VIDEO)
756 directoryPath.Append(_EnvironmentImpl::GetPredefinedPath(PREDEFINED_DIRECTORY_VIDEOS));
758 else if (key == _STORAGE_ALLOCATED_INTERNAL_IMAGE)
760 directoryPath.Append(_EnvironmentImpl::GetPredefinedPath(PREDEFINED_DIRECTORY_IMAGES));
762 else if (key == _STORAGE_ALLOCATED_INTERNAL_DOWNLOAD)
764 directoryPath.Append(_EnvironmentImpl::GetPredefinedPath(PREDEFINED_DIRECTORY_DOWNLOADS));
766 else if (key == _STORAGE_ALLOCATED_EXTERNAL_APPLICATION)
768 directoryPath.Append(_EnvironmentImpl::GetPredefinedPath(PREDEFINED_DIRECTORY_EXTERNAL_APPLICATIONS));
770 else if (key == _STORAGE_ALLOCATED_EXTERNAL_AUDIO)
772 directoryPath.Append(_EnvironmentImpl::GetPredefinedPath(PREDEFINED_DIRECTORY_EXTERNAL_SOUNDS));
774 else if (key == _STORAGE_ALLOCATED_EXTERNAL_VIDEO)
776 directoryPath.Append(_EnvironmentImpl::GetPredefinedPath(PREDEFINED_DIRECTORY_EXTERNAL_VIDEOS));
778 else if (key == _STORAGE_ALLOCATED_EXTERNAL_IMAGE)
780 directoryPath.Append(_EnvironmentImpl::GetPredefinedPath(PREDEFINED_DIRECTORY_EXTERNAL_IMAGES));
782 else if (key == _STORAGE_ALLOCATED_EXTERNAL_DOWNLOAD)
784 directoryPath.Append(_EnvironmentImpl::GetPredefinedPath(PREDEFINED_DIRECTORY_EXTERNAL_DOWNLOADS));
788 SysLogException(NID_SYS, E_INVALID_ARG, "Required key[%ls] is not valid", key.GetPointer());
792 SysLog(NID_SYS, "%s", GetErrorMessage(r));
793 SysLog(NID_SYS, "%ls", directoryPath.GetPointer());
796 // if(Tizen::Io::File::IsFileExist(L"/opt/usr/etc/common_service_for_runtime") == true)
798 SysLog(NID_SYS, "Runtime is serviced by common-service.");
799 _RuntimeClientEx* pRuntimeClientEx = _RuntimeClientEx::GetInstance();
800 pRuntimeClientEx->GetDirectorySizeValueAsync(directoryPath, listener);
804 SysLog(NID_SYS, "Runtime is serviced by app-service.");
805 _RuntimeClient* pRuntimeClient = _RuntimeClient::GetInstance();
806 pRuntimeClient->GetDirectorySizeValueAsync(directoryPath, listener);
815 _RuntimeInfoImpl::GetInstance(RuntimeInfo& runtimeinfo)
817 return runtimeinfo.__pRuntimeInfoImpl;
820 const _RuntimeInfoImpl*
821 _RuntimeInfoImpl::GetInstance(const RuntimeInfo& runtimeinfo)
823 return runtimeinfo.__pRuntimeInfoImpl;