Merge "Avoid 60ms QS inflations on UI thread after density changes" into udc-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
72ac76b7a9
@@ -28,11 +28,11 @@ import android.content.res.Resources;
|
|||||||
public class InterestingConfigChanges {
|
public class InterestingConfigChanges {
|
||||||
private final Configuration mLastConfiguration = new Configuration();
|
private final Configuration mLastConfiguration = new Configuration();
|
||||||
private final int mFlags;
|
private final int mFlags;
|
||||||
private int mLastDensity;
|
|
||||||
|
|
||||||
public InterestingConfigChanges() {
|
public InterestingConfigChanges() {
|
||||||
this(ActivityInfo.CONFIG_LOCALE | ActivityInfo.CONFIG_LAYOUT_DIRECTION
|
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) {
|
public InterestingConfigChanges(int flags) {
|
||||||
@@ -50,11 +50,6 @@ public class InterestingConfigChanges {
|
|||||||
public boolean applyNewConfig(Resources res) {
|
public boolean applyNewConfig(Resources res) {
|
||||||
int configChanges = mLastConfiguration.updateFrom(
|
int configChanges = mLastConfiguration.updateFrom(
|
||||||
Configuration.generateDelta(mLastConfiguration, res.getConfiguration()));
|
Configuration.generateDelta(mLastConfiguration, res.getConfiguration()));
|
||||||
boolean densityChanged = mLastDensity != res.getDisplayMetrics().densityDpi;
|
return (configChanges & (mFlags)) != 0;
|
||||||
if (densityChanged || (configChanges & (mFlags)) != 0) {
|
|
||||||
mLastDensity = res.getDisplayMetrics().densityDpi;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user