resolved conflicts for merge of b52c152d to master

Change-Id: I34869bda071d511c9595ea0a5ff6571eb34da059
diff --git a/services/audiopolicy/AudioPolicyManager.cpp b/services/audiopolicy/AudioPolicyManager.cpp
index c472b11..ee0c987 100644
--- a/services/audiopolicy/AudioPolicyManager.cpp
+++ b/services/audiopolicy/AudioPolicyManager.cpp
@@ -280,6 +280,7 @@
                             0);
         }
 
+        mpClientInterface->onAudioPortListUpdate();
         return NO_ERROR;
     }  // end if is output device
 
@@ -336,6 +337,7 @@
 
         closeAllInputs();
 
+        mpClientInterface->onAudioPortListUpdate();
         return NO_ERROR;
     } // end if is input device
 
@@ -747,6 +749,7 @@
         }
         mPreviousOutputs = mOutputs;
         ALOGV("getOutput() returns new direct output %d", output);
+        mpClientInterface->onAudioPortListUpdate();
         return output;
     }
 
@@ -979,6 +982,7 @@
             if (dstOutput != mPrimaryOutput) {
                 mpClientInterface->moveEffects(AUDIO_SESSION_OUTPUT_MIX, mPrimaryOutput, dstOutput);
             }
+            mpClientInterface->onAudioPortListUpdate();
         }
     }
 }
@@ -1060,6 +1064,7 @@
         return 0;
     }
     addInput(input, inputDesc);
+    mpClientInterface->onAudioPortListUpdate();
     return input;
 }
 
@@ -1145,6 +1150,7 @@
     delete mInputs.valueAt(index);
     mInputs.removeItem(input);
     nextAudioPortGeneration();
+    mpClientInterface->onAudioPortListUpdate();
     ALOGV("releaseInput() exit");
 }
 
@@ -1897,6 +1903,7 @@
                 patchDesc->mAfPatchHandle = afPatchHandle;
                 *handle = patchDesc->mHandle;
                 nextAudioPortGeneration();
+                mpClientInterface->onAudioPatchListUpdate();
             } else {
                 ALOGW("createAudioPatch() patch panel could not connect device patch, error %d",
                 status);
@@ -1960,6 +1967,7 @@
                                                               status, patchDesc->mAfPatchHandle);
             removeAudioPatch(patchDesc->mHandle);
             nextAudioPortGeneration();
+            mpClientInterface->onAudioPatchListUpdate();
         } else {
             return BAD_VALUE;
         }
@@ -3577,6 +3585,7 @@
                 }
                 outputDesc->mPatchHandle = patchDesc->mHandle;
                 nextAudioPortGeneration();
+                mpClientInterface->onAudioPatchListUpdate();
             }
         }
     }
@@ -3607,6 +3616,7 @@
     outputDesc->mPatchHandle = 0;
     removeAudioPatch(patchDesc->mHandle);
     nextAudioPortGeneration();
+    mpClientInterface->onAudioPatchListUpdate();
     return status;
 }
 
@@ -3662,6 +3672,7 @@
                 }
                 inputDesc->mPatchHandle = patchDesc->mHandle;
                 nextAudioPortGeneration();
+                mpClientInterface->onAudioPatchListUpdate();
             }
         }
     }
@@ -3687,6 +3698,7 @@
     inputDesc->mPatchHandle = 0;
     removeAudioPatch(patchDesc->mHandle);
     nextAudioPortGeneration();
+    mpClientInterface->onAudioPatchListUpdate();
     return status;
 }