62 delete self; |
55 delete self; |
63 } |
56 } |
64 |
57 |
65 template <> |
58 template <> |
66 class TTraits<TDesC> |
59 class TTraits<TDesC> |
67 { |
60 { |
68 public: |
61 public: |
69 static TDesC* CopyLC(const TDesC& aOther) { return aOther.AllocLC(); } |
62 static TDesC* CopyLC(const TDesC& aOther) { return aOther.AllocLC(); } |
70 static TDesC* ReadFromStreamLC(RReadStream& aStream) { return HBufC::NewLC(aStream, KMaxTInt); } |
63 static TDesC* ReadFromStreamLC(RReadStream& aStream) { return HBufC::NewLC(aStream, KMaxTInt); } |
71 static void WriteToStreamL(const TDesC& aItem, RWriteStream& aStream) { aStream << aItem; } |
64 static void WriteToStreamL(const TDesC& aItem, RWriteStream& aStream) { aStream << aItem; } |
72 }; |
65 }; |
73 |
66 |
74 CSisLauncherSession::CSisLauncherSession() |
67 CSisLauncherSession::CSisLauncherSession() |
75 { |
68 { |
76 } |
69 } |
77 |
70 |
78 void CSisLauncherSession::CreateL() |
71 void CSisLauncherSession::CreateL() |
79 { |
72 { |
80 Server().AddSession(); |
73 Server().AddSession(); |
81 } |
74 } |
82 |
75 |
83 CSisLauncherSession::~CSisLauncherSession() |
76 CSisLauncherSession::~CSisLauncherSession() |
84 { |
77 { |
85 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
78 Server().DropSession(); |
86 delete iCurrentAppRegData; |
79 } |
87 #endif |
|
88 Server().DropSession(); |
|
89 } |
|
90 void CSisLauncherSession::DoRunExecutableL(const RMessage2& aMessage) |
80 void CSisLauncherSession::DoRunExecutableL(const RMessage2& aMessage) |
91 { |
81 { |
92 TFileName filename; |
82 TFileName filename; |
93 aMessage.ReadL(0, filename); |
83 aMessage.ReadL(0, filename); |
94 |
84 |
95 TBool wait; |
85 TBool wait; |
96 TPckg <TBool> waitPckg(wait); |
86 TPckg <TBool> waitPckg(wait); |
97 |
87 |
98 aMessage.ReadL(1, waitPckg); |
88 aMessage.ReadL(1, waitPckg); |
99 Server().RunExecutableL(filename, wait); |
89 Server().RunExecutableL(filename, wait); |
100 |
90 |
101 aMessage.Complete(KErrNone); |
91 aMessage.Complete(KErrNone); |
102 } |
92 } |
103 |
93 |
104 void CSisLauncherSession::DoStartDocumentL(const RMessage2& aMessage) |
94 void CSisLauncherSession::DoStartDocumentL(const RMessage2& aMessage) |
105 { |
95 { |
106 TFileName filename; |
96 TFileName filename; |
107 aMessage.ReadL(0, filename); |
97 aMessage.ReadL(0, filename); |
108 |
98 |
109 TBool wait; |
99 TBool wait; |
110 TPckg <TBool> waitPckg(wait); |
100 TPckg <TBool> waitPckg(wait); |
111 |
101 |
112 aMessage.ReadL(1, waitPckg); |
102 aMessage.ReadL(1, waitPckg); |
113 if (Server().BootUpMode() == KTextShell) |
103 if (Server().BootUpMode() == KTextShell) |
114 { |
104 { |
115 // emulator tests running in textshell or in textshell ROM (#def SWI_TEXTSHELL_ROM) |
105 // emulator tests running in textshell or in textshell ROM (#def SWI_TEXTSHELL_ROM) |
116 DEBUG_PRINTF2(_L8("Sis Launcher Server - textshell - skipping start document by file handle. wait = %d"), wait); |
106 DEBUG_PRINTF2(_L8("Sis Launcher Server - textshell - skipping start document by file handle. wait = %d"), wait); |
117 } |
107 } |
118 else |
108 else |
119 { |
109 { |
120 // emulatore running with GUI |
110 // emulatore running with GUI |
121 #ifndef SWI_TEXTSHELL_ROM |
111 #ifndef SWI_TEXTSHELL_ROM |
122 Server().StartDocumentL(filename, wait); |
112 Server().StartDocumentL(filename, wait); |
123 #endif |
113 #endif |
124 } |
114 } |
125 |
115 |
126 aMessage.Complete(KErrNone); |
116 aMessage.Complete(KErrNone); |
127 } |
117 } |
128 |
118 |
129 |
119 |
130 void CSisLauncherSession::DoStartDocumentByHandleL(const RMessage2& aMessage) |
120 void CSisLauncherSession::DoStartDocumentByHandleL(const RMessage2& aMessage) |
131 { |
121 { |
132 RFile file; |
122 RFile file; |
133 file.AdoptFromClient(aMessage, 0, 1); |
123 file.AdoptFromClient(aMessage, 0, 1); |
134 CleanupClosePushL(file); |
124 CleanupClosePushL(file); |
135 |
125 |
136 TBool wait; |
126 TBool wait; |
137 TPckg <TBool> waitPckg(wait); |
127 TPckg <TBool> waitPckg(wait); |
138 |
128 |
139 aMessage.ReadL(2, waitPckg); |
129 aMessage.ReadL(2, waitPckg); |
140 if (Server().BootUpMode() == KTextShell) |
130 if (Server().BootUpMode() == KTextShell) |
141 { |
131 { |
142 // emulator tests running in textshell or in textshell ROM (#def SWI_TEXTSHELL_ROM) |
132 // emulator tests running in textshell or in textshell ROM (#def SWI_TEXTSHELL_ROM) |
143 DEBUG_PRINTF3(_L8("Sis Launcher Server - textshell - skipping start document %S, wait = %d"), |
133 DEBUG_PRINTF3(_L8("Sis Launcher Server - textshell - skipping start document %S, wait = %d"), |
144 &file, wait); |
134 &file, wait); |
145 } |
135 } |
146 else |
136 else |
147 { |
137 { |
148 // emulatore running with GUI |
138 // emulatore running with GUI |
149 #ifndef SWI_TEXTSHELL_ROM |
139 #ifndef SWI_TEXTSHELL_ROM |
150 Server().StartDocumentL(file, wait); |
140 Server().StartDocumentL(file, wait); |
151 #endif |
141 #endif |
152 } |
142 } |
153 CleanupStack::PopAndDestroy(&file); |
143 CleanupStack::PopAndDestroy(&file); |
154 aMessage.Complete(KErrNone); |
144 aMessage.Complete(KErrNone); |
155 } |
145 } |
156 void CSisLauncherSession::DoStartByMimeL(const RMessage2& aMessage) |
146 void CSisLauncherSession::DoStartByMimeL(const RMessage2& aMessage) |
157 { |
147 { |
158 TFileName filename; |
148 TFileName filename; |
159 aMessage.ReadL(0, filename); |
149 aMessage.ReadL(0, filename); |
160 |
150 |
161 TInt srcLen = aMessage.GetDesLengthL(1); |
151 TInt srcLen = aMessage.GetDesLengthL(1); |
162 |
152 |
163 HBufC8* mimeType = HBufC8::NewLC(srcLen); |
153 HBufC8* mimeType = HBufC8::NewLC(srcLen); |
164 TPtr8 ptr(mimeType->Des()); |
154 TPtr8 ptr(mimeType->Des()); |
165 aMessage.ReadL(1, ptr); |
155 aMessage.ReadL(1, ptr); |
166 |
156 |
167 TBool wait; |
157 TBool wait; |
168 TPckg <TBool> waitPckg(wait); |
158 TPckg <TBool> waitPckg(wait); |
169 aMessage.ReadL(2, waitPckg); |
159 aMessage.ReadL(2, waitPckg); |
170 if (Server().BootUpMode() == KTextShell) |
160 if (Server().BootUpMode() == KTextShell) |
171 { |
161 { |
172 // emulator tests running in textshell or in textshell ROM (#def SWI_TEXTSHELL_ROM) |
162 // emulator tests running in textshell or in textshell ROM (#def SWI_TEXTSHELL_ROM) |
173 DEBUG_PRINTF3(_L8("Sis Launcher Server - textshell - skipping start document by file handle mimetype %S, wait = %d"), |
163 DEBUG_PRINTF3(_L8("Sis Launcher Server - textshell - skipping start document by file handle mimetype %S, wait = %d"), |
174 mimeType, wait); |
164 mimeType, wait); |
175 } |
165 } |
176 else |
166 else |
177 { |
167 { |
178 // emulatore running with GUI |
168 // emulatore running with GUI |
179 #ifndef SWI_TEXTSHELL_ROM |
169 #ifndef SWI_TEXTSHELL_ROM |
180 Server().StartByMimeL(filename, *mimeType, wait); |
170 Server().StartByMimeL(filename, *mimeType, wait); |
181 #endif |
171 #endif |
182 } |
172 } |
183 CleanupStack::PopAndDestroy(mimeType); |
173 CleanupStack::PopAndDestroy(mimeType); |
184 |
174 |
185 aMessage.Complete(KErrNone); |
175 aMessage.Complete(KErrNone); |
186 } |
176 } |
187 void CSisLauncherSession::DoStartByMimeByHandleL(const RMessage2& aMessage) |
177 void CSisLauncherSession::DoStartByMimeByHandleL(const RMessage2& aMessage) |
188 { |
178 { |
189 RFile file; |
179 RFile file; |
190 file.AdoptFromClient(aMessage, 0, 1); |
180 file.AdoptFromClient(aMessage, 0, 1); |
191 CleanupClosePushL(file); |
181 CleanupClosePushL(file); |
192 |
182 |
193 TInt srcLen = aMessage.GetDesLengthL(2); |
183 TInt srcLen = aMessage.GetDesLengthL(2); |
194 |
184 |
195 HBufC8* mimeType = HBufC8::NewLC(srcLen); |
185 HBufC8* mimeType = HBufC8::NewLC(srcLen); |
196 TPtr8 ptr(mimeType->Des()); |
186 TPtr8 ptr(mimeType->Des()); |
197 aMessage.ReadL(2, ptr); |
187 aMessage.ReadL(2, ptr); |
198 |
188 |
199 TBool wait; |
189 TBool wait; |
200 TPckg <TBool> waitPckg(wait); |
190 TPckg <TBool> waitPckg(wait); |
201 |
191 |
202 aMessage.ReadL(3, waitPckg); |
192 aMessage.ReadL(3, waitPckg); |
203 if (Server().BootUpMode() == KTextShell) |
193 if (Server().BootUpMode() == KTextShell) |
204 { |
194 { |
205 // emulator tests running in textshell or in textshell ROM (#def SWI_TEXTSHELL_ROM) |
195 // emulator tests running in textshell or in textshell ROM (#def SWI_TEXTSHELL_ROM) |
206 DEBUG_PRINTF4(_L("Sis Launcher Server - textshell - skipping launch of document %S, mimetype %s, wait %d"), |
196 DEBUG_PRINTF4(_L("Sis Launcher Server - textshell - skipping launch of document %S, mimetype %s, wait %d"), |
207 &file, mimeType, wait); |
197 &file, mimeType, wait); |
208 } |
198 } |
209 else |
199 else |
210 { |
200 { |
211 // emulatore running with GUI |
201 // emulatore running with GUI |
212 #ifndef SWI_TEXTSHELL_ROM |
202 #ifndef SWI_TEXTSHELL_ROM |
213 Server().StartByMimeL(file, *mimeType, wait); |
203 Server().StartByMimeL(file, *mimeType, wait); |
214 #endif |
204 #endif |
215 } |
205 } |
216 CleanupStack::PopAndDestroy(mimeType); |
206 CleanupStack::PopAndDestroy(mimeType); |
217 CleanupStack::PopAndDestroy(&file); |
207 CleanupStack::PopAndDestroy(&file); |
218 |
208 |
219 aMessage.Complete(KErrNone); |
209 aMessage.Complete(KErrNone); |
220 |
210 |
221 } |
211 } |
222 void CSisLauncherSession::ServiceL(const RMessage2& aMessage) |
212 void CSisLauncherSession::ServiceL(const RMessage2& aMessage) |
223 { |
213 { |
224 DEBUG_PRINTF2(_L8("Sis Launcher Server - Servicing Message %d"), aMessage.Function()); |
214 DEBUG_PRINTF2(_L8("Sis Launcher Server - Servicing Message %d"), aMessage.Function()); |
225 |
215 |
226 switch (aMessage.Function()) |
216 switch (aMessage.Function()) |
227 { |
217 { |
228 case ERunExecutable: |
218 case ERunExecutable: |
229 DoRunExecutableL(aMessage); |
219 DoRunExecutableL(aMessage); |
230 break; |
220 break; |
231 case EStartDocument: |
221 case EStartDocument: |
232 DoStartDocumentL(aMessage); |
222 DoStartDocumentL(aMessage); |
233 break; |
223 break; |
234 case EStartDocumentByHandle: |
224 case EStartDocumentByHandle: |
235 DoStartDocumentByHandleL(aMessage); |
225 DoStartDocumentByHandleL(aMessage); |
236 break; |
226 break; |
237 case EStartByMime: |
227 case EStartByMime: |
238 DoStartByMimeL(aMessage); |
228 DoStartByMimeL(aMessage); |
239 break; |
229 break; |
240 case EStartByMimeByHandle: |
230 case EStartByMimeByHandle: |
241 DoStartByMimeByHandleL(aMessage); |
231 DoStartByMimeByHandleL(aMessage); |
242 break; |
232 break; |
243 case EShutdown: |
233 case EShutdown: |
244 { |
234 { |
245 TInt srcLen=aMessage.GetDesLengthL(0); |
235 TInt srcLen=aMessage.GetDesLengthL(0); |
246 |
236 |
247 HBufC8* uidBuffer = HBufC8::NewLC(srcLen); |
237 HBufC8* uidBuffer = HBufC8::NewLC(srcLen); |
248 TPtr8 uidPtr = uidBuffer->Des(); |
238 TPtr8 uidPtr = uidBuffer->Des(); |
249 aMessage.ReadL(0, uidPtr, 0); |
239 aMessage.ReadL(0, uidPtr, 0); |
250 |
240 |
251 TUint8* dataPtr=const_cast<TUint8*>(uidPtr.Ptr()); |
241 TUint8* dataPtr=const_cast<TUint8*>(uidPtr.Ptr()); |
252 TUid* tUidPtr=reinterpret_cast<TUid*>(dataPtr); |
242 TUid* tUidPtr=reinterpret_cast<TUid*>(dataPtr); |
253 TInt8 uidCount=srcLen/sizeof(TUid); |
243 TInt8 uidCount=srcLen/sizeof(TUid); |
254 TInt shutdownTimeout = aMessage.Int1(); |
244 TInt shutdownTimeout = aMessage.Int1(); |
255 if (Server().BootUpMode() == KTextShell) |
245 if (Server().BootUpMode() == KTextShell) |
256 { |
246 { |
257 // emulator tests running in textshell or in textshell ROM (#def SWI_TEXTSHELL_ROM) |
247 // emulator tests running in textshell or in textshell ROM (#def SWI_TEXTSHELL_ROM) |
258 DEBUG_PRINTF(_L8("Sis Launcher Server - textshell - skipping graceful shutdown of GUI applications")); |
248 DEBUG_PRINTF(_L8("Sis Launcher Server - textshell - skipping graceful shutdown of GUI applications")); |
259 } |
249 } |
260 else |
250 else |
261 { |
251 { |
262 // emulatore running with GUI |
252 // emulatore running with GUI |
263 #ifndef SWI_TEXTSHELL_ROM |
253 #ifndef SWI_TEXTSHELL_ROM |
264 for (TInt i = 0; i < uidCount; i++) |
254 for (TInt i = 0; i < uidCount; i++) |
265 { |
255 { |
266 // graceful shutdown |
256 // graceful shutdown |
267 Server().ShutdownL(tUidPtr[i], shutdownTimeout); |
257 Server().ShutdownL(tUidPtr[i], shutdownTimeout); |
268 } |
258 } |
269 #endif |
259 #endif |
270 } |
260 } |
271 // Having tried graceful shutdown, we need to kill any remaining processes |
261 // Having tried graceful shutdown, we need to kill any remaining processes |
272 // matching the SID. Note that killing a process may re-order the list of |
262 // matching the SID. Note that killing a process may re-order the list of |
273 // remaining processes, so the search must start from the top again. |
263 // remaining processes, so the search must start from the top again. |
274 for (TInt i = 0; i < uidCount; i++) |
264 for (TInt i = 0; i < uidCount; i++) |
275 { |
265 { |
276 Server().ForceShutdownL(tUidPtr[i]); |
266 Server().ForceShutdownL(tUidPtr[i]); |
277 } |
267 } |
278 CleanupStack::PopAndDestroy(uidBuffer); |
268 CleanupStack::PopAndDestroy(uidBuffer); |
279 aMessage.Complete(KErrNone); |
269 aMessage.Complete(KErrNone); |
280 |
270 |
281 break; |
271 break; |
282 } |
272 } |
283 case EShutdownAll: |
273 case EShutdownAll: |
284 { |
274 { |
285 if (Server().BootUpMode() == KTextShell) |
275 if (Server().BootUpMode() == KTextShell) |
286 { |
276 { |
287 // emulator tests running in textshell or in textshell ROM (#def SWI_TEXTSHELL_ROM) |
277 // emulator tests running in textshell or in textshell ROM (#def SWI_TEXTSHELL_ROM) |
288 DEBUG_PRINTF(_L8("Sis Launcher Server - textshell - skipping shutdown of user applications")); |
278 DEBUG_PRINTF(_L8("Sis Launcher Server - textshell - skipping shutdown of user applications")); |
289 } |
279 } |
290 else |
280 else |
291 { |
281 { |
292 // emulatore running with GUI |
282 // emulatore running with GUI |
293 #ifndef SWI_TEXTSHELL_ROM |
283 #ifndef SWI_TEXTSHELL_ROM |
294 Server().ShutdownL(); |
284 Server().ShutdownL(); |
295 #endif |
285 #endif |
296 } |
286 } |
297 aMessage.Complete(KErrNone); |
287 aMessage.Complete(KErrNone); |
298 break; |
288 break; |
299 } |
289 } |
300 case ECheckApplicationInUse: |
290 case ECheckApplicationInUse: |
301 { |
291 { |
302 TInt srcLen=aMessage.GetDesLengthL(0); |
292 TInt srcLen=aMessage.GetDesLengthL(0); |
303 |
293 |
304 HBufC8* appInUseBuffer = HBufC8::NewLC(srcLen); |
294 HBufC8* appInUseBuffer = HBufC8::NewLC(srcLen); |
305 TPtr8 appInUseBufferPtr = appInUseBuffer->Des(); |
295 TPtr8 appInUseBufferPtr = appInUseBuffer->Des(); |
306 aMessage.ReadL(0, appInUseBufferPtr, 0); |
296 aMessage.ReadL(0, appInUseBufferPtr, 0); |
307 |
297 |
308 TAppInUse* appInUsePtr = (TAppInUse*) User::AllocL(srcLen); |
298 TAppInUse* appInUsePtr = (TAppInUse*) User::AllocL(srcLen); |
309 CleanupStack::PushL(appInUsePtr); |
299 CleanupStack::PushL(appInUsePtr); |
310 Mem::Copy(appInUsePtr, appInUseBufferPtr.Ptr(), srcLen); |
300 Mem::Copy(appInUsePtr, appInUseBufferPtr.Ptr(), srcLen); |
311 |
301 |
312 TUint appInUseCount=srcLen/sizeof(TAppInUse); |
302 TUint appInUseCount=srcLen/sizeof(TAppInUse); |
313 for (TInt i=0;i<appInUseCount;i++) |
303 for (TInt i=0;i<appInUseCount;i++) |
314 { |
304 { |
315 TRAPD(err, CheckApplicationInUseL(appInUsePtr[i].iAppUid)); |
305 TRAPD(err, CheckApplicationInUseL(appInUsePtr[i].iAppUid)); |
316 if (err==KErrInUse) |
306 if (err==KErrInUse) |
317 { |
307 { |
318 appInUsePtr[i].iInUse=ETrue; |
308 appInUsePtr[i].iInUse=ETrue; |
319 } |
309 } |
320 } |
310 } |
321 |
311 |
322 TUint8* dataPtr=reinterpret_cast<TUint8*>(appInUsePtr); |
312 TUint8* dataPtr=reinterpret_cast<TUint8*>(appInUsePtr); |
323 const TPtrC8 data(dataPtr, srcLen); |
313 const TPtrC8 data(dataPtr, srcLen); |
324 |
314 |
325 //Indicate the client apps in use |
315 //Indicate the client apps in use |
326 aMessage.WriteL(0, data); |
316 aMessage.WriteL(0, data); |
327 aMessage.Complete(KErrNone); |
317 aMessage.Complete(KErrNone); |
328 CleanupStack::PopAndDestroy(appInUsePtr); |
318 CleanupStack::PopAndDestroy(appInUsePtr); |
329 CleanupStack::PopAndDestroy(appInUseBuffer); |
319 CleanupStack::PopAndDestroy(appInUseBuffer); |
330 break; |
320 break; |
331 } |
321 } |
332 case ENotifyNewApps: |
322 case ENotifyNewApps: |
333 { |
323 { |
334 TInt size = aMessage.GetDesLengthL(0); |
324 TInt size = aMessage.GetDesLengthL(0); |
335 |
325 |
336 HBufC8* buf = HBufC8::NewLC(size); |
326 HBufC8* buf = HBufC8::NewLC(size); |
337 TPtr8 bufPtr = buf->Des(); |
327 TPtr8 bufPtr = buf->Des(); |
338 aMessage.ReadL(0, bufPtr); |
328 aMessage.ReadL(0, bufPtr); |
339 |
329 |
340 RDesReadStream stream(*buf); |
330 RDesReadStream stream(*buf); |
341 RPointerArray<TDesC> files; |
331 RPointerArray<TDesC> files; |
342 InternalizePointerArrayL(files, stream); |
332 InternalizePointerArrayL(files, stream); |
343 |
333 if (Server().BootUpMode() == KTextShell) |
344 if (Server().BootUpMode() == KTextShell) |
334 { |
345 { |
335 // emulator tests running in textshell or in textshell ROM (#def SWI_TEXTSHELL_ROM) |
346 // emulator tests running in textshell or in textshell ROM (#def SWI_TEXTSHELL_ROM) |
336 DEBUG_PRINTF(_L8("Sis Launcher Server - textshell - skipping notification of new applications.")); |
347 DEBUG_PRINTF(_L8("Sis Launcher Server - TextShell - skipping notification of new applications (ENotifyNewApps).")); |
337 } |
348 } |
338 else |
349 else |
339 { |
350 { |
340 // emulatore running with GUI |
351 // emulatore running with GUI |
341 #ifndef SWI_TEXTSHELL_ROM |
352 #ifndef SWI_TEXTSHELL_ROM |
342 Server().NotifyNewAppsL(files); |
353 Server().NotifyNewAppsL(files); |
343 #endif |
354 #endif // SWI_TEXTSHELL_ROM |
344 } |
355 } |
345 files.ResetAndDestroy(); |
356 |
346 |
357 files.ResetAndDestroy(); |
347 CleanupStack::PopAndDestroy(buf); |
358 CleanupStack::PopAndDestroy(buf); |
348 |
359 |
349 aMessage.Complete(KErrNone); |
360 aMessage.Complete(KErrNone); |
350 break; |
361 break; |
351 } |
362 } |
352 case EParseSwTypeRegFile: |
|
353 #ifndef SWI_TEXTSHELL_ROM |
|
354 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
355 ParseSwTypeRegFileL(aMessage); |
|
356 #endif |
|
357 #endif |
|
358 aMessage.Complete(KErrNone); |
|
359 break; |
|
360 case ERegisterSifLauncherMimeTypes: |
|
361 #ifndef SWI_TEXTSHELL_ROM |
|
362 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
363 RegisterSifLauncherMimeTypesL(aMessage); |
|
364 #endif |
|
365 #endif |
|
366 aMessage.Complete(KErrNone); |
|
367 break; |
|
368 case EUnregisterSifLauncherMimeTypes: |
|
369 #ifndef SWI_TEXTSHELL_ROM |
|
370 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
371 UnregisterSifLauncherMimeTypesL(aMessage); |
|
372 #endif |
|
373 #endif |
|
374 aMessage.Complete(KErrNone); |
|
375 break; |
|
376 case EQueueRunExecutable: |
|
377 //fall through |
|
378 case EQueueStartDocumentByHandle: |
|
379 //fall through |
|
380 case EQueueStartByMimeByHandle: |
|
381 Server().RunQueue().AddToQueueL(aMessage); |
|
382 aMessage.Complete(KErrNone); |
|
383 break; |
|
384 case EExecuteQueue: |
|
385 aMessage.Complete(Server().RunQueue().ExecuteQueue()); |
|
386 break; |
|
387 case EKillQueue: |
|
388 Server().RunQueue().ResetQueue(); |
|
389 aMessage.Complete(KErrNone); |
|
390 break; |
|
391 default: |
|
392 { |
|
393 PanicClient(aMessage,EPanicIllegalFunction); |
|
394 break; |
|
395 } |
|
396 } |
|
397 } |
|
398 |
|
399 |
|
400 void CSisLauncherSession::ServiceError(const RMessage2& aMessage,TInt aError) |
|
401 { |
|
402 DEBUG_PRINTF2(_L8("Sis Launcher Server - ServiceL failed with error code %d."), aError); |
|
403 |
|
404 if (aError==KErrBadDescriptor) |
|
405 { |
|
406 PanicClient(aMessage,EPanicBadDescriptor); |
|
407 } |
|
408 CSession2::ServiceError(aMessage,aError); |
|
409 } |
|
410 |
|
411 |
|
412 void CSisLauncherSession::CheckApplicationInUseL(TUid aUid) |
|
413 { |
|
414 |
|
415 TFindProcess findProcess; |
|
416 TFullName fullName; |
|
417 |
|
418 while(findProcess.Next(fullName) == KErrNone) |
|
419 { |
|
420 RProcess process; |
|
421 User::LeaveIfError(process.Open(findProcess)); |
|
422 TUid sid(process.SecureId()); |
|
423 TExitType exitType = process.ExitType(); |
|
424 process.Close(); |
|
425 if (sid == aUid && exitType == EExitPending) |
|
426 User::Leave(KErrInUse); |
|
427 } |
|
428 } |
|
429 |
|
430 |
|
431 |
|
432 |
363 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
433 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
364 case EParseSwTypeRegFile: |
|
365 #ifndef SWI_TEXTSHELL_ROM |
|
366 ParseSwTypeRegFileL(aMessage); |
|
367 #endif |
|
368 aMessage.Complete(KErrNone); |
|
369 break; |
|
370 case ERegisterSifLauncherMimeTypes: |
|
371 #ifndef SWI_TEXTSHELL_ROM |
|
372 RegisterSifLauncherMimeTypesL(aMessage); |
|
373 #endif |
|
374 aMessage.Complete(KErrNone); |
|
375 break; |
|
376 case EUnregisterSifLauncherMimeTypes: |
|
377 #ifndef SWI_TEXTSHELL_ROM |
|
378 UnregisterSifLauncherMimeTypesL(aMessage); |
|
379 #endif |
|
380 aMessage.Complete(KErrNone); |
|
381 break; |
|
382 case EAsyncParseResourceFileSize: |
|
383 { |
|
384 TRAPD(err,err = AsyncParseResourceFileSizeL(aMessage)); |
|
385 aMessage.Complete(err); |
|
386 break; |
|
387 } |
|
388 case EAsyncParseResourceFileData: |
|
389 { |
|
390 TRAPD(err,AsyncParseResourceFileDataL(aMessage)); |
|
391 aMessage.Complete(err); |
|
392 break; |
|
393 } |
|
394 case ENotifyNewAppsData: |
|
395 { |
|
396 RIpcReadStream readStream; |
|
397 readStream.Open(aMessage, 0); |
|
398 CleanupClosePushL(readStream); |
|
399 |
|
400 RPointerArray<Usif::CApplicationRegistrationData> appRegInfo; |
|
401 CleanupClosePushL(appRegInfo); |
|
402 |
|
403 const TInt numElems = readStream.ReadInt32L(); |
|
404 for (TInt i=0; i<numElems; ++i) |
|
405 { |
|
406 Usif::CApplicationRegistrationData* info = Usif::CApplicationRegistrationData::NewL(readStream); |
|
407 CleanupStack::PushL(info); |
|
408 appRegInfo.AppendL(info); |
|
409 CleanupStack::Pop(info); |
|
410 } |
|
411 |
|
412 if (Server().BootUpMode() == KTextShell) |
|
413 { |
|
414 // emulator tests running in textshell or in textshell ROM (#def SWI_TEXTSHELL_ROM) |
|
415 DEBUG_PRINTF(_L8("Sis Launcher Server - TextShell - Skipping notification of force registered applications.")); |
|
416 } |
|
417 else |
|
418 { |
|
419 // emulatore running with GUI |
|
420 #ifndef SWI_TEXTSHELL_ROM |
|
421 Server().NotifyNewAppsL(appRegInfo); |
|
422 #endif // SWI_TEXTSHELL_ROM |
|
423 } |
|
424 appRegInfo.ResetAndDestroy(); |
|
425 CleanupStack::PopAndDestroy(2); |
|
426 aMessage.Complete(KErrNone); |
|
427 break; |
|
428 } |
|
429 case ENotifyApparcForApps: |
|
430 { |
|
431 if (Server().BootUpMode() == KTextShell) |
|
432 { |
|
433 DEBUG_PRINTF(_L8("Sis Launcher Server - TextShell - Skipping notification of applications (ENotifyApparcForApps).")); |
|
434 } |
|
435 else |
|
436 { |
|
437 #ifndef SWI_TEXTSHELL_ROM |
|
438 NotifyApparcForAppsL(aMessage); |
|
439 #endif |
|
440 } |
|
441 aMessage.Complete(KErrNone); |
|
442 break; |
|
443 } |
|
444 #endif // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
445 case EQueueRunExecutable: |
|
446 //fall through |
|
447 case EQueueStartDocumentByHandle: |
|
448 //fall through |
|
449 case EQueueStartByMimeByHandle: |
|
450 Server().RunQueue().AddToQueueL(aMessage); |
|
451 aMessage.Complete(KErrNone); |
|
452 break; |
|
453 case EExecuteQueue: |
|
454 aMessage.Complete(Server().RunQueue().ExecuteQueue()); |
|
455 break; |
|
456 case EKillQueue: |
|
457 Server().RunQueue().ResetQueue(); |
|
458 aMessage.Complete(KErrNone); |
|
459 break; |
|
460 default: |
|
461 { |
|
462 PanicClient(aMessage,EPanicIllegalFunction); |
|
463 break; |
|
464 } |
|
465 } |
|
466 } |
|
467 |
|
468 |
|
469 void CSisLauncherSession::ServiceError(const RMessage2& aMessage,TInt aError) |
|
470 { |
|
471 DEBUG_PRINTF2(_L8("Sis Launcher Server - ServiceL failed with error code %d."), aError); |
|
472 |
|
473 if (aError==KErrBadDescriptor) |
|
474 { |
|
475 PanicClient(aMessage,EPanicBadDescriptor); |
|
476 } |
|
477 CSession2::ServiceError(aMessage,aError); |
|
478 } |
|
479 |
|
480 |
|
481 void CSisLauncherSession::CheckApplicationInUseL(TUid aUid) |
|
482 { |
|
483 |
|
484 TFindProcess findProcess; |
|
485 TFullName fullName; |
|
486 |
|
487 while(findProcess.Next(fullName) == KErrNone) |
|
488 { |
|
489 RProcess process; |
|
490 User::LeaveIfError(process.Open(findProcess)); |
|
491 TUid sid(process.SecureId()); |
|
492 TExitType exitType = process.ExitType(); |
|
493 process.Close(); |
|
494 if (sid == aUid && exitType == EExitPending) |
|
495 User::Leave(KErrInUse); |
|
496 } |
|
497 } |
|
498 |
|
499 |
|
500 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
501 TInt CSisLauncherSession::AsyncParseResourceFileSizeL(const RMessage2& aMessage) |
|
502 { |
|
503 // We only support one call at once currently |
|
504 if (iInAsyncParseResourceFile) |
|
505 { |
|
506 return KErrInUse; |
|
507 } |
|
508 else |
|
509 { |
|
510 iInAsyncParseResourceFile=ETrue; |
|
511 delete iCurrentAppRegData; |
|
512 iCurrentAppRegData=NULL; |
|
513 |
|
514 RFs fs; |
|
515 RFile file; |
|
516 User::LeaveIfError(fs.Connect()); |
|
517 CleanupClosePushL(fs); |
|
518 file.AdoptFromClient(aMessage, 0, 1); |
|
519 CleanupClosePushL(file); |
|
520 //Read languages need to pass |
|
521 TInt bufSize=0; |
|
522 bufSize = aMessage.GetDesMaxLength(2); |
|
523 HBufC8* bufToHoldLanguages = HBufC8::NewLC(bufSize); |
|
524 TPtr8 bufPtrDscToHoldLanguages = bufToHoldLanguages->Des(); |
|
525 aMessage.ReadL(2, bufPtrDscToHoldLanguages, 0); |
|
526 |
|
527 RDesReadStream inStream(bufPtrDscToHoldLanguages); |
|
528 CleanupClosePushL(inStream); |
|
529 TInt32 languageCount = inStream.ReadInt32L(); |
|
530 |
|
531 RArray<TLanguage> appLanguages; |
|
532 CleanupClosePushL(appLanguages); |
|
533 |
|
534 for (TInt i=0; i<languageCount; i++) |
|
535 appLanguages.AppendL((TLanguage)inStream.ReadInt32L()); |
|
536 |
|
537 CAppRegInfoReader *appRegInfoReader = CAppRegInfoReader::NewL(fs,file); |
|
538 CleanupStack::PushL(appRegInfoReader); |
|
539 |
|
540 TRAPD(err,iCurrentAppRegData = appRegInfoReader->ReadL(appLanguages)); |
|
541 if (KErrNone != err) |
|
542 { |
|
543 iInAsyncParseResourceFile=EFalse; |
|
544 User::Leave(err); |
|
545 } |
|
546 |
|
547 iInAsyncParseResourceFile=EFalse; |
|
548 TInt objectSize=0; |
|
549 objectSize= GetObjectSizeL(iCurrentAppRegData); |
|
550 if (objectSize > 0) |
|
551 { |
|
552 //Everything went fine so return the buffer size. |
|
553 CleanupStack::PopAndDestroy(6,&fs); |
|
554 return objectSize; |
|
555 } |
|
556 else |
|
557 User::Leave(KErrUnknown); |
|
558 } |
|
559 return KErrNone; |
|
560 } |
|
561 |
|
562 void CSisLauncherSession::AsyncParseResourceFileDataL(const RMessage2& aMessage) |
|
563 { |
|
564 if (iCurrentAppRegData) |
|
565 { |
|
566 WriteObjectDataL(aMessage, 0, iCurrentAppRegData); |
|
567 delete iCurrentAppRegData; |
|
568 iCurrentAppRegData=NULL; |
|
569 } |
|
570 else |
|
571 User::Leave(KErrArgument); |
|
572 } |
|
573 |
|
574 void CSisLauncherSession::ParseSwTypeRegFileL(const RMessage2& aMessage) |
434 void CSisLauncherSession::ParseSwTypeRegFileL(const RMessage2& aMessage) |
575 { |
435 { |
576 // Unpack the file handle |
436 // Unpack the file handle |
577 RFile file; |
437 RFile file; |
578 User::LeaveIfError(file.AdoptFromClient(aMessage, 0, 1)); |
438 User::LeaveIfError(file.AdoptFromClient(aMessage, 0, 1)); |
579 CleanupClosePushL(file); |
439 CleanupClosePushL(file); |
580 |
440 |
581 // Read the registration file |
441 // Read the registration file |
582 TInt fileSize = 0; |
442 TInt fileSize = 0; |
583 User::LeaveIfError(file.Size(fileSize)); |
443 User::LeaveIfError(file.Size(fileSize)); |
584 HBufC8* buf = HBufC8::NewLC(fileSize); |
444 HBufC8* buf = HBufC8::NewLC(fileSize); |
585 TPtr8 bufPtr = buf->Des(); |
445 TPtr8 bufPtr = buf->Des(); |
586 User::LeaveIfError(file.Read(bufPtr)); |
446 User::LeaveIfError(file.Read(bufPtr)); |
587 |
447 |
588 // Parse the registration file |
448 // Parse the registration file |
589 RCPointerArray<Usif::CSoftwareTypeRegInfo> regInfoArray; |
449 RCPointerArray<CSoftwareTypeRegInfo> regInfoArray; |
590 CleanupClosePushL(regInfoArray); |
450 CleanupClosePushL(regInfoArray); |
591 |
451 |
592 CSoftwareTypeRegInfoParser* parser = CSoftwareTypeRegInfoParser::NewL(); |
452 CSoftwareTypeRegInfoParser* parser = CSoftwareTypeRegInfoParser::NewL(); |
593 CleanupStack::PushL(parser); |
453 CleanupStack::PushL(parser); |
594 parser->ParseL(*buf, regInfoArray); |
454 parser->ParseL(*buf, regInfoArray); |
595 |
455 |
596 // Pack the registration data |
456 // Pack the registration data |
597 RBuf8 serializedRegInfo; |
457 RBuf8 serializedRegInfo; |
598 serializedRegInfo.CleanupClosePushL(); |
458 serializedRegInfo.CleanupClosePushL(); |
599 SoftwareTypeRegInfoUtils::SerializeArrayL(regInfoArray, serializedRegInfo); |
459 SoftwareTypeRegInfoUtils::SerializeArrayL(regInfoArray, serializedRegInfo); |
600 aMessage.Write(2, serializedRegInfo); |
460 aMessage.Write(2, serializedRegInfo); |
601 |
461 |
602 CleanupStack::PopAndDestroy(5, &file); // buf, regInfoArray, parser, serializedRegInfo |
462 CleanupStack::PopAndDestroy(5, &file); // buf, regInfoArray, parser, serializedRegInfo |
603 } |
463 } |
604 |
464 |
605 #ifndef SWI_TEXTSHELL_ROM |
465 #ifndef SWI_TEXTSHELL_ROM |
606 void CSisLauncherSession::NotifyApparcForAppsL(const RMessage2& aMessage) |
|
607 { |
|
608 DEBUG_PRINTF(_L8("Sending the notification to AppArc.")); |
|
609 RIpcReadStream readStream; |
|
610 readStream.Open(aMessage, 0); |
|
611 CleanupClosePushL(readStream); |
|
612 RArray<TApaAppUpdateInfo> apparcAppInfoArray; |
|
613 CleanupClosePushL(apparcAppInfoArray); |
|
614 |
|
615 RApaLsSession apaSession; |
|
616 TInt err = apaSession.Connect(); |
|
617 if(KErrNone != err) |
|
618 { |
|
619 DEBUG_PRINTF2(_L8("RApaLsSession::Connect failed with %d. Notification to AppArc failed."), err); |
|
620 User::LeaveIfError(err); |
|
621 } |
|
622 CleanupClosePushL(apaSession); |
|
623 TApaAppUpdateInfo::TApaAppAction appaction = TApaAppUpdateInfo::EAppNotPresent; |
|
624 const TInt numElems = readStream.ReadInt32L(); |
|
625 DEBUG_PRINTF2(_L8("Number of applications to be notified is %d."), numElems); |
|
626 //Convert the local structure into the structure required by apparc |
|
627 for (TInt i=0; i<numElems; ++i) |
|
628 { |
|
629 TAppUpdateInfo appInfo; |
|
630 appInfo.InternalizeL(readStream); |
|
631 if(appInfo.iAction == EAppInstalled) |
|
632 { |
|
633 appaction = TApaAppUpdateInfo::EAppPresent; |
|
634 } |
|
635 else if(appInfo.iAction == EAppUninstalled) |
|
636 { |
|
637 appaction = TApaAppUpdateInfo::EAppNotPresent; |
|
638 } |
|
639 TApaAppUpdateInfo apparcAppUpdateInfo(appInfo.iAppUid, appaction); |
|
640 apparcAppInfoArray.AppendL(apparcAppUpdateInfo); |
|
641 DEBUG_PRINTF2(_L("AppUid is 0x%x"), appInfo.iAppUid); |
|
642 DEBUG_PRINTF2(_L("Action is %d"), appInfo.iAction); |
|
643 } |
|
644 |
|
645 err = 0; |
|
646 TRAP(err, err = apaSession.UpdateAppListL(apparcAppInfoArray)); |
|
647 if(KErrNone != err) |
|
648 { |
|
649 DEBUG_PRINTF2(_L8("RApaLsSession::UpdateAppListL failed with %d. Notification to AppArc failed."), err); |
|
650 User::LeaveIfError(err); |
|
651 } |
|
652 |
|
653 CleanupStack::PopAndDestroy(3, &readStream); |
|
654 } |
|
655 |
|
656 void CSisLauncherSession::RegisterSifLauncherMimeTypesL(const RMessage2& aMessage) |
466 void CSisLauncherSession::RegisterSifLauncherMimeTypesL(const RMessage2& aMessage) |
657 { |
467 { |
658 RegisterSifLauncherMimeTypesImplL(aMessage, ETrue); |
468 RegisterSifLauncherMimeTypesImplL(aMessage, ETrue); |
659 } |
469 } |
660 |
470 |
661 void CSisLauncherSession::UnregisterSifLauncherMimeTypesL(const RMessage2& aMessage) |
471 void CSisLauncherSession::UnregisterSifLauncherMimeTypesL(const RMessage2& aMessage) |
662 { |
472 { |
663 RegisterSifLauncherMimeTypesImplL(aMessage, EFalse); |
473 RegisterSifLauncherMimeTypesImplL(aMessage, EFalse); |
664 } |
474 } |
665 |
475 |
666 void CSisLauncherSession::RegisterSifLauncherMimeTypesImplL(const RMessage2& aMessage, TBool aRegister) |
476 void CSisLauncherSession::RegisterSifLauncherMimeTypesImplL(const RMessage2& aMessage, TBool aRegister) |
667 { |
477 { |
668 // Read serialized MIME types from aMessage |
478 // Read serialized MIME types from aMessage |
669 HBufC8* buf = HBufC8::NewLC(aMessage.GetDesLengthL(0)); |
479 HBufC8* buf = HBufC8::NewLC(aMessage.GetDesLengthL(0)); |
670 TPtr8 bufPtr(buf->Des()); |
480 TPtr8 bufPtr(buf->Des()); |
671 aMessage.ReadL(0, bufPtr); |
481 aMessage.ReadL(0, bufPtr); |
672 |
482 |
673 // Unserialize MIME types |
483 // Unserialize MIME types |
674 RDesReadStream rs(*buf); |
484 RDesReadStream rs(*buf); |
675 CleanupClosePushL(rs); |
485 CleanupClosePushL(rs); |
676 |
486 |
677 RCPointerArray<HBufC8> mimeTypes; |
487 RCPointerArray<HBufC8> mimeTypes; |
678 CleanupClosePushL(mimeTypes); |
488 CleanupClosePushL(mimeTypes); |
679 |
489 |
680 InternalizePointerArrayL(mimeTypes, rs); |
490 InternalizePointerArrayL(mimeTypes, rs); |
681 |
491 |
682 // Connect to AppArc |
492 // Connect to AppArc |
683 RApaLsSession apa; |
493 RApaLsSession apa; |
684 TInt err = apa.Connect(); |
494 TInt err = apa.Connect(); |
685 if (err != KErrNone) |
495 if (err != KErrNone) |
686 { |
496 { |
687 DEBUG_PRINTF2(_L8("Failed to connect to the AppArc server, err = %d\n"),err); |
497 DEBUG_PRINTF2(_L8("Failed to connect to the AppArc server, err = %d\n"),err); |
688 User::Leave(err); |
498 User::Leave(err); |
689 } |
499 } |
690 CleanupClosePushL(apa); |
500 CleanupClosePushL(apa); |
691 |
501 |
692 // Iterate over the MIME types and (un)register them |
502 // Iterate over the MIME types and (un)register them |
693 for (TInt i=0; i<mimeTypes.Count(); ++i) |
503 for (TInt i=0; i<mimeTypes.Count(); ++i) |
694 { |
504 { |
695 TDataType dataType(*mimeTypes[i]); |
505 TDataType dataType(*mimeTypes[i]); |
696 if (aRegister) |
506 if (aRegister) |
697 { |
507 { |
698 const TUid KSifLauncherUid = {0x10285BD0}; |
508 const TUid KSifLauncherUid = {0x10285BD0}; |
699 err = apa.InsertDataMapping(dataType, KDataTypePriorityTrustedHigh, KSifLauncherUid); |
509 err = apa.InsertDataMapping(dataType, KDataTypePriorityTrustedHigh, KSifLauncherUid); |
700 } |
510 } |
701 else |
511 else |
702 { |
512 { |
703 err = apa.DeleteDataMapping(dataType); |
513 err = apa.DeleteDataMapping(dataType); |
704 } |
514 } |
705 if (err != KErrNone) |
515 if (err != KErrNone) |
706 { |
516 { |
707 DEBUG_PRINTF2(_L8("Failed to (un)register MIME types to AppArc, err = %d\n"),err); |
517 DEBUG_PRINTF2(_L8("Failed to (un)register MIME types to AppArc, err = %d\n"),err); |
708 } |
518 } |
709 } |
519 } |
710 |
520 |
711 CleanupStack::PopAndDestroy(4, buf); //rs, mimeTypes, apa |
521 CleanupStack::PopAndDestroy(4, buf); //rs, mimeTypes, apa |
712 } |
522 } |
713 |
523 |
714 #endif // SWI_TEXTSHELL_ROM |
524 #endif // SWI_TEXTSHELL_ROM |
715 #endif // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
525 #endif // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
716 |
526 |
717 } // namespace Swi |
527 } // namespace Swi |