Task jumping in contact details
When viewing contact details from a quick contact card, the contact
details appear in a two-pane UI, forming a sort of implicit Up
navigation. As a result, viewing contact details from another task is
in effect a task jump since the user may choose to navigate to other
contacts using the other pane of the UI.
Use the new shouldUpRecreateTask API in JB to determine whether the
trampoline from ContactDetailActivity to the two-pane People activity
should also include a task jump.
Bug:6449430
Change-Id: I90b86873a3a21022d52bb387d9adc5391c8d23ac
diff --git a/src/com/android/contacts/activities/ContactDetailActivity.java b/src/com/android/contacts/activities/ContactDetailActivity.java
index 1ccf32c..d656fdb 100644
--- a/src/com/android/contacts/activities/ContactDetailActivity.java
+++ b/src/com/android/contacts/activities/ContactDetailActivity.java
@@ -75,9 +75,18 @@
Intent intent = new Intent();
intent.setAction(originalIntent.getAction());
intent.setDataAndType(originalIntent.getData(), originalIntent.getType());
- intent.setFlags(
- Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | Intent.FLAG_ACTIVITY_FORWARD_RESULT
- | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
+
+ // If we are launched from the outside, we should create a new task, because the user
+ // can freely navigate the app (this is different from phones, where only the UP button
+ // kicks the user into the full app)
+ if (shouldUpRecreateTask(intent)) {
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK |
+ Intent.FLAG_ACTIVITY_TASK_ON_HOME);
+ } else {
+ intent.setFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS |
+ Intent.FLAG_ACTIVITY_FORWARD_RESULT | Intent.FLAG_ACTIVITY_SINGLE_TOP |
+ Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ }
intent.setClass(this, PeopleActivity.class);
startActivity(intent);