am 5e024a3c: Merge "Fixing regression where the proper rotation check was not being done. (Bug 6422040)" into jb-dev
* commit '5e024a3c9cf31021106f892fca0f83af3be029aa':
Fixing regression where the proper rotation check was not being done. (Bug 6422040)
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index 586177b..fe9334b 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -758,7 +758,7 @@
// drop in Workspace
mLauncher.exitSpringLoadedDragMode();
}
- mLauncher.unlockScreenOrientation();
+ mLauncher.unlockScreenOrientation(false);
}
@Override
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 5802610..e5baf62 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -385,15 +385,8 @@
}
mSearchDropTargetBar.onSearchPackagesChanged(searchVisible, voiceVisible);
- final String forceEnableRotation =
- SystemProperties.get(FORCE_ENABLE_ROTATION_PROPERTY, "false");
-
- boolean enableRotation = getResources().getBoolean(R.bool.allow_rotation);
-
// On large interfaces, we want the screen to auto-rotate based on the current orientation
- if (enableRotation || "true".equalsIgnoreCase(forceEnableRotation)) {
- setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
- }
+ unlockScreenOrientation(true);
}
private void checkForLocaleChange() {
@@ -3358,16 +3351,31 @@
return oriMap[(d.getRotation() + indexOffset) % 4];
}
- public void lockScreenOrientation() {
- setRequestedOrientation(mapConfigurationOriActivityInfoOri(getResources()
- .getConfiguration().orientation));
+ public boolean isRotationEnabled() {
+ boolean forceEnableRotation = "true".equalsIgnoreCase(SystemProperties.get(
+ FORCE_ENABLE_ROTATION_PROPERTY, "false"));
+ boolean enableRotation = forceEnableRotation ||
+ getResources().getBoolean(R.bool.allow_rotation);
+ return enableRotation;
}
- public void unlockScreenOrientation() {
- mHandler.postDelayed(new Runnable() {
- public void run() {
+ public void lockScreenOrientation() {
+ if (isRotationEnabled()) {
+ setRequestedOrientation(mapConfigurationOriActivityInfoOri(getResources()
+ .getConfiguration().orientation));
+ }
+ }
+ public void unlockScreenOrientation(boolean immediate) {
+ if (isRotationEnabled()) {
+ if (immediate) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
+ } else {
+ mHandler.postDelayed(new Runnable() {
+ public void run() {
+ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
+ }
+ }, mRestoreScreenOrientationDelay);
}
- }, mRestoreScreenOrientationDelay);
+ }
}
/* Cling related */
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 404efc2..ec18fb3 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -386,7 +386,7 @@
public void onDragEnd() {
mIsDragOccuring = false;
updateChildrenLayersEnabled();
- mLauncher.unlockScreenOrientation();
+ mLauncher.unlockScreenOrientation(false);
}
/**