result
_PowerManagerImpl::InitBatteryEvent(void)
{
- int ret = vconf_notify_key_changed(VCONFKEY_SYSMAN_BATTERY_LEVEL_STATUS, BatteryLevelVConfCallback, null);
+ int ret = vconf_notify_key_changed(VCONFKEY_SYSMAN_BATTERY_LEVEL_STATUS, BatteryLevelVConfCallback, null);
SysTryReturnResult(NID_SYS, ret == 0, E_SYSTEM, "It failed to set the battery event");
return E_SUCCESS;
pSceenEventList->Construct();
int errorCode = 0;
errorCode = vconf_notify_key_changed(VCONFKEY_PM_CURRENT_BRIGHTNESS, ScreenEventVConfCallback, null);
- SysTryReturnResult(NID_SYS, errorCode == 0, E_SYSTEM, "It failed to add ScreenEvent listener.");
+ SysTryReturnResult(NID_SYS, errorCode == 0, E_SYSTEM, "It failed to add ScreenEvent listener on VCONFKEY_PM_CURRENT_BRIGHTNESS.");
errorCode = power_set_changed_cb(PowerChangedCallback, null);
- SysTryReturnResult(NID_SYS, errorCode == 0, E_SYSTEM, "It failed to add ScreenEvent listener.");
+ if(errorCode != POWER_ERROR_NONE)
+ {
+ SysLogException(NID_SYS, E_SYSTEM, "It is failed to register power callback. So unregister VCONFKEY_PM_CURRENT_BRIGHTNESS also.");
+ vconf_ignore_key_changed(VCONFKEY_PM_CURRENT_BRIGHTNESS, ScreenEventVConfCallback);
+ }
+ SysTryReturnResult(NID_SYS, errorCode == POWER_ERROR_NONE, E_SYSTEM, "It failed to add ScreenEvent listener.");
__pSceenEventList = pSceenEventList.release();
SysLog(NID_SYS,"It successed to register power_set_changed_cb");
}
SysTryReturnResult(NID_SYS,__pSceenEventList != null, E_OBJ_NOT_FOUND, "IScreenEventListener list is empty");
r = __pSceenEventList->Remove(&listener);
-
- if (__pSceenEventList->GetCount() == 0)
- {
- delete __pSceenEventList;
- __pSceenEventList = null;
- }
- return r;
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_OBJ_NOT_FOUND, "listener is not exist.");
+ return E_SUCCESS;
}
if (__pChargingEventList == null)
{
- __pChargingEventList = new ArrayListT<IChargingEventListener*>;
- SysTryReturnResult(NID_SYS, __pChargingEventList, E_SYSTEM, "Memory allocation failed");
- __pChargingEventList->Construct();
- int errorCode = 0;
- errorCode = runtime_info_set_changed_cb(RUNTIME_INFO_KEY_BATTERY_IS_CHARGING, RuntimeInfoChangedCallback, null);
- if (errorCode != 0)
- {
- SysLog(NID_SYS, "It failed to register battery charging event");
+ int errorCode = runtime_info_set_changed_cb(RUNTIME_INFO_KEY_BATTERY_IS_CHARGING, RuntimeInfoChangedCallback, null);
+ SysTryReturnResult(NID_SYS, errorCode == RUNTIME_INFO_ERROR_NONE, E_SYSTEM, "It is failed to register RUNTIME_INFO_KEY_BATTERY_IS_CHARGING.");
+
+ __pChargingEventList = new ArrayListT<IChargingEventListener*>;
+ SysTryReturnResult(NID_SYS, __pChargingEventList, E_SYSTEM, "Memory allocation failed");
+ r = __pChargingEventList->Construct();
+ if(r != E_SUCCESS)
+ {
delete __pChargingEventList;
__pChargingEventList = null;
- return E_SYSTEM;
- }
+ }
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to construct charging event list.");
}
if (isSet == false || __pChargingEventList->GetCount() == 0)
result r = E_SUCCESS;
SysTryReturnResult(NID_SYS,__pChargingEventList != null, E_OBJ_NOT_FOUND, "__pChargingEventList list is empty");
-
r = __pChargingEventList->Remove(&listener);
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_OBJ_NOT_FOUND, "listener is not exist.");
- if (__pChargingEventList->GetCount() == 0)
- {
- delete __pChargingEventList;
- __pChargingEventList = null;
- }
- return r;
+ return E_SUCCESS;
}
result
SysTryReturnResult(NID_SYS,__pBootEventList != null, E_OBJ_NOT_FOUND, "IBootEventListener list is empty");
r = __pBootEventList->Remove(&listener);
-
- if (__pBootEventList->GetCount() == 0)
- {
- delete __pBootEventList;
- __pBootEventList = null;
- }
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_OBJ_NOT_FOUND, "IBootEventListener list is empty");
return E_SUCCESS;
}