From 4b51b3232a12cd281eca9662b1085b8f02d7accb Mon Sep 17 00:00:00 2001 From: Bryce Lee Date: Fri, 7 Apr 2017 10:27:19 -0700 Subject: [PATCH] Update decor LayoutParams when window is already added. These values can change for themes that are dependent on the size, such as the DialogWhenLarge theme. In this case, different layouts are loaded that could depend on updated LayoutParams. This CL identifies the case when the layoutparams change and informs the activity. Change-Id: Icde8d94cc089ca0c02a15120a860533ef540c850 Fixes: 31643268 Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test CtsServicesHostTestCases android.server.cts.ActivityManagerAppConfigurationTests#testDialogWhenLargeSplitSmall --- core/java/android/app/ActivityThread.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 7299d6bd0ed74..182982a638f1f 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -3727,9 +3727,17 @@ public final class ActivityThread { impl.notifyChildRebuilt(); } } - if (a.mVisibleFromClient && !a.mWindowAdded) { - a.mWindowAdded = true; - wm.addView(decor, l); + if (a.mVisibleFromClient) { + if (!a.mWindowAdded) { + a.mWindowAdded = true; + wm.addView(decor, l); + } else { + // The activity will get a callback for this {@link LayoutParams} change + // earlier. However, at that time the decor will not be set (this is set + // in this method), so no action will be taken. This call ensures the + // callback occurs with the decor set. + a.onWindowAttributesChanged(l); + } } // If the window has already been added, but during resume @@ -3769,6 +3777,7 @@ public final class ActivityThread { wm.updateViewLayout(decor, l); } } + r.activity.mVisibleFromServer = true; mNumVisibleActivities++; if (r.activity.mVisibleFromClient) {