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>
38 #include <FBaseRtEvent.h>
39 #include <FBaseRtIEventArg.h>
40 #include <FBaseRtIEventListener.h>
41 #include <FBaseRtThread.h>
42 #include <FBaseSysLog.h>
43 #include <FApp_AppInfo.h>
44 #include <FBase_StringConverter.h>
46 #include "FSys_EnvironmentImpl.h"
47 #include "FSys_RuntimeInfoImpl.h"
48 #include "FSys_RuntimeClient.h"
50 using namespace Tizen::App;
51 using namespace Tizen::Base;
52 using namespace Tizen::Base::Runtime;
56 namespace Tizen { namespace System
59 #ifndef VCONFKEY_SERVICE_READY
60 #define VCONFKEY_SERVICE_READY "memory/appservice/serviceready"
63 static const wchar_t* _ALLOCATED_MEMORY = L"AllocatedMemory";
64 static const wchar_t* _MEMORY_ALLOCATED = L"http://tizen.org/runtime/memory.allocated";
65 static const wchar_t* _MEMORY_ALLOCATED_SELF = L"http://tizen.org/runtime/memory.allocated.self";
67 static const wchar_t* _AVAILABLE_EXTERNAL_STORAGE = L"AvailableExternalStorage";
68 static const wchar_t* _STORAGE_AVAILABLE_EXTERNAL = L"http://tizen.org/runtime/storage.available.external";
70 static const wchar_t* _AVAILABLE_INTERNAL_STORAGE = L"AvailableInternalStorage";
71 static const wchar_t* _STORAGE_AVAILABLE_INTERNAL = L"http://tizen.org/runtime/storage.available.internal";
73 static const wchar_t* _AVAILABLE_MEDIA_STORAGE = L"AvailableMediaStorage";
74 static const wchar_t* _STORAGE_AVAILABLE_INTERNAL_MEDIA = L"http://tizen.org/runtime/storage.available.internal.media";
76 static const wchar_t* _BATTERY_LEVEL = L"BatteryLevel";
77 static const wchar_t* _CHARGING = L"IsCharging";
79 static const wchar_t* _CPU_CORE_ALL_USAGE = L"http://tizen.org/runtime/cpu.core.all.usage";
81 static const wchar_t* _MAX_ALLOCATABLE_MEMORY = L"MaxAllocatableMemory";
82 static const wchar_t* _AVAILABLE_VIDEO_MEMORY = L"AvailableVideoMemory";
83 static const wchar_t* _ALLOCATED_VIDEO_MEMORY = L"AllocatedVideoMemory";
84 static const wchar_t* _AVAILABLE_MEMORY = L"AvailableMemory";
85 static const wchar_t* _MEMORY_AVAILABLE = L"http://tizen.org/runtime/memory.available";
86 static const wchar_t* _MEMORY_AVAILABLE_VIDEO = L"http://tizen.org/runtime/memory.available.video";
87 static const wchar_t* _MEMORY_ALLOCATED_VIDEO = L"http://tizen.org/runtime/memory.allocated.video";
89 static const wchar_t* _STORAGE_ALLOCATED_INTERNAL_APPLICATION = L"http://tizen.org/runtime/storage.allocated.internal.application";
90 static const wchar_t* _STORAGE_ALLOCATED_INTERNAL_AUDIO = L"http://tizen.org/runtime/storage.allocated.internal.audio";
91 static const wchar_t* _STORAGE_ALLOCATED_INTERNAL_VIDEO = L"http://tizen.org/runtime/storage.allocated.internal.video";
92 static const wchar_t* _STORAGE_ALLOCATED_INTERNAL_IMAGE = L"http://tizen.org/runtime/storage.allocated.internal.image";
93 static const wchar_t* _STORAGE_ALLOCATED_INTERNAL_DOWNLOAD = L"http://tizen.org/runtime/storage.allocated.internal.download";
94 static const wchar_t* _STORAGE_ALLOCATED_EXTERNAL_APPLICATION = L"http://tizen.org/runtime/storage.allocated.external.application";
95 static const wchar_t* _STORAGE_ALLOCATED_EXTERNAL_AUDIO = L"http://tizen.org/runtime/storage.allocated.external.audio";
96 static const wchar_t* _STORAGE_ALLOCATED_EXTERNAL_VIDEO = L"http://tizen.org/runtime/storage.allocated.external.video";
97 static const wchar_t* _STORAGE_ALLOCATED_EXTERNAL_IMAGE = L"http://tizen.org/runtime/storage.allocated.external.image";
98 static const wchar_t* _STORAGE_ALLOCATED_EXTERNAL_DOWNLOAD = L"http://tizen.org/runtime/storage.allocated.external.download";
100 static const wchar_t _BOOT_STATUS_KEY[] = L"http://tizen.org/runtime/system.status";
101 static const wchar_t _BOOT_STATUS_INITIALIZING[] = L"initializing";
102 static const wchar_t _BOOT_STATUS_READY[] = L"ready";
105 static const int _RUNTIME_INFO_EVENT_TYPE_INT = 101;
106 static const int _RUNTIME_INFO_EVENT_TYPE_LONGLONG = 102;
109 static const char* const _PROC_SYSTEM_MEMORY_INFO = "/proc/meminfo";
110 static const char* const _PROC_PROCESS_MEMORY_INFO = "/proc/self/status";
111 static const char* const _PROC_STAT = "/proc/stat";
113 static const char* const _PROC_KEY_SYSTEM_MEMORY_TOTAL = "MemTotal";
114 static const char* const _PROC_KEY_SYSTEM_MEMORY_FREE = "MemFree";
115 static const char* const _PROC_KEY_PROCESS_MEMORY = "VmSize";
117 static const char* const _ROOT_PATH = "/";
119 static const int _MAX_BUFFER_LENGTH = 1024;
121 static const int _CPU_USAGE_EVALUATION_INTERVAL = 1000000; //1 sec
125 unsigned long long user;
126 unsigned long long system;
127 unsigned long long nice;
128 unsigned long long idle;
129 unsigned long long wait;
130 unsigned long long hi;
131 unsigned long long si;
132 unsigned long long zero;
135 bool read_proc_stat(procstat_t *p)
140 fp = fopen(_PROC_STAT, "r");
146 ret = fscanf(fp, "%s %llu %llu %llu %llu %llu %llu %llu %llu",
174 void diff_proc_stat(procstat_t *a, procstat_t *b, procstat_t *d)
176 d->user = a->user - b->user;
177 d->system = a->system - b->system;
178 d->nice = a->nice - b->nice;
179 d->idle = a->idle - b->idle;
180 d->wait = a->wait - b->wait;
181 d->hi = a->hi - b->hi;
182 d->si = a->si - b->si;
183 d->zero = a->zero - b->zero;
186 class _RuntimeInfoEventArg : public IEventArg
189 _RuntimeInfoEventArg()
193 , errorCode(E_SUCCESS)
194 , DirectoryPath(null)
199 ~_RuntimeInfoEventArg()
201 if(DirectoryPath != null)
203 delete [] DirectoryPath;
209 long long longLongValue;
212 IEventListener* pListener;
215 class _RuntimeInfoEvent : public Event
218 void FireImpl(IEventListener& listener, const IEventArg& arg)
220 const _RuntimeInfoEventArg* runtimeArg = dynamic_cast<const _RuntimeInfoEventArg*> (&arg);
222 if(runtimeArg == null)
224 SysLogException(NID_SYS, E_SYSTEM, "Argument is null.");
228 switch(runtimeArg->Type)
230 case _RUNTIME_INFO_EVENT_TYPE_INT:
232 IRuntimeInfoGetIntAsyncResultListener* pIntListener = dynamic_cast<IRuntimeInfoGetIntAsyncResultListener*>(&listener);
234 if(pIntListener == runtimeArg->pListener)
236 pIntListener->OnResultReceivedForGetValueAsync(runtimeArg->intValue, runtimeArg->errorCode);
237 RemoveListener(listener);
241 case _RUNTIME_INFO_EVENT_TYPE_LONGLONG:
243 IRuntimeInfoGetLonglongAsyncResultListener* pLonglongListener = dynamic_cast<IRuntimeInfoGetLonglongAsyncResultListener*>(&listener);
244 if(pLonglongListener == runtimeArg->pListener)
246 pLonglongListener->OnResultReceivedForGetValueAsync(runtimeArg->longLongValue, runtimeArg->errorCode);
247 RemoveListener(listener);
255 _RuntimeInfoEvent runtimeInfoEvent;
257 _RuntimeInfoImpl::_RuntimeInfoImpl(void)
261 _RuntimeInfoImpl::~_RuntimeInfoImpl(void)
266 _RuntimeInfoImpl::GetValue(const String& key, String& value)
268 if (key == _BOOT_STATUS_KEY)
271 const int errorCode = vconf_get_int(VCONFKEY_SERVICE_READY, &bootReady);
274 value = (bootReady == 1 ) ? _BOOT_STATUS_READY : _BOOT_STATUS_INITIALIZING;
283 return E_OBJ_NOT_FOUND;
288 _RuntimeInfoImpl::GetValue(const String& key, int& value)
292 result r = E_OBJ_NOT_FOUND;
294 if (key == _BATTERY_LEVEL)
296 return GetBatteryLevel(value);
298 else if (key == _ALLOCATED_MEMORY || key == _ALLOCATED_VIDEO_MEMORY)
300 r = GetFromProc(_PROC_PROCESS_MEMORY_INFO, _PROC_KEY_PROCESS_MEMORY, free_size);
301 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to get memory size.");
302 value = free_size * 1024;
304 else if (key == _AVAILABLE_MEMORY || key == _AVAILABLE_VIDEO_MEMORY || key == _MAX_ALLOCATABLE_MEMORY)
306 r = GetFromProc(_PROC_SYSTEM_MEMORY_INFO, _PROC_KEY_SYSTEM_MEMORY_FREE, free_size);
307 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to get memory size.");
308 value = free_size * 1024;
314 _RuntimeInfoImpl::GetValue(const String& key, long long& value)
317 long long total_size = 0;
318 long long free_size =0;
319 result r = E_OBJ_NOT_FOUND;
321 if (key == _MEMORY_AVAILABLE || key == _MEMORY_AVAILABLE_VIDEO)
323 r = GetFromProcLonglong(_PROC_SYSTEM_MEMORY_INFO, _PROC_KEY_SYSTEM_MEMORY_FREE, free_size);
324 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to get memory size.");
325 value = free_size * 1024;
327 else if (key == _MEMORY_ALLOCATED || key == _MEMORY_ALLOCATED_VIDEO)
329 r = GetFromProcLonglong(_PROC_SYSTEM_MEMORY_INFO, _PROC_KEY_SYSTEM_MEMORY_TOTAL, total_size);
330 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to get memory size.");
331 r = GetFromProcLonglong(_PROC_SYSTEM_MEMORY_INFO, _PROC_KEY_SYSTEM_MEMORY_FREE, free_size);
332 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to get memory size.");
333 value = (total_size - free_size) * 1024;
335 else if (key == _MEMORY_ALLOCATED_SELF)
337 r = GetFromProcLonglong(_PROC_PROCESS_MEMORY_INFO, _PROC_KEY_PROCESS_MEMORY, free_size);
338 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to get memory size.");
339 value = free_size * 1024;
341 else if (key == _AVAILABLE_INTERNAL_STORAGE)
343 return GetAvailableInternalStorage(value);
345 else if (key == _AVAILABLE_EXTERNAL_STORAGE)
347 return GetAvailableExternalStorage(value);
349 else if (key == _AVAILABLE_MEDIA_STORAGE)
351 return GetAvailableMediaStorage(value);
353 else if(key == _STORAGE_AVAILABLE_INTERNAL)
355 return GetAvailableInternalStorage(value);
357 else if(key == _STORAGE_AVAILABLE_EXTERNAL)
359 return GetAvailableExternalStorage(value);
361 else if(key == _STORAGE_AVAILABLE_INTERNAL_MEDIA)
363 return GetAvailableMediaStorage(value);
367 SysLogException(NID_SYS, r, "Key[%ls] is not valid.", key.GetPointer());
373 _RuntimeInfoImpl::GetDirectorySize(const char* path)
380 char command[512] = {0,};
381 char fileName[512] = {0,};
385 Tizen::App::App* pApp = Tizen::App::App::GetInstance();
391 String appId(pApp->GetAppId());
392 unique_ptr <char> appIdPath(_StringConverter::CopyToCharArrayN(appId));
394 ret = sprintf(fileName, "/tmp/size_of_directory_%s.tmp", appIdPath.get());
397 SysLogException(NID_SYS, E_SYSTEM, "It is failed to write file path.");
401 ret = sprintf(command, "rm -rf %s", fileName);
404 SysLogException(NID_SYS, E_SYSTEM, "It is failed to write remove command.");
408 ret = system(command);
412 SysLogException(NID_SYS, E_SYSTEM, "It is failed to execute command[%s].", command);
415 ret = sprintf(command, "du -skb -P %s >> %s", path, fileName);
418 SysLogException(NID_SYS, E_SYSTEM, "It is failed to write du command.");
422 ret = system(command);
425 SysLogException(NID_SYS, E_SYSTEM, "It is failed to execute command[%s].", command);
430 pFile = fopen(fileName, "r");
436 ret = fscanf(pFile, "%lld", &size);
452 ret = sprintf(command, "rm -rf %s", fileName);
455 SysLogException(NID_SYS, E_SYSTEM, "It is failed to write remove command.");
459 ret = system(command);
462 SysLogException(NID_SYS, E_SYSTEM, "It is failed to execute command[%s].", command);
470 _RuntimeInfoImpl::GetValue(const String& key, double& value)
472 return E_OBJ_NOT_FOUND;
476 _RuntimeInfoImpl::GetValue(const String& key, bool& value)
478 if (key == _CHARGING)
480 return IsChargingMode(value);
484 return E_OBJ_NOT_FOUND;
489 _RuntimeInfoImpl::GetValue(const String& key, UuId& value)
491 return E_OBJ_NOT_FOUND;
495 _RuntimeInfoImpl::GetBatteryLevel(int& value)
497 int batteryValue = -1;
498 batteryValue = device_get_battery_pct();
499 SysTryReturnResult(NID_SYS, !(batteryValue < 0 || value > 100), E_SYSTEM, "[E_SYSTEM] device_get_battery_pct return %d", batteryValue);
500 value = batteryValue;
506 _RuntimeInfoImpl::IsChargingMode(bool& value)
508 bool chargeState = false;
510 ret = runtime_info_get_value_bool(RUNTIME_INFO_KEY_BATTERY_IS_CHARGING, &chargeState);
511 SysTryReturnResult(NID_SYS, ret == 0, E_SYSTEM, "[E_SYSTEM] runtime_info_get_value_bool returns %d.", ret);
518 _RuntimeInfoImpl::GetAvailableInternalStorage(long long& value)
521 result r = E_SUCCESS;
523 r = GetCapacity(_ROOT_PATH, total, value);
524 SysTryReturn(NID_SYS, !IsFailed(r), E_SYSTEM, r, "[E_SYSTEM] system error has occurred. ");
529 _RuntimeInfoImpl::GetAvailableExternalStorage(long long& value)
531 int sdCardStatus = 0;
535 ret = vconf_get_int(VCONFKEY_SYSMAN_MMC_STATUS, &sdCardStatus);
536 SysTryReturn(NID_SYS, !(ret < 0), E_SYSTEM, E_SYSTEM, "[E_SYSTEM] vconf_get_int VCONFKEY_SYSMAN_MMC_STATUS failed");
538 if(sdCardStatus == 0)
543 char* directoryPath = _StringConverter::CopyToCharArrayN(_EnvironmentImpl::GetExternalStoragePath());
544 SysTryReturnResult(NID_SYS, directoryPath != null, E_SYSTEM, "It is failed to get external directory path.");
545 result r = GetCapacity(directoryPath, total, value);
546 delete [] directoryPath;
551 _RuntimeInfoImpl::GetAvailableMediaStorage(long long& value)
555 char* directoryPath = _StringConverter::CopyToCharArrayN(_EnvironmentImpl::GetMediaPath());
556 SysTryReturnResult(NID_SYS, directoryPath != null, E_SYSTEM, "It is failed to get media directory path.");
557 result r = GetCapacity(directoryPath, total, value);
558 delete [] directoryPath;
563 _RuntimeInfoImpl::GetCapacity(const char* path, long long& totalSize, long long& availableSize)
566 if (statfs(path, &fs) < 0)
568 SysLogException(NID_SYS, E_SYSTEM, "[E_SYSTEM] statfs() failed");
572 totalSize = static_cast< long long >(fs.f_bsize) * static_cast< long long >(fs.f_blocks);
573 availableSize = static_cast< long long >(fs.f_bsize) * static_cast< long long >(fs.f_bavail);
579 _RuntimeInfoImpl::GetFromProcLonglong(const char* path, const char* key, long long& value)
581 FILE* pStream = null;
582 char line[_MAX_BUFFER_LENGTH] = {0, };
583 char fieldName[_MAX_BUFFER_LENGTH] = {0, };
584 long long keyValue = 0;
585 pStream = fopen(path, "r");
586 SysTryReturnResult(NID_SYS, pStream != null, E_SYSTEM, "%s open is failed.", path);
588 while (fgets(line, sizeof(line), pStream))
590 if (sscanf(line, "%s %lld %*s", fieldName, &keyValue) == 2)
592 if (strncmp(fieldName, key, static_cast< int >(strlen(key))) == 0)
602 SysLogException(NID_SYS, E_OBJ_NOT_FOUND, "it can't find %s field", key);
603 return E_OBJ_NOT_FOUND;
607 _RuntimeInfoImpl::GetFromProc(const char* path, const char* key, int& value)
609 FILE* pStream = null;
610 char line[_MAX_BUFFER_LENGTH] = {0, };
611 char fieldName[_MAX_BUFFER_LENGTH] = {0, };
613 pStream = fopen(path, "r");
614 SysTryReturnResult(NID_SYS, pStream != null, E_SYSTEM, "%s open is failed.", path);
616 while (fgets(line, sizeof(line), pStream))
618 if (sscanf(line, "%s %d %*s", fieldName, &keyValue) == 2)
620 if (strncmp(fieldName, key, static_cast< int >(strlen(key))) == 0)
630 SysLogException(NID_SYS, E_OBJ_NOT_FOUND, "it can't find %s field", key);
631 return E_OBJ_NOT_FOUND;
635 _RuntimeInfoImpl::GetDirectorySizeAsync(void* data)
641 _RuntimeInfoEventArg* pEventArg = (_RuntimeInfoEventArg*)data;
642 long long size = _RuntimeInfoImpl::GetDirectorySize(pEventArg->DirectoryPath);
644 if(pEventArg == null)
646 SysLogException(NID_SYS, E_OUT_OF_MEMORY, "It is failed to create instance of _RuntimeInfoEventArg");
649 pEventArg->Type = _RUNTIME_INFO_EVENT_TYPE_LONGLONG;
650 pEventArg->longLongValue = size;
651 SysLog(NID_SYS, "Fire event %x %s %lld", pEventArg, pEventArg->DirectoryPath, size);
652 runtimeInfoEvent.Fire(*pEventArg);
658 _RuntimeInfoImpl::GetCpuUsageAsync(void* data)
660 result r = E_SUCCESS;
663 procstat_t first, second, diffrence;
664 unsigned long long total, usage;
666 if(read_proc_stat(&first) != false)
668 usleep(_CPU_USAGE_EVALUATION_INTERVAL);
669 if(read_proc_stat(&second) != false)
671 diff_proc_stat(&second, &first, &diffrence);
672 total = diffrence.user + diffrence.system
673 + diffrence.nice + diffrence.idle
674 + diffrence.wait + diffrence.hi
676 usage = 10000 - (diffrence.idle * 10000 / total);
690 _RuntimeInfoEventArg* pEventArg = (_RuntimeInfoEventArg*) data;
691 if(pEventArg == null)
693 SysLogException(NID_SYS, E_OUT_OF_MEMORY, "It is failed to create instance of _RuntimeInfoEventArg");
696 pEventArg->errorCode = r;
697 pEventArg->Type = _RUNTIME_INFO_EVENT_TYPE_INT;
698 pEventArg->intValue = value;
700 runtimeInfoEvent.Fire(*pEventArg);
706 _RuntimeInfoImpl::GetValueAsync(const String& key, IRuntimeInfoGetIntAsyncResultListener* listener)
708 result r = E_SUCCESS;
710 SysTryReturnResult(NID_SYS, listener != null, E_INVALID_ARG, "listener is null");
712 if (key == _CPU_CORE_ALL_USAGE)
716 runtimeInfoEvent.AddListener(*listener);
721 _RuntimeInfoEventArg* pEventArg = new (std::nothrow) _RuntimeInfoEventArg();
722 pEventArg->pListener = listener;
723 thr_id = pthread_create(&p_thread, null, GetCpuUsageAsync, pEventArg);
724 pthread_detach(p_thread);
728 SysLogException(NID_SYS, E_INVALID_ARG, "Required key[%ls] is not valid", key.GetPointer());
735 _RuntimeInfoImpl::GetValueAsync(const String& key, IRuntimeInfoGetLonglongAsyncResultListener* listener)
739 result r = E_SUCCESS;
740 String directoryPath;
742 SysTryReturnResult(NID_SYS, listener != null, E_INVALID_ARG, "listener is null");
744 if(key == _STORAGE_ALLOCATED_INTERNAL_APPLICATION)
746 directoryPath.Append(_EnvironmentImpl::GetPredefinedPath(PREDEFINED_DIRECTORY_APPLICATIONS));
748 else if (key == _STORAGE_ALLOCATED_INTERNAL_AUDIO)
750 directoryPath.Append(_EnvironmentImpl::GetPredefinedPath(PREDEFINED_DIRECTORY_SOUNDS));
752 else if (key == _STORAGE_ALLOCATED_INTERNAL_VIDEO)
754 directoryPath.Append(_EnvironmentImpl::GetPredefinedPath(PREDEFINED_DIRECTORY_VIDEOS));
756 else if (key == _STORAGE_ALLOCATED_INTERNAL_IMAGE)
758 directoryPath.Append(_EnvironmentImpl::GetPredefinedPath(PREDEFINED_DIRECTORY_IMAGES));
760 else if (key == _STORAGE_ALLOCATED_INTERNAL_DOWNLOAD)
762 directoryPath.Append(_EnvironmentImpl::GetPredefinedPath(PREDEFINED_DIRECTORY_DOWNLOADS));
764 else if (key == _STORAGE_ALLOCATED_EXTERNAL_APPLICATION)
766 directoryPath.Append(_EnvironmentImpl::GetPredefinedPath(PREDEFINED_DIRECTORY_EXTERNAL_APPLICATIONS));
768 else if (key == _STORAGE_ALLOCATED_EXTERNAL_AUDIO)
770 directoryPath.Append(_EnvironmentImpl::GetPredefinedPath(PREDEFINED_DIRECTORY_EXTERNAL_SOUNDS));
772 else if (key == _STORAGE_ALLOCATED_EXTERNAL_VIDEO)
774 directoryPath.Append(_EnvironmentImpl::GetPredefinedPath(PREDEFINED_DIRECTORY_EXTERNAL_VIDEOS));
776 else if (key == _STORAGE_ALLOCATED_EXTERNAL_IMAGE)
778 directoryPath.Append(_EnvironmentImpl::GetPredefinedPath(PREDEFINED_DIRECTORY_EXTERNAL_IMAGES));
780 else if (key == _STORAGE_ALLOCATED_EXTERNAL_DOWNLOAD)
782 directoryPath.Append(_EnvironmentImpl::GetPredefinedPath(PREDEFINED_DIRECTORY_EXTERNAL_DOWNLOADS));
786 SysLogException(NID_SYS, E_INVALID_ARG, "Required key[%ls] is not valid", key.GetPointer());
790 SysLog(NID_SYS, "%s", GetErrorMessage(r));
791 SysLog(NID_SYS, "%ls", directoryPath.GetPointer());
794 _RuntimeClient* pRuntimeClient = _RuntimeClient::GetInstance();
795 pRuntimeClient->GetDirectorySizeValueAsync(directoryPath, listener);
802 _RuntimeInfoImpl::GetInstance(RuntimeInfo& runtimeinfo)
804 return runtimeinfo.__pRuntimeInfoImpl;
807 const _RuntimeInfoImpl*
808 _RuntimeInfoImpl::GetInstance(const RuntimeInfo& runtimeinfo)
810 return runtimeinfo.__pRuntimeInfoImpl;