Add DENSITY_DEVICE_STABLE constant

The existing DENSITY_DEVICE gets updated by ActivityThread following
configuration changes that affect density, so just a docs update there.

Bug: 26854123
Change-Id: I69dfca99a6038ed9cf8b2f2c007cdbc4a399dd8a
diff --git a/api/current.txt b/api/current.txt
index 537ae8a..c2b0f22 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -39885,6 +39885,7 @@
     field public static final int DENSITY_420 = 420; // 0x1a4
     field public static final int DENSITY_560 = 560; // 0x230
     field public static final int DENSITY_DEFAULT = 160; // 0xa0
+    field public static final int DENSITY_DEVICE_STABLE;
     field public static final int DENSITY_HIGH = 240; // 0xf0
     field public static final int DENSITY_LOW = 120; // 0x78
     field public static final int DENSITY_MEDIUM = 160; // 0xa0
diff --git a/api/system-current.txt b/api/system-current.txt
index 1091ff1..7a79aa5 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -42302,6 +42302,7 @@
     field public static final int DENSITY_420 = 420; // 0x1a4
     field public static final int DENSITY_560 = 560; // 0x230
     field public static final int DENSITY_DEFAULT = 160; // 0xa0
+    field public static final int DENSITY_DEVICE_STABLE;
     field public static final int DENSITY_HIGH = 240; // 0xf0
     field public static final int DENSITY_LOW = 120; // 0x78
     field public static final int DENSITY_MEDIUM = 160; // 0xa0
diff --git a/api/test-current.txt b/api/test-current.txt
index 09a9cca..a49d0f3 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -39902,6 +39902,7 @@
     field public static final int DENSITY_420 = 420; // 0x1a4
     field public static final int DENSITY_560 = 560; // 0x230
     field public static final int DENSITY_DEFAULT = 160; // 0xa0
+    field public static final int DENSITY_DEVICE_STABLE;
     field public static final int DENSITY_HIGH = 240; // 0xf0
     field public static final int DENSITY_LOW = 120; // 0x78
     field public static final int DENSITY_MEDIUM = 160; // 0xa0
diff --git a/core/java/android/util/DisplayMetrics.java b/core/java/android/util/DisplayMetrics.java
index 9a69600..a747f16 100644
--- a/core/java/android/util/DisplayMetrics.java
+++ b/core/java/android/util/DisplayMetrics.java
@@ -131,16 +131,29 @@
     public static final float DENSITY_DEFAULT_SCALE = 1.0f / DENSITY_DEFAULT;
 
     /**
-     * The device's density.
-     * @hide because eventually this should be able to change while
-     * running, so shouldn't be a constant.
-     * @deprecated There is no longer a static density; you can find the
-     * density for a display in {@link #densityDpi}.
+     * The device's current density.
+     * <p>
+     * This value reflects any changes made to the device density. To obtain
+     * the device's stable density, use {@link #DENSITY_DEVICE_STABLE}.
+     *
+     * @hide This value should not be used.
+     * @deprecated Use {@link #DENSITY_DEVICE_STABLE} to obtain the stable
+     *             device density or {@link #densityDpi} to obtain the current
+     *             density for a specific display.
      */
     @Deprecated
     public static int DENSITY_DEVICE = getDeviceDensity();
 
     /**
+     * The device's stable density.
+     * <p>
+     * This value is constant at run time and may not reflect the current
+     * display density. To obtain the current density for a specific display,
+     * use {@link #densityDpi}.
+     */
+    public static final int DENSITY_DEVICE_STABLE = getDeviceDensity();
+
+    /**
      * The absolute width of the display in pixels.
      */
     public int widthPixels;