Add NEW_TASK flag to intent if metadata matches

This is a refactoring CL for the isNewTask() method. Before this CL we
check isNewTask() in different places. This CL tries to simplify the
logic by moving the check to where the intent is generated, so we don't have to
check the condition here and there.

Also did some minor refactoring.

Fixes: 216026158
Test: robotest
Change-Id: I3d8b4864e73fc49c83c46fc2d219b2b74c1ab5a4
3 files changed