47
|
1 |
/*
|
|
2 |
* Copyright (c) 2000 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: Implementation of applicationmanagement components
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#define __INCLUDE_CAPABILITY_NAMES__
|
|
19 |
#include <e32svr.h>
|
|
20 |
#include <badesca.h>
|
|
21 |
#include <e32cmn.h>
|
|
22 |
#include <bautils.h>
|
|
23 |
#include <featmgr.h>
|
|
24 |
#include <imcvcodc.h>
|
|
25 |
#include <uikon.hrh>
|
|
26 |
#include <e32property.h>
|
52
|
27 |
#include <driveinfo.h>
|
47
|
28 |
#include <SWInstDefs.h>
|
|
29 |
#include <PolicyEngineClient.h>
|
|
30 |
#include <PolicyEngineXACML.h>
|
|
31 |
#include <eikenv.h>
|
|
32 |
#include <hbapplication.h>
|
|
33 |
#include <apgwgnam.h>
|
|
34 |
#include <nsmldmconst.h>
|
|
35 |
#include <DevManInternalCRKeys.h>
|
|
36 |
#include <apgtask.h>
|
|
37 |
#include <apgwgnam.h>
|
|
38 |
#include "ampskeys.h"
|
|
39 |
#include "amprivateCRKeys.h"
|
|
40 |
#include "ApplicationManagementConst.h"
|
|
41 |
#include "ApplicationManagementCommon.h"
|
|
42 |
#include "ApplicationManagementClientServer.h"
|
|
43 |
#include "ApplicationManagementServer.h"
|
|
44 |
#include "AMDeploymentComponent.h"
|
|
45 |
#include "amsmlhelper.h"
|
|
46 |
#include "ApplicationManagementUtility.h"
|
|
47 |
#include "ApplicationManagementUtilityFactory.h"
|
|
48 |
#include "debug.h"
|
|
49 |
#include "coemain.h"
|
|
50 |
#include "AMPreInstallApp.h"
|
|
51 |
#include "amview.h"
|
|
52 |
#include "appmgmtnotifier.h"
|
|
53 |
|
|
54 |
using namespace NApplicationManagement;
|
|
55 |
|
|
56 |
#ifdef __AM_CONNECT_INSTALLER_ONSTARTUP_
|
|
57 |
|
|
58 |
#pragma message("AM Connecting installer at startup")
|
|
59 |
#else
|
|
60 |
#pragma message("AM Connecting installer when needed")
|
|
61 |
#endif
|
|
62 |
// Needed only for jad+jar installation
|
|
63 |
_LIT( KInstallDir, "c:\\temp\\" );
|
|
64 |
_LIT8(KMIDletJarURL, "MIDlet-Jar-URL");
|
|
65 |
//OMA SCOMO Specific
|
|
66 |
_LIT8(KDownloadState, "./SCOMO/Download/");
|
|
67 |
_LIT8(KDeliveredState, "./SCOMO/Inventory/Delivered/");
|
|
68 |
_LIT8(KDeployedState, "./SCOMO/Inventory/Deployed/");
|
|
69 |
|
|
70 |
//Package all the above together into a policy
|
|
71 |
CPolicyServer::TPolicy KApplicationManagementSecurityPolicy;
|
|
72 |
|
|
73 |
// ------------------------------------------------------------------------------------------------
|
|
74 |
// CApplicationManagementServer::ComponentDownloadComplete()
|
|
75 |
// ------------------------------------------------------------------------------------------------
|
|
76 |
void CApplicationManagementServer::ComponentDownloadComplete(
|
|
77 |
CDeploymentComponent *aComponent, TInt iapid, HBufC8 *aServerId)
|
|
78 |
{
|
|
79 |
TInt err = KErrNone;
|
|
80 |
TRAP( err, DownloadCompleteL( aComponent, iapid, aServerId ));
|
|
81 |
}
|
|
82 |
|
|
83 |
// ------------------------------------------------------------------------------------------------
|
|
84 |
// CApplicationManagementServer::DownloadCompleteL()
|
|
85 |
// ------------------------------------------------------------------------------------------------
|
|
86 |
|
|
87 |
void CApplicationManagementServer::DownloadCompleteL(
|
|
88 |
CDeploymentComponent *aComponent, TInt iapid, HBufC8 *aServerId)
|
|
89 |
{
|
|
90 |
RDEBUG( "ApplicationManagementServer DownloadComplete - start" );
|
|
91 |
__ASSERT_DEBUG( aComponent, User::Invariant() );
|
|
92 |
iComp = aComponent;
|
|
93 |
iStorage->UpdateL(*aComponent);
|
|
94 |
TInt errdownload = KErrNone;
|
|
95 |
TInt errInstall = KErrNone;
|
|
96 |
TInt status = KStatusSuccess;
|
|
97 |
|
|
98 |
if (!aComponent->DownloadFailed())
|
|
99 |
{
|
|
100 |
CDeploymentComponent *old = DoDataUpdateCheckL(*aComponent);
|
|
101 |
TDownloadTarget trgt = aComponent->DownloadTarget();
|
|
102 |
switch (trgt)
|
|
103 |
{
|
|
104 |
case EDeliver:
|
|
105 |
{
|
|
106 |
break;
|
|
107 |
}
|
|
108 |
case EInstall:
|
|
109 |
case EInstallAndActivate:
|
|
110 |
{
|
|
111 |
|
|
112 |
TRAP(errInstall,DoTheInstallL( *aComponent));
|
|
113 |
RDEBUG_2( "ApplicationManagementServer DownloadComplete - start %d", errInstall);
|
|
114 |
|
|
115 |
if (trgt == EInstall && errInstall == KErrNone)
|
|
116 |
{
|
|
117 |
iStorage->DeactivateL(*aComponent);
|
|
118 |
}
|
|
119 |
break;
|
|
120 |
}
|
|
121 |
|
|
122 |
case EUpdate:
|
|
123 |
case EUpdateAndActivate:
|
|
124 |
{
|
|
125 |
if (old)
|
|
126 |
{
|
|
127 |
FullUpdateL(*aComponent, *old);
|
|
128 |
if (trgt == EUpdate)
|
|
129 |
{
|
|
130 |
iStorage->DeactivateL(*aComponent);
|
|
131 |
}
|
|
132 |
}
|
|
133 |
break;
|
|
134 |
}
|
|
135 |
default:
|
|
136 |
{
|
|
137 |
break;
|
|
138 |
}
|
|
139 |
}
|
|
140 |
}
|
|
141 |
else
|
|
142 |
{
|
|
143 |
errdownload = aComponent->DownloadStatus();
|
|
144 |
}
|
|
145 |
|
|
146 |
RDEBUG( "ApplicationManagementServer DownloadComplete - Start Send to background" );
|
|
147 |
//Download Completed/ Failed or installation success/ failure Send server to Background.
|
|
148 |
|
|
149 |
iOMASCOMOEnabled = IsOMASCOMOEnabledL();
|
|
150 |
|
|
151 |
m_Window->lower();
|
|
152 |
|
|
153 |
if (iOMASCOMOEnabled)
|
|
154 |
{
|
|
155 |
status = GetErrorStatus(errdownload, errInstall);
|
|
156 |
|
|
157 |
TInt ASyncSupported = -1;
|
|
158 |
|
|
159 |
CRepository *repository = CRepository::NewLC(
|
|
160 |
KUidPSApplicationManagementKeys);
|
|
161 |
repository->Get(KAsyncEnabled, ASyncSupported);
|
|
162 |
CleanupStack::PopAndDestroy();
|
|
163 |
|
|
164 |
// For Sync Reporting
|
|
165 |
if (!ASyncSupported)
|
|
166 |
{
|
|
167 |
// Update Central Repository with proper error code for Sync
|
|
168 |
|
|
169 |
CRepository *repository = CRepository::NewLC(
|
|
170 |
KUidPSApplicationManagementKeys);
|
|
171 |
repository->Set(KAMSyncStatus, status);
|
|
172 |
CleanupStack::PopAndDestroy();
|
|
173 |
|
|
174 |
RProperty counter;
|
|
175 |
|
|
176 |
TInt r = counter.Attach(KUidPSApplicationManagementKeys,
|
|
177 |
KSyncNotifier, EOwnerThread);
|
|
178 |
User::LeaveIfError(r);
|
|
179 |
|
|
180 |
TInt err = counter.Set(KErrCancel);
|
|
181 |
User::LeaveIfError(err);
|
|
182 |
counter.Close();
|
|
183 |
}
|
|
184 |
else// Do AsyncReporting
|
|
185 |
{
|
|
186 |
|
|
187 |
RDEBUG( "CApplicationManagementServer::ASync Reporting Step 1" );
|
|
188 |
|
|
189 |
// Get deployement component entries
|
|
190 |
TInt internalid = aComponent->InternalId();
|
|
191 |
|
|
192 |
RDEBUG( "CApplicationManagementServer::ASync Reporting Step 2" );
|
|
193 |
|
|
194 |
TBuf8<256> targetURI;
|
|
195 |
|
|
196 |
TDeploymentComponentState state = aComponent->State();
|
|
197 |
|
|
198 |
RDEBUG( "CApplicationManagementServer::ASync Reporting Step 3" );
|
|
199 |
|
|
200 |
if (state == EDCSDownload)
|
|
201 |
{
|
|
202 |
|
|
203 |
RDEBUG( "CApplicationManagementServer::ASync EDCSDownload Start" );
|
|
204 |
|
|
205 |
targetURI.Append(KDownloadState);
|
|
206 |
targetURI.Append(aComponent->UserId());
|
|
207 |
|
|
208 |
RDEBUG( "CApplicationManagementServer::ASync EDCSDownload End" );
|
|
209 |
|
|
210 |
}
|
|
211 |
else if (state == EDCSDelivered)
|
|
212 |
{
|
|
213 |
RDEBUG( "CApplicationManagementServer::ASync EDCSDelivered Start" );
|
|
214 |
|
|
215 |
targetURI.Append(KDeliveredState);
|
|
216 |
targetURI.Append(aComponent->UserId());
|
|
217 |
|
|
218 |
RDEBUG( "CApplicationManagementServer::ASync EDCSDelivered End" );
|
|
219 |
|
|
220 |
}
|
|
221 |
else if (state == EDCSActive || state == EDCSInactive)
|
|
222 |
{
|
|
223 |
|
|
224 |
RDEBUG( "CApplicationManagementServer::ASync EDCSActive Start" );
|
|
225 |
|
|
226 |
targetURI.Append(KDeployedState);
|
|
227 |
targetURI.Append(aComponent->UserId());
|
|
228 |
|
|
229 |
RDEBUG( "CApplicationManagementServer::ASync EDCSActive End" );
|
|
230 |
}
|
|
231 |
|
|
232 |
//Save Entry to database with status and target URI of deployment component
|
|
233 |
TInt iapidval = 2;
|
|
234 |
TRAPD( err1, SmlHelper::GetDefaultIAPFromDMProfileL( iapid ) );
|
|
235 |
if (err1 == KErrNone)
|
|
236 |
{
|
|
237 |
RDEBUG_2("Application Mgmt Server service::DownloadCompleteL iapid to : %d", iapid );
|
|
238 |
}
|
|
239 |
|
|
240 |
TInt index;
|
|
241 |
iAMServerDB->SaveToDatabaseL(index, internalid, status,
|
|
242 |
targetURI, iapidval);
|
|
243 |
|
|
244 |
RDEBUG( "CApplicationManagementServer::ASync SaveToDatabaseL completed" );
|
|
245 |
|
|
246 |
EnableDMNetworkMonL(iapid, aServerId);
|
|
247 |
}
|
|
248 |
}
|
|
249 |
int value = 0 ;
|
|
250 |
int err = RProperty::Set(TUid::Uid(KOmaDMAppUid), KDownloadActive, value);
|
|
251 |
RDEBUG_2("RProperty set (%d)", err );
|
|
252 |
if (iDownloadMngr->DownloadCount() == 0)
|
|
253 |
{
|
|
254 |
|
|
255 |
RDEBUG_2( "CApplicationManagementServer::ConstructL - ERROR leaving cannot connect installer: %d", iSessionCount );
|
|
256 |
|
|
257 |
// Is session count is not modified whenever there is error then at the end of download complete decrement
|
|
258 |
// the session count.
|
|
259 |
|
|
260 |
if (status != KStatusSuccess && iSessionCount != 0)
|
|
261 |
{
|
|
262 |
iSessionCount--;
|
|
263 |
}
|
|
264 |
|
|
265 |
if (iSessionCount == 0)
|
|
266 |
{
|
|
267 |
iShutdown.Start();
|
|
268 |
}
|
|
269 |
}
|
|
270 |
aComponent->SetDriveSelectionStatus(false);
|
|
271 |
RDEBUG( "ApplicationManagementServer DownloadComplete - end" );
|
|
272 |
}
|
|
273 |
|
|
274 |
void CApplicationManagementServer::InstallationCancelled()
|
|
275 |
{
|
|
276 |
iInstaller.CancelOperation();
|
|
277 |
}
|
|
278 |
// ------------------------------------------------------------------------------------------------
|
|
279 |
// CApplicationManagementServer::IsOMASCOMOEnabledL()
|
|
280 |
// ------------------------------------------------------------------------------------------------
|
|
281 |
|
|
282 |
TBool CApplicationManagementServer::IsOMASCOMOEnabledL()
|
|
283 |
{
|
|
284 |
RDEBUG( "CApplicationManagementServer::IsOMASCOMOEnabledL Start" );
|
|
285 |
|
|
286 |
TInt adapterValue;
|
|
287 |
|
|
288 |
CRepository *repository = CRepository::NewLC(
|
|
289 |
KCRUidPrivateApplicationManagementKeys);
|
|
290 |
repository->Get(KAMAdapterValue, adapterValue);
|
|
291 |
CleanupStack::PopAndDestroy();
|
|
292 |
|
|
293 |
RDEBUG( "CApplicationManagementServer::IsOMASCOMOEnabledL End" );
|
|
294 |
|
|
295 |
if (adapterValue == 0 || adapterValue == 1)
|
|
296 |
return EFalse;
|
|
297 |
else
|
|
298 |
return ETrue;
|
|
299 |
}
|
|
300 |
|
|
301 |
// ------------------------------------------------------------------------------------------------
|
|
302 |
// CApplicationManagementServer::GetErrorStatus()
|
|
303 |
// ------------------------------------------------------------------------------------------------
|
|
304 |
TInt CApplicationManagementServer::GetErrorStatus(TInt aErrorDownload,
|
|
305 |
TInt aErrorInstall)
|
|
306 |
{
|
|
307 |
TInt status = KStatusSuccess;
|
|
308 |
|
|
309 |
if (aErrorDownload != KErrNone)
|
|
310 |
{
|
|
311 |
if (aErrorDownload == KStatusUserCancelled || aErrorDownload
|
|
312 |
== KStatusDowloadFailedOOM || aErrorDownload
|
|
313 |
== KStatusUnSupportedEnvironment || aErrorDownload
|
|
314 |
== KStatusAlternateDownldAuthFail || aErrorDownload
|
|
315 |
== KStatusAltDowldUnavailable)
|
|
316 |
{
|
|
317 |
status = aErrorDownload;
|
|
318 |
}
|
|
319 |
else
|
|
320 |
status = KStatusDownloadFailed;
|
|
321 |
}
|
|
322 |
|
|
323 |
else if (aErrorInstall != KErrNone)
|
|
324 |
{
|
|
325 |
if (aErrorInstall == SwiUI::KSWInstErrSecurityFailure)
|
|
326 |
status = KStatusPkgValidationFailed;
|
|
327 |
if (aErrorInstall == SwiUI::KSWInstErrInsufficientMemory)
|
|
328 |
status = KStatusInstallFailedOOM;
|
|
329 |
if (aErrorInstall == KStatusUserCancelled)
|
|
330 |
status = KStatusUserCancelled;
|
|
331 |
else
|
|
332 |
status = KStatusInstallFailed;
|
|
333 |
|
|
334 |
}
|
|
335 |
|
|
336 |
return status;
|
|
337 |
|
|
338 |
}
|
|
339 |
|
|
340 |
// ------------------------------------------------------------------------------------------------
|
|
341 |
// CApplicationManagementServer::EnableDMNetworkMonL()
|
|
342 |
// ------------------------------------------------------------------------------------------------
|
|
343 |
void CApplicationManagementServer::EnableDMNetworkMonL(TInt iapid,
|
|
344 |
HBufC8 *aServerId)
|
|
345 |
{
|
|
346 |
TInt retryenabled = 1;
|
|
347 |
_LIT( KNetMon,"\\dmnetworkmon.exe" );
|
|
348 |
|
|
349 |
// Enable DM Network Monitoring for retry of Generic alert in case of N/W loss
|
|
350 |
|
|
351 |
CRepository *repository = CRepository::NewLC(
|
|
352 |
KCRUidDeviceManagementInternalKeys);
|
|
353 |
TInt err_val = repository->Set(KDevManEnableDMNetworkMon, retryenabled);
|
|
354 |
RDEBUG_2( "CApplicationManagementServer::EnableDMNetworkMonL Retry enabled err: %d", err_val );
|
|
355 |
RDEBUG_2( "CApplicationManagementServer::EnableDMNetworkMonL Retry enabled value: %d", retryenabled );
|
|
356 |
|
|
357 |
err_val = repository->Set(KDevManIapIdKey, iapid);
|
|
358 |
RDEBUG_2( "CApplicationManagementServer::EnableDMNetworkMonL devmaniapid: %d", err_val );
|
|
359 |
RDEBUG_2( "CApplicationManagementServer::EnableDMNetworkMonL iap id: %d", iapid );
|
|
360 |
|
|
361 |
err_val = repository->Set(KDevManServerIdKey, *aServerId);
|
|
362 |
RDEBUG_2( "CApplicationManagementServer::EnableDMNetworkMonL serveridkey: %d", err_val );
|
|
363 |
|
|
364 |
TBuf<256> buf1;
|
|
365 |
buf1.Copy(*aServerId);
|
|
366 |
RDEBUG_2( "Server ID - '%S'", &buf1);
|
|
367 |
|
|
368 |
CleanupStack::PopAndDestroy();
|
|
369 |
|
|
370 |
// create NetMon EXE
|
|
371 |
RProcess rp;
|
|
372 |
TInt err = rp.Create(KNetMon, KNullDesC);
|
|
373 |
User::LeaveIfError(err);
|
|
374 |
TRequestStatus stat;
|
|
375 |
rp.Rendezvous(stat);
|
|
376 |
|
|
377 |
if (stat != KRequestPending)
|
|
378 |
rp.Kill(0); // abort startup
|
|
379 |
else
|
|
380 |
rp.Resume(); // logon OK - start the server
|
|
381 |
TInt r = (rp.ExitType() == EExitPanic) ? KErrGeneral : stat.Int();
|
|
382 |
rp.Close();
|
|
383 |
|
|
384 |
}
|
|
385 |
|
|
386 |
// ------------------------------------------------------------------------------------------------
|
|
387 |
// CApplicationManagementServer::CApplicationManagementServer
|
|
388 |
// ------------------------------------------------------------------------------------------------
|
|
389 |
|
|
390 |
inline CApplicationManagementServer::CApplicationManagementServer() :
|
|
391 |
CPolicyServer(0, KApplicationManagementSecurityPolicy, ESharableSessions)
|
|
392 |
{
|
|
393 |
}
|
|
394 |
|
|
395 |
// ------------------------------------------------------------------------------------------------
|
|
396 |
// CApplicationManagementServer::AddSession()
|
|
397 |
// ------------------------------------------------------------------------------------------------
|
|
398 |
|
|
399 |
void CApplicationManagementServer::AddSession()
|
|
400 |
{
|
|
401 |
// A new session is being created
|
|
402 |
RDEBUG( "ApplicationManagementServer: CApplicationManagementServer::AddSession" );
|
|
403 |
++iSessionCount;
|
|
404 |
|
|
405 |
// Cancel the shutdown timer if it was running
|
|
406 |
iShutdown.Cancel();
|
|
407 |
}
|
|
408 |
|
|
409 |
// ------------------------------------------------------------------------------------------------
|
|
410 |
// CApplicationManagementServer::DropSession()
|
|
411 |
// ------------------------------------------------------------------------------------------------
|
|
412 |
|
|
413 |
void CApplicationManagementServer::DropSession()
|
|
414 |
{
|
|
415 |
// A session is being destroyed
|
|
416 |
RDEBUG( "ApplicationManagementServer: CApplicationManagementServer::DropSession" );
|
|
417 |
|
|
418 |
// Start the shutdown timer if it is the last session
|
|
419 |
if (--iSessionCount == 0)
|
|
420 |
{
|
|
421 |
if (iDownloadMngr->DownloadCount() > 0)
|
|
422 |
{
|
|
423 |
RDEBUG( "ApplicationManagementServer: CApplicationManagementServer::DropSession download in progress" );
|
|
424 |
}
|
|
425 |
else
|
|
426 |
{
|
|
427 |
iShutdown.Start();
|
|
428 |
}
|
|
429 |
}
|
|
430 |
}
|
|
431 |
|
|
432 |
// -----------------------------------------------------------------------------------------------------------
|
|
433 |
// CApplicationManagementServer::AddDownloadL( CDeploymentComponent *aComponent )
|
|
434 |
// -----------------------------------------------------------------------------------------------------------
|
|
435 |
|
|
436 |
void CApplicationManagementServer::AddDownloadL(
|
|
437 |
CDeploymentComponent *aComponent)
|
|
438 |
{
|
|
439 |
__ASSERT_DEBUG( aComponent, User::Invariant() );
|
|
440 |
|
|
441 |
RDEBUG( "CApplicationManagementServer::AddDownloadL Start" );
|
|
442 |
|
|
443 |
iDownloadMngr->AddDownloadL(aComponent);
|
|
444 |
|
|
445 |
RDEBUG( "CApplicationManagementServer::AddDownloadL End" );
|
|
446 |
}
|
|
447 |
|
|
448 |
// ------------------------------------------------------------------------------------------------
|
|
449 |
// CApplicationManagementServer
|
|
450 |
// -----------------------------------------------------------------------------
|
|
451 |
|
|
452 |
CServer2* CApplicationManagementServer::NewL(HbMainWindow *mainWindow)
|
|
453 |
{
|
|
454 |
//specifies all connect attempts should pass
|
|
455 |
KApplicationManagementSecurityPolicy.iOnConnect
|
|
456 |
= CPolicyServer::EAlwaysPass;
|
|
457 |
KApplicationManagementSecurityPolicy.iRangeCount
|
|
458 |
= KApplicationManagementRangeCount; //number of ranges
|
|
459 |
KApplicationManagementSecurityPolicy.iRanges
|
|
460 |
= KApplicationManagementRanges;
|
|
461 |
KApplicationManagementSecurityPolicy.iElementsIndex
|
|
462 |
= KApplicationManagementSecurityElementsIndex;
|
|
463 |
KApplicationManagementSecurityPolicy.iElements
|
|
464 |
= KApplicationManagementSecurityElements;
|
|
465 |
|
|
466 |
RDEBUG( "ApplicationManagementServer: CApplicationManagementServer::NewLC" );
|
|
467 |
|
|
468 |
CApplicationManagementServer* self =
|
|
469 |
new (ELeave) CApplicationManagementServer;
|
|
470 |
CleanupStack::PushL(self);
|
|
471 |
|
|
472 |
self->ConstructL(mainWindow);
|
|
473 |
CleanupStack::Pop();
|
|
474 |
return self;
|
|
475 |
|
|
476 |
}
|
|
477 |
|
|
478 |
// -----------------------------------------------------------------------------
|
|
479 |
// CApplicationManagementServer::~CApplicationManagementServer
|
|
480 |
// ------------------------------------------------------------------------------------------------
|
|
481 |
|
|
482 |
CApplicationManagementServer::~CApplicationManagementServer()
|
|
483 |
{
|
|
484 |
RDEBUG_3("CApplicationManagementServer::~CApplicationManagementServer 0x%X - 0x%X", reinterpret_cast<TUint>(this ),
|
|
485 |
reinterpret_cast<TUint>(this)+sizeof( CApplicationManagementServer ) );
|
|
486 |
FeatureManager::UnInitializeLib();
|
|
487 |
iInstaller.Close();
|
|
488 |
delete iStorage;
|
|
489 |
|
|
490 |
delete iUtility;
|
|
491 |
delete iAMServerDB;
|
|
492 |
|
|
493 |
RProperty::Delete(KUidPSApplicationManagementKeys, KAMServerUIEnabled);
|
|
494 |
|
|
495 |
RProperty::Delete(KUidPSApplicationManagementKeys, KAMOperationNonSilent);
|
|
496 |
|
|
497 |
RProperty::Delete(KUidPSApplicationManagementKeys, KSyncNotifier);
|
|
498 |
|
|
499 |
RProperty::Delete(KUidPSApplicationManagementKeys, KDMUINotClosed);
|
|
500 |
|
|
501 |
iInstallFile.Close();
|
|
502 |
iInstallRFs.Close();
|
|
503 |
|
|
504 |
delete iDownloadMngr;
|
|
505 |
|
|
506 |
}
|
|
507 |
|
|
508 |
// ------------------------------------------------------------------------------------------------
|
|
509 |
// CApplicationManagementServer::HandleAllClientsClosed
|
|
510 |
// ------------------------------------------------------------------------------------------------
|
|
511 |
void CApplicationManagementServer::HandleAllClientsClosed()
|
|
512 |
{
|
|
513 |
// Do Nothing
|
|
514 |
RDEBUG( "CApplicationManagementServer::HandleAllClientsClosed" );
|
|
515 |
}
|
|
516 |
|
|
517 |
// ------------------------------------------------------------------------------------------------
|
|
518 |
// CApplicationManagementServer::ConstructL
|
|
519 |
// ------------------------------------------------------------------------------------------------
|
|
520 |
|
|
521 |
void CApplicationManagementServer::ConstructL(HbMainWindow* aWindow)
|
|
522 |
{
|
|
523 |
|
|
524 |
// 2nd phase construction - ensure the timer and server objects are running
|
|
525 |
RDEBUG( "CApplicationManagementServer::ConstructL - Start" );
|
|
526 |
|
|
527 |
iOMASCOMOEnabled = ETrue;
|
|
528 |
mUserCancelled = 0;
|
|
529 |
TRAPD( errf, FeatureManager::InitializeLibL() );
|
|
530 |
if (errf != KErrNone)
|
|
531 |
{
|
|
532 |
User::Leave(errf);
|
|
533 |
}
|
|
534 |
m_Window = aWindow;
|
|
535 |
RDEBUG( "CApplicationManagementServer::ConstructL - start" );
|
|
536 |
StartL(KApplicationManagementServerName);
|
|
537 |
iStorage = CDeliveryComponentStorage::NewL();
|
|
538 |
|
|
539 |
iUtility
|
|
540 |
= ApplicationManagementUtilityFactory::CreateManagementUtilityL();
|
|
541 |
iDownloadMngr = CAMDownloadStore::NewL(*this);
|
|
542 |
iAMServerDB = CAMDownloaddb::NewL();
|
|
543 |
|
|
544 |
// Define P&S Keys
|
|
545 |
RProperty::Define(KUidPSApplicationManagementKeys, KAMServerUIEnabled,
|
|
546 |
RProperty::EInt);
|
|
547 |
|
|
548 |
RProperty::Define(KUidPSApplicationManagementKeys, KAMOperationNonSilent,
|
|
549 |
RProperty::EInt);
|
|
550 |
|
|
551 |
RProperty::Define(KUidPSApplicationManagementKeys, KSyncNotifier,
|
|
552 |
RProperty::EInt);
|
|
553 |
|
|
554 |
RProperty::Define(KUidPSApplicationManagementKeys, KDMUINotClosed,
|
|
555 |
RProperty::EInt);
|
|
556 |
|
|
557 |
RProperty syncproperty;
|
|
558 |
|
|
559 |
//Ignore error status
|
|
560 |
syncproperty.Attach(KUidPSApplicationManagementKeys, KSyncNotifier,
|
|
561 |
EOwnerThread);
|
|
562 |
syncproperty.Set(KErrNone);
|
|
563 |
syncproperty.Close();
|
|
564 |
|
|
565 |
#ifdef __AM_CONNECT_INSTALLER_ONSTARTUP_
|
|
566 |
TInt err( iInstaller.Connect() );
|
|
567 |
if ( err != KErrNone )
|
|
568 |
{
|
|
569 |
RDEBUG_2( "CApplicationManagementServer::ConstructL - ERROR leaving cannot connect installer: %d", err );
|
|
570 |
User::LeaveIfError( err );
|
|
571 |
}
|
|
572 |
#endif
|
|
573 |
iShutdown.ConstructL();
|
|
574 |
// ensure that the server still exits even if the 1st client fails to connect
|
|
575 |
iShutdown.Start();
|
|
576 |
|
|
577 |
RDEBUG( "CApplicationManagementServer::ConstructL - end" );
|
|
578 |
}
|
|
579 |
//---------------------------------------------------------------------------
|
|
580 |
// Create a new client session.
|
|
581 |
//---------------------------------------------------------------------------
|
|
582 |
CSession2* CApplicationManagementServer::NewSessionL(
|
|
583 |
const TVersion& aVersion, const RMessage2& /*aMessage */) const
|
|
584 |
{
|
|
585 |
RDEBUG( "ApplicationManagementServer: CApplicationManagementServer::NewSessionL" );
|
|
586 |
TVersion ver(KAMVerMajor, KAMVerMinor, KAMVerBuild);
|
|
587 |
if (!User::QueryVersionSupported(ver, aVersion))
|
|
588 |
{
|
|
589 |
RDEBUG( "CApplicationManagementServer::NewSessionL(): wrong version offered -> BAIL OUT!" );
|
|
590 |
User::Leave(KErrNotSupported);
|
|
591 |
}
|
|
592 |
return new (ELeave) CApplicationManagementSession();
|
|
593 |
}
|
|
594 |
|
|
595 |
// ------------------------------------------------------------------------------------------------
|
|
596 |
// CApplicationManagementServer::CustomSecurityCheckL()
|
|
597 |
// ------------------------------------------------------------------------------------------------
|
|
598 |
|
|
599 |
CPolicyServer::TCustomResult CApplicationManagementServer::CustomSecurityCheckL(
|
|
600 |
const RMessage2& /*aMsg*/, TInt& /*aAction*/, TSecurityInfo& /*aMissing*/)
|
|
601 |
{
|
|
602 |
return EPass;
|
|
603 |
}
|
|
604 |
|
|
605 |
// ------------------------------------------------------------------------------------------------
|
|
606 |
// CApplicationManagementServer::InstallCompleteL()
|
|
607 |
// ------------------------------------------------------------------------------------------------
|
|
608 |
|
|
609 |
void CApplicationManagementServer::InstallCompleteL(
|
|
610 |
const CDeploymentComponent& aCompo, const TBool &aInstallSuccess)
|
|
611 |
{
|
|
612 |
RDEBUG_2("CApplicationManagementServer::InstallCompleteL start (%d)", aInstallSuccess);
|
|
613 |
|
|
614 |
iInstallFile.Close();
|
|
615 |
// if java jad + jar install, remove files from c:\temp directory
|
|
616 |
if (CDeploymentComponent::IsJavaMimeL(aCompo.MetaData().MimeType() ) && CDeploymentComponent::IsJavaMimeL(aCompo.Data().MimeType() ) )
|
|
617 |
{
|
|
618 |
TFileName fn, fn2;
|
|
619 |
GenerateTempFileNameL(iInstallRFs, aCompo, fn, fn2);
|
|
620 |
RDEBUG_3("CApplicationManagementServer::InstallCompleteL delete files: (%S) (%S)", &fn, &fn2);
|
|
621 |
User::LeaveIfError(iInstallRFs.Delete(fn));
|
|
622 |
User::LeaveIfError(iInstallRFs.Delete(fn2));
|
|
623 |
}
|
|
624 |
TInt silentsession = 0;
|
|
625 |
TInt r2 = RProperty::Get(KPSUidNSmlSOSServerKey, KNSmlDMSilentJob,
|
|
626 |
silentsession);
|
|
627 |
|
|
628 |
if(r2 == KErrNone)
|
|
629 |
CApplicationManagementUtility::iSilentSession = silentsession;
|
|
630 |
|
|
631 |
if (!CApplicationManagementUtility::iSilentSession)
|
|
632 |
{
|
|
633 |
AppMgmtNotifier* note = new AppMgmtNotifier(m_appName);
|
|
634 |
if (aInstallSuccess)
|
|
635 |
{
|
|
636 |
note->showInstallSuccessNote();
|
|
637 |
// Remove temporary files from private directory
|
|
638 |
const_cast<CDeploymentComponent&> (aCompo).ResetDataL(iInstallRFs);
|
|
639 |
}
|
|
640 |
else if(mUserCancelled == 0)
|
|
641 |
{
|
|
642 |
note->showInstallFailedNote();
|
|
643 |
m_Window->lower();
|
|
644 |
}
|
|
645 |
|
|
646 |
delete note;
|
|
647 |
}
|
|
648 |
else
|
|
649 |
{
|
|
650 |
if (aInstallSuccess)
|
|
651 |
{
|
|
652 |
|
|
653 |
const_cast<CDeploymentComponent&> (aCompo).ResetDataL(iInstallRFs);
|
|
654 |
m_Window->lower();
|
|
655 |
}
|
|
656 |
}
|
|
657 |
|
|
658 |
iInstallRFs.Close();
|
|
659 |
|
|
660 |
iInstallInProgress = EFalse;
|
|
661 |
#ifndef __AM_CONNECT_INSTALLER_ONSTARTUP_
|
|
662 |
iInstaller.Close();
|
|
663 |
#endif
|
|
664 |
RDEBUG("CApplicationManagementServer::InstallCompleteL end");
|
|
665 |
}
|
|
666 |
|
|
667 |
// ------------------------------------------------------------------------------------------------
|
|
668 |
// CApplicationManagementServer::GenerateTempJarFileNameL()
|
|
669 |
// ------------------------------------------------------------------------------------------------
|
|
670 |
|
|
671 |
void CApplicationManagementServer::GenerateTempJarFileNameL(RFs &aFs,
|
|
672 |
const TDesC& aMetaSource, TFileName &aFileName) const
|
|
673 |
{
|
|
674 |
if (aMetaSource != KNullDesC)
|
|
675 |
{
|
|
676 |
RFile file;
|
|
677 |
User::LeaveIfError(file.Open(aFs, aMetaSource, EFileRead));
|
|
678 |
CleanupClosePushL(file);
|
|
679 |
TFileName temp;
|
|
680 |
temp = ReadJarFileNameL(file);
|
|
681 |
GenerateTempFileNameL(aFs, temp, aFileName);
|
|
682 |
CleanupStack::PopAndDestroy(&file);
|
|
683 |
}
|
|
684 |
}
|
|
685 |
|
|
686 |
// ------------------------------------------------------------------------------------------------
|
|
687 |
// CApplicationManagementServer::GenerateTempFileNameL()
|
|
688 |
// ------------------------------------------------------------------------------------------------
|
|
689 |
|
|
690 |
void CApplicationManagementServer::GenerateTempFileNameL(const RFs &aFs,
|
|
691 |
const TDesC& aSource, TFileName &aFileName) const
|
|
692 |
{
|
|
693 |
if (aSource != KNullDesC)
|
|
694 |
{
|
|
695 |
aFileName.Copy(KInstallDir);
|
|
696 |
TParse p;
|
|
697 |
User::LeaveIfError(aFs.Parse(aSource, p));
|
|
698 |
aFileName.Append(p.NameAndExt());
|
|
699 |
}
|
|
700 |
}
|
|
701 |
|
|
702 |
// ------------------------------------------------------------------------------------------------
|
|
703 |
// CApplicationManagementServer::GenerateTempFileNameL()
|
|
704 |
// ------------------------------------------------------------------------------------------------
|
|
705 |
|
|
706 |
void CApplicationManagementServer::GenerateTempFileNameL(RFs &aFs,
|
|
707 |
const CDeploymentComponent& aCompo, TFileName& aSource,
|
|
708 |
TFileName &aMetaSource, TFileName &aFileName,
|
|
709 |
TFileName &aMetaFileName) const
|
|
710 |
{
|
|
711 |
if (!BaflUtils::FolderExists(aFs, KInstallDir))
|
|
712 |
{
|
|
713 |
aFs.MkDirAll(KInstallDir);
|
|
714 |
}
|
|
715 |
|
|
716 |
aMetaSource.Copy(aCompo.MetaData().DataFileName());
|
|
717 |
GenerateTempFileNameL(aFs, aMetaSource, aMetaFileName);
|
|
718 |
aSource.Copy(aCompo.Data().DataFileName());
|
|
719 |
GenerateTempJarFileNameL(aFs, aMetaSource, aFileName);
|
|
720 |
}
|
|
721 |
|
|
722 |
// ------------------------------------------------------------------------------------------------
|
|
723 |
// CApplicationManagementServer::GenerateTempFileNameL()
|
|
724 |
// ------------------------------------------------------------------------------------------------
|
|
725 |
|
|
726 |
void CApplicationManagementServer::GenerateTempFileNameL(RFs &aFs,
|
|
727 |
const CDeploymentComponent& aCompo, TFileName &aFileName,
|
|
728 |
TFileName &aMetaFileName) const
|
|
729 |
{
|
|
730 |
TFileName ftemp, msource;
|
|
731 |
GenerateTempFileNameL(aFs, aCompo, ftemp, msource, aFileName,
|
|
732 |
aMetaFileName);
|
|
733 |
}
|
|
734 |
|
|
735 |
// ------------------------------------------------------------------------------------------------
|
|
736 |
// CApplicationManagementServer::ReadJarFileNameL()
|
|
737 |
// ------------------------------------------------------------------------------------------------
|
|
738 |
|
|
739 |
TFileName CApplicationManagementServer::ReadJarFileNameL(RFile& aFile) const
|
|
740 |
{
|
|
741 |
TFileName jarFileName;
|
|
742 |
HBufC8* lineBuffer = HBufC8::NewLC(KMaxFileName + 72); // lets hope all lines fit to this
|
|
743 |
TPtr8 linePtr(lineBuffer->Des());
|
|
744 |
TInt length(0);
|
|
745 |
aFile.Size(length);
|
|
746 |
HBufC8* data = HBufC8::NewLC(length);
|
|
747 |
TPtr8 ptr(data->Des());
|
|
748 |
aFile.Read(ptr);
|
|
749 |
RDesReadStream stream(*data);
|
|
750 |
CleanupClosePushL(stream);
|
|
751 |
TInt colonIndex = -1;
|
|
752 |
TInt err(KErrNone);
|
|
753 |
TInt found(KErrNotFound);
|
|
754 |
const TInt KJadNameValueSeparator = 0x3A; //':'
|
|
755 |
|
|
756 |
for (;;)
|
|
757 |
{
|
|
758 |
TRAP( err, ReadLineL(stream, linePtr) );
|
|
759 |
if (err == KErrNone)
|
|
760 |
{
|
|
761 |
RDEBUG8_2("Read line: (%S)", &linePtr);
|
|
762 |
found = linePtr.Find(KMIDletJarURL);
|
|
763 |
if (found != KErrNotFound && found == 0) // found
|
|
764 |
{
|
|
765 |
TPtrC8 filename(linePtr);
|
|
766 |
colonIndex = linePtr.Locate(KJadNameValueSeparator);
|
|
767 |
if (colonIndex != KErrNotFound)
|
|
768 |
{
|
|
769 |
filename.Set(linePtr.Mid(colonIndex + 1)); // get jar filename, format is: MIDlet-Jar-URL: bomber.jar
|
|
770 |
jarFileName.Copy(filename);
|
|
771 |
jarFileName.Trim();
|
|
772 |
break;
|
|
773 |
}
|
|
774 |
}
|
|
775 |
}
|
|
776 |
else
|
|
777 |
{
|
|
778 |
User::Leave(err);
|
|
779 |
}
|
|
780 |
}
|
|
781 |
CleanupStack::PopAndDestroy(3, lineBuffer); // stream, data
|
|
782 |
return jarFileName;
|
|
783 |
}
|
|
784 |
|
|
785 |
// ------------------------------------------------------------------------------------------------
|
|
786 |
// CApplicationManagementServer::ReadLineL()
|
|
787 |
// ------------------------------------------------------------------------------------------------
|
|
788 |
|
|
789 |
void CApplicationManagementServer::ReadLineL(RReadStream& aStream,
|
|
790 |
TDes8& aLineBuffer) const
|
|
791 |
{
|
|
792 |
TBuf8<1> input;
|
|
793 |
const TUint32 LF = 10;
|
|
794 |
const TUint32 CR = 13;
|
|
795 |
TBool endOfLine(EFalse);
|
|
796 |
TInt errRead(KErrNone);
|
|
797 |
|
|
798 |
// reset
|
|
799 |
aLineBuffer.Zero();
|
|
800 |
|
|
801 |
while (!endOfLine)
|
|
802 |
{
|
|
803 |
TRAP(errRead, aStream.ReadL(input, 1));
|
|
804 |
|
|
805 |
if (errRead == KErrEof)
|
|
806 |
{
|
|
807 |
// EOF
|
|
808 |
User::Leave(KErrEof);
|
|
809 |
}
|
|
810 |
// check special characters
|
|
811 |
if (input[0] == LF)
|
|
812 |
{
|
|
813 |
// End of line
|
|
814 |
endOfLine = ETrue;
|
|
815 |
}
|
|
816 |
else if (input[0] == CR)
|
|
817 |
{
|
|
818 |
// Only end of line if not followed by a LF
|
|
819 |
}
|
|
820 |
else
|
|
821 |
{
|
|
822 |
// We put any other character in the buffer
|
|
823 |
if (aLineBuffer.Length() < aLineBuffer.MaxLength())
|
|
824 |
{
|
|
825 |
aLineBuffer.Append(input[0]);
|
|
826 |
}
|
|
827 |
}
|
|
828 |
}
|
|
829 |
}
|
|
830 |
|
|
831 |
// ------------------------------------------------------------------------------------------------
|
|
832 |
// CApplicationManagementServer::PrepareInstallL()
|
|
833 |
// ------------------------------------------------------------------------------------------------
|
|
834 |
|
|
835 |
TBool CApplicationManagementServer::PrepareInstallL(
|
|
836 |
const CDeploymentComponent &aComponent, TFileName &aFileName)
|
|
837 |
{
|
|
838 |
RDEBUG( "CApplicationManagementServer::PrepareInstallL" );
|
|
839 |
TBool res(ETrue);
|
|
840 |
|
|
841 |
#ifndef __AM_CONNECT_INSTALLER_ONSTARTUP_
|
|
842 |
TInt err(iInstaller.Connect());
|
|
843 |
if (err != KErrNone)
|
|
844 |
{
|
|
845 |
RDEBUG_2( "CApplicationManagementServer::PrepareInstallL - ERROR leaving cannot connect installer: %d", err );
|
|
846 |
User::LeaveIfError(err);
|
|
847 |
}
|
|
848 |
CleanupClosePushL(iInstaller);
|
|
849 |
#endif
|
|
850 |
|
|
851 |
RDEBUG( "CApplicationManagementServer::PrepareInstallL - connected to installer" );
|
|
852 |
// Copy data file name (install file)
|
|
853 |
if (aComponent.Data().DataFileName().Length() > 0)
|
|
854 |
{
|
|
855 |
aFileName.Copy(aComponent.Data().DataFileName());
|
|
856 |
}
|
|
857 |
else
|
|
858 |
{
|
|
859 |
// data file has not been created for component!
|
|
860 |
User::Leave(KErrNotFound);
|
|
861 |
}
|
|
862 |
// Open RFs session
|
|
863 |
User::LeaveIfError(iInstallRFs.Connect());
|
|
864 |
User::LeaveIfError(iInstallRFs.ShareProtected());
|
|
865 |
|
|
866 |
// set installoptions and correct mime type
|
|
867 |
using namespace SwiUI;
|
|
868 |
iInstallOptions = aComponent.InstallOpts().iOptions;
|
|
869 |
TInstallReq req;
|
|
870 |
if (aComponent.Data().MimeType() == SwiUI::KSisMimeType)
|
|
871 |
{
|
|
872 |
//convert if MIME type is application/vnd.symbian.install to x-epoc/x-sisx-app
|
|
873 |
//as installer doesn't support application/vnd.symbian.install MIME type from S60 3rd edition onwards.
|
|
874 |
req.iMIME = SwiUI::KSisxMimeType;
|
|
875 |
}
|
|
876 |
else
|
|
877 |
{
|
|
878 |
req.iMIME = aComponent.Data().MimeType();
|
|
879 |
}
|
|
880 |
|
|
881 |
if (CDeploymentComponent::IsJavaMimeL(aComponent.MetaData().MimeType()))
|
|
882 |
{
|
|
883 |
// Check if both jad and jar files already exist in the phone
|
|
884 |
if (CDeploymentComponent::IsJavaMimeL(aComponent.Data().MimeType())
|
|
885 |
&& aComponent.MetaData().MimeType() == SwiUI::KJadMIMEType)
|
|
886 |
{
|
|
887 |
// Move both files to temporary location and use jad to install java application
|
|
888 |
CFileMan *fm = CFileMan::NewL(iInstallRFs);
|
|
889 |
CleanupStack::PushL(fm);
|
|
890 |
TFileName source, metasource, metatarget;
|
|
891 |
aFileName.Copy(KNullDesC8()); // reset
|
|
892 |
GenerateTempFileNameL(iInstallRFs, aComponent, source,
|
|
893 |
metasource, aFileName, metatarget);
|
|
894 |
|
|
895 |
RDEBUG_2( "CApplicationManagementServer::PrepareInstallL - temp jar file '%S'", &aFileName );
|
|
896 |
RDEBUG_2( "CApplicationManagementServer::PrepareInstallL - temp jad file '%S'", &metatarget );
|
|
897 |
|
|
898 |
// Copy datafile (jar)
|
|
899 |
TInt copyer(fm->Copy(source, aFileName));
|
|
900 |
|
|
901 |
// Copy metadatafile (jad)
|
|
902 |
TInt copyer2(fm->Copy(metasource, metatarget));
|
|
903 |
|
|
904 |
CleanupStack::PopAndDestroy(fm);
|
|
905 |
|
|
906 |
RDEBUG_3( "CApplicationManagementServer::PrepareInstallL - (%d)-(%d)", copyer, copyer2 );
|
|
907 |
|
|
908 |
if (copyer == KErrNone && copyer2 == KErrNone)
|
|
909 |
{
|
|
910 |
res = ETrue;
|
|
911 |
aFileName = metatarget;
|
|
912 |
req.iMIME = aComponent.MetaData().MimeType();
|
|
913 |
}
|
|
914 |
else
|
|
915 |
{
|
|
916 |
User::Leave(KErrWrite);
|
|
917 |
}
|
|
918 |
}
|
|
919 |
else if (aComponent.MetaData().MimeType() == SwiUI::KJadMIMEType)
|
|
920 |
{
|
|
921 |
aFileName.Copy(aComponent.MetaData().DataFileName());
|
|
922 |
req.iMIME = aComponent.MetaData().MimeType();
|
|
923 |
RDEBUG_2( "CApplicationManagementServer::PrepareInstallL - Using Jad file to install java application: %S", &aFileName );
|
|
924 |
}
|
|
925 |
}
|
|
926 |
|
|
927 |
if (aComponent.GetIAP() > -1)
|
|
928 |
{
|
|
929 |
req.iIAP = aComponent.GetIAP();
|
|
930 |
RDEBUG_2( "CApplicationManagementServer::PrepareInstallL: setting iap to %d", req.iIAP );
|
|
931 |
}
|
|
932 |
else
|
|
933 |
{
|
|
934 |
TInt iap = KErrNotFound;
|
|
935 |
TRAPD( err, SmlHelper::GetDefaultIAPFromDMProfileL( iap ) );
|
|
936 |
if (err == KErrNone)
|
|
937 |
{
|
|
938 |
req.iIAP = iap;
|
|
939 |
RDEBUG_2(" -> using DM profile default IAP: %d", iap);
|
|
940 |
}
|
|
941 |
else
|
|
942 |
{
|
|
943 |
RDEBUG_2("**** ERROR while fetching DM profile default iap: %d", err );
|
|
944 |
}
|
|
945 |
}
|
|
946 |
|
|
947 |
iInstallReq = SwiUI::TInstallReqPckg(req);
|
|
948 |
RDEBUG8_2( "CApplicationManagementServer::PrepareInstallL: mime type is (%S)", &req.iMIME);
|
|
949 |
RDEBUG_2( "CApplicationManagementServer::PrepareInstallL - Using temp file '%S'", &aFileName );
|
|
950 |
|
|
951 |
User::LeaveIfError(iInstallFile.Open(iInstallRFs, aFileName, EFileRead));
|
|
952 |
TInt sz;
|
|
953 |
User::LeaveIfError(iInstallFile.Size(sz));
|
|
954 |
if (!(sz > 0))
|
|
955 |
{
|
|
956 |
res = EFalse;
|
|
957 |
RDEBUG( "CApplicationManagementServer::PrepareInstallL - ERROR size of source file is 0!" );
|
|
958 |
}
|
|
959 |
|
|
960 |
#ifndef __AM_CONNECT_INSTALLER_ONSTARTUP_
|
|
961 |
CleanupStack::Pop(&iInstaller);
|
|
962 |
#endif
|
|
963 |
|
|
964 |
RDEBUG( "CApplicationManagementServer::PrepareInstallL end" );
|
|
965 |
|
|
966 |
iAppname = aFileName;
|
|
967 |
|
|
968 |
return res;
|
|
969 |
}
|
|
970 |
|
|
971 |
// ------------------------------------------------------------------------------------------------
|
|
972 |
// CApplicationManagementServer::InstallL()
|
|
973 |
// ------------------------------------------------------------------------------------------------
|
|
974 |
|
|
975 |
void CApplicationManagementServer::InstallL(
|
|
976 |
const CDeploymentComponent &aComponent, TRequestStatus &aStatus)
|
|
977 |
{
|
|
978 |
RDEBUG( "CApplicationManagementServer::InstallL (async): begin" );
|
|
979 |
|
|
980 |
if (iInstallInProgress == EFalse)
|
|
981 |
{
|
|
982 |
TFileName fn;
|
|
983 |
TInt type = EInstallWaitDlg;
|
|
984 |
TInt silentsession = 0;
|
|
985 |
TInt r2 = RProperty::Get(KPSUidNSmlSOSServerKey, KNSmlDMSilentJob,
|
|
986 |
silentsession);
|
|
987 |
|
|
988 |
if(r2 == KErrNone)
|
|
989 |
CApplicationManagementUtility::iSilentSession = silentsession;
|
|
990 |
|
|
991 |
if (!CApplicationManagementUtility::iSilentSession)
|
|
992 |
{
|
|
993 |
m_Dlg = new AMWaitProgDialog(m_appName, *this);
|
|
994 |
m_Dlg->createWaitDialog(type);
|
|
995 |
if (CApplicationManagementUtility::mHidden == 1)
|
|
996 |
{
|
|
997 |
m_Dlg->startIndicator();
|
|
998 |
}
|
|
999 |
else
|
|
1000 |
{
|
|
1001 |
m_Window->raise();
|
|
1002 |
CApplicationManagementUtility::mCurrDlg->setVisible(true);
|
|
1003 |
}
|
|
1004 |
}
|
|
1005 |
if (PrepareInstallL(aComponent, fn))
|
|
1006 |
{
|
|
1007 |
if (m_Dlg)
|
|
1008 |
m_Dlg->registerInstallRequest(aStatus);
|
|
1009 |
delete iArgu;
|
|
1010 |
iArgu = NULL;
|
|
1011 |
iArgu = Usif::COpaqueNamedParams::NewL();
|
|
1012 |
iArgu->AddIntL(Usif::KSifInParam_InstallSilently, 1);
|
|
1013 |
TAMInstallOptions opts = aComponent.InstallOpts();
|
|
1014 |
TChar drive = opts.iOptions.iDrive;
|
|
1015 |
RFs iFs;
|
|
1016 |
TInt driveNumber;
|
|
1017 |
iFs.CharToDrive(drive,driveNumber);
|
|
1018 |
|
|
1019 |
iArgu->AddIntL(Usif::KSifInParam_Drive, driveNumber);
|
|
1020 |
|
|
1021 |
delete iResults;
|
|
1022 |
iResults = NULL;
|
|
1023 |
iResults = Usif::COpaqueNamedParams::NewL();
|
|
1024 |
|
|
1025 |
RDEBUG_3( "CApplicationManagementServer::InstallL: Install '%S' sizeof opts: %d", &fn, sizeof (aComponent.InstallOpts()));
|
|
1026 |
TRAPD( err ,iInstaller.Install( iInstallFile, *iArgu, *iResults, aStatus ) );
|
|
1027 |
|
|
1028 |
RDEBUG_2( "CApplicationManagementServer::InstallL: status: %d", err);
|
|
1029 |
User::LeaveIfError(err);
|
|
1030 |
iInstallInProgress = ETrue;
|
|
1031 |
}
|
|
1032 |
else
|
|
1033 |
{
|
|
1034 |
RDEBUG( "CApplicationManagementServer::InstallL - PrepareInstallL failed, leaving" );
|
|
1035 |
User::Leave(KErrArgument);
|
|
1036 |
}
|
|
1037 |
}
|
|
1038 |
else
|
|
1039 |
{
|
|
1040 |
RDEBUG( "CApplicationManagementServer::InstallL (async): previous install still in progress...bailing out" );
|
|
1041 |
TRequestStatus * status = &aStatus;
|
|
1042 |
User::RequestComplete(status, KErrInUse);
|
|
1043 |
}
|
|
1044 |
RDEBUG( "CApplicationManagementServer::InstallL (async): end" );
|
|
1045 |
}
|
|
1046 |
|
|
1047 |
// ------------------------------------------------------------------------------------------------
|
|
1048 |
// CApplicationManagementServer::PrepareInstallL()
|
|
1049 |
// ------------------------------------------------------------------------------------------------
|
|
1050 |
|
|
1051 |
void CApplicationManagementServer::InstallL(
|
|
1052 |
const CDeploymentComponent &aComponent)
|
|
1053 |
{
|
|
1054 |
RDEBUG( "CApplicationManagementServer::InstallL: begin" );
|
|
1055 |
|
|
1056 |
if (iInstallInProgress == EFalse)
|
|
1057 |
{
|
|
1058 |
TFileName fn;
|
|
1059 |
if (PrepareInstallL(aComponent, fn))
|
|
1060 |
{
|
|
1061 |
iInstallInProgress = ETrue;
|
|
1062 |
RDEBUG_2( "CApplicationManagementServer::InstallL: Install '%S' ", &fn);
|
|
1063 |
SwiUI::TInstallOptionsPckg pkg(aComponent.InstallOpts().iOptions);
|
|
1064 |
iInstallInProgress = EFalse;
|
|
1065 |
}
|
|
1066 |
else
|
|
1067 |
{
|
|
1068 |
RDEBUG( "CApplicationManagementServer::InstallL - PrepareInstallL failed, leaving" );
|
|
1069 |
User::Leave(KErrArgument);
|
|
1070 |
}
|
|
1071 |
}
|
|
1072 |
RDEBUG( "CApplicationManagementServer::InstallL: end" );
|
|
1073 |
}
|
|
1074 |
|
|
1075 |
// ------------------------------------------------------------------------------------------------
|
|
1076 |
// CApplicationManagementServer::UninstallL()
|
|
1077 |
// ------------------------------------------------------------------------------------------------
|
|
1078 |
|
|
1079 |
void CApplicationManagementServer::UninstallL(
|
|
1080 |
const CDeploymentComponent &aComponent, TRequestStatus &aStatus)
|
|
1081 |
{
|
|
1082 |
RDEBUG( "CApplicationManagementServer::UninstallL: begin" );
|
|
1083 |
if (iInstallInProgress == EFalse)
|
|
1084 |
{
|
|
1085 |
TInt err(iInstaller.Connect());
|
|
1086 |
User::LeaveIfError(err);
|
|
1087 |
RDEBUG_2( "CApplicationManagementServer::UninstallL: UninstallL '0x%X' ", aComponent.Uid());
|
|
1088 |
using namespace SwiUI;
|
|
1089 |
iUninstallOptions = aComponent.UninstallOpts();
|
|
1090 |
|
|
1091 |
delete iArgu;
|
|
1092 |
iArgu = NULL;
|
|
1093 |
iArgu = Usif::COpaqueNamedParams::NewL();
|
|
1094 |
iArgu->AddIntL( Usif::KSifInParam_InstallSilently, 1 );
|
|
1095 |
|
|
1096 |
delete iResults;
|
|
1097 |
iResults = NULL;
|
|
1098 |
iResults = Usif::COpaqueNamedParams::NewL();
|
|
1099 |
TRAP( err ,iInstaller.Uninstall( aComponent.GetComponentId(), *iArgu, *iResults, aStatus ));
|
|
1100 |
|
|
1101 |
RDEBUG_2( "CApplicationManagementServer::UninstallL: UninstallL result '0x%X'", err );
|
|
1102 |
User::LeaveIfError(err);
|
|
1103 |
iInstallInProgress = ETrue;
|
|
1104 |
}
|
|
1105 |
else
|
|
1106 |
{
|
|
1107 |
RDEBUG( "CApplicationManagementServer::UninstallL: previous uninstall still in progress...bailing out" );
|
|
1108 |
TRequestStatus * status = &aStatus;
|
|
1109 |
User::RequestComplete(status, KErrInUse);
|
|
1110 |
}
|
|
1111 |
|
|
1112 |
RDEBUG( "CApplicationManagementServer::UninstallL: end" );
|
|
1113 |
}
|
|
1114 |
// ------------------------------------------------------------------------------------------------
|
|
1115 |
// CApplicationManagementServer::PerformRFSL()
|
|
1116 |
// ------------------------------------------------------------------------------------------------
|
|
1117 |
|
|
1118 |
void CApplicationManagementServer::PerformRFSL()
|
|
1119 |
{
|
|
1120 |
RDEBUG( "CApplicationManagementServer::PerformRFSL: begin" );
|
|
1121 |
const RComponentIdArray &arrt = iStorage->GetComponentIds();
|
|
1122 |
TCertInfoPckg *corcert = NULL;
|
|
1123 |
for (TInt i(0); i < arrt.Count(); i++)
|
|
1124 |
{
|
|
1125 |
RDEBUG_3( "CApplicationManagementServer::PerformRFSL processing dc %d of %d", i, arrt.Count() );
|
|
1126 |
CDeploymentComponent &c = iStorage->ComponentL(arrt[i]);
|
|
1127 |
|
|
1128 |
const RCertArray &certs = iStorage->Certificates();
|
|
1129 |
TInt index = c.Owner();
|
|
1130 |
TCertInfoPckg *certp = NULL;
|
|
1131 |
if (index >= 0)
|
|
1132 |
{
|
|
1133 |
certp = certs[c.Owner()];
|
|
1134 |
}
|
|
1135 |
if (!corcert && certp)
|
|
1136 |
{
|
|
1137 |
if (CheckCertL((*certp)()))
|
|
1138 |
{
|
|
1139 |
corcert = certp;
|
|
1140 |
RDEBUG_2( "CApplicationManagementServer::PerformRFSL Found CORP Cert! Removing %d ", i );
|
|
1141 |
RemoveInternalL(c);
|
|
1142 |
}
|
|
1143 |
else
|
|
1144 |
{
|
|
1145 |
RDEBUG_2( "CApplicationManagementServer::PerformRFSL skipping %d because not corp dc", i );
|
|
1146 |
}
|
|
1147 |
}
|
|
1148 |
else
|
|
1149 |
{
|
|
1150 |
if (corcert == certp)
|
|
1151 |
{
|
|
1152 |
RDEBUG_2( "CApplicationManagementServer::PerformRFSL Removing %d ", i );
|
|
1153 |
RemoveInternalL(c);
|
|
1154 |
}
|
|
1155 |
else
|
|
1156 |
{
|
|
1157 |
RDEBUG_2( "CApplicationManagementServer::PerformRFSL skipping %d because not corp dc", i );
|
|
1158 |
}
|
|
1159 |
}
|
|
1160 |
}
|
|
1161 |
RDEBUG( "CApplicationManagementServer::PerformRFSL: end" );
|
|
1162 |
}
|
|
1163 |
|
|
1164 |
// ------------------------------------------------------------------------------------------------
|
|
1165 |
// CApplicationManagementServer::RemoveInternalL()
|
|
1166 |
// ------------------------------------------------------------------------------------------------
|
|
1167 |
|
|
1168 |
|
|
1169 |
void CApplicationManagementServer::RemoveInternalL(
|
|
1170 |
const CDeploymentComponent &aCompo, TBool aDoUninstall /* = ETrue */)
|
|
1171 |
{
|
|
1172 |
RDEBUG_2("CApplicationManagementServer: RemoveInternalL - Remove id: (%d)", aCompo.InternalId() );
|
|
1173 |
TInt err(KErrNone);
|
|
1174 |
TDeploymentComponentName name = aCompo.ComponentName();
|
|
1175 |
TBuf<KDeploymentComponentNameMaxLength> ne;
|
|
1176 |
ne.Copy(name);
|
|
1177 |
m_appName = QString::fromUtf16(ne.Ptr(), ne.Length());
|
|
1178 |
|
|
1179 |
RDEBUG("CApplicationManagementServer: RemoveInternalL - step1");
|
|
1180 |
|
|
1181 |
TInt err1 = KErrNone;
|
|
1182 |
if (!err1)
|
|
1183 |
{
|
|
1184 |
RDEBUG("CApplicationManagementServer: RemoveInternalL - step2");
|
|
1185 |
|
|
1186 |
aCompo.SetStatusNode(EDelivered_RemoveProgress);
|
|
1187 |
|
|
1188 |
TDeploymentComponentState st(aCompo.State());
|
|
1189 |
if (st == EDCSDelivered || st == EDCSDownload)
|
|
1190 |
{
|
|
1191 |
RDEBUG("CApplicationManagementServer: RemoveInternalL - step3 start");
|
|
1192 |
TRAP(err,iStorage->RemoveL( aCompo.InternalId() ));
|
|
1193 |
RDEBUG("CApplicationManagementServer: RemoveInternalL - step4 start");
|
|
1194 |
}
|
|
1195 |
else if (st == EDCSActive || st == EDCSInactive)
|
|
1196 |
{
|
|
1197 |
RDEBUG("CApplicationManagementServer: RemoveInternalL - step5 start");
|
|
1198 |
if (aDoUninstall)
|
|
1199 |
{
|
|
1200 |
if (aCompo.Uid() != TUid::Null())
|
|
1201 |
{
|
|
1202 |
TInt nonSilentOperation = KErrNotFound;
|
|
1203 |
iOMASCOMOEnabled = IsOMASCOMOEnabledL();
|
|
1204 |
if (!iOMASCOMOEnabled)
|
|
1205 |
nonSilentOperation = 0;
|
|
1206 |
RDEBUG("CApplicationManagementServer: RemoveInternalL - step5 start 1");
|
|
1207 |
|
|
1208 |
TInt silentsession = 0;
|
|
1209 |
RProperty::Get(KPSUidNSmlSOSServerKey, KNSmlDMSilentJob,
|
|
1210 |
silentsession);
|
|
1211 |
|
|
1212 |
CApplicationManagementUtility::iSilentSession
|
|
1213 |
= silentsession;
|
|
1214 |
TRequestStatus s1 = KRequestPending;
|
|
1215 |
AppMgmtNotifier* note = new AppMgmtNotifier(m_appName);
|
|
1216 |
|
|
1217 |
// displaying uninstall confirm notes
|
|
1218 |
if (!CApplicationManagementUtility::iSilentSession)
|
|
1219 |
{
|
|
1220 |
CDialogWait* wait = CDialogWait::NewL();
|
|
1221 |
note->showUninstallDialog(aCompo, wait->iStatus);
|
|
1222 |
m_Window->raise();
|
|
1223 |
wait->StartWait();
|
|
1224 |
s1=wait->iStatus;
|
|
1225 |
delete wait;
|
|
1226 |
}
|
|
1227 |
if (s1 != KStatusUserCancelled)
|
|
1228 |
{
|
|
1229 |
TInt type = EUninstallWaitDlg;
|
|
1230 |
TRequestStatus s;
|
|
1231 |
if (!CApplicationManagementUtility::iSilentSession)
|
|
1232 |
{
|
|
1233 |
m_Dlg = new AMWaitProgDialog(m_appName, *this);
|
|
1234 |
m_Dlg->createWaitDialog(type);
|
|
1235 |
m_Window->raise();
|
|
1236 |
CApplicationManagementUtility::mCurrDlg->setVisible(
|
|
1237 |
true);
|
|
1238 |
|
|
1239 |
}
|
|
1240 |
CDialogWait* wait1 = CDialogWait::NewL();
|
|
1241 |
|
|
1242 |
TRAP(err,UninstallL( aCompo, wait1->iStatus ));
|
|
1243 |
//wait till uninstall completes
|
|
1244 |
wait1->StartWait();
|
|
1245 |
if (!CApplicationManagementUtility::iSilentSession)
|
|
1246 |
m_Dlg->closeAMWaitDialog();
|
|
1247 |
m_Window->lower();
|
|
1248 |
s = wait1->iStatus;
|
|
1249 |
delete wait1;
|
|
1250 |
iInstallInProgress = EFalse;
|
|
1251 |
// Capturing Installer errors,if any
|
|
1252 |
err = s.Int();
|
|
1253 |
if (s.Int() == KErrNone)
|
|
1254 |
{
|
|
1255 |
note->showUnInstallSuccessNote();
|
|
1256 |
RDEBUG("CApplicationManagementServer::RemoveInternalL Uninstalled");
|
|
1257 |
}
|
|
1258 |
else
|
|
1259 |
{
|
|
1260 |
note->showUnInstallFailedNote();
|
|
1261 |
if (s.Int() == KErrNotFound)
|
|
1262 |
{
|
|
1263 |
RDEBUG( "CApplicationManagementServer: RemoveInternalL WARNING component was not found by uninstaller" );
|
|
1264 |
}
|
|
1265 |
else
|
|
1266 |
{
|
|
1267 |
RDEBUG_2("CApplicationManagementServer: RemoveInternalL ERROR uninstall failed %d", s.Int() );
|
|
1268 |
}
|
|
1269 |
}
|
|
1270 |
}
|
|
1271 |
else
|
|
1272 |
{
|
|
1273 |
err = SwiUI::KSWInstErrUserCancel;
|
|
1274 |
aCompo.SetStatusNode(EDelivered_RemoveFailed);
|
|
1275 |
RDEBUG( "CApplicationManagementServer: RemoveInternalL User cancelled" );
|
|
1276 |
}
|
|
1277 |
delete note;
|
|
1278 |
}
|
|
1279 |
else
|
|
1280 |
{
|
|
1281 |
RDEBUG( "CApplicationManagementServer: RemoveInternalL ERROR component is deployed but has null uid - it cannot be uninstalled!" );
|
|
1282 |
}
|
|
1283 |
}
|
|
1284 |
else
|
|
1285 |
{
|
|
1286 |
RDEBUG_2("CApplicationManagementServer: RemoveInternalL - Skipped uninstall of %d", aCompo.InternalId() );
|
|
1287 |
}
|
|
1288 |
/*
|
|
1289 |
* if (unstall is sucesss) then remove component from storage
|
|
1290 |
*
|
|
1291 |
*/
|
|
1292 |
if (err == KErrNone)
|
|
1293 |
{
|
|
1294 |
iStorage->RemoveL(aCompo.InternalId());
|
|
1295 |
}
|
|
1296 |
}
|
|
1297 |
else
|
|
1298 |
{
|
|
1299 |
RDEBUG_2("CApplicationManagementServer: RemoveInternalL ERROR called with illegal state component id %d", aCompo.State() );
|
|
1300 |
User::Leave(KErrArgument);
|
|
1301 |
}
|
|
1302 |
/*
|
|
1303 |
* if error set state to remove failed
|
|
1304 |
* Finally call userleaveiferror()
|
|
1305 |
* */
|
|
1306 |
if (err != KErrNone)
|
|
1307 |
{
|
|
1308 |
aCompo.SetStatusNode(EDelivered_RemoveFailed);
|
|
1309 |
}
|
|
1310 |
}
|
|
1311 |
else
|
|
1312 |
{
|
|
1313 |
err = SwiUI::KSWInstErrUserCancel;
|
|
1314 |
aCompo.SetStatusNode(EDelivered_RemoveFailed);
|
|
1315 |
}
|
|
1316 |
|
|
1317 |
User::LeaveIfError(err);
|
|
1318 |
}
|
|
1319 |
|
|
1320 |
|
|
1321 |
// ------------------------------------------------------------------------------------------------
|
|
1322 |
// CApplicationManagementServer::CheckCertL()
|
|
1323 |
// ------------------------------------------------------------------------------------------------
|
|
1324 |
|
|
1325 |
TBool CApplicationManagementServer::CheckCertL(const TCertInfo &aInfo) const
|
|
1326 |
{
|
|
1327 |
TBool go(EFalse);
|
|
1328 |
|
|
1329 |
if (FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement))
|
|
1330 |
{
|
|
1331 |
// #ifdef __SAP_POLICY_MANAGEMENT
|
|
1332 |
RPolicyEngine peng;
|
|
1333 |
|
|
1334 |
// The management session
|
|
1335 |
//
|
|
1336 |
TInt err(peng.Connect());
|
|
1337 |
|
|
1338 |
if (err == KErrNone)
|
|
1339 |
{
|
|
1340 |
CleanupClosePushL(peng);
|
|
1341 |
RPolicyRequest rq;
|
|
1342 |
err = rq.Open(peng);
|
|
1343 |
if (err == KErrNone)
|
|
1344 |
{
|
|
1345 |
CleanupClosePushL(rq);
|
|
1346 |
|
|
1347 |
TRequestContext rc;
|
|
1348 |
|
|
1349 |
using namespace PolicyEngineXACML;
|
|
1350 |
using namespace NPolicyConstants;
|
|
1351 |
|
|
1352 |
rc.AddSubjectAttributeL(KTrustedSubject, aInfo);
|
|
1353 |
rc.AddResourceAttributeL(KResourceId, KApplicationManagement,
|
|
1354 |
KStringDataType);
|
|
1355 |
|
|
1356 |
TResponse resp;
|
|
1357 |
err = rq.MakeRequest(rc, resp);
|
|
1358 |
if (err == KErrNone)
|
|
1359 |
{
|
|
1360 |
if (resp.GetResponseValue() == EResponsePermit
|
|
1361 |
#ifdef _DEBUG
|
|
1362 |
|| resp.GetResponseValue()
|
|
1363 |
== EResponseNotApplicable
|
|
1364 |
#endif
|
|
1365 |
)
|
|
1366 |
{
|
|
1367 |
go = ETrue;
|
|
1368 |
}
|
|
1369 |
else
|
|
1370 |
{
|
|
1371 |
RDEBUG_2( "CApplicationManagementSession::CheckCertL; Policy response denies access! %d", resp.GetResponseValue());
|
|
1372 |
}
|
|
1373 |
}
|
|
1374 |
else
|
|
1375 |
{
|
|
1376 |
RDEBUG_2( "CApplicationManagementSession::CheckCertL; ERROR making policy request! %d", err);
|
|
1377 |
}
|
|
1378 |
CleanupStack::PopAndDestroy(&rq);
|
|
1379 |
}
|
|
1380 |
else
|
|
1381 |
{
|
|
1382 |
RDEBUG_2( "CApplicationManagementSession::CheckCertL; ERROR Failed to open policy engine session! %d", err);
|
|
1383 |
}
|
|
1384 |
CleanupStack::PopAndDestroy(&peng);
|
|
1385 |
}
|
|
1386 |
else
|
|
1387 |
{
|
|
1388 |
RDEBUG_2( "CApplicationManagementSession::CheckCertL; ERROR Failed to connect policy engine! %d", err);
|
|
1389 |
}
|
|
1390 |
User::LeaveIfError(err);
|
|
1391 |
}
|
|
1392 |
else
|
|
1393 |
{
|
|
1394 |
RDEBUG( "CApplicationManagementSession::CheckCertL; No PolicyManagement by featmgr-> cert ok!" );
|
|
1395 |
go = ETrue;
|
|
1396 |
}
|
|
1397 |
return go;
|
|
1398 |
}
|
|
1399 |
|
|
1400 |
// ------------------------------------------------------------------------------------------------
|
|
1401 |
// CApplicationManagementServer::HasUidL()
|
|
1402 |
// ------------------------------------------------------------------------------------------------
|
|
1403 |
|
|
1404 |
TBool CApplicationManagementServer::HasUidL(const TUid &aUid,
|
|
1405 |
CDeploymentComponent *& aCompo, CDeploymentComponent *aIgnored /* = NULL */)
|
|
1406 |
{
|
|
1407 |
TBool found(EFalse);
|
|
1408 |
const RComponentIdArray &arrt = iStorage->GetComponentIds();
|
|
1409 |
TInt count(arrt.Count());
|
|
1410 |
for (TInt i(0); i < count; i++)
|
|
1411 |
{
|
|
1412 |
CDeploymentComponent &compo = iStorage->ComponentL(arrt[i]);
|
|
1413 |
if (compo.Uid() == aUid)
|
|
1414 |
{
|
|
1415 |
if (&compo != aIgnored)
|
|
1416 |
{
|
|
1417 |
aCompo = &compo;
|
|
1418 |
found = ETrue;
|
|
1419 |
RDEBUG_3( "ApplicationManagementServer: UidExistsL 0x%X - Found NOT ignored %d", aUid.iUid, compo.InternalId() );
|
|
1420 |
}
|
|
1421 |
else
|
|
1422 |
{
|
|
1423 |
RDEBUG( "ApplicationManagementServer: UidExistsL - Found ignored " );
|
|
1424 |
}
|
|
1425 |
}
|
|
1426 |
}
|
|
1427 |
if (!found)
|
|
1428 |
{
|
|
1429 |
found = FindInstalledSisUidL(aUid);
|
|
1430 |
if (!found)
|
|
1431 |
{
|
|
1432 |
found = FindInstalledJavaUidL(aUid);
|
|
1433 |
}
|
|
1434 |
}
|
|
1435 |
return found;
|
|
1436 |
}
|
|
1437 |
|
|
1438 |
// ------------------------------------------------------------------------------------------------
|
|
1439 |
// CApplicationManagementServer::FindInstalledSisUidL()
|
|
1440 |
// ------------------------------------------------------------------------------------------------
|
|
1441 |
|
|
1442 |
TBool CApplicationManagementServer::FindInstalledSisUidL(const TUid &aUid) const
|
|
1443 |
{
|
|
1444 |
TBool found(EFalse);
|
|
1445 |
Swi::RSisRegistrySession sisses;
|
|
1446 |
TInt r(sisses.Connect());
|
|
1447 |
User::LeaveIfError(r);
|
|
1448 |
CleanupClosePushL(sisses);
|
|
1449 |
|
|
1450 |
RArray<TUid> uids;
|
|
1451 |
sisses.InstalledUidsL(uids);
|
|
1452 |
CleanupClosePushL(uids);
|
|
1453 |
|
|
1454 |
TInt uidc(uids.Count());
|
|
1455 |
for (TInt j(0); found == EFalse && j < uidc; j++)
|
|
1456 |
{
|
|
1457 |
if (uids[j] == aUid)
|
|
1458 |
{
|
|
1459 |
found = ETrue;
|
|
1460 |
}
|
|
1461 |
}
|
|
1462 |
CleanupStack::PopAndDestroy(&uids);
|
|
1463 |
CleanupStack::PopAndDestroy(&sisses);
|
|
1464 |
|
|
1465 |
return found;
|
|
1466 |
}
|
|
1467 |
|
|
1468 |
// ------------------------------------------------------------------------------------------------
|
|
1469 |
// CApplicationManagementServer::FindInstalledJavaUidL()
|
|
1470 |
// ------------------------------------------------------------------------------------------------
|
|
1471 |
|
|
1472 |
TBool CApplicationManagementServer::FindInstalledJavaUidL(const TUid &aUid) const
|
|
1473 |
{
|
|
1474 |
TBool found(EFalse);
|
|
1475 |
iUtility->RefreshJavaRegistryL();
|
|
1476 |
found = iUtility->FindInstalledJavaUidL(aUid);
|
|
1477 |
return found;
|
|
1478 |
}
|
|
1479 |
|
|
1480 |
// ------------------------------------------------------------------------------------------------
|
|
1481 |
// CApplicationManagementServer::FindNewUid()
|
|
1482 |
// ------------------------------------------------------------------------------------------------
|
|
1483 |
|
|
1484 |
TUid CApplicationManagementServer::FindNewUid(const RArray<TUid> &aUidsOrig,
|
|
1485 |
const RArray<TUid> &aUidsNew) const
|
|
1486 |
{
|
|
1487 |
TUid ret(TUid::Null());
|
|
1488 |
TInt c1(aUidsOrig.Count());
|
|
1489 |
TInt c2(aUidsNew.Count());
|
|
1490 |
if (c2 >= c1)
|
|
1491 |
{
|
|
1492 |
for (TInt i(c2 - 1); i >= 0 && !ret.iUid; i--)
|
|
1493 |
{
|
|
1494 |
if (aUidsOrig.Find(aUidsNew[i]) == KErrNotFound)
|
|
1495 |
{
|
|
1496 |
ret = aUidsNew[i];
|
|
1497 |
}
|
|
1498 |
}
|
|
1499 |
}
|
|
1500 |
return ret;
|
|
1501 |
}
|
|
1502 |
|
|
1503 |
// ------------------------------------------------------------------------------------------------
|
|
1504 |
// CApplicationManagementServer::JavaUidsL()
|
|
1505 |
// ------------------------------------------------------------------------------------------------
|
|
1506 |
|
|
1507 |
void CApplicationManagementServer::JavaUidsL(RArray<TUid> &aUids) const
|
|
1508 |
{
|
|
1509 |
iUtility->RefreshJavaRegistryL();
|
|
1510 |
iUtility->JavaUidsL(aUids);
|
|
1511 |
}
|
|
1512 |
|
|
1513 |
void CApplicationManagementServer::CheckforDuplicateMidletsL(
|
|
1514 |
TMidletParameters& amidletParameters)
|
|
1515 |
{
|
|
1516 |
RDEBUG( "CApplicationManagementServer::CheckforDuplicateMidletsL: Start");
|
|
1517 |
const RComponentIdArray &arrt = iStorage->GetComponentIds();
|
|
1518 |
TInt cont(arrt.Count());
|
|
1519 |
for (TInt i( 0); i < cont; i++)
|
|
1520 |
{
|
|
1521 |
CDeploymentComponent &compo = iStorage->ComponentL(arrt[i]);
|
|
1522 |
if (((compo.State() == EDCSActive) || (compo.State() == EDCSInactive ))
|
|
1523 |
&& (compo.MidletName()== amidletParameters.iMidletName)
|
|
1524 |
&& (compo.MidletVendor()== amidletParameters.iMidletVenorName))
|
|
1525 |
{
|
|
1526 |
//remove old one
|
|
1527 |
iStorage->RemoveL(compo.InternalId() );
|
|
1528 |
}
|
|
1529 |
}
|
|
1530 |
|
|
1531 |
RDEBUG( "CApplicationManagementServer::CheckforDuplicateMidletsL: End");
|
|
1532 |
}
|
|
1533 |
// ------------------------------------------------------------------------------------------------
|
|
1534 |
// CApplicationManagementServer::JavaInstallL()
|
|
1535 |
// ------------------------------------------------------------------------------------------------
|
|
1536 |
|
|
1537 |
void CApplicationManagementServer::JavaInstallL(CDeploymentComponent &aCompo)
|
|
1538 |
{
|
|
1539 |
RDEBUG( "CApplicationManagementServer::JavaInstallL: Start");
|
|
1540 |
|
|
1541 |
//TRequestStatus s;
|
|
1542 |
TInt err(KErrNone);
|
|
1543 |
// set state to install progressf
|
|
1544 |
CDialogWait* wait = CDialogWait::NewL();
|
|
1545 |
aCompo.SetStatusNode(EDelivered_InstallProgress);
|
|
1546 |
TRAP(err,InstallL( aCompo,wait->iStatus ));
|
|
1547 |
if (err != KErrNone)
|
|
1548 |
{
|
|
1549 |
aCompo.SetStatusNode(EDelivered_InstalledFailedWithData);
|
|
1550 |
User::Leave(err);
|
|
1551 |
}
|
|
1552 |
wait->StartWait();
|
|
1553 |
if (!CApplicationManagementUtility::iSilentSession && CApplicationManagementUtility::mCurrDlg)
|
|
1554 |
m_Dlg->closeAMWaitDialog();
|
|
1555 |
m_Window->lower();
|
|
1556 |
TRequestStatus s1 = wait->iStatus;
|
|
1557 |
delete wait;
|
|
1558 |
RDEBUG_2( "ApplicationManagementSession: JavaInstallL 1 failed with code %d",
|
|
1559 |
s1.Int() );
|
|
1560 |
|
|
1561 |
TInt usifdeplid = -1;
|
|
1562 |
if (iResults && wait->iStatus.Int()!=KErrCancel)
|
|
1563 |
{
|
|
1564 |
iResults->GetIntByNameL(Usif::KSifOutParam_ComponentId, usifdeplid);
|
|
1565 |
RDEBUG_2( "ApplicationManagementSession: JavaInstallL usifdeplid %d",
|
|
1566 |
usifdeplid);
|
|
1567 |
|
|
1568 |
}
|
|
1569 |
RDEBUG( "wait->StartWait() CApplicationManagementServer::javainstallL Step3");
|
|
1570 |
|
|
1571 |
aCompo.SetComponentId(usifdeplid);
|
|
1572 |
|
|
1573 |
s1 = wait->iStatus;
|
|
1574 |
delete wait;
|
|
1575 |
RDEBUG_2("ApplicationManagementSession: javainstallL with code %d",
|
|
1576 |
s1.Int() );
|
|
1577 |
if (s1 == KErrCancel)
|
|
1578 |
{
|
|
1579 |
RDEBUG_2( "ApplicationManagementSession: JavaInstallL failed with code %d",
|
|
1580 |
s1.Int() );
|
|
1581 |
// set state to install failed with data
|
|
1582 |
aCompo.SetStatusNode(EDelivered_InstalledFailedWithData);
|
|
1583 |
User::Leave(s1.Int());
|
|
1584 |
}
|
|
1585 |
else
|
|
1586 |
{
|
|
1587 |
TMidletParameters midletParameters;
|
|
1588 |
iUtility->RefreshJavaRegistryL();
|
|
1589 |
//Ignore if any error comes
|
|
1590 |
TRAPD(err,iUtility->GetInstalledMidletParametersL(midletParameters));
|
|
1591 |
TRAP(err,CheckforDuplicateMidletsL(midletParameters));
|
|
1592 |
|
|
1593 |
if (err != KErrNone)
|
|
1594 |
{
|
|
1595 |
aCompo.SetStatusNode(EDelivered_InstalledFailedWithData);
|
|
1596 |
User::Leave(err);
|
|
1597 |
}
|
|
1598 |
else
|
|
1599 |
{
|
|
1600 |
aCompo.SetStatusNode(EIdle);
|
|
1601 |
}
|
|
1602 |
aCompo.SetUid(midletParameters.iMidletUid);
|
|
1603 |
|
|
1604 |
RDEBUG( "CApplicationManagementServer::JavaInstallL: Step1");
|
|
1605 |
if (aCompo.ComponentVersion() == KNullDesC8)
|
|
1606 |
{
|
|
1607 |
aCompo.SetVersionL(midletParameters.bufVersion);
|
|
1608 |
|
|
1609 |
}
|
|
1610 |
|
|
1611 |
TBool status = EFalse;
|
|
1612 |
|
|
1613 |
//Since "C" drive is not removable
|
|
1614 |
|
|
1615 |
if (midletParameters.iDrive != EDriveC)
|
|
1616 |
{
|
|
1617 |
status = IsInstalledAppRemovableL(midletParameters.iDrive);
|
|
1618 |
}
|
|
1619 |
if (status)
|
|
1620 |
{
|
|
1621 |
RDEBUG( "IsInstalledAppRemovableL(midletParameters.iDrive); True");
|
|
1622 |
}
|
|
1623 |
else
|
|
1624 |
{
|
|
1625 |
RDEBUG( "IsInstalledAppRemovableL(midletParameters.iDrive); False");
|
|
1626 |
}
|
|
1627 |
|
|
1628 |
//check for status drive
|
|
1629 |
aCompo.SetAppRemovableStatus(status);
|
|
1630 |
}
|
|
1631 |
|
|
1632 |
RDEBUG( "CApplicationManagementServer::JavaInstallL: End");
|
|
1633 |
}
|
|
1634 |
|
|
1635 |
// ------------------------------------------------------------------------------------------------
|
|
1636 |
// CApplicationManagementServer::SisInstallL()
|
|
1637 |
// ------------------------------------------------------------------------------------------------
|
|
1638 |
|
|
1639 |
void CApplicationManagementServer::SisInstallL(
|
|
1640 |
const CDeploymentComponent &aCompo)
|
|
1641 |
{
|
|
1642 |
TRequestStatus s;
|
|
1643 |
CDialogWait* wait = CDialogWait::NewL();
|
|
1644 |
// set state to install progress
|
|
1645 |
aCompo.SetStatusNode(EDelivered_InstallProgress);
|
|
1646 |
TInt err(KErrNone);
|
|
1647 |
TRAP(err,InstallL( aCompo,wait->iStatus ));
|
|
1648 |
if (err != KErrNone)
|
|
1649 |
{
|
|
1650 |
aCompo.SetStatusNode(EDelivered_InstalledFailedWithData);
|
|
1651 |
User::Leave(err);
|
|
1652 |
}
|
|
1653 |
RDEBUG_2("ApplicationManagementSession: SisInstallL failed with code before startwait %d",
|
|
1654 |
wait->iStatus.Int() );
|
|
1655 |
wait->StartWait();
|
|
1656 |
RDEBUG_2("ApplicationManagementSession: SisInstallL failed with code after startwait %d",
|
|
1657 |
wait->iStatus.Int() );
|
|
1658 |
RDEBUG( "wait->StartWait() CApplicationManagementServer::SisInstallL Step1");
|
|
1659 |
if (!CApplicationManagementUtility::iSilentSession && CApplicationManagementUtility::mCurrDlg)
|
|
1660 |
m_Dlg->closeAMWaitDialog();
|
|
1661 |
delete m_Dlg;
|
|
1662 |
m_Dlg=NULL;
|
|
1663 |
RDEBUG( "wait->StartWait() CApplicationManagementServer::SisInstallL Step2");
|
|
1664 |
|
|
1665 |
m_Window->lower();
|
|
1666 |
|
|
1667 |
TInt usifdeplid = -1;
|
|
1668 |
if (iResults && wait->iStatus.Int()!=KErrCancel)
|
|
1669 |
iResults->GetIntByNameL(Usif::KSifOutParam_ComponentId, usifdeplid);
|
|
1670 |
|
|
1671 |
RDEBUG( "wait->StartWait() CApplicationManagementServer::SisInstallL Step3");
|
|
1672 |
|
|
1673 |
iComp->SetComponentId(usifdeplid);
|
|
1674 |
|
|
1675 |
TRequestStatus s1 = wait->iStatus;
|
|
1676 |
delete wait;
|
|
1677 |
RDEBUG_2("ApplicationManagementSession: SisInstallL with code %d",
|
|
1678 |
s1.Int() );
|
|
1679 |
|
|
1680 |
if(s1 == KErrCancel)
|
|
1681 |
{
|
|
1682 |
s1 = KStatusUserCancelled;
|
|
1683 |
RDEBUG( "KErrCancel visited operation cancelled");
|
|
1684 |
mUserCancelled=1;
|
|
1685 |
}
|
|
1686 |
if (s1 != KErrNone)
|
|
1687 |
{
|
|
1688 |
RDEBUG_2("ApplicationManagementSession: SisInstallL failed with code %d",
|
|
1689 |
s1.Int() );
|
|
1690 |
// set state to install failed with data
|
|
1691 |
aCompo.SetStatusNode(EDelivered_InstalledFailedWithData);
|
|
1692 |
User::Leave(s1.Int());
|
|
1693 |
}
|
|
1694 |
else
|
|
1695 |
{
|
|
1696 |
// set state to install sucessful
|
|
1697 |
aCompo.SetStatusNode(EIdle);
|
|
1698 |
RDEBUG("ApplicationManagementSession: SisInstallL successfull" );
|
|
1699 |
}
|
|
1700 |
RDEBUG( "CApplicationManagementServer::SisInstallL: End");
|
|
1701 |
}
|
|
1702 |
|
|
1703 |
// ------------------------------------------------------------------------------------------------
|
|
1704 |
// CApplicationManagementServer::DoTheInstallL()
|
|
1705 |
// ---------------------------------------------------- --------------------------------------------
|
|
1706 |
|
|
1707 |
void CApplicationManagementServer::DoTheInstallL(CDeploymentComponent &aCompo)
|
|
1708 |
{
|
|
1709 |
RDEBUG( "CApplicationManagementServer::DoTheInstallL: Start");
|
|
1710 |
TInt error(KErrNone);
|
|
1711 |
iComp = &aCompo;
|
|
1712 |
|
|
1713 |
TDeploymentComponentName name = aCompo.ComponentName();
|
|
1714 |
if(name.Compare(KNullDesC8())==0)
|
|
1715 |
{
|
|
1716 |
name = aCompo.UserId();
|
|
1717 |
}
|
|
1718 |
TBuf<KDeploymentComponentNameMaxLength> nameBuf;
|
|
1719 |
nameBuf.Copy(name);
|
|
1720 |
m_appName = QString::fromUtf16(nameBuf.Ptr(), nameBuf.Length());
|
|
1721 |
|
|
1722 |
TRequestStatus stat = KErrCompletion;
|
|
1723 |
if (!aCompo.DriveSelected()
|
|
1724 |
&& !CApplicationManagementUtility::iSilentSession)
|
|
1725 |
{
|
|
1726 |
// displaying install confirm notes
|
|
1727 |
CDialogWait* ao = CDialogWait::NewL();
|
|
1728 |
AppMgmtNotifier* note = new AppMgmtNotifier();
|
|
1729 |
int err = KErrNone;
|
|
1730 |
TRAP( err, QT_TRYCATCH_LEAVING(note->showInstallDialog(iComp, ao->iStatus)));
|
|
1731 |
ao->StartWait();
|
|
1732 |
stat = ao->iStatus;
|
|
1733 |
delete ao;
|
|
1734 |
m_Window->lower();
|
|
1735 |
delete note;
|
|
1736 |
}
|
|
1737 |
aCompo.SetDriveSelectionStatus(false);
|
|
1738 |
if (stat == KErrCompletion)
|
|
1739 |
{
|
|
1740 |
if (CDeploymentComponent::IsJavaMimeL(aCompo.Data().MimeType())
|
|
1741 |
|| CDeploymentComponent::IsJavaMimeL(
|
|
1742 |
aCompo.MetaData().MimeType()))
|
|
1743 |
{
|
|
1744 |
TRAP( error, JavaInstallL( aCompo ) );
|
|
1745 |
}
|
|
1746 |
else
|
|
1747 |
{
|
|
1748 |
TRAP( error, SisInstallL( aCompo ) );
|
|
1749 |
if(error==KErrNone)
|
|
1750 |
{
|
|
1751 |
SetSisAppVersionAndDriveL(aCompo);
|
|
1752 |
}
|
|
1753 |
}
|
|
1754 |
|
|
1755 |
|
|
1756 |
|
|
1757 |
if (error == KErrNone)
|
|
1758 |
{
|
|
1759 |
InstallCompleteL(aCompo, ETrue);
|
|
1760 |
CDeploymentComponent *old = DoDataUpdateCheckL(aCompo);
|
|
1761 |
if (old)
|
|
1762 |
{
|
|
1763 |
if (aCompo.State() == EDCSDelivered)
|
|
1764 |
{
|
|
1765 |
if (old->State() == EDCSActive || old->State()
|
|
1766 |
== EDCSInactive)
|
|
1767 |
{
|
|
1768 |
RDEBUG("AMSession: DoTheInstallL ** deleting old node **" );
|
|
1769 |
iStorage->RemoveL(old->InternalId());
|
|
1770 |
}
|
|
1771 |
}
|
|
1772 |
}
|
|
1773 |
iStorage->InstalledL(aCompo);
|
|
1774 |
}
|
|
1775 |
else
|
|
1776 |
{
|
|
1777 |
InstallCompleteL(aCompo, EFalse);
|
|
1778 |
User::Leave(error);
|
|
1779 |
}
|
|
1780 |
}
|
|
1781 |
else
|
|
1782 |
{
|
|
1783 |
aCompo.SetStatusNode(EDelivered_InstallFailedwithOutData);
|
|
1784 |
}
|
|
1785 |
|
|
1786 |
RDEBUG( "CApplicationManagementServer::DoTheInstallL: End");
|
|
1787 |
}
|
|
1788 |
|
|
1789 |
// ------------------------------------------------------------------------------------------------
|
|
1790 |
// CApplicationManagementServer::DoDataUpdateCheckL()
|
|
1791 |
// ------------------------------------------------------------------------------------------------
|
|
1792 |
|
|
1793 |
CDeploymentComponent *CApplicationManagementServer::DoDataUpdateCheckL(
|
|
1794 |
CDeploymentComponent &aCompo)
|
|
1795 |
{
|
|
1796 |
CDeploymentComponent *old = NULL;
|
|
1797 |
if (aCompo.Uid() != TUid::Null() && HasUidL(aCompo.Uid(), old, &aCompo))
|
|
1798 |
{
|
|
1799 |
// check for Uid component.. Legacy code removed.
|
|
1800 |
}
|
|
1801 |
return old;
|
|
1802 |
}
|
|
1803 |
|
|
1804 |
// ------------------------------------------------------------------------------------------------
|
|
1805 |
// CApplicationManagementServer::SetDataL()
|
|
1806 |
// ------------------------------------------------------------------------------------------------
|
|
1807 |
|
|
1808 |
void CApplicationManagementServer::SetDataL(CDeploymentComponent &aCompo,
|
|
1809 |
const TDesC8 &aData, const TDesC8 &aMime)
|
|
1810 |
{
|
|
1811 |
aCompo.SetDataL(aData, aMime);
|
|
1812 |
DoDataUpdateCheckL(aCompo);
|
|
1813 |
}
|
|
1814 |
|
|
1815 |
// ------------------------------------------------------------------------------------------------
|
|
1816 |
// CApplicationManagementServer::FullUpdateL()
|
|
1817 |
// ------------------------------------------------------------------------------------------------
|
|
1818 |
|
|
1819 |
void CApplicationManagementServer::FullUpdateL(const TUint32 sid,
|
|
1820 |
const TUint32 tid)
|
|
1821 |
{
|
|
1822 |
CDeploymentComponent &scompo = iStorage->ComponentL(sid);
|
|
1823 |
CDeploymentComponent &tcompo = iStorage->ComponentL(tid);
|
|
1824 |
FullUpdateL(scompo, tcompo);
|
|
1825 |
}
|
|
1826 |
|
|
1827 |
// ------------------------------------------------------------------------------------------------
|
|
1828 |
// CApplicationManagementServer::FullUpdateL()
|
|
1829 |
// ------------------------------------------------------------------------------------------------
|
|
1830 |
|
|
1831 |
void CApplicationManagementServer::FullUpdateL(CDeploymentComponent &scompo,
|
|
1832 |
const CDeploymentComponent &tcompo)
|
|
1833 |
{
|
|
1834 |
if (scompo.State() == EDCSDelivered)
|
|
1835 |
{
|
|
1836 |
if (tcompo.State() == EDCSActive || tcompo.State() == EDCSInactive)
|
|
1837 |
{
|
|
1838 |
TRequestStatus s2;
|
|
1839 |
InstallL(scompo, s2);
|
|
1840 |
User::WaitForRequest(s2);
|
|
1841 |
if (s2 != KErrNone)
|
|
1842 |
{
|
|
1843 |
RDEBUG_2( "ApplicationManagementSession: FullUpdateL failed with code %d", s2.Int() );
|
|
1844 |
User::Leave(s2.Int());
|
|
1845 |
}
|
|
1846 |
else
|
|
1847 |
{
|
|
1848 |
InstallCompleteL(scompo);
|
|
1849 |
// Before deleting old node ,copy node values which are not set in new node from old node
|
|
1850 |
if (scompo.ComponentId() == KNullDesC8)
|
|
1851 |
scompo.SetIdL(tcompo.ComponentId());
|
|
1852 |
|
|
1853 |
if (scompo.ComponentName() == KNullDesC8)
|
|
1854 |
scompo.SetNameL(tcompo.ComponentName());
|
|
1855 |
|
|
1856 |
if (scompo.ComponentVersion() == KNullDesC8)
|
|
1857 |
scompo.SetVersionL(tcompo.ComponentVersion());
|
|
1858 |
|
|
1859 |
//Tag tcompo state for deletion. Cant delete now, since nsmldmtree woudnt be updated
|
|
1860 |
//Remove the const'ness since state needs to be updated.
|
|
1861 |
|
|
1862 |
iStorage->SetDeploymentComponentState(
|
|
1863 |
const_cast<CDeploymentComponent &> (tcompo),
|
|
1864 |
EDCSDelete);
|
|
1865 |
|
|
1866 |
iStorage->InstalledL(scompo);
|
|
1867 |
RDEBUG( "ApplicationManagementSession: FullUpdateL ok" );
|
|
1868 |
}
|
|
1869 |
}
|
|
1870 |
else
|
|
1871 |
{
|
|
1872 |
RDEBUG_2( "ApplicationManagementSession: ERROR FullUpdateL called for illegal state component: %d!", scompo.State() );
|
|
1873 |
User::Leave(KErrArgument);
|
|
1874 |
}
|
|
1875 |
}
|
|
1876 |
else
|
|
1877 |
{
|
|
1878 |
RDEBUG( "ApplicationManagementSession: ERROR FullUpdateL called for illegal state message!" );
|
|
1879 |
User::Leave(KErrArgument);
|
|
1880 |
}
|
|
1881 |
}
|
|
1882 |
|
|
1883 |
// -------------------------------------------------------------------------------------------------------------------
|
|
1884 |
// CApplicationManagementServer::IsDataFileB64EncodedL()
|
|
1885 |
// -------------------------------------------------------------------------------------------------------------------
|
|
1886 |
TBool CApplicationManagementServer::IsDataFileB64EncodedL(RFile &aFile,
|
|
1887 |
TInt& aLength)
|
|
1888 |
{
|
|
1889 |
RDEBUG("CApplicationManagementServer::IsDataFileB64EncodedL() : start");
|
|
1890 |
TBool encoded = ETrue; // assume b64 encoded
|
|
1891 |
TInt bufSize(KBase64BufSize);
|
|
1892 |
TInt offset(0);
|
|
1893 |
HBufC8 *dataBuf = HBufC8::NewLC(bufSize);
|
|
1894 |
TPtr8 dataPtr = dataBuf->Des();
|
|
1895 |
aFile.Size(aLength);
|
|
1896 |
aFile.Seek(ESeekStart, offset);
|
|
1897 |
|
|
1898 |
while (encoded)
|
|
1899 |
{
|
|
1900 |
aFile.Read(dataPtr);
|
|
1901 |
if (!dataPtr.Length())
|
|
1902 |
{
|
|
1903 |
break;
|
|
1904 |
}
|
|
1905 |
offset = 0;
|
|
1906 |
aFile.Seek(ESeekCurrent, offset);
|
|
1907 |
RDEBUG_2("OFFSET: %d", offset);
|
|
1908 |
encoded = CheckB64Encode(dataPtr);
|
|
1909 |
}
|
|
1910 |
RDEBUG_2("Encoded: %d", encoded);
|
|
1911 |
CleanupStack::PopAndDestroy(dataBuf);
|
|
1912 |
offset = 0;
|
|
1913 |
aFile.Seek(ESeekStart, offset);
|
|
1914 |
|
|
1915 |
RDEBUG("CApplicationManagementServer::IsDataFileB64EncodedL() : end");
|
|
1916 |
return encoded;
|
|
1917 |
}
|
|
1918 |
|
|
1919 |
// -------------------------------------------------------------------------------------------------------------------
|
|
1920 |
// CApplicationManagementServer::CheckB64Encode( const TDesC8& aData )
|
|
1921 |
// -------------------------------------------------------------------------------------------------------------------
|
|
1922 |
TBool CApplicationManagementServer::CheckB64Encode(const TDesC8& aData)
|
|
1923 |
{
|
|
1924 |
TInt inputIndex = 0;
|
|
1925 |
TInt inputLen = aData.Length();
|
|
1926 |
|
|
1927 |
while (inputIndex < inputLen)
|
|
1928 |
{
|
|
1929 |
const TUint8& p = aData[inputIndex];
|
|
1930 |
|
|
1931 |
if ((p >= 48 && p <= 57) || (p >= 65 && p <= 90) || (p >= 97 && p
|
|
1932 |
<= 122) || p == 43 || p == 47 || p == 61 || p == 10 || p
|
|
1933 |
== 13)
|
|
1934 |
{
|
|
1935 |
}
|
|
1936 |
else
|
|
1937 |
{
|
|
1938 |
return EFalse;
|
|
1939 |
}
|
|
1940 |
|
|
1941 |
inputIndex++;
|
|
1942 |
|
|
1943 |
}
|
|
1944 |
|
|
1945 |
return ETrue;
|
|
1946 |
}
|
|
1947 |
|
|
1948 |
// ------------------------------------------------------------------------------------------------
|
|
1949 |
// CApplicationManagementServer::GetAMServerDownloadDBL()
|
|
1950 |
// ------------------------------------------------------------------------------------------------
|
|
1951 |
|
|
1952 |
void CApplicationManagementServer::GetAMServerDownloadDBL(TUint32 internalid,
|
|
1953 |
TInt& finalresult, TDes8& aTargetURI)
|
|
1954 |
{
|
|
1955 |
RDEBUG( "CApplicationManagementServer::GetAMServerDownloadDBL(): Step1" );
|
|
1956 |
|
|
1957 |
TBuf<50> internalidbuf;
|
|
1958 |
|
|
1959 |
RDEBUG( "CApplicationManagementServer::GetAMServerDownloadDBL(): Step2" );
|
|
1960 |
internalidbuf.Num(internalid);
|
|
1961 |
|
|
1962 |
RDEBUG( "CApplicationManagementServer::GetAMServerDownloadDBL(): Step3" );
|
|
1963 |
|
|
1964 |
RPointerArray<CAMDbItem> aItemArray;
|
|
1965 |
|
|
1966 |
RDEBUG( "CApplicationManagementServer::GetAMServerDownloadDBL(): Step4" );
|
|
1967 |
|
|
1968 |
iAMServerDB->GetEntryForLUIDL(aItemArray, internalidbuf);
|
|
1969 |
|
|
1970 |
RDEBUG( "CApplicationManagementServer::GetAMServerDownloadDBL(): Step5" );
|
|
1971 |
|
|
1972 |
if (aItemArray.Count() != 0)
|
|
1973 |
{
|
|
1974 |
RDEBUG( "CApplicationManagementServer::GetAMServerDownloadDBL(): Step6" );
|
|
1975 |
|
|
1976 |
finalresult = aItemArray[0]->iResult;
|
|
1977 |
|
|
1978 |
RDEBUG( "CApplicationManagementServer::GetAMServerDownloadDBL(): Step7" );
|
|
1979 |
|
|
1980 |
if (finalresult < KErrNone)
|
|
1981 |
User::Leave(KErrGeneral);
|
|
1982 |
|
|
1983 |
RDEBUG( "CApplicationManagementServer::GetAMServerDownloadDBL(): Step8" );
|
|
1984 |
|
|
1985 |
if (*aItemArray[0]->iTargetURI == KNullDesC8())
|
|
1986 |
User::Leave(KErrGeneral);
|
|
1987 |
|
|
1988 |
RDEBUG( "CApplicationManagementServer::GetAMServerDownloadDBL(): Step9" );
|
|
1989 |
aTargetURI.Copy(*aItemArray[0]->iTargetURI);
|
|
1990 |
|
|
1991 |
}
|
|
1992 |
RDEBUG( "CApplicationManagementServer::GetAMServerDownloadDBL(): Step10" );
|
|
1993 |
aItemArray.ResetAndDestroy();
|
|
1994 |
|
|
1995 |
}
|
|
1996 |
|
|
1997 |
// ------------------------------------------------------------------------------------------------
|
|
1998 |
// CApplicationManagementServer::DeleteGenericAlertForIDL()
|
|
1999 |
// ------------------------------------------------------------------------------------------------
|
|
2000 |
|
|
2001 |
void CApplicationManagementServer::DeleteGenericAlertForIDL(
|
|
2002 |
TUint32 internalid)
|
|
2003 |
{
|
|
2004 |
iAMServerDB->DeleteFromDatabaseL(internalid);
|
|
2005 |
}
|
|
2006 |
|
|
2007 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2008 |
// CApplicationManagementServer::DecodeB64DataFileL( RFile& aDataFile, RFile& aDestinationFile )
|
|
2009 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2010 |
void CApplicationManagementServer::DecodeB64DataFileL(RFile& aSourceFile,
|
|
2011 |
RFile& aDestinationFile)
|
|
2012 |
{
|
|
2013 |
RDEBUG( "CApplicationManagementServer::DecodeB64DataFileL(): Start" );
|
|
2014 |
// Create buffers
|
|
2015 |
//TInt b64bufferSize = 131072;
|
|
2016 |
TInt decodedBufferSize = ((KBase64BufSize * 3) / 4 + 16);
|
|
2017 |
HBufC8 *dataBuf = HBufC8::NewLC(KBase64BufSize);
|
|
2018 |
TPtr8 dataPtr = dataBuf->Des();
|
|
2019 |
HBufC8* targetBuf = HBufC8::NewLC(decodedBufferSize);
|
|
2020 |
TPtr8 targetPtr(targetBuf->Des());
|
|
2021 |
|
|
2022 |
TInt offset(0);
|
|
2023 |
TInt length(0);
|
|
2024 |
TBool reading(ETrue);
|
|
2025 |
aSourceFile.Size(length);
|
|
2026 |
RDEBUG_2( "CApplicationManagementServer::DecodeB64DataFileL(): b64 file total size: (%d)", length );
|
|
2027 |
aSourceFile.Seek(ESeekStart, offset);
|
|
2028 |
|
|
2029 |
// Initialize decoder
|
|
2030 |
TImCodecB64 B64Coder;
|
|
2031 |
B64Coder.Initialise();
|
|
2032 |
|
|
2033 |
while (reading)
|
|
2034 |
{
|
|
2035 |
aSourceFile.Read(dataPtr);
|
|
2036 |
if (!dataPtr.Length())
|
|
2037 |
{
|
|
2038 |
// EOF
|
|
2039 |
break;
|
|
2040 |
}
|
|
2041 |
offset = 0;
|
|
2042 |
aSourceFile.Seek(ESeekCurrent, offset);
|
|
2043 |
RDEBUG_2("OFFSET: %d", offset);
|
|
2044 |
|
|
2045 |
// decode data
|
|
2046 |
B64Coder.Decode(dataPtr, targetPtr);
|
|
2047 |
// write decoded data to temporary file
|
|
2048 |
aDestinationFile.Write(targetPtr);
|
|
2049 |
}
|
|
2050 |
CleanupStack::PopAndDestroy(targetBuf);
|
|
2051 |
CleanupStack::PopAndDestroy(dataBuf);
|
|
2052 |
|
|
2053 |
offset = 0;
|
|
2054 |
aDestinationFile.Seek(ESeekStart, offset);
|
|
2055 |
RDEBUG( "CApplicationManagementServer::DecodeB64DataFileL(): end" );
|
|
2056 |
}
|
|
2057 |
|
|
2058 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2059 |
// CApplicationManagementServer::DecodeB64DataLC( const TDesC8& aData )
|
|
2060 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2061 |
HBufC8* CApplicationManagementServer::DecodeB64DataLC(const TDesC8 &aData)
|
|
2062 |
{
|
|
2063 |
RDEBUG( "CApplicationManagementServer::DecodeB64DataLC(): Start" );
|
|
2064 |
TImCodecB64 B64Coder;
|
|
2065 |
B64Coder.Initialise();
|
|
2066 |
HBufC8 *target = HBufC8::NewLC((aData.Length() * 3) / 4 + 16);
|
|
2067 |
TPtr8 targetPtr(target->Des());
|
|
2068 |
B64Coder.Decode(aData, targetPtr);
|
|
2069 |
RDEBUG( "CApplicationManagementServer::DecodeB64DataLC(): End" );
|
|
2070 |
return target;
|
|
2071 |
}
|
|
2072 |
|
|
2073 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2074 |
// CApplicationManagementServer::EncodeDataL( const TDesC8& aData, CBufBase &aTarget )
|
|
2075 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2076 |
void CApplicationManagementServer::EncodeDataL(const TDesC8& aData,
|
|
2077 |
CBufBase &aTarget)
|
|
2078 |
{
|
|
2079 |
TInt outLen(aData.Length() * 2);
|
|
2080 |
aTarget.ExpandL(0, outLen);
|
|
2081 |
TImCodecB64 B64Coder;
|
|
2082 |
B64Coder.Initialise();
|
|
2083 |
TPtr8 target(aTarget.Ptr(0));
|
|
2084 |
TInt decoded(B64Coder.Encode(aData, target));
|
|
2085 |
TInt s(target.Length());
|
|
2086 |
aTarget.ResizeL(s);
|
|
2087 |
aTarget.Compress();
|
|
2088 |
if (!decoded)
|
|
2089 |
{
|
|
2090 |
RDEBUG( "CApplicationManagementServer::EncodeDataL(): Encoding b64 failed?" );
|
|
2091 |
}
|
|
2092 |
}
|
|
2093 |
|
|
2094 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2095 |
// CApplicationManagementSession::CApplicationManagementSession
|
|
2096 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2097 |
inline CApplicationManagementSession::CApplicationManagementSession()
|
|
2098 |
{
|
|
2099 |
RDEBUG_2( "CApplicationManagementSession::CApplicationManagementSession 0x%x", this);
|
|
2100 |
}
|
|
2101 |
|
|
2102 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2103 |
// CApplicationManagementSession::CApplicationManagementSession
|
|
2104 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2105 |
|
|
2106 |
inline CApplicationManagementSession::CApplicationManagementSession(
|
|
2107 |
const TCertInfo &aInfo) :
|
|
2108 |
iCertInfo(aInfo)
|
|
2109 |
{
|
|
2110 |
RDEBUG( "CApplicationManagementSession::CApplicationManagementSession (cert) " );
|
|
2111 |
}
|
|
2112 |
|
|
2113 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2114 |
// CApplicationManagementSession::Server()
|
|
2115 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2116 |
|
|
2117 |
inline CApplicationManagementServer& CApplicationManagementSession::Server() const
|
|
2118 |
{
|
|
2119 |
return *static_cast<CApplicationManagementServer*> (const_cast<CServer2*> (CSession2::Server()));
|
|
2120 |
}
|
|
2121 |
|
|
2122 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2123 |
// CApplicationManagementSession::CreateL()
|
|
2124 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2125 |
// 2nd phase construct for sessions - called by the CServer framework
|
|
2126 |
|
|
2127 |
void CApplicationManagementSession::CreateL()
|
|
2128 |
{
|
|
2129 |
RDEBUG_2( "ApplicationManagementSession: CApplicationManagementSession::CreateL: 0x%x", this );
|
|
2130 |
|
|
2131 |
Server().AddSession();
|
|
2132 |
}
|
|
2133 |
|
|
2134 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2135 |
// CApplicationManagementSession::~CApplicationManagementSession()
|
|
2136 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2137 |
|
|
2138 |
CApplicationManagementSession::~CApplicationManagementSession()
|
|
2139 |
{
|
|
2140 |
RDEBUG_3("CApplicationManagementSession::~CApplicationManagementSession 0x%X - 0x%X", reinterpret_cast<TUint>(this),
|
|
2141 |
reinterpret_cast<TUint>(this)+sizeof( CApplicationManagementSession ) );
|
|
2142 |
RDEBUG_2("CApplicationManagementSession::~CApplicationManagementSession iCertInfo offs 0x%X",
|
|
2143 |
reinterpret_cast<TUint>(&this->iCertInfo) - reinterpret_cast<TUint>(this) );
|
|
2144 |
|
|
2145 |
Server().DropSession();
|
|
2146 |
}
|
|
2147 |
|
|
2148 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2149 |
// CApplicationManagementSession::ServiceL()
|
|
2150 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2151 |
|
|
2152 |
void CApplicationManagementSession::ServiceL(const RMessage2& aMessage)
|
|
2153 |
{
|
|
2154 |
if (aMessage.Function() == EPerformRfs)
|
|
2155 |
{
|
|
2156 |
TRAPD( err, Server().PerformRFSL() );
|
|
2157 |
aMessage.Complete(err);
|
|
2158 |
}
|
|
2159 |
else
|
|
2160 |
{
|
|
2161 |
TBool handled(EFalse);
|
|
2162 |
TInt err(KErrNone);
|
|
2163 |
TRAP( err, handled = PreDispatchMessageL( aMessage ) );
|
|
2164 |
if (!handled)
|
|
2165 |
{
|
|
2166 |
TRAP(err,DispatchMessageL(aMessage));
|
|
2167 |
}
|
|
2168 |
|
|
2169 |
// Some of the functions contains operations that already complete message
|
|
2170 |
// doing Complete() twice will cause panic
|
|
2171 |
if (aMessage.Handle())
|
|
2172 |
{
|
|
2173 |
aMessage.Complete(err);
|
|
2174 |
}
|
|
2175 |
}
|
|
2176 |
}
|
|
2177 |
|
|
2178 |
// CApplicationManagementSession::PreDispatchMessageL()
|
|
2179 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2180 |
|
|
2181 |
TBool CApplicationManagementSession::PreDispatchMessageL(
|
|
2182 |
const RMessage2 &aMessage)
|
|
2183 |
{
|
|
2184 |
TBool ret(EFalse);
|
|
2185 |
// These succeed regardless of certificate....
|
|
2186 |
switch (aMessage.Function())
|
|
2187 |
{
|
|
2188 |
case EGetStateChangingIdsCountOperation:
|
|
2189 |
{
|
|
2190 |
// gets count of items list of ids that are potentially changing state
|
|
2191 |
StateChangeComponentIdsCountL(aMessage);
|
|
2192 |
ret = ETrue;
|
|
2193 |
break;
|
|
2194 |
}
|
|
2195 |
case EGetStateChangingIdsOperation:
|
|
2196 |
{
|
|
2197 |
// gets list of ids that are potentially changing state
|
|
2198 |
StateChangeComponentIdsL(aMessage);
|
|
2199 |
ret = ETrue;
|
|
2200 |
break;
|
|
2201 |
}
|
|
2202 |
case ECompleteStateChangeOperation: // completes change of state
|
|
2203 |
{
|
|
2204 |
StateChangeCompleteL(aMessage);
|
|
2205 |
ret = ETrue;
|
|
2206 |
break;
|
|
2207 |
}
|
|
2208 |
default:
|
|
2209 |
{
|
|
2210 |
break;
|
|
2211 |
}
|
|
2212 |
}
|
|
2213 |
return ret;
|
|
2214 |
}
|
|
2215 |
|
|
2216 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2217 |
// CApplicationManagementSession::DispatchMessageL()
|
|
2218 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2219 |
|
|
2220 |
void CApplicationManagementSession::DispatchMessageL(
|
|
2221 |
const RMessage2& aMessage)
|
|
2222 |
{
|
|
2223 |
RDEBUG_2( "CApplicationManagementSession::DispatchMessageL; %d" ,
|
|
2224 |
aMessage.Function() );
|
|
2225 |
|
|
2226 |
TBool go(EFalse);
|
|
2227 |
if (iTrustAdded)
|
|
2228 |
{
|
|
2229 |
go = Server().CheckCertL(iCertInfo);
|
|
2230 |
}
|
|
2231 |
else
|
|
2232 |
{
|
|
2233 |
go = ETrue;
|
|
2234 |
}
|
|
2235 |
|
|
2236 |
if (go)
|
|
2237 |
{
|
|
2238 |
switch (aMessage.Function())
|
|
2239 |
{
|
|
2240 |
case EAddTrust:
|
|
2241 |
{
|
|
2242 |
RDEBUG_2( "CApplicationManagementSession::DispatchMessageL; EAddTrust this=0x%x", this );
|
|
2243 |
AddTrustL(aMessage);
|
|
2244 |
break;
|
|
2245 |
}
|
|
2246 |
case EDeplCompCountOperation:
|
|
2247 |
{
|
|
2248 |
ComponentCountL(aMessage);
|
|
2249 |
return;
|
|
2250 |
}
|
|
2251 |
case EDeplCompIdsOperation:
|
|
2252 |
{
|
|
2253 |
ComponentIdsL(aMessage);
|
|
2254 |
return;
|
|
2255 |
}
|
|
2256 |
case EDeplCompDeliverCompleteOperation:
|
|
2257 |
{
|
|
2258 |
DeliverCompleteL(aMessage);
|
|
2259 |
break;
|
|
2260 |
}
|
|
2261 |
case EDeplCompGetOperation:
|
|
2262 |
{
|
|
2263 |
GetComponentL(aMessage);
|
|
2264 |
break;
|
|
2265 |
}
|
|
2266 |
case EInstallOperation:
|
|
2267 |
{
|
|
2268 |
InstallL(aMessage);
|
|
2269 |
break;
|
|
2270 |
}
|
|
2271 |
case EDeplCompAttrUpdateOperation:
|
|
2272 |
{
|
|
2273 |
UpdateL(aMessage);
|
|
2274 |
break;
|
|
2275 |
}
|
|
2276 |
case EDeplCompGetDataOperation:
|
|
2277 |
{
|
|
2278 |
GetDataL(aMessage);
|
|
2279 |
break;
|
|
2280 |
}
|
|
2281 |
case EDeplCompGetDataLengthOperation:
|
|
2282 |
{
|
|
2283 |
GetDataLengthL(aMessage);
|
|
2284 |
break;
|
|
2285 |
}
|
|
2286 |
case EDeplCompRemoveOperation:
|
|
2287 |
{
|
|
2288 |
RemoveL(aMessage);
|
|
2289 |
break;
|
|
2290 |
}
|
|
2291 |
case EDeplCompDeliverStartOperation2:
|
|
2292 |
{
|
|
2293 |
Deliver2L(aMessage);
|
|
2294 |
break;
|
|
2295 |
}
|
|
2296 |
case EDeplCompUpdateDataOperation:
|
|
2297 |
{
|
|
2298 |
UpdateDataL(aMessage);
|
|
2299 |
break;
|
|
2300 |
}
|
|
2301 |
case EDeplCompUpdateStreamedDataOperation:
|
|
2302 |
{
|
|
2303 |
UpdateStreamedDataL(aMessage);
|
|
2304 |
break;
|
|
2305 |
}
|
|
2306 |
case EDeplCompDownloadOperation:
|
|
2307 |
{
|
|
2308 |
DownloadL(aMessage);
|
|
2309 |
break;
|
|
2310 |
}
|
|
2311 |
case EDeplCompUpdateOperation:
|
|
2312 |
{
|
|
2313 |
FullUpdateL(aMessage);
|
|
2314 |
break;
|
|
2315 |
}
|
|
2316 |
case EDeplCompGetUserIdOperation:
|
|
2317 |
{
|
|
2318 |
GetUserIdL(aMessage);
|
|
2319 |
break;
|
|
2320 |
}
|
|
2321 |
case EDeplCompStartDownloadOperation:
|
|
2322 |
{
|
|
2323 |
StartDownloadL(aMessage);
|
|
2324 |
break;
|
|
2325 |
}
|
|
2326 |
case EDeplCompDeactivateOperation:
|
|
2327 |
{
|
|
2328 |
DeactivateL(aMessage);
|
|
2329 |
break;
|
|
2330 |
}
|
|
2331 |
case EDeplCompActivateOperation:
|
|
2332 |
{
|
|
2333 |
ActivateL(aMessage);
|
|
2334 |
break;
|
|
2335 |
}
|
|
2336 |
case EDeplCompGetTemporaryInstFile:
|
|
2337 |
{
|
|
2338 |
GetTemporaryInstFileL(aMessage);
|
|
2339 |
break;
|
|
2340 |
}
|
|
2341 |
|
|
2342 |
case EDeplCompGetFinalResultForGA:
|
|
2343 |
{
|
|
2344 |
GetFinalResultForGAL(aMessage);
|
|
2345 |
break;
|
|
2346 |
|
|
2347 |
}
|
|
2348 |
case EDeplCompGenericAlertSent:
|
|
2349 |
{
|
|
2350 |
GenericAlertSentForIdL(aMessage);
|
|
2351 |
break;
|
|
2352 |
}
|
|
2353 |
case ECheckStatusNodes:
|
|
2354 |
{
|
|
2355 |
CheckStatusNodesValuesL();
|
|
2356 |
break;
|
|
2357 |
}
|
|
2358 |
|
|
2359 |
default:
|
|
2360 |
{
|
|
2361 |
User::Leave(KErrNotSupported);
|
|
2362 |
break;
|
|
2363 |
}
|
|
2364 |
}
|
|
2365 |
}
|
|
2366 |
else
|
|
2367 |
{
|
|
2368 |
RDEBUG_2( "CApplicationManagementSession::DispatchMessageL; Policy prevented action this=0x%x", this );
|
|
2369 |
User::Leave(KErrAccessDenied);
|
|
2370 |
}
|
|
2371 |
}
|
|
2372 |
|
|
2373 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2374 |
// CApplicationManagementSession::GenericAlertSentForIdL()
|
|
2375 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2376 |
|
|
2377 |
void CApplicationManagementSession::GenericAlertSentForIdL(
|
|
2378 |
const RMessage2& aMessage) const
|
|
2379 |
{
|
|
2380 |
TUint32 luid;
|
|
2381 |
TPckg<TUint32> pk(luid);
|
|
2382 |
TInt read(aMessage.Read(0, pk));
|
|
2383 |
|
|
2384 |
Server().DeleteGenericAlertForIDL(luid);
|
|
2385 |
|
|
2386 |
}
|
|
2387 |
|
|
2388 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2389 |
// CApplicationManagementSession::GetFinalResultForGAL()
|
|
2390 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2391 |
|
|
2392 |
void CApplicationManagementSession::GetFinalResultForGAL(
|
|
2393 |
const RMessage2& aMessage)
|
|
2394 |
{
|
|
2395 |
|
|
2396 |
RDEBUG( "CApplicationManagementSession: GetFinalResultForGAL Step 1" );
|
|
2397 |
TUint32 luid;
|
|
2398 |
TPckg<TUint32> pk(luid);
|
|
2399 |
|
|
2400 |
TInt finalresult = KErrNone;
|
|
2401 |
|
|
2402 |
RDEBUG( "CApplicationManagementSession: GetFinalResultForGAL Step 2" );
|
|
2403 |
|
|
2404 |
HBufC8 *targetURI = HBufC8::NewL(512);
|
|
2405 |
TPtr8 ptr = targetURI->Des();
|
|
2406 |
|
|
2407 |
RDEBUG( "CApplicationManagementSession: GetFinalResultForGAL Step 3" );
|
|
2408 |
|
|
2409 |
TInt read(aMessage.Read(0, pk));
|
|
2410 |
|
|
2411 |
RDEBUG( "CApplicationManagementSession: GetFinalResultForGAL Step 4" );
|
|
2412 |
|
|
2413 |
Server().GetAMServerDownloadDBL(luid, finalresult, ptr);
|
|
2414 |
|
|
2415 |
RDEBUG( "CApplicationManagementSession: GetFinalResultForGAL Step 5" );
|
|
2416 |
|
|
2417 |
RDEBUG_2( "ApplicationManagementServer: GetFinalResultForGAL Count is %d", finalresult );
|
|
2418 |
TPckg<TInt> p1(finalresult);
|
|
2419 |
aMessage.WriteL(1, p1);
|
|
2420 |
|
|
2421 |
RDEBUG( "CApplicationManagementSession: GetFinalResultForGAL Step 6" );
|
|
2422 |
aMessage.WriteL(2, ptr);
|
|
2423 |
|
|
2424 |
RDEBUG( "CApplicationManagementSession: GetFinalResultForGAL Step 7" );
|
|
2425 |
if (targetURI)
|
|
2426 |
delete targetURI;
|
|
2427 |
|
|
2428 |
}
|
|
2429 |
|
|
2430 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2431 |
// CApplicationManagementSession::ComponentCountL()
|
|
2432 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2433 |
|
|
2434 |
void CApplicationManagementSession::ComponentCountL(const RMessage2& aMessage)
|
|
2435 |
{
|
|
2436 |
RDEBUG( "CApplicationManagementSession: ComponentCountL" );
|
|
2437 |
TDeploymentComponentState st;
|
|
2438 |
TPckg<TDeploymentComponentState> pk(st);
|
|
2439 |
|
|
2440 |
TInt read(aMessage.Read(1, pk));
|
|
2441 |
RDEBUG_3( "CApplicationManagementSession: ComponentCountL State is %d, read %d", st, read);
|
|
2442 |
|
|
2443 |
const RComponentIdArray &arrt = Server().Storage()->GetComponentIds();
|
|
2444 |
RComponentIdArray arr;
|
|
2445 |
CleanupClosePushL(arr);
|
|
2446 |
if ((st == EDCSActive) || (st == EDCSInactive))
|
|
2447 |
{
|
|
2448 |
ActiveComponentsL(arrt, arr, st);
|
|
2449 |
}
|
|
2450 |
else
|
|
2451 |
{
|
|
2452 |
TInt count(arrt.Count());
|
|
2453 |
for (TInt i(0); i < count; i++)
|
|
2454 |
{
|
|
2455 |
CDeploymentComponent &compo = Server().Storage()->ComponentL(
|
|
2456 |
arrt[i]);
|
|
2457 |
if (st == EDCSNone || compo.State() == st)
|
|
2458 |
{
|
|
2459 |
arr.Append(arrt[i]);
|
|
2460 |
}
|
|
2461 |
}
|
|
2462 |
}
|
|
2463 |
TInt n(arr.Count());
|
|
2464 |
CleanupStack::PopAndDestroy(&arr);
|
|
2465 |
|
|
2466 |
RDEBUG_2( "ApplicationManagementServer: ComponentCountL Count is %d", n );
|
|
2467 |
TPckg<TInt> p(n);
|
|
2468 |
|
|
2469 |
aMessage.WriteL(0, p);
|
|
2470 |
|
|
2471 |
}
|
|
2472 |
|
|
2473 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2474 |
// CApplicationManagementSession::ActiveComponentsL()
|
|
2475 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2476 |
|
|
2477 |
void CApplicationManagementSession::ActiveComponentsL(
|
|
2478 |
const RComponentIdArray &aArrt, RComponentIdArray &aArr,
|
|
2479 |
TDeploymentComponentState &aState) const
|
|
2480 |
{
|
|
2481 |
Swi::RSisRegistrySession sisses;
|
|
2482 |
TInt r(sisses.Connect());
|
|
2483 |
User::LeaveIfError(r);
|
|
2484 |
CleanupClosePushL(sisses);
|
|
2485 |
|
|
2486 |
RArray<TUid> uids;
|
|
2487 |
sisses.InstalledUidsL(uids);
|
|
2488 |
CleanupClosePushL(uids);
|
|
2489 |
TInt cont(aArrt.Count());
|
|
2490 |
TInt uidc(uids.Count());
|
|
2491 |
RArray<TUid> juids;
|
|
2492 |
Server().JavaUidsL(juids);
|
|
2493 |
CleanupClosePushL(juids);
|
|
2494 |
TInt juidc(juids.Count());
|
|
2495 |
RComponentIdArray rem;
|
|
2496 |
CleanupClosePushL(rem);
|
|
2497 |
for (TInt i(0); i < cont; i++)
|
|
2498 |
{
|
|
2499 |
CDeploymentComponent &compo =
|
|
2500 |
Server().Storage()->ComponentL(aArrt[i]);
|
|
2501 |
TDeploymentComponentState state = compo.State();
|
|
2502 |
if (state == aState)
|
|
2503 |
{
|
|
2504 |
TBool add(EFalse);
|
|
2505 |
const TUid &uid(compo.Uid());
|
|
2506 |
for (TInt j(0); add == EFalse && j < uidc; j++)
|
|
2507 |
{
|
|
2508 |
|
|
2509 |
if (uids[j] == uid)
|
|
2510 |
{
|
|
2511 |
RDEBUG( "CApplicationManagementSession::ActiveComponentsL Entered" );
|
|
2512 |
|
|
2513 |
// Check if this registry entry is present
|
|
2514 |
Swi::RSisRegistrySession sisSession;
|
|
2515 |
User::LeaveIfError(sisSession.Connect());
|
|
2516 |
CleanupClosePushL(sisSession);
|
|
2517 |
|
|
2518 |
Swi::RSisRegistryEntry sisEntry;
|
|
2519 |
|
|
2520 |
//Opens the base package entry by specifying a UID.
|
|
2521 |
User::LeaveIfError(sisEntry.Open(sisSession, compo.Uid()));
|
|
2522 |
CleanupClosePushL(sisEntry);
|
|
2523 |
|
|
2524 |
add = sisEntry.IsPresentL();
|
|
2525 |
|
|
2526 |
if (add)
|
|
2527 |
{
|
|
2528 |
// If Present update the Version, name and other info to that deployement component. Since application would have got an update
|
|
2529 |
// by some other means
|
|
2530 |
TVersion version = sisEntry.VersionL();
|
|
2531 |
TBuf8<KVersionLength> pkgDes;
|
|
2532 |
pkgDes.AppendNum(version.iMajor);
|
|
2533 |
pkgDes.Append(KLiteralPeriod);
|
|
2534 |
pkgDes.AppendNum(version.iMinor);
|
|
2535 |
|
|
2536 |
HBufC *packagename = sisEntry.PackageNameL();
|
|
2537 |
TBuf8<512> packagename8;
|
|
2538 |
packagename8.Copy(*packagename);
|
|
2539 |
delete packagename;
|
|
2540 |
|
|
2541 |
compo.SetNameL(packagename8);
|
|
2542 |
compo.SetVersionL(pkgDes);
|
|
2543 |
|
|
2544 |
Server().Storage()->UpdateL(compo);
|
|
2545 |
|
|
2546 |
RDEBUG( "CApplicationManagementSession::ActiveComponentsL ETrue" );
|
|
2547 |
|
|
2548 |
}
|
|
2549 |
else
|
|
2550 |
RDEBUG( "CApplicationManagementSession::ActiveComponentsL EFalse" );
|
|
2551 |
CleanupStack::PopAndDestroy(2, &sisSession);
|
|
2552 |
}
|
|
2553 |
}
|
|
2554 |
if (!add) // go throug java suites
|
|
2555 |
{
|
|
2556 |
for (TInt k(0); add == EFalse && k < juidc; k++)
|
|
2557 |
{
|
|
2558 |
if (juids[k] == uid)
|
|
2559 |
{
|
|
2560 |
add = ETrue;
|
|
2561 |
}
|
|
2562 |
}
|
|
2563 |
}
|
|
2564 |
if (add)
|
|
2565 |
{
|
|
2566 |
aArr.Append(aArrt[i]);
|
|
2567 |
}
|
|
2568 |
else
|
|
2569 |
{
|
|
2570 |
RDEBUG8_3( "ApplicationManagementServer: ActiveComponentCountL skipping 0x%x, %S",
|
|
2571 |
compo.Uid() ,&compo.ComponentId() );
|
|
2572 |
rem.Append(aArrt[i]);
|
|
2573 |
}
|
|
2574 |
}
|
|
2575 |
}
|
|
2576 |
TInt rc(rem.Count());
|
|
2577 |
for (TInt t(0); t < rc; t++)
|
|
2578 |
{
|
|
2579 |
RDEBUG_2( "ApplicationManagementServer: ActiveComponentCountL removing non existing %d", rem[t] );
|
|
2580 |
CDeploymentComponent &compo = Server().Storage()->ComponentL(rem[t]);
|
|
2581 |
if (!compo.AppRemovable())
|
|
2582 |
Server().RemoveInternalL(compo, EFalse);
|
|
2583 |
}
|
|
2584 |
CleanupStack::PopAndDestroy(&rem);
|
|
2585 |
CleanupStack::PopAndDestroy(&juids);
|
|
2586 |
CleanupStack::PopAndDestroy(&uids);
|
|
2587 |
CleanupStack::PopAndDestroy(&sisses);
|
|
2588 |
}
|
|
2589 |
|
|
2590 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2591 |
// CApplicationManagementSession::ComponentIdsL()
|
|
2592 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2593 |
|
|
2594 |
void CApplicationManagementSession::ComponentIdsL(const RMessage2& aMessage) const
|
|
2595 |
{
|
|
2596 |
RDEBUG( "CApplicationManagementSession: ComponentIdsL" );
|
|
2597 |
TDeploymentComponentState st;
|
|
2598 |
TPckg<TDeploymentComponentState> pk(st);
|
|
2599 |
|
|
2600 |
TInt read(aMessage.Read(1, pk));
|
|
2601 |
RDEBUG_3( "CApplicationManagementSession: ComponentIdsL State is %d, read %d", st, read);
|
|
2602 |
|
|
2603 |
const RComponentIdArray &arrt = Server().Storage()->GetComponentIds();
|
|
2604 |
TInt buflen(0);
|
|
2605 |
TUint32* buf = NULL;
|
|
2606 |
if (st == EDCSNone)
|
|
2607 |
{
|
|
2608 |
buflen = arrt.Count();
|
|
2609 |
buf = new (ELeave) TUint32[buflen];
|
|
2610 |
CleanupArrayDeletePushL(buf);
|
|
2611 |
for (TInt i(0); i < buflen; i++)
|
|
2612 |
{
|
|
2613 |
RDEBUG_2("ApplicationManagementSession: ComponentIdsL Adding %d!!", arrt[i]);
|
|
2614 |
buf[i] = arrt[i];
|
|
2615 |
}
|
|
2616 |
}
|
|
2617 |
else
|
|
2618 |
{
|
|
2619 |
RComponentIdArray arr;
|
|
2620 |
if (st == EDCSActive)
|
|
2621 |
{
|
|
2622 |
ActiveComponentsL(arrt, arr, st);
|
|
2623 |
}
|
|
2624 |
else
|
|
2625 |
{
|
|
2626 |
TInt artc(arrt.Count());
|
|
2627 |
for (TInt i(0); i < artc; i++)
|
|
2628 |
{
|
|
2629 |
CDeploymentComponent &compo = Server().Storage()->ComponentL(
|
|
2630 |
arrt[i]);
|
|
2631 |
if (compo.State() == st)
|
|
2632 |
{
|
|
2633 |
arr.Append(arrt[i]);
|
|
2634 |
}
|
|
2635 |
}
|
|
2636 |
}
|
|
2637 |
buflen = arr.Count();
|
|
2638 |
buf = new (ELeave) TUint32[buflen];
|
|
2639 |
CleanupArrayDeletePushL(buf);
|
|
2640 |
|
|
2641 |
TUint32 len(aMessage.GetDesMaxLength(0) / 4);
|
|
2642 |
if (buflen == len)
|
|
2643 |
{
|
|
2644 |
RDEBUG( "CApplicationManagementSession: ComponentIdsL Right count!!" );
|
|
2645 |
}
|
|
2646 |
else
|
|
2647 |
{
|
|
2648 |
RDEBUG_3( "CApplicationManagementSession: ComponentIdsL Wrong count (is %d, should be %d)!!", len, buflen);
|
|
2649 |
if (len < buflen)
|
|
2650 |
{
|
|
2651 |
buflen = len;
|
|
2652 |
}
|
|
2653 |
}
|
|
2654 |
for (TInt i(0); i < buflen; i++)
|
|
2655 |
{
|
|
2656 |
RDEBUG_2( "CApplicationManagementSession: ComponentIdsL Adding %d!!",
|
|
2657 |
arr[i] );
|
|
2658 |
buf[i] = arr[i];
|
|
2659 |
}
|
|
2660 |
arr.Close();
|
|
2661 |
}
|
|
2662 |
|
|
2663 |
TPtrC8 p((TUint8*) buf, buflen * sizeof(TUint32));
|
|
2664 |
aMessage.WriteL(0, p);
|
|
2665 |
|
|
2666 |
CleanupStack::PopAndDestroy(buf);
|
|
2667 |
}
|
|
2668 |
|
|
2669 |
#ifdef _DEBUG
|
|
2670 |
HBufC* Des8to16LC(const TDesC8 &aDes)
|
|
2671 |
{
|
|
2672 |
HBufC *b = HBufC::NewLC(aDes.Length());
|
|
2673 |
TPtr p(b->Des());
|
|
2674 |
p.Copy(aDes);
|
|
2675 |
return b;
|
|
2676 |
}
|
|
2677 |
|
|
2678 |
HBufC* ToStringLC(TDeploymentComponent &aComp)
|
|
2679 |
{
|
|
2680 |
HBufC *b = HBufC::NewLC(aComp.iId.Length() + aComp.iName.Length()
|
|
2681 |
+ aComp.iVersion.Length() + 10 + 50);
|
|
2682 |
TPtr p(b->Des());
|
|
2683 |
_LIT( KFormat, "Id: '%S', Name: '%S', Version: '%S', State: %d, OldState: %d");
|
|
2684 |
p.Format(KFormat, &*Des8to16LC(aComp.iId), &*Des8to16LC(aComp.iName),
|
|
2685 |
&*Des8to16LC(aComp.iVersion), aComp.iState, aComp.iOldState);
|
|
2686 |
CleanupStack::PopAndDestroy(3);
|
|
2687 |
return b;
|
|
2688 |
}
|
|
2689 |
#endif
|
|
2690 |
|
|
2691 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2692 |
// CApplicationManagementSession::Deliver2L()
|
|
2693 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2694 |
|
|
2695 |
void CApplicationManagementSession::Deliver2L(const RMessage2& aMessage) const
|
|
2696 |
{
|
|
2697 |
RDEBUG( "ApplicationManagementSession: Deliver2L" );
|
|
2698 |
|
|
2699 |
TDeploymentComponentIPC comp;
|
|
2700 |
TPckg<TDeploymentComponentIPC> pcomp(comp);
|
|
2701 |
TInt read2(aMessage.Read(0, pcomp));
|
|
2702 |
|
|
2703 |
HBufC8 *data = HBufC8::NewLC(aMessage.GetDesLength(1));
|
|
2704 |
TPtr8 pbuf(data->Des());
|
|
2705 |
TInt read(aMessage.Read(1, pbuf));
|
|
2706 |
|
|
2707 |
CDeploymentComponent *compo = NULL;
|
|
2708 |
if (iTrustAdded)
|
|
2709 |
{
|
|
2710 |
compo = Server().Storage()->NewComponentL(EDCSDelivered,
|
|
2711 |
comp.iUserId, &iCertInfo);
|
|
2712 |
}
|
|
2713 |
else
|
|
2714 |
{
|
|
2715 |
compo
|
|
2716 |
= Server().Storage()->NewComponentL(EDCSDelivered,
|
|
2717 |
comp.iUserId);
|
|
2718 |
}
|
|
2719 |
|
|
2720 |
compo->Set(comp.iComponent);
|
|
2721 |
compo->Data().SetDataL(pbuf, comp.iMimeType);
|
|
2722 |
Server().Storage()->UpdateL(*compo);
|
|
2723 |
compo->CopyStateTo(comp.iComponent);
|
|
2724 |
|
|
2725 |
#ifdef _DEBUG
|
|
2726 |
RDEBUG_2( "Deliver2L: TDeploymentComponent is '%S'",
|
|
2727 |
ToStringLC( comp.iComponent ) );
|
|
2728 |
CleanupStack::PopAndDestroy();
|
|
2729 |
#endif
|
|
2730 |
|
|
2731 |
TPckg<TDeploymentComponent> pcomp2(comp.iComponent);
|
|
2732 |
aMessage.Write(0, pcomp2);
|
|
2733 |
CleanupStack::PopAndDestroy(data);
|
|
2734 |
TInt n(compo->InternalId());
|
|
2735 |
TPckg<TUint32> p(n);
|
|
2736 |
aMessage.WriteL(2, p);
|
|
2737 |
}
|
|
2738 |
|
|
2739 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2740 |
// CApplicationManagementSession::DeliverCompleteL()
|
|
2741 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2742 |
|
|
2743 |
void CApplicationManagementSession::DeliverCompleteL(
|
|
2744 |
const RMessage2& aMessage) const
|
|
2745 |
{
|
|
2746 |
RDEBUG( "ApplicationManagementSession: DeliverCompleteL" );
|
|
2747 |
TUint32 id;
|
|
2748 |
TPckg<TUint32> pid(id);
|
|
2749 |
|
|
2750 |
TInt read(aMessage.Read(0, pid));
|
|
2751 |
RDEBUG_2( "ApplicationManagementSession: DeliverCompleteL id is %d", id );
|
|
2752 |
|
|
2753 |
CDeploymentComponent &compo = Server().Storage()->ComponentL(id);
|
|
2754 |
|
|
2755 |
HBufC8 *opts = HBufC8::NewLC(aMessage.GetDesLength(1));
|
|
2756 |
TPtr8 popts(opts->Des());
|
|
2757 |
TInt read1(aMessage.Read(1, popts));
|
|
2758 |
compo.SetInstallOptsL(*opts);
|
|
2759 |
|
|
2760 |
HBufC8 *meta = HBufC8::NewLC(aMessage.GetDesLength(2));
|
|
2761 |
TPtr8 pmeta(meta->Des());
|
|
2762 |
TInt read2(aMessage.Read(2, pmeta));
|
|
2763 |
compo.SetMetaDataL(*meta, KNullDesC8);
|
|
2764 |
|
|
2765 |
CleanupStack::PopAndDestroy(meta);
|
|
2766 |
CleanupStack::PopAndDestroy(opts);
|
|
2767 |
Server().Storage()->UpdateL(compo);
|
|
2768 |
}
|
|
2769 |
|
|
2770 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2771 |
// CApplicationManagementSession::GetComponentL()
|
|
2772 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2773 |
|
|
2774 |
void CApplicationManagementSession::GetComponentL(const RMessage2& aMessage) const
|
|
2775 |
{
|
|
2776 |
RDEBUG( "ApplicationManagementSession: GetComponentL" );
|
|
2777 |
TUint32 id;
|
|
2778 |
TPckg<TUint32> pid(id);
|
|
2779 |
TInt read(aMessage.Read(0, pid));
|
|
2780 |
|
|
2781 |
RDEBUG_2( "ApplicationManagementSession: GetComponentL id is %d", id );
|
|
2782 |
CDeploymentComponent &compo = Server().Storage()->ComponentL(id);
|
|
2783 |
|
|
2784 |
TDeploymentComponent comp;
|
|
2785 |
compo.CopyStateTo(comp);
|
|
2786 |
|
|
2787 |
TPckg<TDeploymentComponent> pcomp(comp);
|
|
2788 |
aMessage.Write(1, pcomp);
|
|
2789 |
}
|
|
2790 |
|
|
2791 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2792 |
// CApplicationManagementSession::StartDownloadL()
|
|
2793 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2794 |
|
|
2795 |
void CApplicationManagementSession::StartDownloadL(const RMessage2& aMessage) const
|
|
2796 |
{
|
|
2797 |
RDEBUG( "ApplicationManagementSession: StartDownloadL" );
|
|
2798 |
TUint32 id = 0;
|
|
2799 |
TPckg<TUint32> pid(id);
|
|
2800 |
TInt read(aMessage.Read(0, pid));
|
|
2801 |
|
|
2802 |
TPckgBuf<TDownloadTarget> target;
|
|
2803 |
read = aMessage.Read(1, target);
|
|
2804 |
RDEBUG_2( "ApplicationManagementSession: StartDownloadL id is %d", id );
|
|
2805 |
|
|
2806 |
CDeploymentComponent &compo = Server().Storage()->ComponentL(id);
|
|
2807 |
compo.SetDownloadTarget(target());
|
|
2808 |
Server().AddDownloadL(&compo);
|
|
2809 |
}
|
|
2810 |
|
|
2811 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2812 |
// CApplicationManagementSession::DeactivateL()
|
|
2813 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2814 |
|
|
2815 |
void CApplicationManagementSession::DeactivateL(const RMessage2& aMessage) const
|
|
2816 |
{
|
|
2817 |
RDEBUG( "ApplicationManagementSession: DeactivateL" );
|
|
2818 |
TUint32 id = 0;
|
|
2819 |
TPckg<TUint32> pid(id);
|
|
2820 |
TInt read(aMessage.Read(0, pid));
|
|
2821 |
|
|
2822 |
RDEBUG_2( "ApplicationManagementSession: DeactivateL id is %d", id );
|
|
2823 |
CDeploymentComponent &compo = Server().Storage()->ComponentL(id);
|
|
2824 |
Server().Storage()->DeactivateL(compo);
|
|
2825 |
}
|
|
2826 |
|
|
2827 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2828 |
// CApplicationManagementSession::ActivateL()
|
|
2829 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2830 |
|
|
2831 |
void CApplicationManagementSession::ActivateL(const RMessage2& aMessage) const
|
|
2832 |
{
|
|
2833 |
RDEBUG( "ApplicationManagementSession: ActivateL" );
|
|
2834 |
TUint32 id;
|
|
2835 |
TPckg<TUint32> pid(id);
|
|
2836 |
TInt read(aMessage.Read(0, pid));
|
|
2837 |
|
|
2838 |
RDEBUG_2( "ApplicationManagementSession: ActivateL id is %d", id );
|
|
2839 |
CDeploymentComponent &compo = Server().Storage()->ComponentL(id);
|
|
2840 |
Server().Storage()->ActivateL(compo);
|
|
2841 |
}
|
|
2842 |
|
|
2843 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2844 |
// CApplicationManagementSession::GetUserIdL()
|
|
2845 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2846 |
|
|
2847 |
void CApplicationManagementSession::GetUserIdL(const RMessage2& aMessage) const
|
|
2848 |
{
|
|
2849 |
RDEBUG( "ApplicationManagementSession: GetUserIdL" );
|
|
2850 |
TUint32 id = 0;
|
|
2851 |
TPckg<TUint32> pid(id);
|
|
2852 |
TInt read(aMessage.Read(0, pid));
|
|
2853 |
|
|
2854 |
RDEBUG_2( "ApplicationManagementSession: GetUserIdL id is %d", id );
|
|
2855 |
CDeploymentComponent &compo = Server().Storage()->ComponentL(id);
|
|
2856 |
|
|
2857 |
aMessage.Write(1, compo.UserId());
|
|
2858 |
}
|
|
2859 |
|
|
2860 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2861 |
// CApplicationManagementSession::GetTemporaryInstFileL()
|
|
2862 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2863 |
|
|
2864 |
void CApplicationManagementSession::GetTemporaryInstFileL(
|
|
2865 |
const RMessage2& aMessage) const
|
|
2866 |
{
|
|
2867 |
// TIpcArgs( &id, &itemid, &filehandle )
|
|
2868 |
RDEBUG( "ApplicationManagementSession: GetTemporaryInstFileL" );
|
|
2869 |
TUint32 id;
|
|
2870 |
TPckg<TUint32> pid(id);
|
|
2871 |
TInt read(aMessage.Read(0, pid));
|
|
2872 |
|
|
2873 |
TDeplCompAttrType item;
|
|
2874 |
TPckg<TDeplCompAttrType> itemid(item);
|
|
2875 |
read = aMessage.Read(1, itemid);
|
|
2876 |
|
|
2877 |
RDEBUG_2( "ApplicationManagementSession: GetTemporaryInstFileL id is %d", id );
|
|
2878 |
CDeploymentComponent &compo = Server().Storage()->ComponentL(id);
|
|
2879 |
|
|
2880 |
TFileName fileName;
|
|
2881 |
|
|
2882 |
if (item == EDCData)
|
|
2883 |
{
|
|
2884 |
fileName.Copy(compo.Data().DataFileName());
|
|
2885 |
}
|
|
2886 |
else if (item == EDCMetaData)
|
|
2887 |
{
|
|
2888 |
fileName.Copy(compo.MetaData().DataFileName());
|
|
2889 |
}
|
|
2890 |
else
|
|
2891 |
{
|
|
2892 |
RDEBUG_2( "ApplicationManagementSession: GetTemporaryInstFileL: Not supported type: (%d)", item);
|
|
2893 |
User::Leave(KErrNotSupported);
|
|
2894 |
}
|
|
2895 |
|
|
2896 |
RDEBUG_2( "ApplicationManagementSession: GetTemporaryInstFileL: (%S)", &fileName);
|
|
2897 |
|
|
2898 |
RFs fs;
|
|
2899 |
User::LeaveIfError(fs.Connect());
|
|
2900 |
User::LeaveIfError(fs.ShareProtected());
|
|
2901 |
CleanupClosePushL(fs);
|
|
2902 |
RFile file;
|
|
2903 |
User::LeaveIfError(file.Open(fs, fileName, EFileWrite));
|
|
2904 |
CleanupClosePushL(file);
|
|
2905 |
|
|
2906 |
// Takes care of completing with session (RFs),
|
|
2907 |
// SendReceieve returns session handle at client side
|
|
2908 |
User::LeaveIfError(file.TransferToClient(aMessage, 2));
|
|
2909 |
CleanupStack::PopAndDestroy(2, &fs); // fs , file
|
|
2910 |
}
|
|
2911 |
|
|
2912 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2913 |
// CApplicationManagementSession::PackageSizeL()
|
|
2914 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2915 |
|
|
2916 |
TInt CApplicationManagementSession::PackageSizeL(
|
|
2917 |
Swi::RSisRegistrySession& aSession, Swi::RSisRegistryEntry& aEntry)
|
|
2918 |
{
|
|
2919 |
RPointerArray<Swi::CSisRegistryPackage> listPackages;
|
|
2920 |
TInt size(0);
|
|
2921 |
TInt err(0);
|
|
2922 |
CleanupClosePushL(listPackages);
|
|
2923 |
|
|
2924 |
aEntry.AugmentationsL(listPackages);
|
|
2925 |
|
|
2926 |
for (TInt index(0); index < listPackages.Count(); index++)
|
|
2927 |
{
|
|
2928 |
TRAP(err, AugmentationSizeL( aSession, *listPackages[index]))
|
|
2929 |
if (err != KErrNone)
|
|
2930 |
{
|
|
2931 |
break;
|
|
2932 |
}
|
|
2933 |
}
|
|
2934 |
|
|
2935 |
if (err != KErrNone)
|
|
2936 |
{
|
|
2937 |
size = 0;
|
|
2938 |
}
|
|
2939 |
else
|
|
2940 |
{
|
|
2941 |
TRAP(err, size += aEntry.SizeL() );
|
|
2942 |
}
|
|
2943 |
|
|
2944 |
listPackages.ResetAndDestroy();
|
|
2945 |
CleanupStack::PopAndDestroy(&listPackages);
|
|
2946 |
|
|
2947 |
if (err != KErrNone)
|
|
2948 |
{
|
|
2949 |
//We leave if there was an error,
|
|
2950 |
// but we have to clean up the listPackages before the leave.
|
|
2951 |
User::Leave(err);
|
|
2952 |
}
|
|
2953 |
|
|
2954 |
return size;
|
|
2955 |
}
|
|
2956 |
|
|
2957 |
// ------------------------------------------------------------------------------------------------
|
|
2958 |
// CAppMngrSisxInfo::AugmentationSizeL()
|
|
2959 |
// Returns the Size of the package
|
|
2960 |
// (other items were commented in a header).
|
|
2961 |
// ------------------------------------------------------------------------------------------------
|
|
2962 |
//
|
|
2963 |
TInt CApplicationManagementSession::AugmentationSizeL(
|
|
2964 |
Swi::RSisRegistrySession& aSession,
|
|
2965 |
const Swi::CSisRegistryPackage& aPackage)
|
|
2966 |
{
|
|
2967 |
TInt size(0);
|
|
2968 |
Swi::RSisRegistryEntry regEntry;
|
|
2969 |
CleanupClosePushL(regEntry);
|
|
2970 |
|
|
2971 |
regEntry.OpenL(aSession, aPackage);
|
|
2972 |
size += PackageSizeL(aSession, regEntry);
|
|
2973 |
|
|
2974 |
CleanupStack::PopAndDestroy(®Entry);
|
|
2975 |
|
|
2976 |
return size;
|
|
2977 |
}
|
|
2978 |
|
|
2979 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2980 |
// CApplicationManagementSession::LookupSisRegistryL()
|
|
2981 |
// -------------------------------------------------------------------------------------------------------------------
|
|
2982 |
|
|
2983 |
void CApplicationManagementSession::LookupSisRegistryL()
|
|
2984 |
{
|
|
2985 |
Swi::RSisRegistrySession sisses;
|
|
2986 |
TInt r(sisses.Connect());
|
|
2987 |
RPointerArray<Swi::CSisRegistryPackage> pkgs(12);
|
|
2988 |
sisses.InstalledPackagesL(pkgs);
|
|
2989 |
|
|
2990 |
TInt count(pkgs.Count());
|
|
2991 |
for (TInt i(0); i < count; i++)
|
|
2992 |
{
|
|
2993 |
Swi::CSisRegistryPackage* p = pkgs[i];
|
|
2994 |
|
|
2995 |
RDEBUG_5(" Found package: %d, '%S', uid: 0x%X, size: %d" ,
|
|
2996 |
i, &p->Name(), p->Uid().iUid, AugmentationSizeL( sisses, *p ) );
|
|
2997 |
}
|
|
2998 |
|
|
2999 |
sisses.Close();
|
|
3000 |
pkgs.ResetAndDestroy();
|
|
3001 |
|
|
3002 |
}
|
|
3003 |
|
|
3004 |
// -------------------------------------------------------------------------------------------------------------------
|
|
3005 |
// CApplicationManagementSession::InstallL()
|
|
3006 |
// -------------------------------------------------------------------------------------------------------------------
|
|
3007 |
|
|
3008 |
void CApplicationManagementSession::InstallL(const RMessage2& aMessage) const
|
|
3009 |
{
|
|
3010 |
RDEBUG( "ApplicationManagementSession: InstallL" );
|
|
3011 |
TUint32 id;
|
|
3012 |
TPckg<TUint32> pid(id);
|
|
3013 |
TInt read(aMessage.Read(0, pid));
|
|
3014 |
|
|
3015 |
TDeploymentComponentState targetst;
|
|
3016 |
TPckg<TDeploymentComponentState> pk(targetst);
|
|
3017 |
|
|
3018 |
read = aMessage.Read(1, pk);
|
|
3019 |
|
|
3020 |
RDEBUG_3( "ApplicationManagementSession: InstallL id is %d, targetstate %d",
|
|
3021 |
id, targetst );
|
|
3022 |
|
|
3023 |
CDeploymentComponent &compo = Server().Storage()->ComponentL(id);
|
|
3024 |
if (compo.State() == EDCSDelivered)
|
|
3025 |
{
|
|
3026 |
Server().DoTheInstallL(compo);
|
|
3027 |
}
|
|
3028 |
else
|
|
3029 |
{
|
|
3030 |
User::Leave(KErrArgument);
|
|
3031 |
}
|
|
3032 |
RDEBUG_2( "ApplicationManagementSession: InstallL success. New compo state (%d)", compo.State());
|
|
3033 |
}
|
|
3034 |
|
|
3035 |
// -------------------------------------------------------------------------------------------------------------------
|
|
3036 |
// CApplicationManagementSession::UpdateDataL()
|
|
3037 |
// -------------------------------------------------------------------------------------------------------------------
|
|
3038 |
|
|
3039 |
void CApplicationManagementSession::UpdateDataL(const RMessage2& aMessage) const
|
|
3040 |
{
|
|
3041 |
RDEBUG( "ApplicationManagementSession: UpdateDataL" );
|
|
3042 |
|
|
3043 |
TDeplCompDataIPC ipc;
|
|
3044 |
TPckg<TDeplCompDataIPC> pipc(ipc);
|
|
3045 |
TInt read(aMessage.Read(0, pipc));
|
|
3046 |
RDEBUG_2( "ApplicationManagementSession: UpdateDataL id is %d", ipc.iInternalId );
|
|
3047 |
|
|
3048 |
HBufC8 *buf = HBufC8::NewLC(aMessage.GetDesLength(1));
|
|
3049 |
TPtr8 pbuf(buf->Des());
|
|
3050 |
TInt read2(aMessage.Read(1, pbuf));
|
|
3051 |
|
|
3052 |
CDeploymentComponent &compo = Server().Storage()->ComponentL(
|
|
3053 |
ipc.iInternalId);
|
|
3054 |
|
|
3055 |
if (Server().CheckB64Encode(pbuf))
|
|
3056 |
{
|
|
3057 |
RDEBUG( "ApplicationManagementSession: UpdateDataL data is base64 encoded");
|
|
3058 |
// b64 encoded data, decode it
|
|
3059 |
HBufC8* tmp;
|
|
3060 |
tmp = Server().DecodeB64DataLC(pbuf);
|
|
3061 |
pbuf.Copy(*tmp);
|
|
3062 |
pbuf = buf->Des();
|
|
3063 |
CleanupStack::PopAndDestroy(tmp);
|
|
3064 |
}
|
|
3065 |
|
|
3066 |
if (compo.State() == EDCSDelivered)
|
|
3067 |
{
|
|
3068 |
if (ipc.iAttrType == EDCData)
|
|
3069 |
{
|
|
3070 |
compo.SetDataL(pbuf, ipc.iDataMime);
|
|
3071 |
}
|
|
3072 |
else if (ipc.iAttrType == EDCMetaData)
|
|
3073 |
{
|
|
3074 |
compo.SetMetaDataL(pbuf, ipc.iDataMime);
|
|
3075 |
}
|
|
3076 |
else
|
|
3077 |
{
|
|
3078 |
RDEBUG_2( "ApplicationManagementSession::UpdateDataL - ERROR UpdateDataL called for illegal item: %d!", ipc.iAttrType );
|
|
3079 |
User::Leave(KErrArgument);
|
|
3080 |
}
|
|
3081 |
|
|
3082 |
Server().Storage()->UpdateL(compo);
|
|
3083 |
}
|
|
3084 |
else
|
|
3085 |
{
|
|
3086 |
RDEBUG( "ApplicationManagementSession::UpdateDataL - ERROR UpdateDataL called for illegal state message!" );
|
|
3087 |
User::Leave(KErrArgument);
|
|
3088 |
}
|
|
3089 |
CleanupStack::PopAndDestroy(buf);
|
|
3090 |
}
|
|
3091 |
|
|
3092 |
// -------------------------------------------------------------------------------------------------------------------
|
|
3093 |
// CApplicationManagementSession::UpdateStreamedDataL()
|
|
3094 |
// -------------------------------------------------------------------------------------------------------------------
|
|
3095 |
|
|
3096 |
void CApplicationManagementSession::UpdateStreamedDataL(
|
|
3097 |
const RMessage2& aMessage) const
|
|
3098 |
{
|
|
3099 |
RDEBUG( "ApplicationManagementSession: UpdateStreamedDataL() Start");
|
|
3100 |
TDeplCompDataIPC ipc;
|
|
3101 |
TPckg<TDeplCompDataIPC> pipc(ipc);
|
|
3102 |
TInt read(aMessage.Read(0, pipc));
|
|
3103 |
RDEBUG_2( "ApplicationManagementSession: UpdateStreamedDataL id is %d", ipc.iInternalId );
|
|
3104 |
|
|
3105 |
CDeploymentComponent &compo = Server().Storage()->ComponentL(
|
|
3106 |
ipc.iInternalId);
|
|
3107 |
|
|
3108 |
if (compo.State() == EDCSDelivered)
|
|
3109 |
{
|
|
3110 |
RFs fs;
|
|
3111 |
User::LeaveIfError(fs.Connect());
|
|
3112 |
CleanupClosePushL(fs);
|
|
3113 |
RFile file;
|
|
3114 |
TFileName dataFileName;
|
|
3115 |
TInt length(0);
|
|
3116 |
|
|
3117 |
if (ipc.iAttrType == EDCData)
|
|
3118 |
{
|
|
3119 |
dataFileName.Copy(compo.Data().DataFileName());
|
|
3120 |
}
|
|
3121 |
else if (ipc.iAttrType == EDCMetaData)
|
|
3122 |
{
|
|
3123 |
dataFileName.Copy(compo.MetaData().DataFileName());
|
|
3124 |
}
|
|
3125 |
else
|
|
3126 |
{
|
|
3127 |
RDEBUG_2( "ApplicationManagementSession::UpdateStreamedDataL - ERROR called for illegal item: %d!", ipc.iAttrType );
|
|
3128 |
User::Leave(KErrArgument);
|
|
3129 |
}
|
|
3130 |
|
|
3131 |
RDEBUG_2( "ApplicationManagementSession::UpdateStreamedDataL(): using dataFile: (%S)", &dataFileName );
|
|
3132 |
|
|
3133 |
// EFileWrite So we can delete the original decoded data file
|
|
3134 |
User::LeaveIfError(file.Open(fs, dataFileName, EFileWrite));
|
|
3135 |
CleanupClosePushL(file);
|
|
3136 |
if (Server().IsDataFileB64EncodedL(file, length))
|
|
3137 |
{
|
|
3138 |
RDEBUG( "CApplicationManagementServer::UpdateStreamedDataL(): data is decoded" );
|
|
3139 |
|
|
3140 |
TFileName tempFileName;
|
|
3141 |
TBuf<30> privatePath;
|
|
3142 |
fs.PrivatePath(privatePath);
|
|
3143 |
RFile tempFile;
|
|
3144 |
TInt err(KErrNone);
|
|
3145 |
err = tempFile.Temp(fs, privatePath, tempFileName, EFileWrite);
|
|
3146 |
if (err == KErrNone)
|
|
3147 |
{
|
|
3148 |
RDEBUG_2( "ApplicationManagementSession::UpdateStreamedDataL(): created tempFile: (%S)", &tempFileName );
|
|
3149 |
}
|
|
3150 |
else
|
|
3151 |
{
|
|
3152 |
User::Leave(err);
|
|
3153 |
}
|
|
3154 |
CleanupClosePushL(tempFile);
|
|
3155 |
|
|
3156 |
TRAP( err, Server().DecodeB64DataFileL( file, tempFile ) );
|
|
3157 |
if (err != KErrNone)
|
|
3158 |
{
|
|
3159 |
RDEBUG_2( "ApplicationManagementSession::UpdateStreamedDataL - failed to decode datafile: %d", err );
|
|
3160 |
CleanupStack::PopAndDestroy(2, &file);
|
|
3161 |
compo.ResetDataL(fs); // Remove both files if exists
|
|
3162 |
User::Leave(err);
|
|
3163 |
}
|
|
3164 |
else
|
|
3165 |
{
|
|
3166 |
// close both files, delete decode file and rename temp file to correct one
|
|
3167 |
CleanupStack::PopAndDestroy(2, &file);
|
|
3168 |
fs.Delete(dataFileName);
|
|
3169 |
err = fs.Rename(tempFileName, dataFileName);
|
|
3170 |
RDEBUG_2( "ApplicationManagementSession::UpdateStreamedDataL - successfully decoded datafile: %d", err );
|
|
3171 |
}
|
|
3172 |
CleanupStack::PopAndDestroy(&fs);
|
|
3173 |
}
|
|
3174 |
else
|
|
3175 |
{
|
|
3176 |
RDEBUG( "ApplicationManagementSession::UpdateStreamedDataL(): data is NOT decoded" );
|
|
3177 |
CleanupStack::PopAndDestroy(2, &fs);
|
|
3178 |
}
|
|
3179 |
|
|
3180 |
if (ipc.iAttrType == EDCData)
|
|
3181 |
{
|
|
3182 |
compo.SetDataL(ipc.iDataMime);
|
|
3183 |
}
|
|
3184 |
else
|
|
3185 |
{
|
|
3186 |
compo.SetMetaDataL(ipc.iDataMime);
|
|
3187 |
}
|
|
3188 |
|
|
3189 |
Server().Storage()->UpdateL(compo);
|
|
3190 |
}
|
|
3191 |
else
|
|
3192 |
{
|
|
3193 |
RDEBUG( "ApplicationManagementSession::UpdateStreamedDataL - ERROR called for illegal state message!" );
|
|
3194 |
User::Leave(KErrArgument);
|
|
3195 |
}
|
|
3196 |
RDEBUG( "ApplicationManagementSession: UpdateStreamedDataL() End");
|
|
3197 |
}
|
|
3198 |
|
|
3199 |
// -------------------------------------------------------------------------------------------------------------------
|
|
3200 |
// CApplicationManagementSession::UpdateL()
|
|
3201 |
// -------------------------------------------------------------------------------------------------------------------
|
|
3202 |
|
|
3203 |
void CApplicationManagementSession::UpdateL(const RMessage2& aMessage) const
|
|
3204 |
{
|
|
3205 |
RDEBUG( "ApplicationManagementSession: UpdateL" );
|
|
3206 |
|
|
3207 |
TUint32 id;
|
|
3208 |
TPckg<TUint32> pid(id);
|
|
3209 |
TInt read(aMessage.Read(0, pid));
|
|
3210 |
RDEBUG_2("ApplicationManagementSession: UpdateL id is %d", id );
|
|
3211 |
|
|
3212 |
TDeplCompAttrType item;
|
|
3213 |
TPckg<TDeplCompAttrType> itemid(item);
|
|
3214 |
TInt read1(aMessage.Read(1, itemid));
|
|
3215 |
HBufC8 *buf = HBufC8::NewLC(aMessage.GetDesLength(2));
|
|
3216 |
TPtr8 pbuf(buf->Des());
|
|
3217 |
TInt read2(aMessage.Read(2, pbuf));
|
|
3218 |
|
|
3219 |
CDeploymentComponent &c = Server().Storage()->ComponentL(id);
|
|
3220 |
TDeploymentComponentState st(c.State());
|
|
3221 |
if (st == EDCSDelivered || st == EDCSDownload)
|
|
3222 |
{
|
|
3223 |
switch (item)
|
|
3224 |
{
|
|
3225 |
case EDCId:
|
|
3226 |
{
|
|
3227 |
c.SetIdL(pbuf);
|
|
3228 |
break;
|
|
3229 |
}
|
|
3230 |
case EDCName:
|
|
3231 |
{
|
|
3232 |
c.SetNameL(pbuf);
|
|
3233 |
break;
|
|
3234 |
}
|
|
3235 |
case EDCVersion:
|
|
3236 |
{
|
|
3237 |
c.SetVersionL(pbuf);
|
|
3238 |
break;
|
|
3239 |
}
|
|
3240 |
case EDCDescriptionRef:
|
|
3241 |
{
|
|
3242 |
c.SetDescriptionL(pbuf);
|
|
3243 |
break;
|
|
3244 |
}
|
|
3245 |
case EDCInstallOptions:
|
|
3246 |
{
|
|
3247 |
c.SetInstallOptsL(pbuf);
|
|
3248 |
break;
|
|
3249 |
}
|
|
3250 |
case EDCMetaData:
|
|
3251 |
{
|
|
3252 |
c.SetMetaDataL(pbuf, KNullDesC8);
|
|
3253 |
break;
|
|
3254 |
}
|
|
3255 |
case EDCPkgID:
|
|
3256 |
{
|
|
3257 |
c.SetPkgIDL(pbuf);
|
|
3258 |
break;
|
|
3259 |
}
|
|
3260 |
case EDCPkgType:
|
|
3261 |
{
|
|
3262 |
c.SetPkgTypeL(pbuf);
|
|
3263 |
break;
|
|
3264 |
}
|
|
3265 |
|
|
3266 |
default:
|
|
3267 |
{
|
|
3268 |
if (st == EDCSDelivered)
|
|
3269 |
{
|
|
3270 |
switch (item)
|
|
3271 |
{
|
|
3272 |
case EDCData:
|
|
3273 |
{
|
|
3274 |
c.SetDataL(pbuf, KNullDesC8);
|
|
3275 |
if (c.State() == EDCSDownload)
|
|
3276 |
{
|
|
3277 |
// Server().StartDownload( *compo );
|
|
3278 |
}
|
|
3279 |
break;
|
|
3280 |
}
|
|
3281 |
default:
|
|
3282 |
{
|
|
3283 |
RDEBUG_2("ApplicationManagementSession: ERROR UpdateL called for illegal item type!!!! %d", item );
|
|
3284 |
User::Leave(KErrArgument);
|
|
3285 |
}
|
|
3286 |
}
|
|
3287 |
}
|
|
3288 |
else if (st == EDCSDownload)
|
|
3289 |
{
|
|
3290 |
switch (item)
|
|
3291 |
{
|
|
3292 |
case EDCId:
|
|
3293 |
{
|
|
3294 |
c.SetIdL(pbuf);
|
|
3295 |
break;
|
|
3296 |
}
|
|
3297 |
case EDCName:
|
|
3298 |
{
|
|
3299 |
c.SetNameL(pbuf);
|
|
3300 |
break;
|
|
3301 |
}
|
|
3302 |
case EDCVersion:
|
|
3303 |
{
|
|
3304 |
c.SetVersionL(pbuf);
|
|
3305 |
break;
|
|
3306 |
}
|
|
3307 |
case EDCDownloadURI:
|
|
3308 |
{
|
|
3309 |
c.SetDownloadURIL(pbuf);
|
|
3310 |
break;
|
|
3311 |
}
|
|
3312 |
case EDCConRef:
|
|
3313 |
{
|
|
3314 |
TPckgBuf<TInt> aInt;
|
|
3315 |
aInt.Copy(pbuf);
|
|
3316 |
c.SetIAPL(aInt());
|
|
3317 |
break;
|
|
3318 |
}
|
|
3319 |
default:
|
|
3320 |
{
|
|
3321 |
RDEBUG_2( "ApplicationManagementSession: ERROR UpdateL called for illegal item type!!!! %d", item );
|
|
3322 |
User::Leave(KErrArgument);
|
|
3323 |
break;
|
|
3324 |
}
|
|
3325 |
}
|
|
3326 |
}
|
|
3327 |
break;
|
|
3328 |
}
|
|
3329 |
}
|
|
3330 |
Server().Storage()->UpdateL(c);
|
|
3331 |
}
|
|
3332 |
else if (st == EDCSActive || st == EDCSInactive)
|
|
3333 |
{
|
|
3334 |
switch (item)
|
|
3335 |
{
|
|
3336 |
case EDCName:
|
|
3337 |
{
|
|
3338 |
c.SetNameL(pbuf);
|
|
3339 |
break;
|
|
3340 |
}
|
|
3341 |
case EDCVersion:
|
|
3342 |
{
|
|
3343 |
c.SetVersionL(pbuf);
|
|
3344 |
break;
|
|
3345 |
}
|
|
3346 |
case EDCDescriptionRef:
|
|
3347 |
{
|
|
3348 |
c.SetDescriptionL(pbuf);
|
|
3349 |
break;
|
|
3350 |
}
|
|
3351 |
default:
|
|
3352 |
{
|
|
3353 |
RDEBUG_2( "ApplicationManagementSession: ERROR UpdateL called for illegal item type!!!! %d", item );
|
|
3354 |
User::Leave(KErrArgument);
|
|
3355 |
break;
|
|
3356 |
}
|
|
3357 |
}
|
|
3358 |
Server().Storage()->UpdateL(c);
|
|
3359 |
}
|
|
3360 |
else
|
|
3361 |
{
|
|
3362 |
RDEBUG( "ApplicationManagementSession: ERROR UpdateL called for illegal state message!" );
|
|
3363 |
User::Leave(KErrArgument);
|
|
3364 |
}
|
|
3365 |
CleanupStack::PopAndDestroy(buf);
|
|
3366 |
}
|
|
3367 |
|
|
3368 |
// -------------------------------------------------------------------------------------------------------------------
|
|
3369 |
// CApplicationManagementSession::GetDataLengthL()
|
|
3370 |
// -------------------------------------------------------------------------------------------------------------------
|
|
3371 |
|
|
3372 |
void CApplicationManagementSession::GetDataLengthL(const RMessage2& aMessage) const
|
|
3373 |
{
|
|
3374 |
RDEBUG( "ApplicationManagementSession: GetDataLengthL" );
|
|
3375 |
TUint32 id;
|
|
3376 |
TPckg<TUint32> pid(id);
|
|
3377 |
|
|
3378 |
TInt read(aMessage.Read(0, pid));
|
|
3379 |
|
|
3380 |
TInt length(0);
|
|
3381 |
|
|
3382 |
TDeplCompAttrType dt;
|
|
3383 |
TPckg<TDeplCompAttrType> pdt(dt);
|
|
3384 |
read = aMessage.Read(1, pdt);
|
|
3385 |
CDeploymentComponent &compo = Server().Storage()->ComponentL(id);
|
|
3386 |
if (compo.State() == EDCSDelivered)
|
|
3387 |
{
|
|
3388 |
if (dt == EDCInstallOptions)
|
|
3389 |
{
|
|
3390 |
if (compo.InstallOptsSet())
|
|
3391 |
{
|
|
3392 |
length = sizeof(TAMInstallOptions);
|
|
3393 |
}
|
|
3394 |
}
|
|
3395 |
else if (dt == EDCData)
|
|
3396 |
{
|
|
3397 |
length = compo.Data().DataLengthL();
|
|
3398 |
}
|
|
3399 |
else if (dt == EDCDataMime)
|
|
3400 |
{
|
|
3401 |
length = compo.Data().MimeType().Length();
|
|
3402 |
}
|
|
3403 |
else if (dt == EDCMetaData)
|
|
3404 |
{
|
|
3405 |
length = compo.MetaData().DataLengthL();
|
|
3406 |
}
|
|
3407 |
else if (dt == EDCMetaDataMime)
|
|
3408 |
{
|
|
3409 |
length = compo.MetaData().MimeType().Length();
|
|
3410 |
}
|
|
3411 |
else
|
|
3412 |
{
|
|
3413 |
RDEBUG_2( "ApplicationManagementSession: GetDataLengthL ERROR called with illegal type %d", dt );
|
|
3414 |
User::Leave(KErrArgument);
|
|
3415 |
}
|
|
3416 |
}
|
|
3417 |
else if (compo.State() == EDCSDownload)
|
|
3418 |
{
|
|
3419 |
if (dt == EDCDownloadURI)
|
|
3420 |
{
|
|
3421 |
length = compo.DownloadURI().Length();
|
|
3422 |
}
|
|
3423 |
else if (dt == EDCInstallOptions)
|
|
3424 |
{
|
|
3425 |
if (compo.InstallOptsSet())
|
|
3426 |
{
|
|
3427 |
length = sizeof(TAMInstallOptions);
|
|
3428 |
}
|
|
3429 |
}
|
|
3430 |
else
|
|
3431 |
{
|
|
3432 |
RDEBUG_2( "ApplicationManagementSession: GetDataLengthL ERROR Download / called with illegal state component id %d",
|
|
3433 |
compo.State() );
|
|
3434 |
User::Leave(KErrArgument);
|
|
3435 |
}
|
|
3436 |
}
|
|
3437 |
else
|
|
3438 |
{
|
|
3439 |
RDEBUG_2( "ApplicationManagementSession: GetDataLengthL ERROR called with illegal state component id %d",
|
|
3440 |
compo.State() );
|
|
3441 |
User::Leave(KErrArgument);
|
|
3442 |
}
|
|
3443 |
|
|
3444 |
TPckg<TInt> pcomp(length);
|
|
3445 |
aMessage.Write(2, pcomp);
|
|
3446 |
}
|
|
3447 |
|
|
3448 |
// -------------------------------------------------------------------------------------------------------------------
|
|
3449 |
// CApplicationManagementSession::GetDataL()
|
|
3450 |
// -------------------------------------------------------------------------------------------------------------------
|
|
3451 |
|
|
3452 |
void CApplicationManagementSession::GetDataL(const RMessage2& aMessage) const
|
|
3453 |
{
|
|
3454 |
RDEBUG( "ApplicationManagementSession: GetDataL" );
|
|
3455 |
TUint32 id;
|
|
3456 |
TPckg<TUint32> pid(id);
|
|
3457 |
|
|
3458 |
TInt read(aMessage.Read(0, pid));
|
|
3459 |
|
|
3460 |
TDeplCompAttrType dt;
|
|
3461 |
TPckg<TDeplCompAttrType> pdt(dt);
|
|
3462 |
read = aMessage.Read(1, pdt);
|
|
3463 |
|
|
3464 |
RDEBUG_3( "ApplicationManagementSession: GetDataL id is %d, and attribute %d", id, dt );
|
|
3465 |
CDeploymentComponent &compo = Server().Storage()->ComponentL(id);
|
|
3466 |
if (dt == EDCStatus)
|
|
3467 |
{
|
|
3468 |
TPckg<TInt> p(compo.Status());
|
|
3469 |
aMessage.Write(2, p);
|
|
3470 |
}
|
|
3471 |
else if (compo.State() == EDCSDelivered)
|
|
3472 |
{
|
|
3473 |
if (dt == EDCInstallOptions)
|
|
3474 |
{
|
|
3475 |
if (compo.InstallOptsSet())
|
|
3476 |
{
|
|
3477 |
TAMInstallOptionsPckgBuf pckg(compo.InstallOpts());
|
|
3478 |
aMessage.Write(2, pckg);
|
|
3479 |
}
|
|
3480 |
else
|
|
3481 |
{
|
|
3482 |
aMessage.Write(2, KNullDesC8);
|
|
3483 |
}
|
|
3484 |
}
|
|
3485 |
else if (dt == EDCData)
|
|
3486 |
{
|
|
3487 |
aMessage.Write(2, compo.Data().Data());
|
|
3488 |
}
|
|
3489 |
else if (dt == EDCDataMime)
|
|
3490 |
{
|
|
3491 |
aMessage.Write(2, compo.Data().MimeType());
|
|
3492 |
}
|
|
3493 |
else if (dt == EDCMetaData)
|
|
3494 |
{
|
|
3495 |
aMessage.Write(2, compo.MetaData().Data());
|
|
3496 |
}
|
|
3497 |
else if (dt == EDCMetaDataMime)
|
|
3498 |
{
|
|
3499 |
aMessage.Write(2, compo.MetaData().MimeType());
|
|
3500 |
}
|
|
3501 |
else
|
|
3502 |
{
|
|
3503 |
RDEBUG_2( "ApplicationManagementSession: GetDataL ERROR called with illegal type %d", dt );
|
|
3504 |
User::Leave(KErrArgument);
|
|
3505 |
}
|
|
3506 |
}
|
|
3507 |
else if (compo.State() == EDCSDownload)
|
|
3508 |
{
|
|
3509 |
|
|
3510 |
if (dt == EDCDownloadURI)
|
|
3511 |
{
|
|
3512 |
aMessage.Write(2, compo.DownloadURI());
|
|
3513 |
}
|
|
3514 |
|
|
3515 |
else if (dt == EDCInstallOptions)
|
|
3516 |
{
|
|
3517 |
if (compo.InstallOptsSet())
|
|
3518 |
{
|
|
3519 |
TAMInstallOptionsPckgBuf pckg(compo.InstallOpts());
|
|
3520 |
aMessage.Write(2, pckg);
|
|
3521 |
}
|
|
3522 |
else
|
|
3523 |
{
|
|
3524 |
aMessage.Write(2, KNullDesC8);
|
|
3525 |
}
|
|
3526 |
}
|
|
3527 |
else if (dt == EDCConRef)
|
|
3528 |
{
|
|
3529 |
TPckg<TInt> p(compo.GetIAP());
|
|
3530 |
aMessage.Write(2, p);
|
|
3531 |
}
|
|
3532 |
else
|
|
3533 |
{
|
|
3534 |
RDEBUG_2( "ApplicationManagementSession:GetDataL ERROR called with illegal type %d", dt );
|
|
3535 |
User::Leave(KErrArgument);
|
|
3536 |
}
|
|
3537 |
}
|
|
3538 |
else
|
|
3539 |
{
|
|
3540 |
RDEBUG_2("ApplicationManagementSession: GetDataL ERROR called with illegal state component id %d", compo.State() );
|
|
3541 |
User::Leave(KErrArgument);
|
|
3542 |
}
|
|
3543 |
}
|
|
3544 |
|
|
3545 |
// -------------------------------------------------------------------------------------------------------------------
|
|
3546 |
// CApplicationManagementSession::RemoveL()
|
|
3547 |
// -------------------------------------------------------------------------------------------------------------------
|
|
3548 |
|
|
3549 |
void CApplicationManagementSession::RemoveL(const RMessage2& aMessage) const
|
|
3550 |
{
|
|
3551 |
RDEBUG( "ApplicationManagementSession: RemoveL" );
|
|
3552 |
TUint32 id;
|
|
3553 |
TPckg<TUint32> pid(id);
|
|
3554 |
TInt read(aMessage.Read(0, pid));
|
|
3555 |
RDEBUG_2( "ApplicationManagementSession: RemoveL id is %d", id );
|
|
3556 |
RemoveInternalL(id);
|
|
3557 |
}
|
|
3558 |
|
|
3559 |
// -------------------------------------------------------------------------------------------------------------------
|
|
3560 |
// CApplicationManagementSession::RemoveInternalL()
|
|
3561 |
// -------------------------------------------------------------------------------------------------------------------
|
|
3562 |
|
|
3563 |
void CApplicationManagementSession::RemoveInternalL(const TUint32 &aId) const
|
|
3564 |
{
|
|
3565 |
CDeploymentComponent &compo = Server().Storage()->ComponentL(aId);
|
|
3566 |
|
|
3567 |
Server().RemoveInternalL(compo);
|
|
3568 |
}
|
|
3569 |
|
|
3570 |
// -------------------------------------------------------------------------------------------------------------------
|
|
3571 |
// CApplicationManagementSession::DownloadL()
|
|
3572 |
// -------------------------------------------------------------------------------------------------------------------
|
|
3573 |
|
|
3574 |
void CApplicationManagementSession::DownloadL(const RMessage2& aMessage) const
|
|
3575 |
{
|
|
3576 |
RDEBUG( "ApplicationManagementSession: DownloadL" );
|
|
3577 |
|
|
3578 |
TDCUserId userId;
|
|
3579 |
aMessage.ReadL(1, userId);
|
|
3580 |
CDeploymentComponent *compo = NULL;
|
|
3581 |
|
|
3582 |
if (iTrustAdded)
|
|
3583 |
{
|
|
3584 |
compo = Server().Storage()->NewComponentL(EDCSDownload, userId,
|
|
3585 |
&iCertInfo);
|
|
3586 |
}
|
|
3587 |
else
|
|
3588 |
{
|
|
3589 |
compo = Server().Storage()->NewComponentL(EDCSDownload, userId);
|
|
3590 |
}
|
|
3591 |
TUint32 i(compo->InternalId());
|
|
3592 |
TPckg<TUint32> p(i);
|
|
3593 |
aMessage.WriteL(0, p);
|
|
3594 |
RDEBUG( "ApplicationManagementSession: DownloadL end" );
|
|
3595 |
}
|
|
3596 |
|
|
3597 |
// -------------------------------------------------------------------------------------------------------------------
|
|
3598 |
// CApplicationManagementSession::FullUpdateL()
|
|
3599 |
// -------------------------------------------------------------------------------------------------------------------
|
|
3600 |
|
|
3601 |
void CApplicationManagementSession::FullUpdateL(const RMessage2& aMessage) const
|
|
3602 |
{
|
|
3603 |
RDEBUG( "ApplicationManagementSession: FullUpdateL" );
|
|
3604 |
|
|
3605 |
TUint32 sid;
|
|
3606 |
|
|
3607 |
TPckg<TUint32> psid(sid);
|
|
3608 |
TInt read(aMessage.Read(0, psid));
|
|
3609 |
TUint32 tid;
|
|
3610 |
TPckg<TUint32> ptid(tid);
|
|
3611 |
TInt read2(aMessage.Read(1, ptid));
|
|
3612 |
|
|
3613 |
RDEBUG_3( "ApplicationManagementSession: FullUpdateL sid is %d, tid is %d", sid, tid );
|
|
3614 |
CApplicationManagementServer &server = Server();
|
|
3615 |
server.FullUpdateL(sid, tid);
|
|
3616 |
}
|
|
3617 |
|
|
3618 |
// -------------------------------------------------------------------------------------------------------------------
|
|
3619 |
// CApplicationManagementSession::ServiceError()
|
|
3620 |
// -------------------------------------------------------------------------------------------------------------------
|
|
3621 |
|
|
3622 |
void CApplicationManagementSession::ServiceError(const RMessage2& aMessage,
|
|
3623 |
TInt aError)
|
|
3624 |
{
|
|
3625 |
RDEBUG_2( "ApplicationManagementSession: CApplicationManagementSession::ServiceError %d", aError);
|
|
3626 |
CSession2::ServiceError(aMessage, aError);
|
|
3627 |
}
|
|
3628 |
|
|
3629 |
// -------------------------------------------------------------------------------------------------------------------
|
|
3630 |
// CApplicationManagementSession::AddTrustL()
|
|
3631 |
// -------------------------------------------------------------------------------------------------------------------
|
|
3632 |
|
|
3633 |
void CApplicationManagementSession::AddTrustL(const RMessage2 &aMessage)
|
|
3634 |
{
|
|
3635 |
TPckg<TCertInfo> pkg(iCertInfo);
|
|
3636 |
aMessage.ReadL(0, pkg);
|
|
3637 |
iTrustAdded = ETrue;
|
|
3638 |
}
|
|
3639 |
|
|
3640 |
// -------------------------------------------------------------------------------------------------------------------
|
|
3641 |
// CApplicationManagementSession::StateChangeComponentIdsL()
|
|
3642 |
// -------------------------------------------------------------------------------------------------------------------
|
|
3643 |
|
|
3644 |
void CApplicationManagementSession::StateChangeComponentIdsL(
|
|
3645 |
const RMessage2& aMessage) const
|
|
3646 |
{
|
|
3647 |
RDEBUG( "CApplicationManagementSession: StateChangeComponentIdsL" );
|
|
3648 |
RComponentIdArray arr;
|
|
3649 |
Server().Storage()->GetStateChangeComponentIdsL(arr);
|
|
3650 |
TInt buflen(arr.Count());
|
|
3651 |
TUint32* buf = new (ELeave) TUint32[buflen];
|
|
3652 |
CleanupArrayDeletePushL(buf);
|
|
3653 |
for (TInt i(0); i < buflen; i++)
|
|
3654 |
{
|
|
3655 |
RDEBUG_2( "ApplicationManagementSession:ComponentIdsL Adding %d!!", arr[i]);
|
|
3656 |
buf[i] = arr[i];
|
|
3657 |
}
|
|
3658 |
TPtrC8 p((TUint8*) buf, buflen * sizeof(TUint32));
|
|
3659 |
aMessage.WriteL(0, p);
|
|
3660 |
arr.Close();
|
|
3661 |
CleanupStack::PopAndDestroy(buf);
|
|
3662 |
RDEBUG( "CApplicationManagementSession: StateChangeComponentIdsL end" );
|
|
3663 |
|
|
3664 |
}
|
|
3665 |
|
|
3666 |
// -------------------------------------------------------------------------------------------------------------------
|
|
3667 |
// CApplicationManagementSession::StateChangeComponentIdsCountL()
|
|
3668 |
// -------------------------------------------------------------------------------------------------------------------
|
|
3669 |
|
|
3670 |
void CApplicationManagementSession::StateChangeComponentIdsCountL(
|
|
3671 |
const RMessage2& aMessage) const
|
|
3672 |
{
|
|
3673 |
RDEBUG( "CApplicationManagementSession: StateChangeComponentIdsCountL" );
|
|
3674 |
RPointerArray<TPreInstalledAppParams> preInstalledAppParams;
|
|
3675 |
CAMPreInstallApp* preInstallApp = CAMPreInstallApp::NewL();
|
|
3676 |
preInstallApp->GetPreInstalledAppsL(preInstalledAppParams);
|
|
3677 |
TInt count = 0;
|
|
3678 |
for (count = 0; count < preInstalledAppParams.Count(); count++)
|
|
3679 |
{
|
|
3680 |
RDEBUG8_2("CApplicationManagementSession::DownloadL: Installed App Name is: %S",&(preInstalledAppParams[count]->iPreInstalledAppame));
|
|
3681 |
RDEBUG8_2("CApplicationManagementSession::DownloadL: Installed App Vendor is: %S",&(preInstalledAppParams[count]->iPreInstalledAppVendorName));
|
|
3682 |
RDEBUG_2("CApplicationManagementSession::DownloadL: Installed App UID is : '0x%X'",preInstalledAppParams[count]->iPreInstalledAppUid);
|
|
3683 |
|
|
3684 |
TBool found = EFalse;
|
|
3685 |
const RComponentIdArray &arrt = Server().Storage()->GetComponentIds();
|
|
3686 |
TInt countval(arrt.Count());
|
|
3687 |
for (TInt i(0); i < countval; i++)
|
|
3688 |
{
|
|
3689 |
CDeploymentComponent &compo = Server().Storage()->ComponentL(
|
|
3690 |
arrt[i]);
|
|
3691 |
if (compo.Uid()
|
|
3692 |
== preInstalledAppParams[count]->iPreInstalledAppUid)
|
|
3693 |
{
|
|
3694 |
RDEBUG( "CApplicationManagementSession: ActiveComponentsL found= TRUE" );
|
|
3695 |
found = ETrue;
|
|
3696 |
}
|
|
3697 |
}
|
|
3698 |
if (!found)
|
|
3699 |
{
|
|
3700 |
RDEBUG( "CApplicationManagementSession: Adding Pre-installed app" );
|
|
3701 |
TDCUserId preInstalledAppName;
|
|
3702 |
preInstalledAppName.Copy(
|
|
3703 |
preInstalledAppParams[count]->iPreInstalledAppame);
|
|
3704 |
CDeploymentComponent *preInstallCompo = NULL;
|
|
3705 |
RDEBUG8_2("CApplicationManagementSession: Installed App Name is: %S",&preInstalledAppName);
|
|
3706 |
preInstallCompo = Server().Storage()->NewComponentL(EDCSActive,
|
|
3707 |
preInstalledAppName);
|
|
3708 |
preInstallCompo->SetUid(
|
|
3709 |
preInstalledAppParams[count]->iPreInstalledAppUid);
|
|
3710 |
preInstallCompo->SetNameL(preInstalledAppName);
|
|
3711 |
preInstallCompo->SetVersionL(
|
|
3712 |
preInstalledAppParams[count]->iVersion);
|
|
3713 |
preInstallCompo->SetMimeTypeL(
|
|
3714 |
preInstalledAppParams[count]->iMimeType);
|
|
3715 |
preInstallCompo->SetAppRemovableStatus(ETrue);
|
|
3716 |
|
|
3717 |
Server().Storage()->UpdateL(*preInstallCompo);
|
|
3718 |
Server().Storage()->CheckForDuplicateNodesInDeployedL(
|
|
3719 |
*preInstallCompo);
|
|
3720 |
}
|
|
3721 |
}
|
|
3722 |
delete preInstallApp;
|
|
3723 |
RComponentIdArray arr;
|
|
3724 |
Server().Storage()->GetStateChangeComponentIdsL(arr);
|
|
3725 |
TPckgBuf<TInt> buflen(arr.Count());
|
|
3726 |
aMessage.WriteL(0, buflen);
|
|
3727 |
arr.Close();
|
|
3728 |
RDEBUG( "CApplicationManagementSession: StateChangeComponentIdsCountL end" );
|
|
3729 |
}
|
|
3730 |
|
|
3731 |
// -------------------------------------------------------------------------------------------------------------------
|
|
3732 |
// CApplicationManagementSession::StateChangeCompleteL()
|
|
3733 |
// -------------------------------------------------------------------------------------------------------------------
|
|
3734 |
|
|
3735 |
void CApplicationManagementSession::StateChangeCompleteL(
|
|
3736 |
const RMessage2& aMessage) const
|
|
3737 |
{
|
|
3738 |
RDEBUG( "CApplicationManagementSession: StateChangeCompleteL" );
|
|
3739 |
TUint32 tid;
|
|
3740 |
TPckg<TUint32> ptid(tid);
|
|
3741 |
TInt read2(aMessage.Read(0, ptid));
|
|
3742 |
Server().Storage()->StateChangedL(tid);
|
|
3743 |
}
|
|
3744 |
void CApplicationManagementSession::CheckStatusNodesValuesL()
|
|
3745 |
{
|
|
3746 |
const RComponentIdArray &arrt = Server().Storage()->GetComponentIds();
|
|
3747 |
TInt cont(arrt.Count());
|
|
3748 |
TBool isUpdateRequired = ETrue;
|
|
3749 |
for (TInt i(0); i < cont; i++)
|
|
3750 |
{
|
|
3751 |
CDeploymentComponent &compo = Server().Storage()->ComponentL(arrt[i]);
|
|
3752 |
isUpdateRequired = EFalse;
|
|
3753 |
if (compo.Status() == EDownload_DownloadProgress)
|
|
3754 |
{
|
|
3755 |
compo.SetStatusNode(EDownload_DownloadFailed);
|
|
3756 |
isUpdateRequired = ETrue;
|
|
3757 |
}
|
|
3758 |
else if (compo.Status() == EDelivered_InstallProgress)
|
|
3759 |
{
|
|
3760 |
compo.SetStatusNode(EDelivered_InstalledFailedWithData);
|
|
3761 |
isUpdateRequired = ETrue;
|
|
3762 |
}
|
|
3763 |
else if (compo.Status() == EDelivered_RemoveProgress)
|
|
3764 |
{
|
|
3765 |
compo.SetStatusNode(EDelivered_RemoveFailed);
|
|
3766 |
isUpdateRequired = ETrue;
|
|
3767 |
}
|
|
3768 |
else if (compo.Status() == EDeployed_RemoveProgress)
|
|
3769 |
{
|
|
3770 |
compo.SetStatusNode(EDeployed_RemoveFailed);
|
|
3771 |
isUpdateRequired = ETrue;
|
|
3772 |
}
|
|
3773 |
else if (compo.Status() == EDeployed_ActivateProgress)
|
|
3774 |
{
|
|
3775 |
compo.SetStatusNode(EDeployed_ActivateFailed);
|
|
3776 |
isUpdateRequired = ETrue;
|
|
3777 |
}
|
|
3778 |
else if (compo.Status() == EDeployed_DeactivateProgress)
|
|
3779 |
{
|
|
3780 |
compo.SetStatusNode(EDeployed_DeactivateFailed);
|
|
3781 |
isUpdateRequired = ETrue;
|
|
3782 |
}
|
|
3783 |
if (isUpdateRequired)
|
|
3784 |
Server().Storage()->UpdateL(compo);
|
|
3785 |
}
|
|
3786 |
|
|
3787 |
}
|
|
3788 |
|
|
3789 |
void CApplicationManagementServer::SetSisAppVersionAndDriveL(
|
|
3790 |
CDeploymentComponent &aCompo)
|
|
3791 |
{
|
|
3792 |
RDEBUG( "CApplicationManagementSession: SetSisAppVersionAndDriveL: Begin" );
|
|
3793 |
|
|
3794 |
Swi::RSisRegistrySession sisSession;
|
|
3795 |
User::LeaveIfError(sisSession.Connect());
|
|
3796 |
CleanupClosePushL(sisSession);
|
|
3797 |
|
|
3798 |
Swi::RSisRegistryEntry sisEntry;
|
|
3799 |
|
|
3800 |
//Opens the base package entry by specifying a UID.
|
|
3801 |
User::LeaveIfError(sisEntry.Open(sisSession, aCompo.Uid()));
|
|
3802 |
CleanupClosePushL(sisEntry);
|
|
3803 |
|
|
3804 |
TUint drivesMask = sisEntry.InstalledDrivesL();
|
|
3805 |
|
|
3806 |
TInt drive = EDriveA;
|
|
3807 |
TDriveNumber installedDrive = EDriveC;
|
|
3808 |
|
|
3809 |
if (drivesMask)
|
|
3810 |
{
|
|
3811 |
// Select the highest drive as location drive. That's the case when
|
|
3812 |
// all installation is not in same drive
|
|
3813 |
|
|
3814 |
while (drivesMask >>= 1)
|
|
3815 |
{
|
|
3816 |
drive++;
|
|
3817 |
}
|
|
3818 |
|
|
3819 |
RDEBUG_2( "drive -> SetSisAppVersionAndDriveL %d", drive);
|
|
3820 |
|
|
3821 |
installedDrive = (TDriveNumber) drive;
|
|
3822 |
}
|
|
3823 |
|
|
3824 |
TBool status = EFalse;
|
|
3825 |
|
|
3826 |
//Since "C" drive is not removable
|
|
3827 |
|
|
3828 |
if (installedDrive != EDriveC)
|
|
3829 |
{
|
|
3830 |
status = IsInstalledAppRemovableL(installedDrive);
|
|
3831 |
}
|
|
3832 |
if (status)
|
|
3833 |
{
|
|
3834 |
RDEBUG( "IsInstalledAppRemovableL(SetSisAppVersionAndDriveL); True");
|
|
3835 |
}
|
|
3836 |
else
|
|
3837 |
{
|
|
3838 |
RDEBUG( "IsInstalledAppRemovableL(SetSisAppVersionAndDriveL); False");
|
|
3839 |
}
|
|
3840 |
|
|
3841 |
//check for status drive
|
|
3842 |
aCompo.SetAppRemovableStatus(status);
|
|
3843 |
|
|
3844 |
TVersion version = sisEntry.VersionL();
|
|
3845 |
|
|
3846 |
if (aCompo.ComponentVersion() == KNullDesC8)
|
|
3847 |
{
|
|
3848 |
TBuf8<KVersionLength> pkgDes;
|
|
3849 |
pkgDes.AppendNum(version.iMajor);
|
|
3850 |
pkgDes.Append(KLiteralPeriod);
|
|
3851 |
pkgDes.AppendNum(version.iMinor);
|
|
3852 |
aCompo.SetVersionL(pkgDes);
|
|
3853 |
|
|
3854 |
}
|
|
3855 |
CleanupStack::PopAndDestroy(2, &sisSession);
|
|
3856 |
|
|
3857 |
RDEBUG( "CApplicationManagementSession: SetSisAppVersionAndDriveL: End" );
|
|
3858 |
}
|
|
3859 |
|
|
3860 |
TBool CApplicationManagementServer::IsInstalledAppRemovableL(
|
|
3861 |
TDriveNumber &iDrive)
|
|
3862 |
{
|
|
3863 |
RDEBUG( "IsInstalledAppRemovableL: Step1" );
|
|
3864 |
TBool removable = EFalse;
|
|
3865 |
RFs rfs;
|
|
3866 |
User::LeaveIfError(rfs.Connect());
|
|
3867 |
CleanupClosePushL(rfs);
|
|
3868 |
TDriveList driveList;
|
|
3869 |
TInt driveCount;
|
|
3870 |
|
|
3871 |
//Get all removeable drive, both physically and logically
|
|
3872 |
User::LeaveIfError(DriveInfo::GetUserVisibleDrives(rfs, driveList,
|
|
3873 |
driveCount, KDriveAttRemovable));
|
|
3874 |
|
|
3875 |
TInt max(driveList.Length());
|
|
3876 |
|
|
3877 |
RDEBUG_2( "driveList.Length() %d", max);
|
|
3878 |
|
|
3879 |
RDEBUG_2( "driveCount %d", driveCount);
|
|
3880 |
|
|
3881 |
TBuf<26> buf;
|
|
3882 |
buf.Copy(driveList);
|
|
3883 |
RDEBUG_2( "Drive Info (%S)", &buf);
|
|
3884 |
|
|
3885 |
for (TInt i = 0; i < max; ++i)
|
|
3886 |
{
|
|
3887 |
if (driveList[i])
|
|
3888 |
{
|
|
3889 |
TUint status;
|
|
3890 |
RDEBUG( "IsInstalledAppRemovableL: Step3" );
|
|
3891 |
DriveInfo::GetDriveStatus(rfs, i, status);
|
|
3892 |
|
|
3893 |
RDEBUG( "IsInstalledAppRemovableL: Step4" );
|
|
3894 |
//To make sure the drive is physically removeable not logically removeable
|
|
3895 |
if (status & DriveInfo::EDriveRemovable)
|
|
3896 |
{
|
|
3897 |
RDEBUG( "IsInstalledAppRemovableL: Drive removable" );
|
|
3898 |
RDEBUG_2( "IsInstalledAppRemovableL: Drive removable Drive ID %d", i);
|
|
3899 |
if (i == iDrive)
|
|
3900 |
{
|
|
3901 |
RDEBUG( "IsInstalledAppRemovableL: Step5" );
|
|
3902 |
removable = ETrue;
|
|
3903 |
break;
|
|
3904 |
}
|
|
3905 |
}
|
|
3906 |
}
|
|
3907 |
}
|
|
3908 |
|
|
3909 |
CleanupStack::PopAndDestroy(&rfs);
|
|
3910 |
|
|
3911 |
return removable;
|
|
3912 |
}
|
|
3913 |
|
|
3914 |
// -----------------------------------------------------------------------------
|
|
3915 |
// CShutDown::CShutdown()
|
|
3916 |
// ------------------------------------------------------------------------------------------------
|
|
3917 |
|
|
3918 |
inline CShutdown::CShutdown() :
|
|
3919 |
CTimer(-1)
|
|
3920 |
{
|
|
3921 |
CActiveScheduler::Add(this);
|
|
3922 |
}
|
|
3923 |
|
|
3924 |
// ------------------------------------------------------------------------------------------------
|
|
3925 |
// CShutDown::ConstructL()
|
|
3926 |
// ------------------------------------------------------------------------------------------------
|
|
3927 |
|
|
3928 |
inline void CShutdown::ConstructL()
|
|
3929 |
{
|
|
3930 |
CTimer::ConstructL();
|
|
3931 |
}
|
|
3932 |
|
|
3933 |
// ------------------------------------------------------------------------------------------------
|
|
3934 |
// CShutDown::Start()
|
|
3935 |
// ------------------------------------------------------------------------------------------------
|
|
3936 |
|
|
3937 |
inline void CShutdown::Start()
|
|
3938 |
{
|
|
3939 |
RDEBUG( "ApplicationManagementServer: starting shutdown timeout" );
|
|
3940 |
After(KApplicationManagementShutdownDelay);
|
|
3941 |
}
|
|
3942 |
|
|
3943 |
// ------------------------------------------------------------------------------------------------
|
|
3944 |
// CShutDown::RunL()
|
|
3945 |
// ------------------------------------------------------------------------------------------------
|
|
3946 |
|
|
3947 |
void CShutdown::RunL()
|
|
3948 |
{
|
|
3949 |
RDEBUG( "ApplicationManagementServer timeout ... closing" );
|
|
3950 |
HbApplication::exit(0);
|
|
3951 |
}
|
|
3952 |
|
|
3953 |
// ------------------------------------------------------------------------------------------------
|
|
3954 |
// CShutDown::Start()
|
|
3955 |
// ------------------------------------------------------------------------------------------------
|
|
3956 |
inline void CShutdown::Stop()
|
|
3957 |
{
|
|
3958 |
RDEBUG( "ApplicationManagementServer: Stop" );
|
|
3959 |
HbApplication::exit(0);
|
|
3960 |
}
|
|
3961 |
|
|
3962 |
// End of File
|