javamanager/javacaptain/extensionplugins/scrupdater/src/scrupdater.cpp
changeset 48 e0d6e9bd3ca7
parent 47 f40128debb5d
equal deleted inserted replaced
47:f40128debb5d 48:e0d6e9bd3ca7
    31 
    31 
    32 #include "scrupdater.h"
    32 #include "scrupdater.h"
    33 
    33 
    34 using namespace Usif;
    34 using namespace Usif;
    35 
    35 
       
    36 _LIT(KMediaId, "Media-Id");
       
    37 
    36 /**
    38 /**
    37  * Return pointer to ExtensionPluginInterface implementation for this
    39  * Return pointer to ExtensionPluginInterface implementation for this
    38  * extension dll
    40  * extension dll
    39  */
    41  */
    40 java::captain::ExtensionPluginInterface* getExtensionPlugin()
    42 java::captain::ExtensionPluginInterface* getExtensionPlugin()
    41 {
    43 {
    42     return new java::captain::ScrUpdater();
    44     return new java::captain::ScrUpdater();
    43 }
    45 }
    44 
    46 
    45 namespace java
    47 namespace java  // codescanner::namespace
    46 {
    48 {
    47 namespace captain
    49 namespace captain  // codescanner::namespace
    48 {
    50 {
    49 
    51 
    50 using java::fileutils::driveInfo;
    52 using java::fileutils::driveInfo;
    51 using java::fileutils::DriveListenerInterface;
    53 using java::fileutils::DriveListenerInterface;
    52 
    54 
    53 /**
    55 /**
    54  * Empty contructor
    56  * Empty contructor
    55  */
    57  */
    56 ScrUpdater::ScrUpdater() : mCore(0)
    58 ScrUpdater::ScrUpdater()
    57 {
    59 {
    58 }
    60 }
    59 
    61 
    60 /**
    62 /**
    61  * Empty destructor
    63  * Empty destructor
    65 }
    67 }
    66 
    68 
    67 /**
    69 /**
    68  * Implement PluginInterface method
    70  * Implement PluginInterface method
    69  */
    71  */
    70 void ScrUpdater::startPlugin(CoreInterface* core)
    72 void ScrUpdater::startPlugin(CoreInterface* /* aCore */)
    71 {
    73 {
    72     LOG(EJavaCaptain, EInfo, "ScrUpdater plugin started");
    74     LOG(EJavaCaptain, EInfo, "ScrUpdater plugin started");
    73 
       
    74     mCore = core;
       
    75 }
    75 }
    76 
    76 
    77 /**
    77 /**
    78  * Implement PluginInterface method
    78  * Implement PluginInterface method
    79  */
    79  */
    80 void ScrUpdater::stopPlugin()
    80 void ScrUpdater::stopPlugin()
    81 {
    81 {
    82     mCore = 0;
       
    83 }
    82 }
    84 
    83 
    85 /**
    84 /**
    86  * Implement ExtensionPluginInterface method
    85  * Implement ExtensionPluginInterface method
    87  */
    86  */
    94  * Handle Java Captain events sent by Boot event provider or
    93  * Handle Java Captain events sent by Boot event provider or
    95  * MMC event provider.
    94  * MMC event provider.
    96  *
    95  *
    97  * Implement EventConsumerInterface method
    96  * Implement EventConsumerInterface method
    98  */
    97  */
    99 void ScrUpdater::event(const std::string& eventProvider,
    98 void ScrUpdater::event(const std::string& aEventProvider,
   100                        java::comms::CommsMessage& aMsg)
    99                        java::comms::CommsMessage& aMsg)
   101 {
   100 {
   102     if (eventProvider == BOOT_EVENT_PROVIDER)
   101     if (aEventProvider == BOOT_EVENT_PROVIDER)
   103     {
   102     {
   104         int bootType = NORMAL_BOOT_C;
   103         int bootType = NORMAL_BOOT_C;
   105         getBootMessageParams(aMsg, bootType);
   104         getBootMessageParams(aMsg, bootType);
   106         LOG1(
   105         LOG1(
   107             EJavaCaptain,
   106             EJavaCaptain,
   129                     "DriveListenerInterface: event() unknown boot event (type=%d)", bootType);
   128                     "DriveListenerInterface: event() unknown boot event (type=%d)", bootType);
   130             }
   129             }
   131             break;
   130             break;
   132         }
   131         }
   133     }
   132     }
   134     else if (eventProvider == MMC_EVENT_PROVIDER)
   133     else if (aEventProvider == MMC_EVENT_PROVIDER)
   135     {
   134     {
   136         int operation = 0;
   135         int operation = 0;
   137         driveInfo di;
   136         driveInfo di;
   138         getMmcChangedMessageParams(aMsg, operation, di);
   137         getMmcChangedMessageParams(aMsg, operation, di);
   139         LOG1(
   138         LOG1(
   187     RSoftwareComponentRegistry *pScr = createScrL();
   186     RSoftwareComponentRegistry *pScr = createScrL();
   188     CleanupStack::PushL(pScr);
   187     CleanupStack::PushL(pScr);
   189 
   188 
   190     // Get ids of all Java components in scr
   189     // Get ids of all Java components in scr
   191     RArray<TComponentId> componentIdList;
   190     RArray<TComponentId> componentIdList;
       
   191     CleanupClosePushL(componentIdList);
       
   192 
   192     CComponentFilter *pJavaSwTypeFilter = CComponentFilter::NewLC();
   193     CComponentFilter *pJavaSwTypeFilter = CComponentFilter::NewLC();
   193     pJavaSwTypeFilter->SetSoftwareTypeL(Usif::KSoftwareTypeJava);
   194     pJavaSwTypeFilter->SetSoftwareTypeL(Usif::KSoftwareTypeJava);
   194 
   195 
   195     pScr->GetComponentIdsL(componentIdList, pJavaSwTypeFilter);
   196     pScr->GetComponentIdsL(componentIdList, pJavaSwTypeFilter);
   196     CleanupStack::PopAndDestroy(pJavaSwTypeFilter);
   197     CleanupStack::PopAndDestroy(pJavaSwTypeFilter);
   197     CleanupClosePushL(componentIdList);
       
   198 
   198 
   199     // For each component check whether it has been installed
   199     // For each component check whether it has been installed
   200     // to the removed drive
   200     // to the removed drive
   201     TInt  nComponents = componentIdList.Count();
   201     TInt  nComponents = componentIdList.Count();
   202     TUint removedDrive = (TUint)(aInfo->iRootPath[0]);
   202     TUint removedDrive = (TUint)(aInfo->iRootPath[0]);
   203     // Now removedDrive contains the drive letter, convert it to drive number 0-25
   203     // Now removedDrive contains the drive letter, convert it to drive number 0-25
   204     if ((removedDrive > 64) && (removedDrive < 91))
   204     if ((removedDrive > 64) && (removedDrive < 91))  // codescanner::magicnumbers
   205     {
   205     {
   206         // 'A' - 'Z'
   206         // 'A' - 'Z'
   207         removedDrive -= 65;
   207         removedDrive -= 65;  // codescanner::magicnumbers
   208     }
   208     }
   209     else if ((removedDrive > 96) && (removedDrive < 123))
   209     else if ((removedDrive > 96) && (removedDrive < 123))  // codescanner::magicnumbers
   210     {
   210     {
   211         // 'a' - 'z'
   211         // 'a' - 'z'
   212         removedDrive -= 97;
   212         removedDrive -= 97;  // codescanner::magicnumbers
   213     }
   213     }
   214     else
   214     else
   215     {
   215     {
   216         ELOG1WSTR(EJavaCaptain,
   216         ELOG1WSTR(EJavaCaptain,
   217             "removeScrPresencesL: Unexpected root path in remove drive info %s",
   217             "removeScrPresencesL: Unexpected root path in remove drive info %s",
   221     }
   221     }
   222 
   222 
   223     LOG2(EJavaCaptain, EInfo, "Number of Java components is %d, removed drive is %d",
   223     LOG2(EJavaCaptain, EInfo, "Number of Java components is %d, removed drive is %d",
   224         nComponents, removedDrive);
   224         nComponents, removedDrive);
   225 
   225 
   226     TBool fPresenceChange = EFalse;
       
   227     RArray<TApaAppUpdateInfo> removedApps;
   226     RArray<TApaAppUpdateInfo> removedApps;
   228     CleanupClosePushL(removedApps);
   227     CleanupClosePushL(removedApps);
   229 
   228 
   230     for (TInt nInd = 0; nInd < nComponents; nInd++)
   229     for (TInt nInd = 0; nInd < nComponents; nInd++)
   231     {
   230     {
   259             pScr->SetIsComponentPresentL(componentIdList[nInd], EFalse);
   258             pScr->SetIsComponentPresentL(componentIdList[nInd], EFalse);
   260 
   259 
   261             LOG1(EJavaCaptain, EInfo,
   260             LOG1(EJavaCaptain, EInfo,
   262                 "removeScrPresencesL: set component %d to not present",
   261                 "removeScrPresencesL: set component %d to not present",
   263                 componentIdList[nInd]);
   262                 componentIdList[nInd]);
   264 
       
   265             fPresenceChange = ETrue;
       
   266 
   263 
   267             // Gather the Uids of all applications that are no longer present
   264             // Gather the Uids of all applications that are no longer present
   268             RArray<TUid> appsInComponent;
   265             RArray<TUid> appsInComponent;
   269             CleanupClosePushL(appsInComponent);
   266             CleanupClosePushL(appsInComponent);
   270             pScr->GetAppUidsForComponentL(
   267             pScr->GetAppUidsForComponentL(
   272             for (TInt nInd2 = 0; nInd2 < appsInComponent.Count(); nInd2++)
   269             for (TInt nInd2 = 0; nInd2 < appsInComponent.Count(); nInd2++)
   273             {
   270             {
   274                 TApaAppUpdateInfo appInfo;
   271                 TApaAppUpdateInfo appInfo;
   275                 appInfo.iAppUid = appsInComponent[nInd2];
   272                 appInfo.iAppUid = appsInComponent[nInd2];
   276                 appInfo.iAction = TApaAppUpdateInfo::EAppNotPresent;
   273                 appInfo.iAction = TApaAppUpdateInfo::EAppNotPresent;
   277                 (void)removedApps.Append(appInfo);
   274                 removedApps.AppendL(appInfo);
   278             }
   275             }
   279             CleanupStack::PopAndDestroy(&appsInComponent);
   276             CleanupStack::PopAndDestroy(&appsInComponent);
   280         }
   277         }
   281 
   278 
   282         CleanupStack::PopAndDestroy(pEntry);
   279         CleanupStack::PopAndDestroy(pEntry);
   283     }
   280     }
   284 
   281 
   285     // Tell AppArc which applications are no longer present
   282     // Tell AppArc which applications are no longer present
   286     while (fPresenceChange)
   283     if (removedApps.Count() > 0)
   287     {
   284     {
   288         if (removedApps.Count() == 0)
       
   289         {
       
   290             ELOG(EJavaCaptain, "removeScrPresencesL: Uids of the removed apps are not known");
       
   291             break;
       
   292         }
       
   293 
       
   294         RApaLsSession apaSession;
   285         RApaLsSession apaSession;
   295         TInt err = apaSession.Connect();
   286         TInt err = apaSession.Connect();
   296         if (KErrNone != err)
   287         if (KErrNone != err)
   297         {
   288         {
   298             ELOG1(EJavaCaptain, "removeScrPresencesL: Error %d when connecting AppArc", err);
   289             ELOG1(EJavaCaptain, "removeScrPresencesL: Error %d when connecting AppArc", err);
   299             break;
       
   300         }
   290         }
   301         else
   291         else
   302         {
   292         {
   303             CleanupClosePushL(apaSession);
   293             CleanupClosePushL(apaSession);
   304             apaSession.UpdateAppListL(removedApps);
   294             apaSession.UpdateAppListL(removedApps);
   305             CleanupStack::PopAndDestroy(); // closes apaSession
   295             CleanupStack::PopAndDestroy(); // closes apaSession
   306             fPresenceChange = EFalse;
       
   307         }
   296         }
   308     }
   297     }
   309 
   298 
   310     CleanupStack::PopAndDestroy(); // Close removedApps
   299     CleanupStack::PopAndDestroy(); // Close removedApps
   311     CleanupStack::PopAndDestroy(); // Close componentIdList
   300     CleanupStack::PopAndDestroy(); // Close componentIdList
   327     RSoftwareComponentRegistry *pScr = createScrL();
   316     RSoftwareComponentRegistry *pScr = createScrL();
   328     CleanupStack::PushL(pScr);
   317     CleanupStack::PushL(pScr);
   329 
   318 
   330     // Get ids of all Java components in scr
   319     // Get ids of all Java components in scr
   331     RArray<TComponentId> componentIdList;
   320     RArray<TComponentId> componentIdList;
       
   321     CleanupClosePushL(componentIdList);
       
   322 
   332     CComponentFilter *pJavaSwTypeFilter = CComponentFilter::NewLC();
   323     CComponentFilter *pJavaSwTypeFilter = CComponentFilter::NewLC();
   333     pJavaSwTypeFilter->SetSoftwareTypeL(Usif::KSoftwareTypeJava);
   324     pJavaSwTypeFilter->SetSoftwareTypeL(Usif::KSoftwareTypeJava);
   334 
   325 
   335     pScr->GetComponentIdsL(componentIdList, pJavaSwTypeFilter);
   326     pScr->GetComponentIdsL(componentIdList, pJavaSwTypeFilter);
   336     CleanupStack::PopAndDestroy(pJavaSwTypeFilter);
   327     CleanupStack::PopAndDestroy(pJavaSwTypeFilter);
   337     CleanupClosePushL(componentIdList);
       
   338 
   328 
   339     // For each component check whether it has been installed
   329     // For each component check whether it has been installed
   340     // to the added drive AND whether the media id is correct
   330     // to the added drive AND whether the media id is correct
   341     // (in other words if the actual memory card where the component
   331     // (in other words if the actual memory card where the component
   342     // has been installed to is added to the drive).
   332     // has been installed to is added to the drive).
   343     TInt  nComponents  = componentIdList.Count();
   333     TInt  nComponents  = componentIdList.Count();
   344     TUint addedMediaId = (TUint)(aInfo->iId);
   334     TUint addedMediaId = (TUint)(aInfo->iId);
   345     TUint addedDrive   = (TUint)(aInfo->iRootPath[0]);
   335     TUint addedDrive   = (TUint)(aInfo->iRootPath[0]);
   346     // Now addedDrive contains the drive letter, convert it to drive number 0-25
   336     // Now addedDrive contains the drive letter, convert it to drive number 0-25
   347     if ((addedDrive > 64) && (addedDrive < 91))
   337     if ((addedDrive > 64) && (addedDrive < 91))  // codescanner::magicnumbers
   348     {
   338     {
   349         // 'A' - 'Z'
   339         // 'A' - 'Z'
   350         addedDrive -= 65;
   340         addedDrive -= 65;  // codescanner::magicnumbers
   351     }
   341     }
   352     else if ((addedDrive > 96) && (addedDrive < 123))
   342     else if ((addedDrive > 96) && (addedDrive < 123))  // codescanner::magicnumbers
   353     {
   343     {
   354         // 'a' - 'z'
   344         // 'a' - 'z'
   355         addedDrive -= 97;
   345         addedDrive -= 97;  // codescanner::magicnumbers
   356     }
   346     }
   357     else
   347     else
   358     {
   348     {
   359         ELOG1WSTR(EJavaCaptain,
   349         ELOG1WSTR(EJavaCaptain,
   360             "addScrPresencesL: Unexpected root path in add drive info %s",
   350             "addScrPresencesL: Unexpected root path in add drive info %s",
   364     }
   354     }
   365 
   355 
   366     LOG2(EJavaCaptain, EInfo, "Number of Java components is %d, added drive is %d",
   356     LOG2(EJavaCaptain, EInfo, "Number of Java components is %d, added drive is %d",
   367         nComponents, addedDrive);
   357         nComponents, addedDrive);
   368 
   358 
   369     TBool fPresenceChange = EFalse;
       
   370     RArray<TApaAppUpdateInfo> addedApps;
   359     RArray<TApaAppUpdateInfo> addedApps;
   371     CleanupClosePushL(addedApps);
   360     CleanupClosePushL(addedApps);
   372 
   361 
   373     for (TInt nInd = 0; nInd < nComponents; nInd++)
   362     for (TInt nInd = 0; nInd < nComponents; nInd++)
   374     {
   363     {
   382             continue;
   371             continue;
   383         }
   372         }
   384 
   373 
   385         // When Java Installer registers Java app to SCR it stores also
   374         // When Java Installer registers Java app to SCR it stores also
   386         // the media id using SetComponentPropertyL(TComponentId aComponentId,
   375         // the media id using SetComponentPropertyL(TComponentId aComponentId,
   387         // _L("Media-Id")), TInt64 aValue);  (aValue is actually 32 bit int)
   376         // _L("Media-Id"), TInt64 aValue);  (aValue is actually 32 bit int)
   388         CIntPropertyEntry* pMediaIdProperty = (CIntPropertyEntry *)
   377         CIntPropertyEntry* pMediaIdProperty = (CIntPropertyEntry *)
   389             pScr->GetComponentPropertyL(componentIdList[nInd],_L("Media-Id"));
   378             pScr->GetComponentPropertyL(componentIdList[nInd], KMediaId);
   390         if (NULL == pMediaIdProperty)
   379         if (NULL == pMediaIdProperty)
   391         {
   380         {
   392             ELOG1(EJavaCaptain,
   381             ELOG1(EJavaCaptain,
   393                 "addScrPresencesL: media_id property not found for component %d",
   382                 "addScrPresencesL: media_id property not found for component %d",
   394                 componentIdList[nInd]);
   383                 componentIdList[nInd]);
   421                 pScr->SetIsComponentPresentL(componentIdList[nInd], ETrue);
   410                 pScr->SetIsComponentPresentL(componentIdList[nInd], ETrue);
   422 
   411 
   423                 LOG1(EJavaCaptain, EInfo,
   412                 LOG1(EJavaCaptain, EInfo,
   424                     "addScrPresencesL: set component %d to present",
   413                     "addScrPresencesL: set component %d to present",
   425                     componentIdList[nInd]);
   414                     componentIdList[nInd]);
   426 
       
   427                 fPresenceChange = ETrue;
       
   428 
   415 
   429                 // Gather the Uids of all 'new' applications that are now present
   416                 // Gather the Uids of all 'new' applications that are now present
   430                 RArray<TUid> appsInComponent;
   417                 RArray<TUid> appsInComponent;
   431                 CleanupClosePushL(appsInComponent);
   418                 CleanupClosePushL(appsInComponent);
   432                 pScr->GetAppUidsForComponentL(
   419                 pScr->GetAppUidsForComponentL(
   434                 for (TInt nInd2 = 0; nInd2 < appsInComponent.Count(); nInd2++)
   421                 for (TInt nInd2 = 0; nInd2 < appsInComponent.Count(); nInd2++)
   435                 {
   422                 {
   436                     TApaAppUpdateInfo appInfo;
   423                     TApaAppUpdateInfo appInfo;
   437                     appInfo.iAppUid = appsInComponent[nInd2];
   424                     appInfo.iAppUid = appsInComponent[nInd2];
   438                     appInfo.iAction = TApaAppUpdateInfo::EAppPresent;
   425                     appInfo.iAction = TApaAppUpdateInfo::EAppPresent;
   439                     (void)addedApps.Append(appInfo);
   426                     addedApps.AppendL(appInfo);
   440                 }
   427                 }
   441                 CleanupStack::PopAndDestroy(&appsInComponent);
   428                 CleanupStack::PopAndDestroy(&appsInComponent);
   442             }
   429             }
   443         }
   430         }
   444 
   431 
   445         CleanupStack::PopAndDestroy(pMediaIdProperty);
   432         CleanupStack::PopAndDestroy(pMediaIdProperty);
   446         CleanupStack::PopAndDestroy(pEntry);
   433         CleanupStack::PopAndDestroy(pEntry);
   447     }
   434     }
   448 
   435 
   449     // Tell AppArc which 'new' applications are now present
   436     // Tell AppArc which 'new' applications are now present
   450     while (fPresenceChange)
   437     if (addedApps.Count() > 0)
   451     {
   438     {
   452         if (addedApps.Count() == 0)
       
   453         {
       
   454             ELOG(EJavaCaptain, "addScrPresencesL: Uids of the 'new' apps are not known");
       
   455             break;
       
   456         }
       
   457 
       
   458         RApaLsSession apaSession;
   439         RApaLsSession apaSession;
   459         TInt err = apaSession.Connect();
   440         TInt err = apaSession.Connect();
   460         if (KErrNone != err)
   441         if (KErrNone != err)
   461         {
   442         {
   462             ELOG1(EJavaCaptain, "addScrPresencesL: Error %d when connecting AppArc", err);
   443             ELOG1(EJavaCaptain, "addScrPresencesL: Error %d when connecting AppArc", err);
   463             break;
       
   464         }
   444         }
   465         else
   445         else
   466         {
   446         {
   467             CleanupClosePushL(apaSession);
   447             CleanupClosePushL(apaSession);
   468             apaSession.UpdateAppListL(addedApps);
   448             apaSession.UpdateAppListL(addedApps);
   469             CleanupStack::PopAndDestroy(); // closes apaSession
   449             CleanupStack::PopAndDestroy(); // closes apaSession
   470             fPresenceChange = EFalse;
       
   471         }
   450         }
   472     }
   451     }
   473 
   452 
   474     CleanupStack::PopAndDestroy(); // Close addedApps
   453     CleanupStack::PopAndDestroy(); // Close addedApps
   475     CleanupStack::PopAndDestroy(); // Close componentIdList
   454     CleanupStack::PopAndDestroy(); // Close componentIdList
   485  * to removable drives accordingly.
   464  * to removable drives accordingly.
   486  */
   465  */
   487 void ScrUpdater::initializeScrPresenceInfoL()
   466 void ScrUpdater::initializeScrPresenceInfoL()
   488 {
   467 {
   489     __UHEAP_MARK;
   468     __UHEAP_MARK;
   490     RFs fs;
   469     RFs fs;  // codescanner::rfs
   491     User::LeaveIfError(fs.Connect());
   470     User::LeaveIfError(fs.Connect());
   492     CleanupClosePushL(fs);
   471     CleanupClosePushL(fs);
   493 
   472 
   494     // Which drives are present and what is the media id of
   473     // Which drives are present and what is the media id of
   495     // each removable volume
   474     // each removable volume
   503     for (TInt nInd = EDriveA; nInd < EDriveZ; nInd++)
   482     for (TInt nInd = EDriveA; nInd < EDriveZ; nInd++)
   504     {
   483     {
   505         err = fs.Volume(volumeInfo, nInd);
   484         err = fs.Volume(volumeInfo, nInd);
   506         if (KErrNone == err)
   485         if (KErrNone == err)
   507         {
   486         {
   508             drivePresent[nInd] = ETrue;
   487             drivePresent[nInd] = ETrue;  // codescanner::accessArrayElementWithoutCheck2
   509             driveMediaId[nInd] = volumeInfo.iUniqueID;
   488             driveMediaId[nInd] = volumeInfo.iUniqueID;  // codescanner::accessArrayElementWithoutCheck2
   510             // If the media is not removable, media id is not checked
   489             // If the media is not removable, media id is not checked
   511             err2 = fs.Drive(driveInfo, nInd);
   490             err2 = fs.Drive(driveInfo, nInd);
   512             if (KErrNone != err2)
   491             if (KErrNone != err2)
   513             {
   492             {
   514                 ELOG1(EJavaCaptain,
   493                 ELOG1(EJavaCaptain,
   518             }
   497             }
   519             else
   498             else
   520             {
   499             {
   521                 if (!(driveInfo.iDriveAtt & KDriveAttRemovable))
   500                 if (!(driveInfo.iDriveAtt & KDriveAttRemovable))
   522                 {
   501                 {
   523                     driveMediaId[nInd] = 0;
   502                     driveMediaId[nInd] = 0;  // codescanner::accessArrayElementWithoutCheck2
   524                 }
   503                 }
   525             }
   504             }
   526         }
   505         }
   527         else if (KErrNotReady == err)
   506         else if (KErrNotReady == err)
   528         {
   507         {
   529             // no volume in this drive
   508             // no volume in this drive
   530             drivePresent[nInd] = EFalse;
   509             drivePresent[nInd] = EFalse;  // codescanner::accessArrayElementWithoutCheck2
   531             driveMediaId[nInd] = 0;
   510             driveMediaId[nInd] = 0;  // codescanner::accessArrayElementWithoutCheck2
   532         }
   511         }
   533         else
   512         else
   534         {
   513         {
   535             ELOG1(EJavaCaptain,
   514             ELOG1(EJavaCaptain,
   536                 "initializeScrPresenceInfoL: error (%d) when trying to get volume info",
   515                 "initializeScrPresenceInfoL: error (%d) when trying to get volume info",
   571             CleanupStack::PopAndDestroy(pEntry);
   550             CleanupStack::PopAndDestroy(pEntry);
   572             continue;
   551             continue;
   573         }
   552         }
   574 
   553 
   575         CIntPropertyEntry* pMediaIdProperty = (CIntPropertyEntry *)
   554         CIntPropertyEntry* pMediaIdProperty = (CIntPropertyEntry *)
   576             pScr->GetComponentPropertyL(componentIdList[nInd],_L("Media-Id"));
   555             pScr->GetComponentPropertyL(componentIdList[nInd], KMediaId);
   577         if (NULL == pMediaIdProperty)
   556         if (NULL == pMediaIdProperty)
   578         {
   557         {
   579             ELOG1(EJavaCaptain,
   558             ELOG1(EJavaCaptain,
   580                 "initializeScrPresenceInfoL: media_id property not found for component %d",
   559                 "initializeScrPresenceInfoL: media_id property not found for component %d",
   581                 componentIdList[nInd]);
   560                 componentIdList[nInd]);
   613             CleanupStack::PopAndDestroy(pMediaIdProperty);
   592             CleanupStack::PopAndDestroy(pMediaIdProperty);
   614             CleanupStack::PopAndDestroy(pEntry);
   593             CleanupStack::PopAndDestroy(pEntry);
   615             continue;
   594             continue;
   616         }
   595         }
   617 
   596 
   618         if (drivePresent[installationDrive])
   597         if (drivePresent[installationDrive])  // codescanner::accessArrayElementWithoutCheck2
   619         {
   598         {
   620             // Check also the media id
   599             // Check also the media id
   621             if (driveMediaId[installationDrive] == pMediaIdProperty->IntValue())
   600             if (driveMediaId[installationDrive] == pMediaIdProperty->IntValue())  // codescanner::accessArrayElementWithoutCheck2
   622             {
   601             {
   623                 LOG1(EJavaCaptain, EInfo,
   602                 LOG1(EJavaCaptain, EInfo,
   624                     "initializeScrPresenceInfoL: set component %d to present",
   603                     "initializeScrPresenceInfoL: set component %d to present",
   625                     componentIdList[nInd]);
   604                     componentIdList[nInd]);
   626 
   605 
   660 /**
   639 /**
   661  * Creates an instance of RSoftwareComponentRegistry and connects to it.
   640  * Creates an instance of RSoftwareComponentRegistry and connects to it.
   662  */
   641  */
   663 RSoftwareComponentRegistry *ScrUpdater::createScrL()
   642 RSoftwareComponentRegistry *ScrUpdater::createScrL()
   664 {
   643 {
   665     RSoftwareComponentRegistry *pScr = new RSoftwareComponentRegistry;
   644     RSoftwareComponentRegistry *pScr = new RSoftwareComponentRegistry;  // codescanner::nonleavenew
   666     if (NULL == pScr)
   645     if (NULL == pScr)
   667     {
   646     {
   668         ELOG(EJavaInstaller,
   647         ELOG(EJavaInstaller,
   669             "CreateScrL: Creating RSoftwareComponentRegistry failed");
   648             "CreateScrL: Creating RSoftwareComponentRegistry failed");
   670         User::Leave(KErrGeneral);
   649         User::Leave(KErrGeneral);