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