appinstaller/AppMngr2/Sisx/src/appmngr2sisxappinfo.cpp
branchRCL_3
changeset 14 09e5ea190d07
parent 12 7ca52d38f8c3
child 17 741e5bba2bd1
equal deleted inserted replaced
13:0817e13c927e 14:09e5ea190d07
    26 #include <appmngr2drmutils.h>           // TAppMngr2DRMUtils
    26 #include <appmngr2drmutils.h>           // TAppMngr2DRMUtils
    27 #include <appmngr2cleanuputils.h>       // CleanupResetAndDestroyPushL
    27 #include <appmngr2cleanuputils.h>       // CleanupResetAndDestroyPushL
    28 #include <appmngr2debugutils.h>         // FLOG macros
    28 #include <appmngr2debugutils.h>         // FLOG macros
    29 #include <x509cert.h>                   // CX509Certificate
    29 #include <x509cert.h>                   // CX509Certificate
    30 #include <swi/sisregistrypackage.h>     // CSisRegistryPackage
    30 #include <swi/sisregistrypackage.h>     // CSisRegistryPackage
       
    31 #include <DRMHelper.h>
       
    32 #include <drmutility.h>
    31 
    33 
    32 
    34 
    33 // ======== MEMBER FUNCTIONS ========
    35 // ======== MEMBER FUNCTIONS ========
    34 
    36 
    35 // ---------------------------------------------------------------------------
    37 // ---------------------------------------------------------------------------
   283     // save it's full name in iProtectedFile member variable for later use.
   285     // save it's full name in iProtectedFile member variable for later use.
   284     // Full name of the protected file is needed in ShowDetailsL() function
   286     // Full name of the protected file is needed in ShowDetailsL() function
   285     // to show the licence information.
   287     // to show the licence information.
   286     RPointerArray<HBufC> files;
   288     RPointerArray<HBufC> files;
   287     TRAPD( err, aEntry.FilesL( files ) );
   289     TRAPD( err, aEntry.FilesL( files ) );
       
   290     
   288     if( err == KErrNone )
   291     if( err == KErrNone )
   289         {
   292         {
   290         CleanupResetAndDestroyPushL( files );
   293         CleanupResetAndDestroyPushL( files );
   291         for( TInt fileIndex = 0; fileIndex < files.Count() && !iIsDRMProtected; fileIndex++ )
   294         
   292             {
   295         // Use DRMUtility for DRM check. Utility class is much faster then
   293             HBufC* fileName = files[ fileIndex ];
   296         // IsDRMProtected function.        
   294             iIsDRMProtected = TAppMngr2DRMUtils::IsDRMProtected( *fileName );
   297         DRM::CDrmUtility* utility = DRM::CDrmUtility::NewLC();
   295             if( iIsDRMProtected )
   298                                      
   296                 {
   299         for ( TInt fileIndex = 0; fileIndex < files.Count(); fileIndex++ )
   297                 FLOG( "CAppMngr2SisxAppInfo::ConstructL, iProtectedFile %S", fileName );
   300             {        
   298                 iProtectedFile = fileName;  // takes ownership
   301             RFile fileHandle;
   299                 files.Remove( fileIndex );
   302             TInt error = fileHandle.Open( iFs, *files[ fileIndex ], EFileRead );
   300                 iIsRightsObjectMissingOrExpired =
   303             FLOG( "CAppMngr2SisxAppInfo::ConstructL, File open error %d", 
   301                     TAppMngr2DRMUtils::IsDRMRightsObjectExpiredOrMissingL( *fileName );
   304                     error );
   302                 FLOG( "CAppMngr2SisxAppInfo::ConstructL, iIsRightsObjectMissingOrExpired %d",
   305             
   303                         iIsRightsObjectMissingOrExpired );
   306             if ( error == KErrNone )
       
   307                 {                
       
   308                 CleanupClosePushL( fileHandle );
       
   309                 
       
   310                 iIsDRMProtected = utility->IsProtectedL( fileHandle );
       
   311             
       
   312                 CleanupStack::PopAndDestroy( &fileHandle ); 
       
   313                 
       
   314                 if ( iIsDRMProtected )
       
   315                     {                       
       
   316                     HBufC* fileName = files[ fileIndex ];                            
       
   317                     FLOG( "CAppMngr2SisxAppInfo::ConstructL, iProtectedFile %S", 
       
   318                             fileName );
       
   319                     
       
   320                     iProtectedFile = fileName;  // takes ownership
       
   321                     files.Remove( fileIndex );                    
       
   322                     
       
   323                     CDRMHelper* helper = CDRMHelper::NewLC();                    
       
   324                     CDRMHelperRightsConstraints* playconst = NULL;
       
   325                     CDRMHelperRightsConstraints* dispconst = NULL;
       
   326                     CDRMHelperRightsConstraints* execconst = NULL;
       
   327                     CDRMHelperRightsConstraints* printconst = NULL;            
       
   328                     TBool sendingallowed = EFalse;
       
   329                                     
       
   330                     FLOG( "CAppMngr2SisxAppInfo::ConstructL: GetRightsDetailsL" );
       
   331                     error = KErrNone;
       
   332                     TRAP( error, helper->GetRightsDetailsL( *fileName, 
       
   333                                                 ContentAccess::EView, 
       
   334                                                 iIsRightsObjectMissingOrExpired, 
       
   335                                                 sendingallowed, 
       
   336                                                 playconst, 
       
   337                                                 dispconst, 
       
   338                                                 execconst, 
       
   339                                                 printconst ) );                     
       
   340                     FLOG( "GetRightsDetailsL TRAP err = %d", error );
       
   341                     
       
   342                     delete playconst;
       
   343                     delete dispconst;
       
   344                     delete execconst;
       
   345                     delete printconst;
       
   346                     
       
   347                     CleanupStack::PopAndDestroy( helper );
       
   348                     
       
   349                     FLOG( "iIsRightsObjectMissingOrExpired: %d", 
       
   350                             iIsRightsObjectMissingOrExpired );                                        
       
   351                     }
   304                 }
   352                 }
   305             }
   353             }                
       
   354         CleanupStack::PopAndDestroy( utility );
   306         CleanupStack::PopAndDestroy( &files );
   355         CleanupStack::PopAndDestroy( &files );
   307         }
   356         }
   308 
   357 
   309     FLOG( "CAppMngr2SisxAppInfo::ConstructL, loc=%d, aug=%d, trust=%d, drm=%d, RO=%d",
   358     FLOG( "CAppMngr2SisxAppInfo::ConstructL, loc=%d, aug=%d, trust=%d, drm=%d, RO=%d",
   310             iLocation, iIsAugmentation, iIsTrusted, iIsDRMProtected,
   359             iLocation, iIsAugmentation, iIsTrusted, iIsDRMProtected,