Check if recents exists before trying to relz to it

In some situations (SUW) recents doesn't exist at the time of the
gesture. In these situations, don't try to reference it.

Bug: 205062356
Test: Dismiss AllSetActivity via swipe-up in SUW, observe no crash
Change-Id: I3f1bfd04cfa4874475cd6d033376f24cb5b192a7
This commit is contained in:
Evan Rosky
2021-11-10 14:02:08 -08:00
parent 5d39efecbd
commit dc3ef62960

View File

@@ -497,12 +497,16 @@ final class InputMonitor {
resetInputConsumers(mInputTransaction);
// Update recents input consumer layer if active
if (mAddRecentsAnimationInputConsumerHandle
&& getWeak(mActiveRecentsActivity) != null) {
final WindowContainer layer = getWeak(mActiveRecentsLayerRef);
mRecentsAnimationInputConsumer.show(mInputTransaction,
layer != null ? layer : getWeak(mActiveRecentsActivity));
mAddRecentsAnimationInputConsumerHandle = false;
final ActivityRecord activeRecents = getWeak(mActiveRecentsActivity);
if (mAddRecentsAnimationInputConsumerHandle && activeRecents != null
&& activeRecents.getSurfaceControl() != null) {
WindowContainer layer = getWeak(mActiveRecentsLayerRef);
layer = layer != null ? layer : activeRecents;
// Handle edge-case for SUW where windows don't exist yet
if (layer.getSurfaceControl() != null) {
mRecentsAnimationInputConsumer.show(mInputTransaction, layer);
mAddRecentsAnimationInputConsumerHandle = false;
}
}
mDisplayContent.forAllWindows(this, true /* traverseTopToBottom */);
updateInputFocusRequest(mRecentsAnimationInputConsumer);