summaryrefslogtreecommitdiffstats
path: root/policy/src
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2011-04-21 17:26:39 -0700
committerDianne Hackborn <hackbod@google.com>2011-04-21 17:27:42 -0700
commit9d13264f6b5818812e61d66baaada599b8ad1faf (patch)
treeebc05f5c11a1fe0150cdbb71ff3675d051c6b395 /policy/src
parent4c1f4f7144ad6d73ca2a28eceb5a1c43664799c7 (diff)
downloadframeworks_base-9d13264f6b5818812e61d66baaada599b8ad1faf.zip
frameworks_base-9d13264f6b5818812e61d66baaada599b8ad1faf.tar.gz
frameworks_base-9d13264f6b5818812e61d66baaada599b8ad1faf.tar.bz2
Fix bug in deciding which rotation to use for an orientation.
Change-Id: Icc928c2188a5865035cafcdab2efd5bae3132b1f
Diffstat (limited to 'policy/src')
-rwxr-xr-xpolicy/src/com/android/internal/policy/impl/PhoneWindowManager.java68
1 files changed, 31 insertions, 37 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index 1969945..65321b7 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -35,7 +35,6 @@ import android.database.ContentObserver;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.os.Binder;
-import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
import android.os.LocalPowerManager;
@@ -56,11 +55,9 @@ import com.android.internal.telephony.ITelephony;
import com.android.internal.view.BaseInputHandler;
import com.android.internal.widget.PointerLocationView;
-import android.telephony.TelephonyManager;
import android.util.EventLog;
import android.util.Log;
import android.util.Slog;
-import android.view.Display;
import android.view.Gravity;
import android.view.HapticFeedbackConstants;
import android.view.IWindowManager;
@@ -348,10 +345,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// (See Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR.)
int mIncallPowerBehavior;
- int mLandscapeRotation = -1; // default landscape rotation
- int mSeascapeRotation = -1; // "other" landscape rotation, 180 degrees from mLandscapeRotation
- int mPortraitRotation = -1; // default portrait rotation
- int mUpsideDownRotation = -1; // "other" portrait rotation
+ int mLandscapeRotation = 0; // default landscape rotation
+ int mSeascapeRotation = 0; // "other" landscape rotation, 180 degrees from mLandscapeRotation
+ int mPortraitRotation = 0; // default portrait rotation
+ int mUpsideDownRotation = 0; // "other" portrait rotation
// Nothing to see here, move along...
int mFancyRotationAnimation;
@@ -742,6 +739,32 @@ public class PhoneWindowManager implements WindowManagerPolicy {
initializeHdmiState();
}
+ public void setInitialDisplaySize(int width, int height) {
+ if (width > height) {
+ mLandscapeRotation = Surface.ROTATION_0;
+ mSeascapeRotation = Surface.ROTATION_180;
+ if (mContext.getResources().getBoolean(
+ com.android.internal.R.bool.config_reverseDefaultRotation)) {
+ mPortraitRotation = Surface.ROTATION_90;
+ mUpsideDownRotation = Surface.ROTATION_270;
+ } else {
+ mPortraitRotation = Surface.ROTATION_270;
+ mUpsideDownRotation = Surface.ROTATION_90;
+ }
+ } else {
+ mPortraitRotation = Surface.ROTATION_0;
+ mUpsideDownRotation = Surface.ROTATION_180;
+ if (mContext.getResources().getBoolean(
+ com.android.internal.R.bool.config_reverseDefaultRotation)) {
+ mLandscapeRotation = Surface.ROTATION_270;
+ mSeascapeRotation = Surface.ROTATION_90;
+ } else {
+ mLandscapeRotation = Surface.ROTATION_90;
+ mSeascapeRotation = Surface.ROTATION_270;
+ }
+ }
+ }
+
public void updateSettings() {
ContentResolver resolver = mContext.getContentResolver();
boolean updateRotation = false;
@@ -2528,7 +2551,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
}
}
-
+
public int rotationForOrientationLw(int orientation, int lastRotation,
boolean displayEnabled) {
@@ -2541,35 +2564,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
);
}
- if (mPortraitRotation < 0) {
- // Initialize the rotation angles for each orientation once.
- Display d = ((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE))
- .getDefaultDisplay();
- if (d.getWidth() > d.getHeight()) {
- mLandscapeRotation = Surface.ROTATION_0;
- mSeascapeRotation = Surface.ROTATION_180;
- if (mContext.getResources().getBoolean(
- com.android.internal.R.bool.config_reverseDefaultRotation)) {
- mPortraitRotation = Surface.ROTATION_90;
- mUpsideDownRotation = Surface.ROTATION_270;
- } else {
- mPortraitRotation = Surface.ROTATION_270;
- mUpsideDownRotation = Surface.ROTATION_90;
- }
- } else {
- mPortraitRotation = Surface.ROTATION_0;
- mUpsideDownRotation = Surface.ROTATION_180;
- if (mContext.getResources().getBoolean(
- com.android.internal.R.bool.config_reverseDefaultRotation)) {
- mLandscapeRotation = Surface.ROTATION_270;
- mSeascapeRotation = Surface.ROTATION_90;
- } else {
- mLandscapeRotation = Surface.ROTATION_90;
- mSeascapeRotation = Surface.ROTATION_270;
- }
- }
- }
-
synchronized (mLock) {
switch (orientation) {
case ActivityInfo.SCREEN_ORIENTATION_PORTRAIT: