equal
deleted
inserted
replaced
22 #include <j2me/jdebug.h> |
22 #include <j2me/jdebug.h> |
23 // needed for javaregistry |
23 // needed for javaregistry |
24 #include <javaregistryentry.h> |
24 #include <javaregistryentry.h> |
25 #include <javaregistry.h> |
25 #include <javaregistry.h> |
26 #include <javaattribute.h> |
26 #include <javaattribute.h> |
27 #ifdef RD_JAVA_NGA_ENABLED |
27 |
28 #include <goommonitorsession.h> |
|
29 #include <goommonitorplugin.hrh> |
|
30 #endif // RD_JAVA_NGA_ENABLED |
|
31 #include "CMIDAppUi.h" |
28 #include "CMIDAppUi.h" |
32 // using CMIDApplication API for iApp |
29 // using CMIDApplication API for iApp |
33 #include "CMIDApplication.h" |
30 #include "CMIDApplication.h" |
34 // needed for creating CMIDComponentFactory |
31 // needed for creating CMIDComponentFactory |
35 #include "CMIDComponentFactory.h" |
32 #include "CMIDComponentFactory.h" |
43 using namespace java::ui; |
40 using namespace java::ui; |
44 using namespace Java; |
41 using namespace Java; |
45 |
42 |
46 // class CMIDAppUi |
43 // class CMIDAppUi |
47 CMIDAppUi::CMIDAppUi() : iCurrentDisplayable(NULL), |
44 CMIDAppUi::CMIDAppUi() : iCurrentDisplayable(NULL), |
48 iPendingOrientationChange(EFalse), iPauseApp(EFalse) |
45 iPendingOrientationChange(EFalse), iPauseApp(EFalse) |
49 { |
46 { |
50 mJavaAppUi = java::ui::CoreUiAvkonLcdui::getInstance().getJavaAknAppUi(); |
47 mJavaAppUi = java::ui::CoreUiAvkonLcdui::getInstance().getJavaAknAppUi(); |
51 mCoreAppUi = java::ui::CoreUiAvkonLcdui::getInstance().getJavaUiAppUi(); |
48 mCoreAppUi = java::ui::CoreUiAvkonLcdui::getInstance().getJavaUiAppUi(); |
52 } |
49 } |
53 |
50 |
167 } |
164 } |
168 } |
165 } |
169 |
166 |
170 if (aEvent.Type() == EEventUser) |
167 if (aEvent.Type() == EEventUser) |
171 { |
168 { |
172 TApaSystemEvent* eventData = reinterpret_cast<TApaSystemEvent*>(aEvent.EventData()); |
169 if ((*reinterpret_cast<TApaSystemEvent*>(aEvent.EventData())) == EApaSystemEventShutdown) |
173 if ((*eventData) == EApaSystemEventShutdown) |
170 { |
174 { |
|
175 #ifdef RD_JAVA_NGA_ENABLED |
|
176 // Check the reason |
|
177 eventData++; |
|
178 if ((*eventData) == KGoomMemoryLowEvent) |
|
179 { |
|
180 return HandleGoomMemoryLowEventL(); |
|
181 } |
|
182 #endif // RD_JAVA_NGA_ENABLED |
|
183 // Oom or exit from task-list. Ask the CoreUi to shutdown the MIDlet. |
171 // Oom or exit from task-list. Ask the CoreUi to shutdown the MIDlet. |
184 java::ui::CoreUiAvkonLcdui::getInstance().shutDownRequestFromWindowServer(); |
172 java::ui::CoreUiAvkonLcdui::getInstance().shutDownRequestFromWindowServer(); |
185 } |
173 } |
186 } |
174 } |
187 |
175 |
188 // Workaround to send pauseApp with long-press of the Menu key |
176 // Workaround to send pauseApp with long-press of the Menu key |
189 // if no event was send yet |
|
190 if (aEvent.Type() == EEventKey) |
177 if (aEvent.Type() == EEventKey) |
191 { |
178 { |
192 if (aEvent.Key()->iScanCode == EStdKeyApplication0 |
179 if (aEvent.Key()->iScanCode == EStdKeyApplication0 |
193 && aEvent.Key()->iRepeats == 1 && !iPauseApp) |
180 && aEvent.Key()->iRepeats == 1 && !iPauseApp) |
194 { |
181 { |
285 void CMIDAppUi::UnSetEnv() |
272 void CMIDAppUi::UnSetEnv() |
286 { |
273 { |
287 iEnv = 0; |
274 iEnv = 0; |
288 } |
275 } |
289 |
276 |
290 #ifdef RD_JAVA_NGA_ENABLED |
|
291 TBool CMIDAppUi::HandleGoomMemoryLowEventL() |
|
292 { |
|
293 if (iObserver) |
|
294 { |
|
295 iObserver->HandleFreeGraphicsMemory(); |
|
296 RGOomMonitorSession session; |
|
297 User::LeaveIfError(session.Connect()); |
|
298 session.ThisAppIsNotExiting(CCoeEnv::Static()->RootWin().Identifier()); |
|
299 session.Close(); |
|
300 return ETrue; |
|
301 } |
|
302 return EFalse; |
|
303 } |
|
304 #endif // RD_JAVA_NGA_ENABLED |
|
305 |
|
306 // |
277 // |
307 // From MLcduiPlugin |
278 // From MLcduiPlugin |
308 // |
279 // |
309 void CMIDAppUi::SetObserverL(MMIDObserver* aObserver) |
280 void CMIDAppUi::SetObserverL(MMIDObserver* aObserver) |
310 { |
281 { |