Do not trim tasks when updating activity visibilities

When updating visibility of all activities, the state of activity
may be changed to resumed, and it will also be added to recents
task. If the max amount of task is reached, the inactive tasks will
be trimmed. So it is possible that the index of visibility-update
loop becomes out of bounds.

Though it can also be solved by checking the index every time, that
seems to be a bit unintuitive and waste. And skip trimming should
also reduce the side effect of visibility-update to focus on its
major functionality.

Fixes: 154809437
Fixes: 142627724
Test: RecentTasksTest#testAddTasksInVisibilityUpdate_expectNoTrim

Change-Id: Iba66f2e6ce0beae3ef1187549318ef8779154a3b
6 files changed