summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorTom Marshall <tdm.code@gmail.com>2013-11-21 19:03:26 +0000
committerSteve Kondik <steve@cyngn.com>2015-10-26 21:55:37 -0700
commitd1e82836e05fd35e4627f97bd06419e8f50b00b7 (patch)
treeb575ceffb64d10e65b9d7c5ae1b3080d3f927682 /graphics
parent4f0ec345abdbc360fa7d4836ddaf3c22e5835be6 (diff)
downloadframeworks_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.java10
-rw-r--r--graphics/java/android/graphics/drawable/Drawable.java2
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();