|
1 /* |
|
2 * Copyright (c) 2002-2008 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: Skin server core class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "AknsSrv.h" |
|
21 |
|
22 #include <e32svr.h> |
|
23 #include <AknLayoutDef.h> |
|
24 #include <DRMHelper.h> |
|
25 #include <Oma2Agent.h> |
|
26 #include <bautils.h> |
|
27 #include <hal.h> |
|
28 #include <AknSkinsInternalCRKeys.h> |
|
29 #include <centralrepository.h> |
|
30 #include "tfxconfigparser.h" |
|
31 #include <TfxSrvEcomIds.h> |
|
32 #include <apgwgnam.h> |
|
33 |
|
34 |
|
35 #include "AknsSrvSettings.h" |
|
36 #include "AknsSrvScheduler.h" |
|
37 #include "AknsSkinContent.h" |
|
38 #include <AknsSkinUID.h> |
|
39 #include "AknsSrvUtils.h" |
|
40 #include "AknsSrvExclusion.h" |
|
41 #include "AknsSrvBitmapStore.h" |
|
42 #include "aknssrvwallpaperscaling.h" |
|
43 #include "aknssrvactivedataowner.h" |
|
44 #include "AknsDriveMaster.h" |
|
45 #include "aknssrviconconfigmap.h" |
|
46 |
|
47 #include "AknsDebug.h" |
|
48 |
|
49 _LIT(KTFxDefaultExtensionPath, "z:\\resource\\skins\\"); |
|
50 _LIT(KTFxExtFileExt, ".sel"); |
|
51 |
|
52 // Extension for ini file. |
|
53 _LIT( KAknsSkinSrvIniFileExt, ".ini" ); |
|
54 |
|
55 // Extension for scalable vector graphics file. |
|
56 _LIT( KAknsSkinSrvSvgFileExt, ".svg" ); |
|
57 |
|
58 // No wallpaper |
|
59 const TInt KAknsSkinSrvNoWallpaper = 0; |
|
60 // Image wallpaper |
|
61 const TInt KAknsSkinSrvImageWallpaper = 1; |
|
62 // Slideset wallpaper type |
|
63 const TInt KAknsSkinSrvSlidesetWallpaper = 2; |
|
64 |
|
65 // Filenames and locations of slideset ini-files. |
|
66 _LIT( KAknsSrvSSSSInifile, "\\private\\10207114\\SSSS.ini"); |
|
67 _LIT( KAknsSrvSSWPInifile, "\\private\\10207114\\SSWP.ini"); |
|
68 |
|
69 const TUint KSlidesetEnableAppUid[] = { |
|
70 0x100056cf, // ScreenSaver |
|
71 0x102750f0, // ActiveIdle |
|
72 0x10005a32, // Psln |
|
73 0x10207218, // CapServer |
|
74 0x00000000 // Empty |
|
75 }; |
|
76 |
|
77 // ============================ MEMBER FUNCTIONS =============================== |
|
78 |
|
79 // ----------------------------------------------------------------------------- |
|
80 // CAknsSrv::CAknsSrv |
|
81 // C++ constructor can NOT contain any code, that might leave. |
|
82 // ----------------------------------------------------------------------------- |
|
83 // |
|
84 CAknsSrv::CAknsSrv() : |
|
85 CServer2( CActive::EPriorityStandard), |
|
86 iNotifyEnabled( ETrue ), |
|
87 iContentChanged( EFalse ), |
|
88 iOutstandingChangeEvents( 0 ) |
|
89 { |
|
90 } |
|
91 |
|
92 // ----------------------------------------------------------------------------- |
|
93 // CAknsSrv::New |
|
94 // ----------------------------------------------------------------------------- |
|
95 // |
|
96 CAknsSrv* CAknsSrv::New( TBool &aStartFailed ) |
|
97 { |
|
98 AKNS_TRACE_INFO("CAknsSrv::New STARTED"); |
|
99 |
|
100 aStartFailed = EFalse; |
|
101 |
|
102 CAknsSrv* server = new CAknsSrv(); |
|
103 server->iMergeType = (TAknsSkinSrvMergeType)( |
|
104 EAknsSkinSrvSkin | EAknsSkinSrvIdleWp ); |
|
105 server->iBootFinished = EFalse; |
|
106 if ( server ) |
|
107 { |
|
108 if ( server->Start( KAknSkinSrvName ) != KErrNone ) |
|
109 { |
|
110 AKNS_TRACE_ERROR("CAknsSrv::New START FAILED!"); |
|
111 |
|
112 aStartFailed = ETrue; |
|
113 delete server; |
|
114 return NULL; |
|
115 } |
|
116 } |
|
117 else |
|
118 { |
|
119 AKNS_TRACE_ERROR("CAknsSrv::New SERVER ALLOCATION FAILED!"); |
|
120 return NULL; |
|
121 } |
|
122 server->iBitmapStore = new CAknsSrvBitmapStore; |
|
123 if( !server->iBitmapStore ) |
|
124 { |
|
125 AKNS_TRACE_ERROR("CAknsSrv::New BITMAPSTORE CREATION FAILED!"); |
|
126 delete server; |
|
127 return NULL; |
|
128 } |
|
129 server->iChunkMaintainer = |
|
130 new CAknsSrvChunkMaintainer(server->iBitmapStore); |
|
131 if( !server->iChunkMaintainer ) |
|
132 { |
|
133 AKNS_TRACE_ERROR("CAknsSrv::New CHUNK CREATION FAILED!"); |
|
134 delete server; |
|
135 return NULL; |
|
136 } |
|
137 |
|
138 TInt err = server->iFsSession.Connect(); |
|
139 AKNS_TRACE_INFO1("CAknsSrv::New RFs connected, ret=%d", err); |
|
140 |
|
141 AKNS_TRACE_INFO("CAknsSrv::New server up, connecting shared data"); |
|
142 |
|
143 TInt errorCode( KErrNone ); |
|
144 TRAP( errorCode, (server->iSettings=CAknsSrvSettings::NewL(server, server->iFsSession )) ); |
|
145 if( errorCode ) |
|
146 { |
|
147 AKNS_TRACE_ERROR("CAknsSrv::New SETTING MANAGER CREATION FAILED!"); |
|
148 delete server; |
|
149 return NULL; |
|
150 } |
|
151 |
|
152 AKNS_TRACE_INFO("CAknsSrv::New Settings manager created"); |
|
153 |
|
154 TRAPD( exlListErr, server->iExclusionList = |
|
155 CAknsSrvExclusionList::NewL() ); |
|
156 AKNS_TRACE_INFO1("CAknsSrv::New Exclusion list init, ret=%d", exlListErr); |
|
157 if( exlListErr == KErrNone ) |
|
158 { |
|
159 TRAP( exlListErr, server->iExclusionList->LoadDefaultListFromFileL( server->iFsSession ) ); |
|
160 AKNS_TRACE_INFO1("CAknsSrv::New Exclusion list loaded, ret=%d", exlListErr); |
|
161 if( exlListErr != KErrNone ) |
|
162 { |
|
163 delete server->iExclusionList; |
|
164 server->iExclusionList = NULL; |
|
165 } |
|
166 } |
|
167 |
|
168 // Connection to Fbs-server is needed for server side bitmaps |
|
169 // and should allways be kept connected. |
|
170 err = server->iFbsSession.Connect(); |
|
171 AKNS_TRACE_INFO1("CAknsSrv::New FBS connected, ret=%d", err); |
|
172 |
|
173 TRAP( errorCode, server->iSettings->InstallAdditionalWatchersL() ); |
|
174 AKNS_TRACE_INFO1("CAknsSrv::New Additional watchers installed, ret=%d", errorCode); |
|
175 |
|
176 server->InitSlidesetEnableAppUid(); |
|
177 |
|
178 TRAP_IGNORE( server->InitMaxImageSizeL() ); |
|
179 |
|
180 TRAP( errorCode,server->iWallpaperCache = CAknsSrvWallpaperCache::NewL( KAknsWallpaperCacheSize ) ); |
|
181 |
|
182 AKNS_TRACE_INFO("CAknsSrv::New PrepareMergedSkinContentL"); |
|
183 TRAPD( mergeErr, server->PrepareMergedSkinContentL() ); |
|
184 if( mergeErr != KErrNone ) |
|
185 { |
|
186 AKNS_TRACE_ERROR1("CAknsSrv::New MERGE ERROR %i", mergeErr); |
|
187 server->SetDefaultSkinActive(); |
|
188 server->RestoreDefaultSDSettings(); |
|
189 TRAP( mergeErr, server->PrepareMergedSkinContentL() ); |
|
190 AKNS_TRACE_INFO1("CAknsSrv::New FALLBACK MERGE, ret=%d", mergeErr); |
|
191 __ASSERT_DEBUG( mergeErr==KErrNone, User::Panic( |
|
192 KAknSkinSrvPanicCategory, EAknsSrvFatalMergeFailure ) ); |
|
193 } |
|
194 |
|
195 TRAP(err, server->iBackupSession = CBaBackupSessionWrapper::NewL() ); |
|
196 AKNS_TRACE_INFO1("CAknsSrv::New Backup session wrapper created, ret=%d", err); |
|
197 if( server->iBackupSession ) |
|
198 { |
|
199 TRAP(err, server->iBackupSession->RegisterBackupOperationObserverL( |
|
200 *(server->iSettings) ) ); |
|
201 AKNS_TRACE_INFO1("CAknsSrv::New Backup observer registered, ret=%d", err); |
|
202 } |
|
203 TRAP( err, server->iBackupNotifier = CAknsSrvActiveDataOwner::NewL( server->iFsSession ) ); |
|
204 AKNS_TRACE_INFO1("CAknsSrv::New Backup notifier created, ret=%d", err); |
|
205 |
|
206 AKNS_TRACE_INFO("CAknsSrv::New COMPLETED"); |
|
207 |
|
208 TRAP(err,server->iInstallObserver = CAknsSrvFileObserver::NewL(server)); |
|
209 server->iInstallObserver->IssueRequest(); |
|
210 |
|
211 server->iMergeType = EAknsSkinSrvNone; |
|
212 server->iBootFinished = ETrue; |
|
213 server->iWallpaperType = server->iSettings->WallpaperType(); |
|
214 |
|
215 |
|
216 return server; |
|
217 } |
|
218 |
|
219 // ----------------------------------------------------------------------------- |
|
220 // Destructor. |
|
221 // ----------------------------------------------------------------------------- |
|
222 // |
|
223 CAknsSrv::~CAknsSrv() |
|
224 { |
|
225 // In theory we should never get here, since the server is always running. |
|
226 |
|
227 delete iWPFilename; |
|
228 iWPFilename = NULL; |
|
229 |
|
230 if( iBackupSession ) |
|
231 { |
|
232 iBackupSession->DeRegisterBackupOperationObserver( *iSettings ); |
|
233 delete iBackupSession; |
|
234 iBackupSession = NULL; |
|
235 } |
|
236 delete iExclusionList; |
|
237 delete iSettings; |
|
238 delete iInstallObserver; |
|
239 delete iWallpaperObserver; |
|
240 iFbsSession.Disconnect(); |
|
241 iFsSession.Close(); |
|
242 iSknFile.Close(); |
|
243 |
|
244 delete iDrmHelper; |
|
245 delete iBitmapStore; |
|
246 delete iChunkMaintainer; |
|
247 delete iSkinContentUri; |
|
248 delete iIdleWPContentUri; |
|
249 delete iSkinContentUri2; |
|
250 delete iIdleWPContentUri2; |
|
251 |
|
252 delete iWallpaperTimer; |
|
253 |
|
254 delete iSlideSetObserver; |
|
255 if ( iSlideSetNameArray ) |
|
256 { |
|
257 iSlideSetNameArray->Reset(); |
|
258 } |
|
259 delete iSlideSetNameArray; |
|
260 delete iBackupNotifier; |
|
261 delete iIconConfigMap; |
|
262 |
|
263 iWallpaperCache->ResetAndDestory( ); |
|
264 |
|
265 iSlidesetEnableAppUidArray.Close(); |
|
266 } |
|
267 |
|
268 // ----------------------------------------------------------------------------- |
|
269 // CAknsSrv::NewSessionL |
|
270 // ----------------------------------------------------------------------------- |
|
271 // |
|
272 CSession2* CAknsSrv::NewSessionL(const TVersion& aVersion, const RMessage2& /*aMessage*/) const |
|
273 { |
|
274 // Check that we're the right version |
|
275 TVersion v( KAknSkinSrvMajorVersionNumber, |
|
276 KAknSkinSrvMinorVersionNumber, |
|
277 KAknSkinSrvBuildVersionNumber); |
|
278 if ( !User::QueryVersionSupported(v, aVersion) ) |
|
279 { |
|
280 User::Leave( KErrNotSupported ); |
|
281 } |
|
282 // Make a new session |
|
283 return new(ELeave) CAknsSrvSession( ); |
|
284 } |
|
285 |
|
286 // ----------------------------------------------------------------------------- |
|
287 // CAknSkinSrv::ThreadStart() |
|
288 // The skin server thread. |
|
289 // ----------------------------------------------------------------------------- |
|
290 // |
|
291 EXPORT_C TInt CAknsSrv::ThreadStart() |
|
292 { |
|
293 // Rename own thread |
|
294 User::RenameThread(KAknSkinSrvName); |
|
295 |
|
296 CAknsSrv* server = NULL; |
|
297 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
298 CActiveScheduler* scheduler = new CAknsSrvScheduler; |
|
299 TInt err(KErrNone); |
|
300 |
|
301 TBool startFailed(EFalse); |
|
302 |
|
303 if ( cleanup && scheduler ) |
|
304 { |
|
305 CActiveScheduler::Install( scheduler ); |
|
306 server = CAknsSrv::New( startFailed ); // Adds server in scheduler |
|
307 } |
|
308 |
|
309 if ( !cleanup || !scheduler || !server ) |
|
310 { |
|
311 delete cleanup; |
|
312 delete scheduler; |
|
313 delete server; |
|
314 |
|
315 err = KErrNoMemory; |
|
316 |
|
317 if(startFailed) |
|
318 { |
|
319 // Server Start call failed (means really that the server already existed) |
|
320 err = KErrAlreadyExists; |
|
321 } |
|
322 |
|
323 } |
|
324 if ( err == KErrNone ) |
|
325 { |
|
326 // Prevent killing skin server from other processes |
|
327 User::SetProcessCritical(User::ESystemCritical); |
|
328 User::SetCritical(User::ESystemCritical); |
|
329 |
|
330 // Signal that we've started |
|
331 RProcess::Rendezvous(KErrNone); |
|
332 |
|
333 // Start fielding requests from clients |
|
334 CActiveScheduler::Start(); |
|
335 |
|
336 // Comes here if server gets shut down |
|
337 delete scheduler; //lint !e644 Initialized |
|
338 delete cleanup; //lint !e644 Initialized |
|
339 delete server; //lint !e644 Initialized |
|
340 } |
|
341 |
|
342 // Thread/process exit |
|
343 return( err ); |
|
344 } |
|
345 |
|
346 // ----------------------------------------------------------------------------- |
|
347 // CAknsSrv::NotifyBackupOperationEnd |
|
348 // ----------------------------------------------------------------------------- |
|
349 // |
|
350 void CAknsSrv::NotifyBackupOperationEnd() |
|
351 { |
|
352 RestoreOldSkin(); |
|
353 } |
|
354 |
|
355 // ----------------------------------------------------------------------------- |
|
356 // CAknsSrv::NotifyLayoutChange |
|
357 // ----------------------------------------------------------------------------- |
|
358 // |
|
359 void CAknsSrv::NotifyLayoutChange(TBool aClearScalable) |
|
360 { |
|
361 #ifdef __WINS__ |
|
362 // for emulator only, flush the cache also as |
|
363 // it is possible to perform "illegal" layout changes |
|
364 // ie. landscape -> landscape |
|
365 |
|
366 if (aClearScalable) |
|
367 { |
|
368 iChunkMaintainer->ClearScalableGraphics(EAknsSrcScrModeNone); |
|
369 } |
|
370 |
|
371 #endif // __WINS__ |
|
372 iContentChanged = ETrue; |
|
373 |
|
374 if( !iSettings->CachedBackupOperationInProgress() ) |
|
375 { |
|
376 MergeAndBroadcast(); |
|
377 } |
|
378 } |
|
379 |
|
380 // ----------------------------------------------------------------------------- |
|
381 // CAknsSrv::NotifySkinChange |
|
382 // ----------------------------------------------------------------------------- |
|
383 // |
|
384 void CAknsSrv::NofifySkinChange() |
|
385 { |
|
386 if (iUSBAttached) |
|
387 { |
|
388 return; |
|
389 } |
|
390 iContentChanged = ETrue; |
|
391 |
|
392 if( !iSettings->CachedBackupOperationInProgress() ) |
|
393 { |
|
394 MergeAndBroadcast(); |
|
395 } |
|
396 } |
|
397 |
|
398 // ----------------------------------------------------------------------------- |
|
399 // CAknsSrv::NotifyIdleBackgroundChange |
|
400 // ----------------------------------------------------------------------------- |
|
401 // |
|
402 void CAknsSrv::NotifyIdleBackgroundChange() |
|
403 { |
|
404 iContentChanged = ETrue; |
|
405 iMergeType = (TAknsSkinSrvMergeType)(iMergeType | EAknsSkinSrvIdleWp); |
|
406 |
|
407 if( !iSettings->CachedBackupOperationInProgress() ) |
|
408 { |
|
409 MergeAndBroadcast(); |
|
410 } |
|
411 } |
|
412 |
|
413 // ----------------------------------------------------------------------------- |
|
414 // CAknsSrv::NotifyDRMChange |
|
415 // ----------------------------------------------------------------------------- |
|
416 // |
|
417 void CAknsSrv::NotifyDRMChange() |
|
418 { |
|
419 TRAP_IGNORE ( NotifyDRMChangeL() ); |
|
420 } |
|
421 |
|
422 // ----------------------------------------------------------------------------- |
|
423 // CAknsSrv::NotifyDRMChangeL |
|
424 // ----------------------------------------------------------------------------- |
|
425 // |
|
426 void CAknsSrv::NotifyDRMChangeL() |
|
427 { |
|
428 AKNS_TRACE_INFO("CAknsSrv::NofifyDRMChange - DrmHelper notification"); |
|
429 CheckAndCreateDRMHelper(); |
|
430 |
|
431 TInt size = 256; |
|
432 HBufC* buf = HBufC::NewLC(size); |
|
433 TPtr bufPtr = buf->Des(); |
|
434 |
|
435 TInt error = iSettings->ReadDRMHelperServerNotification( bufPtr ); |
|
436 AKNS_TRACE_INFO1("CAknsSrv::NofifyDRMChange - ReadDRMHelperServerNotification: %d", error ); |
|
437 |
|
438 HBufC8* buf8 = HBufC8::New((buf->Length())*2); |
|
439 CleanupStack::PushL(buf8); |
|
440 const unsigned char* ptr = (const unsigned char*)(buf->Ptr()); |
|
441 |
|
442 buf8->Des().Copy(ptr,(buf->Length())*2); |
|
443 TInt8 count = (TInt8)(*(buf8->Ptr())); |
|
444 TChar mark = (TChar)(*(buf8->Ptr()+1)); |
|
445 TInt8 permtype = (TChar)(*(buf8->Ptr()+2)); |
|
446 TInt8 automcontenttype = (TChar)(*(buf8->Ptr()+3)); |
|
447 TBuf8<256> curi = buf8->Right( buf8->Length()-4); |
|
448 if (curi.Ptr()[curi.Size()-1] == 0) |
|
449 { |
|
450 // The last character in the descriptor is 0, which means |
|
451 // that the original 16-bit desc was padded so |
|
452 // remove the last char... |
|
453 curi.SetLength(curi.Size()-1); |
|
454 } |
|
455 |
|
456 if (mark == 'V') |
|
457 { |
|
458 AKNS_TRACE_INFO1("CAknsSrv::NotifyDRMChange DrmHelper notification type V received, count=%d",count); |
|
459 if (count > 0) |
|
460 { |
|
461 if (iSkinContentUri && iSkinContentUri->Compare(curi) == 0) |
|
462 { |
|
463 AKNS_TRACE_INFO("CAknsSrv::NotifyDRMChange Skin is valid but about to expire"); |
|
464 iDrmHelper->SetAutomatedType(CDRMHelper::EAutomatedTypeTheme); |
|
465 iDrmHelper->CheckRightsAmountL( *iSkinContentUri); |
|
466 } |
|
467 if ( iIdleWPContentUri && iIdleWPContentUri->Compare(curi) == 0) |
|
468 { |
|
469 AKNS_TRACE_INFO("CAknsSrv::NotifyDRMChange IdleWP is valid but about to expire"); |
|
470 iDrmHelper->SetAutomatedType(CDRMHelper::EAutomatedTypeWallpaper); |
|
471 iDrmHelper->CheckRightsAmountL( *iIdleWPContentUri); |
|
472 } |
|
473 } |
|
474 } |
|
475 else if (mark == 'E') |
|
476 { |
|
477 AKNS_TRACE_INFO1("CAknsSrv::NotifyDRMChange DrmHelper notification type E received, count=%d",count); |
|
478 |
|
479 if (count == 0) |
|
480 { |
|
481 // Expire skins here..., no note |
|
482 if (iSkinContentUri && iSkinContentUri->Compare(curi) == 0) |
|
483 { |
|
484 AKNS_TRACE_INFO("CAknsSrv::NotifyDRMChange Skin is expired"); |
|
485 iSkinContentUri2 = (*iSkinContentUri).AllocL(); |
|
486 delete iSkinContentUri; iSkinContentUri = NULL; |
|
487 RestoreDefaultSkin(); |
|
488 // Merge and broadcast |
|
489 iContentChanged = ETrue; |
|
490 MergeAndBroadcast(); |
|
491 // Also notify potential package list update |
|
492 ForceNotifySessions(EAknsSCHNPackageListUpdate); |
|
493 } |
|
494 if (iIdleWPContentUri && iIdleWPContentUri->Compare(curi) == 0) |
|
495 { |
|
496 AKNS_TRACE_INFO("CAknsSrv::NotifyDRMChange IdleWP is expired"); |
|
497 iIdleWPContentUri2 = (*iIdleWPContentUri).AllocL(); |
|
498 delete iIdleWPContentUri; |
|
499 iIdleWPContentUri = NULL; |
|
500 |
|
501 if ( iWallpaperType == KAknsSkinSrvSlidesetWallpaper ) |
|
502 { |
|
503 TBool isProtected = EFalse; |
|
504 if ( iSlideSetNameArray && iSlideSetNameArray->MdcaCount() ) |
|
505 { |
|
506 TFileName wallpaper; |
|
507 iSettings->ReadIdleBackgroundFile( wallpaper ); |
|
508 CheckImageL( wallpaper, isProtected ); |
|
509 } |
|
510 if ( isProtected ) |
|
511 { |
|
512 iCurrentSlide = iCurrentSlide ? (iCurrentSlide - 1): (iSlideSetNameArray->MdcaCount() - 1); |
|
513 WallpaperTimerTimeoutL( ETrue ); |
|
514 } |
|
515 } |
|
516 else |
|
517 { |
|
518 RestoreDefaultIdleWP(); |
|
519 // Merge and broadcast |
|
520 iContentChanged = ETrue; |
|
521 MergeAndBroadcast(); |
|
522 // Also notify potential package list update |
|
523 ForceNotifySessions(EAknsSCHNPackageListUpdate); |
|
524 } |
|
525 } |
|
526 } |
|
527 else if (count > 0) |
|
528 { |
|
529 // Show expiration notes... |
|
530 if (iSkinContentUri2 && iSkinContentUri2->Compare(curi) == 0) |
|
531 { |
|
532 AKNS_TRACE_INFO("CAknsSrv::NotifyDRMChange: RemoveAutomated called for skin"); |
|
533 iDrmHelper->SetAutomatedType(CDRMHelper::EAutomatedTypeTheme); |
|
534 iDrmHelper->CheckRightsAmountL( *iSkinContentUri2); |
|
535 User::LeaveIfError(iDrmHelper->RemoveAutomated( *iSkinContentUri2 )); |
|
536 delete iSkinContentUri2; |
|
537 iSkinContentUri2 = NULL; |
|
538 } |
|
539 if (iIdleWPContentUri2 && iIdleWPContentUri2->Compare(curi) == 0) |
|
540 { |
|
541 AKNS_TRACE_INFO("CAknsSrv::NotifyDRMChange: RemoveAutomated called for idlewp"); |
|
542 iDrmHelper->SetAutomatedType(CDRMHelper::EAutomatedTypeWallpaper); |
|
543 iDrmHelper->CheckRightsAmountL( *iIdleWPContentUri2); |
|
544 User::LeaveIfError(iDrmHelper->RemoveAutomated( *iIdleWPContentUri2 )); |
|
545 delete iIdleWPContentUri2; |
|
546 iIdleWPContentUri2 = NULL; |
|
547 } |
|
548 } |
|
549 } |
|
550 |
|
551 CleanupStack::PopAndDestroy(2); //buf, buf8 |
|
552 } |
|
553 |
|
554 // ----------------------------------------------------------------------------- |
|
555 // CAknsSrv::NotifySlideSetTimeoutChange |
|
556 // ----------------------------------------------------------------------------- |
|
557 // |
|
558 void CAknsSrv::NotifySlideSetTimeoutChange() |
|
559 { |
|
560 // If timeout has not changed, then resume. |
|
561 TInt newtimeout = iSettings->SlideSetWPTimeout(); |
|
562 if (iWallpaperTimer && iWallpaperTimer->Interval() == newtimeout) |
|
563 { |
|
564 return; |
|
565 } |
|
566 // only do this if slideset is selected |
|
567 if ( iSettings->WallpaperType() == KAknsSkinSrvSlidesetWallpaper && |
|
568 iSlideSetNameArray ) |
|
569 { |
|
570 TRAP_IGNORE( SetSlideSetTimerActiveL() ); |
|
571 } |
|
572 } |
|
573 |
|
574 // ----------------------------------------------------------------------------- |
|
575 // CAknsSrv::NotifySlideSetTypeChange |
|
576 // ----------------------------------------------------------------------------- |
|
577 // |
|
578 void CAknsSrv::NotifySlideSetTypeChange() |
|
579 { |
|
580 } |
|
581 |
|
582 // ----------------------------------------------------------------------------- |
|
583 // CAknsSrv::NotifyWallpaperTypeChange |
|
584 // ----------------------------------------------------------------------------- |
|
585 // |
|
586 void CAknsSrv::NotifyWallpaperTypeChange() |
|
587 { |
|
588 if ( iSlideSetObserver ) |
|
589 { |
|
590 iSlideSetObserver->Cancel(); |
|
591 } |
|
592 delete iSlideSetObserver; |
|
593 iSlideSetObserver = NULL; |
|
594 |
|
595 TInt newtype = iSettings->WallpaperType(); |
|
596 // do nothing if the type does not change |
|
597 if (newtype != iWallpaperType) |
|
598 { |
|
599 // none |
|
600 if ( newtype == KAknsSkinSrvNoWallpaper ) |
|
601 { |
|
602 WallpaperLost(); |
|
603 } |
|
604 // normal |
|
605 else if ( newtype == KAknsSkinSrvImageWallpaper ) |
|
606 { |
|
607 TFileName filename; |
|
608 TInt error = iSettings->ReadIdleBackgroundFile( filename ); |
|
609 if( (error == KErrNone) && (filename.Length()>0)) |
|
610 { |
|
611 if (AknsSrvUtils::IsFile( iFsSession, filename ) ) |
|
612 { |
|
613 TRAP_IGNORE( |
|
614 SetWallpaperL( filename,KAknsIIDWallpaper ) ); |
|
615 } |
|
616 else |
|
617 { |
|
618 iSettings->WriteIdleBackgroundToDefault(); |
|
619 } |
|
620 } |
|
621 } |
|
622 //slideset |
|
623 else if ( newtype == KAknsSkinSrvSlidesetWallpaper ) |
|
624 { |
|
625 TRAPD( err, SetSlidesetWallpaperL()); |
|
626 if ( err != KErrNone ) |
|
627 { |
|
628 iSettings->WriteIdleBackgroundToDefault(); |
|
629 } |
|
630 } |
|
631 iWallpaperType = iSettings->WallpaperType(); |
|
632 } |
|
633 } |
|
634 |
|
635 // ----------------------------------------------------------------------------- |
|
636 // CAknsSrv::NotifyScreenSaverChange |
|
637 // ----------------------------------------------------------------------------- |
|
638 // |
|
639 void CAknsSrv::NotifyScreenSaverChange() |
|
640 { |
|
641 // If screensaver is now off => try to change the image. |
|
642 TInt newValue = iSettings->ScreensaverState(); |
|
643 if ( newValue == 0 ) |
|
644 { |
|
645 TRAP_IGNORE( WallpaperTimerTimeoutL() ); |
|
646 } |
|
647 } |
|
648 |
|
649 // ----------------------------------------------------------------------------- |
|
650 // CAknsSrv::NotifyTransitionFxChange |
|
651 // ----------------------------------------------------------------------------- |
|
652 // |
|
653 void CAknsSrv::NotifyTransitionFxChange() |
|
654 { |
|
655 if (iSettings->TransitionFxState() == KMaxTInt) |
|
656 { |
|
657 StopTransitionSrv(); |
|
658 } |
|
659 else |
|
660 { |
|
661 TRAPD(err,StartTransitionSrvL()); |
|
662 if (err) |
|
663 { |
|
664 StopTransitionSrv(); |
|
665 } |
|
666 } |
|
667 } |
|
668 |
|
669 // ----------------------------------------------------------------------------- |
|
670 // CAknsSrv::NotifyAnimEffectsChange |
|
671 // ----------------------------------------------------------------------------- |
|
672 // |
|
673 void CAknsSrv::NotifyAnimBackgroundChange() |
|
674 { |
|
675 ForceNotifySessions( EAknsSCHNAnimBackgroundChanged ); |
|
676 } |
|
677 // ----------------------------------------------------------------------------- |
|
678 // CAknsSrv::StartTransitionSrvL |
|
679 // ----------------------------------------------------------------------------- |
|
680 // |
|
681 void CAknsSrv::StartTransitionSrvL(TBool aSkipSrvStart /*EFalse*/) |
|
682 { |
|
683 // if the transition server is running, |
|
684 // shutdown it first in case TFX server start is not skipped |
|
685 if (!aSkipSrvStart) |
|
686 { |
|
687 StopTransitionSrv(); |
|
688 User::LeaveIfError(iWsSession.Connect()); |
|
689 } |
|
690 |
|
691 if ( ( iSettings->TransitionFxState() != KMaxTInt ) && LoadTfxSrvPluginL()) |
|
692 { |
|
693 // If the server was already running unregister all the kml files |
|
694 if (aSkipSrvStart) |
|
695 { |
|
696 if (!iTFXServer->IsConnected()) |
|
697 { |
|
698 User::LeaveIfError(iTFXServer->Connect()); |
|
699 } |
|
700 User::LeaveIfError(iTFXServer->UnregisterAllKml()); |
|
701 } |
|
702 CTFXConfigParser* parser = CTFXConfigParser::NewL(); |
|
703 CleanupStack::PushL( parser ); |
|
704 |
|
705 TFileName transitionName; |
|
706 |
|
707 // get active skin's transition |
|
708 GetTransitionNameL( transitionName, iSettings->CachedSkinPID() ); |
|
709 |
|
710 TRAPD( err, StartSrvAndRegisterTransitionsL( transitionName, |
|
711 iTFXServer, |
|
712 iTFXServerCtrl, |
|
713 parser, |
|
714 aSkipSrvStart ) ); |
|
715 // base skin definition encountered |
|
716 if( err == KBaseSkinParserLeave ) |
|
717 { |
|
718 _LIT( KHexPrefix, "0x"); |
|
719 const TInt KUidLenght = 20; |
|
720 |
|
721 TAknsPkgID baseSkinId = KAknsNullPkgID; |
|
722 TBuf<KUidLenght> baseSkinDesc; |
|
723 baseSkinDesc.Append( KHexPrefix ); |
|
724 baseSkinDesc.Append( parser->BaseSkinSelFile() ); |
|
725 |
|
726 TRAPD( err2, baseSkinId.SetFromDesL( baseSkinDesc ) ); |
|
727 if( err2 == KErrNone ) |
|
728 { |
|
729 GetTransitionNameL( transitionName, baseSkinId ); |
|
730 |
|
731 // register base skin transitions |
|
732 StartSrvAndRegisterTransitionsL( transitionName, |
|
733 iTFXServer, |
|
734 iTFXServerCtrl, |
|
735 parser, |
|
736 aSkipSrvStart ); |
|
737 } |
|
738 |
|
739 // then register current skin's transitions |
|
740 //(overrides base skin ones if overlapping) |
|
741 |
|
742 GetTransitionNameL( transitionName, iSettings->CachedSkinPID() ); |
|
743 |
|
744 StartSrvAndRegisterTransitionsL( transitionName, |
|
745 iTFXServer, |
|
746 iTFXServerCtrl, |
|
747 parser, |
|
748 ETrue ); // server already running |
|
749 } |
|
750 else |
|
751 { |
|
752 User::LeaveIfError( err ); |
|
753 } |
|
754 CleanupStack::PopAndDestroy( parser ); |
|
755 } |
|
756 // if leave happens before this point, StopTransitionSrv is called |
|
757 // which closes handle to tfxserver / deletes tfxserver ctrl |
|
758 CloseTfxServerConnection(); |
|
759 } |
|
760 |
|
761 // ----------------------------------------------------------------------------- |
|
762 // CAknsSrv::StopTransitionSrv |
|
763 // ----------------------------------------------------------------------------- |
|
764 // |
|
765 void CAknsSrv::StopTransitionSrv() |
|
766 { |
|
767 CloseTfxServerConnection(); |
|
768 |
|
769 if (iTFXServerCtrl) |
|
770 { |
|
771 iTFXServerCtrl->StopTransitionServer(); |
|
772 delete iTFXServerCtrl; |
|
773 iTFXServerCtrl = NULL; |
|
774 |
|
775 REComSession::DestroyedImplementation( iSrvControllerEComDtorUID ); |
|
776 iSrvControllerEComDtorUID.iUid = 0; |
|
777 } |
|
778 |
|
779 iWsSession.Close(); |
|
780 } |
|
781 |
|
782 // ----------------------------------------------------------------------------- |
|
783 // CAknsSrv::NotifyDriveChange |
|
784 // |
|
785 // ----------------------------------------------------------------------------- |
|
786 // |
|
787 void CAknsSrv::NotifyDriveChange( const TInt& aDrive, const TBool& aMediaNotPresent ) |
|
788 { |
|
789 // USB attachement is handled via other notifications. |
|
790 if (iUSBAttached) |
|
791 { |
|
792 return; |
|
793 } |
|
794 if ( aMediaNotPresent && !iSettings->CachedBackupOperationInProgress()) |
|
795 { |
|
796 if ( iSkinOnRemovableDrive && aDrive == iDriveIdOfRemovableDrive ) |
|
797 { |
|
798 TAknsPkgID skinPID = iSettings->CachedSkinPID(); |
|
799 TBool excludeWP = EFalse; |
|
800 if ( iSettings->WallpaperType() == KAknsSkinSrvSlidesetWallpaper ) |
|
801 { |
|
802 excludeWP = ETrue; |
|
803 } |
|
804 SetDefaultSkinActive(); |
|
805 RestoreDefaultSDSettings(excludeWP); |
|
806 MergeAndBroadcast(); |
|
807 } |
|
808 else |
|
809 { |
|
810 // Set previous skin ID as NULL |
|
811 iOldSkin = KAknsNullPkgID; |
|
812 } |
|
813 // Wallpaper was on removable drive and it is no longer accessible. |
|
814 if ( iWPOnRemovableDrive && iWPFilename ) |
|
815 { |
|
816 if ( !AknsSrvUtils::IsFile( iFsSession, *iWPFilename ) ) |
|
817 { |
|
818 iWPOnRemovableDrive = EFalse; |
|
819 WallpaperLost(); |
|
820 } |
|
821 } |
|
822 } |
|
823 } |
|
824 |
|
825 // ----------------------------------------------------------------------------- |
|
826 // CAknsSrv::NotifyBackupOperationBegin |
|
827 // ----------------------------------------------------------------------------- |
|
828 // |
|
829 void CAknsSrv::NotifyBackupOperationBegin() |
|
830 { |
|
831 BackupAndActiveDefaultSkin(); |
|
832 } |
|
833 |
|
834 // ----------------------------------------------------------------------------- |
|
835 // CAknsSrv::NotifyUSBAttach |
|
836 // |
|
837 // ----------------------------------------------------------------------------- |
|
838 // |
|
839 void CAknsSrv::NotifyUSBAttach() |
|
840 { |
|
841 if (iUSBAttached) |
|
842 { |
|
843 return; |
|
844 } |
|
845 iUSBAttached = ETrue; |
|
846 |
|
847 BackupAndActiveDefaultSkin(); |
|
848 } |
|
849 |
|
850 // ----------------------------------------------------------------------------- |
|
851 // CAknsSrv::NotifyUSBRemoval |
|
852 // ----------------------------------------------------------------------------- |
|
853 // |
|
854 void CAknsSrv::NotifyUSBRemoval() |
|
855 { |
|
856 if (!iUSBAttached) |
|
857 { |
|
858 return; |
|
859 } |
|
860 iUSBAttached = EFalse; |
|
861 |
|
862 RestoreOldSkin(); |
|
863 } |
|
864 |
|
865 // ----------------------------------------------------------------------------- |
|
866 // CAknsSrv::MorhphingEventTimeout |
|
867 // ----------------------------------------------------------------------------- |
|
868 // |
|
869 void CAknsSrv::MorhphingEventTimeout() |
|
870 { |
|
871 if( iBootFinished ) |
|
872 { |
|
873 iChunkMaintainer->ClearMorphedGraphics(); |
|
874 iChunkMaintainer->UpdateMorphingTime(); |
|
875 ForceNotifySessions(EAknsSCHNMorphingStateChange); |
|
876 } |
|
877 } |
|
878 |
|
879 // ----------------------------------------------------------------------------- |
|
880 // CAknsSrv::NewSkinPackagesInstalled |
|
881 // ----------------------------------------------------------------------------- |
|
882 // |
|
883 void CAknsSrv::NewSkinPackagesInstalled() |
|
884 { |
|
885 if (iUSBAttached) |
|
886 { |
|
887 return; |
|
888 } |
|
889 |
|
890 ForceNotifySessions( EAknsSCHNPackageListUpdate ); |
|
891 } |
|
892 |
|
893 // ----------------------------------------------------------------------------- |
|
894 // CAknsSrv::WallpaperLost |
|
895 // ----------------------------------------------------------------------------- |
|
896 // |
|
897 void CAknsSrv::WallpaperLost() |
|
898 { |
|
899 if ( iUSBAttached && iWPOnRemovableDrive ) |
|
900 { |
|
901 return; |
|
902 } |
|
903 else if ( iSettings->WallpaperType() == KAknsSkinSrvSlidesetWallpaper ) |
|
904 { |
|
905 TRAP_IGNORE( WallpaperTimerTimeoutL( ETrue ) ); |
|
906 return; |
|
907 } |
|
908 // Does not leave when removing wallpaper. |
|
909 SetWallpaperL( KNullDesC, KAknsIIDWallpaper ); |
|
910 iSettings->WriteIdleBackgroundToDefault(); |
|
911 iMergeType = (TAknsSkinSrvMergeType)(iMergeType | EAknsSkinSrvIdleWp); |
|
912 iContentChanged = ETrue; |
|
913 BroadcastUpdate(); |
|
914 ForceNotifySessions( EAknsSCHNPackageListUpdate ); |
|
915 } |
|
916 |
|
917 // ----------------------------------------------------------------------------- |
|
918 // CAknsSrv::SlideSetModifiedL |
|
919 // ----------------------------------------------------------------------------- |
|
920 // |
|
921 void CAknsSrv::SlideSetModifiedL() |
|
922 { |
|
923 // Read new file name array |
|
924 ReadSlideSetImageFilesL(); |
|
925 |
|
926 SetSlideSetTimerActiveL(); |
|
927 // Try to get the first image. |
|
928 WallpaperTimerTimeoutL( ETrue ); |
|
929 } |
|
930 |
|
931 // ----------------------------------------------------------------------------- |
|
932 // CAknsSrv::EnableSkinChangeNotify |
|
933 // ----------------------------------------------------------------------------- |
|
934 // |
|
935 void CAknsSrv::EnableSkinChangeNotify() |
|
936 { |
|
937 // Only do something if the notificatio mechanism was disabled. |
|
938 if (!iNotifyEnabled) |
|
939 { |
|
940 iNotifyEnabled = ETrue; |
|
941 MergeAndBroadcast(); |
|
942 } |
|
943 } |
|
944 |
|
945 // ----------------------------------------------------------------------------- |
|
946 // CAknsSrv::DisableSkinChangeNotify |
|
947 // ----------------------------------------------------------------------------- |
|
948 // |
|
949 void CAknsSrv::DisableSkinChangeNotify() |
|
950 { |
|
951 iNotifyEnabled = EFalse; |
|
952 } |
|
953 |
|
954 // ----------------------------------------------------------------------------- |
|
955 // CAknsSrv::BroadcastUpdate |
|
956 // ----------------------------------------------------------------------------- |
|
957 // |
|
958 void CAknsSrv::BroadcastUpdate() |
|
959 { |
|
960 if ( iContentChanged ) |
|
961 { |
|
962 iChunkMaintainer->RemoveSingleScalableItem(KAknsIIDWallpaper); |
|
963 ForceNotifySessions( EAknsSCHNWallpaperChanged); |
|
964 iContentChanged = EFalse; |
|
965 } |
|
966 } |
|
967 |
|
968 // ----------------------------------------------------------------------------- |
|
969 // CAknsSrv::MergeAndBroadcast |
|
970 // ----------------------------------------------------------------------------- |
|
971 // |
|
972 TInt CAknsSrv::MergeAndBroadcast() |
|
973 { |
|
974 TInt mergeErr = KErrNone; |
|
975 // We don't want to notify anything if the mechanism was disabled. |
|
976 if (iNotifyEnabled && iContentChanged) |
|
977 { |
|
978 iContentChanged = EFalse; |
|
979 TRAP( mergeErr, PrepareMergedSkinContentL() ); |
|
980 |
|
981 if( mergeErr ) |
|
982 { |
|
983 if( mergeErr==KErrNoMemory ) |
|
984 { |
|
985 ForceNotifySessions( EAknsSCHNConfigurationOOM ); |
|
986 } |
|
987 else |
|
988 { |
|
989 ForceNotifySessions( EAknsSCHNConfigurationCorrupt ); |
|
990 } |
|
991 |
|
992 AKNS_TRACE_ERROR1("CAknsSrv::NotifySkinChangeToSessions MERGE ERROR %i", mergeErr); |
|
993 SetDefaultSkinActive(); |
|
994 RestoreDefaultSDSettings(); |
|
995 |
|
996 // Error ignored, we can do nothing if default system skin does not merge |
|
997 TRAP_IGNORE( PrepareMergedSkinContentL() ); |
|
998 } |
|
999 |
|
1000 iOutstandingChangeEvents += |
|
1001 ForceNotifySessions( EAknsSCHNContentChanged, ETrue); |
|
1002 } |
|
1003 return mergeErr; |
|
1004 } |
|
1005 |
|
1006 // ----------------------------------------------------------------------------- |
|
1007 // CAknsSrv::ForceNotifySessions |
|
1008 // ----------------------------------------------------------------------------- |
|
1009 // |
|
1010 TInt CAknsSrv::ForceNotifySessions( |
|
1011 const TAknsSkinChangeHandlerNotification aType, TBool aCountNotifications ) |
|
1012 { |
|
1013 TInt queued(0); |
|
1014 iSessionIter.SetToFirst(); |
|
1015 while( CSession2* session = iSessionIter++ ) |
|
1016 { |
|
1017 if( (static_cast<CAknsSrvSession*>(session))-> |
|
1018 EnqueueNotification( aType, aCountNotifications ) ) |
|
1019 { |
|
1020 queued += 1; |
|
1021 } |
|
1022 } |
|
1023 return queued; |
|
1024 } |
|
1025 |
|
1026 // ----------------------------------------------------------------------------- |
|
1027 // CAknsSrv::SetActiveSkinContent |
|
1028 // ----------------------------------------------------------------------------- |
|
1029 // |
|
1030 void CAknsSrv::SetActiveSkinContent(const TAknsPkgID aPID) |
|
1031 { |
|
1032 AKNS_TRACE_INFO2("CAknsSrv::SetActiveSkinContent %i %i", aPID.iNumber, aPID.iTimestamp ); |
|
1033 iMergeType = (TAknsSkinSrvMergeType)(iMergeType | EAknsSkinSrvSkin); |
|
1034 iSettings->SetCachedSkinPID( aPID ); |
|
1035 iContentChanged = ETrue; |
|
1036 } |
|
1037 |
|
1038 // ----------------------------------------------------------------------------- |
|
1039 // CAknsSrv::PrepareMergedSkinContentL |
|
1040 // ----------------------------------------------------------------------------- |
|
1041 // |
|
1042 void CAknsSrv::PrepareMergedSkinContentL() |
|
1043 { |
|
1044 iChunkMaintainer->BeginWrite(); |
|
1045 |
|
1046 TRAPD( error, PrepareMergedSkinContentUnprotectedL() ); |
|
1047 |
|
1048 iChunkMaintainer->EndWrite(); |
|
1049 |
|
1050 if( error ) |
|
1051 { |
|
1052 User::Leave( error ); |
|
1053 } |
|
1054 |
|
1055 StartAnimBackgroundL(); |
|
1056 |
|
1057 // Send notifications |
|
1058 ForceNotifySessions( EAknsSCHNConfigurationMerged ); |
|
1059 iMergeType = EAknsSkinSrvNone; |
|
1060 iChunkMaintainer->CreateMorphingTimerL(this); |
|
1061 } |
|
1062 |
|
1063 // ----------------------------------------------------------------------------- |
|
1064 // CAknsSrv::PrepareMergedSkinContentUnprotectedL |
|
1065 // ----------------------------------------------------------------------------- |
|
1066 // |
|
1067 void CAknsSrv::PrepareMergedSkinContentUnprotectedL() |
|
1068 { |
|
1069 iSkinOnRemovableDrive = EFalse; |
|
1070 |
|
1071 iDriveIdOfRemovableDrive = KErrNotFound; |
|
1072 |
|
1073 iChunkMaintainer->ResetLevel(); |
|
1074 |
|
1075 // Insert System default skin definitions first |
|
1076 DoMergeSkinL( |
|
1077 KAknsPIDS60DefaultSkin, |
|
1078 KAknsPIDS60DefaultSkin, |
|
1079 EAknsItemDefClassBitmaps, |
|
1080 ETrue, // clear |
|
1081 EFalse ); // override |
|
1082 |
|
1083 iChunkMaintainer->NextLevel(); |
|
1084 |
|
1085 if (iSkinContentUri && (iMergeType & EAknsSkinSrvSkin)) |
|
1086 { |
|
1087 CheckAndCreateDRMHelper(); |
|
1088 if (!iSkinContentUri2) |
|
1089 { |
|
1090 // error ignored |
|
1091 if (iBootFinished) |
|
1092 { |
|
1093 iDrmHelper->SetAutomatedType(CDRMHelper::EAutomatedTypeTheme); |
|
1094 iDrmHelper->RemoveAutomated( *iSkinContentUri ); |
|
1095 AKNS_TRACE_INFO("CAknsSrv - PrepareMergerSkinContentL: RemoveAutomated called for skin"); |
|
1096 delete iSkinContentUri; |
|
1097 iSkinContentUri = NULL; |
|
1098 } |
|
1099 } |
|
1100 else if (iSkinContentUri->Compare(*iSkinContentUri2)) |
|
1101 { |
|
1102 iDrmHelper->SetAutomatedType(CDRMHelper::EAutomatedTypeTheme); |
|
1103 iDrmHelper->RemoveAutomated( *iSkinContentUri ); |
|
1104 AKNS_TRACE_INFO("CAknsSrv - PrepareMergerSkinContentL: RemoveAutomated called for skin"); |
|
1105 delete iSkinContentUri; |
|
1106 iSkinContentUri = NULL; |
|
1107 } |
|
1108 } |
|
1109 |
|
1110 if (iIdleWPContentUri && (iMergeType & EAknsSkinSrvIdleWp)) |
|
1111 { |
|
1112 CheckAndCreateDRMHelper(); |
|
1113 if (!iIdleWPContentUri2) |
|
1114 { |
|
1115 // error ignored |
|
1116 if (iBootFinished) |
|
1117 { |
|
1118 iDrmHelper->SetAutomatedType(CDRMHelper::EAutomatedTypeWallpaper); |
|
1119 iDrmHelper->RemoveAutomated( *iIdleWPContentUri ); |
|
1120 AKNS_TRACE_INFO("CAknsSrv - PrepareMergerSkinContentL: RemoveAutomated called for idlewp"); |
|
1121 delete iIdleWPContentUri; |
|
1122 iIdleWPContentUri = NULL; |
|
1123 } |
|
1124 } |
|
1125 else if (iIdleWPContentUri->Compare(*iIdleWPContentUri2)) |
|
1126 { |
|
1127 iDrmHelper->SetAutomatedType(CDRMHelper::EAutomatedTypeWallpaper); |
|
1128 iDrmHelper->RemoveAutomated( *iIdleWPContentUri ); |
|
1129 AKNS_TRACE_INFO("CAknsSrv - PrepareMergerSkinContentL: RemoveAutomated called for idlewp"); |
|
1130 delete iIdleWPContentUri; |
|
1131 iIdleWPContentUri = NULL; |
|
1132 } |
|
1133 } |
|
1134 |
|
1135 // And then, insert definitions from the selected skin... |
|
1136 if( iSettings->CachedSkinPID() != KAknsPIDS60DefaultSkin ) |
|
1137 { |
|
1138 DoMergeSkinL( |
|
1139 iSettings->CachedSkinPID(), iSettings->CachedSkinPID(), |
|
1140 EAknsItemDefClassBitmaps, EFalse, EFalse ); |
|
1141 } |
|
1142 |
|
1143 iChunkMaintainer->NextLevel(); |
|
1144 |
|
1145 // Finally, check and merge wallpaper configuration |
|
1146 |
|
1147 iChunkMaintainer->NextLevel(); |
|
1148 if ( (!iUSBAttached) || ( iUSBAttached && !iWPOnRemovableDrive ) ) |
|
1149 { |
|
1150 if ( iSettings->WallpaperType() == KAknsSkinSrvSlidesetWallpaper ) |
|
1151 { |
|
1152 SetSlidesetWallpaperL(); |
|
1153 } |
|
1154 else |
|
1155 { |
|
1156 TPath filename; |
|
1157 TInt error = iSettings->ReadIdleBackgroundFile( filename ); |
|
1158 if( (error == KErrNone) && (filename.Length()>0)) |
|
1159 { |
|
1160 if (AknsSrvUtils::IsFile( iFsSession, filename ) ) |
|
1161 { |
|
1162 SetWallpaperL( filename,KAknsIIDWallpaper ); |
|
1163 } |
|
1164 else |
|
1165 { |
|
1166 iSettings->WriteIdleBackgroundToDefault(); |
|
1167 } |
|
1168 } |
|
1169 } |
|
1170 } |
|
1171 |
|
1172 iChunkMaintainer->NextLevel(); |
|
1173 |
|
1174 // register effects if TfxSrvPlugin is available |
|
1175 TBool tfxServerRunning = (iTFXServerCtrl && iTFXServerCtrl->ServerRunning()); |
|
1176 TRAPD(err,StartTransitionSrvL(tfxServerRunning)); |
|
1177 if (err) |
|
1178 { |
|
1179 StopTransitionSrv(); |
|
1180 } |
|
1181 } |
|
1182 |
|
1183 // ----------------------------------------------------------------------------- |
|
1184 // CAknsSrv::DoMergeSkinL |
|
1185 // ----------------------------------------------------------------------------- |
|
1186 // |
|
1187 void CAknsSrv::DoMergeSkinL( const TAknsPkgID /*aSkinPID*/, |
|
1188 const TAknsPkgID aLocationPID, const TAknsItemDefClass aClass, |
|
1189 const TBool aClearTable, const TBool /*aAHOverrideSkin*/ ) |
|
1190 { |
|
1191 AKNS_TRACE_INFO("CAknsSrv::DoMergeSkinL ENTERED"); |
|
1192 TAknsSrvExclusionQuery query( iExclusionList ); |
|
1193 |
|
1194 // Add highlight animation variant status to query (to include/exclude |
|
1195 // animations in merging). |
|
1196 query.SetHighlightAnimEnabled( iSettings->HighlightAnimEnabled() ); |
|
1197 |
|
1198 AKNS_TRACE_INFO("CAknsSrv::DoMergeSkinL Non System skin"); |
|
1199 // Normal skin |
|
1200 TBool isProtected = EFalse; |
|
1201 |
|
1202 // First look from ROM drive. |
|
1203 TFileName path; |
|
1204 CAknsSrvDriveMaster::DefaultSkinDirectoryOnRom( path ); |
|
1205 HBufC* skinfilename = AknsSrvUtils::GetSkinFileNameL( path, aLocationPID, iFsSession ); |
|
1206 if ( !skinfilename ) |
|
1207 { |
|
1208 AKNS_TRACE_INFO("CAknsSrv::DoMergeSkinL Skin was not found from ROM, trying static ones"); |
|
1209 // Then from device drives. |
|
1210 CAknsSrvDriveMaster* driveMaster = iSettings->GetDriveMaster(); |
|
1211 skinfilename = AknsSrvUtils::GetSkinFileNameL( |
|
1212 *driveMaster, |
|
1213 aLocationPID, |
|
1214 iFsSession, |
|
1215 CAknsSrvDriveMaster::EAknsSrvStaticDrive ); |
|
1216 if( !skinfilename ) |
|
1217 { |
|
1218 AKNS_TRACE_INFO("CAknsSrv::DoMergeSkinL Skin was not found from static drives, trying removable ones"); |
|
1219 // Finally from removable drives. |
|
1220 skinfilename = AknsSrvUtils::GetSkinFileNameL( |
|
1221 *driveMaster, |
|
1222 aLocationPID, |
|
1223 iFsSession, |
|
1224 CAknsSrvDriveMaster::EAknsSrvRemovableDrive ); |
|
1225 if ( !skinfilename ) |
|
1226 { |
|
1227 AKNS_TRACE_ERROR("CAknsSrv::DoMergeSkinL Skin not found!"); |
|
1228 // No skin was found at all... |
|
1229 User::Leave( KErrNotFound ); |
|
1230 } |
|
1231 else |
|
1232 { |
|
1233 iSkinOnRemovableDrive = ETrue; |
|
1234 iFsSession.CharToDrive( skinfilename->Des()[0], iDriveIdOfRemovableDrive ); |
|
1235 CleanupStack::PushL( skinfilename ); |
|
1236 } |
|
1237 } |
|
1238 else |
|
1239 { |
|
1240 CleanupStack::PushL( skinfilename ); |
|
1241 } |
|
1242 } |
|
1243 else |
|
1244 { |
|
1245 CleanupStack::PushL( skinfilename ); |
|
1246 } |
|
1247 #if defined(AKNS_TRACING_ENABLED_INFO) |
|
1248 if (skinfilename) |
|
1249 { |
|
1250 AKNS_TRACE_INFO1("CAknsSrv::DoMergeSkinL Skinfilename == %S", skinfilename); |
|
1251 } |
|
1252 else |
|
1253 { |
|
1254 AKNS_TRACE_INFO("CAknsSrv::DoMergeSkinL Skinfilename == NULL"); |
|
1255 } |
|
1256 #endif // AKNS_TRACING_ENABLED_INFO |
|
1257 |
|
1258 RFile file; |
|
1259 User::LeaveIfError( file.Open( |
|
1260 iFsSession, *skinfilename, EFileRead | EFileShareReadersOnly)); |
|
1261 CleanupClosePushL(file); |
|
1262 |
|
1263 TFileName fn; |
|
1264 if (iSknFile.SubSessionHandle()) |
|
1265 { |
|
1266 iSknFile.FullName(fn); |
|
1267 } |
|
1268 |
|
1269 if (fn.CompareF(*skinfilename)) |
|
1270 { |
|
1271 // file is not already open |
|
1272 iSknFile.Close(); |
|
1273 iSknFile.Duplicate(file); |
|
1274 } |
|
1275 |
|
1276 AKNS_TRACE_INFO("CAknsSrv::DoMergeSkinL SkinFilename got, checking protection..."); |
|
1277 isProtected = AknsSrvUtils::IsDrmProtectedL(file); |
|
1278 if (isProtected) |
|
1279 { |
|
1280 AKNS_TRACE_INFO("CAknsSrv::DoMergeSkinL Skin is DRM-Protected"); |
|
1281 // Get fileInfo |
|
1282 HBufC8* contenturi = AknsSrvUtils::GetContentUriFromFileL( *skinfilename ); |
|
1283 AKNS_TRACE_INFO("CAknsSrv::DoMergeSkinLL - GetContentUriFromFileL returned succesfully"); |
|
1284 CleanupStack::PushL(contenturi); |
|
1285 |
|
1286 CheckAndCreateDRMHelper(); |
|
1287 TBool canSetAutomated( EFalse ); |
|
1288 TInt res = iDrmHelper->CanSetAutomated( *skinfilename, canSetAutomated ); |
|
1289 |
|
1290 if ( res == KErrCANoRights || |
|
1291 res == KErrCANoPermission || |
|
1292 !canSetAutomated ) |
|
1293 { |
|
1294 AKNS_TRACE_ERROR1("CAknsSrv::DoMergeSkinL, failed due to CanSetAutomated result=%d, remove skin", res ); |
|
1295 AKNS_TRACE_ERROR1("CAknsSrv::DoMergeSkinL, failed due to CanSetAutomated boolean=%d, remove skin", canSetAutomated ); |
|
1296 if (!iBootFinished) |
|
1297 { |
|
1298 iSkinContentUri2 = contenturi->AllocL(); |
|
1299 } |
|
1300 User::Leave(KErrCorrupt); |
|
1301 } |
|
1302 |
|
1303 AKNS_TRACE_INFO("CAknsSrv::DoMergeSkinL - GetRightsInfo returned"); |
|
1304 AKNS_TRACE_INFO("CAknsSrv::DoMergeSkin ENTERED"); |
|
1305 |
|
1306 if (!iSkinContentUri) |
|
1307 { |
|
1308 AKNS_TRACE_INFO("CAknsSrv::DoMergeSkinL - Picked up contenturi for automated content (SKIN)"); |
|
1309 iSkinContentUri = contenturi->AllocL(); |
|
1310 } |
|
1311 |
|
1312 CleanupStack::PopAndDestroy(contenturi); |
|
1313 } |
|
1314 AKNS_TRACE_INFO("CAknsSrv::DoMergeSkinL DRM stuff done"); |
|
1315 // Not sure if using mirroring flag works correctly here.... |
|
1316 iChunkMaintainer->MergeSkinDefinitionsL( |
|
1317 *skinfilename, aClass, aClearTable, query, |
|
1318 iSettings->CachedAHMirroringActive(), aLocationPID ); |
|
1319 |
|
1320 CleanupStack::PopAndDestroy( 2, skinfilename ); |
|
1321 |
|
1322 AKNS_TRACE_INFO("CAknsSrv::DoMergeSkinL COMPLETED"); |
|
1323 } |
|
1324 |
|
1325 // ----------------------------------------------------------------------------- |
|
1326 // CAknsSrv::ActiveSkinAnimBgSupportL |
|
1327 // ----------------------------------------------------------------------------- |
|
1328 // |
|
1329 TBool CAknsSrv::ActiveSkinAnimBgSupportL( ) |
|
1330 { |
|
1331 CAknsSrvChunkLookup* chunklookup = CAknsSrvChunkLookup::NewL(); |
|
1332 CleanupStack::PushL( chunklookup ); |
|
1333 TAknsItemID p; |
|
1334 p.Set(EAknsMajorProperty,EAknsMinorPropertyAnimBgParam); |
|
1335 CAknsItemDef* def = chunklookup->LookupAndCreateDefL( p ); |
|
1336 CleanupStack::PopAndDestroy( chunklookup ); |
|
1337 if ( def ) |
|
1338 { |
|
1339 delete def; |
|
1340 return ETrue; |
|
1341 } |
|
1342 |
|
1343 return EFalse; |
|
1344 } |
|
1345 |
|
1346 // ----------------------------------------------------------------------------- |
|
1347 // CAknsSrv::ActiveSkinAnimBgParamL |
|
1348 // ----------------------------------------------------------------------------- |
|
1349 // |
|
1350 HBufC* CAknsSrv::ActiveSkinAnimBgParamL( ) |
|
1351 { |
|
1352 HBufC* param = NULL; |
|
1353 CAknsSrvChunkLookup* chunklookup = CAknsSrvChunkLookup::NewL(); |
|
1354 CleanupStack::PushL( chunklookup ); |
|
1355 TAknsItemID p; |
|
1356 p.Set(EAknsMajorProperty,EAknsMinorPropertyAnimBgParam); |
|
1357 CAknsItemDef* def = chunklookup->LookupAndCreateDefL( p ); |
|
1358 if ( def ) |
|
1359 { |
|
1360 CleanupStack::PushL( def ); |
|
1361 param = ((CAknsStringItemDef*)def)->String().AllocL(); |
|
1362 CleanupStack::PopAndDestroy ( def ); |
|
1363 } |
|
1364 CleanupStack::PopAndDestroy ( chunklookup ); |
|
1365 return param; |
|
1366 } |
|
1367 |
|
1368 // ----------------------------------------------------------------------------- |
|
1369 // CAknsSrv::StartAnimBackgroundL |
|
1370 // ----------------------------------------------------------------------------- |
|
1371 void CAknsSrv::StartAnimBackgroundL() |
|
1372 { |
|
1373 if ( iSettings->TransitionFxState() == KMaxTInt ) |
|
1374 { |
|
1375 //Stop anim effects |
|
1376 iSettings->SetAnimBackgroundState( KMaxTInt ); |
|
1377 return; |
|
1378 } |
|
1379 |
|
1380 const TUid KCRUidThemesVariation = { 0x102818EB }; |
|
1381 const TUint32 KThemesLocalVariation = 0x00000001; |
|
1382 |
|
1383 // Enable animated background setting. |
|
1384 // Bitmask value in decimals: 2048. |
|
1385 const TUint32 KPslnSupportAnimBackground = 0x00000800; |
|
1386 |
|
1387 TInt value = 0; |
|
1388 CRepository* themeVar = CRepository::NewL( KCRUidThemesVariation ); |
|
1389 TInt err = themeVar->Get( KThemesLocalVariation, value ); |
|
1390 if ( err != KErrNone ) |
|
1391 { |
|
1392 value = 0; |
|
1393 } |
|
1394 delete themeVar; |
|
1395 |
|
1396 if ( (value & KPslnSupportAnimBackground) && |
|
1397 ActiveSkinAnimBgSupportL() |
|
1398 ) |
|
1399 { |
|
1400 //Start anim effects |
|
1401 iSettings->SetAnimBackgroundState( 0 ); |
|
1402 } |
|
1403 else |
|
1404 { |
|
1405 //Stop anim effects |
|
1406 iSettings->SetAnimBackgroundState( KMaxTInt ); |
|
1407 } |
|
1408 } |
|
1409 |
|
1410 // ----------------------------------------------------------------------------- |
|
1411 // CAknsSrv::SetWallpaperL |
|
1412 // ----------------------------------------------------------------------------- |
|
1413 // |
|
1414 void CAknsSrv::SetWallpaperL( const TDesC& aFilename, |
|
1415 const TAknsItemID& aIID, TBool aIsSlide ) |
|
1416 { |
|
1417 if (iWallpaperType == KAknsSkinSrvNoWallpaper || |
|
1418 iWallpaperType == KAknsSkinSrvImageWallpaper || |
|
1419 !aIsSlide) |
|
1420 { |
|
1421 iCurrentSlide = 0; |
|
1422 WallpaperTimerL()->Stop(); |
|
1423 } |
|
1424 if (!aIsSlide && iSlideSetNameArray) |
|
1425 { |
|
1426 delete iSlideSetNameArray; |
|
1427 iSlideSetNameArray = NULL; |
|
1428 } |
|
1429 |
|
1430 if (aIID == KAknsIIDWallpaper) |
|
1431 { |
|
1432 iMergeType = (TAknsSkinSrvMergeType)(iMergeType | EAknsSkinSrvIdleWp); |
|
1433 } |
|
1434 |
|
1435 if (iWallpaperObserver) |
|
1436 { |
|
1437 iWallpaperObserver->Cancel(); |
|
1438 delete iWallpaperObserver; |
|
1439 iWallpaperObserver = NULL; |
|
1440 } |
|
1441 |
|
1442 AKNS_TRACE_INFO("CAknsSrv::SetWallPaperL entered"); |
|
1443 TBool isprotected = EFalse; |
|
1444 if (aFilename.Length() >0 ) |
|
1445 { |
|
1446 CFbsBitmap* bmp = NULL; |
|
1447 CFbsBitmap* mask = NULL; |
|
1448 TInt err = KErrNone; |
|
1449 |
|
1450 if ( !iWallpaperCache->IsCached( aFilename ) ) |
|
1451 { |
|
1452 if ( aFilename.Right(4).CompareF( KAknsSkinSrvSvgFileExt ) != 0 ) |
|
1453 { |
|
1454 TRAP( err, CAknsSrvImageConverter::DecodeImageL( iFsSession, |
|
1455 aFilename, |
|
1456 TSize(-1,-1), |
|
1457 bmp, |
|
1458 mask, |
|
1459 iMaxWallpaperSize ) ); |
|
1460 } |
|
1461 delete bmp; |
|
1462 delete mask; |
|
1463 if ( err ) |
|
1464 { |
|
1465 User::LeaveIfError( err ); |
|
1466 } |
|
1467 } |
|
1468 |
|
1469 isprotected = AknsSrvUtils::IsDrmProtectedL(aFilename); |
|
1470 if (!BaflUtils::FileExists(iFsSession, aFilename)) |
|
1471 { |
|
1472 iSettings->WriteIdleBackgroundToDefault(); |
|
1473 return; |
|
1474 } |
|
1475 } |
|
1476 if (isprotected) |
|
1477 { |
|
1478 CheckAndCreateDRMHelper(); |
|
1479 |
|
1480 // Get fileInfo |
|
1481 HBufC8* contenturi = AknsSrvUtils::GetContentUriFromFileL( aFilename ); |
|
1482 CleanupStack::PushL(contenturi); |
|
1483 AKNS_TRACE_INFO("CAknsSrv::SetWallPaperL - GetFileInfo returned succesfully"); |
|
1484 |
|
1485 TBool canSetAutomated( EFalse ); |
|
1486 TInt res = iDrmHelper->CanSetAutomated( aFilename, canSetAutomated ); |
|
1487 if ( res == KErrCANoRights ) |
|
1488 { |
|
1489 AKNS_TRACE_ERROR("CAknsSrv::SetWallPaperL - CanSetAutomated, result = KErrCANoRights"); |
|
1490 RemoveAutomatedWallpaper(aIID, *contenturi); |
|
1491 CleanupStack::PopAndDestroy( contenturi ); |
|
1492 return; |
|
1493 } |
|
1494 |
|
1495 if ( res == KErrCANoPermission || !canSetAutomated ) |
|
1496 { |
|
1497 AKNS_TRACE_ERROR("CAknsSrv::SetWallPaperL - ExpiredRights, FutureRights or ECountBased, remove wallpaper"); |
|
1498 if (!iBootFinished) |
|
1499 { |
|
1500 if (aIID == KAknsIIDWallpaper) |
|
1501 { |
|
1502 AKNS_TRACE_INFO("CAknsSrv::SetWallpaperL - Picked up contenturi for automated content (idlewp)"); |
|
1503 iIdleWPContentUri = contenturi->AllocL(); |
|
1504 } |
|
1505 } |
|
1506 else |
|
1507 { |
|
1508 RemoveAutomatedWallpaper(aIID, *contenturi); |
|
1509 } |
|
1510 CleanupStack::PopAndDestroy( contenturi ); |
|
1511 return; |
|
1512 } |
|
1513 |
|
1514 AKNS_TRACE_INFO("CAknsSrv::SetWallPaperL - Wallpaper has valid restricted rights"); |
|
1515 if (aIID == KAknsIIDWallpaper) |
|
1516 { |
|
1517 if (!iIdleWPContentUri) |
|
1518 { |
|
1519 AKNS_TRACE_INFO("CAknsSrv::SetWallpaperL - Picked up contenturi for automated content (idlewp)"); |
|
1520 iIdleWPContentUri = contenturi->AllocL(); |
|
1521 } |
|
1522 } |
|
1523 |
|
1524 CleanupStack::PopAndDestroy(contenturi); |
|
1525 } |
|
1526 |
|
1527 iChunkMaintainer->SetWallpaper( aIID, aFilename, 0); |
|
1528 |
|
1529 // Set the wallpaper type as correct. |
|
1530 if ( aFilename != KNullDesC && !aIsSlide ) |
|
1531 { |
|
1532 iWallpaperType = KAknsSkinSrvImageWallpaper; |
|
1533 } |
|
1534 else if ( aFilename == KNullDesC && !aIsSlide ) |
|
1535 { |
|
1536 iWallpaperType = KAknsSkinSrvNoWallpaper; |
|
1537 } |
|
1538 |
|
1539 iContentChanged = ETrue; |
|
1540 if ( aFilename.Length() >0 ) |
|
1541 { |
|
1542 TRAPD(err,iWallpaperObserver = CAknsSrvFileObserver::NewL(this, aFilename)); |
|
1543 if (!err) |
|
1544 { |
|
1545 iWallpaperObserver->IssueRequest(); |
|
1546 } |
|
1547 if ( CAknsSrvDriveMaster::IsRemovableDrive( iFsSession, aFilename ) ) |
|
1548 { |
|
1549 iWPOnRemovableDrive = ETrue; |
|
1550 if ( iWPFilename ) |
|
1551 { |
|
1552 delete iWPFilename; |
|
1553 iWPFilename = NULL; |
|
1554 } |
|
1555 iWPFilename = aFilename.AllocL(); |
|
1556 } |
|
1557 else |
|
1558 { |
|
1559 iWPOnRemovableDrive = EFalse; |
|
1560 } |
|
1561 } |
|
1562 else |
|
1563 { |
|
1564 delete iWPFilename; |
|
1565 iWPFilename = NULL; |
|
1566 } |
|
1567 } |
|
1568 |
|
1569 // ----------------------------------------------------------------------------- |
|
1570 // CAknsSrv::CheckImageL |
|
1571 // ----------------------------------------------------------------------------- |
|
1572 // |
|
1573 TBool CAknsSrv::CheckImageL(const TDesC& aFilename, TBool& aIsProtected ) |
|
1574 { |
|
1575 CFbsBitmap* bmp = NULL; |
|
1576 CFbsBitmap* mask = NULL; |
|
1577 |
|
1578 TInt err = KErrNone; |
|
1579 if ( aFilename.Right(4).CompareF( KAknsSkinSrvSvgFileExt ) != 0 ) |
|
1580 { |
|
1581 TRAP( err, CAknsSrvImageConverter::DecodeImageL( iFsSession, |
|
1582 aFilename, |
|
1583 TSize(-1,-1), |
|
1584 bmp, |
|
1585 mask, |
|
1586 iMaxWallpaperSize ) ); |
|
1587 } |
|
1588 delete bmp; |
|
1589 delete mask; |
|
1590 if ( err ) |
|
1591 { |
|
1592 return EFalse; |
|
1593 } |
|
1594 |
|
1595 TBool isValidFile = ETrue; |
|
1596 aIsProtected = AknsSrvUtils::IsDrmProtectedL( aFilename ); |
|
1597 if ( aIsProtected ) |
|
1598 { |
|
1599 CheckAndCreateDRMHelper(); |
|
1600 |
|
1601 TBool canSetAutomated = EFalse; |
|
1602 TInt result = iDrmHelper->CanSetAutomated( aFilename, canSetAutomated ); |
|
1603 if ( !canSetAutomated || result != KErrNone ) |
|
1604 { |
|
1605 isValidFile = EFalse; |
|
1606 } |
|
1607 else |
|
1608 { |
|
1609 TBool expired = EFalse; |
|
1610 TBool sendAllowed = EFalse; //not needed |
|
1611 CDRMHelperRightsConstraints* playDrmHlpCons = NULL; |
|
1612 CDRMHelperRightsConstraints* dispDrmHlpCons = NULL; |
|
1613 CDRMHelperRightsConstraints* execDrmHlpCons = NULL; |
|
1614 CDRMHelperRightsConstraints* printDrmHlpCons = NULL; |
|
1615 iDrmHelper->GetRightsDetailsL( |
|
1616 aFilename, |
|
1617 ContentAccess::EView, |
|
1618 expired, |
|
1619 sendAllowed, |
|
1620 playDrmHlpCons, |
|
1621 dispDrmHlpCons, |
|
1622 execDrmHlpCons, |
|
1623 printDrmHlpCons ); |
|
1624 delete playDrmHlpCons; |
|
1625 delete execDrmHlpCons; |
|
1626 delete printDrmHlpCons; |
|
1627 CleanupStack::PushL( dispDrmHlpCons ); |
|
1628 |
|
1629 if ( dispDrmHlpCons && dispDrmHlpCons->FullRights() ) |
|
1630 { |
|
1631 isValidFile = ETrue; |
|
1632 } |
|
1633 CleanupStack::PopAndDestroy( dispDrmHlpCons ); |
|
1634 } |
|
1635 } |
|
1636 |
|
1637 return isValidFile; |
|
1638 } |
|
1639 |
|
1640 // ----------------------------------------------------------------------------- |
|
1641 // CAknsSrv::WallpaperTimerTimeoutL |
|
1642 // ----------------------------------------------------------------------------- |
|
1643 // |
|
1644 void CAknsSrv::WallpaperTimerTimeoutL( TBool aForceChange ) |
|
1645 { |
|
1646 |
|
1647 TInt slideCount = 0; |
|
1648 if ( iSlideSetNameArray ) |
|
1649 { |
|
1650 slideCount = iSlideSetNameArray->MdcaCount(); |
|
1651 } |
|
1652 else |
|
1653 { |
|
1654 // Wallpaper slideset array has been deleted. |
|
1655 iSettings->WriteIdleBackgroundToDefault(); |
|
1656 return; |
|
1657 } |
|
1658 |
|
1659 if( !aForceChange && !CanChangeSlidesetWallpaperL() ) |
|
1660 { |
|
1661 iCurrentSlide++; |
|
1662 if (iCurrentSlide >= slideCount) |
|
1663 { |
|
1664 iCurrentSlide = 0; |
|
1665 } |
|
1666 return; |
|
1667 } |
|
1668 |
|
1669 //Commnet out for bug ETTA-7JSDGE |
|
1670 // if ( iSettings->ScreensaverState() > 0 ) |
|
1671 // { |
|
1672 // iContentChanged = ETrue; |
|
1673 // iCurrentSlide++; |
|
1674 // if (iCurrentSlide >= slideCount) |
|
1675 // { |
|
1676 // iCurrentSlide = 0; |
|
1677 // } |
|
1678 // iSettings->StartScreenSaverListen(); |
|
1679 // return; |
|
1680 // } |
|
1681 |
|
1682 TInt freeRAM = 0; |
|
1683 HAL::Get(HALData::EMemoryRAMFree, freeRAM); |
|
1684 if (freeRAM < KAknSkinSrvFreeRAMNeeded) |
|
1685 { |
|
1686 return; |
|
1687 } |
|
1688 |
|
1689 // Find next valid image. |
|
1690 TBool isProtected = EFalse; |
|
1691 while ( slideCount && |
|
1692 ( !BaflUtils::FileExists( |
|
1693 iFsSession, |
|
1694 iSlideSetNameArray->MdcaPoint( iCurrentSlide ) ) || |
|
1695 !CheckImageL( |
|
1696 iSlideSetNameArray->MdcaPoint( iCurrentSlide ), |
|
1697 isProtected ) ) ) |
|
1698 { |
|
1699 iSlideSetNameArray->Delete(iCurrentSlide); |
|
1700 slideCount = iSlideSetNameArray->MdcaCount(); |
|
1701 if (iCurrentSlide >= slideCount && slideCount > 0) |
|
1702 { |
|
1703 iCurrentSlide = 0; |
|
1704 TRAPD(err,{isProtected = |
|
1705 AknsSrvUtils::IsDrmProtectedL(iSlideSetNameArray->MdcaPoint(iCurrentSlide));} |
|
1706 ); |
|
1707 if ( err != KErrNone ) |
|
1708 { |
|
1709 isProtected = EFalse; |
|
1710 } |
|
1711 } |
|
1712 } |
|
1713 |
|
1714 CheckAndCreateDRMHelper(); |
|
1715 |
|
1716 // @todo - remove automated content for previous slide - they don't use the member variable |
|
1717 // URI's. |
|
1718 |
|
1719 // remove any previous automated content |
|
1720 if (iIdleWPContentUri) |
|
1721 { |
|
1722 iDrmHelper->SetAutomatedType(CDRMHelper::EAutomatedTypeWallpaper); |
|
1723 iDrmHelper->RemoveAutomated( *iIdleWPContentUri ); |
|
1724 delete iIdleWPContentUri; |
|
1725 iIdleWPContentUri = NULL; |
|
1726 } |
|
1727 |
|
1728 if (iIdleWPContentUri2) |
|
1729 { |
|
1730 iDrmHelper->SetAutomatedType(CDRMHelper::EAutomatedTypeWallpaper); |
|
1731 iDrmHelper->RemoveAutomated( *iIdleWPContentUri2 ); |
|
1732 delete iIdleWPContentUri2; |
|
1733 iIdleWPContentUri2 = NULL; |
|
1734 } |
|
1735 |
|
1736 // Set image as automated content. |
|
1737 if ( slideCount > iCurrentSlide && slideCount ) |
|
1738 { |
|
1739 if ( isProtected ) |
|
1740 { |
|
1741 iDrmHelper->SetAutomatedType(CDRMHelper::EAutomatedTypeWallpaper); |
|
1742 iDrmHelper->SetAutomatedSilent(iSlideSetNameArray->MdcaPoint(iCurrentSlide), ETrue); |
|
1743 iDrmHelper->ConsumeFile2( |
|
1744 iSlideSetNameArray->MdcaPoint( iCurrentSlide), |
|
1745 ContentAccess::EView, |
|
1746 CDRMHelper::EStart ); |
|
1747 iDrmHelper->ConsumeFile2( |
|
1748 iSlideSetNameArray->MdcaPoint( iCurrentSlide), |
|
1749 ContentAccess::EView, |
|
1750 CDRMHelper::EFinish ); |
|
1751 } |
|
1752 } |
|
1753 |
|
1754 CRepository* skinsrep = CRepository::NewL(KCRUidPersonalisation); |
|
1755 CleanupStack::PushL(skinsrep); |
|
1756 |
|
1757 if ( slideCount > 1 ) |
|
1758 { |
|
1759 SetWallpaperL( iSlideSetNameArray->MdcaPoint(iCurrentSlide),KAknsIIDWallpaper, ETrue ); |
|
1760 skinsrep->Set(KPslnIdleBackgroundImagePath, iSlideSetNameArray->MdcaPoint(iCurrentSlide)); |
|
1761 iMergeType = (TAknsSkinSrvMergeType)(iMergeType | EAknsSkinSrvIdleWp); |
|
1762 iContentChanged = ETrue; |
|
1763 BroadcastUpdate(); |
|
1764 iCurrentSlide++; |
|
1765 if ( iCurrentSlide >= slideCount ) |
|
1766 { |
|
1767 iCurrentSlide = 0; |
|
1768 } |
|
1769 } |
|
1770 else |
|
1771 { |
|
1772 // only one or zero images left, cancel timer and set the wallpaper to normal |
|
1773 WallpaperTimerL()->Stop(); |
|
1774 iCurrentSlide = 0; |
|
1775 |
|
1776 TFileName fname; |
|
1777 if ( slideCount ) |
|
1778 { |
|
1779 fname = iSlideSetNameArray->MdcaPoint(0); |
|
1780 } |
|
1781 |
|
1782 if ( slideCount && BaflUtils::FileExists(iFsSession, fname) ) |
|
1783 { |
|
1784 SetWallpaperL( fname,KAknsIIDWallpaper ); |
|
1785 iWallpaperType = KAknsSkinSrvImageWallpaper; |
|
1786 User::LeaveIfError(skinsrep->Set(KPslnIdleBackgroundImagePath, fname)); |
|
1787 User::LeaveIfError(skinsrep->Set(KPslnWallpaperType, iWallpaperType)); |
|
1788 } |
|
1789 else |
|
1790 { |
|
1791 SetWallpaperL( KNullDesC,KAknsIIDWallpaper ); |
|
1792 iSettings->WriteIdleBackgroundToDefault(); |
|
1793 } |
|
1794 |
|
1795 if ( iSlideSetNameArray ) |
|
1796 { |
|
1797 iSlideSetNameArray->Reset(); |
|
1798 } |
|
1799 delete iSlideSetNameArray; |
|
1800 iSlideSetNameArray = NULL; |
|
1801 |
|
1802 iMergeType = (TAknsSkinSrvMergeType)(iMergeType | EAknsSkinSrvIdleWp); |
|
1803 iContentChanged = ETrue; |
|
1804 BroadcastUpdate(); |
|
1805 } |
|
1806 CleanupStack::PopAndDestroy( skinsrep ); |
|
1807 } |
|
1808 |
|
1809 // ----------------------------------------------------------------------------- |
|
1810 // Sets slide set wallpaper. |
|
1811 // ----------------------------------------------------------------------------- |
|
1812 // |
|
1813 void CAknsSrv::SetSlidesetWallpaperL( ) |
|
1814 { |
|
1815 ReadSlideSetImageFilesL(); |
|
1816 |
|
1817 iWallpaperType = KAknsSkinSrvSlidesetWallpaper; |
|
1818 |
|
1819 SetSlideSetTimerActiveL(); |
|
1820 |
|
1821 StopSlidesetIniFileObserver(); |
|
1822 TFileName fileName; |
|
1823 CAknsSrvDriveMaster::GetDefaultDrive( |
|
1824 DriveInfo::EDefaultPhoneMemory, fileName ); |
|
1825 fileName.Append( KAknsSrvSSWPInifile ); |
|
1826 |
|
1827 TAknsSrvFileSrvObserverType type = EAknsSrvFileObsSlidesetWallpaper; |
|
1828 iSlideSetObserver = CAknsSrvFileObserver::NewL( this, type, fileName ); |
|
1829 iSlideSetObserver->IssueRequest(); |
|
1830 |
|
1831 WallpaperTimerTimeoutL(); |
|
1832 } |
|
1833 |
|
1834 // ----------------------------------------------------------------------------- |
|
1835 // Sets slide set wallpaper. |
|
1836 // ----------------------------------------------------------------------------- |
|
1837 // |
|
1838 void CAknsSrv::StopSlidesetIniFileObserver( ) |
|
1839 { |
|
1840 if ( iSlideSetObserver ) |
|
1841 { |
|
1842 iSlideSetObserver->Cancel(); |
|
1843 delete iSlideSetObserver; |
|
1844 iSlideSetObserver = NULL; |
|
1845 } |
|
1846 } |
|
1847 |
|
1848 // ----------------------------------------------------------------------------- |
|
1849 // CAknsSrv::StoreScalableGraphicsL |
|
1850 // ----------------------------------------------------------------------------- |
|
1851 // |
|
1852 void CAknsSrv::StoreScalableGraphicsL( const TAknsItemID& aIID, |
|
1853 const TInt aType, const TSize& aSize, TInt aBmpHandle, TInt aMskHandle, TBool aMorphing ) |
|
1854 { |
|
1855 iChunkMaintainer->StoreScalableGraphicsL( |
|
1856 aIID, aType, aSize, aBmpHandle, aMskHandle, aMorphing); |
|
1857 } |
|
1858 |
|
1859 // ----------------------------------------------------------------------------- |
|
1860 // CAknsSrv::ClearScalableGraphics |
|
1861 // ----------------------------------------------------------------------------- |
|
1862 // |
|
1863 void CAknsSrv::ClearScalableGraphics() |
|
1864 { |
|
1865 iChunkMaintainer->ClearScalableGraphics(EAknsSrvScrModeSquare); |
|
1866 } |
|
1867 |
|
1868 // ----------------------------------------------------------------------------- |
|
1869 // CAknsSrv::FreeLayoutBitmaps |
|
1870 // ----------------------------------------------------------------------------- |
|
1871 // |
|
1872 void CAknsSrv::FreeLayoutBitmaps(const RMessage2 aMessage) |
|
1873 { |
|
1874 TAknsSrcScreenMode mode = (TAknsSrcScreenMode)aMessage.Int0(); |
|
1875 iChunkMaintainer->ClearScalableGraphics(mode); |
|
1876 ForceNotifySessions( EAknsSCHNFlushClientSideCaches ); |
|
1877 } |
|
1878 |
|
1879 // ----------------------------------------------------------------------------- |
|
1880 // CAknsSrv::CheckIconConfigurationL |
|
1881 // ----------------------------------------------------------------------------- |
|
1882 // |
|
1883 TInt CAknsSrv::CheckIconConfiguration( const RMessage2 aMessage ) |
|
1884 { |
|
1885 TUid appUid = TUid::Uid( 0 ); |
|
1886 TPckg<TUid> appUidPack( appUid ); |
|
1887 TBool isConfiguredIcon = EFalse; |
|
1888 TRAPD(err, |
|
1889 {aMessage.ReadL(0, appUidPack); |
|
1890 if ( !iIconConfigMap ) |
|
1891 { |
|
1892 iIconConfigMap = CAknsSrvIconConfigMap::NewL(); |
|
1893 } |
|
1894 iIconConfigMap->IsIconConfiguredL( appUid, isConfiguredIcon );} |
|
1895 ); |
|
1896 if ( err != KErrNone) |
|
1897 { |
|
1898 err = isConfiguredIcon; |
|
1899 } |
|
1900 return isConfiguredIcon; |
|
1901 } |
|
1902 |
|
1903 // ----------------------------------------------------------------------------- |
|
1904 // CAknsSrv::AcknowledgeNotification |
|
1905 // ----------------------------------------------------------------------------- |
|
1906 // |
|
1907 void CAknsSrv::AcknowledgeNotification( const TInt aType ) |
|
1908 { |
|
1909 if( aType == EAknsSCHNContentChanged ) |
|
1910 { |
|
1911 iOutstandingChangeEvents -= 1; |
|
1912 //__ASSERT_DEBUG( iOutstandingChangeEvents >= 0, User::Panic( |
|
1913 // KAknSkinSrvPanicCategory, EAknsSrvNotifyListImbalance ) ); |
|
1914 |
|
1915 if( iOutstandingChangeEvents == 0 ) |
|
1916 { |
|
1917 // Clear scalable graphics |
|
1918 ClearScalableGraphics(); |
|
1919 |
|
1920 // Broadcast deployment notification |
|
1921 ForceNotifySessions( EAknsSCHNConfigurationDeployed ); |
|
1922 } |
|
1923 if ( iOutstandingChangeEvents < 0 ) |
|
1924 { |
|
1925 // Some client is spamming us with EAknSkinSrvAckNotification. |
|
1926 iOutstandingChangeEvents = 0; |
|
1927 } |
|
1928 } |
|
1929 } |
|
1930 |
|
1931 // ----------------------------------------------------------------------------- |
|
1932 // CAknsSrv::OpenBitmapFileL |
|
1933 // ----------------------------------------------------------------------------- |
|
1934 // |
|
1935 void CAknsSrv::OpenBitmapFileL( const RMessage2 aMessage ) |
|
1936 { |
|
1937 // message parameters |
|
1938 // 0. filename |
|
1939 // 1. filehandle |
|
1940 TFileName filename; |
|
1941 aMessage.ReadL( 0,filename ); |
|
1942 |
|
1943 if ( !filename.Length() ) |
|
1944 { |
|
1945 User::Leave( KErrNotFound ); |
|
1946 } |
|
1947 |
|
1948 RFile file; |
|
1949 TChar driveLetter = filename[0]; |
|
1950 TInt driveNumber; |
|
1951 User::LeaveIfError( iFsSession.CharToDrive( driveLetter, driveNumber ) ); |
|
1952 |
|
1953 User::LeaveIfError( iFsSession.ShareProtected() ); |
|
1954 TInt err = iFsSession.CreatePrivatePath( driveNumber ); |
|
1955 |
|
1956 if ( err != KErrNone && err != KErrAlreadyExists ) |
|
1957 { |
|
1958 User::Leave( err ); |
|
1959 } |
|
1960 |
|
1961 User::LeaveIfError( iFsSession.SetSessionToPrivate( driveNumber ) ); |
|
1962 |
|
1963 // @TODO the filename should probably be checked against the filenames |
|
1964 // in the chunkmaintainer |
|
1965 |
|
1966 User::LeaveIfError( file.Open( |
|
1967 iFsSession, filename, EFileRead | EFileShareReadersOnly ) ); |
|
1968 CleanupClosePushL( file ); |
|
1969 User::LeaveIfError( file.TransferToClient( aMessage, 1 ) ); |
|
1970 |
|
1971 CleanupStack::PopAndDestroy(); // file, ownership transferred to client |
|
1972 } |
|
1973 |
|
1974 // ----------------------------------------------------------------------------- |
|
1975 // CAknsSrv::OpenIniFileL |
|
1976 // ----------------------------------------------------------------------------- |
|
1977 // |
|
1978 void CAknsSrv::OpenIniFileL( const RMessage2 aMessage) |
|
1979 { |
|
1980 // Message parameters |
|
1981 // 0. package id |
|
1982 // 1. location |
|
1983 // 2. filehandle |
|
1984 // 3. openmode (EFalse = read, ETrue = write) |
|
1985 TFileName filename; |
|
1986 TFileName path; |
|
1987 TAknsPkgID pid = KAknsNullPkgID; |
|
1988 TPckg<TAknsPkgID> pidPack( pid ); |
|
1989 aMessage.ReadL(0, pidPack); |
|
1990 TAknSkinSrvSkinPackageLocation location =(TAknSkinSrvSkinPackageLocation)aMessage.Int1(); |
|
1991 TBool openmode = aMessage.Int3(); // todo read this from client |
|
1992 |
|
1993 if ( location == EAknsSrvPhone ) |
|
1994 { |
|
1995 CAknsSrvDriveMaster::GetDefaultDrive( DriveInfo::EDefaultPhoneMemory, path ); |
|
1996 if ( path.Length() > 0 ) |
|
1997 { |
|
1998 path.Append( KAknSkinSrvPrivateSkinPath ); |
|
1999 } |
|
2000 } |
|
2001 else if ( location == EAknsSrvMMC ) |
|
2002 { |
|
2003 CAknsSrvDriveMaster::GetDefaultDrive( DriveInfo::EDefaultMassStorage, path ); |
|
2004 if ( path.Length() > 0 ) |
|
2005 { |
|
2006 path.Append( KAknSkinSrvPrivateSkinPath ); |
|
2007 } |
|
2008 } |
|
2009 else |
|
2010 { |
|
2011 User::Leave(KErrArgument); |
|
2012 } |
|
2013 |
|
2014 // this is the skin directory |
|
2015 path.AppendNumFixedWidthUC( pid.iNumber, EHex, 8 ); |
|
2016 if( !pid.IsUid() ) |
|
2017 { |
|
2018 path.AppendNumFixedWidthUC( pid.iTimestamp, EHex, 8 ); |
|
2019 } |
|
2020 path.Append(KPathDelimiter); |
|
2021 |
|
2022 RFile file; |
|
2023 User::LeaveIfError(iFsSession.ShareProtected()); |
|
2024 TChar driveLetter = path[0]; |
|
2025 |
|
2026 TInt driveNumber; |
|
2027 User::LeaveIfError(iFsSession.CharToDrive(driveLetter, driveNumber)); |
|
2028 TInt err=iFsSession.CreatePrivatePath(driveNumber); |
|
2029 if (err!=KErrNone && err!=KErrAlreadyExists) |
|
2030 { |
|
2031 User::Leave(err); |
|
2032 } |
|
2033 filename.AppendNumFixedWidthUC( pid.iNumber, EHex, 8 ); |
|
2034 if( !pid.IsUid() ) |
|
2035 { |
|
2036 filename.AppendNumFixedWidthUC( pid.iTimestamp, EHex, 8 ); |
|
2037 } |
|
2038 |
|
2039 filename.Append( KAknsSkinSrvIniFileExt ); |
|
2040 |
|
2041 User::LeaveIfError(iFsSession.SetSessionToPrivate(driveNumber)); |
|
2042 |
|
2043 iInstallObserver->Cancel(); |
|
2044 if (openmode) |
|
2045 { |
|
2046 // open readwrite |
|
2047 err = iFsSession.MkDirAll(path); |
|
2048 path.Append(filename); |
|
2049 if (err == KErrNone || err == KErrAlreadyExists) |
|
2050 { |
|
2051 err = file.Replace( |
|
2052 iFsSession,path, |
|
2053 EFileShareExclusive | EFileStreamText | EFileWrite ); |
|
2054 } |
|
2055 } |
|
2056 else |
|
2057 { |
|
2058 // open in read only mode |
|
2059 path.Append(filename); |
|
2060 err = file.Open( iFsSession, path, EFileStreamText | EFileRead ); |
|
2061 } |
|
2062 iInstallObserver->IssueRequest(); |
|
2063 User::LeaveIfError(err); |
|
2064 CleanupClosePushL(file); |
|
2065 |
|
2066 User::LeaveIfError(file.TransferToClient(aMessage,2)); |
|
2067 CleanupStack::PopAndDestroy(); // file, ownership transferred to client |
|
2068 } |
|
2069 |
|
2070 // ----------------------------------------------------------------------------- |
|
2071 // CAknsSrv::OpenImageInifileL |
|
2072 // ----------------------------------------------------------------------------- |
|
2073 // |
|
2074 void CAknsSrv::OpenImageInifileL(const RMessage2 aMessage) |
|
2075 { |
|
2076 // Message parameters |
|
2077 // 0. filehandle |
|
2078 // 1. type |
|
2079 TAknsSrvInifileType inifiletype = (TAknsSrvInifileType)aMessage.Int1(); |
|
2080 |
|
2081 RFile file; |
|
2082 User::LeaveIfError(iFsSession.ShareProtected()); |
|
2083 TInt driveNumber; |
|
2084 |
|
2085 TFileName path; |
|
2086 CAknsSrvDriveMaster::GetDefaultDrive( DriveInfo::EDefaultPhoneMemory, path ); |
|
2087 User::LeaveIfError(iFsSession.CharToDrive(path[0], driveNumber)); |
|
2088 |
|
2089 TInt err=iFsSession.CreatePrivatePath(driveNumber); |
|
2090 if (err!=KErrNone && err!=KErrAlreadyExists) |
|
2091 { |
|
2092 User::Leave(err); |
|
2093 } |
|
2094 |
|
2095 User::LeaveIfError(iFsSession.SetSessionToPrivate(driveNumber)); |
|
2096 |
|
2097 TFileName fileName; |
|
2098 CAknsSrvDriveMaster::GetDefaultDrive( |
|
2099 DriveInfo::EDefaultPhoneMemory, fileName ); |
|
2100 |
|
2101 if (inifiletype == EAknsSrvInifileSSWP) |
|
2102 { |
|
2103 fileName.Append( KAknsSrvSSWPInifile ); |
|
2104 err = file.Create( |
|
2105 iFsSession, fileName, EFileShareAny|EFileStreamText|EFileWrite ); |
|
2106 if (err == KErrAlreadyExists) |
|
2107 { |
|
2108 User::LeaveIfError( file.Open( |
|
2109 iFsSession, |
|
2110 fileName, |
|
2111 EFileShareAny | EFileStreamText | EFileWrite ) ); |
|
2112 } |
|
2113 } |
|
2114 else |
|
2115 { |
|
2116 fileName.Append( KAknsSrvSSSSInifile ); |
|
2117 err = file.Create( |
|
2118 iFsSession, fileName, EFileShareAny|EFileStreamText|EFileWrite ); |
|
2119 if (err == KErrAlreadyExists) |
|
2120 { |
|
2121 User::LeaveIfError( file.Open( |
|
2122 iFsSession, |
|
2123 KAknsSrvSSSSInifile, |
|
2124 EFileShareAny | EFileStreamText | EFileWrite ) ); |
|
2125 } |
|
2126 } |
|
2127 CleanupClosePushL(file); |
|
2128 |
|
2129 User::LeaveIfError(file.TransferToClient(aMessage,0)); |
|
2130 CleanupStack::PopAndDestroy(); // file, ownership transferred to client |
|
2131 } |
|
2132 |
|
2133 // ----------------------------------------------------------------------------- |
|
2134 // CAknsSrv::CopySoundFileL |
|
2135 // ----------------------------------------------------------------------------- |
|
2136 // |
|
2137 void CAknsSrv::CopySoundFileL(const RMessage2 aMessage) |
|
2138 { |
|
2139 TFileName sourcefilename; |
|
2140 TFileName targetfilename; |
|
2141 aMessage.ReadL( 0,sourcefilename ); |
|
2142 aMessage.ReadL( 1,targetfilename ); |
|
2143 CFileMan* fileMan = CFileMan::NewL( iFsSession ); |
|
2144 CleanupStack::PushL(fileMan); |
|
2145 User::LeaveIfError( |
|
2146 fileMan->Copy( |
|
2147 sourcefilename, |
|
2148 targetfilename, |
|
2149 CFileMan::ERecurse | CFileMan::EOverWrite ) ); |
|
2150 CleanupStack::PopAndDestroy( fileMan ); |
|
2151 } |
|
2152 |
|
2153 // ----------------------------------------------------------------------------- |
|
2154 // CAknsSrv::EnumeratePackages |
|
2155 // ----------------------------------------------------------------------------- |
|
2156 // |
|
2157 void CAknsSrv::EnumeratePackages( const RMessage2 aMessage) |
|
2158 { |
|
2159 TRAP_IGNORE( EnumeratePackagesL( aMessage ) ); |
|
2160 } |
|
2161 |
|
2162 // ----------------------------------------------------------------------------- |
|
2163 // CAknsSrv::EnumeratePackagesL |
|
2164 // ----------------------------------------------------------------------------- |
|
2165 // |
|
2166 void CAknsSrv::EnumeratePackagesL( const RMessage2 aMessage) |
|
2167 { |
|
2168 AKNS_TRACE_INFO("CAknsSrv::EnumeratePackagesL Begin"); |
|
2169 TAknSkinSrvSkinPackageLocation location = (TAknSkinSrvSkinPackageLocation)aMessage.Int1(); |
|
2170 if (iPackageArray) |
|
2171 { |
|
2172 iPackageArray->ResetAndDestroy(); |
|
2173 delete iPackageArray; |
|
2174 iPackageArray = NULL; |
|
2175 } |
|
2176 iPackageArray = new (ELeave) CArrayPtrFlat<TAknsSrvSkinInfoPkg>(5); |
|
2177 CDesC16ArrayFlat* skinfiles = new (ELeave) CDesC16ArrayFlat(5); |
|
2178 CleanupStack::PushL(skinfiles); |
|
2179 |
|
2180 CAknsSrvDriveMaster* driveMaster = iSettings->GetDriveMaster(); |
|
2181 TInt deviceDrives = |
|
2182 driveMaster->GetNumberOfDrives( CAknsSrvDriveMaster::EAknsSrvStaticDrive ); |
|
2183 TInt massDrives = |
|
2184 driveMaster->GetNumberOfDrives( CAknsSrvDriveMaster::EAknsSrvRemovableDrive ); |
|
2185 |
|
2186 AKNS_TRACE_INFO1("CAknsSrv::EnumeratePackagesL device drives = %d", deviceDrives ); |
|
2187 AKNS_TRACE_INFO1("CAknsSrv::EnumeratePackagesL mass drives = %d", massDrives ); |
|
2188 |
|
2189 TInt index = 0; |
|
2190 TFileName path; |
|
2191 |
|
2192 switch (location) |
|
2193 { |
|
2194 // Drives z and c |
|
2195 case EAknsSrvPhone: |
|
2196 CAknsSrvDriveMaster::DefaultSkinDirectoryOnRom( path ); |
|
2197 AknsSrvUtils::SearchDirectoriesL( iFsSession, path, skinfiles ); |
|
2198 for ( ; index < deviceDrives; index++ ) |
|
2199 { |
|
2200 driveMaster->SkinDirectoryOnDrive( |
|
2201 CAknsSrvDriveMaster::EAknsSrvStaticDrive, index, path ); |
|
2202 AknsSrvUtils::SearchDirectoriesL( iFsSession, path, skinfiles ); |
|
2203 } |
|
2204 break; |
|
2205 // drive e |
|
2206 case EAknsSrvMMC: |
|
2207 for ( ; index < massDrives; index++ ) |
|
2208 { |
|
2209 driveMaster->SkinDirectoryOnDrive( |
|
2210 CAknsSrvDriveMaster::EAknsSrvRemovableDrive, index, path ); |
|
2211 AknsSrvUtils::SearchDirectoriesL( iFsSession, path, skinfiles ); |
|
2212 } |
|
2213 break; |
|
2214 // all drives |
|
2215 case EAknsSrvAll: |
|
2216 CAknsSrvDriveMaster::DefaultSkinDirectoryOnRom( path ); |
|
2217 AknsSrvUtils::SearchDirectoriesL( iFsSession, path, skinfiles ); |
|
2218 for ( ; index < deviceDrives; index++ ) |
|
2219 { |
|
2220 driveMaster->SkinDirectoryOnDrive( |
|
2221 CAknsSrvDriveMaster::EAknsSrvStaticDrive, index, path ); |
|
2222 AknsSrvUtils::SearchDirectoriesL( iFsSession, path, skinfiles ); |
|
2223 } |
|
2224 index = 0; |
|
2225 for ( ; index < massDrives; index++ ) |
|
2226 { |
|
2227 driveMaster->SkinDirectoryOnDrive( |
|
2228 CAknsSrvDriveMaster::EAknsSrvRemovableDrive, index, path ); |
|
2229 AknsSrvUtils::SearchDirectoriesL( iFsSession, path, skinfiles ); |
|
2230 } |
|
2231 |
|
2232 break; |
|
2233 default: break; |
|
2234 } |
|
2235 |
|
2236 AKNS_TRACE_INFO1("CAknsSrv::EnumeratePackagesL skin files found = %d", skinfiles->Count() ); |
|
2237 |
|
2238 CheckAndCreateDRMHelper(); |
|
2239 AknsSrvUtils::BuildSkinInfoPackagesL( |
|
2240 iPackageArray, skinfiles, iFsSession, *iDrmHelper ); |
|
2241 |
|
2242 TInt count = iPackageArray->Count(); |
|
2243 AKNS_TRACE_INFO1("CAknsSrv::EnumeratePackagesL packages found = %d", count ); |
|
2244 TPtr8 countptr((TUint8*)(&count),4,4); |
|
2245 aMessage.WriteL( 0,countptr ); |
|
2246 CleanupStack::Pop( skinfiles ); |
|
2247 skinfiles->Reset(); |
|
2248 delete skinfiles; |
|
2249 AKNS_TRACE_INFO("CAknsSrv::EnumeratePackagesL End"); |
|
2250 } |
|
2251 |
|
2252 // ----------------------------------------------------------------------------- |
|
2253 // CAknsSrv::ReceivePackages |
|
2254 // ----------------------------------------------------------------------------- |
|
2255 // |
|
2256 void CAknsSrv::ReceivePackages( const RMessage2 aMessage ) |
|
2257 { |
|
2258 TInt pkgcount = aMessage.Int0(); |
|
2259 |
|
2260 for (TInt count= 0; count < pkgcount; count++) |
|
2261 { |
|
2262 if ( !iPackageArray ) |
|
2263 { |
|
2264 // No package array. |
|
2265 break; |
|
2266 } |
|
2267 if ( iPackageArray->Count() == 0 ) |
|
2268 { |
|
2269 // Package array is empty. |
|
2270 break; |
|
2271 } |
|
2272 if ( count >= iPackageArray->Count() ) |
|
2273 { |
|
2274 // Out-of-bounds with package array. |
|
2275 break; |
|
2276 } |
|
2277 TPtr8 pkgptr((TUint8*)( iPackageArray->At(count)), |
|
2278 sizeof(TAknsSrvSkinInfoPkg),sizeof(TAknsSrvSkinInfoPkg)); |
|
2279 aMessage.Write(1,pkgptr,count*sizeof(TAknsSrvSkinInfoPkg)); |
|
2280 } |
|
2281 if ( iPackageArray ) |
|
2282 { |
|
2283 iPackageArray->ResetAndDestroy(); |
|
2284 } |
|
2285 delete iPackageArray; |
|
2286 iPackageArray = NULL; |
|
2287 } |
|
2288 |
|
2289 // ----------------------------------------------------------------------------- |
|
2290 // CAknsSrv::DecodeWallpaperImageL |
|
2291 // ----------------------------------------------------------------------------- |
|
2292 // |
|
2293 void CAknsSrv::DecodeWallpaperImageL( const RMessage2 aMessage) |
|
2294 { |
|
2295 // message params |
|
2296 // 0 = filename |
|
2297 // 1 = size |
|
2298 // 2 = bmphandle |
|
2299 // 3 = maskhandle |
|
2300 TFileName filename; |
|
2301 TSize trgSize; |
|
2302 TPckg<TSize> sizePack( trgSize ); |
|
2303 aMessage.ReadL(0, filename); |
|
2304 aMessage.ReadL(1, sizePack); |
|
2305 |
|
2306 TAknsSrvWallpaper* wp; |
|
2307 wp = iWallpaperCache->AddL( iFsSession, filename, trgSize, iMaxWallpaperSize ); |
|
2308 |
|
2309 if ( !wp ) |
|
2310 { |
|
2311 return; |
|
2312 } |
|
2313 |
|
2314 TInt bmphandle = 0; |
|
2315 TInt mskhandle = 0; |
|
2316 |
|
2317 if ( trgSize.iHeight >= trgSize.iWidth ) |
|
2318 { |
|
2319 bmphandle = wp->iPortrait ? wp->iPortrait->Handle() : 0; |
|
2320 mskhandle = wp->iPortraitMask ? wp->iPortraitMask->Handle() : 0; |
|
2321 } |
|
2322 else |
|
2323 { |
|
2324 bmphandle = wp->iLandscape ? wp->iLandscape->Handle() : 0; |
|
2325 mskhandle = wp->iLandscapeMask ? wp->iLandscapeMask->Handle() : 0; |
|
2326 } |
|
2327 |
|
2328 TPtr8 bmpptr((TUint8*)(&bmphandle), 4, 4); |
|
2329 TPtr8 mskptr((TUint8*)(&mskhandle), 4, 4); |
|
2330 if (wp->iPortrait || wp->iLandscape) |
|
2331 { |
|
2332 aMessage.Write(2,bmpptr); |
|
2333 } |
|
2334 |
|
2335 aMessage.Write(3,mskptr); |
|
2336 } |
|
2337 |
|
2338 // ----------------------------------------------------------------------------- |
|
2339 // CAknsSrv::CacheWallpaperImageL |
|
2340 // ----------------------------------------------------------------------------- |
|
2341 // |
|
2342 void CAknsSrv::CacheWallpaperImageL( const RMessage2 aMessage) |
|
2343 { |
|
2344 // message params |
|
2345 // 0 = filename |
|
2346 // 1 = size |
|
2347 // 2 = bmphandle |
|
2348 // 3 = maskhandle |
|
2349 TFileName filename; |
|
2350 TSize trgSize; |
|
2351 TPckg<TSize> sizePack( trgSize ); |
|
2352 aMessage.ReadL(0, filename); |
|
2353 aMessage.ReadL(1, sizePack); |
|
2354 |
|
2355 iWallpaperCache->AddL( iFsSession, filename, trgSize, iMaxWallpaperSize ); |
|
2356 return; |
|
2357 } |
|
2358 // ----------------------------------------------------------------------------- |
|
2359 // CAknsSrv::FreeDecodedWallpaper |
|
2360 // ----------------------------------------------------------------------------- |
|
2361 // |
|
2362 void CAknsSrv::FreeDecodedWallpaper( const RMessage2 aMessage ) |
|
2363 { |
|
2364 TFileName filename; |
|
2365 aMessage.ReadL( 0, filename ); |
|
2366 if ( filename.Length() ) |
|
2367 { |
|
2368 iWallpaperCache->Remove( filename ); |
|
2369 } |
|
2370 else |
|
2371 { |
|
2372 iWallpaperCache->ResetAndDestory( ); |
|
2373 } |
|
2374 } |
|
2375 |
|
2376 // ----------------------------------------------------------------------------- |
|
2377 // CAknsSrv::RestoreDefaultSkin |
|
2378 // ----------------------------------------------------------------------------- |
|
2379 // |
|
2380 void CAknsSrv::RestoreDefaultSkin() |
|
2381 { |
|
2382 iMergeType = (TAknsSkinSrvMergeType)(iMergeType | EAknsSkinSrvSkin); |
|
2383 |
|
2384 iSettings->WriteSkinToDefault(); |
|
2385 } |
|
2386 |
|
2387 // ----------------------------------------------------------------------------- |
|
2388 // CAknsSrv::RestoreDefaultIdleWP |
|
2389 // ----------------------------------------------------------------------------- |
|
2390 // |
|
2391 void CAknsSrv::RestoreDefaultIdleWP() |
|
2392 { |
|
2393 iMergeType = (TAknsSkinSrvMergeType)(iMergeType | EAknsSkinSrvIdleWp); |
|
2394 |
|
2395 iSettings->WriteIdleBackgroundToDefault(); |
|
2396 } |
|
2397 |
|
2398 // ----------------------------------------------------------------------------- |
|
2399 // CAknsSrv::RemoveAutomatedWallpaper |
|
2400 // ----------------------------------------------------------------------------- |
|
2401 // |
|
2402 void CAknsSrv::RemoveAutomatedWallpaper( |
|
2403 const TAknsItemID aIID, const TDesC8& aContentUri ) |
|
2404 { |
|
2405 CheckAndCreateDRMHelper(); |
|
2406 if (!iUSBAttached) |
|
2407 { |
|
2408 iDrmHelper->SetAutomatedType(CDRMHelper::EAutomatedTypeWallpaper); |
|
2409 iDrmHelper->RemoveAutomated(aContentUri); |
|
2410 } |
|
2411 AKNS_TRACE_INFO("CAknsSrv - RemoveAutomatedWallpaperL: RemoveAutomated called for idlewp"); |
|
2412 RestoreDefaultIdleWP(); |
|
2413 iChunkMaintainer->SetWallpaper( aIID, KNullDesC(), 0 ); |
|
2414 } |
|
2415 |
|
2416 // ----------------------------------------------------------------------------- |
|
2417 // CAknsSrv::HandleClientError |
|
2418 // ----------------------------------------------------------------------------- |
|
2419 // |
|
2420 void CAknsSrv::HandleClientError( TInt aErrorCode ) |
|
2421 { |
|
2422 AKNS_TRACE_INFO("CAknsSrv::HandleClientError called"); |
|
2423 // Ignore all errors if backup operation is in progress.... |
|
2424 if( iSettings->CachedBackupOperationInProgress() ) |
|
2425 { |
|
2426 return; |
|
2427 } |
|
2428 // We cannot really do anything if the system default skin is |
|
2429 // already set..... |
|
2430 if( iSettings->CachedSkinPID() == iSettings->DefaultSkinPID() ) |
|
2431 { |
|
2432 return; |
|
2433 } |
|
2434 else |
|
2435 { |
|
2436 TBool enabled = iNotifyEnabled; |
|
2437 EnableSkinChangeNotify(); |
|
2438 |
|
2439 if( aErrorCode==KErrNoMemory ) |
|
2440 { |
|
2441 ForceNotifySessions( EAknsSCHNConfigurationOOM ); |
|
2442 } |
|
2443 else |
|
2444 { |
|
2445 ForceNotifySessions( EAknsSCHNConfigurationCorrupt ); |
|
2446 } |
|
2447 |
|
2448 SetDefaultSkinActive(); |
|
2449 |
|
2450 // This merges the skin content: |
|
2451 MergeAndBroadcast(); |
|
2452 |
|
2453 // Package list might have changed as well |
|
2454 ForceNotifySessions( EAknsSCHNPackageListUpdate ); |
|
2455 |
|
2456 // Restore the notify mechanism to its original state so that |
|
2457 // clients do not get confused... |
|
2458 if (!enabled) |
|
2459 { |
|
2460 DisableSkinChangeNotify(); |
|
2461 } |
|
2462 |
|
2463 // Try to update values in shareddata also |
|
2464 RestoreDefaultSDSettings(); |
|
2465 } |
|
2466 } |
|
2467 |
|
2468 // ----------------------------------------------------------------------------- |
|
2469 // CAknsSrv::RestoreDefaultSDSettings() |
|
2470 // Restores default shared data settings |
|
2471 // ----------------------------------------------------------------------------- |
|
2472 // |
|
2473 void CAknsSrv::RestoreDefaultSDSettings(TBool aExcludeWP) |
|
2474 { |
|
2475 AKNS_TRACE_ERROR("CAknsSrv::Skin not found, or other error encountered! Trying to restore default SD settings."); |
|
2476 if (!iUSBAttached) |
|
2477 { |
|
2478 RemoveAutomatedContent(); |
|
2479 } |
|
2480 iSettings->WriteAllToDefault(aExcludeWP); |
|
2481 } |
|
2482 |
|
2483 // ----------------------------------------------------------------------------- |
|
2484 // CAknsSrv::RemoveAutomatedContent |
|
2485 // ----------------------------------------------------------------------------- |
|
2486 // |
|
2487 void CAknsSrv::RemoveAutomatedContent() |
|
2488 { |
|
2489 // Remove all automated content |
|
2490 CheckAndCreateDRMHelper(); |
|
2491 if (!iBootFinished) |
|
2492 { |
|
2493 return; |
|
2494 } |
|
2495 if (iSkinContentUri) |
|
2496 { |
|
2497 iDrmHelper->SetAutomatedType(CDRMHelper::EAutomatedTypeTheme); |
|
2498 iDrmHelper->RemoveAutomated( *iSkinContentUri ); |
|
2499 delete iSkinContentUri; |
|
2500 iSkinContentUri = NULL; |
|
2501 } |
|
2502 if (iIdleWPContentUri) |
|
2503 { |
|
2504 iDrmHelper->SetAutomatedType(CDRMHelper::EAutomatedTypeWallpaper); |
|
2505 iDrmHelper->RemoveAutomated( *iIdleWPContentUri ); |
|
2506 delete iIdleWPContentUri; |
|
2507 iIdleWPContentUri = NULL; |
|
2508 } |
|
2509 if (iSkinContentUri2) |
|
2510 { |
|
2511 iDrmHelper->SetAutomatedType(CDRMHelper::EAutomatedTypeTheme); |
|
2512 iDrmHelper->RemoveAutomated( *iSkinContentUri2 ); |
|
2513 delete iSkinContentUri2; |
|
2514 iSkinContentUri2 = NULL; |
|
2515 } |
|
2516 if (iIdleWPContentUri2) |
|
2517 { |
|
2518 iDrmHelper->SetAutomatedType(CDRMHelper::EAutomatedTypeWallpaper); |
|
2519 iDrmHelper->RemoveAutomated( *iIdleWPContentUri2 ); |
|
2520 delete iIdleWPContentUri2; |
|
2521 iIdleWPContentUri2 = NULL; |
|
2522 } |
|
2523 } |
|
2524 |
|
2525 |
|
2526 // ----------------------------------------------------------------------------- |
|
2527 // CAknsSrv::LoadTfxSrvPluginL |
|
2528 // ----------------------------------------------------------------------------- |
|
2529 // |
|
2530 TBool CAknsSrv::LoadTfxSrvPluginL() |
|
2531 { |
|
2532 // load ServerController |
|
2533 if (!iTFXServerCtrl) |
|
2534 { |
|
2535 TUid implementationUidCtrl = { KTfxSrvCtrlEcomImpl }; |
|
2536 TAny* inputParams = &iWsSession; |
|
2537 |
|
2538 iTFXServerCtrl =(MTransitionServerController*) |
|
2539 REComSession::CreateImplementationL( implementationUidCtrl, |
|
2540 iSrvControllerEComDtorUID, |
|
2541 inputParams ); |
|
2542 } |
|
2543 |
|
2544 // load Server |
|
2545 if (!iTFXServer) |
|
2546 { |
|
2547 TUid implementationUidSrv = { KTfxSrvEcomImpl }; |
|
2548 |
|
2549 iTFXServer =(MTransitionServer*) |
|
2550 REComSession::CreateImplementationL( implementationUidSrv, |
|
2551 iSrvEComDtorUID, |
|
2552 NULL ); |
|
2553 } |
|
2554 |
|
2555 if( iTFXServer && iTFXServerCtrl ) |
|
2556 { |
|
2557 return ETrue; |
|
2558 } |
|
2559 return EFalse; |
|
2560 } |
|
2561 |
|
2562 // ----------------------------------------------------------------------------- |
|
2563 // CAknsSrv::GetTransitionNameL |
|
2564 // ----------------------------------------------------------------------------- |
|
2565 // |
|
2566 void CAknsSrv::GetTransitionNameL( TFileName& aName, TAknsPkgID aPkgId ) |
|
2567 { |
|
2568 |
|
2569 User::LeaveIfError(iSknFile.FullName(aName)); |
|
2570 |
|
2571 TAknsPkgID pkgid = aPkgId; |
|
2572 |
|
2573 aName = KTFxDefaultExtensionPath(); |
|
2574 aName.AppendNumFixedWidthUC( pkgid.iNumber, EHex, 8 ); |
|
2575 if( !pkgid.IsUid() ) |
|
2576 { |
|
2577 aName.AppendNumFixedWidthUC( pkgid.iTimestamp, EHex, 8 ); |
|
2578 } |
|
2579 aName.Append(KPathDelimiter); |
|
2580 aName.AppendNumFixedWidthUC( pkgid.iNumber, EHex, 8 ); |
|
2581 if( !pkgid.IsUid() ) |
|
2582 { |
|
2583 aName.AppendNumFixedWidthUC( pkgid.iTimestamp, EHex, 8 ); |
|
2584 } |
|
2585 aName.Append(KTFxExtFileExt); |
|
2586 if (!AknsSrvUtils::IsFile( iFsSession, aName ) ) |
|
2587 { |
|
2588 // Try the s60 default as a fallback |
|
2589 pkgid = KAknsPIDS60DefaultSkin; |
|
2590 aName = KTFxDefaultExtensionPath(); |
|
2591 aName.AppendNumFixedWidthUC( pkgid.iNumber, EHex, 8 ); |
|
2592 if( !pkgid.IsUid() ) |
|
2593 { |
|
2594 aName.AppendNumFixedWidthUC( pkgid.iTimestamp, EHex, 8 ); |
|
2595 } |
|
2596 aName.Append(KPathDelimiter); |
|
2597 aName.AppendNumFixedWidthUC( pkgid.iNumber, EHex, 8 ); |
|
2598 if( !pkgid.IsUid() ) |
|
2599 { |
|
2600 aName.AppendNumFixedWidthUC( pkgid.iTimestamp, EHex, 8 ); |
|
2601 } |
|
2602 |
|
2603 aName.Append(KTFxExtFileExt); |
|
2604 if (!AknsSrvUtils::IsFile( iFsSession, aName ) ) |
|
2605 { |
|
2606 User::Leave(KErrNotFound); |
|
2607 } |
|
2608 } |
|
2609 } |
|
2610 |
|
2611 // ----------------------------------------------------------------------------- |
|
2612 // CAknsSrv::CloseTfxServerConnection |
|
2613 // ----------------------------------------------------------------------------- |
|
2614 // |
|
2615 void CAknsSrv::CloseTfxServerConnection() |
|
2616 { |
|
2617 if( iTFXServer ) |
|
2618 { |
|
2619 // disconnect also calls close to actual R-object |
|
2620 iTFXServer->Disconnect(); |
|
2621 delete iTFXServer; |
|
2622 iTFXServer = NULL; |
|
2623 REComSession::DestroyedImplementation( iSrvEComDtorUID ); |
|
2624 iSrvEComDtorUID.iUid = 0; |
|
2625 } |
|
2626 } |
|
2627 |
|
2628 // ----------------------------------------------------------------------------- |
|
2629 // CAknsSrv::CheckAndCreateDRMHelper |
|
2630 // ----------------------------------------------------------------------------- |
|
2631 // |
|
2632 void CAknsSrv::CheckAndCreateDRMHelper() |
|
2633 { |
|
2634 if( iDrmHelper ) |
|
2635 { |
|
2636 return; |
|
2637 } |
|
2638 |
|
2639 AKNS_TRACE_INFO("CAknsSrv::CheckAndCreateDRMHelper No helper, creating"); |
|
2640 |
|
2641 TRAPD(helperErr, iDrmHelper = CDRMHelper::NewL() ); |
|
2642 if( helperErr || (!iDrmHelper) ) |
|
2643 { |
|
2644 AKNS_TRACE_ERROR("CAknsSrv::CheckAndCreateDRMHelper FATAL DRMHELPER FAILURE!"); |
|
2645 User::Panic( KAknSkinSrvPanicCategory, EAknsSrvFatalDRMFailure ); |
|
2646 } |
|
2647 |
|
2648 AKNS_TRACE_INFO("CAknsSrv::CheckAndCreateDRMHelper COMPLETED"); |
|
2649 } |
|
2650 |
|
2651 // ----------------------------------------------------------------------------- |
|
2652 // Sets default skin active. |
|
2653 // ----------------------------------------------------------------------------- |
|
2654 // |
|
2655 void CAknsSrv::SetDefaultSkinActive() |
|
2656 { |
|
2657 SetActiveSkinContent( iSettings->DefaultSkinPID() ); |
|
2658 } |
|
2659 |
|
2660 // ----------------------------------------------------------------------------- |
|
2661 // Reads slide set image filenames from file to member variable. |
|
2662 // ----------------------------------------------------------------------------- |
|
2663 // |
|
2664 void CAknsSrv::ReadSlideSetImageFilesL() |
|
2665 { |
|
2666 WallpaperTimerL()->Stop(); |
|
2667 |
|
2668 TFileName fileName; |
|
2669 CAknsSrvDriveMaster::GetDefaultDrive( |
|
2670 DriveInfo::EDefaultPhoneMemory, fileName ); |
|
2671 fileName.Append( KAknsSrvSSWPInifile ); |
|
2672 |
|
2673 RFile file; |
|
2674 User::LeaveIfError( file.Open( |
|
2675 iFsSession,fileName, EFileRead|EFileShareAny )); |
|
2676 CleanupClosePushL( file ); |
|
2677 |
|
2678 if ( iSlideSetNameArray ) |
|
2679 { |
|
2680 iSlideSetNameArray->Reset(); |
|
2681 delete iSlideSetNameArray; |
|
2682 iSlideSetNameArray = NULL; |
|
2683 } |
|
2684 iSlideSetNameArray = new(ELeave) CDesCArrayFlat(5); |
|
2685 |
|
2686 TFileText textFile; |
|
2687 textFile.Set( file ); |
|
2688 textFile.Seek( ESeekStart ); |
|
2689 |
|
2690 // Wait some time so that file write is finished. |
|
2691 User::After( KAknSkinSrvWaitForWriteToEnd ); |
|
2692 |
|
2693 FOREVER |
|
2694 { |
|
2695 TFileName filename; |
|
2696 if( textFile.Read( filename ) != KErrNone ) |
|
2697 { |
|
2698 break; |
|
2699 } |
|
2700 iSlideSetNameArray->AppendL( filename ); |
|
2701 } |
|
2702 iCurrentSlide = 0; |
|
2703 CleanupStack::PopAndDestroy(); // file |
|
2704 } |
|
2705 |
|
2706 |
|
2707 // ----------------------------------------------------------------------------- |
|
2708 // Returns the pointer to slide set timer. |
|
2709 // ----------------------------------------------------------------------------- |
|
2710 // |
|
2711 CAknsSrvWallpaperTimer* CAknsSrv::WallpaperTimerL() |
|
2712 { |
|
2713 if ( iWallpaperTimer == NULL ) |
|
2714 { |
|
2715 iWallpaperTimer = CAknsSrvWallpaperTimer::NewL( this ); |
|
2716 } |
|
2717 |
|
2718 return iWallpaperTimer; |
|
2719 } |
|
2720 |
|
2721 // ----------------------------------------------------------------------------- |
|
2722 // Sets slideset wallpaper interval timer active. |
|
2723 // ----------------------------------------------------------------------------- |
|
2724 // |
|
2725 void CAknsSrv::SetSlideSetTimerActiveL() |
|
2726 { |
|
2727 AKNS_TRACE_INFO("CAknsSrv::SetSlideSetTimerActiveL"); |
|
2728 |
|
2729 TInt timeout = iSettings->SlideSetWPTimeout(); |
|
2730 WallpaperTimerL()->Start( timeout ); |
|
2731 } |
|
2732 |
|
2733 |
|
2734 // ----------------------------------------------------------------------------- |
|
2735 // Load max image size from CenRep. |
|
2736 // ----------------------------------------------------------------------------- |
|
2737 // |
|
2738 void CAknsSrv::InitMaxImageSizeL() |
|
2739 { |
|
2740 iMaxWallpaperSize = TSize(KAknsMaxWpWidth,KAknsMaxWpHeight); |
|
2741 |
|
2742 CRepository* repository = CRepository::NewL( KCRUidWallpaperConfiguration ); |
|
2743 repository->Get( KWpConfMaxWallpaperWidth, iMaxWallpaperSize.iWidth ); |
|
2744 repository->Get( KWpConfMaxWallpaperHeight, iMaxWallpaperSize.iHeight ); |
|
2745 |
|
2746 delete repository; |
|
2747 |
|
2748 } |
|
2749 |
|
2750 // ----------------------------------------------------------------------------- |
|
2751 // Backup current skin name and active default skin. |
|
2752 // ----------------------------------------------------------------------------- |
|
2753 // |
|
2754 void CAknsSrv::BackupAndActiveDefaultSkin() |
|
2755 { |
|
2756 if( iSkinOnRemovableDrive ) |
|
2757 { |
|
2758 iOldSkin = iSettings->CachedSkinPID(); |
|
2759 AKNS_TRACE_INFO("CAknsSrv::NotifyUSBAttach - USB attached, restoring default skin"); |
|
2760 SetDefaultSkinActive(); |
|
2761 RestoreDefaultSDSettings(ETrue); |
|
2762 MergeAndBroadcast(); |
|
2763 } |
|
2764 else |
|
2765 { |
|
2766 // we really are not interested in mmc stuff if the current skin is not on MMC |
|
2767 iOldSkin = KAknsNullPkgID; |
|
2768 return; |
|
2769 } |
|
2770 } |
|
2771 |
|
2772 // ----------------------------------------------------------------------------- |
|
2773 // Reactive backup skin. |
|
2774 // ----------------------------------------------------------------------------- |
|
2775 // |
|
2776 void CAknsSrv::RestoreOldSkin() |
|
2777 { |
|
2778 if (iOldSkin != KAknsNullPkgID) |
|
2779 { |
|
2780 |
|
2781 if ( iSettings->CachedSkinPID() != iSettings->DefaultSkinPID() ) |
|
2782 { |
|
2783 //Keep None Default active skin |
|
2784 iOldSkin = KAknsNullPkgID; |
|
2785 return; |
|
2786 } |
|
2787 |
|
2788 SetActiveSkinContent( iOldSkin ); |
|
2789 iSettings->WriteSkinSettings(iOldSkin, ETrue); |
|
2790 iOldSkin = KAknsNullPkgID; |
|
2791 MergeAndBroadcast(); |
|
2792 return; // if skin was on mmc, the wallpaper is handled aswell |
|
2793 } |
|
2794 // skin was not on mmc, but wp was |
|
2795 if ( iWPOnRemovableDrive && iWPFilename ) |
|
2796 { |
|
2797 // Check if wallpaper file is still found. |
|
2798 // If so, continue observing. |
|
2799 if ( AknsSrvUtils::IsFile( iFsSession, *iWPFilename ) ) |
|
2800 { |
|
2801 if (iWallpaperObserver) |
|
2802 { |
|
2803 iWallpaperObserver->IssueRequest(); |
|
2804 } |
|
2805 } |
|
2806 else |
|
2807 { |
|
2808 iWPOnRemovableDrive = EFalse; |
|
2809 WallpaperLost(); |
|
2810 } |
|
2811 } |
|
2812 } |
|
2813 |
|
2814 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
2815 |
|
2816 // ----------------------------------------------------------------------------- |
|
2817 // ThreadFunction() |
|
2818 // Needed only in WINS build |
|
2819 // ----------------------------------------------------------------------------- |
|
2820 // |
|
2821 #ifdef __WINS__ |
|
2822 GLDEF_C TInt ThreadFunction( TAny* /*aThreadParams*/ ) |
|
2823 { |
|
2824 // increase dll's user count so it can't get unloaded when the client |
|
2825 // application terminates |
|
2826 |
|
2827 RLibrary lib; |
|
2828 lib.Load( KAknSkinSrvLibName ); // AknSkinServer.dll |
|
2829 |
|
2830 return CAknsSrv::ThreadStart(); |
|
2831 } |
|
2832 #endif // __WINS__ |
|
2833 |
|
2834 // ----------------------------------------------------------------------------- |
|
2835 // StartServer() |
|
2836 // Create the server thread/process |
|
2837 // ----------------------------------------------------------------------------- |
|
2838 // |
|
2839 GLDEF_C TInt StartServer() |
|
2840 { |
|
2841 AKNS_TRACE_INFO("CAknsSrv/StartServer ENTERED"); |
|
2842 |
|
2843 TInt ret( KErrNone ); |
|
2844 |
|
2845 // Launch server process |
|
2846 RProcess server; |
|
2847 ret = server.Create( KAknSkinSrvExe, KNullDesC, |
|
2848 TUidType( KNullUid, KNullUid, KNullUid ), |
|
2849 EOwnerThread ); |
|
2850 |
|
2851 if( ret != KErrNone ) |
|
2852 { |
|
2853 AKNS_TRACE_ERROR1("CAknsSrv/StartServer CREATE FAILED, ret=%d", ret); |
|
2854 return ret; |
|
2855 } |
|
2856 |
|
2857 // Sync server startup |
|
2858 TRequestStatus rendezvousStatus; |
|
2859 server.Rendezvous(rendezvousStatus); |
|
2860 |
|
2861 // Check the rendezvous status before resuming |
|
2862 if(rendezvousStatus!=KRequestPending) |
|
2863 { |
|
2864 AKNS_TRACE_INFO("CAknsSrv/StartServer: startup aborted"); |
|
2865 server.Kill(0); // Abort startup |
|
2866 } |
|
2867 else |
|
2868 { |
|
2869 AKNS_TRACE_INFO("CAknsSrv/StartServer: resuming server process"); |
|
2870 server.Resume(); // Resume process |
|
2871 } |
|
2872 |
|
2873 AKNS_TRACE_INFO("CAknsSrv/StartServer: wait for server"); |
|
2874 |
|
2875 // Wait for server start (or death) |
|
2876 User::WaitForRequest(rendezvousStatus); |
|
2877 |
|
2878 // We can't use status alone since it might be 0 in case of a panic |
|
2879 ret = (server.ExitType()==EExitPanic) ? KErrGeneral : rendezvousStatus.Int(); |
|
2880 |
|
2881 // Close server handle |
|
2882 server.Close(); |
|
2883 |
|
2884 AKNS_TRACE_INFO1("CAknsSrv/StartServer: server start status %d", rendezvousStatus.Int()); |
|
2885 |
|
2886 AKNS_TRACE_INFO("CAknsSrv/StartServer EXIT"); |
|
2887 |
|
2888 // Return the status code |
|
2889 return rendezvousStatus.Int(); |
|
2890 } |
|
2891 |
|
2892 |
|
2893 // ----------------------------------------------------------------------------- |
|
2894 // Check if the slideset wallpaper can change. |
|
2895 // ----------------------------------------------------------------------------- |
|
2896 // |
|
2897 TBool CAknsSrv::CanChangeSlidesetWallpaperL() |
|
2898 { |
|
2899 TBool retval = EFalse; |
|
2900 RWsSession wsSession; |
|
2901 |
|
2902 TInt errorcode = wsSession.Connect(); |
|
2903 if(errorcode != KErrNone) |
|
2904 { |
|
2905 return retval; |
|
2906 } |
|
2907 |
|
2908 CleanupClosePushL(wsSession); |
|
2909 CApaWindowGroupName *topWindowgroup = CApaWindowGroupName::NewLC(wsSession, wsSession.GetFocusWindowGroup()); |
|
2910 TUid topUid = topWindowgroup->AppUid(); |
|
2911 CleanupStack::PopAndDestroy(2); |
|
2912 |
|
2913 if( iSlidesetEnableAppUidArray.Find( topUid.iUid ) != KErrNotFound ) |
|
2914 { |
|
2915 retval = ETrue; |
|
2916 } |
|
2917 |
|
2918 return retval; |
|
2919 } |
|
2920 |
|
2921 // ----------------------------------------------------------------------------- |
|
2922 // Load slideset disable application uid from rss file. |
|
2923 // ----------------------------------------------------------------------------- |
|
2924 // |
|
2925 void CAknsSrv::InitSlidesetEnableAppUid() |
|
2926 { |
|
2927 for ( int i = 0; i < sizeof( KSlidesetEnableAppUid ) |
|
2928 / sizeof( KSlidesetEnableAppUid[0] ); i++ ) |
|
2929 { |
|
2930 iSlidesetEnableAppUidArray.Append( KSlidesetEnableAppUid[i] ); |
|
2931 } |
|
2932 } |
|
2933 |
|
2934 // End of File |