idlefw/hslaunch/src/hslaunch.cpp
branchRCL_3
changeset 122 6cadd6867c17
parent 114 a5a39a295112
child 130 67f2ed48ad91
equal deleted inserted replaced
118:8baec10861af 122:6cadd6867c17
    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" );
       
    25 const TInt KSleepOnRetry = 250000; // 250ms
    24 const TInt KSleepOnRetry = 250000; // 250ms
    26 const TUid KPSCategoryUid = TUid::Uid( 0x200286E3 );
    25 const TUid KPSCategoryUid = TUid::Uid( 0x200286E3 );
    27 const TInt KPSCrashCountKey = 1;
    26 const TInt KPSCrashCountKey = 1;
    28 _LIT_SECURITY_POLICY_C1( KPSReadPolicy, ECapabilityReadDeviceData );
    27 _LIT_SECURITY_POLICY_C1( KPSReadPolicy, ECapabilityReadDeviceData );
    29 _LIT_SECURITY_POLICY_C1( KPSWritePolicy, ECapabilityWriteDeviceData );
    28 _LIT_SECURITY_POLICY_C1( KPSWritePolicy, ECapabilityWriteDeviceData );
   184 // -----------------------------------------------------------------------------
   183 // -----------------------------------------------------------------------------
   185 // CHsLaunch::RunL
   184 // CHsLaunch::RunL
   186 // -----------------------------------------------------------------------------
   185 // -----------------------------------------------------------------------------
   187 //
   186 //
   188 void CHsLaunch::RunL()
   187 void CHsLaunch::RunL()
   189     {    
   188     {        
   190     // Create app or connect to existing.
   189     // Create process
   191     TInt processExisted = EFalse;
       
   192     
       
   193     RProcess process;
   190     RProcess process;
   194     TInt processError = process.Create( KHsExeName, KNullDesC );
   191     TInt processError = KErrNone;    
   195     if( processError == KErrAlreadyExists )
   192     processError = process.Create( KHsExeName, KNullDesC );
   196         {        
       
   197         processError = process.Open( KHsProcessName, EOwnerProcess );
       
   198         processExisted = ETrue;
       
   199         }
       
   200     
   193     
   201     TInt monitorError = KErrNone;
   194     TInt monitorError = KErrNone;
   202     if( processError == KErrNone )
   195     if( processError == KErrNone )
   203         {
   196         {
   204         TRAP( monitorError, InitProcessMonitorL( process.Id() ) );
   197         TRAP( monitorError, InitProcessMonitorL( process.Id() ) );
   205         }
   198         }
   206     
   199     
   207     if( processError == KErrNone &&
   200     if( processError == KErrNone )
   208         !processExisted )
       
   209         {
   201         {
   210         // Make sure process is started even if monitor startup
   202         // Make sure process is started even if monitor startup
   211         // fails. This will assure that process is not left in
   203         // fails. This will assure that process is not left in
   212         // suspended state. Resume can not be called for
   204         // suspended state. Resume can not be called for
   213         // already running process (will cause KERN-EXEC 46).
   205         // already running process (will cause KERN-EXEC 46).