From ec05bc0fda9e10fe16cb98c5d3a4de37773ad5f8 Mon Sep 17 00:00:00 2001 From: Adam Lesinski Date: Tue, 18 Apr 2017 14:42:22 -0700 Subject: [PATCH] Fix issue with fontScale changes not taking effect If a configuration change occurs, and an underlying ResourcesImpl is swapped out under a Resources object, the DisplayMetrics cached by TypedArray will be stale and not up-to-date. Bug: 34120637 Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test CtsServicesHostTestCases android.server.cts.ActivityManagerConfigChangeTests Change-Id: Id78a6d259250950387c2e95c4a2292fdd095c7af --- core/java/android/content/res/TypedArray.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/java/android/content/res/TypedArray.java b/core/java/android/content/res/TypedArray.java index f48afb55c58ae..88bb1a4ce3b98 100644 --- a/core/java/android/content/res/TypedArray.java +++ b/core/java/android/content/res/TypedArray.java @@ -56,12 +56,13 @@ public class TypedArray { // Reset the assets, which may have changed due to configuration changes // or further resource loading. attrs.mAssets = res.getAssets(); + attrs.mMetrics = res.getDisplayMetrics(); attrs.resize(len); return attrs; } private final Resources mResources; - private final DisplayMetrics mMetrics; + private DisplayMetrics mMetrics; private AssetManager mAssets; private boolean mRecycled;