unhide getDisplaySizeDp, also make it return real size

getDisplaySizeDp used to return the display size available to
apps, which could be the real size minus any system decorations
like status bar. This caused some metrics to change when device
is in different orientations. Since the purpose of the API is
to determine the screen size class, we now return metrics based
on real display sizes.

Change-Id: I820f8321df941650e401adc1435e0da5a27addf8
diff --git a/uiautomator/api/current.txt b/uiautomator/api/current.txt
index a1d80c4..fc11007 100644
--- a/uiautomator/api/current.txt
+++ b/uiautomator/api/current.txt
@@ -17,6 +17,7 @@
     method public java.lang.String getCurrentPackageName();
     method public int getDisplayHeight();
     method public int getDisplayRotation();
+    method public android.graphics.Point getDisplaySizeDp();
     method public int getDisplayWidth();
     method public static com.android.uiautomator.core.UiDevice getInstance();
     method public java.lang.String getLastTraversedText();
diff --git a/uiautomator/library/src/com/android/uiautomator/core/UiDevice.java b/uiautomator/library/src/com/android/uiautomator/core/UiDevice.java
index b668bea..b74aec1 100644
--- a/uiautomator/library/src/com/android/uiautomator/core/UiDevice.java
+++ b/uiautomator/library/src/com/android/uiautomator/core/UiDevice.java
@@ -27,7 +27,6 @@
 import android.os.RemoteException;
 import android.os.ServiceManager;
 import android.os.SystemClock;
-import android.os.Trace;
 import android.util.DisplayMetrics;
 import android.util.Log;
 import android.view.Display;
@@ -107,18 +106,18 @@
     /**
      * Returns the display size in dp (device-independent pixel)
      *
-     * The returned display size is adjusted per screen rotation
+     * The returned display size is adjusted per screen rotation. Also this will return the actual
+     * size of the screen, rather than adjusted per system decorations (like status bar).
      *
      * @return a Point containing the display size in dp
-     * @hide
      */
     public Point getDisplaySizeDp() {
         Tracer.trace();
         Display display = getDefaultDisplay();
         Point p = new Point();
-        display.getSize(p);
+        display.getRealSize(p);
         DisplayMetrics metrics = new DisplayMetrics();
-        display.getMetrics(metrics);
+        display.getRealMetrics(metrics);
         float dpx = p.x / metrics.density;
         float dpy = p.y / metrics.density;
         p.x = Math.round(dpx);