Locking orientation on phones (issue 4967793)
Change-Id: I6b5fe63547f43c408feea75f35dc0a08d06c258c
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 28fdb90..c3edb99 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -321,6 +321,11 @@
if (sAppMarketIcon[coi] != null) {
updateAppMarketIcon(sAppMarketIcon[coi]);
}
+
+ // On large interfaces, we want the screen to auto-rotate based on the current orientation
+ if (LauncherApplication.isScreenLarge()) {
+ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
+ }
}
private void checkForLocaleChange() {
@@ -3040,16 +3045,21 @@
}
return oriMap[(d.getRotation() + indexOffset) % 4];
}
- public void lockScreenOrientation() {
- setRequestedOrientation(mapConfigurationOriActivityInfoOri(getResources()
- .getConfiguration().orientation));
+
+ public void lockScreenOrientationOnLargeUI() {
+ if (LauncherApplication.isScreenLarge()) {
+ setRequestedOrientation(mapConfigurationOriActivityInfoOri(getResources()
+ .getConfiguration().orientation));
+ }
}
- public void unlockScreenOrientation() {
- mHandler.postDelayed(new Runnable() {
- public void run() {
- setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
- }
- }, mRestoreScreenOrientationDelay);
+ public void unlockScreenOrientationOnLargeUI() {
+ if (LauncherApplication.isScreenLarge()) {
+ mHandler.postDelayed(new Runnable() {
+ public void run() {
+ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
+ }
+ }, mRestoreScreenOrientationDelay);
+ }
}
/* Cling related */