Fix Control bar display from overriding on going phone call with media.

Reason for cherry-picking: This fixes a few bugs currently blocking TM-QPR.
Launching any media app overrides the ongoing phone call display in
Control Bar Activity. When user launches/opens dialer only dialpad is
displayed and no other phone call controls. When there is an ongoing
phone call limit CardPresenter that sets the view from switching.

Bug: 206649993 221112085
Test: manual atest
Change-Id: Id372d8f9681bea5cd5c23c61e804f7a906220948
(cherry picked from commit 4a26a95a9accbcd4e48006eb7c05b187977ceef0)
diff --git a/src/com/android/car/carlauncher/homescreen/audio/HomeAudioCardPresenter.java b/src/com/android/car/carlauncher/homescreen/audio/HomeAudioCardPresenter.java
index 3398389..5c14aaa 100644
--- a/src/com/android/car/carlauncher/homescreen/audio/HomeAudioCardPresenter.java
+++ b/src/com/android/car/carlauncher/homescreen/audio/HomeAudioCardPresenter.java
@@ -101,6 +101,10 @@
                 // empty content since that would hide the card.
                 return;
             }
+        } else if (mCurrentModel != null && mCurrentModel.getClass() == InCallModel.class) {
+            // If the Model has content, check if currentModel on display is an ongoing phone call.
+            // If there is any ongoing phone call do not update the View.
+            return;
         }
         mCurrentModel = model;
         super.onModelUpdated(model);
diff --git a/tests/src/com/android/car/carlauncher/homescreen/audio/HomeAudioCardPresenterTest.java b/tests/src/com/android/car/carlauncher/homescreen/audio/HomeAudioCardPresenterTest.java
index 602e364..b53d5bd 100644
--- a/tests/src/com/android/car/carlauncher/homescreen/audio/HomeAudioCardPresenterTest.java
+++ b/tests/src/com/android/car/carlauncher/homescreen/audio/HomeAudioCardPresenterTest.java
@@ -27,6 +27,7 @@
 import com.android.car.carlauncher.homescreen.HomeCardInterface;
 import com.android.car.carlauncher.homescreen.ui.CardHeader;
 import com.android.car.carlauncher.homescreen.ui.DescriptiveTextView;
+import com.android.car.carlauncher.homescreen.ui.DescriptiveTextWithControlsView;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -35,8 +36,6 @@
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 
-import java.util.Collections;
-
 @RunWith(JUnit4.class)
 public class HomeAudioCardPresenterTest {
 
@@ -92,6 +91,28 @@
     }
 
     @Test
+    public void onModelUpdated_activePhoneCall_doesNotUpdateFragment() {
+        //setUpActivePhoneCall in presenter
+        CardHeader callModelHeader = new CardHeader("dialer", /* appIcon = */
+                null);
+        DescriptiveTextWithControlsView callModelContent = new DescriptiveTextWithControlsView(
+                /* image = */ null, "callerNumber", "ongoingCall");
+        when(mOtherModel.getCardHeader()).thenReturn(callModelHeader);
+        when(mOtherModel.getCardContent()).thenReturn(callModelContent);
+        mPresenter.onModelUpdated(mOtherModel);
+
+        // send MediaModel update during ongoing call
+        mPresenter.onModelUpdated(mModel);
+
+        //verify call
+        verify(mView).updateHeaderView(callModelHeader);
+        verify(mView).updateContentView(callModelContent);
+        verify(mView, never()).hideCard();
+        verify(mView, never()).updateHeaderView(CARD_HEADER);
+        verify(mView, never()).updateContentView(CARD_CONTENT);
+    }
+
+    @Test
     public void onModelUpdated_nullSameModel_updatesFragment() {
         mPresenter.onModelUpdated(mModel);
         reset(mView);