filemanager/bkupengine/src/CMMCScBkupStateRequestSizeOfBackupData.cpp
changeset 14 1957042d8c7e
parent 1 d1daf54a55b5
child 16 ada7962b4308
equal deleted inserted replaced
1:d1daf54a55b5 14:1957042d8c7e
     1 /*
       
     2 * Copyright (c) 2005 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: CMMCScBkupStateRequestSizeOfBackupData implementation
       
    15 *
       
    16 *
       
    17 */
       
    18 
       
    19 #include "CMMCScBkupStateRequestSizeOfBackupData.h"
       
    20 
       
    21 // System includes
       
    22 #include <e32std.h>
       
    23 
       
    24 // User includes
       
    25 #include "MMCScBkupLogger.h"
       
    26 #include "MMCScBkupSBEUtils.h"
       
    27 #include "TMMCScBkupOwnerDataType.h"
       
    28 #include "CMMCScBkupDataOwnerInfo.h"
       
    29 #include "MMMCScBkupProgressObserver.h"
       
    30 #include "CMMCScBkupDataOwnerCollection.h"
       
    31 #include "CMMCScBkupDriveAndOperationTypeManager.h"
       
    32 
       
    33 
       
    34 // ========================= MEMBER FUNCTIONS ================================
       
    35 
       
    36 // ---------------------------------------------------------------------------
       
    37 // CMMCScBkupStateRequestSizeOfBackupData::CMMCScBkupStateRequestSizeOfBackupData()
       
    38 // 
       
    39 // C++ constructor.
       
    40 // ---------------------------------------------------------------------------
       
    41 CMMCScBkupStateRequestSizeOfBackupData::CMMCScBkupStateRequestSizeOfBackupData( MMMCScBkupDriver& aDriver )
       
    42 :   CMMCScBkupState( aDriver )
       
    43     {
       
    44     __LOG1("CMMCScBkupStateRequestSizeOfBackupData::CMMCScBkupStateRequestSizeOfBackupData() - 0x%08x", StateId().iUid );
       
    45     }
       
    46 
       
    47 
       
    48 // ---------------------------------------------------------------------------
       
    49 // CMMCScBkupStateRequestSizeOfBackupData::~CMMCScBkupStateRequestSizeOfBackupData()
       
    50 // 
       
    51 // C++ destructor.
       
    52 // ---------------------------------------------------------------------------
       
    53 CMMCScBkupStateRequestSizeOfBackupData::~CMMCScBkupStateRequestSizeOfBackupData()
       
    54     {
       
    55     Cancel();
       
    56     //
       
    57     delete iRequestObject;
       
    58     }
       
    59 
       
    60 
       
    61 // ---------------------------------------------------------------------------
       
    62 // CMMCScBkupStateRequestSizeOfBackupData::ConstructL()
       
    63 // 
       
    64 // 
       
    65 // ---------------------------------------------------------------------------
       
    66 void CMMCScBkupStateRequestSizeOfBackupData::ConstructL()
       
    67     {
       
    68     iRequestObject = CMMCScBkupStateRequestSizeOfDataOwner::NewL( Driver() );
       
    69     }
       
    70 
       
    71 
       
    72 // ---------------------------------------------------------------------------
       
    73 // CMMCScBkupStateRequestSizeOfBackupData::NewL()
       
    74 // 
       
    75 // 
       
    76 // ---------------------------------------------------------------------------
       
    77 CMMCScBkupStateRequestSizeOfBackupData* CMMCScBkupStateRequestSizeOfBackupData::NewL( MMMCScBkupDriver& aDriver )
       
    78     {
       
    79     CMMCScBkupStateRequestSizeOfBackupData* self = new(ELeave) CMMCScBkupStateRequestSizeOfBackupData( aDriver);
       
    80     CleanupStack::PushL(self);
       
    81     self->ConstructL();
       
    82     CleanupStack::Pop(self);
       
    83     return self;
       
    84     }
       
    85 
       
    86 
       
    87 // ---------------------------------------------------------------------------
       
    88 // CMMCScBkupStateRequestSizeOfBackupData::StateId()
       
    89 // 
       
    90 // 
       
    91 // ---------------------------------------------------------------------------
       
    92 TMMCScBkupStateId CMMCScBkupStateRequestSizeOfBackupData::StateId() const
       
    93     {
       
    94     return KMMCScBkupStateIdRequestSizeOfBackupData;
       
    95     }
       
    96 
       
    97 
       
    98 // ---------------------------------------------------------------------------
       
    99 // CMMCScBkupStateRequestSizeOfBackupData::NextStateId()
       
   100 // 
       
   101 // 
       
   102 // ---------------------------------------------------------------------------
       
   103 TMMCScBkupStateId CMMCScBkupStateRequestSizeOfBackupData::NextStateId() const
       
   104     {
       
   105     return KMMCScBkupStateIdRequestListOfPublicFiles;
       
   106     }
       
   107 
       
   108 
       
   109 // ---------------------------------------------------------------------------
       
   110 // CMMCScBkupStateRequestSizeOfBackupData::PerformStateInitL()
       
   111 // 
       
   112 // 
       
   113 // ---------------------------------------------------------------------------
       
   114 void CMMCScBkupStateRequestSizeOfBackupData::PerformStateInitL()
       
   115     {
       
   116     // Set to -1 so that the first time RunL is called, we start with
       
   117     // the data owner at index 0.
       
   118     iCurrentDataOwnerIndex = -1;
       
   119     CompleteSelf(KErrNone);
       
   120     }
       
   121 
       
   122 
       
   123 // ---------------------------------------------------------------------------
       
   124 // CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousStateStepL()
       
   125 // 
       
   126 // 
       
   127 // ---------------------------------------------------------------------------
       
   128 void CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousStateStepL()
       
   129     {
       
   130     CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners();
       
   131     const TInt count = dataOwners.Count();
       
   132     //
       
   133     if  ( ++iCurrentDataOwnerIndex < dataOwners.Count() )
       
   134         {
       
   135         CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner(iCurrentDataOwnerIndex);
       
   136 
       
   137         // Request all the public files (on all supported drives) for this
       
   138         // particular data owner
       
   139         __ASSERT_ALWAYS(iRequestObject->IsActive() == EFalse, User::Invariant());
       
   140         //
       
   141         __LOG3("CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousStateStepL() - START - owner[%3d/%3d], sid: 0x%08x", iCurrentDataOwnerIndex, count, owner.SecureId().iId);
       
   142         iRequestObject->RequestL(owner, iStatus);
       
   143         SetActive();
       
   144         }
       
   145     else
       
   146         {
       
   147         __LOG("CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousStateStepL() - END");
       
   148         }
       
   149     }
       
   150 
       
   151 
       
   152 // ---------------------------------------------------------------------------
       
   153 // CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousErrorCleanup()
       
   154 // 
       
   155 // 
       
   156 // ---------------------------------------------------------------------------
       
   157 TBool CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousErrorCleanup( TInt aError )
       
   158     {
       
   159     (void) aError;
       
   160     __LOG1("CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousErrorCleanup() - **** - error: %d", aError );
       
   161     TBool continueProcessing = ETrue;
       
   162 
       
   163     // Cancel requester. Its probably already inactive, but just in case...
       
   164     PerformAsynchronousCancellation();
       
   165 
       
   166     // Reset state and move to next item. Treat the current (badly behaving) item
       
   167     // as completed/processed.
       
   168     CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners();
       
   169     if  ( iCurrentDataOwnerIndex < dataOwners.Count() )
       
   170         {
       
   171         CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( iCurrentDataOwnerIndex );
       
   172 
       
   173         (void) owner;
       
   174         __LOGFILE2("CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousErrorCleanup() - **** - error: %d, SID: 0x%08x - SIZE OF DATA skipped for DO", aError, owner.SecureId().iId );
       
   175 
       
   176         // Ensures that asynchronous state step is called again..
       
   177         CompleteSelf();
       
   178         }
       
   179     else
       
   180         {
       
   181         continueProcessing = EFalse;
       
   182         }
       
   183     //
       
   184     __LOG1("CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousErrorCleanup() - END - continueProcessing: %d", continueProcessing );
       
   185     return continueProcessing;
       
   186     }
       
   187 
       
   188 
       
   189 // ---------------------------------------------------------------------------
       
   190 // CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousCancellation()
       
   191 // 
       
   192 // 
       
   193 // ---------------------------------------------------------------------------
       
   194 void CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousCancellation()
       
   195     {
       
   196     if  ( iRequestObject )
       
   197         {
       
   198         iRequestObject->Cancel();
       
   199         }
       
   200     }
       
   201 
       
   202 
       
   203 
       
   204 
       
   205 
       
   206 
       
   207 
       
   208 
       
   209 
       
   210 
       
   211 
       
   212 
       
   213 
       
   214 
       
   215 
       
   216 
       
   217 
       
   218 
       
   219 
       
   220 
       
   221 
       
   222 
       
   223 
       
   224 
       
   225 
       
   226 
       
   227 
       
   228 
       
   229 
       
   230 
       
   231 
       
   232 // ---------------------------------------------------------------------------
       
   233 // CMMCScBkupStateRequestSizeOfDataOwner::CMMCScBkupStateRequestSizeOfDataOwner()
       
   234 // 
       
   235 // 
       
   236 // ---------------------------------------------------------------------------
       
   237 CMMCScBkupStateRequestSizeOfDataOwner::CMMCScBkupStateRequestSizeOfDataOwner( MMMCScBkupDriver& aDriver )
       
   238 :   CMMCScBkupDriveSpecificRequest( aDriver.DrvParamsBase().DriveAndOperations(), EMMCScBkupOwnerDataTypeAny ), iDriver(aDriver)
       
   239     {
       
   240     }
       
   241 
       
   242 
       
   243 // ---------------------------------------------------------------------------
       
   244 // CMMCScBkupStateRequestSizeOfDataOwner::NewL()
       
   245 // 
       
   246 // 
       
   247 // ---------------------------------------------------------------------------
       
   248 CMMCScBkupStateRequestSizeOfDataOwner* CMMCScBkupStateRequestSizeOfDataOwner::NewL( MMMCScBkupDriver& aDriver )
       
   249     {
       
   250     CMMCScBkupStateRequestSizeOfDataOwner* self = new (ELeave) CMMCScBkupStateRequestSizeOfDataOwner(aDriver);
       
   251     CleanupStack::PushL(self);
       
   252     self->ConstructL();
       
   253     CleanupStack::Pop(self);
       
   254     return self;
       
   255     }
       
   256 
       
   257 
       
   258 // ---------------------------------------------------------------------------
       
   259 // CMMCScBkupStateRequestSizeOfDataOwner::RequestL()
       
   260 // 
       
   261 // 
       
   262 // ---------------------------------------------------------------------------
       
   263 void CMMCScBkupStateRequestSizeOfDataOwner::RequestL( CMMCScBkupDataOwnerInfo& aOwner, TRequestStatus& aObserver )
       
   264     {
       
   265     iOwner = &aOwner;
       
   266     CMMCScBkupDriveSpecificRequest::RequestL( aObserver );
       
   267 
       
   268     // Start the asynchronous request. 
       
   269     CompleteSelf(KErrNone);
       
   270     }
       
   271 
       
   272 
       
   273 // ---------------------------------------------------------------------------
       
   274 // CMMCScBkupStateRequestSizeOfDataOwner::RunL()
       
   275 // 
       
   276 // 
       
   277 // ---------------------------------------------------------------------------
       
   278 void CMMCScBkupStateRequestSizeOfDataOwner::RunL()
       
   279     {
       
   280     __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::RunL() - START - iStatus: %d, sid: 0x%08x", iStatus.Int(), iOwner->SecureId().iId);
       
   281 
       
   282     User::LeaveIfError(iStatus.Int());
       
   283     //
       
   284     TDriveNumber drive = EDriveA;
       
   285     const TDriveList& ownerDrives = iOwner->Owner().DriveList();
       
   286     const TBool driveAvailable = NextValidDrive(drive, ownerDrives);
       
   287     //
       
   288     if  (driveAvailable)
       
   289         {
       
   290         CDataOwnerInfo& owner = iOwner->Owner();
       
   291         CSBGenericDataType& identifier = owner.Identifier();
       
   292 
       
   293         // Size any active and passive data
       
   294         GetActiveAndPassiveDataSizesL( owner, identifier, drive );
       
   295 
       
   296         // Size any system package data
       
   297         GetSystemDataSizesL( owner, identifier, drive );
       
   298 
       
   299         // Size any java data
       
   300         GetJavaDataSizesL( owner, identifier, drive );
       
   301 
       
   302         // Complete ourself to try the next drive
       
   303         CompleteSelf(KErrNone);
       
   304         __LOG1("CMMCScBkupStateRequestSizeOfDataOwner::RunL() - END - sid: 0x%08x, checking next drive...", iOwner->SecureId().iId);
       
   305         }
       
   306     else
       
   307         {
       
   308         __LOG1("CMMCScBkupStateRequestSizeOfDataOwner::RunL() - END - sid: 0x%08x, last drive scanned => notifying observer", iOwner->SecureId().iId);
       
   309         CompleteObserverRequest(KErrNone);
       
   310         }
       
   311     }
       
   312 
       
   313 
       
   314 // ---------------------------------------------------------------------------
       
   315 // CMMCScBkupStateRequestSizeOfDataOwner::DoCancel()
       
   316 // 
       
   317 // 
       
   318 // ---------------------------------------------------------------------------
       
   319 void CMMCScBkupStateRequestSizeOfDataOwner::DoCancel()
       
   320     {
       
   321     CompleteObserverRequest( KErrCancel );
       
   322     }
       
   323 
       
   324 
       
   325 // ---------------------------------------------------------------------------
       
   326 // CMMCScBkupStateRequestSizeOfDataOwner::GetActiveAndPassiveDataSizesL()
       
   327 // 
       
   328 // 
       
   329 // ---------------------------------------------------------------------------
       
   330 TUint CMMCScBkupStateRequestSizeOfDataOwner::GetActiveAndPassiveDataSizesL( const CDataOwnerInfo& aOwner, 
       
   331     CSBGenericDataType& /*aIdentifier*/, TDriveNumber aDrive )
       
   332     {
       
   333     // Passive Data
       
   334     const TBool passiveBURSupported = MMCScBkupSBEUtils::HasPassiveDataL( aOwner );
       
   335     const TBool passiveDataTransferAllowedForDrive = DriveAndOperations().IsDataTypeAllowedToAccessDrive( aDrive, EMMCScBkupOwnerDataTypePassiveData );
       
   336     __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::GetSIDSizesL() - passiveBURSupported: %d, passiveDataTransferAllowedForDrive: %d", passiveBURSupported, passiveDataTransferAllowedForDrive );
       
   337 
       
   338     TUint ret = 0;
       
   339     TUint itemSize = 0;
       
   340     if  ( passiveBURSupported && passiveDataTransferAllowedForDrive )
       
   341         {
       
   342         const TSecureId secureId = iOwner->SecureId();
       
   343         const TTransferDataType type = Driver().DrvParamsBase().PassiveTransferType();
       
   344         __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::GetSIDSizesL() - sid: 0x%08x claims PASSIVE Data... type: %d", iOwner->SecureId().iId, type);
       
   345 
       
   346         itemSize = GetSIDSpecificSizeL( secureId, aDrive, type );
       
   347         iOwner->AddToOperationalSizeL( EMMCScBkupOwnerDataTypePassiveData, aDrive, itemSize );
       
   348         ret += itemSize;
       
   349         __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::GetSIDSizesL() - sid: 0x%08x, passive size: %8d", secureId.iId, itemSize);
       
   350         }
       
   351 
       
   352     // Active Data
       
   353     const TBool activeBURSupported = MMCScBkupSBEUtils::HasActiveDataL( aOwner );
       
   354     const TBool activeDataTransferAllowedForDrive = DriveAndOperations().IsDataTypeAllowedToAccessDrive( aDrive, EMMCScBkupOwnerDataTypeActiveData );
       
   355     __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::GetSIDSizesL() - activeBURSupported: %d, activeDataTransferAllowedForDrive: %d", activeBURSupported, activeDataTransferAllowedForDrive );
       
   356 
       
   357     if  ( activeBURSupported && activeDataTransferAllowedForDrive )
       
   358         {
       
   359         const TSecureId secureId = iOwner->SecureId();
       
   360         const TTransferDataType type = Driver().DrvParamsBase().ActiveTransferType();
       
   361         __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::GetSIDSizesL() - sid: 0x%08x claims ACTIVE Data... type: %d", iOwner->SecureId().iId, type);
       
   362 
       
   363 
       
   364         // Technically, we should wait for an active data owner to become ready before we ask
       
   365         // for its sizing information. If we don't wait, we might receive KErrNotReady back
       
   366         // from our SBE request. 
       
   367         //
       
   368         // Currently, the MMC engine doesn't actually make any use of the active data sizing
       
   369         // info, so we trap (and ignore) the error in this situation. In the future, we will
       
   370         // have to change the state machine in order to request the active data statuses
       
   371         // before the sizing can be requested.
       
   372         itemSize = 0;
       
   373         TRAPD(err, GetSIDSpecificSizeL( secureId, aDrive, type ));
       
   374         __LOG3("CMMCScBkupStateRequestSizeOfDataOwner::GetSIDSizesL() - sid: 0x%08x, active size: %8d, fetchError: %d", secureId.iId, itemSize, err);
       
   375 
       
   376         if  ( err == KErrNone || err == KErrNotReady )
       
   377             {
       
   378             err = KErrNone;
       
   379             }
       
   380         else
       
   381             {
       
   382             User::LeaveIfError( err );
       
   383             }
       
   384 
       
   385         iOwner->AddToOperationalSizeL( EMMCScBkupOwnerDataTypeActiveData, aDrive, itemSize );
       
   386         ret += itemSize;
       
   387         __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::GetSIDSizesL() - sid: 0x%08x, active size: %8d", secureId.iId, itemSize);
       
   388         }
       
   389 
       
   390     return ret;
       
   391     }
       
   392 
       
   393 
       
   394 // ---------------------------------------------------------------------------
       
   395 // CMMCScBkupStateRequestSizeOfDataOwner::GetSIDSpecificSizeL()
       
   396 // 
       
   397 // 
       
   398 // ---------------------------------------------------------------------------
       
   399 TUint CMMCScBkupStateRequestSizeOfDataOwner::GetSIDSpecificSizeL( TSecureId aSecureID, TDriveNumber aDrive, TTransferDataType aDataType )
       
   400     {
       
   401     CSBSIDTransferType* transferType = CSBSIDTransferType::NewL( aSecureID,
       
   402                                                                  aDrive,
       
   403                                                                  aDataType
       
   404                                                                 );
       
   405     CleanupStack::PushL( transferType );
       
   406     const TUint size = Driver().DrvSecureBackupClient().ExpectedDataSizeL( *transferType );
       
   407     CleanupStack::PopAndDestroy( transferType );
       
   408     return size;
       
   409     }
       
   410 
       
   411 
       
   412 // ---------------------------------------------------------------------------
       
   413 // CMMCScBkupStateRequestSizeOfDataOwner::GetSystemDataSizesL()
       
   414 // 
       
   415 // 
       
   416 // ---------------------------------------------------------------------------
       
   417 TUint CMMCScBkupStateRequestSizeOfDataOwner::GetSystemDataSizesL( const CDataOwnerInfo& aOwner, CSBGenericDataType& aIdentifier, TDriveNumber aDrive )
       
   418     {
       
   419     TUint size = 0;
       
   420     //
       
   421     const TBool systemBURSupported = MMCScBkupSBEUtils::HasSystemDataL( aOwner );
       
   422     const TBool systemDataTransferAllowedForDrive = DriveAndOperations().IsDataTypeAllowedToAccessDrive( aDrive, EMMCScBkupOwnerDataTypeSystemData );
       
   423     __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::GetSystemDataSizesL() - systemBURSupported: %d, systemDataTransferAllowedForDrive: %d", systemBURSupported, systemDataTransferAllowedForDrive );
       
   424 
       
   425     if  ( systemBURSupported && systemDataTransferAllowedForDrive )
       
   426         {
       
   427         __LOG1("CMMCScBkupStateRequestSizeOfDataOwner::GetSystemDataSizesL() - sid: 0x%08x claims SYSTEM Data...", iOwner->SecureId().iId);
       
   428 
       
   429         // Again we have to create a temporary in order to actually retrieve the info...
       
   430         CSBPackageId* packageGeneric = static_cast<CSBPackageId*>( MMCScBkupSBEUtils::CopyLC( aIdentifier ) );
       
   431         const TUid packageId = packageGeneric->PackageIdL();
       
   432         //
       
   433         const TPackageDataType type = Driver().DrvParamsBase().PackageTransferType();
       
   434         CSBPackageTransferType* transferType = CSBPackageTransferType::NewL( packageId,
       
   435                                                                              aDrive,
       
   436                                                                              type
       
   437                                                                             );
       
   438         CleanupStack::PushL( transferType );
       
   439         size = Driver().DrvSecureBackupClient().ExpectedDataSizeL( *transferType );
       
   440         __LOG3("CMMCScBkupStateRequestSizeOfDataOwner::GetSystemDataSizesL() - packageId: 0x%08x, sid: 0x%08x, package size: %8d", packageId.iUid, iOwner->SecureId().iId, size);
       
   441         CleanupStack::PopAndDestroy( transferType );
       
   442         //
       
   443         iOwner->AddToOperationalSizeL( EMMCScBkupOwnerDataTypeSystemData, aDrive, size );
       
   444         CleanupStack::PopAndDestroy( packageGeneric );
       
   445         }
       
   446 
       
   447     return size;
       
   448     }
       
   449 
       
   450 
       
   451 // ---------------------------------------------------------------------------
       
   452 // CMMCScBkupStateRequestSizeOfDataOwner::GetJavaDataSizesL()
       
   453 // 
       
   454 // 
       
   455 // ---------------------------------------------------------------------------
       
   456 TUint CMMCScBkupStateRequestSizeOfDataOwner::GetJavaDataSizesL( const CDataOwnerInfo& aOwner, CSBGenericDataType& aIdentifier, TDriveNumber aDrive )
       
   457     {
       
   458     TUint size = 0;
       
   459     //
       
   460     const TBool javaBURSupported = MMCScBkupSBEUtils::HasJavaDataL( aOwner );
       
   461     const TBool javaDataTransferAllowedForDrive = DriveAndOperations().IsDataTypeAllowedToAccessDrive( aDrive, EMMCScBkupOwnerDataTypeJavaData );
       
   462     __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::GetJavaSizesL() - javaBURSupported: %d, javaDataTransferAllowedForDrive: %d", javaBURSupported, javaDataTransferAllowedForDrive );
       
   463     
       
   464     if  ( javaBURSupported && javaDataTransferAllowedForDrive )
       
   465         {
       
   466         // Again we have to create a temporary in order to actually retrieve the info...
       
   467         CSBJavaId* packageGeneric = static_cast<CSBJavaId*>(MMCScBkupSBEUtils::CopyLC( aIdentifier ));
       
   468         const TPtrC pHash(packageGeneric->SuiteHashL());
       
   469         __LOG1("CMMCScBkupStateRequestSizeOfDataOwner::GetJavaSizesL() - midlet hash: %S", &pHash );
       
   470  
       
   471         const TUint midletSize = GetJavaSpecificSizeL( pHash, aDrive, EJavaMIDlet);
       
   472         __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::GetJavaSizesL() - EJavaMIDlet,     sid: 0x%08x, size: %8d", iOwner->SecureId().iId, midletSize);
       
   473     
       
   474         const TUint midletDataSize = GetJavaSpecificSizeL( pHash, aDrive, EJavaMIDletData);
       
   475         __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::GetJavaSizesL() - EJavaMIDletData, sid: 0x%08x, size: %8d", iOwner->SecureId().iId, midletDataSize);
       
   476 
       
   477         // We put the midlet itself in the special 'java data' category (the 'system data' equivalent for
       
   478         // java midlets).
       
   479         iOwner->AddToOperationalSizeL( EMMCScBkupOwnerDataTypeJavaData, aDrive, midletSize );
       
   480 
       
   481         // We put the midlet's data (e.g. any data files that it created) inside
       
   482         // the 'passive data' bucket.
       
   483         iOwner->AddToOperationalSizeL( EMMCScBkupOwnerDataTypePassiveData, aDrive, midletDataSize );
       
   484         
       
   485         // Java abuses the passive data slot. We would've initially set passive data's completion status
       
   486         // to ETrue inside CMMCScBkupDataOwnerInfo::ConstructL() as a result of receiving a Java
       
   487         // transfer type... but we can reset it back to "not yet completed" if the midlet
       
   488         // does indeed have some 'passive data'.
       
   489         iOwner->SetCompletionStatus( EMMCScBkupOwnerDataTypePassiveData, ( midletDataSize == 0 ) );
       
   490 
       
   491         CleanupStack::PopAndDestroy( packageGeneric );
       
   492         //
       
   493         size = midletSize + midletDataSize;
       
   494         }
       
   495 
       
   496     return size;
       
   497     }
       
   498 
       
   499 
       
   500 // ---------------------------------------------------------------------------
       
   501 // CMMCScBkupStateRequestSizeOfDataOwner::GetJavaSpecificSizeL()
       
   502 // 
       
   503 // 
       
   504 // ---------------------------------------------------------------------------
       
   505 TUint CMMCScBkupStateRequestSizeOfDataOwner::GetJavaSpecificSizeL( const TDesC& aHash, TDriveNumber aDrive, TJavaTransferType aDataType )
       
   506     {
       
   507     CSBJavaTransferType* transferType = CSBJavaTransferType::NewL( aHash,
       
   508                                                                    aDrive,
       
   509                                                                    aDataType
       
   510                                                                   );
       
   511     CleanupStack::PushL( transferType );
       
   512     const TUint size = Driver().DrvSecureBackupClient().ExpectedDataSizeL( *transferType );
       
   513     CleanupStack::PopAndDestroy( transferType );
       
   514     return size;
       
   515     }