sysstatemgmt/ssmpolicyplugins/ssmshutdownpolicy/src/ssmshutdownpolicy.cpp
branchRCL_3
changeset 20 1ddbe54d0645
parent 7 1fc153c72b60
equal deleted inserted replaced
19:94cb00198351 20:1ddbe54d0645
   215     CRepository* repository =
   215     CRepository* repository =
   216         CRepository::NewLC( iUtil->CrUid( KCRUidStartup ) );
   216         CRepository::NewLC( iUtil->CrUid( KCRUidStartup ) );
   217     TInt errorCode = repository->Set( KStartupReason, aReasonCode );
   217     TInt errorCode = repository->Set( KStartupReason, aReasonCode );
   218     ERROR( errorCode, "Failed to set KStartupReason CenRep key" );
   218     ERROR( errorCode, "Failed to set KStartupReason CenRep key" );
   219 
   219 
       
   220 	// In case of disk full, we will not try to set the device lock query status cenrep key here.
       
   221 	// Rather it is set after disk space is recovered.
       
   222 	if ((EUnknownReset !=  aReasonCode) && (KErrDiskFull != errorCode))
       
   223 		{
       
   224 		// Set the lock code query success as EStartupDevLockNotSucess in case the shutdown is not due to the the unknown reset.  
       
   225 		// This is because if the device crashes before resetting the key during boot time.
       
   226 		errorCode = repository->Set(KStartupDevLockStatus, EStartupDevLockNotSucess);
       
   227 		INFO_1("Setting KStartupDevLockStatus CenRep key with EStartupDevLockNotSucess completed with %d", errorCode);
       
   228 		}
       
   229 
   220 	if( KErrDiskFull == errorCode )
   230 	if( KErrDiskFull == errorCode )
   221 		{
   231 		{
   222 		//Need not to put on CleanupStack, it's not calling any leaving function and
   232 		//Need not to put on CleanupStack, it's not calling any leaving function and
   223 		//it's handled by reference count
   233 		//it's handled by reference count
   224 		CSsmUiSpecific* ssmUiSpecific = CSsmUiSpecific::InstanceL();
   234 		CSsmUiSpecific* ssmUiSpecific = CSsmUiSpecific::InstanceL();
   226 		errorCode = ssmUiSpecific->FreeReservedPhoneMemorySpace( 0 );
   236 		errorCode = ssmUiSpecific->FreeReservedPhoneMemorySpace( 0 );
   227 		if( KErrNone == errorCode )
   237 		if( KErrNone == errorCode )
   228 			{
   238 			{
   229 			errorCode = repository->Set( KStartupReason, aReasonCode );
   239 			errorCode = repository->Set( KStartupReason, aReasonCode );
   230 			ERROR( errorCode, "Failed to set KStartupReason CenRep key after freeing the memory" );
   240 			ERROR( errorCode, "Failed to set KStartupReason CenRep key after freeing the memory" );
       
   241 
       
   242 			if (EUnknownReset !=  aReasonCode)
       
   243 				{
       
   244 				// Set the lock code query success as EStartupDevLockNotSucess in case the shutdown is not due to the the unknown reset.  
       
   245 				// This is because if the device crashes before resetting the key during boot time.
       
   246 				errorCode = repository->Set(KStartupDevLockStatus, EStartupDevLockNotSucess);
       
   247 				ERROR( errorCode, "Failed to set KStartupDevLockStatus CenRep key after freeing the memory" );
       
   248 				}
   231 			}
   249 			}
   232 		CSsmUiSpecific::Release();
   250 		CSsmUiSpecific::Release();
   233 		}
   251 		}
   234     
   252     
   235     CleanupStack::PopAndDestroy( repository );
   253     CleanupStack::PopAndDestroy( repository );