clock2/clockui/adtupdater/src/adtupdaterappui.cpp
branchRCL_3
changeset 78 356f28cd5ca0
parent 66 bd7edf625bdd
child 86 ed599363c2d7
--- a/clock2/clockui/adtupdater/src/adtupdaterappui.cpp	Tue Sep 14 21:17:03 2010 +0300
+++ b/clock2/clockui/adtupdater/src/adtupdaterappui.cpp	Wed Sep 15 12:11:35 2010 +0300
@@ -28,6 +28,10 @@
 const TInt KOrdinalPosition( 0 );
 const TInt KOrdinalPriority( 0 );
 
+// Uid of phoneapp
+const TUid KPhoneUid  = {0x100058B3};
+
+
 // Literals
 
 // ---------------------------------------------------------
@@ -76,7 +80,8 @@
     BaseConstructL( EStandardApp | EAknEnableSkin | EAknEnableMSK |
             EAknSingleClickCompatible );
 
-	
+    iAdtWgId = iCoeEnv->RootWin().Identifier();
+
 	// Sets the priority for window group
 	CEikonEnv &eikEnv = *CEikonEnv::Static();	
 	eikEnv.RootWin().SetOrdinalPosition( KOrdinalPosition, KOrdinalPriority );
@@ -145,6 +150,48 @@
 	}
 
 // ---------------------------------------------------------
+// CAdtUpdaterAppUi::IsAppInBackground
+// rest of the details are commented in the header
+// ---------------------------------------------------------
+//
+TBool CAdtUpdaterAppUi::IsAppInBackground()
+    {
+	__PRINTS( "CAdtUpdaterAppUi::IsAppInBackground - Entry" );
+    // Gets the window group id of the app coming in foreground
+    TInt activeWgId = iCoeEnv->WsSession().GetFocusWindowGroup();
+    __PRINTS( "CAdtUpdaterAppUi::IsAppInBackground - Exit" );
+    if(activeWgId != iAdtWgId)
+        {
+        return ETrue;
+        }
+    return EFalse;
+    }
+
+// ---------------------------------------------------------
+// CAdtUpdaterAppUi::IsHighPriorityWindowActive
+// rest of the details are commented in the header
+// ---------------------------------------------------------
+//
+TBool CAdtUpdaterAppUi::IsHighPriorityWindowActive()
+    {
+    __PRINTS( "CCAdtUpdaterAppUi::IsHighPriorityWindowActive - Entry" );
+    // Gets the window group id of the app coming in foreground
+    TInt activeWgId = iCoeEnv->WsSession().GetFocusWindowGroup();
+    TApaTaskList taskList(iCoeEnv->WsSession());
+    
+    //In future, if any other high priority window will be there, then 
+    //add that particular UID in the below check.
+    //Note: Key Lock and alarm are not handled here as these windows already 
+    //have high priority than CDT. In callui window group, the window - when
+    //call is answered, has a low priority, that's why callui is handled here.
+    __PRINTS( "CCAdtUpdaterAppUi::IsHighPriorityWindowActive - Exit" );
+    if(activeWgId == taskList.FindApp(KPhoneUid).WgId())
+        {
+        return ETrue;
+        }
+    return EFalse;
+    }
+// ---------------------------------------------------------
 // CAdtUpdaterAppUi::ToggleAppViewL
 // rest of the details are commented in the header
 // ---------------------------------------------------------