19 #include <e32debug.h> |
19 #include <e32debug.h> |
20 #include "hslaunch.h" |
20 #include "hslaunch.h" |
21 |
21 |
22 // ========================= DECLARATIONS ================================== |
22 // ========================= DECLARATIONS ================================== |
23 _LIT( KHsExeName, "homescreen.exe" ); |
23 _LIT( KHsExeName, "homescreen.exe" ); |
|
24 _LIT( KHsProcessName, "Home screen" ); |
24 const TInt KSleepOnRetry = 250000; // 250ms |
25 const TInt KSleepOnRetry = 250000; // 250ms |
25 const TUid KPSCategoryUid = TUid::Uid( 0x200286E3 ); |
26 const TUid KPSCategoryUid = TUid::Uid( 0x200286E3 ); |
26 const TInt KPSCrashCountKey = 1; |
27 const TInt KPSCrashCountKey = 1; |
27 _LIT_SECURITY_POLICY_C1( KPSReadPolicy, ECapabilityReadDeviceData ); |
28 _LIT_SECURITY_POLICY_C1( KPSReadPolicy, ECapabilityReadDeviceData ); |
28 _LIT_SECURITY_POLICY_C1( KPSWritePolicy, ECapabilityWriteDeviceData ); |
29 _LIT_SECURITY_POLICY_C1( KPSWritePolicy, ECapabilityWriteDeviceData ); |
183 // ----------------------------------------------------------------------------- |
184 // ----------------------------------------------------------------------------- |
184 // CHsLaunch::RunL |
185 // CHsLaunch::RunL |
185 // ----------------------------------------------------------------------------- |
186 // ----------------------------------------------------------------------------- |
186 // |
187 // |
187 void CHsLaunch::RunL() |
188 void CHsLaunch::RunL() |
188 { |
189 { |
189 // Create process |
190 // Create app or connect to existing. |
|
191 TInt processExisted = EFalse; |
|
192 |
190 RProcess process; |
193 RProcess process; |
191 TInt processError = KErrNone; |
194 TInt processError = process.Create( KHsExeName, KNullDesC ); |
192 processError = process.Create( KHsExeName, KNullDesC ); |
195 if( processError == KErrAlreadyExists ) |
|
196 { |
|
197 processError = process.Open( KHsProcessName, EOwnerProcess ); |
|
198 processExisted = ETrue; |
|
199 } |
193 |
200 |
194 TInt monitorError = KErrNone; |
201 TInt monitorError = KErrNone; |
195 if( processError == KErrNone ) |
202 if( processError == KErrNone ) |
196 { |
203 { |
197 TRAP( monitorError, InitProcessMonitorL( process.Id() ) ); |
204 TRAP( monitorError, InitProcessMonitorL( process.Id() ) ); |
198 } |
205 } |
199 |
206 |
200 if( processError == KErrNone ) |
207 if( processError == KErrNone && |
|
208 !processExisted ) |
201 { |
209 { |
202 // Make sure process is started even if monitor startup |
210 // Make sure process is started even if monitor startup |
203 // fails. This will assure that process is not left in |
211 // fails. This will assure that process is not left in |
204 // suspended state. Resume can not be called for |
212 // suspended state. Resume can not be called for |
205 // already running process (will cause KERN-EXEC 46). |
213 // already running process (will cause KERN-EXEC 46). |