Allow for screen density drawables in compatibility mode.

This change allows us to use drawables that match the current screen
density even when being loaded in compatibility mode.  In this case,
the bitmap is loaded in the screen density, and the bitmap and
nine-patch drawables take care of accounting for the density difference.

This should be safe for existing applications, for the most part, since
they shouldn't really be pulling the bitmap out of the drawable.  For
the small rare chance of them breaking, it worth getting the correct
graphics.  Also this will only happen when there is actually a resource
of the matching density, and no existing apps should have resources for
anything besides the default density (though of course all of the
framework resources will be available in the native density).

As part of this, the bitmap density API has been changed to a single
integer provider the DPI unit density.
diff --git a/core/java/android/view/ViewRoot.java b/core/java/android/view/ViewRoot.java
index bb61ad3..b6119aa 100644
--- a/core/java/android/view/ViewRoot.java
+++ b/core/java/android/view/ViewRoot.java
@@ -187,7 +187,7 @@
      */
     AudioManager mAudioManager;
 
-    private final float mDensity;
+    private final int mDensity;
 
     public ViewRoot(Context context) {
         super();
@@ -229,7 +229,7 @@
         mAdded = false;
         mAttachInfo = new View.AttachInfo(sWindowSession, mWindow, this, this);
         mViewConfiguration = ViewConfiguration.get(context);
-        mDensity = context.getResources().getDisplayMetrics().density;
+        mDensity = context.getResources().getDisplayMetrics().densityDpi;
     }
 
     @Override
@@ -1270,7 +1270,7 @@
             }
 
             // TODO: Do this in native
-            canvas.setDensityScale(mDensity);
+            canvas.setDensity(mDensity);
         } catch (Surface.OutOfResourcesException e) {
             Log.e("ViewRoot", "OutOfResourcesException locking surface", e);
             // TODO: we should ask the window manager to do something!