Fix N_SE-56436 for Screen lock.
authorHokwon Song <hokwon.song@samsung.com>
Wed, 30 Oct 2013 04:46:27 +0000 (13:46 +0900)
committerHokwon Song <hokwon.song@samsung.com>
Wed, 30 Oct 2013 04:46:27 +0000 (13:46 +0900)
Change-Id: I27e610e4f17c1aa1eaff384ae4a0e21ebe9b4185
Signed-off-by: Hokwon Song <hokwon.song@samsung.com>
src/system/FSys_PowerManagerImpl.cpp

index bcf55bd..98bd6d7 100644 (file)
@@ -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;