Fix Race in ScreenshotController

TakeScreenshotExecutor was creating the ScreenshotController by passing the displayId. However, if the display was disconnected before ScreenshotController was fully initialized, it ended up crashing (exactly when creating the display context).

Now, ScreenshotController is not created unless we have a not-null display in TakescreenshotExecutor.

Test: TakeScreenshotExecutorTest
Flag: None
Fixes: 329147174
Merged-In: I0c7c9ec4e7d3dfc8896bd325bd250d372a6c0891
Change-Id: Ib5dbf463a89342f1f61e0d84f4031d7c72f2b87d
6 files changed