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

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

Issue 399553002: [Android] Implement ScreenOrientation.unlock align with spec (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 47e79e6a06f2835711ed2afe427bd616c2983838..63d277e73a62053708988b90a66bb00208048ed0 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
@@ -6,6 +6,8 @@ package org.chromium.content.browser;
import android.app.Activity;
import android.content.pm.ActivityInfo;
+import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.NameNotFoundException;
import android.util.Log;
import com.google.common.annotations.VisibleForTesting;
@@ -74,7 +76,13 @@ class ScreenOrientationProvider {
return;
}
- activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
+ try {
+ ActivityInfo info = activity.getPackageManager().getActivityInfo(
+ activity.getComponentName(), PackageManager.GET_META_DATA);
+ activity.setRequestedOrientation(info.screenOrientation);
+ } catch (NameNotFoundException e) {
+ activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
+ }
mlamouri (slow - plz ping) 2014/07/16 09:13:42 I would prefer if the try-catch was only wrapping
}
private ScreenOrientationProvider() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698