OSDN Git Service

Using SCREEN_ORIENTATION_LOCKED for locking to current orientation.
authorSunny Goyal <sunnygoyal@google.com>
Tue, 10 Feb 2015 22:28:44 +0000 (14:28 -0800)
committerSunny Goyal <sunnygoyal@google.com>
Tue, 10 Feb 2015 22:32:55 +0000 (14:32 -0800)
Bug: 17298128
Change-Id: If64b6957a594bcc48f6454689d11cd63d31b9239

src/com/android/launcher3/Launcher.java

index 61915b7..4e30901 100644 (file)
@@ -4779,8 +4779,12 @@ public class Launcher extends Activity
 
     public void lockScreenOrientation() {
         if (Utilities.isRotationEnabled(this)) {
-            setRequestedOrientation(mapConfigurationOriActivityInfoOri(getResources()
-                    .getConfiguration().orientation));
+            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) {
+                setRequestedOrientation(mapConfigurationOriActivityInfoOri(getResources()
+                        .getConfiguration().orientation));
+            } else {
+                setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);
+            }
         }
     }
     public void unlockScreenOrientation(boolean immediate) {