installationservices/swi/source/swis/server/restoremachine.cpp
branchRCL_3
changeset 26 8b7f4e561641
parent 25 7333d7932ef7
equal deleted inserted replaced
25:7333d7932ef7 26:8b7f4e561641
    35 #include "sisinfo.h"
    35 #include "sisinfo.h"
    36 #include "sisuid.h"
    36 #include "sisuid.h"
    37 #include "log.h"
    37 #include "log.h"
    38 #include "swispubsubdefs.h"
    38 #include "swispubsubdefs.h"
    39 #include "securitycheckutil.h"
    39 #include "securitycheckutil.h"
    40 #include "secutils.h"
       
    41 #include "cleanuputils.h"
    40 #include "cleanuputils.h"
    42 #include "sisversion.h"
    41 #include "sisversion.h"
    43 #include "sisregistrywritablesession.h"
    42 #include "sisregistrywritablesession.h"
    44 #include <f32file.h>
    43 #include <f32file.h>
    45 #include "sisregistrypackage.h"
    44 #include "sisregistrypackage.h"
   879 
   878 
   880 		const RPointerArray<TPtrC8>& controllerBinaries = iRestoreController.ControllerBinaries();
   879 		const RPointerArray<TPtrC8>& controllerBinaries = iRestoreController.ControllerBinaries();
   881 		ASSERT(controllerBinaries.Count() == iPlans.Count());
   880 		ASSERT(controllerBinaries.Count() == iPlans.Count());
   882 		DEBUG_PRINTF3(_L8("Restoring plan %d out of %d"), iPlanIndex, iPlans.Count());
   881 		DEBUG_PRINTF3(_L8("Restoring plan %d out of %d"), iPlanIndex, iPlans.Count());
   883 		const TDesC8& controllerBinary = *controllerBinaries[iPlanIndex];
   882 		const TDesC8& controllerBinary = *controllerBinaries[iPlanIndex];
   884 		
       
   885 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
       
   886 		/*During restore the controllers are processed sequentialy one by one, ecah controller has one CPlan object (which internally has
       
   887 		CApplication object), we maintain the set of affected apps for each controller within its CPlan object(done while doning processing)
       
   888 		and we use the same set of affected apps for the subsequent controllers. For example In case of SP over SA ,while processing the SA controller we will not have
       
   889 		any affected apps as it is the first controller but for the second SP controller we will tahke the affected apps from the previously 
       
   890 		processed controller ie SA.
       
   891 		*/
       
   892 		RArray<TAppUpdateInfo> appInfo;
       
   893 		CleanupClosePushL(appInfo);		
       
   894 		if(iPlanIndex > 0)
       
   895 		    {
       
   896 		    iPlans[iPlanIndex-1]->GetAffectedApps(appInfo);
       
   897 		    }
       
   898 #endif
       
   899 		
       
   900 		iProcessor = CRestoreProcessor::NewL(*(iPlans[iPlanIndex]), controllerBinary, iSecurityManager,
   883 		iProcessor = CRestoreProcessor::NewL(*(iPlans[iPlanIndex]), controllerBinary, iSecurityManager,
   901 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
   884 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
   902 			iStsSession, iRegistrySession, appInfo,
   885 			iStsSession, iRegistrySession,
   903 #else
   886 #else
   904 			iIntegrityServices,
   887 			iIntegrityServices,
   905 #endif
   888 #endif
   906 			iRestoreController.Verifiers(), baseSids, iMachine.Observer()); 
   889 			iRestoreController.Verifiers(), baseSids, iMachine.Observer()); 
   907 
       
   908 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK		
       
   909 		CleanupStack::Pop(&appInfo);
       
   910 #endif
       
   911 		iProcessor->ProcessPlanL(iStatus);
   890 		iProcessor->ProcessPlanL(iStatus);
   912 		CleanupStack::PopAndDestroy(&baseSids);
   891 		CleanupStack::PopAndDestroy(&baseSids);
   913 		
   892 		
   914 		SetActive();
   893 		SetActive();
   915 		}
   894 		}
  1096 		// Due to the fact that SCR allows only one transaction at a time (one writer, many readers), 
  1075 		// Due to the fact that SCR allows only one transaction at a time (one writer, many readers), 
  1097 		// the possibility of the registry commit (SCR commit) failing is less likely than an STS commit 
  1076 		// the possibility of the registry commit (SCR commit) failing is less likely than an STS commit 
  1098 		// failure - therefore we commit STS first and then the registry 
  1077 		// failure - therefore we commit STS first and then the registry 
  1099 		iStsSession.CommitL();
  1078 		iStsSession.CommitL();
  1100 		iRegistrySession.CommitTransactionL();
  1079 		iRegistrySession.CommitTransactionL();
  1101    
       
  1102 		CPlan* lastPlan = iPlans[iPlans.Count()-1];
       
  1103 		if (lastPlan)
       
  1104             {
       
  1105             RSisLauncherSession launcher;  
       
  1106             CleanupClosePushL(launcher);
       
  1107             if (launcher.Connect() != KErrNone)
       
  1108                 {
       
  1109                 iMachine.Observer().CommitL();
       
  1110                 User::LeaveIfError(RProperty::Set(pubsubCategory, KUidSoftwareInstallKey, ESwisNone));
       
  1111                 iClientMessage.Complete(iStatus.Int());
       
  1112                 DEBUG_PRINTF(_L8("Install Machine - Failed to connect to SisLauncher"));
       
  1113                 CleanupStack::Pop(&launcher);
       
  1114                 launcher.Close();
       
  1115                 return;
       
  1116                 }             
       
  1117              //Notify apparc for the the change in the Applications
       
  1118              RArray<TAppUpdateInfo> affectedApps;
       
  1119              CleanupClosePushL(affectedApps);
       
  1120              lastPlan->GetAffectedApps(affectedApps);
       
  1121 #ifdef _DEBUG             
       
  1122              for(TInt i = 0; i < affectedApps.Count(); i++)
       
  1123                   {
       
  1124                   DEBUG_PRINTF2(_L("Affected AppUid during restore is 0x%x"), affectedApps[i].iAppUid);
       
  1125                   DEBUG_PRINTF2(_L("Action to be performed is %d"), affectedApps[i].iAction);
       
  1126                   }  
       
  1127 #endif             
       
  1128              if (affectedApps.Count() > 0)
       
  1129                   {
       
  1130                   launcher.NotifyNewAppsL(affectedApps);
       
  1131                   }          
       
  1132              CleanupStack::PopAndDestroy(2, &launcher);             
       
  1133              }        
       
  1134        
       
  1135 		
       
  1136 #else
  1080 #else
  1137 		iIntegrityServices.CommitL();
  1081 		iIntegrityServices.CommitL();
  1138 #endif
  1082 #endif
  1139 		iMachine.Observer().CommitL();
  1083 		iMachine.Observer().CommitL();
  1140 		}
  1084 		}