Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1dfc43a0 authored by Roman Birg's avatar Roman Birg Committed by Gerrit Code Review
Browse files

unbreak density scaling



- Only apply density scaling to built in screens so we don't affect
overlays.

- Only apply density scaling for activities which fall under the
  'default' compatibility bucket. Some apps may  have different
  compatibility info setup (e.g. scaling) and we do not
  need to apply the user density to this activity.

Change-Id: I0b4849141cf081694aae5668ae60764e70be7db1
Signed-off-by: default avatarRoman Birg <roman@cyngn.com>
parent d1689f3b
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1917,8 +1917,10 @@ public class Resources {
            if (mConfiguration.densityDpi != Configuration.DENSITY_DPI_UNDEFINED) {
                mMetrics.densityDpi = mConfiguration.densityDpi;
                mMetrics.density = mConfiguration.densityDpi * DisplayMetrics.DENSITY_DEFAULT_SCALE;
                if (mCompatibilityInfo.equals(CompatibilityInfo.DEFAULT_COMPATIBILITY_INFO)) {
                    mMetrics.updateDensity();
                }
            }
            mMetrics.scaledDensity = mMetrics.density * mConfiguration.fontScale;

            String locale = null;
+0 −1
Original line number Diff line number Diff line
@@ -254,7 +254,6 @@ public class DisplayMetrics {
        noncompatScaledDensity = o.noncompatScaledDensity;
        noncompatXdpi = o.noncompatXdpi;
        noncompatYdpi = o.noncompatYdpi;
        updateDensity();
    }
    
    public void setToDefaults() {
+2 −0
Original line number Diff line number Diff line
@@ -444,6 +444,8 @@ public final class DisplayInfo implements Parcelable {

        if (!compatInfo.equals(CompatibilityInfo.DEFAULT_COMPATIBILITY_INFO)) {
            compatInfo.applyToDisplayMetrics(outMetrics);
        } else if (type == Display.TYPE_BUILT_IN) {
            outMetrics.updateDensity();
        }
    }