securitydialogs/SecUi/Src/SecUiSystemLock.cpp
changeset 17 8957df7b0072
parent 0 164170e6151a
child 26 aad866c37519
equal deleted inserted replaced
15:318c4eab2439 17:8957df7b0072
    28 #include    "SecUiWait.h"
    28 #include    "SecUiWait.h"
    29 #include    <mmtsy_names.h>
    29 #include    <mmtsy_names.h>
    30 #include 	<e32property.h>
    30 #include 	<e32property.h>
    31 #include <ctsydomainpskeys.h>
    31 #include <ctsydomainpskeys.h>
    32 #include    <securityuisprivatepskeys.h>
    32 #include    <securityuisprivatepskeys.h>
       
    33 #include    <devicelockaccessapi.h>
       
    34 
    33     /*****************************************************
    35     /*****************************************************
    34     *    Series 60 Customer / TSY
    36     *    Series 60 Customer / TSY
    35     *    Needs customer TSY implementation
    37     *    Needs customer TSY implementation
    36     *****************************************************/
    38     *****************************************************/
    37 //  LOCAL CONSTANTS AND MACROS  
    39 //  LOCAL CONSTANTS AND MACROS  
   152     *****************************************************/
   154     *****************************************************/
   153     #if defined(_DEBUG)
   155     #if defined(_DEBUG)
   154     RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL()"));
   156     RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL()"));
   155     #endif
   157     #endif
   156     // close fast-swap window
   158     // close fast-swap window
   157     CEikonEnv::Static()->DismissTaskList();
   159             RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 );
   158 
   160             CDevicelockAccessApi* iDevicelockAccess = CDevicelockAccessApi::NewL( );
   159 #ifdef __WINS__
   161            	RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 );
   160     // can not verify security code in emulator ---> lock system 
   162 						iDevicelockAccess->OfferDevicelock();
   161 #ifdef RD_REMOTELOCK
   163 						//				EnableDevicelock( EDevicelockManual );
   162 		iProperty.Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EManualLocked);
   164 						RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 );
   163 #else// !RD_REMOTELOCK
       
   164         iProperty.Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockOn);
       
   165 #endif//RD_REMOTELOCK
       
   166 #else //__WINS__
       
   167 
       
   168     if(IsActive())
       
   169         return;
       
   170 
       
   171 
       
   172     RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice;
       
   173     RMobilePhone::TMobilePhoneLockInfoV1 lockInfo;
       
   174     RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo);
       
   175     RMobilePhone::TMobilePhoneLockSetting lockChange(RMobilePhone::ELockSetDisabled);
       
   176     CWait* wait = CWait::NewL();
       
   177     CleanupStack::PushL( wait );
       
   178     #if defined(_DEBUG)
       
   179     RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL() GetLockInfo"));
       
   180     #endif
       
   181     iPhone.GetLockInfo(wait->iStatus, lockType, lockInfoPkg);
       
   182     if (wait->WaitForRequestL() == KErrNone)
       
   183         {
       
   184         #if defined(_DEBUG)
       
   185         RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL() KErrNone"));
       
   186         #endif
       
   187         if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled)
       
   188             {
       
   189             #if defined(_DEBUG)
       
   190             RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL() ELockSetDisabled"));
       
   191             #endif
       
   192             // ask code
       
   193             #if defined(_DEBUG)
       
   194             RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL() SetLockSetting"));
       
   195             #endif
       
   196             //iCustomPhone.CheckSecurityCode(iStatus, RMmCustomAPI::ESecurityCodePassPhrase);
       
   197             lockChange = RMobilePhone::ELockSetEnabled;
       
   198             RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSystemLockOriginated);
       
   199             iPhone.SetLockSetting(iStatus, lockType, lockChange);
       
   200             SetActive();
       
   201             }        
       
   202         else
       
   203             {
       
   204             #if defined(_DEBUG)
       
   205             RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL() Lock System"));
       
   206             #endif
       
   207  // lock system 
       
   208 #ifdef RD_REMOTELOCK
       
   209 		iProperty.Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EManualLocked);
       
   210 #else// !RD_REMOTELOCK
       
   211         iProperty.Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockOn);
       
   212 #endif //RD_REMOTELOCK
       
   213 
       
   214             #if defined(_DEBUG)
       
   215             RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL() Lock System OK"));
       
   216             #endif
       
   217             }
       
   218         }
       
   219     else
       
   220         {
       
   221         // ask code 
       
   222         #if defined(_DEBUG)
       
   223         RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL() ask code (SLS) "));
       
   224         #endif
       
   225         lockChange = RMobilePhone::ELockSetEnabled;
       
   226         RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSystemLockOriginated);
       
   227         iPhone.SetLockSetting(iStatus, lockType, lockChange);
       
   228         SetActive();
       
   229         }
       
   230     CleanupStack::PopAndDestroy();
       
   231     #if defined(_DEBUG)
       
   232     RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL() END"));
       
   233     #endif // DEBUG
       
   234     #endif // WINS
       
   235     }
   165     }
   236 //
   166 //
   237 // ----------------------------------------------------------
   167 // ----------------------------------------------------------
   238 // CSystemLock::RunL()
   168 // CSystemLock::RunL()
   239 // Handles query result
   169 // Handles query result