4 * Copyright (File::*c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
8 * Jaewon Lim <jaewon81.lim@samsung.com>
9 * Woojin Jung <woojin2.jung@samsung.com>
10 * Juyoung Kim <j0.kim@samsung.com>
12 * This library is free software; you can redistribute it and/or modify it under
13 * the terms of the GNU Lesser General Public License as published by the
14 * Free Software Foundation; either version 2.1 of the License, or (at your option)
17 * This library is distributed in the hope that it will be useful, but WITHOUT ANY
18 * WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
20 * License for more details.
22 * You should have received a copy of the GNU Lesser General Public License
23 * along with this library; if not, write to the Free Software Foundation, Inc., 51
24 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
38 #include "probeinfo.h"
39 #include "tizen_probe.h"
43 Ecore_Event_Handler* register_orientation_event_listener();
44 void unregister_orientation_event_listener(Ecore_Event_Handler* handler);
47 using namespace Tizen::Base;
48 using namespace Tizen::Base::Collection;
50 #define LIFECYCLE_PROBE_BLOCK(FUNCNAME) \
51 setProbePoint(&probeInfo); \
53 APPEND_LOG_BASIC_NAME(LC_LIFECYCLE, FUNCNAME); \
54 APPEND_LOG_COMMON_NONE(CALLER_ADDRESS); \
55 printLog(&log, MSG_LOG)
57 namespace Tizen { namespace App
62 // virtual void OnDeviceOrientationChanged(app_device_orientation_e orientation) = 0;
67 static void OnTerminate(void* user_data);
68 // static void OnDeviceOrientationChanged(app_device_orientation_e orientation, void* user_data);
72 // : public Tizen::Base::Object
75 void OnBackground(void);
76 void OnForeground(void);
77 // virtual void OnDeviceOrientationChanged(app_device_orientation_e orientation);
82 static void SetAppState(AppState appstate);
85 result UiApp::Execute(UiAppInstanceFactory pUiAppFactory,
86 const IList* pArguments)
88 typedef result (*methodType)(UiAppInstanceFactory pFactory, const IList* pArgs);
89 static methodType uiapp_executep;
90 DECLARE_COMMON_VARIABLE;
91 Ecore_Event_Handler* handler;
94 GET_REAL_FUNC_TIZEN(_ZN5Tizen3App5UiApp7ExecuteEPFPS1_vEPKNS_4Base10Collection5IListE,
95 LIBOSP_UIFW, uiapp_executep);
98 handler = register_orientation_event_listener();
99 if(gTraceInfo.exec_map.map_start == NULL)
101 get_map_address(CALLER_ADDRESS, &(gTraceInfo.exec_map.map_start),
102 &(gTraceInfo.exec_map.map_end));
104 LIFECYCLE_PROBE_BLOCK("INITIALIZING");
107 ret = uiapp_executep(pUiAppFactory, pArguments);
110 unregister_orientation_event_listener(handler);
116 void _AppImpl::OnTerminate(void* user_data)
118 typedef void (*methodType)(void*);
119 static methodType appimpl_onterminatep;
120 DECLARE_COMMON_VARIABLE;
122 GET_REAL_FUNC_TIZEN(_ZN5Tizen3App8_AppImpl11OnTerminateEPv, LIBOSP_APPFW, appimpl_onterminatep);
125 LIFECYCLE_PROBE_BLOCK("TERMINATING");
128 appimpl_onterminatep(user_data);
131 void _AppImpl::OnDeviceOrientationChanged(app_device_orientation_e orientation, void* user_data)
133 typedef void (*methodType)(app_device_orientation_e, void*);
134 static methodType appimpl_ondeviceorientationchangedp;
136 GET_REAL_FUNC_TIZEN(_ZN5Tizen3App8_AppImpl26OnDeviceOrientationChangedE24app_device_orientation_ePv,
137 LIBOSP_APPFW, appimpl_ondeviceorientationchangedp);
140 on_orientation_changed((int)orientation, false);
143 appimpl_ondeviceorientationchangedp(orientation, user_data);
146 void _AppInfo::SetAppState(AppState appState)
148 typedef void (*methodType)(AppState appstate);
149 static methodType appinfo_setappstatep;
150 DECLARE_COMMON_VARIABLE;
152 GET_REAL_FUNC_TIZEN(_ZN5Tizen3App8_AppInfo11SetAppStateENS0_8AppStateE, LIBOSP_APPFW, appinfo_setappstatep);
155 if(appState == RUNNING)
157 LIFECYCLE_PROBE_BLOCK("RUNNING");
161 appinfo_setappstatep(appState);
164 void _UiAppImpl::OnBackground(void)
166 typedef void (_UiAppImpl::*methodType)(void);
167 static methodType uiappimpl_onbackgroundp;
168 DECLARE_COMMON_VARIABLE;
170 GET_REAL_FUNC_TIZEN(_ZN5Tizen3App10_UiAppImpl12OnBackgroundEv, LIBOSP_UIFW, uiappimpl_onbackgroundp);
174 LIFECYCLE_PROBE_BLOCK("PAUSING");
177 (this->*uiappimpl_onbackgroundp)();
180 void _UiAppImpl::OnForeground(void)
182 typedef void (_UiAppImpl::*methodType)(void);
183 static methodType uiappimpl_onforegroundp;
184 DECLARE_COMMON_VARIABLE;
186 GET_REAL_FUNC_TIZEN(_ZN5Tizen3App10_UiAppImpl12OnForegroundEv, LIBOSP_UIFW, uiappimpl_onforegroundp);
189 LIFECYCLE_PROBE_BLOCK("RUNNING");
191 // SCREENSHOT_DONE();
194 (this->*uiappimpl_onforegroundp)();
198 void _UiAppImpl::OnDeviceOrientationChanged(app_device_orientation_e orientation)
200 typedef void (*methodType)(_UiAppImpl* th, app_device_orientation_e orientation);
201 static methodType uiappimpl_ondeviceorientationchangedp;
203 GET_REAL_FUNC_TIZEN(_ZThn4_N5Tizen3App10_UiAppImpl26OnDeviceOrientationChangedE24app_device_orientation_e,
204 LIBOSP_UIFW, uiappimpl_ondeviceorientationchangedp);
207 on_orientation_changed((int)orientation, false);
210 uiappimpl_ondeviceorientationchangedp(static_cast<_UiAppImpl*>(dynamic_cast<_IAppImpl*>(this)), orientation);
213 } } // end of namespace