Launch contact detail screen as a new task

This will have the detail screen appear as a separate task in
"recent task" screen.

Bug: 5039625
Change-Id: Id686650e0d6dafa5afaab53312739fe8fee326de
diff --git a/src/com/android/contacts/CallDetailActivity.java b/src/com/android/contacts/CallDetailActivity.java
index 428e2e8..8e58cd9 100644
--- a/src/com/android/contacts/CallDetailActivity.java
+++ b/src/com/android/contacts/CallDetailActivity.java
@@ -408,6 +408,10 @@
 
                 if (contactUri != null) {
                     mainActionIntent = new Intent(Intent.ACTION_VIEW, contactUri);
+                    // This will launch People's detail contact screen, so we probably want to
+                    // treat it as a separate People task.
+                    mainActionIntent.setFlags(
+                            Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
                     mainActionIcon = R.drawable.ic_contacts_holo_dark;
                     mainActionDescription =
                             getString(R.string.description_view_contact, nameOrNumber);
diff --git a/src/com/android/contacts/list/ContactTileSecondaryTargetView.java b/src/com/android/contacts/list/ContactTileSecondaryTargetView.java
index c4ea212..25f353d 100644
--- a/src/com/android/contacts/list/ContactTileSecondaryTargetView.java
+++ b/src/com/android/contacts/list/ContactTileSecondaryTargetView.java
@@ -46,7 +46,11 @@
         mSecondaryButton.setOnClickListener(new OnClickListener() {
             @Override
             public void onClick(View v) {
-                getContext().startActivity(new Intent(Intent.ACTION_VIEW, getLookupUri()));
+                Intent intent = new Intent(Intent.ACTION_VIEW, getLookupUri());
+                // Secondary target will be visible only from phone's favorite screen, then
+                // we want to launch it as a separate People task.
+                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
+                getContext().startActivity(intent);
             }
         });
     }