66
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: Java MIDlet runtime type for AppMngr2
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include "appmngr2midletruntime.h" // CAppMngr2MidletRuntime
|
|
20 |
#include "appmngr2midletappinfo.h" // CAppMngr2MidletAppInfo
|
|
21 |
#include "appmngr2midletpackageinfo.h" // CAppMngr2MidletPackageInfo
|
|
22 |
#include "appmngr2midletpckginfofactory.h" // CAppMngr2MidletPckgInfoFactory
|
|
23 |
#include "appmngr2midletsettingsview.h" // KMidletSuiteSettingsViewId
|
|
24 |
#include "appmngr2recognizedfile.h" // CAppMngr2RecognizedFile
|
|
25 |
#include "appmngr2midletresourcehandler.h" // CAppMngr2MidletResourceHandler
|
|
26 |
|
|
27 |
#include <appmngr2midlet.mbg> // icon IDs
|
|
28 |
#include <appmngr2runtimeobserver.h> // MAppMngr2RuntimeObserver
|
|
29 |
|
|
30 |
#include <data_caging_path_literals.hrh> // KDC_APP_BITMAP_DIR
|
|
31 |
#include <AknIconArray.h> // CAknIconArray
|
|
32 |
#include <AknsUtils.h> // AknsUtils
|
|
33 |
#include <gulicon.h> // CGulIcon
|
|
34 |
#include <eikenv.h> // CEikonEnv
|
|
35 |
#include <SWInstDefs.h> // KJadMIMEType, KJarMIMEType
|
|
36 |
#include <aknViewAppUi.h> // CAknViewAppUi
|
|
37 |
#include <bldvariant.hrh>
|
|
38 |
|
|
39 |
#include "logger.h" // LOG
|
|
40 |
#include "iconsizeutils.h" // IconSizeUtils::GetIconSizes
|
|
41 |
|
|
42 |
// MIDlet icon file name
|
|
43 |
_LIT(KAppMngr2MidletIconFileNameMif, "AppMngr2Midlet.mif");
|
|
44 |
|
|
45 |
// ======== MEMBER FUNCTIONS ========
|
|
46 |
|
|
47 |
// ---------------------------------------------------------------------------
|
|
48 |
// CAppMngr2MidletRuntime::NewL()
|
|
49 |
// ---------------------------------------------------------------------------
|
|
50 |
//
|
|
51 |
CAppMngr2MidletRuntime* CAppMngr2MidletRuntime::NewL(
|
|
52 |
MAppMngr2RuntimeObserver& aObserver)
|
|
53 |
{
|
|
54 |
LOG(EJavaAppMngrPlugin, EInfo, " + CAppMngr2MidletRuntime::NewL ");
|
|
55 |
CAppMngr2MidletRuntime* self
|
|
56 |
= new(ELeave) CAppMngr2MidletRuntime(aObserver);
|
|
57 |
CleanupStack::PushL(self);
|
|
58 |
self->ConstructL();
|
|
59 |
CleanupStack::Pop(self);
|
|
60 |
LOG(EJavaAppMngrPlugin, EInfo, " - CAppMngr2MidletRuntime::NewL ");
|
|
61 |
|
|
62 |
return self;
|
|
63 |
}
|
|
64 |
|
|
65 |
// ---------------------------------------------------------------------------
|
|
66 |
// CAppMngr2MidletRuntime::~CAppMngr2MidletRuntime()
|
|
67 |
// ---------------------------------------------------------------------------
|
|
68 |
//
|
|
69 |
CAppMngr2MidletRuntime::~CAppMngr2MidletRuntime()
|
|
70 |
{
|
|
71 |
LOG(EJavaAppMngrPlugin, EInfo, " + CAppMngr2MidletRuntime::~CAppMngr2MidletRuntime ");
|
|
72 |
|
|
73 |
// MIDlet suite settings view must be removed and destroyed before
|
|
74 |
// MIDlet Runtime Plug-in is unloaded
|
|
75 |
CEikonEnv* eikonEnv = CEikonEnv::Static();
|
|
76 |
CAknViewAppUi* appUi = static_cast<CAknViewAppUi*>(eikonEnv->EikAppUi());
|
|
77 |
|
|
78 |
if (appUi)
|
|
79 |
{
|
|
80 |
appUi->RemoveView(KMidletSuiteSettingsViewId);
|
|
81 |
}
|
|
82 |
|
|
83 |
if (iPckgFactory)
|
|
84 |
{
|
|
85 |
delete iPckgFactory;
|
|
86 |
iPckgFactory = NULL;
|
|
87 |
}
|
|
88 |
|
|
89 |
if (iJavaRegistry)
|
|
90 |
{
|
|
91 |
delete iJavaRegistry;
|
|
92 |
iJavaRegistry = NULL;
|
|
93 |
}
|
|
94 |
if (iResourceHandler)
|
|
95 |
{
|
|
96 |
delete iResourceHandler;
|
|
97 |
iResourceHandler = NULL;
|
|
98 |
}
|
|
99 |
LOG(EJavaAppMngrPlugin, EInfo, " - CAppMngr2MidletRuntime::~CAppMngr2MidletRuntime ");
|
|
100 |
}
|
|
101 |
|
|
102 |
// ---------------------------------------------------------------------------
|
|
103 |
// CAppMngr2MidletRuntime::LoadIconsL()
|
|
104 |
// ---------------------------------------------------------------------------
|
|
105 |
//
|
|
106 |
void CAppMngr2MidletRuntime::LoadIconsL(CAknIconArray& aIconArray)
|
|
107 |
{
|
|
108 |
LOG(EJavaAppMngrPlugin, EInfo, " + CAppMngr2MidletRuntime::LoadIconsL ");
|
|
109 |
MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
|
|
110 |
HBufC* iconFilePath = NULL;
|
|
111 |
|
|
112 |
iconFilePath = FullBitmapFileNameLC(KAppMngr2MidletIconFileNameMif);
|
|
113 |
|
|
114 |
// Icon 0: qgn_menu_am_midlet
|
|
115 |
CGulIcon* icon = AknsUtils::CreateGulIconL(skinInstance,
|
|
116 |
KAknsIIDQgnMenuAmMidlet, *iconFilePath,
|
|
117 |
EMbmAppmngr2midletQgn_menu_am_midlet,
|
|
118 |
EMbmAppmngr2midletQgn_menu_am_midlet_mask);
|
|
119 |
CleanupStack::PushL(icon);
|
|
120 |
aIconArray.AppendL(icon);
|
|
121 |
CleanupStack::Pop(icon);
|
|
122 |
|
|
123 |
// Icon 1: qgn_prop_drm_exp_large
|
|
124 |
icon = AknsUtils::CreateGulIconL(skinInstance,
|
|
125 |
KAknsIIDQgnPropDrmRightsExpLarge, *iconFilePath,
|
|
126 |
EMbmAppmngr2midletQgn_prop_drm_exp_large,
|
|
127 |
EMbmAppmngr2midletQgn_prop_drm_exp_large_mask);
|
|
128 |
CleanupStack::PushL(icon);
|
|
129 |
aIconArray.AppendL(icon);
|
|
130 |
CleanupStack::Pop(icon);
|
|
131 |
|
|
132 |
CleanupStack::PopAndDestroy(iconFilePath);
|
|
133 |
LOG(EJavaAppMngrPlugin, EInfo, " - CAppMngr2MidletRuntime::LoadIconsL ");
|
|
134 |
}
|
|
135 |
|
|
136 |
// ---------------------------------------------------------------------------
|
|
137 |
// CAppMngr2MidletRuntime::GetSupportedDataTypesL()
|
|
138 |
// ---------------------------------------------------------------------------
|
|
139 |
//
|
|
140 |
void CAppMngr2MidletRuntime::GetSupportedDataTypesL(
|
|
141 |
CDataTypeArray& aDataTypeArray)
|
|
142 |
{
|
|
143 |
LOG(EJavaAppMngrPlugin, EInfo, " + CAppMngr2MidletRuntime::GetSupportedDataTypesL ");
|
|
144 |
TDataType jarFile(SwiUI::KJarMIMEType);
|
|
145 |
aDataTypeArray.AppendL(jarFile);
|
|
146 |
|
|
147 |
TDataType jadFile(SwiUI::KJadMIMEType);
|
|
148 |
aDataTypeArray.AppendL(jadFile);
|
|
149 |
LOG(EJavaAppMngrPlugin, EInfo, " - CAppMngr2MidletRuntime::GetSupportedDataTypesL ");
|
|
150 |
}
|
|
151 |
|
|
152 |
// ---------------------------------------------------------------------------
|
|
153 |
// CAppMngr2MidletRuntime::GetInstallationFilesL()
|
|
154 |
// ---------------------------------------------------------------------------
|
|
155 |
//
|
|
156 |
void CAppMngr2MidletRuntime::GetInstallationFilesL(
|
|
157 |
RPointerArray<CAppMngr2PackageInfo>& aPackageInfos,
|
|
158 |
const RPointerArray<CAppMngr2RecognizedFile>& aFileList,
|
|
159 |
RFs& aFsSession,
|
|
160 |
TRequestStatus& aStatus)
|
|
161 |
{
|
|
162 |
LOG(EJavaAppMngrPlugin, EInfo, " + CAppMngr2MidletRuntime::GetInstallationFilesL ");
|
|
163 |
|
|
164 |
if (!iPckgFactory)
|
|
165 |
{
|
|
166 |
iPckgFactory = CAppMngr2MidletPckgInfoFactory::NewL(*this, aFsSession, *iResourceHandler);
|
|
167 |
}
|
|
168 |
|
|
169 |
iPckgFactory->GetInstallationFilesL(aPackageInfos, aFileList,
|
|
170 |
aStatus);
|
|
171 |
LOG(EJavaAppMngrPlugin, EInfo, " - CAppMngr2MidletRuntime::GetInstallationFilesL ");
|
|
172 |
}
|
|
173 |
|
|
174 |
|
|
175 |
// ---------------------------------------------------------------------------
|
|
176 |
// CAppMngr2MidletRuntime::CancelGetInstallationFiles()
|
|
177 |
// ---------------------------------------------------------------------------
|
|
178 |
//
|
|
179 |
void CAppMngr2MidletRuntime::CancelGetInstallationFiles()
|
|
180 |
{
|
|
181 |
LOG(EJavaAppMngrPlugin, EInfo, " + CAppMngr2MidletRuntime::CancelGetInstallationFiles ");
|
|
182 |
if (iPckgFactory)
|
|
183 |
{
|
|
184 |
iPckgFactory->Cancel();
|
|
185 |
}
|
|
186 |
}
|
|
187 |
|
|
188 |
// ---------------------------------------------------------------------------
|
|
189 |
// CAppMngr2MidletRuntime::GetInstalledAppsL()
|
|
190 |
// ---------------------------------------------------------------------------
|
|
191 |
//
|
|
192 |
void CAppMngr2MidletRuntime::GetInstalledAppsL(
|
|
193 |
RPointerArray<CAppMngr2AppInfo>& aApps,
|
|
194 |
RFs& aFsSession, TRequestStatus& aStatus)
|
|
195 |
{
|
|
196 |
LOG(EJavaAppMngrPlugin, EInfo, " + CAppMngr2MidletRuntime::GetInstalledAppsL ");
|
|
197 |
RArray<TUid> uids;
|
|
198 |
CleanupClosePushL(uids);
|
|
199 |
|
|
200 |
iJavaRegistry->GetRegistryEntryUidsL(Java::EGeneralPackage, uids);
|
|
201 |
for (TInt index = 0; index < uids.Count(); index++)
|
|
202 |
{
|
|
203 |
Java::CJavaRegistryPackageEntry* entry
|
|
204 |
= (Java::CJavaRegistryPackageEntry*)
|
|
205 |
iJavaRegistry->RegistryEntryL(uids[index]);
|
|
206 |
|
|
207 |
//CleanupStack::PushL(entry);
|
|
208 |
// Entry ownership is taken.
|
|
209 |
GetInstalledAppL(aApps, aFsSession, entry);
|
|
210 |
|
|
211 |
//CleanupStack::Pop(aEntry);
|
|
212 |
}
|
|
213 |
|
|
214 |
CleanupStack::PopAndDestroy(&uids);
|
|
215 |
|
|
216 |
TRequestStatus* status = &aStatus;
|
|
217 |
User::RequestComplete(status, KErrNone);
|
|
218 |
|
|
219 |
LOG(EJavaAppMngrPlugin, EInfo, " - CAppMngr2MidletRuntime::GetInstalledAppsL ");
|
|
220 |
}
|
|
221 |
|
|
222 |
// ---------------------------------------------------------------------------
|
|
223 |
// CAppMngr2MidletRuntime::CancelGetInstalledApps()
|
|
224 |
// ---------------------------------------------------------------------------
|
|
225 |
//
|
|
226 |
void CAppMngr2MidletRuntime::CancelGetInstalledApps()
|
|
227 |
{
|
|
228 |
LOG(EJavaAppMngrPlugin, EInfo, " CAppMngr2MidletRuntime::CancelGetInstalledApps ");
|
|
229 |
// Implementation of GetInstalledAppsL in synchronous, therefore there is no
|
|
230 |
// need to cancel operation.
|
|
231 |
}
|
|
232 |
|
|
233 |
// ---------------------------------------------------------------------------
|
|
234 |
// CAppMngr2MidletRuntime::GetInstalledAppL()
|
|
235 |
// ---------------------------------------------------------------------------
|
|
236 |
//
|
|
237 |
void CAppMngr2MidletRuntime::GetInstalledAppL(
|
|
238 |
RPointerArray<CAppMngr2AppInfo>& aApps,
|
|
239 |
RFs& aFsSession,
|
|
240 |
Java::CJavaRegistryPackageEntry* aEntry)
|
|
241 |
{
|
|
242 |
LOG(EJavaAppMngrPlugin, EInfo, " + CAppMngr2MidletRuntime::GetInstalledAppL ");
|
|
243 |
|
|
244 |
// Entry ownership is taken and it must be set to CleanupStack
|
|
245 |
// to avoid double deletion.
|
|
246 |
CAppMngr2MidletAppInfo* appInfo = CAppMngr2MidletAppInfo::NewLC(
|
|
247 |
*this, aEntry, aFsSession, *iResourceHandler);
|
|
248 |
//CleanupStack::Pop(aEntry);
|
|
249 |
|
|
250 |
aApps.AppendL(appInfo); // takes ownership
|
|
251 |
CleanupStack::Pop(appInfo);
|
|
252 |
|
|
253 |
LOG(EJavaAppMngrPlugin, EInfo, " - CAppMngr2MidletRuntime::GetInstalledAppL ");
|
|
254 |
}
|
|
255 |
|
|
256 |
// ---------------------------------------------------------------------------
|
|
257 |
// CAppMngr2MidletRuntime::CAppMngr2MidletRuntime()
|
|
258 |
// ---------------------------------------------------------------------------
|
|
259 |
//
|
|
260 |
CAppMngr2MidletRuntime::CAppMngr2MidletRuntime(
|
|
261 |
MAppMngr2RuntimeObserver& aObserver) : CAppMngr2Runtime(aObserver)
|
|
262 |
{
|
|
263 |
}
|
|
264 |
|
|
265 |
// ---------------------------------------------------------------------------
|
|
266 |
// CAppMngr2MidletRuntime::ConstructL()
|
|
267 |
// ---------------------------------------------------------------------------
|
|
268 |
//
|
|
269 |
void CAppMngr2MidletRuntime::ConstructL()
|
|
270 |
{
|
|
271 |
LOG(EJavaAppMngrPlugin, EInfo, " + CAppMngr2MidletRuntime::ConstructL ");
|
|
272 |
iJavaRegistry = Java::CJavaRegistry::NewL();
|
|
273 |
iResourceHandler = CAppMngr2MidletResourceHandler::NewL();
|
|
274 |
iJavaRasterIconSize = IconSizeUtils::GetIconSizes().iAppMgrIconSize;
|
|
275 |
ILOG2(EJavaAppMngrPlugin, "Java icon size (%d, %d)",
|
|
276 |
iJavaRasterIconSize.iWidth, iJavaRasterIconSize.iHeight);
|
|
277 |
LOG(EJavaAppMngrPlugin, EInfo, " - CAppMngr2MidletRuntime::ConstructL ");
|
|
278 |
}
|