phoneapp/phoneuicontrol/src/cphonestate.cpp
branchRCL_3
changeset 31 ba54057fe027
parent 25 91c2fb4b78df
child 39 b8d67d6176f5
--- a/phoneapp/phoneuicontrol/src/cphonestate.cpp	Tue Apr 27 16:37:10 2010 +0300
+++ b/phoneapp/phoneuicontrol/src/cphonestate.cpp	Tue May 11 16:13:03 2010 +0300
@@ -55,6 +55,7 @@
 #include <textresolver.h>
 #include <phoneappvoipcommands.hrh>
 #include <hwrmdomainpskeys.h>
+#include <hal.h>
 
 #include "phoneui.pan"
 #include "cphonestate.h"
@@ -257,12 +258,7 @@
 
         case MEngineMonitor::EPEMessageCallSecureStatusChanged:
             HandleCallSecureStatusChangeL( aCallId );
-
-            if ( iCustomization )
-                {
-                iCustomization->HandlePhoneEngineMessageL( aMessage,
-                    aCallId );
-                }
+            ForwardPEMessageToPhoneCustomizationL( aMessage, aCallId );
             break;
 
         case MEngineMonitor::EPEMessageActivateWarrantyMode:
@@ -380,11 +376,7 @@
 
             TBool handled( EFalse );
 
-            if ( iCustomization )
-                {
-                handled = iCustomization->HandlePhoneEngineMessageL(
-                                aMessage, aCallId );
-                }
+            handled = ForwardPEMessageToPhoneCustomizationL( aMessage, aCallId );
 
             if ( EFalse == handled )
                 {
@@ -843,28 +835,39 @@
 void CPhoneState::HandleChangedCallDurationL( TInt aCallId )
     {
      __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleChangedCallDurationL() ");
-    // Get the call duration
-    TTime time( 0 );
-    TTimeIntervalSeconds timeInterval =
-        iStateMachine->PhoneEngineInfo()->CallDuration( aCallId );
-    time += timeInterval;
-
-    // Read format string from AVKON resource
-    TBuf<KPhoneMaxCharsInNote> timeDurationFormatString( KNullDesC );
-    LoadResource( timeDurationFormatString, EPhoneCallDurationFormatString );
-
-    // Format the time
-    TBuf<KPhoneMaxTimeDisplayTextLength> timeString( KNullDesC );
-    time.FormatL( timeString, timeDurationFormatString );
-
-    // Localize time format
-    AknTextUtils::LanguageSpecificNumberConversion( timeString );
-
-    // update the call header call duration
-    iViewCommandHandle->ExecuteCommandL(
-        EPhoneViewUpdateCallHeaderCallDuration,
-        aCallId,
-        timeString );
+    
+    TInt ret = KErrNone;
+    TInt isDisplayOn;
+    
+    ret = HAL::Get( HALData::EDisplayState, isDisplayOn );
+    
+    // Update only if the display is on or if HAL::Get returns an error, 
+    // in which case display value cannot be trusted.
+    if ( ret || isDisplayOn )
+        {
+        // Get the call duration
+        TTime time( 0 );
+        TTimeIntervalSeconds timeInterval =
+            iStateMachine->PhoneEngineInfo()->CallDuration( aCallId );
+        time += timeInterval;
+        
+        // Read format string from AVKON resource
+        TBuf<KPhoneMaxCharsInNote> timeDurationFormatString( KNullDesC );
+        LoadResource( timeDurationFormatString, EPhoneCallDurationFormatString );
+        
+        // Format the time
+        TBuf<KPhoneMaxTimeDisplayTextLength> timeString( KNullDesC );
+        time.FormatL( timeString, timeDurationFormatString );
+        
+        // Localize time format
+        AknTextUtils::LanguageSpecificNumberConversion( timeString );
+        
+        // update the call header call duration
+        iViewCommandHandle->ExecuteCommandL(
+            EPhoneViewUpdateCallHeaderCallDuration,
+            aCallId,
+            timeString );
+        }
     }
 
 // -----------------------------------------------------------------------------
@@ -4724,8 +4727,8 @@
         {
         TPhoneCmdParamInteger integerParam;
         integerParam.SetInteger( EPhoneInCallCmdActivateIhf );
-        TRAP_IGNORE( iViewCommandHandle->ExecuteCommandL(
-            EPhoneViewEnableToolbarButton, &integerParam ));
+        iViewCommandHandle->ExecuteCommand(
+            EPhoneViewEnableToolbarButton, &integerParam );
         }
     }
 
@@ -4778,5 +4781,25 @@
         }
     }
 
+// -----------------------------------------------------------
+// CPhoneState::ForwardPEMessageToPhoneCustomizationL
+// Forward Phone Engine messages to Phone customization
+// (other items were commented in a header).
+// -----------------------------------------------------------
+//
+EXPORT_C TBool CPhoneState::ForwardPEMessageToPhoneCustomizationL(
+    const TInt aMessage,
+    TInt aCallId )
+    {
+    __LOGMETHODSTARTEND( EPhoneControl, "CPhoneState::ForwardPEMessageToPhoneCustomizationL() " );
+    TBool handled = EFalse;
+    
+    if ( iCustomization )
+       {
+       handled = iCustomization->HandlePhoneEngineMessageL( aMessage, aCallId );
+       }
+    return handled;
+    }
+
 //  End of File