diff -r e5618cc85d74 -r 6c158198356e javamanager/javasettings/appmngrplugin/src/appmngr2midletappinfo.cpp --- a/javamanager/javasettings/appmngrplugin/src/appmngr2midletappinfo.cpp Thu Jul 15 18:31:06 2010 +0300 +++ b/javamanager/javasettings/appmngrplugin/src/appmngr2midletappinfo.cpp Thu Aug 19 09:48:13 2010 +0300 @@ -31,10 +31,12 @@ #include // TAppMngr2DRMUtils #include // CleanupResetAndDestroyPushL -#include // Midlet resource IDs +#include // RApaLsSession + +#include // Midlet resource IDs #include "appmngr2midletappinfo.h" // CAppMngr2MidletAppInfo #include "appmngr2midletruntime.h" // KAppMngr2MidletUid -#include "javaapplicationsettings.hrh" // Midlet command IDs +#include "javaapplicationsettings.hrh" // Midlet command IDs #include "appmngr2midletinfoiterator.h" // CAppMngr2MidletInfoIterator #include "appmngr2midletsettingsview.h" // CAppMngr2MidletSettingsView #include "appmngr2midletsettingshandler.h" // CAppMngr2MidletSettingsHandler @@ -189,8 +191,12 @@ CGulIcon* CAppMngr2MidletAppInfo::SpecificIconL() const { LOG(EJavaAppMngrPlugin, EInfo, "CAppMngr2MidletAppInfo::SpecificIconL"); - CGulIcon* icon = CGulIcon::NewL(iAppBitmap, iAppMask); - icon->SetBitmapsOwnedExternally(ETrue); + CGulIcon* icon = NULL; + if (iAppBitmap && iAppMask) + { + icon = CGulIcon::NewL(iAppBitmap, iAppMask); + icon->SetBitmapsOwnedExternally(ETrue); + } return icon; } @@ -243,7 +249,7 @@ void CAppMngr2MidletAppInfo::GetMenuItemsL( RPointerArray& aMenuCmds) { - LOG(EJavaAppMngrPlugin, EInfo, "CAppMngr2MidletAppInfo::GetMenuItemsL"); + LOG(EJavaAppMngrPlugin, EInfo, "+ CAppMngr2MidletAppInfo::GetMenuItemsL"); TInt resourceOffset = iResourceHandler.AddResourceFileL(); CEikMenuPaneItem::SData* menuItemData = new(ELeave) CEikMenuPaneItem::SData; CleanupStack::PushL(menuItemData); @@ -468,8 +474,7 @@ // const std::wstring CAppMngr2MidletAppInfo::SecurityDomainCategory() const { - LOG(EJavaAppMngrPlugin, EInfo, " + CAppMngr2MidletAppInfo::MidletSuiteSecurityDomainCategory "); - LOG(EJavaAppMngrPlugin, EInfo, " - CAppMngr2MidletAppInfo::MidletSuiteSecurityDomainCategory "); + LOG(EJavaAppMngrPlugin, EInfo, "CAppMngr2MidletAppInfo::MidletSuiteSecurityDomainCategory "); return iSecurityDomainCategory; } @@ -767,10 +772,14 @@ // MIDlet suite specific icons if (midletUids.Count() > 0) { - AknsUtils::CreateAppIconLC(AknsUtils::SkinInstance(), midletUids[ 0 ], - EAknsAppIconTypeList, iAppBitmap, iAppMask); - CleanupStack::Pop(2); // iAppBitmap, iAppMask + // Errors ignored so that the midlet is still displayed in the list with default icon. + TRAPD(err, GetAppIconL(midletUids[0])); + if (KErrNone != err) + { + ELOG1(EJavaAppMngrPlugin, "GetAppIconL error %d", err); + } } + CleanupStack::PopAndDestroy(&midletUids); // security domain @@ -925,7 +934,7 @@ CleanupStack::PopAndDestroy(urlParam); CleanupStack::PopAndDestroy(launcher); - LOG(EJavaAppMngrPlugin, EInfo, "+ CAppMngr2MidletAppInfo::ShowInfoUrlL"); + LOG(EJavaAppMngrPlugin, EInfo, "- CAppMngr2MidletAppInfo::ShowInfoUrlL"); } // --------------------------------------------------------------------------- @@ -985,3 +994,37 @@ iCertsRead = ETrue; LOG(EJavaAppMngrPlugin, EInfo, "- CAppMngr2MidletAppInfo::ReadCertificatesInfoL"); } + +void CAppMngr2MidletAppInfo::GetAppIconL(TUid aMidletUid) +{ + LOG(EJavaAppMngrPlugin, EInfo, "+ CAppMngr2MidletAppInfo::GetAppIconL"); + + ASSERT(!iAppBitmap); + ASSERT(!iAppMask); + + RApaLsSession lsSession; + User::LeaveIfError(lsSession.Connect()); + CleanupClosePushL(lsSession); + CApaMaskedBitmap* apaBmp = CApaMaskedBitmap::NewLC(); + + TSize size = static_cast(Runtime()).JavaRasterIconSize(); + TInt err = lsSession.GetAppIcon(aMidletUid, size, *apaBmp); + if (err == KErrNone) + { + iAppBitmap = new (ELeave) CFbsBitmap(); + iAppMask = new (ELeave) CFbsBitmap(); + User::LeaveIfError(iAppBitmap->Duplicate(apaBmp->Handle())); + User::LeaveIfError(iAppMask->Duplicate(apaBmp->Mask()->Handle())); + } + CleanupStack::PopAndDestroy(apaBmp); + CleanupStack::PopAndDestroy(&lsSession); + + if (!iAppBitmap) + { + AknsUtils::CreateAppIconLC(AknsUtils::SkinInstance(), aMidletUid, + EAknsAppIconTypeList, iAppBitmap, iAppMask); + CleanupStack::Pop(2); // iAppBitmap, iAppMask + } + + LOG(EJavaAppMngrPlugin, EInfo, "- CAppMngr2MidletAppInfo::GetAppIconL"); +}