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

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: Add temp point and fix braces. 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') | no next file with comments »
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..863fa1b5e16d41c2a6fbbceb807823ed8af87af8 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;
@@ -29,6 +30,7 @@ public class DeviceDisplayInfo {
private final Context mAppContext;
private final WindowManager mWinManager;
+ private Point mTempPoint = new Point();
private DeviceDisplayInfo(Context context) {
mAppContext = context.getApplicationContext();
@@ -51,6 +53,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;
+ }
+ getDisplay().getRealSize(mTempPoint);
+ return mTempPoint.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;
+ }
+ getDisplay().getRealSize(mTempPoint);
+ return mTempPoint.x;
+ }
+
@SuppressWarnings("deprecation")
private int getPixelFormat() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
@@ -141,8 +167,10 @@ public class DeviceDisplayInfo {
}
private void updateNativeSharedDisplayInfo() {
- nativeUpdateSharedDeviceDisplayInfo(getDisplayHeight(),
- getDisplayWidth(), getBitsPerPixel(), getBitsPerComponent(),
+ nativeUpdateSharedDeviceDisplayInfo(
+ getDisplayHeight(), getDisplayWidth(),
+ getPhysicalDisplayHeight(), getPhysicalDisplayWidth(),
+ getBitsPerPixel(), getBitsPerComponent(),
getDIPScale(), getSmallestDIPWidth());
}
@@ -171,9 +199,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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698