Null checking window before starting dream

With window being null we get null exception when trying to get attributes to properly start dream

Test: atest DreamServiceTest
Bug: b/271179864
Change-Id: I3136b620383a0c609a8260cc7b0e9b7f6e6422c1
This commit is contained in:
Prince
2023-03-06 15:20:52 +00:00
committed by Prince Donkor
parent 19f6c52f6f
commit 0993fbd81c

View File

@@ -1409,6 +1409,10 @@ public class DreamService extends Service implements Window.Callback {
// Request the DreamOverlay be told to dream with dream's window
// parameters once the window has been attached.
mDreamStartOverlayConsumer = overlay -> {
if (mWindow == null) {
Slog.d(TAG, "mWindow is null");
return;
}
try {
overlay.startDream(mWindow.getAttributes(), mOverlayCallback,
mDreamComponent.flattenToString(),