21 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS |
21 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS |
22 #include "../apserv/APSCLSV.H" |
22 #include "../apserv/APSCLSV.H" |
23 #include "APGCLI.H" |
23 #include "APGCLI.H" |
24 #include "APACMDLN.H" |
24 #include "APACMDLN.H" |
25 #include "APGSTD.H" |
25 #include "APGSTD.H" |
|
26 #include "OstTraceDefinitions.h" |
|
27 #ifdef OST_TRACE_COMPILER_IN_USE |
|
28 #include "apgstartTraces.h" |
|
29 #endif |
26 |
30 |
27 #if defined(USE_IH_RAISE_EVENT) |
31 #if defined(USE_IH_RAISE_EVENT) |
28 // For performance system test |
32 // For performance system test |
29 // see /common/testtools/systemmonitor/instrumentationhandler/inc/raiseevent.h |
33 // see /common/testtools/systemmonitor/instrumentationhandler/inc/raiseevent.h |
30 // and /common/generic/plattest/Group/SetEnv.bat |
34 // and /common/generic/plattest/Group/SetEnv.bat |
95 found; otherwise one of the other system-wide error codes. |
99 found; otherwise one of the other system-wide error codes. |
96 @see CCoeAppUi::ActivateViewL() |
100 @see CCoeAppUi::ActivateViewL() |
97 */ |
101 */ |
98 EXPORT_C TInt RApaLsSession::StartApp(const CApaCommandLine& aCommandLine,TThreadId& aThreadId,TRequestStatus* aRequestStatusForRendezvous ) |
102 EXPORT_C TInt RApaLsSession::StartApp(const CApaCommandLine& aCommandLine,TThreadId& aThreadId,TRequestStatus* aRequestStatusForRendezvous ) |
99 { |
103 { |
100 return DoStartApp(aCommandLine, &aThreadId,aRequestStatusForRendezvous); |
104 OstTraceDef0( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, RAPALSSESSION_STARTAPP, "RApaLsSession::StartApp will return value of DoStartApp" ); |
|
105 return DoStartApp(aCommandLine, &aThreadId,aRequestStatusForRendezvous); |
101 } |
106 } |
102 |
107 |
103 |
108 |
104 TInt RApaLsSession::DoStartApp(const CApaCommandLine& aCommandLine, TThreadId* aThreadId,TRequestStatus* aRequestStatusForRendezvous) |
109 TInt RApaLsSession::DoStartApp(const CApaCommandLine& aCommandLine, TThreadId* aThreadId,TRequestStatus* aRequestStatusForRendezvous) |
105 { |
110 { |
106 TRAPD(error, DoStartAppL(aCommandLine, aThreadId, aRequestStatusForRendezvous)); |
111 TRAPD(error, DoStartAppL(aCommandLine, aThreadId, aRequestStatusForRendezvous)); |
|
112 OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW_INTERNAL, RAPALSSESSION_DOSTARTAPP, "RApaLsSession::DoStartApp will return with error returned from DoStartAppL : error=%d", error ); |
107 return error; |
113 return error; |
108 } |
114 } |
109 |
115 |
110 void RApaLsSession::DoStartAppL(const CApaCommandLine& aCommandLine, TThreadId* aThreadId,TRequestStatus* aRequestStatusForRendezvous) |
116 void RApaLsSession::DoStartAppL(const CApaCommandLine& aCommandLine, TThreadId* aThreadId,TRequestStatus* aRequestStatusForRendezvous) |
111 { |
117 { |
132 if(Handle() != KNullHandle) |
138 if(Handle() != KNullHandle) |
133 { |
139 { |
134 // requesting from rule-based plug-ins if we can run an application |
140 // requesting from rule-based plug-ins if we can run an application |
135 // if server fails while requested rule-based plug-ins it returns a negative value - proceed with launching the application in this case |
141 // if server fails while requested rule-based plug-ins it returns a negative value - proceed with launching the application in this case |
136 const TBool okayToRun = SendReceiveWithReconnect(EAppListServRuleBasedLaunching, TIpcArgs(&logicalExecutableName)); |
142 const TBool okayToRun = SendReceiveWithReconnect(EAppListServRuleBasedLaunching, TIpcArgs(&logicalExecutableName)); |
|
143 OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW_INTERNAL, RAPALSSESSION_DOSTARTAPPL, "RApaLsSession::DoStartAppL will leave with error returned by SebdReceiveWithReconnect okayToRun=%d", okayToRun ); |
137 User::LeaveIfError(!okayToRun ? KErrCancel : okayToRun); // May leave with KErrNotFound if exe not found |
144 User::LeaveIfError(!okayToRun ? KErrCancel : okayToRun); // May leave with KErrNotFound if exe not found |
138 } |
145 } |
139 |
146 |
140 TFileName nativeExecutableNameOfNonNativeApplication; |
147 TFileName nativeExecutableNameOfNonNativeApplication; |
141 RProcess process; |
148 RProcess process; |
145 // if we're connected to the Apparc server, try to get the opaque-data and native-executable name |
152 // if we're connected to the Apparc server, try to get the opaque-data and native-executable name |
146 // (the latter is only if it's a non-native application that we're launching) |
153 // (the latter is only if it's a non-native application that we're launching) |
147 if (Handle()!=KNullHandle) |
154 if (Handle()!=KNullHandle) |
148 { |
155 { |
149 const TInt lengthOfOpaqueData=User::LeaveIfError(SendReceiveWithReconnect(EAppListServGetNativeExecutableNameIfNonNative, TIpcArgs(&nativeExecutableNameOfNonNativeApplication, &logicalExecutableName))); |
156 const TInt lengthOfOpaqueData=User::LeaveIfError(SendReceiveWithReconnect(EAppListServGetNativeExecutableNameIfNonNative, TIpcArgs(&nativeExecutableNameOfNonNativeApplication, &logicalExecutableName))); |
|
157 OstTraceDef0( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW_INTERNAL, DUP1_RAPALSSESSION_DOSTARTAPPL, "RApaLsSession::DoStartAppL will leave with error returned by GetNewOpaueData" ); |
150 User::LeaveIfError(GetNewOpaqueData(opaqueData, lengthOfOpaqueData)); |
158 User::LeaveIfError(GetNewOpaqueData(opaqueData, lengthOfOpaqueData)); |
151 } |
159 } |
152 |
160 |
153 // try first to create the application process without interacting with the Apparc server at all - |
161 // try first to create the application process without interacting with the Apparc server at all - |
154 // assumes "logicalExecutableName" is itself a native executable |
162 // assumes "logicalExecutableName" is itself a native executable |
155 TUidType uidType(KNullUid, KNullUid, KNullUid); |
163 TUidType uidType(KNullUid, KNullUid, KNullUid); |
156 TInt err = process.CreateWithStackOverride(logicalExecutableName, KNullDesC, uidType, MinApplicationStackSize(), EOwnerProcess); |
164 TInt err = process.CreateWithStackOverride(logicalExecutableName, KNullDesC, uidType, MinApplicationStackSize(), EOwnerProcess); |
|
165 OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_ERROR_INTERNAL, DUP2_RAPALSSESSION_DOSTARTAPPL, "process.CreateWithStackOverride returned with err=%d", err ); |
|
166 |
157 |
167 |
158 // If we haven't been able to create the process using the native executable name from the command line |
168 // If we haven't been able to create the process using the native executable name from the command line |
159 // object, instead try to create it using the native executable name of the non-native application. |
169 // object, instead try to create it using the native executable name of the non-native application. |
160 // Can only do this if apparc is connected and thus this name has been retrieved above and |
170 // Can only do this if apparc is connected and thus this name has been retrieved above and |
161 // nativeExecutableNameOfNonNativeApplication populated. |
171 // nativeExecutableNameOfNonNativeApplication populated. |
162 if (err && nativeExecutableNameOfNonNativeApplication.Length() > 0) |
172 if (err && nativeExecutableNameOfNonNativeApplication.Length() > 0) |
|
173 { |
163 err = process.CreateWithStackOverride(nativeExecutableNameOfNonNativeApplication, KNullDesC, uidType, MinApplicationStackSize(), EOwnerProcess); |
174 err = process.CreateWithStackOverride(nativeExecutableNameOfNonNativeApplication, KNullDesC, uidType, MinApplicationStackSize(), EOwnerProcess); |
|
175 OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_ERROR_INTERNAL, DUP3_RAPALSSESSION_DOSTARTAPPL, "RApaLsSession::DoStartAppL err=%d", err ); |
|
176 } |
164 |
177 |
165 // if we managed to create the process via either of the two methods attempted above (with the native |
178 // if we managed to create the process via either of the two methods attempted above (with the native |
166 // name or the native name of the non-native app), finish setting it up and "resume" it |
179 // name or the native name of the non-native app), finish setting it up and "resume" it |
167 if (!err) |
180 if (!err) |
168 { |
181 { |
232 Sets up slots 0 and 1 in aIpcArgs - assumes that slots 2 and 3 have already been set up; |
247 Sets up slots 0 and 1 in aIpcArgs - assumes that slots 2 and 3 have already been set up; |
233 it then invokes aOpcode |
248 it then invokes aOpcode |
234 */ |
249 */ |
235 TInt RApaLsSession::GetExecutableNameAndNewOpaqueData(TDes& aNativeExecutableName, TDes& aLogicalExecutableName, HBufC8*& aOpaqueData, TIpcArgs& aIpcArgs, TInt aOpcode) const |
250 TInt RApaLsSession::GetExecutableNameAndNewOpaqueData(TDes& aNativeExecutableName, TDes& aLogicalExecutableName, HBufC8*& aOpaqueData, TIpcArgs& aIpcArgs, TInt aOpcode) const |
236 { |
251 { |
|
252 OstTraceDefExt4( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW_INTERNAL, DUP1_RAPALSSESSION_GETEXECUTABLENAMEANDNEWOPAQUEDATA, "RApaLsSession::GetExecutableNameAndNewOpaqueData;aNativeExecutableName=%S;aLogicalExecutableName=%S;aOpaqueData=%s;aOpcode=%d", aNativeExecutableName, aLogicalExecutableName, *aOpaqueData, aOpcode ); |
|
253 |
237 aNativeExecutableName.SetLength(0); // if this comes out zero-length from EAppListServExecutableNameForXxx below then use the logicalExecutableName in RProcess::Create (in this case it's a native C++ application) |
254 aNativeExecutableName.SetLength(0); // if this comes out zero-length from EAppListServExecutableNameForXxx below then use the logicalExecutableName in RProcess::Create (in this case it's a native C++ application) |
238 aIpcArgs.Set(0, &aNativeExecutableName); |
255 aIpcArgs.Set(0, &aNativeExecutableName); |
239 aIpcArgs.Set(1, &aLogicalExecutableName); |
256 aIpcArgs.Set(1, &aLogicalExecutableName); |
240 |
257 |
241 const TInt lengthOfOpaqueData = SendReceiveWithReconnect(aOpcode, aIpcArgs); |
258 const TInt lengthOfOpaqueData = SendReceiveWithReconnect(aOpcode, aIpcArgs); |
242 if (lengthOfOpaqueData < 0) |
259 if (lengthOfOpaqueData < 0) |
243 return lengthOfOpaqueData; // it's an error code |
260 { |
244 |
261 OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW_INTERNAL, RAPALSSESSION_GETEXECUTABLENAMEANDNEWOPAQUEDATA, "RApaLsSession::GetExecutableNameAndNewOpaqueData will return with error returned by SendReceiveWithConnect : lengthOfOpaqueData=%d", lengthOfOpaqueData ); |
|
262 return lengthOfOpaqueData; // it's an error code |
|
263 } |
|
264 |
|
265 OstTraceDef0( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW_INTERNAL, DUP3_RAPALSSESSION_GETEXECUTABLENAMEANDNEWOPAQUEDATA, "RApaLsSession::GetExecutableNameAndNewOpaqueData will return with value returned by GetNewOpaqueData" ); |
245 return GetNewOpaqueData(aOpaqueData, lengthOfOpaqueData); |
266 return GetNewOpaqueData(aOpaqueData, lengthOfOpaqueData); |
246 } |
267 } |
247 |
268 |
248 /** |
269 /** |
249 Allocated a new buffer for aOpaqueData containing data fetched fronm AppArc server. |
270 Allocated a new buffer for aOpaqueData containing data fetched fronm AppArc server. |
250 Returns an error code if no opaque data could be allocated or fetched. |
271 Returns an error code if no opaque data could be allocated or fetched. |
251 */ |
272 */ |
252 TInt RApaLsSession::GetNewOpaqueData(HBufC8*& aOpaqueData, TInt aLengthOfOpaqueData) const |
273 TInt RApaLsSession::GetNewOpaqueData(HBufC8*& aOpaqueData, TInt aLengthOfOpaqueData) const |
253 { |
274 { |
|
275 OstTraceDefExt2( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, RAPALSSESSION_GETNEWOPAQUEDATA_ENTRY, "RApaLsSession::GetNewOpaqueData;aOpaqueData=%s;aLengthOfOpaqueData=%d", *aOpaqueData, aLengthOfOpaqueData ); |
|
276 |
254 aOpaqueData = NULL; |
277 aOpaqueData = NULL; |
255 if(!aLengthOfOpaqueData) |
278 if(!aLengthOfOpaqueData) |
256 return KErrNone; // Nothing to get |
279 { |
|
280 OstTraceDef0( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW_INTERNAL, RAPALSSESSION_GETNEWOPAQUEDATA, "RApaLsSession::GetNewOpaqueData will return with KErrNone"); |
|
281 return KErrNone; // Nothing to get |
|
282 } |
257 |
283 |
258 // Make sure it's not a negative error code |
284 // Make sure it's not a negative error code |
259 ASSERT(aLengthOfOpaqueData > 0); |
285 ASSERT(aLengthOfOpaqueData > 0); |
260 |
286 |
261 // Allocate a buffer for the opaque data |
287 // Allocate a buffer for the opaque data |
287 if (aOpaqueData) |
314 if (aOpaqueData) |
288 commandLine->SetOpaqueDataL(*aOpaqueData); |
315 commandLine->SetOpaqueDataL(*aOpaqueData); |
289 |
316 |
290 DoStartApplicationL(aNativeExecutableName, *commandLine, aThreadId, aRequestStatusForRendezvous); |
317 DoStartApplicationL(aNativeExecutableName, *commandLine, aThreadId, aRequestStatusForRendezvous); |
291 CleanupStack::PopAndDestroy(commandLine)); |
318 CleanupStack::PopAndDestroy(commandLine)); |
292 |
319 |
|
320 OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW_INTERNAL, DUP1_RAPALSSESSION_STARTAPPLICATIONPASSINGFILEHANDLE, "RApaLsSession::StartApplicationPassingFileHandle will return with error=%d", error ); |
293 return error; |
321 return error; |
294 } |
322 } |
295 |
323 |
296 TInt RApaLsSession::StartApplicationPassingDocumentName(const TDesC& aNativeExecutableName, const TDesC& aLogicalExecutableName, const TDesC8* aOpaqueData, const TDesC& aDocumentName, TThreadId& aThreadId,TApaCommand aCommand, TRequestStatus* aRequestStatusForRendezvous) |
324 TInt RApaLsSession::StartApplicationPassingDocumentName(const TDesC& aNativeExecutableName, const TDesC& aLogicalExecutableName, const TDesC8* aOpaqueData, const TDesC& aDocumentName, TThreadId& aThreadId,TApaCommand aCommand, TRequestStatus* aRequestStatusForRendezvous) |
297 { |
325 { |
319 |
348 |
320 // Aquire permission to start the app from "application start rule" plug-ins |
349 // Aquire permission to start the app from "application start rule" plug-ins |
321 if(Handle() != KNullHandle) // Connected to AppArc server? |
350 if(Handle() != KNullHandle) // Connected to AppArc server? |
322 { |
351 { |
323 const TBool okayToRun = SendReceiveWithReconnect(EAppListServRuleBasedLaunching, TIpcArgs(&actualNativeExecutableName)); |
352 const TBool okayToRun = SendReceiveWithReconnect(EAppListServRuleBasedLaunching, TIpcArgs(&actualNativeExecutableName)); |
|
353 OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_NORMAL, RAPALSSESSION_DOSTARTAPPLICATIONL, "SendReceiveWithReconnect with okayToRun=%d", okayToRun ); |
|
354 |
324 // If server fails while requested rule-based plug-ins it returns a negative value. |
355 // If server fails while requested rule-based plug-ins it returns a negative value. |
325 // We shall proceed with launching an application in this case. |
356 // We shall proceed with launching an application in this case. |
326 User::LeaveIfError(!okayToRun ? KErrCancel : okayToRun); // May leave with KErrNotFound if exe is not found or KErrNotSupported if embeddable only |
357 User::LeaveIfError(!okayToRun ? KErrCancel : okayToRun); // May leave with KErrNotFound if exe is not found or KErrNotSupported if embeddable only |
327 } |
358 } |
328 |
359 |
361 the list has not completed; KErrNotFound, if a matching entry could not be found; otherwise |
392 the list has not completed; KErrNotFound, if a matching entry could not be found; otherwise |
362 one of the other system-wide error codes. |
393 one of the other system-wide error codes. |
363 */ |
394 */ |
364 EXPORT_C TInt RApaLsSession::StartDocument(const TDesC& aDocFileName, TThreadId& aThreadId, TLaunchType /*aLaunchType*/) |
395 EXPORT_C TInt RApaLsSession::StartDocument(const TDesC& aDocFileName, TThreadId& aThreadId, TLaunchType /*aLaunchType*/) |
365 { |
396 { |
|
397 OstTraceDefExt2( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, RAPALSSESSION_STARTDOCUMENT_ENTRY, "RApaLsSession::StartDocument :aDocFileName=%S;aThreadId=%x", aDocFileName, ( TUint )&( aThreadId ) ); |
|
398 |
|
399 |
366 HBufC8* buffer = NULL; |
400 HBufC8* buffer = NULL; |
367 TInt error = GetNewBufferFromFile(buffer, aDocFileName); |
401 TInt error = GetNewBufferFromFile(buffer, aDocFileName); |
368 if (error) |
402 if (error) |
369 return error; |
403 { |
|
404 OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP2_RAPALSSESSION_STARTDOCUMENT, "RApaLsSession::StartDocument will return with error returned by GetNewBufferFromFile : error=%d", error ); |
|
405 return error; |
|
406 } |
370 |
407 |
371 TFileName nativeExecutableName; // the name of the EXE that we pass to RProcess::Create |
408 TFileName nativeExecutableName; // the name of the EXE that we pass to RProcess::Create |
372 TFileName logicalExecutableName; // the name of the MIDlet, Python script, etc |
409 TFileName logicalExecutableName; // the name of the MIDlet, Python script, etc |
373 HBufC8* opaqueData = NULL; |
410 HBufC8* opaqueData = NULL; |
374 TIpcArgs ipcArgs; |
411 TIpcArgs ipcArgs; |
375 ipcArgs.Set(2, &aDocFileName); |
412 ipcArgs.Set(2, &aDocFileName); |
376 ipcArgs.Set(3, buffer); |
413 ipcArgs.Set(3, buffer); |
377 error = GetExecutableNameAndNewOpaqueData(nativeExecutableName, logicalExecutableName, opaqueData, ipcArgs, EAppListServGetExecutableNameGivenDocument); |
414 error = GetExecutableNameAndNewOpaqueData(nativeExecutableName, logicalExecutableName, opaqueData, ipcArgs, EAppListServGetExecutableNameGivenDocument); |
|
415 OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_ERROR, DUP3_RAPALSSESSION_STARTDOCUMENT, "GetExecutableNameAndNewOpaqueData returned with error=%d", error ); |
|
416 |
378 if (error) |
417 if (error) |
379 { |
418 { |
380 delete buffer; |
419 delete buffer; |
|
420 OstTraceDef0( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP4_RAPALSSESSION_STARTDOCUMENT, "RApaLsSession::StartDocument will return with error returned by GetExecutableNameAndNewOpaqueData" ); |
381 return error; |
421 return error; |
382 } |
422 } |
383 |
423 |
384 error = StartApplicationPassingDocumentName(nativeExecutableName, logicalExecutableName, opaqueData, aDocFileName, aThreadId, EApaCommandOpen, NULL); |
424 error = StartApplicationPassingDocumentName(nativeExecutableName, logicalExecutableName, opaqueData, aDocFileName, aThreadId, EApaCommandOpen, NULL); |
|
425 OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_ERROR, DUP5_RAPALSSESSION_STARTDOCUMENT, "StartApplicationPassingDocumentName returned with error=%d", error ); |
|
426 |
385 delete opaqueData; |
427 delete opaqueData; |
386 |
428 |
387 delete buffer; |
429 delete buffer; |
|
430 OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP6_RAPALSSESSION_STARTDOCUMENT, "RApaLsSession::StartDocument will return with error=%d", error ); |
388 return error; |
431 return error; |
389 } |
432 } |
390 |
433 |
391 /** Finds and launches an application to handle the document contained in the specified file |
434 /** Finds and launches an application to handle the document contained in the specified file |
392 |
435 |
405 TFileName nativeExecutableName; // the name of the EXE that we pass to RProcess::Create |
448 TFileName nativeExecutableName; // the name of the EXE that we pass to RProcess::Create |
406 TFileName logicalExecutableName; // the name of the MIDlet, Python script, etc |
449 TFileName logicalExecutableName; // the name of the MIDlet, Python script, etc |
407 HBufC8* opaqueData = NULL; |
450 HBufC8* opaqueData = NULL; |
408 TIpcArgs ipcArgs; |
451 TIpcArgs ipcArgs; |
409 TInt error = aDocFile.TransferToServer(ipcArgs, 2, 3); |
452 TInt error = aDocFile.TransferToServer(ipcArgs, 2, 3); |
|
453 OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_ERROR, RAPALSSESSION_STARTDOCUMENT, "aDocFile.TransferToServer returned with error =%d", error ); |
|
454 |
410 if (!error) |
455 if (!error) |
411 error = GetExecutableNameAndNewOpaqueData(nativeExecutableName, logicalExecutableName, opaqueData, ipcArgs, EAppListServGetExecutableNameGivenDocumentPassedByFileHandle); |
456 error = GetExecutableNameAndNewOpaqueData(nativeExecutableName, logicalExecutableName, opaqueData, ipcArgs, EAppListServGetExecutableNameGivenDocumentPassedByFileHandle); |
412 |
457 |
413 if (error) |
458 if (error) |
414 return error; |
459 { |
415 |
460 OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP1_RAPALSSESSION_STARTDOCUMENT, "RApaLsSession::StartDocument will return with error =%d", error ); |
|
461 return error; |
|
462 } |
|
463 |
|
464 OstTraceDefExt2( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_ERROR, DUP7_RAPALSSESSION_STARTDOCUMENT, "Logical Executable name : [%S]; Native executable name : [%S]", logicalExecutableName, nativeExecutableName ); |
416 error = StartApplicationPassingFileHandle(nativeExecutableName, logicalExecutableName, opaqueData, aDocFile, aThreadId, aRequestStatusForRendezvous); |
465 error = StartApplicationPassingFileHandle(nativeExecutableName, logicalExecutableName, opaqueData, aDocFile, aThreadId, aRequestStatusForRendezvous); |
417 delete opaqueData; |
466 delete opaqueData; |
|
467 |
|
468 OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP8_RAPALSSESSION_STARTDOCUMENT, "RApaLsSession::StartDocument will return with error =%d", error ); |
418 return error; |
469 return error; |
419 } //lint !e1764 Suppress reference parameter could be declared const ref |
470 } //lint !e1764 Suppress reference parameter could be declared const ref |
420 |
471 |
421 |
472 |
422 /** Launches an application that can handle the specified data (MIME) type. |
473 /** Launches an application that can handle the specified data (MIME) type. |
439 const TPckgC<TDataType> dataType(aDataType); |
490 const TPckgC<TDataType> dataType(aDataType); |
440 TIpcArgs ipcArgs; |
491 TIpcArgs ipcArgs; |
441 ipcArgs.Set(2, &dataType); |
492 ipcArgs.Set(2, &dataType); |
442 TInt error=GetExecutableNameAndNewOpaqueData(nativeExecutableName, logicalExecutableName, opaqueData, ipcArgs, EAppListServGetExecutableNameGivenDataType); |
493 TInt error=GetExecutableNameAndNewOpaqueData(nativeExecutableName, logicalExecutableName, opaqueData, ipcArgs, EAppListServGetExecutableNameGivenDataType); |
443 if (error) |
494 if (error) |
444 return error; |
495 { |
445 |
496 OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP9_RAPALSSESSION_STARTDOCUMENT, "RApaLsSession::StartDocument will return with error returned GetExecutablleNameAndNewOpaqueData;error=%d", error ); |
|
497 return error; |
|
498 } |
|
499 |
446 error = StartApplicationPassingDocumentName(nativeExecutableName, logicalExecutableName, opaqueData, aDocFileName, aThreadId,EApaCommandOpen,NULL); |
500 error = StartApplicationPassingDocumentName(nativeExecutableName, logicalExecutableName, opaqueData, aDocFileName, aThreadId,EApaCommandOpen,NULL); |
447 delete opaqueData; |
501 delete opaqueData; |
448 |
502 |
|
503 OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP10_RAPALSSESSION_STARTDOCUMENT, "RApaLsSession::StartDocument will return with error StartApplicationPassingDocumentName : error=%d", error ); |
449 return error; |
504 return error; |
450 } |
505 } |
451 |
506 |
452 /** Finds and launches an application to handle the document contained in the specified file |
507 /** Finds and launches an application to handle the document contained in the specified file |
453 |
508 |
467 HBufC8* opaqueData = NULL; |
522 HBufC8* opaqueData = NULL; |
468 const TPckgC<TDataType> dataType(aDataType); |
523 const TPckgC<TDataType> dataType(aDataType); |
469 TIpcArgs ipcArgs; |
524 TIpcArgs ipcArgs; |
470 ipcArgs.Set(2, &dataType); |
525 ipcArgs.Set(2, &dataType); |
471 TInt error = GetExecutableNameAndNewOpaqueData(nativeExecutableName, logicalExecutableName, opaqueData, ipcArgs, EAppListServGetExecutableNameGivenDataType); |
526 TInt error = GetExecutableNameAndNewOpaqueData(nativeExecutableName, logicalExecutableName, opaqueData, ipcArgs, EAppListServGetExecutableNameGivenDataType); |
472 if (error) |
527 OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP11_RAPALSSESSION_STARTDOCUMENT, "GetExecutabkeNameAndNewOpaqueData returned with error =%d", error ); |
473 return error; |
528 |
|
529 if (error) |
|
530 { |
|
531 OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP12_RAPALSSESSION_STARTDOCUMENT, "RApaLsSession::StartDocument will return with error returned by GetExecutableNameAndNewOpaqueData : error=%d", error ); |
|
532 return error; |
|
533 } |
474 |
534 |
475 error = StartApplicationPassingFileHandle(nativeExecutableName, logicalExecutableName, opaqueData, aDocFile, aThreadId, aRequestStatusForRendezvous); |
535 error = StartApplicationPassingFileHandle(nativeExecutableName, logicalExecutableName, opaqueData, aDocFile, aThreadId, aRequestStatusForRendezvous); |
476 delete opaqueData; |
536 delete opaqueData; |
|
537 OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP13_RAPALSSESSION_STARTDOCUMENT, "RApaLsSession::StartDocument will return with error returned by StartApplicationPassingFileHandle : error=%d", error ); |
477 return error; |
538 return error; |
478 } //lint !e1764 Suppress reference parameter could be declared const ref |
539 } //lint !e1764 Suppress reference parameter could be declared const ref |
479 |
540 |
480 |
541 |
481 /** Launches the application identified by the specified UID. |
542 /** Launches the application identified by the specified UID. |
489 @return KErrNone, if successful; EAppListInvalid if the server's initial population of |
550 @return KErrNone, if successful; EAppListInvalid if the server's initial population of |
490 the list has not completed; KErrNotFound, if no suitable application can |
551 the list has not completed; KErrNotFound, if no suitable application can |
491 be found; otherwise one of the other system-wide error codes. */ |
552 be found; otherwise one of the other system-wide error codes. */ |
492 EXPORT_C TInt RApaLsSession::StartDocument(const TDesC& aDocFileName, TUid aAppUid, TThreadId& aThreadId, TLaunchType /*aLaunchType*/) |
553 EXPORT_C TInt RApaLsSession::StartDocument(const TDesC& aDocFileName, TUid aAppUid, TThreadId& aThreadId, TLaunchType /*aLaunchType*/) |
493 { |
554 { |
|
555 OstTraceDefExt2( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP17_RAPALSSESSION_STARTDOCUMENT_ENTRY, "RApaLsSession::StartDocument;aDocFileName=%S;aAppUid.iUid=%d", aDocFileName, aAppUid.iUid ); |
|
556 |
494 // Get the executable file name and "opaque" app meta-data from AppArc server |
557 // Get the executable file name and "opaque" app meta-data from AppArc server |
495 |
558 |
496 TFileName nativeExecutableName; // the name of the EXE that we pass to RProcess::Create |
559 TFileName nativeExecutableName; // the name of the EXE that we pass to RProcess::Create |
497 TFileName logicalExecutableName; // the name of the MIDlet, Python script, etc |
560 TFileName logicalExecutableName; // the name of the MIDlet, Python script, etc |
498 HBufC8* opaqueData = NULL; |
561 HBufC8* opaqueData = NULL; |
499 |
562 |
500 TIpcArgs ipcArgs; |
563 TIpcArgs ipcArgs; |
501 ipcArgs.Set(2, aAppUid.iUid); |
564 ipcArgs.Set(2, aAppUid.iUid); |
502 |
565 |
503 TInt error = GetExecutableNameAndNewOpaqueData(nativeExecutableName, logicalExecutableName, opaqueData, ipcArgs, EAppListServGetExecutableNameGivenAppUid); |
566 TInt error = GetExecutableNameAndNewOpaqueData(nativeExecutableName, logicalExecutableName, opaqueData, ipcArgs, EAppListServGetExecutableNameGivenAppUid); |
504 if (error) |
567 OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP14_RAPALSSESSION_STARTDOCUMENT, "GetExecutableNameAndNewOpaquedata returned with error =%d", error ); |
505 return error; |
568 |
|
569 if (error) |
|
570 { |
|
571 OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP15_RAPALSSESSION_STARTDOCUMENT, "RApaLsSession::StartDocument will return with error returned by GetExecutableNameAndNewOpaqueData : error=%d", error ); |
|
572 return error; |
|
573 } |
506 |
574 |
507 // Start the application, passing it the document file name |
575 // Start the application, passing it the document file name |
508 |
576 |
509 error = StartApplicationPassingDocumentName(nativeExecutableName, logicalExecutableName, opaqueData, aDocFileName, aThreadId, EApaCommandOpen, NULL); |
577 error = StartApplicationPassingDocumentName(nativeExecutableName, logicalExecutableName, opaqueData, aDocFileName, aThreadId, EApaCommandOpen, NULL); |
510 delete opaqueData; |
578 delete opaqueData; |
511 |
579 |
|
580 OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP16_RAPALSSESSION_STARTDOCUMENT, "RApaLsSession::StartDocument will return with error returned by StartApplicationPassingDocumentName : error=%d", error ); |
512 return error; |
581 return error; |
513 } |
582 } |
514 |
583 |
515 /** Finds and launches an application to handle the document contained in the specified file |
584 /** Finds and launches an application to handle the document contained in the specified file |
516 |
585 |
529 HBufC8* opaqueData=NULL; |
598 HBufC8* opaqueData=NULL; |
530 TIpcArgs ipcArgs; |
599 TIpcArgs ipcArgs; |
531 ipcArgs.Set(2, aAppUid.iUid); |
600 ipcArgs.Set(2, aAppUid.iUid); |
532 TInt error = GetExecutableNameAndNewOpaqueData(nativeExecutableName, logicalExecutableName, opaqueData, ipcArgs, EAppListServGetExecutableNameGivenAppUid); |
601 TInt error = GetExecutableNameAndNewOpaqueData(nativeExecutableName, logicalExecutableName, opaqueData, ipcArgs, EAppListServGetExecutableNameGivenAppUid); |
533 if (error) |
602 if (error) |
534 return error; |
603 { |
|
604 OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP17_RAPALSSESSION_STARTDOCUMENT, "RApaLsSession::StartDocument will return with the return value of GetExecutableNameAndNewOpaqueData : error=%d", error ); |
|
605 return error; |
|
606 } |
535 |
607 |
536 error = StartApplicationPassingFileHandle(nativeExecutableName, logicalExecutableName, opaqueData, aDocFile, aThreadId, aRequestStatusForRendezvous); |
608 error = StartApplicationPassingFileHandle(nativeExecutableName, logicalExecutableName, opaqueData, aDocFile, aThreadId, aRequestStatusForRendezvous); |
537 delete opaqueData; |
609 delete opaqueData; |
|
610 OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP18_RAPALSSESSION_STARTDOCUMENT, "RApaLsSession::StartDocument will return with the return value of StartApplicationPassingFileHandle : error=%d", error ); |
538 return error; |
611 return error; |
539 } //lint !e1764 Suppress reference parameter could be declared const ref |
612 } //lint !e1764 Suppress reference parameter could be declared const ref |
540 |
613 |
541 |
614 |
542 /** Launches the application identified by the specified UID and creates a new document. |
615 /** Launches the application identified by the specified UID and creates a new document. |
565 HBufC8* opaqueData=NULL; |
638 HBufC8* opaqueData=NULL; |
566 TIpcArgs ipcArgs; |
639 TIpcArgs ipcArgs; |
567 ipcArgs.Set(2, aAppUid.iUid); |
640 ipcArgs.Set(2, aAppUid.iUid); |
568 TInt error = GetExecutableNameAndNewOpaqueData(nativeExecutableName, logicalExecutableName, opaqueData, ipcArgs, EAppListServGetExecutableNameGivenAppUid); |
641 TInt error = GetExecutableNameAndNewOpaqueData(nativeExecutableName, logicalExecutableName, opaqueData, ipcArgs, EAppListServGetExecutableNameGivenAppUid); |
569 if (error) |
642 if (error) |
570 return error; |
643 { |
571 |
644 OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, RAPALSSESSION_CREATEDOCUMENT, "RApaLsSession::CreateDocument will return with error returned from GetExecutableNameAndNewOpaqueData=%d", error ); |
|
645 return error; |
|
646 } |
572 error = StartApplicationPassingDocumentName(nativeExecutableName, logicalExecutableName, opaqueData, aDocFileName, aThreadId,EApaCommandCreate,NULL); |
647 error = StartApplicationPassingDocumentName(nativeExecutableName, logicalExecutableName, opaqueData, aDocFileName, aThreadId,EApaCommandCreate,NULL); |
573 delete opaqueData; |
648 delete opaqueData; |
574 |
649 |
575 return error; |
650 OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP1_RAPALSSESSION_CREATEDOCUMENT, "RApaLsSession::CreateDocument will return with return value of StartApplicationPassingDocumentName =%d", error ); |
576 } |
651 return error; |
577 |
652 } |
578 |
653 |
579 |
654 |
|
655 |