From 376b1791f5888970901326fa60f67431fa701a4d Mon Sep 17 00:00:00 2001 From: Hokwon Song Date: Wed, 30 Oct 2013 13:46:27 +0900 Subject: [PATCH 1/1] Fix N_SE-56436 for Screen lock. Change-Id: I27e610e4f17c1aa1eaff384ae4a0e21ebe9b4185 Signed-off-by: Hokwon Song --- src/system/FSys_PowerManagerImpl.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/system/FSys_PowerManagerImpl.cpp b/src/system/FSys_PowerManagerImpl.cpp index bcf55bd..98bd6d7 100644 --- a/src/system/FSys_PowerManagerImpl.cpp +++ b/src/system/FSys_PowerManagerImpl.cpp @@ -71,6 +71,8 @@ static const wchar_t* POWER_MANAGER_SERVICE_ID = L"osp.sys.ipcserver.powermanage #endif bool _activeApp = false; +unsigned int _dimmingFlag = GOTO_STATE_NOW; +unsigned int _screenOnState = LCD_DIM; bool _deviceCpuPowerOn = false; bool _keepCpuAwake = false; bool _keepScreenOnState = false; @@ -96,11 +98,18 @@ void _ActiveEventListener::OnActiveAppChanged(const Tizen::App::AppId& appId) { int ret = 0; - SysLog(NID_SYS, "Active App is %ls.", appId.GetPointer()); + SysLog(NID_SYS, "Active App is %ls. GetApp id %ls", appId.GetPointer(), _AppInfo::GetApplicationId().GetPointer()); if(appId == _AppInfo::GetApplicationId()) { _activeApp = true; + if (_keepScreenOnState == true) + { + int ret = -1; + ret = pm_lock_state(_screenOnState, _dimmingFlag, 0); + SysTryReturnVoidResult(NID_SYS, ret == 0,E_SYSTEM, "[E_SYSTEM] It failed to lock the screen state. error code [%d]", ret); + SysLog(NID_SYS, "Screen on state is recoveryed."); + } } else { @@ -110,7 +119,6 @@ _ActiveEventListener::OnActiveAppChanged(const Tizen::App::AppId& appId) { ret = pm_unlock_state(LCD_NORMAL, GOTO_STATE_NOW); SysTryReturnVoidResult(NID_SYS, ret == 0, E_SYSTEM, "[E_SYSTEM] It failed to unlock the power state"); - _keepScreenOnState = false; } if (_keepCpuAwake == true || _deviceCpuPowerOn == true) //In case of CPU power control, it has to be keep despite of deactive state. @@ -400,6 +408,8 @@ _PowerManagerImpl::KeepScreenOnState(bool keepOn, bool dimming) { state = LCD_NORMAL; } + _dimmingFlag = flag; + _screenOnState = state; ret = pm_lock_state(state, flag, 0); SysTryReturnResult(NID_SYS, ret == 0, E_SYSTEM, "[E_SYSTEM] It failed to lock the screen state"); _keepScreenOnState = true; -- 2.7.4