From 8b73d86492c3bcd2fbca6545b89c159ace637b72 Mon Sep 17 00:00:00 2001 From: An An Yu Date: Wed, 12 Oct 2022 14:54:12 -0700 Subject: [PATCH] Upon double registration just return instead of throwing exception Bug: 204073440 Test: manual Change-Id: I019f3a63a12d64f3e8cb7059fa8ac237ec8dd09b --- .../window/extensions/layout/WindowLayoutComponentImpl.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libs/WindowManager/Jetpack/src/androidx/window/extensions/layout/WindowLayoutComponentImpl.java b/libs/WindowManager/Jetpack/src/androidx/window/extensions/layout/WindowLayoutComponentImpl.java index 0fb6ff878451c..b516e1407b11b 100644 --- a/libs/WindowManager/Jetpack/src/androidx/window/extensions/layout/WindowLayoutComponentImpl.java +++ b/libs/WindowManager/Jetpack/src/androidx/window/extensions/layout/WindowLayoutComponentImpl.java @@ -117,9 +117,7 @@ public class WindowLayoutComponentImpl implements WindowLayoutComponent { if (mWindowLayoutChangeListeners.containsKey(context) // In theory this method can be called on the same consumer with different context. || mWindowLayoutChangeListeners.containsValue(consumer)) { - throw new IllegalArgumentException( - "Context or Consumer has already been registered for WindowLayoutInfo" - + " callback."); + return; } if (!context.isUiContext()) { throw new IllegalArgumentException("Context must be a UI Context, which should be"