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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.content.browser; 5 package org.chromium.content.browser;
6 6
7 import android.app.Activity; 7 import android.app.Activity;
8 import android.content.pm.ActivityInfo; 8 import android.content.pm.ActivityInfo;
9 import android.content.pm.PackageManager;
10 import android.content.pm.PackageManager.NameNotFoundException;
9 import android.util.Log; 11 import android.util.Log;
10 12
11 import com.google.common.annotations.VisibleForTesting; 13 import com.google.common.annotations.VisibleForTesting;
12 14
13 import org.chromium.base.ApplicationStatus; 15 import org.chromium.base.ApplicationStatus;
14 import org.chromium.base.CalledByNative; 16 import org.chromium.base.CalledByNative;
15 import org.chromium.base.JNINamespace; 17 import org.chromium.base.JNINamespace;
16 import org.chromium.content.common.ScreenOrientationValues; 18 import org.chromium.content.common.ScreenOrientationValues;
17 19
18 /** 20 /**
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 activity.setRequestedOrientation(orientation); 69 activity.setRequestedOrientation(orientation);
68 } 70 }
69 71
70 @CalledByNative 72 @CalledByNative
71 void unlockOrientation() { 73 void unlockOrientation() {
72 Activity activity = ApplicationStatus.getLastTrackedFocusedActivity(); 74 Activity activity = ApplicationStatus.getLastTrackedFocusedActivity();
73 if (activity == null) { 75 if (activity == null) {
74 return; 76 return;
75 } 77 }
76 78
77 activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECI FIED); 79 try {
80 ActivityInfo info = activity.getPackageManager().getActivityInfo(
81 activity.getComponentName(), PackageManager.GET_META_DATA);
82 activity.setRequestedOrientation(info.screenOrientation);
83 } catch (NameNotFoundException e) {
84 activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNS PECIFIED);
85 }
mlamouri (slow - plz ping) 2014/07/16 09:13:42 I would prefer if the try-catch was only wrapping
78 } 86 }
79 87
80 private ScreenOrientationProvider() { 88 private ScreenOrientationProvider() {
81 } 89 }
82 } 90 }
OLDNEW
« 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