Call dispatchConfigurationChanged if configuration changed

When updating the configuration within an existing render session,
exisiting views need to be informed of that change. This is done through
calling dispatchConfigurationChanged on the root view.

Flag: NONE host-only change
Bug: 405954650
Test: test updated
Change-Id: If55b2d1dc2b1f25e07618d46725af5446ff03f30
diff --git a/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java b/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java
index 5470a54..ad03988 100644
--- a/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java
+++ b/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java
@@ -101,6 +101,8 @@
 
     private final T mParams;
 
+    protected boolean mConfigurationUpdated;
+
     private BridgeContext mContext;
 
     private static final Object sContextLock = new Object();
@@ -187,6 +189,7 @@
     public void updateHardwareConfiguration(HardwareConfig hardwareConfig) {
         mParams.setHardwareConfig(hardwareConfig);
         mContext.getConfiguration().setTo(getConfiguration(mParams));
+        mConfigurationUpdated = true;
     }
 
     /**
diff --git a/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java b/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
index b805e33..ab2164e 100644
--- a/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
+++ b/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
@@ -483,6 +483,11 @@
                 return ERROR_NOT_INFLATED.createResult();
             }
 
+            if (mConfigurationUpdated) {
+                mViewRoot.dispatchConfigurationChanged(getContext().getConfiguration());
+                mConfigurationUpdated = false;
+            }
+
             measureLayout(params);
 
             float scaleX = 1.0f;
diff --git a/bridge/tests/res/testApp/MyApplication/golden/allwidgets_resized.png b/bridge/tests/res/testApp/MyApplication/golden/allwidgets_resized.png
index 7337711..28cc3da 100644
--- a/bridge/tests/res/testApp/MyApplication/golden/allwidgets_resized.png
+++ b/bridge/tests/res/testApp/MyApplication/golden/allwidgets_resized.png
Binary files differ