summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2012-05-01 10:44:08 -0700
committerWinson Chung <winsonc@google.com>2012-05-01 10:45:05 -0700
commit4b919f813f4e5e0323a4c1747392551fce4a8758 (patch)
tree06bf7f34f3d75eb569dc312f512804601c26a8a7 /src
parentd7c28056d3fc462f42b508026154d6d8fee5606b (diff)
downloadandroid_packages_apps_Trebuchet-4b919f813f4e5e0323a4c1747392551fce4a8758.tar.gz
android_packages_apps_Trebuchet-4b919f813f4e5e0323a4c1747392551fce4a8758.tar.bz2
android_packages_apps_Trebuchet-4b919f813f4e5e0323a4c1747392551fce4a8758.zip
Fixing regression where the proper rotation check was not being done. (Bug 6422040)
Change-Id: Iadc9a886b84c4418750dc365298944f76c564587
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher2/AppsCustomizePagedView.java2
-rw-r--r--src/com/android/launcher2/Launcher.java36
-rw-r--r--src/com/android/launcher2/Workspace.java2
3 files changed, 24 insertions, 16 deletions
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index 3936e599c..305094485 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -758,7 +758,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
// 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 028a4515a..876aa3b1f 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -381,15 +381,8 @@ public final class Launcher extends Activity
}
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() {
@@ -3333,16 +3326,31 @@ public final class Launcher extends Activity
return oriMap[(d.getRotation() + indexOffset) % 4];
}
+ 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 lockScreenOrientation() {
- setRequestedOrientation(mapConfigurationOriActivityInfoOri(getResources()
- .getConfiguration().orientation));
+ if (isRotationEnabled()) {
+ setRequestedOrientation(mapConfigurationOriActivityInfoOri(getResources()
+ .getConfiguration().orientation));
+ }
}
- public void unlockScreenOrientation() {
- mHandler.postDelayed(new Runnable() {
- public void run() {
+ 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 84787a251..f219d7603 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -383,7 +383,7 @@ public class Workspace extends SmoothPagedView
public void onDragEnd() {
mIsDragOccuring = false;
updateChildrenLayersEnabled();
- mLauncher.unlockScreenOrientation();
+ mLauncher.unlockScreenOrientation(false);
}
/**