|
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 Application Management Components |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #include <e32svr.h> |
|
22 #include "ApplicationManagementClientServer.h" |
|
23 #include "ApplicationManagementClient.h" |
|
24 #include "ApplicationManagementRfs.h" |
|
25 #include "debug.h" |
|
26 #include <apacmdln.h> |
|
27 #include <apgtask.h> |
|
28 |
|
29 |
|
30 #include <apgcli.h> |
|
31 |
|
32 #include <badesca.h> |
|
33 |
|
34 using namespace NApplicationManagement; |
|
35 |
|
36 // ---------------------------------------------------------------------------------------- |
|
37 // Server startup code |
|
38 // ---------------------------------------------------------------------------------------- |
|
39 |
|
40 static TInt StartAMServerL() |
|
41 { |
|
42 RDEBUG("RApplicationManagement: Starting server..."); |
|
43 |
|
44 TInt err = KErrNone; |
|
45 const TUid nameUid = TUid::Uid(KUikonUidPluginInterfaceNotifiers); |
|
46 |
|
47 const TUid appServerUid = TUid::Uid(KAppMgmtServerUid ); |
|
48 |
|
49 RApaLsSession apa; |
|
50 err = apa.Connect(); |
|
51 User::LeaveIfError(err); |
|
52 CleanupClosePushL(apa); |
|
53 |
|
54 // Get application information |
|
55 TApaAppInfo info; |
|
56 |
|
57 for(TInt i = 20; ((err = apa.GetAppInfo(info, |
|
58 appServerUid)) == RApaLsSession::EAppListInvalid) && i > 0; i--) |
|
59 { |
|
60 User::After(500000); |
|
61 } |
|
62 User::LeaveIfError(err); |
|
63 |
|
64 TRequestStatus aRequestStatusForRendezvous; |
|
65 |
|
66 // Start aplication server |
|
67 CApaCommandLine* cmdLine = CApaCommandLine::NewLC(); |
|
68 cmdLine->SetExecutableNameL(info.iFullName); |
|
69 cmdLine->SetServerRequiredL(nameUid.iUid ); |
|
70 cmdLine->SetCommandL(EApaCommandBackground); |
|
71 TThreadId srvid; |
|
72 err = apa.StartApp(*cmdLine, srvid, &aRequestStatusForRendezvous); |
|
73 User::LeaveIfError(err); |
|
74 |
|
75 User::WaitForRequest(aRequestStatusForRendezvous); |
|
76 CleanupStack::PopAndDestroy(2, &apa); // cmdLine and apa |
|
77 |
|
78 return KErrNone; |
|
79 } |
|
80 |
|
81 EXPORT_C RAppMgmtRfs::RAppMgmtRfs() |
|
82 { |
|
83 } |
|
84 EXPORT_C TInt RAppMgmtRfs::Connect() |
|
85 { |
|
86 TInt retry=2; |
|
87 TVersion ver( KAMVerMajor, KAMVerMinor, KAMVerBuild ); |
|
88 for (;;) |
|
89 { |
|
90 |
|
91 TInt r; |
|
92 |
|
93 const TUid nameUid = TUid::Uid(KUikonUidPluginInterfaceNotifiers); |
|
94 |
|
95 const TUid appServerUid = TUid::Uid(KAppMgmtServerUid ); |
|
96 |
|
97 _LIT(KServerNameFormat, "%08x_%08x_AppServer"); |
|
98 TFullName serverName; |
|
99 serverName.Format(KServerNameFormat, |
|
100 nameUid, appServerUid); |
|
101 TRAP(r, ConnectExistingByNameL(serverName) ); |
|
102 if(r) |
|
103 { |
|
104 |
|
105 r = CreateSession (serverName, ver); |
|
106 |
|
107 } |
|
108 if (r!=KErrNotFound && r!=KErrServerTerminated) |
|
109 return r; |
|
110 if (--retry==0) |
|
111 return r; |
|
112 TRAP_IGNORE(r=StartAMServerL()); |
|
113 if (r!=KErrNone && r!=KErrAlreadyExists) |
|
114 { |
|
115 return r; |
|
116 } |
|
117 } |
|
118 } |
|
119 |
|
120 |
|
121 EXPORT_C void RAppMgmtRfs::Close() |
|
122 { |
|
123 REikAppServiceBase::Close(); //basecall |
|
124 } |
|
125 |
|
126 // New methods |
|
127 EXPORT_C void RAppMgmtRfs::PerformRfsL() const |
|
128 { |
|
129 User::LeaveIfError( SendReceive( EPerformRfs, TIpcArgs() ) ); |
|
130 } |
|
131 |
|
132 TUid RAppMgmtRfs::ServiceUid() const |
|
133 { |
|
134 return TUid::Uid( KAMServiceUid); |
|
135 } |
|
136 |
|
137 |
|
138 EXPORT_C RApplicationManagement::RApplicationManagement() |
|
139 { |
|
140 } |
|
141 |
|
142 // This is the standard retry pattern for server connection |
|
143 EXPORT_C TInt RApplicationManagement::Connect( ) |
|
144 { |
|
145 TInt retry=2; |
|
146 TVersion ver( KAMVerMajor, KAMVerMinor, KAMVerBuild ); |
|
147 for (;;) |
|
148 { |
|
149 |
|
150 TInt r; |
|
151 |
|
152 const TUid nameUid = TUid::Uid(KUikonUidPluginInterfaceNotifiers); |
|
153 |
|
154 const TUid appServerUid = TUid::Uid(KAppMgmtServerUid ); |
|
155 |
|
156 _LIT(KServerNameFormat, "%08x_%08x_AppServer"); |
|
157 TFullName serverName; |
|
158 serverName.Format(KServerNameFormat, |
|
159 nameUid, appServerUid); |
|
160 TRAP(r, ConnectExistingByNameL(serverName) ); |
|
161 if(r) |
|
162 { |
|
163 |
|
164 r = CreateSession (serverName, ver); |
|
165 |
|
166 } |
|
167 if (r!=KErrNotFound && r!=KErrServerTerminated) |
|
168 return r; |
|
169 if (--retry==0) |
|
170 return r; |
|
171 TRAP_IGNORE(r=StartAMServerL()) |
|
172 if (r!=KErrNone && r!=KErrAlreadyExists) |
|
173 { |
|
174 return r; |
|
175 } |
|
176 } |
|
177 } |
|
178 |
|
179 EXPORT_C TInt RApplicationManagement::Connect( const TCertInfo &aCertInfo ) |
|
180 { |
|
181 TInt r( Connect() ); |
|
182 if ( r == KErrNone || r == KErrAlreadyExists ) |
|
183 { |
|
184 TPckg<TCertInfo> pkg( aCertInfo ); |
|
185 r = SendReceive( EAddTrust, TIpcArgs( &pkg ) ); |
|
186 } |
|
187 return r; |
|
188 } |
|
189 |
|
190 |
|
191 EXPORT_C void RApplicationManagement::Close() |
|
192 { |
|
193 REikAppServiceBase::Close(); |
|
194 } |
|
195 |
|
196 |
|
197 |
|
198 EXPORT_C TUint32 RApplicationManagement::DeliverL( const TDCUserId &aUserId ) const |
|
199 { |
|
200 TDeploymentComponent aInfo( KNullDesC8(), KNullDesC8(), KNullDesC8(), EDCSNone ); |
|
201 TDeploymentComponentIPC pkg( aInfo, KNullDesC8(), aUserId ); |
|
202 |
|
203 TPckg<TDeploymentComponentIPC> pinfo(pkg); |
|
204 TUint32 id = 0; |
|
205 TPckg< TUint32 > pid( id ); |
|
206 const TDesC8& empty = KNullDesC8(); |
|
207 |
|
208 TInt err( SendReceive( EDeplCompDeliverStartOperation2, TIpcArgs( &pinfo, &empty, &pid) ) ); |
|
209 if ( err == KErrNone ) |
|
210 { |
|
211 RDEBUG_2( "ApplicationManagementServer: DeliverL start SUCCESS id: %d", id ); |
|
212 //TPckg<TDeploymentComponent> pinfo2(aInfo); |
|
213 |
|
214 err = SendReceive( EDeplCompDeliverCompleteOperation, TIpcArgs( &pid, &empty, &empty )); |
|
215 |
|
216 if ( err == KErrNone ) |
|
217 { |
|
218 RDEBUG_2( "ApplicationManagementServer: DeliverL complete SUCCESS id: %d", id ); |
|
219 err = id; |
|
220 } |
|
221 else |
|
222 { |
|
223 RDEBUG_2( "ApplicationManagementServer: DeliverL failed2... %d", err); |
|
224 } |
|
225 } |
|
226 else |
|
227 { |
|
228 RDEBUG_2("ApplicationManagementServer: DeliverL failed1... %d", err); |
|
229 } |
|
230 User::LeaveIfError( err ); |
|
231 return err; |
|
232 } |
|
233 |
|
234 |
|
235 |
|
236 EXPORT_C TInt RApplicationManagement::DeploymentComponent( |
|
237 TUint32 aInternalId, TDeploymentComponent &aReturnValue ) const |
|
238 { |
|
239 TPckg<TDeploymentComponent> pinfo(aReturnValue); |
|
240 TPckg< TUint32 > pid( aInternalId ); |
|
241 TInt err( SendReceive( EDeplCompGetOperation, TIpcArgs( &pid, &pinfo) ) ); |
|
242 if ( err == KErrNone ) |
|
243 { |
|
244 RDEBUG_2( "RApplicationManagement: DeploymentComponent start SUCCESS id: %d", aInternalId ); |
|
245 } |
|
246 else |
|
247 { |
|
248 RDEBUG_2("RApplicationManagement: DeploymentComponent failed... %d", err); |
|
249 } |
|
250 |
|
251 return err; |
|
252 } |
|
253 |
|
254 |
|
255 EXPORT_C void RApplicationManagement::DeploymentComponentUserIdL( |
|
256 TUint32 aInternalId, TDCUserId &aResponse ) const |
|
257 { |
|
258 |
|
259 TPckgC< TUint32 > pid( aInternalId ); |
|
260 TInt err( SendReceive( EDeplCompGetUserIdOperation, TIpcArgs( &pid, &aResponse) ) ); |
|
261 if ( err == KErrNone ) |
|
262 { |
|
263 RDEBUG_2( "RApplicationManagement: DeploymentComponentUserIdL SUCCESS id: %d", aInternalId ); |
|
264 } |
|
265 else |
|
266 { |
|
267 RDEBUG_2( "RApplicationManagement: DeploymentComponentUserIdL failed... %d", err); |
|
268 } |
|
269 |
|
270 User::LeaveIfError( err ); |
|
271 } |
|
272 |
|
273 |
|
274 /** |
|
275 * @param aInternalId Id of the component to be found |
|
276 * @param aBuffer a buffer to store results |
|
277 * @return KErrNone Symbian error code |
|
278 */ |
|
279 EXPORT_C void RApplicationManagement::DeploymentComponentDataL( |
|
280 TUint32 aInternalId, TDeplCompAttrType aDataType, CBufBase &aBuffer ) const |
|
281 { |
|
282 //aBuffer.ResizeL( |
|
283 TPckg< TUint32 > pid( aInternalId ); |
|
284 TPckg< TDeplCompAttrType > pdt( aDataType ); |
|
285 TInt length( 0 ); |
|
286 TPckg< TInt > plen( length ); |
|
287 aBuffer.Reset(); |
|
288 TInt err( KErrNone) ; |
|
289 if ( aDataType == EDCInstallOptions |
|
290 || aDataType == EDCMetaData |
|
291 || aDataType == EDCData |
|
292 || aDataType == EDCDataMime |
|
293 || aDataType == EDCMetaDataMime |
|
294 || aDataType == EDCDownloadURI ) |
|
295 { |
|
296 err = SendReceive( EDeplCompGetDataLengthOperation, TIpcArgs( &pid, &pdt, &plen) ) ; |
|
297 if ( err == KErrNone ) |
|
298 { |
|
299 |
|
300 } |
|
301 else |
|
302 { |
|
303 RDEBUG_2( "RApplicationManagement: DeploymentComponentDataL EDeplCompGetDataLengthOperation ERROR failed to get length... %d", err ); |
|
304 } |
|
305 } |
|
306 else if ( aDataType == EDCStatus) |
|
307 { |
|
308 length = 0; // to make sure we don't fetch it twice |
|
309 TPckgBuf<TInt> ptr; |
|
310 err = SendReceive( EDeplCompGetDataOperation, TIpcArgs( &pid, &pdt, &ptr ) ); |
|
311 if ( err == KErrNone ) |
|
312 { |
|
313 TBuf8<10> b; |
|
314 b.AppendNum( ptr() ); |
|
315 aBuffer.InsertL( 0, b ); |
|
316 RDEBUG( "RApplicationManagement: DeploymentComponentDataL EDCDownloadStatus SUCCESS!" ); |
|
317 } |
|
318 else |
|
319 { |
|
320 RDEBUG_2( "RApplicationManagement: DeploymentComponentDataL EDCDownloadStatus ERROR failed... %d", err ); |
|
321 } |
|
322 } |
|
323 else if ( aDataType == EDCConRef ) |
|
324 { |
|
325 length = 0; // to make sure we don't fetch it twice |
|
326 TPckgBuf<TInt> ptr; |
|
327 err = SendReceive( EDeplCompGetDataOperation, TIpcArgs( &pid, &pdt, &ptr ) ); |
|
328 if ( err == KErrNone ) |
|
329 { |
|
330 aBuffer.InsertL( 0, ptr ); |
|
331 RDEBUG( "RApplicationManagement: DeploymentComponentDataL EDCConRef SUCCESS!" ); |
|
332 } |
|
333 else |
|
334 { |
|
335 RDEBUG_2( "RApplicationManagement: DeploymentComponentDataL EDCConRefERROR failed... %d" , err ); |
|
336 } |
|
337 } |
|
338 else |
|
339 { |
|
340 User::Leave( KErrArgument ); |
|
341 } |
|
342 if ( length > 0 ) |
|
343 { |
|
344 HBufC8 *buf = HBufC8::NewLC( length ); |
|
345 TPtr8 ptr( buf->Des() ); |
|
346 err = SendReceive( EDeplCompGetDataOperation, TIpcArgs( &pid, &pdt, &ptr ) ); |
|
347 if ( err == KErrNone ) |
|
348 { |
|
349 aBuffer.InsertL( 0, ptr ); |
|
350 RDEBUG( "RApplicationManagement: DeploymentComponentDataL EDeplCompGetDataOperation SUCCESS!" ); |
|
351 } |
|
352 else |
|
353 { |
|
354 RDEBUG_2( "RApplicationManagement: DeploymentComponentDataL EDeplCompGetDataOperationERROR failed... %d", err ); |
|
355 } |
|
356 CleanupStack::PopAndDestroy( buf ); |
|
357 } |
|
358 else |
|
359 { |
|
360 RDEBUG( "RApplicationManagement: DeploymentComponentDataL: Length is zero" ); |
|
361 } |
|
362 User::LeaveIfError( err ); |
|
363 } |
|
364 |
|
365 |
|
366 EXPORT_C TInt RApplicationManagement::DeploymentComponentIdsL( |
|
367 RElementIdArray &aArray, const TDeploymentComponentState aState ) const |
|
368 { |
|
369 RDEBUG_2( "RApplicationManagement: DeploymentComponentIds aState=%d!", aState ); |
|
370 TInt count = 0; |
|
371 TPckg<TInt> cnt(count); |
|
372 TPckg<TDeploymentComponentState> pk(aState); |
|
373 TInt err( SendReceive( EDeplCompCountOperation, TIpcArgs( &cnt, &pk ) ) ); |
|
374 RDEBUG_2( "RApplicationManagement: DeploymentComponentIds : Count is %d", count ); |
|
375 if ( err == KErrNone ) |
|
376 { |
|
377 if ( count > 0 ) |
|
378 { |
|
379 aArray.Reset(); |
|
380 for ( TInt i( 0 ); i != count; ++i ) |
|
381 { |
|
382 aArray.AppendL( 0 ); |
|
383 } |
|
384 TPtr8 p( reinterpret_cast< TUint8* >( &aArray[0] ), 0, count * sizeof( TUint32 ) ); |
|
385 err = SendReceive( EDeplCompIdsOperation, TIpcArgs( &p, &pk ) ) ; |
|
386 if ( err == KErrNone ) |
|
387 { |
|
388 RDEBUG( "RApplicationManagement: DeploymentComponentIds SUCCESS!" ); |
|
389 } |
|
390 else |
|
391 { |
|
392 RDEBUG_2( "RApplicationManagement: DeploymentComponentIds failed... %d", err ); |
|
393 } |
|
394 } |
|
395 } |
|
396 else |
|
397 { |
|
398 RDEBUG_2( "RApplicationManagement: DeploymentComponentIds failed to get count... %d", err); |
|
399 } |
|
400 return err; |
|
401 } |
|
402 |
|
403 /** |
|
404 * InstallL Installs given deployment component. |
|
405 * @param aDeploymentComponent The deployment component to be installed |
|
406 * @param aTargetState Will the installed component be actibve or inactive (default active) |
|
407 * @return KErrNone Symbian error code |
|
408 */ |
|
409 EXPORT_C void RApplicationManagement::InstallL( TUint32 aInternalId, |
|
410 TDeploymentComponentState aTargetState ) const |
|
411 { |
|
412 TPckg<TUint32> id(aInternalId); |
|
413 if ( aTargetState != EDCSActive && aTargetState != EDCSInactive ) |
|
414 { |
|
415 // install only to either of above states |
|
416 User::Leave( KErrArgument ); |
|
417 } |
|
418 TPckg<TDeploymentComponentState> pk( aTargetState ); |
|
419 |
|
420 TInt err( SendReceive( EInstallOperation, TIpcArgs( &id, &pk ) ) ); |
|
421 if ( err == KErrNone ) |
|
422 { |
|
423 RDEBUG( "RApplicationManagement: InstallL SUCCESS!" ); |
|
424 } |
|
425 else |
|
426 { |
|
427 RDEBUG_2("ApplicationManagementServer: InstallL failed... %d", err); |
|
428 if( err == KErrNotFound ) |
|
429 { |
|
430 err = KErrArgument ; // indicates that data was not filled... |
|
431 } |
|
432 } |
|
433 User::LeaveIfError( err ) ; |
|
434 } |
|
435 |
|
436 EXPORT_C void RApplicationManagement::UpdateDeploymentComponentDataL( |
|
437 TUint32 aInternalId, TDeplCompAttrType aItem, const TDesC8 &aItemData, const TDesC8 &aDataMime ) const |
|
438 { |
|
439 TDeplCompDataIPC ipc ; |
|
440 ipc.iDataMime = aDataMime; |
|
441 ipc.iInternalId = aInternalId ; |
|
442 ipc.iAttrType = aItem ; |
|
443 TPckg<TDeplCompDataIPC> pipc( ipc ); |
|
444 |
|
445 TInt err( SendReceive( EDeplCompUpdateDataOperation, TIpcArgs( &pipc, &aItemData ) ) ); |
|
446 if ( err == KErrNone ) |
|
447 { |
|
448 RDEBUG( "RApplicationManagement: UpdateDeploymentComponentDataL SUCCESS!" ); |
|
449 } |
|
450 else |
|
451 { |
|
452 RDEBUG_2("ApplicationManagementServer: UpdateDeploymentComponentDataL failed... %d", err); |
|
453 } |
|
454 User::LeaveIfError( err ); |
|
455 } |
|
456 |
|
457 EXPORT_C void RApplicationManagement::UpdateDeploymentComponentStreamedDataL( |
|
458 TUint32 aInternalId, TDeplCompAttrType aItem, const TDesC8 &aDataMime ) const |
|
459 { |
|
460 TDeplCompDataIPC ipc ; |
|
461 ipc.iDataMime = aDataMime; |
|
462 ipc.iInternalId = aInternalId ; |
|
463 ipc.iAttrType = aItem ; |
|
464 TPckg<TDeplCompDataIPC> pipc( ipc ); |
|
465 |
|
466 TInt err( SendReceive( EDeplCompUpdateStreamedDataOperation, TIpcArgs( &pipc ) ) ); |
|
467 if ( err == KErrNone ) |
|
468 { |
|
469 RDEBUG( "RApplicationManagement: UpdateDeploymentComponentStreamedDataL SUCCESS!" ); |
|
470 } |
|
471 else |
|
472 { |
|
473 RDEBUG_2("ApplicationManagementServer: UpdateDeploymentComponentStreamedDataL failed... %d", err); |
|
474 } |
|
475 User::LeaveIfError( err ); |
|
476 } |
|
477 |
|
478 |
|
479 EXPORT_C void RApplicationManagement::UpdateDeploymentComponentL( |
|
480 TUint32 aInternalId, TDeplCompAttrType aItem, const TDesC8 &aItemData ) const |
|
481 { |
|
482 TPckg<TUint32> id(aInternalId); |
|
483 TPckg<TDeplCompAttrType> itemid(aItem); |
|
484 |
|
485 TInt err( SendReceive( EDeplCompAttrUpdateOperation, TIpcArgs( &id, &itemid, &aItemData ) ) ); |
|
486 if ( err == KErrNone ) |
|
487 { |
|
488 RDEBUG( "RApplicationManagement: UpdateDeploymentComponentL SUCCESS!" ); |
|
489 } |
|
490 else |
|
491 { |
|
492 RDEBUG_2("ApplicationManagementServer: UpdateDeploymentComponentL failed... %d", err); |
|
493 } |
|
494 User::LeaveIfError( err ); |
|
495 } |
|
496 |
|
497 |
|
498 /** |
|
499 * RemoveL Removes given deployment component. |
|
500 * @param aInternalId Id of the component to be removed |
|
501 * @return KErrNone Symbian error code |
|
502 */ |
|
503 EXPORT_C void RApplicationManagement::RemoveL( TUint32 aInternalId ) const |
|
504 { |
|
505 TPckg< TUint32 > id( aInternalId ); |
|
506 RDEBUG_2( "RApplicationManagement: RemoveL %d!" , aInternalId ); |
|
507 |
|
508 TInt err( SendReceive( EDeplCompRemoveOperation, TIpcArgs( &id ) ) ); |
|
509 if ( err == KErrNone ) |
|
510 { |
|
511 RDEBUG( "RApplicationManagement: RemoveL SUCCESS!" ); |
|
512 } |
|
513 else if ( err == KErrNotFound ) |
|
514 { |
|
515 RDEBUG( "RApplicationManagement: RemoveL WARNING Component already missing!" ); |
|
516 } |
|
517 else |
|
518 { |
|
519 RDEBUG_2("ApplicationManagementServer: RemoveL failed... %d", err); |
|
520 User::LeaveIfError( err ); |
|
521 } |
|
522 } |
|
523 |
|
524 |
|
525 /** |
|
526 * StartDownloadL Starts download of deployment component. |
|
527 * @param aInternalId The id of the component to be downloaded |
|
528 * @return |
|
529 */ |
|
530 EXPORT_C void RApplicationManagement::StartDownloadL( TUint32 aInternalId, |
|
531 const TDownloadTarget aTarget ) const |
|
532 { |
|
533 TPckg< TUint32 > id( aInternalId ); |
|
534 RDEBUG_2( "RApplicationManagement: StartDownloadL %d!", aInternalId ); |
|
535 TPckg< TDownloadTarget > trg( aTarget ); |
|
536 TInt err( SendReceive( EDeplCompStartDownloadOperation, TIpcArgs( &id, &trg ) ) ); |
|
537 if ( err == KErrNone ) |
|
538 { |
|
539 RDEBUG( "RApplicationManagement: StartDownloadL SUCCESS!" ); |
|
540 } |
|
541 else |
|
542 { |
|
543 RDEBUG_2("ApplicationManagementServer: StartDownloadL failed... %d", err); |
|
544 } |
|
545 User::LeaveIfError( err ); |
|
546 } |
|
547 |
|
548 |
|
549 EXPORT_C TUint32 RApplicationManagement::DownloadL( const TDCUserId &aUserId ) const |
|
550 { |
|
551 TUint32 id( 0 ) ; |
|
552 TPckg< TUint32 > pid( id ); |
|
553 |
|
554 TInt err( SendReceive( EDeplCompDownloadOperation, TIpcArgs( &pid, &aUserId ) ) ); |
|
555 if ( err == KErrNone ) |
|
556 { |
|
557 RDEBUG( "RApplicationManagement: DownloadL SUCCESS!" ); |
|
558 err = pid() ; |
|
559 } |
|
560 else |
|
561 { |
|
562 RDEBUG_2("ApplicationManagementServer: DownloadL failed... %d", err); |
|
563 } |
|
564 return err ; |
|
565 } |
|
566 |
|
567 EXPORT_C void RApplicationManagement::UpdateL( TUint32 aSourceInternalId, TUint32 aTargetInternalId ) const |
|
568 { |
|
569 TPckg< TUint32 > sid( aSourceInternalId ); |
|
570 TPckg< TUint32 > tid( aTargetInternalId ); |
|
571 |
|
572 TInt err( SendReceive( EDeplCompUpdateOperation, TIpcArgs( &sid, &tid ) ) ); |
|
573 if ( err == KErrNone ) |
|
574 { |
|
575 RDEBUG( "RApplicationManagement: UpdateL SUCCESS!" ); |
|
576 } |
|
577 else |
|
578 { |
|
579 RDEBUG_2("ApplicationManagementServer: UpdateL failed... %d", err); |
|
580 } |
|
581 User::LeaveIfError( err ); |
|
582 } |
|
583 |
|
584 |
|
585 |
|
586 EXPORT_C TInt RApplicationManagement::StateChangingDCIdsL( RElementIdArray &aArray ) const |
|
587 { |
|
588 RDEBUG( "RApplicationManagement: StateChangingDCIds " ); |
|
589 TInt count( 0 ) ; |
|
590 TPckg<TInt> cnt(count); |
|
591 TInt err( SendReceive( EGetStateChangingIdsCountOperation, TIpcArgs( &cnt ) ) ); |
|
592 if ( err == KErrNone ) |
|
593 { |
|
594 aArray.Reset(); |
|
595 if ( count > 0 ) |
|
596 { |
|
597 for ( TInt i( 0 ); i != count; ++i ) |
|
598 { |
|
599 aArray.AppendL( 0 ); |
|
600 } |
|
601 TPtr8 p( reinterpret_cast< TUint8* >( &aArray[0] ), 0, count * sizeof( TUint32 ) ); |
|
602 err = SendReceive( EGetStateChangingIdsOperation, TIpcArgs( &p ) ) ; |
|
603 if ( err == KErrNone ) |
|
604 { |
|
605 RDEBUG( "RApplicationManagement: StateChangingDCIds SUCCESS!" ); |
|
606 } |
|
607 else |
|
608 { |
|
609 RDEBUG_2( "RApplicationManagement: StateChangingDCIds failed... %d" , err ); |
|
610 } |
|
611 } |
|
612 else |
|
613 { |
|
614 RDEBUG_2("RApplicationManagement: StateChangingDCIds SUCCESS zero dcs... %d", count); |
|
615 } |
|
616 } |
|
617 else |
|
618 { |
|
619 RDEBUG_2("RApplicationManagement: StateChangingDCIds failed... %d", err); |
|
620 } |
|
621 return err; |
|
622 } |
|
623 |
|
624 |
|
625 EXPORT_C TInt RApplicationManagement::StateChangeComplete( TUint32 aInternalId ) const |
|
626 { |
|
627 TPckg<TUint32> id(aInternalId); |
|
628 |
|
629 TInt err( SendReceive( ECompleteStateChangeOperation, TIpcArgs( &id ) ) ); |
|
630 if ( err == KErrNone ) |
|
631 { |
|
632 RDEBUG( "RApplicationManagement: StateChangeComplete SUCCESS!" ); |
|
633 } |
|
634 else |
|
635 { |
|
636 RDEBUG_2("ApplicationManagementServer: StateChangeComplete failed... %d", err); |
|
637 if( err == KErrNotFound ) |
|
638 { |
|
639 err = KErrArgument ; // indicates that data was not filled... |
|
640 } |
|
641 } |
|
642 return ( err ) ; |
|
643 } |
|
644 |
|
645 |
|
646 /** |
|
647 * ActivateL Tries to activate given deployment component |
|
648 * |
|
649 * @param aInternalId The id of the component to be activated |
|
650 */ |
|
651 EXPORT_C void RApplicationManagement::ActivateL( TUint32 aInternalId ) const |
|
652 { |
|
653 TPckg< TUint32 > id( aInternalId ); |
|
654 RDEBUG_2( "RApplicationManagement: ActivateL %d!" , aInternalId ); |
|
655 |
|
656 TInt err( SendReceive( EDeplCompActivateOperation, TIpcArgs( &id ) ) ); |
|
657 if ( err == KErrNone ) |
|
658 { |
|
659 RDEBUG( "RApplicationManagement: ActivateL SUCCESS!" ); |
|
660 } |
|
661 else |
|
662 { |
|
663 RDEBUG_2("ApplicationManagementServer: ActivateL failed... %d", err); |
|
664 } |
|
665 User::LeaveIfError( err ); |
|
666 } |
|
667 |
|
668 /** |
|
669 * DeactivateL Tries to deactivate given deployment component |
|
670 * |
|
671 * @param aInternalId The id of the component to be deactivated |
|
672 */ |
|
673 EXPORT_C void RApplicationManagement::DeactivateL( TUint32 aInternalId ) const |
|
674 { |
|
675 TPckg< TUint32 > id( aInternalId ); |
|
676 RDEBUG_2( "RApplicationManagement: DeactivateL %d!", aInternalId ); |
|
677 |
|
678 TInt err( SendReceive( EDeplCompDeactivateOperation, TIpcArgs( &id ) ) ); |
|
679 if ( err == KErrNone ) |
|
680 { |
|
681 RDEBUG( "RApplicationManagement: DeactivateL SUCCESS!" ); |
|
682 } |
|
683 else |
|
684 { |
|
685 RDEBUG_2("ApplicationManagementServer: DeactivateL failed... %d", err); |
|
686 } |
|
687 User::LeaveIfError( err ); |
|
688 } |
|
689 |
|
690 |
|
691 /** |
|
692 * DeploymentComponentDataSizeL Get deployment component attribute size |
|
693 * |
|
694 * @param aInternalId The id of the component |
|
695 * @param aItem The type of attribute whose size is to be got |
|
696 * @return The size |
|
697 */ |
|
698 EXPORT_C TInt RApplicationManagement::DeploymentComponentDataSizeL( TUint32 aInternalId, const TDeplCompAttrType &aDataType ) const |
|
699 { |
|
700 TPckg< TUint32 > pid( aInternalId ); |
|
701 TPckg< TDeplCompAttrType > pdt( aDataType ); |
|
702 TInt length( 0 ); |
|
703 TPckg< TInt > plen( length ); |
|
704 TInt err( KErrNone) ; |
|
705 if ( aDataType == EDCInstallOptions |
|
706 || aDataType == EDCMetaData |
|
707 || aDataType == EDCData |
|
708 || aDataType == EDCDownloadURI ) |
|
709 { |
|
710 err = SendReceive( EDeplCompGetDataLengthOperation, TIpcArgs( &pid, &pdt, &plen) ) ; |
|
711 if ( err == KErrNone ) |
|
712 { |
|
713 |
|
714 } |
|
715 } |
|
716 else if ( aDataType == EDCStatus ) |
|
717 { |
|
718 length = 0; |
|
719 TPckgBuf<TInt> ptr; |
|
720 err = SendReceive( EDeplCompGetDataOperation, TIpcArgs( &pid, &pdt, &ptr ) ); |
|
721 if ( err == KErrNone ) |
|
722 { |
|
723 TBuf8<10> b; |
|
724 b.AppendNum( ptr() ); |
|
725 length = b.Length(); |
|
726 RDEBUG( "RApplicationManagement: DeploymentComponentDataSizeL elseif SUCCESS!" ); |
|
727 } |
|
728 else |
|
729 { |
|
730 RDEBUG_2( "RApplicationManagement: DeploymentComponentDataSizeL ERROR failed... %d", err ); |
|
731 } |
|
732 } |
|
733 else |
|
734 { |
|
735 TPckgBuf<TDeploymentComponent> pinfo; |
|
736 TPckg< TUint32 > pid( aInternalId ); |
|
737 err = SendReceive( EDeplCompGetOperation, TIpcArgs( &pid, &pinfo) ); |
|
738 if ( err == KErrNone ) |
|
739 { |
|
740 RDEBUG_2( "RApplicationManagement: DeploymentComponentDataSizeL else SUCCESS id: %d", aInternalId ); |
|
741 switch ( aDataType ) |
|
742 { |
|
743 case EDCId: |
|
744 { |
|
745 length = pinfo().iId.Length(); |
|
746 break; |
|
747 } |
|
748 case EDCName: |
|
749 { |
|
750 length = pinfo().iName.Length(); |
|
751 break; |
|
752 } |
|
753 case EDCVersion: |
|
754 { |
|
755 length = pinfo().iVersion.Length(); |
|
756 break; |
|
757 } |
|
758 default: |
|
759 { |
|
760 break; |
|
761 } |
|
762 } |
|
763 } |
|
764 else |
|
765 { |
|
766 RDEBUG_2("RApplicationManagement: DeploymentComponentDataSizeL failed... %d", err); |
|
767 } |
|
768 } |
|
769 |
|
770 RDEBUG_2("RApplicationManagement: DeploymentComponentDataSizeL returning... %d", length); |
|
771 |
|
772 return length; |
|
773 } |
|
774 |
|
775 /** |
|
776 * DeploymentComponentTempInstFileL ask file handle from server to be used |
|
777 * |
|
778 * @param aInternalId The id of the component |
|
779 * @param aTempFile temporary file handle |
|
780 * @param aItem The type of attribute whose type of temporary file to get |
|
781 * @return KErrNone Symbian error code |
|
782 */ |
|
783 EXPORT_C void RApplicationManagement::DeploymentComponentTempInstFileL( TUint32 aInternalId, RFile& aTempFile, const TDeplCompAttrType &aItem ) const |
|
784 { |
|
785 RDEBUG_3( "RApplicationManagement: DeploymentComponentTempInstFileL: Id (%d) AttrType (%d)", aInternalId, aItem ); |
|
786 TPckg<TUint32> id(aInternalId); |
|
787 TPckg<TDeplCompAttrType> itemid(aItem); |
|
788 TPckgBuf<TInt> filehandle; |
|
789 |
|
790 TInt fshandle = SendReceive(EDeplCompGetTemporaryInstFile, TIpcArgs( &id, &itemid, &filehandle ) ); |
|
791 TInt err = aTempFile.AdoptFromServer( fshandle, filehandle() ) ; |
|
792 User::LeaveIfError( err ); |
|
793 RDEBUG_2( "RApplicationManagement: DeploymentComponentTempInstFileL fshandle (%d)", fshandle ); |
|
794 } |
|
795 |
|
796 /** |
|
797 * GetFinalResultsForGAL ask results from AM Server. In response AM |
|
798 * server returns final result and target URI of node |
|
799 * |
|
800 * @param aInternalId The id of the component |
|
801 * @param aFinalResult Final result of deployment component |
|
802 * @param aTargetURI Target URI of deployment component |
|
803 * @return void |
|
804 */ |
|
805 |
|
806 EXPORT_C void RApplicationManagement::GetFinalResultsForGAL(TUint32 aInternalId, TInt& aFinalResult, TDes8& aTargetURI) const |
|
807 { |
|
808 TPckg<TUint32> internalid(aInternalId); |
|
809 TPckg<TInt> finalresult(aFinalResult); |
|
810 TPckg<TDesC8> targeturi(aTargetURI); |
|
811 |
|
812 TInt err = SendReceive(EDeplCompGetFinalResultForGA, TIpcArgs( &internalid, &finalresult, &aTargetURI) ); |
|
813 } |
|
814 |
|
815 EXPORT_C void RApplicationManagement::GenericAlertSentL(TUint32 aInternalId) const |
|
816 { |
|
817 |
|
818 TPckg<TUint32> internalid(aInternalId); |
|
819 |
|
820 |
|
821 TInt err = SendReceive(EDeplCompGenericAlertSent, TIpcArgs( &internalid) ); |
|
822 } |
|
823 |
|
824 /** |
|
825 * Implementation of Service UID() from base class. Returns AM service UID |
|
826 * to framework |
|
827 * |
|
828 * @return uid of AM service UID |
|
829 */ |
|
830 EXPORT_C void RApplicationManagement::CheckStatusNodesL( ) const |
|
831 { |
|
832 User::LeaveIfError( SendReceive( ECheckStatusNodes, TIpcArgs() ) ); |
|
833 } |
|
834 |
|
835 TUid RApplicationManagement::ServiceUid() const |
|
836 { |
|
837 |
|
838 |
|
839 return TUid::Uid( KAMServiceUid); |
|
840 } |
|
841 |
|
842 // End of File |