Skip to content

fix: open correct contact when reopening details after a call#794

Open
fluffyspace wants to merge 1 commit intoFossifyOrg:mainfrom
fluffyspace:fix/contact-details-stale-task
Open

fix: open correct contact when reopening details after a call#794
fluffyspace wants to merge 1 commit intoFossifyOrg:mainfrom
fluffyspace:fix/contact-details-stale-task

Conversation

@fluffyspace
Copy link
Copy Markdown

Summary

Fixes #783 — picking a contact from Favorites/Contacts after calling a previously-viewed contact opens that previous contact instead of the one just tapped.

Root cause

startContactDetailsIntent in ActivityExt.kt launches ACTION_QUICK_CONTACT via the commons launchActivityIntent, which adds only FLAG_ACTIVITY_NEW_TASK. With that flag alone, if the receiving Contacts app's task is still alive from a previous view, Android brings the existing task forward with its old activity stack. The new intent is dropped (the receiver isn't singleTop / singleTask), so the previously-viewed contact is shown.

This is easy to miss in casual testing — pressing back from the quick-contact view finishes the activity and tears down the task, so the bug only reproduces when the previous quick-contact view is left in the background (the typical flow being: open contact → tap call → end call → return to phone app → tap a different contact).

Fix

Add FLAG_ACTIVITY_CLEAR_TASK so the receiver's task is cleared before launching the new view. Applied to both branches (Fossify Contacts via ACTION_VIEW, system Contacts via ACTION_QUICK_CONTACT). The launchViewContactIntent call was inlined so the flag could be set before launchActivityIntent adds NEW_TASK.

Test plan

  • Open Favorites, tap contact A → call A → end call → tap contact B in Favorites → contact B's details appear (previously: contact A reappeared)
  • Repeat the call/return cycle several times → no stale stack of past contacts builds up
  • Plain "tap A → back → tap B" path still works
  • Same flow from the Contacts tab
  • Same flow with Fossify Contacts installed (private-contact branch)

The contact details intent (ACTION_QUICK_CONTACT) was launched with only
FLAG_ACTIVITY_NEW_TASK. If the system Contacts app's task was still alive
from a previous view (e.g. after calling the previously-viewed contact),
that task was brought forward with its old activity and the new intent
was dropped. Adds FLAG_ACTIVITY_CLEAR_TASK so the receiver's task is
cleared before launching the new view.

Fixes FossifyOrg#783.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Picks wrong contact after a previous call from the contact details

2 participants