#include "FApp_AppArg.h"
#include "FApp_IAppImpl.h"
#include "FApp_AppResourceImpl.h"
+#include <FSys_SettingInfoImpl.h>
using namespace Tizen::Base;
using namespace Tizen::Base::Collection;
_AppInfo::SetAppState(INITIALIZING);
+ r = _SettingInfoImpl::AddSettingEventListenerForInternal(*this);
+ SysTryLog(NID_APP, !IsFailed(r), "[%s] failed to add setting event listener.", GetErrorMessage(r));
+
return E_SUCCESS;
}
-
result
_AppImpl::Execute(_IAppImpl* pIAppImpl)
{
state_handler.low_memory = &OnLowMemory;
state_handler.low_battery = NULL;
- state_handler.language_changed = &OnLanguageChanged;
+ state_handler.language_changed = NULL;
state_handler.region_format_changed = NULL;
_Aul::SetPowerOffNotiListener(OnPowerOffNotiReceived, this);
}
// clear outstanding ongoing notification
- const AppId& appId = _AppInfo::GetApplicationId();
- std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId));
- notification_delete_all_by_type(pAppId.get(), NOTIFICATION_TYPE_ONGOING);
+ notification_delete_all_by_type(appinfo_get_appid(), NOTIFICATION_TYPE_ONGOING);
return r;
}
if (pAppManager != null)
{
- result r = pAppManager->RegisterApplication(_AppInfo::GetPackageId(), _AppInfo::GetAppExecutableName(), static_cast<_AppType>(_AppInfo::GetAppType()), _AppInfo::GetProcessId());
+ result r = pAppManager->RegisterApplication(_AppInfo::GetApplicationId(), static_cast<_AppType>(_AppInfo::GetAppType()), _AppInfo::GetProcessId());
SysTryLog(NID_APP, !IsFailed(r), "[%s] Application registration failed.", GetErrorMessage(r));
}
SysLogTag(NID_APP, "LAUNCH","[%ls:<RegisterApplication>:done]", _AppInfo::GetAppExecutableName().GetPointer());
service_get_window(service, &winId);
if (winId > 0)
{
- _AppInfo::GetAppInfo()->SetParentWindowHandle(winId);
+ _AppInfo::SetParentWindowHandle(winId);
SysLog(NID_APP, "Saving window handle 0x%x.", winId);
}
// call for callbacks
SysTryReturnVoidResult(NID_APP, pAppImpl != null, E_INVALID_STATE, "[E_INVALID_STATE] Getting App instance failed.");
SysTryReturnVoidResult(NID_APP, pAppImpl->__pIAppImpl != null, E_INVALID_STATE, "[E_INVALID_STATE] Getting App instance failed.");
+ result r = _SettingInfoImpl::RemoveSettingEventListenerForInternal(*pAppImpl);
+ SysTryLog(NID_APP, !IsFailed(r), "[%s] failed to remove setting event listener.", GetErrorMessage(r));
+
__isTerminationRequested = true;
pAppImpl->__pIAppImpl->OnTerminate();
}
{
result r = E_SUCCESS;
+ SysLog(NID_APP, "Terminate() is called by application itself");
+
__isTerminationRequested = true;
app_efl_exit();
__pApp->OnBatteryLevelChanged(batteryLevel);
}
-void
-_AppImpl::OnLanguageChanged(void* user_data)
-{
- SysLog(NID_APP, "");
- _AppInfo::UpdatePackageInfo(true);
-
- _AppResourceImpl::Reinitialize();
- SysLog(NID_APP, "Language change done.");
-}
-
-
result
_AppImpl::SendUserEvent(RequestId requestId, const IList* pArgs, bool isPublic)
{
return;
}
- const String& appId = _AppInfo::GetApplicationId();
+ const char* pAppId = appinfo_get_appid();
const char* p = appsvc_get_operation(arg.GetBundle());
String operationId = (p) ? String(p) : TIZEN_OPERATION_MAIN;
operationId = TIZEN_OPERATION_MAIN;
}
- SysLog(NID_APP, "AppControl (%ls, %ls).", appId.GetPointer(), operationId.GetPointer());
+ SysLog(NID_APP, "AppControl (%s, %ls).", pAppId, operationId.GetPointer());
String uri;
String mime;
pAppControlProviderEventListener->OnAppControlRequestReceived(reqId, operationId, pUri, pMime, pMap.get());
- SysLog(NID_APP, "AppControl (%ls, %ls) invocation finished.", appId.GetPointer(), operationId.GetPointer());
+ SysLog(NID_APP, "AppControl (%s, %ls) invocation finished.", pAppId, operationId.GetPointer());
}
return;
CATCH:
- if (r == E_SYSTEM)
- {
- pErrorMsg = new (std::nothrow) String("[E_SYSTEM] A system error has occurred.");
- }
- else if (r == E_OUT_OF_MEMORY)
- {
- pErrorMsg = new (std::nothrow) String("[E_OUT_OF_MEMORY] The memory was insufficient.");
- }
- SysTryReturnVoidResult(NID_APP, pErrorMsg, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory was insufficient.");
-
- res = DataControlProviderManager::GetInstance()->SendDataControlError(reqId, *pErrorMsg);
-
if (pColumnList)
{
pColumnList->RemoveAll(true);
delete pUpdateMap;
}
+ if (r == E_SYSTEM)
+ {
+ pErrorMsg = new (std::nothrow) String("[E_SYSTEM] A system error has occurred.");
+ }
+ else if (r == E_OUT_OF_MEMORY)
+ {
+ pErrorMsg = new (std::nothrow) String("[E_OUT_OF_MEMORY] The memory was insufficient.");
+ }
+ SysTryReturnVoidResult(NID_APP, pErrorMsg, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory was insufficient.");
+
+ res = DataControlProviderManager::GetInstance()->SendDataControlError(reqId, *pErrorMsg);
+
delete pErrorMsg;
return;
return __isTerminationRequested;
}
+typedef void (*cbForVconf)(keynode_t* node, void *pData);
+
void
-_AppImpl::OnPowerOffNotiReceived(void* user_data)
+_AppImpl::OnPowerOffNotiReceived(void* node, void* user_data)
{
- SysLog(NID_APP, "Application is being terminated by power off.");
+ int value = -1;
+ if (!vconf_get_int(VCONFKEY_SYSMAN_POWER_OFF_STATUS, &value))
+ {
+ if (value == VCONFKEY_SYSMAN_POWER_OFF_DIRECT || value == VCONFKEY_SYSMAN_POWER_OFF_RESTART)
+ {
+ SysLog(NID_APP, "Application is being terminated by power off.");
- _AppImpl* pAppImpl = _AppImpl::GetInstance();
- if (pAppImpl != null)
+ if (vconf_ignore_key_changed(VCONFKEY_SYSMAN_POWER_OFF_STATUS, (cbForVconf)_AppImpl::OnPowerOffNotiReceived))
+ {
+ SysLog(NID_APP, "Fail to ignore vconf for key(%s)", VCONFKEY_SYSMAN_POWER_OFF_STATUS);
+ }
+
+ _AppImpl* pAppImpl = _AppImpl::GetInstance();
+ if (pAppImpl != null)
+ {
+ pAppImpl->__forcedTermination = true;
+ }
+
+ app_efl_exit();
+ }
+ }
+}
+
+void
+_AppImpl::OnSettingChanged(String& key)
+{
+ if (key == L"http://tizen.org/setting/locale.language")
{
- pAppImpl->__forcedTermination = true;
+ _AppInfo::UpdatePackageInfo(true);
+ _AppResourceImpl::Reinitialize();
+ SysLog(NID_APP, "Reinitialized resources due to locale change.");
}
-
- app_efl_exit();
}
-bool
+bool
_AppImpl::IsForcedTermination(void)
{
return __forcedTermination;