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

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: update AUTHOR 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 | « AUTHORS ('k') | 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..0aebd440be7f94c00ac5d624307939903a1b2f66 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,7 @@ package org.chromium.content.browser;
import android.app.Activity;
import android.content.pm.ActivityInfo;
+import android.content.pm.PackageManager;
import android.util.Log;
import com.google.common.annotations.VisibleForTesting;
@@ -74,7 +75,17 @@ class ScreenOrientationProvider {
return;
}
- activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
+ int defaultOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
+
+ try {
+ ActivityInfo info = activity.getPackageManager().getActivityInfo(
+ activity.getComponentName(), PackageManager.GET_META_DATA);
+ defaultOrientation = info.screenOrientation;
+ } catch (PackageManager.NameNotFoundException e) {
+ // Do nothing, defaultOrientation should be SCREEN_ORIENTATION_UNSPECIFIED.
+ } finally {
+ activity.setRequestedOrientation(defaultOrientation);
+ }
}
private ScreenOrientationProvider() {
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698