[RESTRICT AUTOMERGE]Don't finish noHistory activity while it is on the topmost.

There was no top running activity in the target task result in the
NPE.

The CL makes sure the top running noHistory activity is not finished
when launched again and have protection for getTopNonFinishingActivity.

Bug: 159507052
Test: atest testNoHistoryActivityNotFinished
Change-Id: Id582f28d79bec052115e07d98c097c7d50c11609
(cherry picked from commit 59a51c6ba9219835d0419b5e5b2cde80bd695b4b)
2 files changed