am 97dcc20e: Merge "Deprecate useless BitmapDrawable constructor Bug #2590549"
# Via Android (Google) Code Review (1) and Romain Guy (1)
* commit '97dcc20e6d6fcce712ab1101bfe03c74aa2b6682':
Deprecate useless BitmapDrawable constructor Bug #2590549
diff --git a/api/current.txt b/api/current.txt
index caa3e0c..c8f999f 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -9376,7 +9376,7 @@
public class BitmapDrawable extends android.graphics.drawable.Drawable {
ctor public deprecated BitmapDrawable();
- ctor public BitmapDrawable(android.content.res.Resources);
+ ctor public deprecated BitmapDrawable(android.content.res.Resources);
ctor public deprecated BitmapDrawable(android.graphics.Bitmap);
ctor public BitmapDrawable(android.content.res.Resources, android.graphics.Bitmap);
ctor public deprecated BitmapDrawable(java.lang.String);
diff --git a/graphics/java/android/graphics/drawable/BitmapDrawable.java b/graphics/java/android/graphics/drawable/BitmapDrawable.java
index 6e41d34..675c4b6 100644
--- a/graphics/java/android/graphics/drawable/BitmapDrawable.java
+++ b/graphics/java/android/graphics/drawable/BitmapDrawable.java
@@ -74,8 +74,8 @@
/**
* Create an empty drawable, not dealing with density.
- * @deprecated Use {@link #BitmapDrawable(Resources)} to ensure
- * that the drawable has correctly set its target density.
+ * @deprecated Use {@link #BitmapDrawable(android.content.res.Resources, android.graphics.Bitmap)}
+ * instead to specify a bitmap to draw with and ensure the correct density is set.
*/
@Deprecated
public BitmapDrawable() {
@@ -85,7 +85,10 @@
/**
* Create an empty drawable, setting initial target density based on
* the display metrics of the resources.
+ * @deprecated Use {@link #BitmapDrawable(android.content.res.Resources, android.graphics.Bitmap)}
+ * instead to specify a bitmap to draw with.
*/
+ @Deprecated
@SuppressWarnings({"UnusedParameters"})
public BitmapDrawable(Resources res) {
mBitmapState = new BitmapState((Bitmap) null);
diff --git a/graphics/java/android/graphics/drawable/Drawable.java b/graphics/java/android/graphics/drawable/Drawable.java
index 54d1bf5..37f2250 100644
--- a/graphics/java/android/graphics/drawable/Drawable.java
+++ b/graphics/java/android/graphics/drawable/Drawable.java
@@ -868,6 +868,7 @@
} else if (name.equals("inset")) {
drawable = new InsetDrawable();
} else if (name.equals("bitmap")) {
+ //noinspection deprecation
drawable = new BitmapDrawable(r);
if (r != null) {
((BitmapDrawable) drawable).setTargetDensity(r.getDisplayMetrics());