static const int _DEVICE_CPU = 1;
static const int _DEVICE_POWER_LEVEL_ON = 1;
static const int _DEVICE_POWER_LEVEL_OFF = 0;
-static const int _APPID_LENGTH = 10;
static const int _DEACTIVATED_BRIGHTNESS_CONTROL = -1;
static const float _BRIGHTNESS_RESOLUTION = 10.0;
static const wchar_t* POWER_MANAGER_SERVICE_ID = L"osp.sys.ipcserver.powermanager";
#endif
bool _activeApp = false;
+unsigned int _dimmingFlag = GOTO_STATE_NOW;
+unsigned int _screenOnState = LCD_DIM;
bool _deviceCpuPowerOn = false;
bool _keepCpuAwake = false;
bool _keepScreenOnState = false;
_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
{
{
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.
{
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;
unique_ptr<_IpcClient> pIpcClient (new (std::nothrow) _IpcClient());
SysTryReturn(NID_SYS, pIpcClient != null, E_OUT_OF_MEMORY, r, "It is failed to create IPC instance.");
-// if(Tizen::Io::File::IsFileExist(L"/opt/usr/etc/common_service_for_powermanager") == true)
- {
- SysLog(NID_SYS, "PowerManager is serviced by common-service");
- r = pIpcClient->Construct(POWER_MANAGER_SERVICE_ID);
- }
-/* else
- {
- r = pIpcClient->Construct(_COMMUNICATION_DISPATCHER_IPC_ID);
- }
-*/
+ SysLog(NID_SYS, "PowerManager is serviced by common-service");
+ r = pIpcClient->Construct(POWER_MANAGER_SERVICE_ID);
SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "[%s] It failed to create IpcClient", GetErrorMessage(r));
requestMessage.Construct();
unique_ptr<_IpcClient> pIpcClient (new (std::nothrow) _IpcClient());
SysTryReturn(NID_SYS, pIpcClient != null, E_OUT_OF_MEMORY, r, "It is failed to create IPC instance.");
-// if(Tizen::Io::File::IsFileExist(L"/opt/usr/etc/common_service_for_powermanager") == true)
- {
- SysLog(NID_SYS, "PowerManager is serviced by common-service");
- r = pIpcClient->Construct(POWER_MANAGER_SERVICE_ID);
- }
-/* else
- {
- r = pIpcClient->Construct(_COMMUNICATION_DISPATCHER_IPC_ID);
- }
-*/
+ SysLog(NID_SYS, "PowerManager is serviced by common-service");
+ r = pIpcClient->Construct(POWER_MANAGER_SERVICE_ID);
SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "[%s] It failed to create IpcClient", GetErrorMessage(r));
requestMessage.Construct();