applicationmanagement/server/src/ApplicationManagementServer.cpp
branchRCL_3
changeset 23 c4687ff85147
parent 20 f2101057ffeb
child 24 6757f1e2efd2
equal deleted inserted replaced
22:9360ca28b668 23:c4687ff85147
   419         RDEBUG_2( "CApplicationManagementServer::ConstructL - ERROR leaving cannot connect installer: %d", iSessionCount );
   419         RDEBUG_2( "CApplicationManagementServer::ConstructL - ERROR leaving cannot connect installer: %d", iSessionCount );
   420         
   420         
   421         // Is session count is not modified whenever there is error then at the end of download complete decrement
   421         // Is session count is not modified whenever there is error then at the end of download complete decrement
   422         //  the session count.
   422         //  the session count.
   423         
   423         
   424         if(status != KStatusSuccess && iSessionCount != 0 )
   424         if(iSessionCount != 0 )
   425             {
   425             {
   426             iSessionCount--; 
   426             iSessionCount--; 
   427             }
   427             }
   428        
   428        
   429         if (iSessionCount == 0)
   429         if (iSessionCount == 0)
  2823 
  2823 
  2824     RDEBUG_2( "ApplicationManagementSession: DeactivateL id is %d", id );
  2824     RDEBUG_2( "ApplicationManagementSession: DeactivateL id is %d", id );
  2825     CDeploymentComponent &compo = Server().Storage()->ComponentL(id);
  2825     CDeploymentComponent &compo = Server().Storage()->ComponentL(id);
  2826     Server().Storage()->DeactivateL(compo);
  2826     Server().Storage()->DeactivateL(compo);
  2827     
  2827     
  2828     SetSCOMOTargetURI(compo.UserId());
  2828    
  2829     }
  2829     }
  2830 
  2830 
  2831 // -------------------------------------------------------------------------------------------------------------------
  2831 // -------------------------------------------------------------------------------------------------------------------
  2832 // CApplicationManagementSession::ActivateL()
  2832 // CApplicationManagementSession::ActivateL()
  2833 // -------------------------------------------------------------------------------------------------------------------
  2833 // -------------------------------------------------------------------------------------------------------------------
  2841 
  2841 
  2842     RDEBUG_2( "ApplicationManagementSession: ActivateL id is %d", id );
  2842     RDEBUG_2( "ApplicationManagementSession: ActivateL id is %d", id );
  2843     CDeploymentComponent &compo = Server().Storage()->ComponentL(id);
  2843     CDeploymentComponent &compo = Server().Storage()->ComponentL(id);
  2844     Server().Storage()->ActivateL(compo);
  2844     Server().Storage()->ActivateL(compo);
  2845     
  2845     
  2846     SetSCOMOTargetURI(compo.UserId());
  2846     
  2847     }
  2847     }
  2848 
  2848 
  2849 // -------------------------------------------------------------------------------------------------------------------
  2849 // -------------------------------------------------------------------------------------------------------------------
  2850 // CApplicationManagementSession::GetUserIdL()
  2850 // CApplicationManagementSession::GetUserIdL()
  2851 // -------------------------------------------------------------------------------------------------------------------
  2851 // -------------------------------------------------------------------------------------------------------------------
  2861     CDeploymentComponent &compo = Server().Storage()->ComponentL(id);
  2861     CDeploymentComponent &compo = Server().Storage()->ComponentL(id);
  2862 
  2862 
  2863     aMessage.Write( 1, compo.UserId() );
  2863     aMessage.Write( 1, compo.UserId() );
  2864     }
  2864     }
  2865 
  2865 
  2866 void CApplicationManagementSession::SetSCOMOTargetURI(const TDesC8& aURI) const
  2866 
  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    
       
  2894     }
       
  2895 
  2867 
  2896 // -------------------------------------------------------------------------------------------------------------------
  2868 // -------------------------------------------------------------------------------------------------------------------
  2897 // CApplicationManagementSession::GetTemporaryInstFileL()
  2869 // CApplicationManagementSession::GetTemporaryInstFileL()
  2898 // -------------------------------------------------------------------------------------------------------------------
  2870 // -------------------------------------------------------------------------------------------------------------------
  2899 
  2871 
  3744 
  3716 
  3745 void CApplicationManagementSession::StateChangeComponentIdsCountL(
  3717 void CApplicationManagementSession::StateChangeComponentIdsCountL(
  3746         const RMessage2& aMessage) const
  3718         const RMessage2& aMessage) const
  3747     {
  3719     {
  3748     RDEBUG( "CApplicationManagementSession: StateChangeComponentIdsCountL" );
  3720     RDEBUG( "CApplicationManagementSession: StateChangeComponentIdsCountL" );
  3749                RPointerArray<TPreInstalledAppParams> preInstalledAppParams;
       
  3750                 CAMPreInstallApp* preInstallApp = CAMPreInstallApp::NewL();
       
  3751                 preInstallApp->GetPreInstalledAppsL(preInstalledAppParams);
       
  3752                 TInt count = 0;
       
  3753                 for (count = 0; count< preInstalledAppParams.Count(); count++)
       
  3754                     {
       
  3755                     RDEBUG8_2("CApplicationManagementSession::DownloadL: Installed App Name is: %S",&(preInstalledAppParams[count]->iPreInstalledAppame));
       
  3756                     RDEBUG8_2("CApplicationManagementSession::DownloadL: Installed App Vendor is: %S",&(preInstalledAppParams[count]->iPreInstalledAppVendorName));
       
  3757                     RDEBUG_2("CApplicationManagementSession::DownloadL: Installed App UID is : '0x%X'",preInstalledAppParams[count]->iPreInstalledAppUid);
       
  3758 
       
  3759                     TBool found = EFalse;
       
  3760                     const RComponentIdArray &arrt = Server().Storage()->GetComponentIds();
       
  3761                     TInt countval(arrt.Count() );
       
  3762                     for (TInt i( 0); i < countval; i++)
       
  3763                         {
       
  3764                         CDeploymentComponent &compo = Server().Storage()->ComponentL(arrt[i]);
       
  3765                         if (compo.Uid()== preInstalledAppParams[count]->iPreInstalledAppUid)
       
  3766                             {
       
  3767                             RDEBUG( "CApplicationManagementSession: ActiveComponentsL found= TRUE" );
       
  3768                             found = ETrue;
       
  3769                             }
       
  3770                         }
       
  3771                     if (!found)
       
  3772                         {
       
  3773                         RDEBUG( "CApplicationManagementSession: Adding Pre-installed app" );
       
  3774                         TDCUserId preInstalledAppName;
       
  3775                         preInstalledAppName.Copy(preInstalledAppParams[count]->iPreInstalledAppame);
       
  3776                         CDeploymentComponent *preInstallCompo= NULL;
       
  3777                         RDEBUG8_2("CApplicationManagementSession: Installed App Name is: %S",&preInstalledAppName);
       
  3778                         preInstallCompo = Server().Storage()->NewComponentL(EDCSActive, preInstalledAppName);
       
  3779                         preInstallCompo->SetUid(preInstalledAppParams[count]->iPreInstalledAppUid);
       
  3780                         preInstallCompo->SetNameL(preInstalledAppName);
       
  3781                         preInstallCompo->SetVersionL(preInstalledAppParams[count]->iVersion);
       
  3782                         preInstallCompo->SetMimeTypeL(preInstalledAppParams[count]->iMimeType);
       
  3783 				preInstallCompo->SetAppRemovableStatus(ETrue);
       
  3784 
       
  3785                         Server().Storage()->UpdateL( *preInstallCompo );
       
  3786                         Server().Storage()->CheckForDuplicateNodesInDeployedL(*preInstallCompo);
       
  3787                         }
       
  3788                     }
       
  3789                 delete preInstallApp;
       
  3790     RComponentIdArray arr;
  3721     RComponentIdArray arr;
  3791     Server().Storage()->GetStateChangeComponentIdsL(arr);
  3722     Server().Storage()->GetStateChangeComponentIdsL(arr);
  3792     TPckgBuf<TInt> buflen(arr.Count() );
  3723     TPckgBuf<TInt> buflen(arr.Count() );
  3793     aMessage.WriteL( 0, buflen);
  3724     aMessage.WriteL( 0, buflen);
  3794     arr.Close();
  3725     arr.Close();