skins/AknSkins/srvinc/AknsSrv.h
changeset 0 05e9090e2422
child 54 08459e712984
equal deleted inserted replaced
-1:000000000000 0:05e9090e2422
       
     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 #ifndef AKNSSRV_H
       
    20 #define AKNSSRV_H
       
    21 
       
    22 // INCLUDES
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <fbs.h>
       
    26 
       
    27 #include <w32std.h>
       
    28 
       
    29 #include "AknsSrvSettings.h"
       
    30 #include <AknsItemID.h>
       
    31 #include <AknsPkgID.h>
       
    32 #include "AknsSrvItemDef.h"
       
    33 #include "AknsSrvSession.h"
       
    34 #include <AknsSrvSkinInformationPkg.h>
       
    35 #include "AknsSrvChunkMaintainer.h"
       
    36 #include "AknsSrvBitmapRenderer.h"
       
    37 #include "AknsSrvBitmapStore.h"
       
    38 #include "aknssrvinstallobserver.h"
       
    39 #include "aknssrvwallpapertimer.h"
       
    40 
       
    41 #include "AknsSrvWallpaperCache.h"
       
    42 
       
    43 #include "tfxconfigparser.h"
       
    44 // CONSTANTS
       
    45 // File extension for dynamic link library.
       
    46 _LIT(KDllPostFix,".DLL");
       
    47 // File extension for skin binary file.
       
    48 _LIT(KSKNPostFix,"\\*.SKN");
       
    49 
       
    50 // Empty string.
       
    51 _LIT( KAknsSkinSrvEmptyString, "" );
       
    52 
       
    53 const TUint KAknSkinSrvMajorVersionNumber=0;
       
    54 const TUint KAknSkinSrvMinorVersionNumber=1;
       
    55 const TUint KAknSkinSrvBuildVersionNumber=1;
       
    56 
       
    57 // Needed for creating server thread.
       
    58 const TUint KDefaultHeapSize=160*1024;
       
    59 
       
    60 _LIT(KAknSkinSrvName,"!AknSkinServer");
       
    61 _LIT(KAknSkinSrvExe,"Z:\\System\\Programs\\AknSkinSrv.exe");
       
    62 _LIT(KAknSkinSrvLibName,"AknSkinSrv.dll");
       
    63 
       
    64 // Minimum amount of RAM needed to activate skin.
       
    65 const TInt KAknSkinSrvFreeRAMNeeded = 2000000;
       
    66 
       
    67 // Amount of time to wait when ini-file has changed, so that 
       
    68 // writing is finished.
       
    69 const TInt KAknSkinSrvWaitForWriteToEnd = 1000000;
       
    70 
       
    71 class MTransitionServerController;
       
    72 class MTransitionServer;
       
    73 
       
    74 // DATA TYPES
       
    75 
       
    76 /**
       
    77 * Opcodes used in message passing between client and server.
       
    78 */
       
    79 enum TAknSkinSrvRequest
       
    80     {
       
    81     EAknSkinSrvEnableNotifySkinChange   = 0,
       
    82     EAknSkinSrvDisableNotifySkinChange  = 1,
       
    83     EAknSkinSrvSetAllItemDefSets        = 2,
       
    84     EAknSkinSrvSetItemDefSet            = 3,
       
    85     EAknSkinSrvClientError              = 4,
       
    86     EAknSkinSrvSetNotifyHandler         = 5,
       
    87     EAknSkinSrvNextEvent                = 6,
       
    88     EAknSkinSrvCancel                   = 7,
       
    89     EAknSkinSrvSetIdleWallPaper         = 8,
       
    90     EAknSkinSrvSetPinboardWallPaper     = 9,
       
    91     EAknSkinSrvStoreScalableGfx         = 10,
       
    92     EAknSkinSrvClearScalableGfx         = 11,
       
    93     EAknSkinSrvAckNotification          = 12,
       
    94     EAknSkinSrvOpenBitmapFile           = 13,
       
    95     EAknSkinSrvDeleteSkin               = 14,
       
    96     EAknSkinSrvCopySkin                 = 15,
       
    97     EAknSkinSrvOpenIniFile              = 16,
       
    98     EAknSkinSrvCopySoundFile            = 17,
       
    99     EAknSkinSrvEnumeratePackages        = 18,
       
   100     EAknSkinSrvReceivePackages          = 19,
       
   101     EAknSkinSrvStoreMorphingScalableGfx = 20,
       
   102     EAknSkinSrvDecodeWallpaperImage     = 21,
       
   103     EAknSkinSrvFreeDecodedWallpaper     = 22,
       
   104     EAknSkinSrvFreeLayoutBitmaps        = 23,
       
   105     EAknSkinSrvOpenImageInifile         = 24,
       
   106     EAknSkinSrvSetSlideSetWP            = 25,
       
   107     EAknSkinSrvCheckIconConfiguration   = 26,
       
   108     EAknSkinSrvStopSSIniFileObserver    = 27,
       
   109     EAknSkinSrvCacheWallpaperImage      = 28,
       
   110     };
       
   111 
       
   112 enum TAknsSkinSrvMergeType
       
   113     {
       
   114     EAknsSkinSrvNone = 0,
       
   115     EAknsSkinSrvSkin = 2,
       
   116     EAknsSkinSrvIdleWp = 4,
       
   117     EAknsSkinSrvPinbWp = 8,
       
   118     };
       
   119 
       
   120 struct TAknsSrvLayoutInfo
       
   121     {
       
   122     TInt iLayoutType;
       
   123     TSize iLayoutSize;
       
   124     };
       
   125 
       
   126 
       
   127 // FUNCTION PROTOTYPES
       
   128 
       
   129 /**
       
   130 * Function to start the server thread/process.
       
   131 */
       
   132 GLREF_C TInt StartServer();
       
   133 
       
   134 #ifdef __WINS__
       
   135 
       
   136 /**
       
   137 * Thread function for WINS builds.
       
   138 */
       
   139 GLREF_C TInt ThreadFunction( TAny* aThreadParams );
       
   140 
       
   141 #endif // __WINS__
       
   142 
       
   143 // FORWARD DECLARATIONS
       
   144 
       
   145 class CAknsSrvExclusionList;
       
   146 class CDRMHelper;
       
   147 class CAknsSrvBitmapStore;
       
   148 class CAknsSrvActiveDataOwner;
       
   149 class CAknsSrvIconConfigMap;
       
   150 
       
   151 
       
   152 // CLASS DECLARATIONS
       
   153 
       
   154 
       
   155 /**
       
   156 * Server implementation class.
       
   157 *
       
   158 */
       
   159 NONSHARABLE_CLASS(CAknsSrv) : public CServer2,
       
   160                               public MAknsSrvSettingObserver,
       
   161                               public MAknsSrvMorphingListener,
       
   162                               public MAknsSrvFileObserver,
       
   163                               public MAknsSrvWallpaperListener
       
   164     {
       
   165     public:
       
   166 
       
   167         /**
       
   168         * Static constructor.
       
   169         *
       
   170         * @return Newly created server object.
       
   171         */
       
   172         static CAknsSrv* New( TBool& aStartFailed );
       
   173 
       
   174         /**
       
   175         * Destructor.
       
   176         */
       
   177         virtual ~CAknsSrv();
       
   178 
       
   179     public:
       
   180 
       
   181         /**
       
   182         * Creates a new session.
       
   183         *
       
   184         * @since 2.0
       
   185         *
       
   186         * @param aVersion Skin server version.
       
   187         *
       
   188         * @return Newly created session object.
       
   189         */
       
   190         CSession2* NewSessionL( const TVersion& aVersion, const RMessage2& aMessage) const;
       
   191 
       
   192         /**
       
   193         * Server bootstrap code.
       
   194         *
       
   195         * @since 2.0
       
   196         *
       
   197         *
       
   198         */
       
   199         IMPORT_C static TInt ThreadStart();
       
   200 
       
   201     public: // From MAknsSrvSettingObserver
       
   202 
       
   203         void NotifyBackupOperationEnd();
       
   204         void NotifyLayoutChange(TBool aClearScalable);
       
   205         void NofifySkinChange();
       
   206         void NotifyIdleBackgroundChange();
       
   207         void NotifyDRMChange();
       
   208         void NotifyDRMChangeL();
       
   209         void NotifyUSBAttach();
       
   210         void NotifyUSBRemoval();
       
   211         void NotifySlideSetTimeoutChange();
       
   212         void NotifySlideSetTypeChange();
       
   213         void NotifyWallpaperTypeChange();
       
   214         // Notify screensaver state change.
       
   215         void NotifyScreenSaverChange();
       
   216 
       
   217         void NotifyTransitionFxChange();
       
   218         void StartTransitionSrvL(TBool aSkipSrvStart = EFalse);
       
   219         void StopTransitionSrv();
       
   220         void NotifyDriveChange( const TInt& aDrive, const TBool& aMediaNotPresent );
       
   221         void NotifyBackupOperationBegin();
       
   222         void NotifyAnimBackgroundChange();
       
   223 
       
   224     public:
       
   225         void MorhphingEventTimeout();
       
   226         void NewSkinPackagesInstalled();
       
   227         void WallpaperLost();
       
   228         // Observer interface - slide set ini-file has been changed.
       
   229         void SlideSetModifiedL();
       
   230     public: // New functions
       
   231 
       
   232         /**
       
   233         * Disables the skin notification mechanism.
       
   234         *
       
   235         * @since 2.0
       
   236         *
       
   237         */
       
   238         void DisableSkinChangeNotify();
       
   239 
       
   240         /**
       
   241         * Enables the skin notification mechanism
       
   242         *
       
   243         * @since 2.0
       
   244         */
       
   245         void EnableSkinChangeNotify();
       
   246 
       
   247         void BroadcastUpdate();
       
   248         /**
       
   249         * Merges skin content and notifies all the sessions.
       
   250         *
       
   251         * @since 2.7
       
   252         */
       
   253         TInt MergeAndBroadcast();
       
   254 
       
   255         /**
       
   256         * Notifies change of the given type to all sessions.
       
   257         *
       
   258         * @param aType Type of the notification.
       
   259         *
       
   260         * @return Number of sessions that will process the notification.
       
   261         *
       
   262         * @since 2.5
       
   263         */
       
   264         TInt ForceNotifySessions(
       
   265             const TAknsSkinChangeHandlerNotification aType,
       
   266             TBool aCountNotifications = EFalse);
       
   267 
       
   268         /**
       
   269         * Skin content setter function.
       
   270         *
       
   271         * @since 2.0
       
   272         *
       
   273         * @param aPID Package ID of the skin that will be used for all the item
       
   274         *   types.
       
   275         */
       
   276         void SetActiveSkinContent(const TAknsPkgID aPID);
       
   277 
       
   278         /**
       
   279         * Prepares merged skin content based on active definition sets.
       
   280         *
       
   281         * @since 2.0
       
   282         */
       
   283         void PrepareMergedSkinContentL();
       
   284 
       
   285         /**
       
   286         * Prepares merged skin content based on active definition sets
       
   287         * without being semaphore-safe.
       
   288         *
       
   289         * @since 2.8
       
   290         */
       
   291         void PrepareMergedSkinContentUnprotectedL();
       
   292 
       
   293         /**
       
   294         * Handles the client error condition.
       
   295         */
       
   296         void HandleClientError(TInt aErrorCode);
       
   297 
       
   298         /**
       
   299         *
       
   300         */
       
   301         void SetWallpaperL(const TDesC& aFilename,
       
   302             const TAknsItemID& aIID, TBool aIsSlide = EFalse);
       
   303 
       
   304         /**
       
   305         *
       
   306         * @since 2.8
       
   307         */
       
   308         void StoreScalableGraphicsL( const TAknsItemID& aIID,
       
   309             const TInt aType, const TSize& aSize, TInt aBmpHandle, TInt aMskHandle, TBool aMorphing);
       
   310 
       
   311         /**
       
   312         *
       
   313         * @since 2.8
       
   314         */
       
   315         void ClearScalableGraphics();
       
   316 
       
   317         /**
       
   318         * Marks the given notification acknowledged.
       
   319         *
       
   320         * @param aType Type of the notification.
       
   321         *
       
   322         * @since 2.7
       
   323         */
       
   324         void AcknowledgeNotification( const TInt aType );
       
   325 
       
   326         void OpenBitmapFileL( const RMessage2 aMessage );
       
   327         void OpenIniFileL( const RMessage2 aMessage);
       
   328         void CopySoundFileL( const RMessage2 aMessage);
       
   329         void EnumeratePackages( const RMessage2 aMessage );
       
   330         void EnumeratePackagesL( const RMessage2 aMessage );
       
   331         void ReceivePackages( const RMessage2 aMessage );
       
   332         void DecodeWallpaperImageL( const RMessage2 aMessage);
       
   333         void FreeDecodedWallpaper( const RMessage2 aMessage );
       
   334         void CacheWallpaperImageL( const RMessage2 aMessage);
       
   335 
       
   336         /**
       
   337         * Opens ini-file for slideset.
       
   338         *
       
   339         * @since 3.2
       
   340         */
       
   341         void OpenImageInifileL(const RMessage2 aMessage);
       
   342 
       
   343         TBool CheckImageL(const TDesC& aFilename, TBool& aIsProtected );
       
   344 
       
   345         /**
       
   346         *
       
   347         */
       
   348         void SetSlidesetWallpaperL();
       
   349 
       
   350         /**
       
   351         *
       
   352         */
       
   353         void WallpaperTimerTimeoutL( TBool aForceChange = EFalse );
       
   354 
       
   355         /**
       
   356         *
       
   357         */
       
   358         void StopSlidesetIniFileObserver();
       
   359 
       
   360         /**
       
   361         *
       
   362         */
       
   363         void FreeLayoutBitmaps( const RMessage2 aMessage);
       
   364 
       
   365         /**
       
   366         * Checks if the application UID has repository based configuration for its icons.
       
   367         * 
       
   368         * @since 3.2
       
   369         */
       
   370         TInt CheckIconConfiguration( const RMessage2 aMessage );
       
   371 
       
   372     private:
       
   373 
       
   374         /**
       
   375         * Default C++ constructor
       
   376         */
       
   377         CAknsSrv();
       
   378 
       
   379         /**
       
   380         * The actual skin merge function.
       
   381         */
       
   382         void DoMergeSkinL( const TAknsPkgID aSkinPID,
       
   383             const TAknsPkgID aLocationPID,
       
   384             const TAknsItemDefClass aClass, const TBool aClearTable,
       
   385             const TBool aAHOverrideSkin );
       
   386 
       
   387         /**
       
   388         * Restores default shared data settings
       
   389         */
       
   390         void RestoreDefaultSDSettings(TBool aExcludeWP = EFalse);
       
   391 
       
   392         void RestoreDefaultSkin();
       
   393         void RestoreDefaultIdleWP();
       
   394 
       
   395         void CheckAndCreateDRMHelper();
       
   396         void RemoveAutomatedWallpaper(const TAknsItemID aIID, const TDesC8& aContentUri);
       
   397         void RemoveAutomatedContent();
       
   398 
       
   399         /**
       
   400         * Loads TfxSrv srv / srv controller objects if available
       
   401         */
       
   402         TBool LoadTfxSrvPluginL();
       
   403         void GetTransitionNameL( TFileName& aName, TAknsPkgID aPkgId );
       
   404         void CloseTfxServerConnection();
       
   405 
       
   406         /**
       
   407         * Sets default skin active.
       
   408         */
       
   409         void SetDefaultSkinActive();
       
   410 
       
   411         /**
       
   412         * Reads slide set filenames from a file to a member variable.
       
   413         */
       
   414         void ReadSlideSetImageFilesL();
       
   415 
       
   416         /**
       
   417         * Returns the pointer to slide set timer.
       
   418         * If timer is not created, creates it first.
       
   419         */
       
   420         CAknsSrvWallpaperTimer* WallpaperTimerL();
       
   421 
       
   422         /**
       
   423         * Sets the slide set timer active.
       
   424         */
       
   425         void SetSlideSetTimerActiveL();
       
   426         
       
   427         /**
       
   428         * Load max image size from CenRep.
       
   429         */
       
   430         void InitMaxImageSizeL();
       
   431 
       
   432 
       
   433         /**
       
   434         * Backup current skin name and active default skin.
       
   435         */
       
   436         void BackupAndActiveDefaultSkin();
       
   437 
       
   438         /**
       
   439         * Reactive backup skin.
       
   440         */
       
   441         void RestoreOldSkin();
       
   442 
       
   443         /**
       
   444         * Check if the slideset wallpaper can change.
       
   445         */
       
   446         TBool CanChangeSlidesetWallpaperL();
       
   447         
       
   448         /**
       
   449         * Load slideset enable application uid.
       
   450         */
       
   451         void InitSlidesetEnableAppUid();
       
   452         
       
   453 		/**
       
   454         * Check if active skin support animation background
       
   455         */
       
   456         TBool ActiveSkinAnimBgSupportL();
       
   457         
       
   458 		/**
       
   459         * Get animation background parameter of active skin, 
       
   460 		* Owner Transfered
       
   461         */
       
   462         HBufC* ActiveSkinAnimBgParamL();
       
   463         
       
   464         /**
       
   465         * Start animation background if possible
       
   466         */
       
   467         void StartAnimBackgroundL();   
       
   468 
       
   469     private: // Data
       
   470 
       
   471         CAknsSrvSettings* iSettings;
       
   472 
       
   473         TBool iNotifyEnabled;
       
   474         TBool iContentChanged;
       
   475         TInt iOutstandingChangeEvents;
       
   476 
       
   477         RFbsSession iFbsSession;
       
   478         RFs iFsSession;
       
   479 
       
   480         TInt iSkinCount;
       
   481         CAknsSrvSkinInformationPkg* iSkinInfoPkgs;
       
   482 
       
   483         CAknsSrvChunkMaintainer* iChunkMaintainer;
       
   484 
       
   485         CAknsSrvExclusionList* iExclusionList;
       
   486 
       
   487         CDRMHelper* iDrmHelper;
       
   488         HBufC8* iSkinContentUri;
       
   489         HBufC8* iIdleWPContentUri;
       
   490         HBufC8* iSkinContentUri2;
       
   491         HBufC8* iIdleWPContentUri2;
       
   492         HBufC* iWPFilename;
       
   493         TAknsPkgID iOldSkin;
       
   494 
       
   495         CBaBackupSessionWrapper* iBackupSession;
       
   496 
       
   497         // Active skin in on removable drive.
       
   498         TBool iSkinOnRemovableDrive;
       
   499 
       
   500         // Current wallpaper on removable drive.
       
   501         TBool iWPOnRemovableDrive;
       
   502 
       
   503         // USB cable has been attached.
       
   504         TBool iUSBAttached;
       
   505 
       
   506         CAknsSrvBitmapStore* iBitmapStore;
       
   507         TAknsSkinSrvMergeType iMergeType;
       
   508         TBool iBootFinished;
       
   509 
       
   510         CArrayPtrFlat<TAknsSrvSkinInfoPkg>* iPackageArray;
       
   511 
       
   512         CAknsSrvFileObserver* iInstallObserver;
       
   513         CAknsSrvFileObserver* iWallpaperObserver;
       
   514 
       
   515         RFile iSknFile;
       
   516 
       
   517         /*
       
   518         *  Timer for slideset.
       
   519         *  Own.
       
   520         */
       
   521         CAknsSrvWallpaperTimer* iWallpaperTimer;
       
   522 
       
   523         /*
       
   524         * Index of currently active wallpaper in slideset.
       
   525         */
       
   526         TInt iCurrentSlide;
       
   527 
       
   528         /* 
       
   529         *  Array of filenames forming the slideset.
       
   530         *  Own.
       
   531         */
       
   532         CDesCArray* iSlideSetNameArray;
       
   533         
       
   534         /* 
       
   535         * Type of wallpaper (none/image/slideset).
       
   536         */
       
   537         TInt iWallpaperType;
       
   538 
       
   539         /**
       
   540         * Observes for slide set wallpaper ini-file changes.
       
   541         * Own.
       
   542         */
       
   543         CAknsSrvFileObserver* iSlideSetObserver;
       
   544 
       
   545         // For transition effects
       
   546 
       
   547         // using tfxsrv via plugin interface
       
   548         MTransitionServerController* iTFXServerCtrl;
       
   549         MTransitionServer* iTFXServer;
       
   550 
       
   551         // for destroying ecom implementation
       
   552         TUid iSrvControllerEComDtorUID;
       
   553         TUid iSrvEComDtorUID;
       
   554 
       
   555         RWsSession iWsSession;
       
   556 
       
   557         /* Observes for backup state and controls active data owner
       
   558         *  for skin server backup/restore.
       
   559         *  Own.
       
   560         */
       
   561         CAknsSrvActiveDataOwner* iBackupNotifier;
       
   562 
       
   563         /**
       
   564         * Drive ID of removable drive, where active skin is located.
       
   565         */
       
   566         TInt iDriveIdOfRemovableDrive;
       
   567         
       
   568         /**
       
   569         * Wallpaper max size. 
       
   570         */
       
   571         TSize iMaxWallpaperSize;
       
   572 
       
   573         /* Contains indication if certain application icon is configured
       
   574         * using cenrep. Then skinned icon should not be used.
       
   575         * Icon configuration is language based.
       
   576         * Own.
       
   577         */
       
   578         CAknsSrvIconConfigMap* iIconConfigMap;
       
   579         
       
   580         /**
       
   581         * Slidesetwallpaper-enable application whitelist
       
   582         */
       
   583         RArray<TInt> iSlidesetEnableAppUidArray;
       
   584         
       
   585         /**
       
   586         * WallpaperCache
       
   587         */
       
   588         CAknsSrvWallpaperCache* iWallpaperCache;
       
   589         
       
   590         TBool iSetSlideSet;
       
   591         
       
   592     };
       
   593 
       
   594 
       
   595 #endif // AKNSSRV_H
       
   596 
       
   597 // End of File
       
   598