diff options
author | Tom Marshall <tdm.code@gmail.com> | 2013-11-21 19:03:26 +0000 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-10-26 21:55:37 -0700 |
commit | d1e82836e05fd35e4627f97bd06419e8f50b00b7 (patch) | |
tree | b575ceffb64d10e65b9d7c5ae1b3080d3f927682 /graphics | |
parent | 4f0ec345abdbc360fa7d4836ddaf3c22e5835be6 (diff) | |
download | frameworks_base-d1e82836e05fd35e4627f97bd06419e8f50b00b7.zip frameworks_base-d1e82836e05fd35e4627f97bd06419e8f50b00b7.tar.gz frameworks_base-d1e82836e05fd35e4627f97bd06419e8f50b00b7.tar.bz2 |
Allow custom density setting
Use system property persist.sys.lcd_density to set custom density. The
custom setting affects the entire UI. It is independent of
ro.sf.lcd_density and has no effect on play store compatibility.
Code distilled from PA project via PAC project.
Change-Id: I8d26405d5d33bdf2890a0e9f67f113a4dc3e763b
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/java/android/graphics/Bitmap.java | 10 | ||||
-rw-r--r-- | graphics/java/android/graphics/drawable/Drawable.java | 2 |
2 files changed, 3 insertions, 9 deletions
diff --git a/graphics/java/android/graphics/Bitmap.java b/graphics/java/android/graphics/Bitmap.java index 3e4d93b..3279185 100644 --- a/graphics/java/android/graphics/Bitmap.java +++ b/graphics/java/android/graphics/Bitmap.java @@ -80,24 +80,18 @@ public final class Bitmap implements Parcelable { private static volatile Matrix sScaleMatrix; - private static volatile int sDefaultDensity = -1; - /** * For backwards compatibility, allows the app layer to change the default * density when running old apps. * @hide */ public static void setDefaultDensity(int density) { - sDefaultDensity = density; + // Ignore } @SuppressWarnings("deprecation") static int getDefaultDensity() { - if (sDefaultDensity >= 0) { - return sDefaultDensity; - } - sDefaultDensity = DisplayMetrics.DENSITY_DEVICE; - return sDefaultDensity; + return DisplayMetrics.getDeviceDensity(); } /** diff --git a/graphics/java/android/graphics/drawable/Drawable.java b/graphics/java/android/graphics/drawable/Drawable.java index 32af59a..7bd445f 100644 --- a/graphics/java/android/graphics/drawable/Drawable.java +++ b/graphics/java/android/graphics/drawable/Drawable.java @@ -1076,7 +1076,7 @@ public abstract class Drawable { // drawn to the screen. if (opts == null) opts = new BitmapFactory.Options(); opts.inScreenDensity = res != null - ? res.getDisplayMetrics().noncompatDensityDpi : DisplayMetrics.DENSITY_DEVICE; + ? res.getDisplayMetrics().noncompatDensityDpi : DisplayMetrics.getDeviceDensity(); Bitmap bm = BitmapFactory.decodeResourceStream(res, value, is, pad, opts); if (bm != null) { byte[] np = bm.getNinePatchChunk(); |