accessoryservices/accessoryserver/src/Server/AccSrvConnectionController.cpp
branchRCL_3
changeset 10 66ecddbca914
parent 9 21e939dd208a
child 12 4a5c47a50617
--- a/accessoryservices/accessoryserver/src/Server/AccSrvConnectionController.cpp	Tue Apr 27 17:57:16 2010 +0300
+++ b/accessoryservices/accessoryserver/src/Server/AccSrvConnectionController.cpp	Tue May 11 17:23:24 2010 +0300
@@ -761,22 +761,38 @@
     TAccPolAccessoryMode accMode;
 
     iServerModel->CurrentConnectionStatusL( genericIDArray );
-
-    if( (EFalse == aAudioOutputStatus) && (KErrUnknown != aDbId) ) 
-        { 
-        TInt index( TAccPolGenericIDArrayAccessor::FindWithUniqueIDL( 
-                genericIDArray, aDbId) ); 
-				if(KErrNotFound != index)
-					{
-        	TAccPolGenericIDArrayAccessor::RemoveIndexFromGenericIDArray(genericIDArray, index); 
-        	}
+    
+    TUint count;
+    TBool isHDMIConnected = EFalse;
+    
+    count = genericIDArray.Count();
+    if((1 < count) && (EFalse == aAudioOutputStatus) && (KErrUnknown != aDbId))
+        {
+        for(TInt i( 0 ); i < count; ++i)
+            {
+            if(genericIDArray.GetGenericIDL(i).PhysicalConnectionCaps() & KPCHDMI)
+                {
+                isHDMIConnected = ETrue;
+                break;
+                }        
+            }
+        }
+    
+    if(isHDMIConnected)
+        {
+        accMode = iServerModel->AccessoryMode();
+        }    
+    else
+        {
+        accMode = iPolicy->ResolveAccessoryModeL( genericIDArray, 
+                                                  aDbId, 
+                                                  aAudioOutputStatus, 
+                                                  iServerModel->AccessoryMode(), 
+                                                  iServerModel->UniqueID() );
         }
 
-    accMode = iPolicy->ResolveAccessoryModeL( genericIDArray, 
-                                              aDbId, 
-                                              aAudioOutputStatus, 
-                                              iServerModel->AccessoryMode(), 
-                                              iServerModel->UniqueID() );
+
+    
 
     if( iServerModel->SetAccessoryMode( accMode, aDbId ) ) //Store accessory mode
         {