From dde331cebd87982faded6818ad5f9927ff994c96 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Fri, 3 Aug 2012 14:01:57 -0700 Subject: We can now (kind-of) change screen density on the fly. Preloaded drawables now have a density associated with them, so we can load the correct drawable if we are using a different density. Window manager now formally keeps track of the density for each screen, allowing it to be overridden like you can already do with size, and relies on this density to drive itself internally and the configurations it reports. There are a new set of Bitmap constructors where you provide a DisplayMetrics so they can be constructed with the correct density. (This will be for when you can have different windows in the same app running at different densities.) ActivityThread now watches for density changes, and pushes them to the DENSITY_DEVICE and Bitmap global density values for that process. A new am command allows you to change the density. --- core/java/android/view/ViewDebug.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'core/java/android/view/ViewDebug.java') diff --git a/core/java/android/view/ViewDebug.java b/core/java/android/view/ViewDebug.java index 00d4fc76a219..dae9265ab1fb 100644 --- a/core/java/android/view/ViewDebug.java +++ b/core/java/android/view/ViewDebug.java @@ -546,7 +546,7 @@ public class ViewDebug { (view != null && view.getResources() != null) ? view.getResources().getDisplayMetrics() : null; final Bitmap bitmap = metrics != null ? - Bitmap.createBitmap(metrics.widthPixels, + Bitmap.createBitmap(metrics, metrics.widthPixels, metrics.heightPixels, Bitmap.Config.RGB_565) : null; final Canvas canvas = bitmap != null ? new Canvas(bitmap) : null; return new Object[] { @@ -706,7 +706,8 @@ public class ViewDebug { Log.w("View", "Failed to create capture bitmap!"); // Send an empty one so that it doesn't get stuck waiting for // something. - b = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); + b = Bitmap.createBitmap(root.getResources().getDisplayMetrics(), + 1, 1, Bitmap.Config.ARGB_8888); } BufferedOutputStream out = null; -- cgit v1.2.3