Make an exception for screenshot optimization.

Screenshots were not being made for tasks with the flag
FLAG_EXCLUDE_FROM_RECENTS set. But if the task is in the foreground
the shot should be taken even with the flag set. This fix adds a test
for tasks being in the foreground.

Fixes bug 11170567.

Change-Id: If42db7f43ed1dd8d2b16b68824adc813b31c94f0
2 files changed