Index: ui/android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java |
diff --git a/ui/android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java b/ui/android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java |
index 188c405c7c28cc1169e0b2640293632ccd3e82c4..f0bbdd641fd49c201a4fef24effe9afa40d2c48b 100644 |
--- a/ui/android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java |
+++ b/ui/android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java |
@@ -8,6 +8,7 @@ import android.content.ComponentCallbacks; |
import android.content.Context; |
import android.content.res.Configuration; |
import android.graphics.PixelFormat; |
+import android.graphics.Point; |
import android.os.Build; |
import android.util.DisplayMetrics; |
import android.view.Display; |
@@ -51,6 +52,30 @@ public class DeviceDisplayInfo { |
return getMetrics().widthPixels; |
} |
+ /** |
+ * @return Real physical display height in physical pixels. |
+ */ |
+ @CalledByNative |
+ public int getPhysicalDisplayHeight() { |
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) |
+ return 0; |
Ted C
2014/01/08 21:43:23
braces are required in java always (unless the sta
epenner
2014/01/08 22:32:18
Done.
|
+ Point size = new Point(); |
Ted C
2014/01/08 21:43:23
How often is this called?
If it gets called very
epenner
2014/01/08 22:32:18
Ooh, good one. It's not called often now, but did
|
+ getDisplay().getRealSize(size); |
+ return size.y; |
+ } |
+ |
+ /** |
+ * @return Real physical display width in physical pixels. |
+ */ |
+ @CalledByNative |
+ public int getPhysicalDisplayWidth() { |
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) |
+ return 0; |
+ Point size = new Point(); |
+ getDisplay().getRealSize(size); |
+ return size.x; |
+ } |
+ |
@SuppressWarnings("deprecation") |
private int getPixelFormat() { |
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) { |
@@ -141,8 +166,10 @@ public class DeviceDisplayInfo { |
} |
private void updateNativeSharedDisplayInfo() { |
- nativeUpdateSharedDeviceDisplayInfo(getDisplayHeight(), |
- getDisplayWidth(), getBitsPerPixel(), getBitsPerComponent(), |
+ nativeUpdateSharedDeviceDisplayInfo( |
+ getDisplayHeight(), getDisplayWidth(), |
+ getPhysicalDisplayHeight(), getPhysicalDisplayWidth(), |
+ getBitsPerPixel(), getBitsPerComponent(), |
getDIPScale(), getSmallestDIPWidth()); |
} |
@@ -171,9 +198,10 @@ public class DeviceDisplayInfo { |
return deviceDisplayInfo; |
} |
- private native void nativeUpdateSharedDeviceDisplayInfo(int displayHeight, |
- int displayWidth, int bitsPerPixel, |
- int bitsPerComponent, double dipScale, |
+ private native void nativeUpdateSharedDeviceDisplayInfo( |
+ int displayHeight, int displayWidth, |
+ int physicalDisplayHeight, int physicalDisplayWidth, |
+ int bitsPerPixel, int bitsPerComponent, double dipScale, |
int smallestDIPWidth); |
} |