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 863fa1b5e16d41c2a6fbbceb807823ed8af87af8..c154ea0b224ae684f7b41cd07bd2beae317199bd 100644 |
--- a/ui/android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java |
+++ b/ui/android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java |
@@ -31,6 +31,7 @@ public class DeviceDisplayInfo { |
private final Context mAppContext; |
private final WindowManager mWinManager; |
private Point mTempPoint = new Point(); |
+ private DisplayMetrics mTempMetrics = new DisplayMetrics(); |
private DeviceDisplayInfo(Context context) { |
mAppContext = context.getApplicationContext(); |
@@ -42,7 +43,8 @@ public class DeviceDisplayInfo { |
*/ |
@CalledByNative |
public int getDisplayHeight() { |
- return getMetrics().heightPixels; |
+ getDisplay().getSize(mTempPoint); |
+ return mTempPoint.y; |
} |
/** |
@@ -50,7 +52,8 @@ public class DeviceDisplayInfo { |
*/ |
@CalledByNative |
public int getDisplayWidth() { |
- return getMetrics().widthPixels; |
+ getDisplay().getSize(mTempPoint); |
+ return mTempPoint.x; |
} |
/** |
@@ -140,7 +143,8 @@ public class DeviceDisplayInfo { |
*/ |
@CalledByNative |
public double getDIPScale() { |
- return getMetrics().density; |
+ getDisplay().getMetrics(mTempMetrics); |
+ return mTempMetrics.density; |
} |
/** |
@@ -178,10 +182,6 @@ public class DeviceDisplayInfo { |
return mWinManager.getDefaultDisplay(); |
} |
- private DisplayMetrics getMetrics() { |
- return mAppContext.getResources().getDisplayMetrics(); |
- } |
- |
/** |
* Creates DeviceDisplayInfo for a given Context. |
* |