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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/init/AsyncInitializationActivity.java

Issue 1776963002: Revert of Use Display.getRealMetrics() to calculate device size (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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/android/java/src/org/chromium/ui/base/DeviceFormFactor.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/init/AsyncInitializationActivity.java
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 2c5d3a8485e0c518bb3922fe0e61118b875cb378..4dc01149a4dc3d876821c9316c410eac1fb84edd 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
@@ -15,6 +15,7 @@
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.support.v7.app.AppCompatActivity;
+import android.util.DisplayMetrics;
import android.view.Display;
import android.view.Surface;
import android.view.View;
@@ -69,6 +70,7 @@
super.onDestroy();
}
+ @SuppressWarnings("cast")
@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(newBase);
@@ -78,7 +80,10 @@
// switcher resources. Overriding the smallestScreenWidthDp in the Configuration ensures
// Android will load the tab strip resources. See crbug.com/588838.
if (Build.VERSION.CODENAME.equals("N")) {
- int smallestDeviceWidthDp = DeviceFormFactor.getSmallestDeviceWidthDp(this);
+ DisplayMetrics metrics = new DisplayMetrics();
+ ((WindowManager) getApplicationContext().getSystemService(
+ Context.WINDOW_SERVICE)).getDefaultDisplay().getMetrics(metrics);
+ int smallestDeviceWidthDp = DeviceFormFactor.getSmallestDeviceWidthDp(metrics);
if (smallestDeviceWidthDp >= DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP) {
Configuration overrideConfiguration = new Configuration();
« no previous file with comments | « no previous file | ui/android/java/src/org/chromium/ui/base/DeviceFormFactor.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698