Lets take an app with 2 activities MainActivity and Activity2. MainAct is the launcher activity. Activity2 contains a default navhost fragment having a navgraph with two fragments, fragment1(start-destination), fragment2.
When starting MainActivity I create a notification having a content intent created with NavDeepLinkBuilder that navigates to Activity2.fragment2. The problem appears if MainActivity is running and active in the foreground and Activity2.fragment2 is navigated then after I press back it does not navigate back to MainActivity as it should but instead it takes me to launcher home screen.
I also tested this behaviour with implicit deep links: adb shell am start -a "android.intent.action.VIEW" -d http://fragment2/ Having MainActivity open Activity2 gets on top and on back press it navigates to MainActivity as it should.
I think either I did not construct the explicit link correctly or this is a bug with explicit deep links. Complete demo project https://github.com/iulian0512/navtest
TLDR:
Explicit Deep Link (invoked from notification)
MainActivity(already running) -> Activity2 (back press) -> Launcher home screen
Implicit Deep Link (invoked from terminal)
MainActivity(already running) -> Activity2 (back press) -> MainActivity
LE: I created a video to try to explain the issue more concisely https://www.youtube.com/watch?v=HBShKSjOcL8