Chromium Code Reviews| 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() { |