[ActivityManager] Set appropriate relation of task to home

All below cases should return to home but the top will be Settings.
The initial steps are
1.Launch Settings from home
2.Press home key
3.Launch activity A in task X from home

Case 1
4.A starts activity B in task Y and calls moveTaskToBack

Case 2
4.A starts activity B in task X and calls moveTaskToBack
5.B calls finish

Case 3
4.A launches activity B in task Y
5.B launches A with NEW_TASK (bring existed task)
6.A calls finish return to B
7.B calls finish

Case 4
4.A launches activity B in task X
5.B launches C in task X
6.C launches A with flag NEW_TASK and CLEAR_TOP
7.A calls finish

Solution:
Transfer return-to to next adjacent task.

Change-Id: Icdad980eec64e081d15679600da07cf4431e40d6
1 file changed