Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(619)

Unified Diff: ui/android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java

Issue 93933016: Android: Add support for returning real screen resolution. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/gfx/android/device_display_info.h » ('j') | ui/gfx/android/shared_device_display_info.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « no previous file | ui/gfx/android/device_display_info.h » ('j') | ui/gfx/android/shared_device_display_info.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698