diff --git a/chrome/android/java/src/org/chromium/chrome/browser/init/AsyncInitializationActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/init/AsyncInitializationActivity.java index d9eacfc087da..1af2d853196f 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/init/AsyncInitializationActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/init/AsyncInitializationActivity.java @@ -110,13 +110,14 @@ protected void attachBaseContext(Context newBase) { // On N+, Chrome should always retain the tab strip layout on tablets. Normally in // multi-window, if Chrome is launched into a smaller screen Android will load the tab // switcher resources. Overriding the smallestScreenWidthDp in the Configuration ensures - // Android will load the tab strip resources. - // See crbug.com/588838, crbug.com/662338, crbug.com/780593. + // Android will load the tab strip resources. See crbug.com/588838. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - Configuration overrideConfiguration = new Configuration(); - overrideConfiguration.smallestScreenWidthDp = - DeviceFormFactor.getSmallestDeviceWidthDp(); - applyOverrideConfiguration(overrideConfiguration); + if (DeviceFormFactor.isTablet()) { + Configuration overrideConfiguration = new Configuration(); + overrideConfiguration.smallestScreenWidthDp = + DeviceFormFactor.getSmallestDeviceWidthDp(); + applyOverrideConfiguration(overrideConfiguration); + } } } diff --git a/ui/android/java/src/org/chromium/ui/base/DeviceFormFactor.java b/ui/android/java/src/org/chromium/ui/base/DeviceFormFactor.java index fb4e10740e27..9c538a8113f1 100644 --- a/ui/android/java/src/org/chromium/ui/base/DeviceFormFactor.java +++ b/ui/android/java/src/org/chromium/ui/base/DeviceFormFactor.java @@ -23,12 +23,15 @@ public class DeviceFormFactor { public static final int MINIMUM_TABLET_WIDTH_DP = 600; /** - * @return Whether the app should currently treat the device as a tablet for layout. This method - * is not affected by Android N multi-window, but can change for external displays. - * E.g. http://developer.samsung.com/samsung-dex/testing + * @return Whether the app should treat the device as a tablet for layout. This method is not + * affected by Android N multi-window. */ @CalledByNative public static boolean isTablet() { + // On some devices, OEM modifications have been made to the resource loader that cause the + // DeviceFormFactor calculation of whether a device is using tablet resources to be + // incorrect. Check which resources were actually loaded rather than look at screen size. + // See crbug.com/662338. return ContextUtils.getApplicationContext().getResources().getBoolean(R.bool.is_tablet); }