Commit 33ea909e authored by Andrew Grieve's avatar Andrew Grieve Committed by Commit Bot

Android: Fix isTablet()-related occuring on some JB tablets

A better fix would be fix PhysicalDisplayAndroid.java, but given this is
fixed in JB MR1, I don't think it's worth the extra effort.

Bug: 829318
Change-Id: Ibe03c8392bf86b69322ff01f9ddf3c63396a161f
Reviewed-on: https://chromium-review.googlesource.com/1001707
Commit-Queue: agrieve <agrieve@chromium.org>
Reviewed-by: default avatarTheresa <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#549274}
parent d7080f06
......@@ -5,6 +5,7 @@
package org.chromium.ui.base;
import android.content.Context;
import android.os.Build;
import android.support.annotation.UiThread;
import org.chromium.base.ContextUtils;
......@@ -86,9 +87,12 @@ public class DeviceFormFactor {
}
private static int detectScreenWidthBucket(Context context) {
// TODO(agrieve): Remove runningOnUiThread() guard and audit for background thread usages.
// https://crbug.com/669974
if (ThreadUtils.runningOnUiThread()
// Pre-JB MR1, Display.getSize() is used rather than Display.getRealSize().
// For our query, getSize() is not always correct. https://crbug.com/829318
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1
// TODO(agrieve): Remove thread check and audit for background usages.
// https://crbug.com/669974
&& ThreadUtils.runningOnUiThread()
&& !isTabletDisplay(DisplayAndroid.getNonMultiDisplay(context))) {
// There have been no cases where tablet resources end up being used on phone-sized
// displays. Short-circuit this common-case since checking resources is slower (and
......
......@@ -85,6 +85,8 @@ public class DisplayAndroid {
}
/**
* Note: For JB pre-MR1, this can sometimes return values smaller than the actual screen.
* https://crbug.com/829318
* @return Display height in physical pixels.
*/
public int getDisplayHeight() {
......@@ -92,6 +94,7 @@ public class DisplayAndroid {
}
/**
* Note: For JB pre-MR1, this can sometimes return values smaller than the actual screen.
* @return Display width in physical pixels.
*/
public int getDisplayWidth() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment