Rebase ThemeImpl rather than reallocate memory
Memory churn is high when swapping the ResourcesImpl of a Resources object. Each time Resources#setImpl is invoked, all themes based on that Resources object are assigned new ThemeImpl objects that are created using the new ResourcesImpl. ThemeImpls can only belong to one Theme object, so the old implementation is discarded and the theme takes ownership of the new ThemeImp. This creates performance problems when framework overlays are toggled. Toggling overlays targeting the framework causes all themes across all processes to recreate and reallocate all of their themes. By rebasing the ThemeImpl on the new ResourcesImpl without deallocating the native theme memory, we reduce churn and produce less garbage that needs to be garbage collected. Bug: 141198925 Test: atest libandroidfw_tests Test: atest ResourcesPerfWorkloads Change-Id: I03fb31ee09c9cfdbd3c41bcf0b605607dab54ed7
Loading
Please register or sign in to comment