I have 2 apps let's say A and B. App A has activity x and app B has activity 1,2. In app B activity 1 is launcher activity with no flags and activity 2 is singleTask also Activity 1 starts activity 2(for result) with no flags. In app A there is a button in activity x which starts app B's activity 1 with new_task_flag.
My question is when I tap on button then I have 2 tasks i.e x and 1->2, on pressing hardware home button and launching app B then what will be the behaviour of these task. From my understanding task 1->2 should come in foreground but I see multiple instances of activity 2 stacked on task. What am I missing here ?
I have gone through several stackoverflow posts like Android task and process, SingleTask and SingleInstance (David's elaborate answer) and google docs but unable to figure out problem here.