Make window mgr stack movement track activity mgr

There were situations where the activity manager ActivityStack was
moved to the front but the corresponding window manager TaskStack
was not. This caused the wrong activity to receive focus which led
to Application Not Responding errors.

One path in particular occurred in startActivityUncheckedLocked()
where curTop.task != intentActivity.task and
sourceStack.topActivity().task != sourceRecord.task. In this case
targetStack.moveTaskToFrontLocked() was never called.

This fix forces all calls to ActivityStack.moveToFront() to make
a call to WindowManagerService.moveTaskToTop() and eliminates
redundant calls to moveTaskToTop().

Fixes bug 17721767.

Change-Id: Ibf01389810dd36724eaec5a4a07560144b2f4cef
2 files changed