applicationmanagement/server/src/ApplicationManagementServer.cpp
branchRCL_3
changeset 40 f2101057ffeb
parent 20 f6aa907032f4
child 55 c4687ff85147
equal deleted inserted replaced
29:ebe540617f90 40:f2101057ffeb
   331             RProperty counter;
   331             RProperty counter;
   332             
   332             
   333             TInt r=counter.Attach(KUidPSApplicationManagementKeys,
   333             TInt r=counter.Attach(KUidPSApplicationManagementKeys,
   334                     KSyncNotifier, EOwnerThread);
   334                     KSyncNotifier, EOwnerThread);
   335             User::LeaveIfError(r);
   335             User::LeaveIfError(r);
       
   336 
       
   337             TBuf8<256> targetURI;
       
   338 
       
   339             TDeploymentComponentState state = aComponent->State();
       
   340 
       
   341             if (state == EDCSDownload)
       
   342                 {
       
   343                 targetURI.Append(KDownloadState);
       
   344                 targetURI.Append(aComponent->UserId());
       
   345                 }
       
   346             else
       
   347                 if (state == EDCSDelivered)
       
   348                     {
       
   349                     targetURI.Append(KDeliveredState);
       
   350                     targetURI.Append(aComponent->UserId());
       
   351 
       
   352                     }
       
   353                 else
       
   354                     if (state == EDCSActive|| state == EDCSInactive)
       
   355                         {
       
   356                         targetURI.Append(KDeployedState);
       
   357                         targetURI.Append(aComponent->UserId());
       
   358                         }
       
   359 
       
   360 						//Set Targeturi to cenrep
       
   361 		
       
   362 						CRepository* cenrep = NULL;
       
   363   					TInt errr(KErrNone);
       
   364 	  				TRAP(errr, cenrep = CRepository::NewL( KCRUidDeviceManagementInternalKeys ));	  	
       
   365 	  				if(errr == KErrNone)
       
   366 	  				{
       
   367     					errr = cenrep->Set( KNSmlDMSCOMOTargetRef, targetURI );    	
       
   368     					delete cenrep;
       
   369     					cenrep = NULL;
       
   370     				}
   336 
   371 
   337             TInt err = counter.Set(KErrCancel);
   372             TInt err = counter.Set(KErrCancel);
   338             User::LeaveIfError(err);
   373             User::LeaveIfError(err);
   339             counter.Close();
   374             counter.Close();
   340 
   375 
  2787     TInt read(aMessage.Read( 0, pid) );
  2822     TInt read(aMessage.Read( 0, pid) );
  2788 
  2823 
  2789     RDEBUG_2( "ApplicationManagementSession: DeactivateL id is %d", id );
  2824     RDEBUG_2( "ApplicationManagementSession: DeactivateL id is %d", id );
  2790     CDeploymentComponent &compo = Server().Storage()->ComponentL(id);
  2825     CDeploymentComponent &compo = Server().Storage()->ComponentL(id);
  2791     Server().Storage()->DeactivateL(compo);
  2826     Server().Storage()->DeactivateL(compo);
       
  2827     
       
  2828     SetSCOMOTargetURI(compo.UserId());
  2792     }
  2829     }
  2793 
  2830 
  2794 // -------------------------------------------------------------------------------------------------------------------
  2831 // -------------------------------------------------------------------------------------------------------------------
  2795 // CApplicationManagementSession::ActivateL()
  2832 // CApplicationManagementSession::ActivateL()
  2796 // -------------------------------------------------------------------------------------------------------------------
  2833 // -------------------------------------------------------------------------------------------------------------------
  2803     TInt read(aMessage.Read( 0, pid) );
  2840     TInt read(aMessage.Read( 0, pid) );
  2804 
  2841 
  2805     RDEBUG_2( "ApplicationManagementSession: ActivateL id is %d", id );
  2842     RDEBUG_2( "ApplicationManagementSession: ActivateL id is %d", id );
  2806     CDeploymentComponent &compo = Server().Storage()->ComponentL(id);
  2843     CDeploymentComponent &compo = Server().Storage()->ComponentL(id);
  2807     Server().Storage()->ActivateL(compo);
  2844     Server().Storage()->ActivateL(compo);
       
  2845     
       
  2846     SetSCOMOTargetURI(compo.UserId());
  2808     }
  2847     }
  2809 
  2848 
  2810 // -------------------------------------------------------------------------------------------------------------------
  2849 // -------------------------------------------------------------------------------------------------------------------
  2811 // CApplicationManagementSession::GetUserIdL()
  2850 // CApplicationManagementSession::GetUserIdL()
  2812 // -------------------------------------------------------------------------------------------------------------------
  2851 // -------------------------------------------------------------------------------------------------------------------
  2820 
  2859 
  2821     RDEBUG_2( "ApplicationManagementSession: GetUserIdL id is %d", id );
  2860     RDEBUG_2( "ApplicationManagementSession: GetUserIdL id is %d", id );
  2822     CDeploymentComponent &compo = Server().Storage()->ComponentL(id);
  2861     CDeploymentComponent &compo = Server().Storage()->ComponentL(id);
  2823 
  2862 
  2824     aMessage.Write( 1, compo.UserId() );
  2863     aMessage.Write( 1, compo.UserId() );
       
  2864     }
       
  2865 
       
  2866 void CApplicationManagementSession::SetSCOMOTargetURI(const TDesC8& aURI) const
       
  2867     {
       
  2868     _LIT8( KAMSeparator8, "/" );
       
  2869     _LIT8( KAMStateValueNodeName, "State" );
       
  2870     TBuf8<256> targetStateURI(KDeployedState);
       
  2871     
       
  2872     targetStateURI.Append(aURI);
       
  2873     
       
  2874     targetStateURI.Append(KAMSeparator8);
       
  2875     targetStateURI.Append(KAMStateValueNodeName);
       
  2876             
       
  2877     CRepository* cenrep = NULL;
       
  2878     TInt errr(KErrNone);
       
  2879 
       
  2880     TRAP(errr, cenrep = CRepository::NewL( KCRUidDeviceManagementInternalKeys ));
       
  2881 
       
  2882     if(errr == KErrNone)
       
  2883     {
       
  2884     errr = cenrep->Set(KNSmlDMSCOMOTargetRef, targetStateURI);
       
  2885     }
       
  2886     
       
  2887     if(cenrep)
       
  2888         {
       
  2889         delete cenrep;
       
  2890         cenrep = NULL;
       
  2891         }
       
  2892     
       
  2893    
  2825     }
  2894     }
  2826 
  2895 
  2827 // -------------------------------------------------------------------------------------------------------------------
  2896 // -------------------------------------------------------------------------------------------------------------------
  2828 // CApplicationManagementSession::GetTemporaryInstFileL()
  2897 // CApplicationManagementSession::GetTemporaryInstFileL()
  2829 // -------------------------------------------------------------------------------------------------------------------
  2898 // -------------------------------------------------------------------------------------------------------------------
  2989             id, targetst );
  3058             id, targetst );
  2990 
  3059 
  2991     CDeploymentComponent &compo = Server().Storage()->ComponentL(id);
  3060     CDeploymentComponent &compo = Server().Storage()->ComponentL(id);
  2992     if (compo.State() == EDCSDelivered)
  3061     if (compo.State() == EDCSDelivered)
  2993         {
  3062         {
  2994         Server().DoTheInstallL(compo) ;
  3063         TInt err(KErrNone);
       
  3064 	  		TRAP(err, Server().DoTheInstallL(compo)) ;
       
  3065         TBuf8<256> targetURI;
       
  3066         TDeploymentComponentState state = compo.State();
       
  3067         if( state == EDCSDelivered)
       
  3068         	{
       
  3069         			targetURI.Append(KDeliveredState);
       
  3070               targetURI.Append(compo.UserId());
       
  3071           }
       
  3072           else if (state == EDCSActive|| state == EDCSInactive)
       
  3073           {
       
  3074           		targetURI.Append(KDeployedState);
       
  3075               targetURI.Append(compo.UserId());  
       
  3076         	} 
       
  3077         	
       
  3078         	//Set Targeturi to cenrep
       
  3079         	CRepository* cenrep = NULL;
       
  3080 	  			TRAP(err, cenrep = CRepository::NewL( KCRUidDeviceManagementInternalKeys ));
       
  3081 	  			if(err == KErrNone)
       
  3082 	  			{		  				
       
  3083     				err = cenrep->Set( KNSmlDMSCOMOTargetRef, targetURI );    				
       
  3084     				delete cenrep;
       
  3085     				cenrep = NULL;
       
  3086     			} 
  2995         }
  3087         }
  2996     else
  3088     else
  2997         {
  3089         {
  2998         User::Leave(KErrArgument);
  3090         User::Leave(KErrArgument);
  2999         }
  3091         }
  3652 
  3744 
  3653 void CApplicationManagementSession::StateChangeComponentIdsCountL(
  3745 void CApplicationManagementSession::StateChangeComponentIdsCountL(
  3654         const RMessage2& aMessage) const
  3746         const RMessage2& aMessage) const
  3655     {
  3747     {
  3656     RDEBUG( "CApplicationManagementSession: StateChangeComponentIdsCountL" );
  3748     RDEBUG( "CApplicationManagementSession: StateChangeComponentIdsCountL" );
  3657                 RPointerArray<TPreInstalledAppParams> preInstalledAppParams;
  3749                RPointerArray<TPreInstalledAppParams> preInstalledAppParams;
  3658                 CAMPreInstallApp* preInstallApp = CAMPreInstallApp::NewL();
  3750                 CAMPreInstallApp* preInstallApp = CAMPreInstallApp::NewL();
  3659                 preInstallApp->GetPreInstalledAppsL(preInstalledAppParams);
  3751                 preInstallApp->GetPreInstalledAppsL(preInstalledAppParams);
  3660                 TInt count = 0;
  3752                 TInt count = 0;
  3661                 for (count = 0; count< preInstalledAppParams.Count(); count++)
  3753                 for (count = 0; count< preInstalledAppParams.Count(); count++)
  3662                     {
  3754                     {