Merge "Avoid 60ms QS inflations on UI thread after density changes" into udc-qpr-dev

This commit is contained in:
TreeHugger Robot
2023-06-26 15:05:04 +00:00
committed by Android (Google) Code Review

View File

@@ -28,11 +28,11 @@ import android.content.res.Resources;
public class InterestingConfigChanges {
private final Configuration mLastConfiguration = new Configuration();
private final int mFlags;
private int mLastDensity;
public InterestingConfigChanges() {
this(ActivityInfo.CONFIG_LOCALE | ActivityInfo.CONFIG_LAYOUT_DIRECTION
| ActivityInfo.CONFIG_UI_MODE | ActivityInfo.CONFIG_ASSETS_PATHS);
| ActivityInfo.CONFIG_UI_MODE | ActivityInfo.CONFIG_ASSETS_PATHS
| ActivityInfo.CONFIG_DENSITY);
}
public InterestingConfigChanges(int flags) {
@@ -50,11 +50,6 @@ public class InterestingConfigChanges {
public boolean applyNewConfig(Resources res) {
int configChanges = mLastConfiguration.updateFrom(
Configuration.generateDelta(mLastConfiguration, res.getConfiguration()));
boolean densityChanged = mLastDensity != res.getDisplayMetrics().densityDpi;
if (densityChanged || (configChanges & (mFlags)) != 0) {
mLastDensity = res.getDisplayMetrics().densityDpi;
return true;
}
return false;
return (configChanges & (mFlags)) != 0;
}
}