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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ScreenOrientationProvider.java

Issue 2394773006: android: Use DisplayAndroid in java (Closed)
Patch Set: javadoc Created 4 years, 2 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
Index: content/public/android/java/src/org/chromium/content/browser/ScreenOrientationProvider.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ScreenOrientationProvider.java b/content/public/android/java/src/org/chromium/content/browser/ScreenOrientationProvider.java
index b7a17138b73dc2356232544d615ad6d0f5f60a17..3cdb3247b634137f5748f6cf04e0bbf1951560ca 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ScreenOrientationProvider.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ScreenOrientationProvider.java
@@ -7,6 +7,7 @@ package org.chromium.content.browser;
import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
+import android.view.Surface;
import org.chromium.base.ApplicationStatus;
import org.chromium.base.Log;
@@ -16,7 +17,6 @@ import org.chromium.base.annotations.JNINamespace;
import org.chromium.content_public.common.ScreenOrientationConstants;
import org.chromium.content_public.common.ScreenOrientationValues;
import org.chromium.ui.display.DisplayAndroid;
-import org.chromium.ui.gfx.DeviceDisplayInfo;
/**
* This is the implementation of the C++ counterpart ScreenOrientationProvider.
@@ -45,15 +45,15 @@ public class ScreenOrientationProvider {
case ScreenOrientationValues.ANY:
return ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR;
case ScreenOrientationValues.NATURAL:
- DeviceDisplayInfo displayInfo = DeviceDisplayInfo.create(activity);
- int rotation = displayInfo.getRotationDegrees();
- if (rotation == 0 || rotation == 180) {
- if (displayInfo.getDisplayHeight() >= displayInfo.getDisplayWidth()) {
+ DisplayAndroid displayAndroid = DisplayAndroid.get(activity);
+ int rotation = displayAndroid.getRotation();
+ if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_180) {
+ if (displayAndroid.getDisplayHeight() >= displayAndroid.getDisplayWidth()) {
return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
}
return ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
} else {
- if (displayInfo.getDisplayHeight() < displayInfo.getDisplayWidth()) {
+ if (displayAndroid.getDisplayHeight() < displayAndroid.getDisplayWidth()) {
return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
}
return ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;

Powered by Google App Engine
This is Rietveld 408576698