Specify display ID to launch activity in correct DA

Bug: 197363258
Test: manual on seahawk_car_ui_portrait
Change-Id: Iaa88f31d174abb52a83d30acf3607e591590ed55
diff --git a/src/com/android/car/carlauncher/homescreen/audio/InCallModel.java b/src/com/android/car/carlauncher/homescreen/audio/InCallModel.java
index 5421cb9..3ace6b4 100644
--- a/src/com/android/car/carlauncher/homescreen/audio/InCallModel.java
+++ b/src/com/android/car/carlauncher/homescreen/audio/InCallModel.java
@@ -17,6 +17,7 @@
 package com.android.car.carlauncher.homescreen.audio;
 
 import android.Manifest;
+import android.app.ActivityOptions;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
@@ -27,6 +28,7 @@
 import android.telecom.Call;
 import android.telecom.TelecomManager;
 import android.util.Log;
+import android.view.Display;
 import android.view.View;
 
 import androidx.core.content.ContextCompat;
@@ -175,7 +177,12 @@
         PackageManager pm = mContext.getPackageManager();
         Intent intent = pm.getLaunchIntentForPackage(mTelecomManager.getDefaultDialerPackage());
         if (intent != null) {
-            mContext.startActivity(intent);
+            // Launch activity in the default app task container: the display area where
+            // applications are launched by default.
+            // If not set, activity launches in the calling TDA.
+            ActivityOptions options = ActivityOptions.makeBasic();
+            options.setLaunchDisplayId(Display.DEFAULT_DISPLAY);
+            mContext.startActivity(intent, options.toBundle());
         } else {
             if (DEBUG) {
                 Log.d(TAG, "No launch intent found for dialer package: "
diff --git a/src/com/android/car/carlauncher/homescreen/audio/MediaViewModel.java b/src/com/android/car/carlauncher/homescreen/audio/MediaViewModel.java
index 17ee283..3fd6549 100644
--- a/src/com/android/car/carlauncher/homescreen/audio/MediaViewModel.java
+++ b/src/com/android/car/carlauncher/homescreen/audio/MediaViewModel.java
@@ -18,12 +18,14 @@
 
 import static android.car.media.CarMediaManager.MEDIA_SOURCE_MODE_PLAYBACK;
 
+import android.app.ActivityOptions;
 import android.app.Application;
 import android.car.Car;
 import android.content.Context;
 import android.content.Intent;
 import android.graphics.drawable.Drawable;
 import android.util.Size;
+import android.view.Display;
 import android.view.View;
 
 import androidx.annotation.NonNull;
@@ -112,7 +114,13 @@
 
     @Override
     public void onClick(View v) {
-        v.getContext().startActivity(new Intent(Car.CAR_INTENT_ACTION_MEDIA_TEMPLATE));
+        // Launch activity in the default app task container: the display area where
+        // applications are launched by default.
+        // If not set, activity launches in the calling TDA.
+        ActivityOptions options = ActivityOptions.makeBasic();
+        options.setLaunchDisplayId(Display.DEFAULT_DISPLAY);
+        v.getContext().startActivity(new Intent(Car.CAR_INTENT_ACTION_MEDIA_TEMPLATE),
+                options.toBundle());
     }
 
     /**