terminalsecurity/SCP/SCPEventHandler/src/SCPEventHandler.cpp
changeset 5 3f7d9dbe57c8
parent 0 b497e44ab2fc
equal deleted inserted replaced
4:958eca8527dd 5:3f7d9dbe57c8
    85 // NotifyChangesL
    85 // NotifyChangesL
    86 // -----------------------------------------------------------------------------
    86 // -----------------------------------------------------------------------------
    87 EXPORT_C void CSCPEventHandler::NotifyChangesL(THandlerServiceId aEvent, THandlerOperation aOperation) 
    87 EXPORT_C void CSCPEventHandler::NotifyChangesL(THandlerServiceId aEvent, THandlerOperation aOperation) 
    88     {
    88     {
    89     
    89     
    90     FLOG(_L("[CSCPEventHandler]-> started NotifyChangesL() aOperation=%d"), aOperation);
    90     _DMEVNT_DEBUG(_L("[CSCPEventHandler]-> started NotifyChangesL() aOperation=%d"), aOperation);
    91 
    91 
    92     if( (EOpnUninstall == aOperation) || (EOpnRemoved == aOperation))
    92     if( (EOpnUninstall == aOperation) || (EOpnRemoved == aOperation))
    93     {
    93     {
    94         FLOG(_L("[CSCPEventHandler]-> EUninstallation == aOperation || EOpnRemoved == aOperation"));
    94         _DMEVNT_DEBUG(_L("[CSCPEventHandler]-> EUninstallation == aOperation || EOpnRemoved == aOperation"));
    95         RArray <TUid> uids;
    95         RArray <TUid> uids;
    96         CleanupClosePushL(uids);
    96         CleanupClosePushL(uids);
    97 
    97 
    98         // Call database api & fill the uids
    98         // Call database api & fill the uids
    99         CSCPParamDBController* dbObj = CSCPParamDBController::NewLC();
    99         CSCPParamDBController* dbObj = CSCPParamDBController::NewLC();
   100        
   100        
   101         //calling...ListApplicationsL
   101         //calling...ListApplicationsL
   102 	   	FLOG(_L("[CSCPEventHandler]-> ListApplicationsL started"));
   102 	   	_DMEVNT_DEBUG(_L("[CSCPEventHandler]-> ListApplicationsL started"));
   103         dbObj->ListApplicationsL(uids);
   103         dbObj->ListApplicationsL(uids);
   104         CleanupStack :: PopAndDestroy(); // dbObj
   104         CleanupStack :: PopAndDestroy(); // dbObj
   105 	    FLOG(_L("[CSCPEventHandler]-> ListApplicationsL ended"));
   105 	    _DMEVNT_DEBUG(_L("[CSCPEventHandler]-> ListApplicationsL ended"));
   106         FLOG(_L("[CSCPEventHandler]-> uids = %d"), uids.Count());
   106         _DMEVNT_DEBUG(_L("[CSCPEventHandler]-> uids = %d"), uids.Count());
   107 
   107 
   108 /*        RArray <TUid> sisUids;
   108 /*        RArray <TUid> sisUids;
   109         CleanupClosePushL( sisUids );*/
   109         CleanupClosePushL( sisUids );*/
   110         
   110         
   111         //GetInstalledSisUidsL(sisUids);
   111         //GetInstalledSisUidsL(sisUids);
   117         //CleanupClosePushL( javaUids );
   117         //CleanupClosePushL( javaUids );
   118         //GetInstalledJavaUidsL(javaUids);
   118         //GetInstalledJavaUidsL(javaUids);
   119 
   119 
   120         RArray <TUid> resultUids;
   120         RArray <TUid> resultUids;
   121         CleanupClosePushL(resultUids);        
   121         CleanupClosePushL(resultUids);        
   122         FLOG(_L("[CSCPEventHandler]-> Entering loop for each application, to check with AI"));
   122         _DMEVNT_DEBUG(_L("[CSCPEventHandler]-> Entering loop for each application, to check with AI"));
   123         
   123         
   124         for (int i=0; i < uids.Count(); i++)
   124         for (int i=0; i < uids.Count(); i++)
   125         {
   125         {
   126             FLOG(_L("[CSCPEventHandler]-> INFO: Checking case for UID %d"), uids[i].iUid);
   126             _DMEVNT_DEBUG(_L("[CSCPEventHandler]-> INFO: Checking case for UID %d"), uids[i].iUid);
   127             
   127             
   128             switch(uids[i].iUid) {
   128             switch(uids[i].iUid) {
   129                 case KNSmlDMHostServer1ID:
   129                 case KNSmlDMHostServer1ID:
   130                 case KNSmlDMHostServer2ID:
   130                 case KNSmlDMHostServer2ID:
   131                 case KNSmlDMHostServer3ID:
   131                 case KNSmlDMHostServer3ID:
   132                 case KNSmlDMHostServer4ID:
   132                 case KNSmlDMHostServer4ID:
   133                     FLOG(_L("[CSCPEventHandler]-> INFO: UID is marked as an exception, cleanup request bypassed..."));
   133                     _DMEVNT_DEBUG(_L("[CSCPEventHandler]-> INFO: UID is marked as an exception, cleanup request bypassed..."));
   134                     break;
   134                     break;
   135                 default: {
   135                 default: {
   136             Swi::RSisRegistryEntry sisEntry;
   136             Swi::RSisRegistryEntry sisEntry;
   137             //Opens the base package entry by specifying a UID. 
   137             //Opens the base package entry by specifying a UID. 
   138             TInt lErr = sisEntry.Open(sisses, uids[i]);
   138             TInt lErr = sisEntry.Open(sisses, uids[i]);
   139             CleanupClosePushL(sisEntry);
   139             CleanupClosePushL(sisEntry);
   140             
   140             
   141             FLOG(_L("[CSCPEventHandler]-> INFO: lErr = %d"), lErr);
   141             _DMEVNT_DEBUG(_L("[CSCPEventHandler]-> INFO: lErr = %d"), lErr);
   142 
   142 
   143             //if(EFalse == isInstalledSis(uids[i], sisUids))
   143             //if(EFalse == isInstalledSis(uids[i], sisUids))
   144             
   144             
   145             // If the application does not exist
   145             // If the application does not exist
   146             if( lErr != KErrNone || EFalse == sisEntry.IsPresentL())
   146             if( lErr != KErrNone || EFalse == sisEntry.IsPresentL())
   147             {
   147             {
   148                 FLOG(_L("[CSCPEventHandler]-> INFO: UID %d was identified as uninstalled,\
   148                 _DMEVNT_DEBUG(_L("[CSCPEventHandler]-> INFO: UID %d was identified as uninstalled,\
   149                         performing cleanup on the same"), uids[i].iUid);
   149                         performing cleanup on the same"), uids[i].iUid);
   150                 // Does not exist in sis-registry, need to check in java registry
   150                 // Does not exist in sis-registry, need to check in java registry
   151                 //if(EFalse == isInstalledJava(uids[i], javaUids))
   151                 //if(EFalse == isInstalledJava(uids[i], javaUids))
   152              		resultUids.Append(uids[i]);
   152              		resultUids.Append(uids[i]);
   153             }
   153             }
   158             };
   158             };
   159         } // for uids
   159         } // for uids
   160 
   160 
   161         //CleanupStack::PopAndDestroy( &sisUids ); // sisUids
   161         //CleanupStack::PopAndDestroy( &sisUids ); // sisUids
   162         //CleanupStack::PopAndDestroy( &javaUids ); // javaUids
   162         //CleanupStack::PopAndDestroy( &javaUids ); // javaUids
   163         FLOG(_L("[CSCPEventHandler]->NotifyChangesL(): Loop ended"));        
   163         _DMEVNT_DEBUG(_L("[CSCPEventHandler]->NotifyChangesL(): Loop ended"));        
   164         FLOG(_L("[CSCPEventHandler]-> resultUids = %d"), resultUids.Count());
   164         _DMEVNT_DEBUG(_L("[CSCPEventHandler]-> resultUids = %d"), resultUids.Count());
   165 
   165 
   166         if(resultUids.Count())
   166         if(resultUids.Count())
   167         {
   167         {
   168         	NotifyCleanupL(resultUids);
   168         	NotifyCleanupL(resultUids);
   169         }
   169         }
   170         CleanupStack :: PopAndDestroy(3); // resultUids, sisses, uids
   170         CleanupStack :: PopAndDestroy(3); // resultUids, sisses, uids
   171     }// if (EUninstallation == aOperation)
   171     }// if (EUninstallation == aOperation)
   172     
   172     
   173     FLOG(_L("[CSCPEventHandler]-> end of NotifyChangesL()"));
   173     _DMEVNT_DEBUG(_L("[CSCPEventHandler]-> end of NotifyChangesL()"));
   174 }
   174 }
   175 
   175 
   176 /*
   176 /*
   177 void CSCPEventHandler::GetInstalledJavaUidsL(RArray<TUid>& aUids)
   177 void CSCPEventHandler::GetInstalledJavaUidsL(RArray<TUid>& aUids)
   178 {
   178 {
   204 }
   204 }
   205 */
   205 */
   206 
   206 
   207 inline void CSCPEventHandler::NotifyCleanupL(RArray<TUid>& aUids)
   207 inline void CSCPEventHandler::NotifyCleanupL(RArray<TUid>& aUids)
   208 {
   208 {
   209     FLOG(_L("[CSCPEventHandler:NotifyCleanupL]-> RSCPClient creation & connecting..."))
   209     _DMEVNT_DEBUG(_L("[CSCPEventHandler:NotifyCleanupL]-> RSCPClient creation & connecting..."));
   210     RSCPClient lClient;
   210     RSCPClient lClient;
   211     CleanupClosePushL (lClient);
   211     CleanupClosePushL (lClient);
   212     User :: LeaveIfError(lClient.Connect());
   212     User :: LeaveIfError(lClient.Connect());
   213 
   213 
   214     FLOG(_L("[CSCPEventHandler]-> Initializing cleanup..."));
   214     _DMEVNT_DEBUG(_L("[CSCPEventHandler]-> Initializing cleanup..."));
   215     //TRAPD(lErr, lClient.PerformCleanupL(ESCPApplicationUninstalled, aUids));
   215     //TRAPD(lErr, lClient.PerformCleanupL(ESCPApplicationUninstalled, aUids));
   216     User :: LeaveIfError(lClient.PerformCleanupL(aUids));
   216     User :: LeaveIfError(lClient.PerformCleanupL(aUids));
   217     CleanupStack :: PopAndDestroy(); // lClient
   217     CleanupStack :: PopAndDestroy(); // lClient
   218     FLOG(_L("[CSCPEventHandler]-> cleanup complete..."));
   218     _DMEVNT_DEBUG(_L("[CSCPEventHandler]-> cleanup complete..."));
   219     FLOG(_L("[CSCPEventHandler:NotifyCleanupL]-> RSCPClient operation Completed..."))
   219     _DMEVNT_DEBUG(_L("[CSCPEventHandler:NotifyCleanupL]-> RSCPClient operation Completed..."));
   220 }
   220 }