Pass configuration changes to all pages

In PagedTileLayout, all pages are inflated previously and the view pager
only attaches/dettaches pages. However, configuration changes are only
dispatched to direct children of the view. This change makes it so that
non-attached pages are also notified.

In particular, fontWeightAdjustment was not being passed, and it's not
one of the changes that causes fragments in SystemUI to be reinflated.

Test: manual
Fixes: 200882432
Change-Id: Ie2bd0eccf1d1e71f364501612bb6e6be8aa29bc9
This commit is contained in:
Fabian Kozynski
2021-10-29 13:47:58 -04:00
parent a9efae988e
commit c43d136ef8

View File

@@ -112,6 +112,16 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
@Override
protected void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
// Pass configuration change to non-attached pages as well. Some config changes will cause
// QS to recreate itself (as determined in FragmentHostManager), but in order to minimize
// those, make sure that all get passed to all pages.
int numPages = mPages.size();
for (int i = 0; i < numPages; i++) {
View page = mPages.get(i);
if (page.getParent() == null) {
page.dispatchConfigurationChanged(newConfig);
}
}
if (mLayoutOrientation != newConfig.orientation) {
mLayoutOrientation = newConfig.orientation;
mDistributeTiles = true;