From 8ce4e12c73837bda319c56f8b9e36cf310caf85e Mon Sep 17 00:00:00 2001 From: Adam Lesinski Date: Mon, 2 May 2016 16:09:16 -0700 Subject: Fix issue where existing Activity Resources references would not update When relaunching an Activity, the DecorView and ViewRootImpl is re-used, along with the IBinder activity token. This means that when we create new resources, we end up just updating the base Activity resources. However, we would set the configuration to the new requested override config and then proceed to update existing Resources references, which would return immediately due to the equality check for configuration updates. This change pushes the setting of the new override config to the updateResourcesForActivity method, which will properly update Resources references that are held in the re-used DecorView. Bug:27915587 Change-Id: I113007a40fa464b8a234b073dcf851e16fee0177 --- core/java/android/app/ResourcesManager.java | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/core/java/android/app/ResourcesManager.java b/core/java/android/app/ResourcesManager.java index d8a3d4f3fa07..f41117858598 100644 --- a/core/java/android/app/ResourcesManager.java +++ b/core/java/android/app/ResourcesManager.java @@ -451,15 +451,8 @@ public class ResourcesManager { } synchronized (this) { - final ActivityResources activityResources = - getOrCreateActivityResourcesStructLocked( - activityToken); - - if (overrideConfig != null) { - activityResources.overrideConfig.setTo(overrideConfig); - } else { - activityResources.overrideConfig.setToDefaults(); - } + // Force the creation of an ActivityResourcesStruct. + getOrCreateActivityResourcesStructLocked(activityToken); } // Update any existing Activity Resources references. -- cgit v1.2.3-59-g8ed1b