1 /* |
|
2 * Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Container for the Active Idle plugin. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // From this plugin. |
|
20 #include <aisystemuids.hrh> |
|
21 |
|
22 #include "pslnactiveidlepluginengine.h" |
|
23 #include "pslnactiveidleplugincontainer.h" |
|
24 #include "pslnactiveidleplugin.h" |
|
25 #include "activeidle2domainpskeys.h" |
|
26 #include "activeidle2internalpskeys.h" |
|
27 |
|
28 // from plugin side |
|
29 #include <extrstandbyscrconst.h> // for KExtrStandbyScrFullScreenMode |
|
30 |
|
31 // From PSLN framework. |
|
32 #include <pslnfwiconhelper.h> |
|
33 #include <psln.rsg> |
|
34 |
|
35 // General services. |
|
36 #include <stringloader.h> |
|
37 #include <aknglobalnote.h> |
|
38 #include <e32property.h> |
|
39 |
|
40 // Application specific skins. |
|
41 #include <pslnfwappthemehandler.h> |
|
42 |
|
43 // XUIKON. |
|
44 #include <xnodt.h> |
|
45 |
|
46 // ECOM. |
|
47 #include <ecom/ecom.h> |
|
48 #include <ecom/implementationinformation.h> |
|
49 |
|
50 #include <centralrepository.h> |
|
51 #include <activeidle2domaincrkeys.h> |
|
52 |
|
53 #include <AknSgcc.h> |
|
54 |
|
55 // Granularity of plugin array. |
|
56 const TInt KPslnPluginArrayGranularity = 4; |
|
57 |
|
58 // ActiveIdle1 plugin ECOM interface uid |
|
59 const TInt KAI1PluginInterfaceUid = 0x101F8700; |
|
60 const TInt KAIThemeStatusPaneHidden = 0x00000001; |
|
61 |
|
62 // AI1 cenrep |
|
63 const TInt KCRUidActiveIdle = 0x10207467; |
|
64 const TInt KCRPluginCountKey = 0x00000002; |
|
65 const TInt KCRFirstPluginKey = 0x00000003; |
|
66 |
|
67 const TInt KPSLNOneSecondInMicroSeconds = 1000*1000; |
|
68 |
|
69 // ========== LOCAL FUNCTIONS ================================================= |
|
70 |
|
71 template<class Array> |
|
72 void CleanupResetAndDestroy(TAny* aObj) |
|
73 { |
|
74 if(aObj) |
|
75 { |
|
76 static_cast<Array*>(aObj)->ResetAndDestroy(); |
|
77 } |
|
78 } |
|
79 |
|
80 template<class Array> |
|
81 void CleanupResetAndDestroyPushL(Array& aPointerArray) |
|
82 { |
|
83 CleanupStack::PushL(TCleanupItem(&CleanupResetAndDestroy<Array>, &aPointerArray)); |
|
84 } |
|
85 |
|
86 // ========== MEMBER FUNCTIONS ================================================ |
|
87 |
|
88 // --------------------------------------------------------------------------- |
|
89 // CPslnActiveIdlePluginEngine::ConstructL() |
|
90 // |
|
91 // Symbian OS two phased constructor |
|
92 // --------------------------------------------------------------------------- |
|
93 // |
|
94 void CPslnActiveIdlePluginEngine::ConstructL(const TRect& /*aRect*/) |
|
95 { |
|
96 #ifdef _MY_DEBUG |
|
97 RDebug::Print(_L("XAI: CPslnActiveIdlePluginEngine::ConstructL")); |
|
98 #endif |
|
99 |
|
100 // Create application theme handler and list for application themes. |
|
101 iMySkinList = new (ELeave) |
|
102 CArrayPtrFlat<CXnODT>(KPslnPluginArrayGranularity); |
|
103 iPslnFWThemeHandler = CPslnFWAppThemeHandler::NewL( |
|
104 *this, |
|
105 *iMySkinList); |
|
106 |
|
107 CheckCurrentUIControllerL(); |
|
108 CheckCurrentAi1PluginL(); |
|
109 iRestartTimer = CPeriodic::NewL(EPriorityNormal); |
|
110 iUiRefreshTimer = CPeriodic::NewL(EPriorityNormal); |
|
111 } |
|
112 |
|
113 // --------------------------------------------------------------------------- |
|
114 // CPslnActiveIdlePluginEngine::CPslnActiveIdlePluginEngine |
|
115 // |
|
116 // Constructor |
|
117 // --------------------------------------------------------------------------- |
|
118 // |
|
119 CPslnActiveIdlePluginEngine::CPslnActiveIdlePluginEngine( |
|
120 CPslnActiveIdlePlugin* aPlugin) |
|
121 : |
|
122 iFirstUpdateRound(ETrue), |
|
123 iFirstUpdateRoundInjected(EFalse), |
|
124 iCurrentUIController(EAiUICUnknown), |
|
125 iPlugin(aPlugin) |
|
126 { |
|
127 } |
|
128 |
|
129 // --------------------------------------------------------------------------- |
|
130 // CPslnActiveIdlePluginEngine::~CPslnActiveIdlePluginEngine() |
|
131 // |
|
132 // Destructor |
|
133 // --------------------------------------------------------------------------- |
|
134 // |
|
135 CPslnActiveIdlePluginEngine::~CPslnActiveIdlePluginEngine() |
|
136 { |
|
137 if (iRestartTimer) |
|
138 { |
|
139 iRestartTimer->Cancel(); |
|
140 } |
|
141 delete iRestartTimer; |
|
142 if (iUiRefreshTimer) |
|
143 { |
|
144 iUiRefreshTimer->Cancel(); |
|
145 } |
|
146 delete iUiRefreshTimer; |
|
147 |
|
148 if (iMySkinList) |
|
149 { |
|
150 iMySkinList->ResetAndDestroy(); |
|
151 } |
|
152 delete iMySkinList; |
|
153 delete iPslnFWThemeHandler; |
|
154 } |
|
155 |
|
156 // ----------------------------------------------------------------------------- |
|
157 // CPslnActiveIdlePluginEngine::ActivateThemeL |
|
158 // ----------------------------------------------------------------------------- |
|
159 // |
|
160 void CPslnActiveIdlePluginEngine::ActivateThemeL() |
|
161 { |
|
162 TInt skinIndex = 0; |
|
163 if( iPlugin->Container() ) |
|
164 { |
|
165 skinIndex = iPlugin->Container()->iListBox->CurrentItemIndex(); |
|
166 } |
|
167 else |
|
168 { |
|
169 // No selection possible yet |
|
170 return; |
|
171 } |
|
172 |
|
173 if (skinIndex >= 0 && skinIndex < iMySkinList->Count() && |
|
174 !iRestartTimer->IsActive()) |
|
175 { |
|
176 if (skinIndex >= iHSStartIndex && |
|
177 skinIndex < iHSEndIndex) |
|
178 { |
|
179 CXnODT* selectedSkinODT = iMySkinList->At(skinIndex); |
|
180 UpdateStatusPaneVisibilityCenrepL( |
|
181 selectedSkinODT->Flags() & KAIThemeStatusPaneHidden); |
|
182 |
|
183 if (iCurrentAi1Plugin != selectedSkinODT->ThemeUid()) |
|
184 { |
|
185 UpdateAi1PluginLoadCenrepL(selectedSkinODT->ThemeUid()); |
|
186 CheckCurrentAi1PluginL(); |
|
187 } |
|
188 if (iCurrentUIController == EAiUICXML) |
|
189 { |
|
190 UpdateUIControllersInCenrepL(EAiUICNative); |
|
191 CheckCurrentUIControllerL(); |
|
192 |
|
193 iRestartTimer->Cancel(); |
|
194 iRestartRetryCount = 0; |
|
195 iRestartTimer->Start( |
|
196 KPSLNOneSecondInMicroSeconds, |
|
197 KPSLNOneSecondInMicroSeconds, |
|
198 TCallBack(RestartTimerCallback, this)); |
|
199 } |
|
200 else |
|
201 { |
|
202 if( IsAiRunning() ) |
|
203 { |
|
204 // Recycle this method to bring to foreground |
|
205 RestartTimerCallback( this ); |
|
206 } |
|
207 } |
|
208 ManualGetSkinsRestartL(); |
|
209 } |
|
210 else |
|
211 { |
|
212 if (iCurrentUIController == EAiUICNative) |
|
213 { |
|
214 UpdateStatusPaneVisibilityCenrepL(EFalse); // Always visible status pane |
|
215 UpdateUIControllersInCenrepL(EAiUICXML); |
|
216 CheckCurrentUIControllerL(); |
|
217 } |
|
218 |
|
219 RProperty::Set( KPSUidAiInformation, KActiveIdleRestartAI2, KActiveIdleRestartCode ); |
|
220 iRestartTimer->Cancel(); |
|
221 iRestartRetryCount = 0; |
|
222 iRestartTimer->Start( |
|
223 KPSLNOneSecondInMicroSeconds, |
|
224 KPSLNOneSecondInMicroSeconds, |
|
225 TCallBack(RestartTimerCallback, this)); |
|
226 CXnODT* selectedSkinODT = iMySkinList->At(skinIndex); |
|
227 TXnServiceCompletedMessage ret; |
|
228 |
|
229 ret = iPslnFWThemeHandler->SetApplicationSkinL( |
|
230 *selectedSkinODT ); |
|
231 |
|
232 if (ret == EXnSetActiveThemeFailed) |
|
233 { |
|
234 // Show error note. |
|
235 HBufC* errorBuf = StringLoader::LoadLC( |
|
236 R_PSLN_QTN_SKINS_ERROR_CORRUPTED); |
|
237 // Display global note. |
|
238 CAknGlobalNote* errorNote = CAknGlobalNote::NewLC(); |
|
239 errorNote->ShowNoteL(EAknGlobalErrorNote, *errorBuf); |
|
240 CleanupStack::PopAndDestroy(2, errorBuf); // errorNote also |
|
241 } |
|
242 else |
|
243 { |
|
244 iRestartTimer->Cancel(); |
|
245 iRestartRetryCount = 0; |
|
246 iRestartTimer->Start( |
|
247 KPSLNOneSecondInMicroSeconds, |
|
248 KPSLNOneSecondInMicroSeconds, |
|
249 TCallBack(RestartTimerCallback, this)); |
|
250 } |
|
251 } |
|
252 } |
|
253 } |
|
254 |
|
255 // ----------------------------------------------------------------------------- |
|
256 // CPslnActiveIdlePluginEngine::HandleMessage |
|
257 // ----------------------------------------------------------------------------- |
|
258 // |
|
259 void CPslnActiveIdlePluginEngine::HandleMessage( |
|
260 TXnServiceCompletedMessage aMessage) |
|
261 { |
|
262 switch (aMessage) |
|
263 { |
|
264 case EXnGetListHeadersEmpty: |
|
265 // Just destroy everything and use default items only. |
|
266 case EXnGetListHeadersFailed: // fallthrough |
|
267 if (iMySkinList) |
|
268 { |
|
269 iMySkinList->ResetAndDestroy(); |
|
270 } |
|
271 break; |
|
272 case EXnServiceRequestCanceled: // fallthrough |
|
273 case EXnServiceRequestError: // fallthrough |
|
274 { |
|
275 TRAP_IGNORE(ManualGetSkinsRestartL();) |
|
276 } |
|
277 break; |
|
278 default: |
|
279 break; |
|
280 } |
|
281 } |
|
282 |
|
283 // ----------------------------------------------------------------------------- |
|
284 // CPslnActiveIdlePluginEngine::HandleMessage |
|
285 // ----------------------------------------------------------------------------- |
|
286 // |
|
287 void CPslnActiveIdlePluginEngine::HandleMessage( |
|
288 TXnServiceCompletedMessage aMessage, |
|
289 CArrayPtrFlat<CXnODT>& /*aAppThemeList*/) |
|
290 { |
|
291 switch (aMessage) |
|
292 { |
|
293 case EXnGetListHeadersRestart: |
|
294 case EXnGetListHeadersUpdate: // fallthrough |
|
295 { |
|
296 TRAP_IGNORE(AddNewThemeL(aMessage)); |
|
297 break; |
|
298 } |
|
299 default: |
|
300 { |
|
301 break; |
|
302 } |
|
303 } |
|
304 } |
|
305 |
|
306 // --------------------------------------------------------------------------- |
|
307 // Adds new theme to the container / listbox. |
|
308 // --------------------------------------------------------------------------- |
|
309 // |
|
310 void CPslnActiveIdlePluginEngine::AddThemesToContainerL() |
|
311 { |
|
312 TInt value = 0; |
|
313 |
|
314 GetExtStandbyScreenState(value); |
|
315 |
|
316 /* value == 0 Only AI2 themes |
|
317 value != 0 |
|
318 bit 31 AI2 themes |
|
319 bit 30-0 External themes |
|
320 */ |
|
321 value |= 0x80000000; // Force AI2 themes on |
|
322 if ((value == 0) || ((value & 0x80000000) != 0)) |
|
323 { |
|
324 if( iPlugin->Container() && iMySkinList ) |
|
325 { |
|
326 // Remove themes. All. |
|
327 iPlugin->Container()->RemoveThemes( 0 ); |
|
328 for ( TInt i = 0; i < iMySkinList->Count(); ++i ) |
|
329 { |
|
330 if( i >= iHSStartIndex && |
|
331 i < iHSEndIndex ) |
|
332 { |
|
333 iPlugin->Container()->AddNewItemToListL( i, |
|
334 iMySkinList->At(i), |
|
335 EAiUICNative ); |
|
336 } |
|
337 else |
|
338 { |
|
339 iPlugin->Container()->AddNewItemToListL( i, |
|
340 iMySkinList->At(i), |
|
341 EAiUICXML ); |
|
342 } |
|
343 } |
|
344 } |
|
345 } |
|
346 } |
|
347 |
|
348 // --------------------------------------------------------------------------- |
|
349 // Adds new theme to the listbox. |
|
350 // --------------------------------------------------------------------------- |
|
351 // |
|
352 void CPslnActiveIdlePluginEngine::AddNewThemeL( |
|
353 TXnServiceCompletedMessage aMessage) |
|
354 { |
|
355 // No themes available - do not add anything. |
|
356 if (!iMySkinList) |
|
357 { |
|
358 return; |
|
359 } |
|
360 |
|
361 // Theme activation causes restart of theme headers list. |
|
362 if (aMessage == EXnGetListHeadersRestart) |
|
363 { |
|
364 iFirstUpdateRound = EFalse; |
|
365 } |
|
366 |
|
367 TInt value = 0; |
|
368 |
|
369 GetExtStandbyScreenState(value); |
|
370 |
|
371 /* value == 0 Only AI2 themes |
|
372 value != 0 |
|
373 bit 31 AI2 themes |
|
374 bit 30-0 External themes |
|
375 */ |
|
376 value |= 0x80000000; // Force AI2 themes on |
|
377 |
|
378 if ((value & 0x7FFFFFFF) > 0) |
|
379 { |
|
380 if ((iFirstUpdateRound && !iFirstUpdateRoundInjected) || |
|
381 aMessage == EXnGetListHeadersRestart) |
|
382 { |
|
383 iFirstUpdateRoundInjected = ETrue; |
|
384 AddHomeScreenThemesL(); |
|
385 } |
|
386 } |
|
387 |
|
388 UiTimerRestart(); |
|
389 } |
|
390 |
|
391 // |
|
392 // Get external Standby Screen state from Cenrep |
|
393 // |
|
394 TInt CPslnActiveIdlePluginEngine::GetExtStandbyScreenState(TInt& aValue ) |
|
395 { |
|
396 TInt ret = 0; |
|
397 TUid uid = { KCRUidActiveIdleLV }; // {0x10275102}; // |
|
398 |
|
399 //TRAP_IGNORE: leaving function called in non-leaving function |
|
400 TRAP_IGNORE |
|
401 ( |
|
402 CRepository* cenRep = CRepository::NewLC( uid ); |
|
403 |
|
404 ret = cenRep->Get(KAIExternalStatusScreen, aValue ); |
|
405 |
|
406 CleanupStack::PopAndDestroy( cenRep ); |
|
407 ) |
|
408 |
|
409 return ret; |
|
410 } |
|
411 |
|
412 // --------------------------------------------------------------------------- |
|
413 // Add EXT HS themes to listing |
|
414 // --------------------------------------------------------------------------- |
|
415 // |
|
416 void CPslnActiveIdlePluginEngine::AddHomeScreenThemesL() |
|
417 { |
|
418 iHSStartIndex = iHSEndIndex = iMySkinList->Count(); |
|
419 // Resolve AI1 plugins in ECOM |
|
420 RImplInfoPtrArray eComPlugins; |
|
421 CleanupResetAndDestroyPushL(eComPlugins); |
|
422 |
|
423 REComSession::ListImplementationsL(TUid::Uid(KAI1PluginInterfaceUid), eComPlugins); |
|
424 for (TInt i = 0; i < eComPlugins.Count(); ++i) |
|
425 { |
|
426 CXnODT* skinODT = CXnODT::NewL(); |
|
427 skinODT->SetThemeUid(eComPlugins[i]->ImplementationUid().iUid); |
|
428 if (eComPlugins[i]->OpaqueData() == KExtrStandbyScrFullScreenMode) |
|
429 { |
|
430 skinODT->SetFlags(KAIThemeStatusPaneHidden); |
|
431 } |
|
432 else |
|
433 { |
|
434 skinODT->SetFlags(0); |
|
435 } |
|
436 CleanupStack::PushL(skinODT); |
|
437 iMySkinList->AppendL(skinODT); |
|
438 CleanupStack::Pop(skinODT); |
|
439 |
|
440 HBufC* item = HBufC::NewLC(KPslnItemMaxTextLength); |
|
441 TPtr itemPtr = item->Des(); |
|
442 if (eComPlugins[i]->DisplayName().Length()) |
|
443 { |
|
444 itemPtr = eComPlugins[i]->DisplayName(); |
|
445 } |
|
446 else |
|
447 { |
|
448 itemPtr = _L("OperatorHomeScreen1"); |
|
449 } |
|
450 skinODT->SetThemeFullNameL( itemPtr ); |
|
451 if (iCurrentAi1Plugin == eComPlugins[i]->ImplementationUid().iUid && |
|
452 iCurrentUIController == EAiUICNative) |
|
453 { |
|
454 itemPtr.Insert(0, KPslnFWActiveListItemFormat); |
|
455 TInt flags = skinODT->Flags(); |
|
456 skinODT->SetFlags(flags | EXnThemeStatusActive ); |
|
457 } |
|
458 else |
|
459 { |
|
460 itemPtr.Insert(0, KPslnFWNonActiveListItemFormat); |
|
461 } |
|
462 CleanupStack::PopAndDestroy(item); |
|
463 ++iHSEndIndex; |
|
464 } |
|
465 CleanupStack::PopAndDestroy(); |
|
466 } |
|
467 |
|
468 // --------------------------------------------------------------------------- |
|
469 // Check active AI2 UI Controller in cenrep keys |
|
470 // --------------------------------------------------------------------------- |
|
471 // |
|
472 void CPslnActiveIdlePluginEngine::CheckCurrentUIControllerL() |
|
473 { |
|
474 CRepository* cenRep = CRepository::NewL(TUid::Uid(KCRUidActiveIdleLV)); // KCRUidActiveIdleLV AI2 Cenrep! |
|
475 TInt value = 0; |
|
476 if (cenRep->Get(KAiMainUIController, value) == KErrNone) |
|
477 { |
|
478 if ((value == AI_UID_ECOM_IMPLEMENTATION_UICONTROLLER_NATIVE) |
|
479 || (value == AI3_UID_ECOM_IMPLEMENTATION_UICONTROLLER_NATIVE)) |
|
480 { |
|
481 iCurrentUIController = EAiUICNative; |
|
482 } |
|
483 else if ((value == AI_UID_ECOM_IMPLEMENTATION_UICONTROLLER_XML) |
|
484 || (value == AI3_UID_ECOM_IMPLEMENTATION_UICONTROLLER_XML)) |
|
485 { |
|
486 iCurrentUIController = EAiUICXML; |
|
487 } |
|
488 } |
|
489 delete cenRep; |
|
490 } |
|
491 |
|
492 // --------------------------------------------------------------------------- |
|
493 // Update active AI2 UI Controller in cenrep keys |
|
494 // --------------------------------------------------------------------------- |
|
495 // |
|
496 void CPslnActiveIdlePluginEngine::UpdateUIControllersInCenrepL(TInt aControllerId) |
|
497 { |
|
498 if (iCurrentUIController != aControllerId) |
|
499 { |
|
500 TUid uid = { KCRUidActiveIdleLV }; // KCRUidActiveIdleLV AI2 Cenrep! |
|
501 CRepository* cenRep = CRepository::NewL(uid); |
|
502 if (aControllerId == EAiUICNative) |
|
503 { |
|
504 cenRep->Delete(KAiFirstUIController); |
|
505 cenRep->Delete(KAiFirstUIController + 1); |
|
506 cenRep->Set(KAiMainUIController, AI_UID_ECOM_IMPLEMENTATION_UICONTROLLER_NATIVE); |
|
507 } |
|
508 else if (aControllerId == EAiUICXML) |
|
509 { |
|
510 cenRep->Create(KAiFirstUIController, AI_UID_ECOM_IMPLEMENTATION_UICONTROLLER_NATIVE); |
|
511 cenRep->Set(KAiFirstUIController, AI_UID_ECOM_IMPLEMENTATION_UICONTROLLER_NATIVE); |
|
512 cenRep->Delete(KAiFirstUIController + 1); |
|
513 cenRep->Set(KAiMainUIController, AI_UID_ECOM_IMPLEMENTATION_UICONTROLLER_XML); |
|
514 } |
|
515 delete cenRep; |
|
516 } |
|
517 } |
|
518 |
|
519 // --------------------------------------------------------------------------- |
|
520 // Update status pane visibility for status pane cenrep key |
|
521 // --------------------------------------------------------------------------- |
|
522 // |
|
523 void CPslnActiveIdlePluginEngine::UpdateStatusPaneVisibilityCenrepL( |
|
524 TBool aPaneHidden) |
|
525 { |
|
526 TInt value = EAiStatusPaneLayoutIdleNormal; |
|
527 if (aPaneHidden) |
|
528 { |
|
529 value = EAiStatusPaneLayoutIdleHidden; |
|
530 } |
|
531 TUid uid = { KCRUidActiveIdleLV }; // KCRUidActiveIdleLV AI2 Cenrep! |
|
532 CRepository* cenRep = CRepository::NewL(uid); |
|
533 cenRep->Set(KAiStatusPaneLayout, value); |
|
534 delete cenRep; |
|
535 } |
|
536 |
|
537 // --------------------------------------------------------------------------- |
|
538 // Update active AI1 plugin in cenrep |
|
539 // --------------------------------------------------------------------------- |
|
540 // |
|
541 void CPslnActiveIdlePluginEngine::UpdateAi1PluginLoadCenrepL(TInt aNewUid) |
|
542 { |
|
543 TUid uid = { KCRUidActiveIdle }; // KCRUidActiveIdle AI1 Cenrep! |
|
544 CRepository* cenRep = CRepository::NewL(uid); |
|
545 TInt currentCount = 0; |
|
546 cenRep->Get(KCRPluginCountKey, currentCount); |
|
547 |
|
548 // Delete old keys if any |
|
549 for (TInt i = 0; i < currentCount; ++i) |
|
550 { |
|
551 cenRep->Delete(KCRFirstPluginKey+i); |
|
552 } |
|
553 |
|
554 cenRep->Delete(KCRPluginCountKey); |
|
555 cenRep->Create(KCRPluginCountKey, 1); |
|
556 // Set only 1 new key, the selected one |
|
557 cenRep->Create(KCRFirstPluginKey, aNewUid); |
|
558 |
|
559 delete cenRep; |
|
560 } |
|
561 |
|
562 // --------------------------------------------------------------------------- |
|
563 // Check the current AI1 plugin (ref. External opretor homescreen feature) |
|
564 // --------------------------------------------------------------------------- |
|
565 // |
|
566 void CPslnActiveIdlePluginEngine::CheckCurrentAi1PluginL() |
|
567 { |
|
568 TUid uid = { KCRUidActiveIdle }; // KCRUidActiveIdle AI1 Cenrep! |
|
569 TInt value = 0; |
|
570 TInt currentCount = 0; |
|
571 |
|
572 CRepository* cenRep = CRepository::NewL(uid); |
|
573 cenRep->Get(KCRPluginCountKey, currentCount); |
|
574 |
|
575 if (currentCount) // count must be set |
|
576 { |
|
577 cenRep->Get(KCRFirstPluginKey, value); |
|
578 } |
|
579 delete cenRep; |
|
580 |
|
581 if (value != 0) |
|
582 { |
|
583 iCurrentAi1Plugin = value; |
|
584 } |
|
585 } |
|
586 |
|
587 // --------------------------------------------------------------------------- |
|
588 // Manually start updating theme/skin listing |
|
589 // --------------------------------------------------------------------------- |
|
590 // |
|
591 void CPslnActiveIdlePluginEngine::ManualGetSkinsRestartL(TBool aForceStart) |
|
592 { |
|
593 if( !aForceStart && iMySkinList->Count() > 0 && |
|
594 iUiRefreshTimer->IsActive() ) |
|
595 { |
|
596 return; |
|
597 } |
|
598 |
|
599 // Restart get skins manually! |
|
600 if( iPlugin->Container() ) |
|
601 { |
|
602 iPlugin->Container()->RemoveThemes(0); |
|
603 } |
|
604 iMySkinList->ResetAndDestroy(); |
|
605 iFirstUpdateRound = ETrue; |
|
606 iFirstUpdateRoundInjected = EFalse; |
|
607 iPslnFWThemeHandler->CancelGetApplicationSkins(); |
|
608 iAddIndex = 0; |
|
609 iPslnFWThemeHandler->GetApplicationSkinsL(KUidActiveIdle); |
|
610 } |
|
611 |
|
612 // --------------------------------------------------------------------------- |
|
613 // Restart AI2 process |
|
614 // --------------------------------------------------------------------------- |
|
615 // |
|
616 TInt CPslnActiveIdlePluginEngine::RestartAifw() |
|
617 { |
|
618 if (!IsAiRunning()) |
|
619 { |
|
620 _LIT(KAiExeName, "z:\\sys\\bin\\ailaunch.exe"); |
|
621 RProcess process; |
|
622 TInt ret = process.Create(KAiExeName, KNullDesC); |
|
623 process.Resume(); |
|
624 process.Close(); |
|
625 return ret; |
|
626 } |
|
627 return KErrNone; |
|
628 } |
|
629 |
|
630 // --------------------------------------------------------------------------- |
|
631 // Checks if AI2 process is running |
|
632 // --------------------------------------------------------------------------- |
|
633 // |
|
634 TBool CPslnActiveIdlePluginEngine::IsAiRunning() |
|
635 { |
|
636 TApaTaskList taskList(CCoeEnv::Static()->WsSession()); |
|
637 TApaTask startTask = taskList.FindApp(TUid::Uid(0x100058f4)); |
|
638 |
|
639 if (!startTask.Exists()) // if first boot queries are done continue bringing ai2 to foreground. |
|
640 { |
|
641 TApaTask aiTask = taskList.FindApp(TUid::Uid(AI_UID3_AIFW_EXE)); |
|
642 if (aiTask.Exists()) // App open |
|
643 { |
|
644 return ETrue; |
|
645 } |
|
646 } |
|
647 return EFalse; |
|
648 } |
|
649 |
|
650 // --------------------------------------------------------------------------- |
|
651 // start ui refresh timer |
|
652 // --------------------------------------------------------------------------- |
|
653 // |
|
654 void CPslnActiveIdlePluginEngine::UiTimerRestart() |
|
655 { |
|
656 iUiRefreshTimer->Cancel(); |
|
657 iUiRefreshTimer->Start( |
|
658 KPSLNOneSecondInMicroSeconds/4, // quarter second delay |
|
659 KPSLNOneSecondInMicroSeconds/4, |
|
660 TCallBack(UiRefreshTimerCallback, this)); |
|
661 } |
|
662 |
|
663 // --------------------------------------------------------------------------- |
|
664 // Call back for restart timer |
|
665 // --------------------------------------------------------------------------- |
|
666 // |
|
667 TInt CPslnActiveIdlePluginEngine::RestartTimerCallback(TAny* aSelf) |
|
668 { |
|
669 CPslnActiveIdlePluginEngine* self = |
|
670 static_cast<CPslnActiveIdlePluginEngine*>(aSelf); |
|
671 |
|
672 if (self) |
|
673 { |
|
674 ++(self->iRestartRetryCount); |
|
675 if ( self->RestartAifw() == KErrNone) |
|
676 { |
|
677 self->iRestartTimer->Cancel(); |
|
678 TApaTaskList taskList(CCoeEnv::Static()->WsSession()); |
|
679 TApaTask startTask = taskList.FindApp(TUid::Uid(0x100058f4)); |
|
680 |
|
681 if (!startTask.Exists()) // if first boot queries are done continue bringing ai2 to foreground. |
|
682 { |
|
683 TApaTask aiTask = taskList.FindApp(TUid::Uid(AI_UID3_AIFW_EXE)); |
|
684 if (aiTask.Exists()) // App open |
|
685 { |
|
686 //aiTask.BringToForeground(); |
|
687 CAknSgcClient::MoveApp(aiTask.WgId(), ESgcMoveAppToForeground); |
|
688 } |
|
689 } |
|
690 CAknEnv::RunAppShutter(); |
|
691 return 0; |
|
692 } |
|
693 if (self->iRestartRetryCount > 3) |
|
694 { |
|
695 self->iRestartTimer->Cancel(); |
|
696 TRAP_IGNORE(self->ManualGetSkinsRestartL()); |
|
697 return 0; |
|
698 } |
|
699 } |
|
700 return 1; |
|
701 } |
|
702 |
|
703 // --------------------------------------------------------------------------- |
|
704 // Call back for UI refresh timer timer |
|
705 // --------------------------------------------------------------------------- |
|
706 // |
|
707 TInt CPslnActiveIdlePluginEngine::UiRefreshTimerCallback(TAny* aSelf) |
|
708 { |
|
709 CPslnActiveIdlePluginEngine* self = |
|
710 static_cast<CPslnActiveIdlePluginEngine*>(aSelf); |
|
711 |
|
712 if (self) |
|
713 { |
|
714 self->iUiRefreshTimer->Cancel(); |
|
715 TRAP_IGNORE(self->AddThemesToContainerL()); |
|
716 if( self->iPlugin->Container() ) |
|
717 { |
|
718 self->iPlugin->Container()->RefreshList(); |
|
719 } |
|
720 } |
|
721 return 0; |
|
722 } |
|
723 |
|
724 // End of File. |
|