am 9d0f2c6d: Merge "DO NOT MERGE: From master -- Fix bug in deciding which rotation to use for an orientation." into honeycomb-mr2
* commit '9d0f2c6d970a1d2c7f9de5c9e89737d7772f95d3': DO NOT MERGE: From master -- Fix bug in deciding which rotation to use for an orientation.
This commit is contained in:
@@ -303,9 +303,9 @@ public final class Configuration implements Parcelable, Comparable<Configuration
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder(128);
|
||||
sb.append("{ fnt=");
|
||||
sb.append("{");
|
||||
sb.append(fontScale);
|
||||
sb.append(" imsi=");
|
||||
sb.append("x imsi=");
|
||||
sb.append(mcc);
|
||||
sb.append("/");
|
||||
sb.append(mnc);
|
||||
|
||||
@@ -393,6 +393,12 @@ public interface WindowManagerPolicy {
|
||||
public void init(Context context, IWindowManager windowManager,
|
||||
LocalPowerManager powerManager);
|
||||
|
||||
/**
|
||||
* Called by window manager once it has the initial, default native
|
||||
* display dimensions.
|
||||
*/
|
||||
public void setInitialDisplaySize(int width, int height);
|
||||
|
||||
/**
|
||||
* Check permissions when adding a window.
|
||||
*
|
||||
|
||||
@@ -55,11 +55,9 @@ import com.android.internal.telephony.ITelephony;
|
||||
import com.android.internal.view.BaseInputHandler;
|
||||
import com.android.internal.widget.PointerLocationView;
|
||||
|
||||
import android.util.Config;
|
||||
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;
|
||||
@@ -138,7 +136,7 @@ import java.util.ArrayList;
|
||||
public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
static final String TAG = "WindowManager";
|
||||
static final boolean DEBUG = false;
|
||||
static final boolean localLOGV = DEBUG ? Config.LOGD : Config.LOGV;
|
||||
static final boolean localLOGV = false;
|
||||
static final boolean DEBUG_LAYOUT = false;
|
||||
static final boolean DEBUG_FALLBACK = false;
|
||||
static final boolean SHOW_STARTING_ANIMATIONS = true;
|
||||
@@ -348,10 +346,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;
|
||||
@@ -733,6 +731,32 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
// config_statusBarCanHide because the latter depends on the screen size
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -2506,7 +2530,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int rotationForOrientationLw(int orientation, int lastRotation,
|
||||
boolean displayEnabled) {
|
||||
|
||||
@@ -2519,35 +2543,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:
|
||||
|
||||
@@ -89,7 +89,7 @@ class DimSurface {
|
||||
public void printTo(String prefix, PrintWriter pw) {
|
||||
pw.print(prefix); pw.print("mDimSurface="); pw.println(mDimSurface);
|
||||
pw.print(prefix); pw.print("mDimShown="); pw.print(mDimShown);
|
||||
pw.print(" mLayer="); pw.println(mLayer);
|
||||
pw.print(" mLayer="); pw.print(mLayer);
|
||||
pw.print(" mDimColor=0x"); pw.println(Integer.toHexString(mDimColor));
|
||||
pw.print(prefix); pw.print("mLastDimWidth="); pw.print(mLastDimWidth);
|
||||
pw.print(" mLastDimWidth="); pw.println(mLastDimWidth);
|
||||
|
||||
@@ -5854,6 +5854,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
mInitialDisplayWidth = mCurDisplayWidth = mDisplay.getRealWidth();
|
||||
mInitialDisplayHeight = mCurDisplayHeight = mDisplay.getRealHeight();
|
||||
mInputManager.setDisplaySize(0, mDisplay.getRawWidth(), mDisplay.getRawHeight());
|
||||
mPolicy.setInitialDisplaySize(mInitialDisplayWidth, mInitialDisplayHeight);
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -8730,21 +8731,21 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
pw.print(", mForcedAppOrientation="); pw.print(mForcedAppOrientation);
|
||||
pw.print(", mRequestedRotation="); pw.println(mRequestedRotation);
|
||||
pw.print(" mDeferredRotation="); pw.print(mDeferredRotation);
|
||||
pw.print(", mDeferredRotationAnimFlags="); pw.print(mDeferredRotationAnimFlags);
|
||||
pw.print(", mDeferredRotationAnimFlags="); pw.println(mDeferredRotationAnimFlags);
|
||||
pw.print(" mAnimationPending="); pw.print(mAnimationPending);
|
||||
pw.print(" mWindowAnimationScale="); pw.print(mWindowAnimationScale);
|
||||
pw.print(" mTransitionWindowAnimationScale="); pw.println(mTransitionAnimationScale);
|
||||
pw.print(" mNextAppTransition=0x");
|
||||
pw.print(Integer.toHexString(mNextAppTransition));
|
||||
pw.print(", mAppTransitionReady="); pw.print(mAppTransitionReady);
|
||||
pw.print(", mAppTransitionRunning="); pw.print(mAppTransitionRunning);
|
||||
pw.print(", mAppTransitionTimeout="); pw.println( mAppTransitionTimeout);
|
||||
pw.print(" mAppTransitionReady="); pw.println(mAppTransitionReady);
|
||||
pw.print(" mAppTransitionRunning="); pw.print(mAppTransitionRunning);
|
||||
pw.print(" mAppTransitionTimeout="); pw.println( mAppTransitionTimeout);
|
||||
if (mNextAppTransitionPackage != null) {
|
||||
pw.print(" mNextAppTransitionPackage=");
|
||||
pw.print(mNextAppTransitionPackage);
|
||||
pw.print(", mNextAppTransitionEnter=0x");
|
||||
pw.print(" mNextAppTransitionEnter=0x");
|
||||
pw.print(Integer.toHexString(mNextAppTransitionEnter));
|
||||
pw.print(", mNextAppTransitionExit=0x");
|
||||
pw.print(" mNextAppTransitionExit=0x");
|
||||
pw.print(Integer.toHexString(mNextAppTransitionExit));
|
||||
}
|
||||
pw.print(" mStartingIconInTransition="); pw.print(mStartingIconInTransition);
|
||||
|
||||
Reference in New Issue
Block a user