Fix crash when initiating split with 5 instances of Chrome in Desktop Windowing

When opening 5 instances of Chrome in Desktop Windowing, navigating back to Overview and trying to split a new Chrome instance from the Taskbar resulted in a crash.

This happened because SplitSelectStateController searches for the last active task of the app chosen to be in split. Then, it returns its taskId that is used in RecentsView to find the TaskView to be animated to split.

However, after the 5th Chrome instance in opened in Desktop Windowing, the last active taskId is no longer visible in Overview or Desktop Windowing. Then, RecentsView won't find any TaskView with that taskId and mSplitHiddenTaskView will be null. This will result in a crash because we have some if-else conditions assuming that is not null because of mSplitSelectStateController has a task to be dismissed during the split animation.

More info in the bug report.

Bug: 372400577
Flag: EXEMPT bugfix
Test: Manual. Steps in the bug report.
Test: Manual. Open 5 windows of Chrome in Desktop Windowing. Go Home. Open a Fullscreen App. Go Overview. Split a new Chrome instance from the Taskbar.
Change-Id: I0f3757e898b606b4e0a180f43c73f1e2d887e996
1 file changed