Merge "Fix issue #5155678: Portrait > Landscape full-screen transition..."

This commit is contained in:
Dianne Hackborn
2011-09-14 19:26:23 -07:00
committed by Android (Google) Code Review
3 changed files with 30 additions and 31 deletions

View File

@@ -30,7 +30,7 @@ import android.util.Slog;
*/
public class Display {
static final String TAG = "Display";
static final boolean DEBUG_COMPAT = false;
static final boolean DEBUG_DISPLAY_SIZE = false;
/**
* The default Display id.
@@ -117,7 +117,8 @@ public class Display {
outSize.x = getRawWidth();
outSize.y = getRawHeight();
}
if (DEBUG_COMPAT && doCompat) Slog.v(TAG, "Returning display size: " + outSize);
if (DEBUG_DISPLAY_SIZE && doCompat) Slog.v(
TAG, "Returning display size: " + outSize);
} catch (RemoteException e) {
Slog.w("Display", "Unable to get display size", e);
}
@@ -203,6 +204,8 @@ public class Display {
outSize.x = getRawWidth();
outSize.y = getRawHeight();
}
if (DEBUG_DISPLAY_SIZE) Slog.v(
TAG, "Returning real display size: " + outSize);
} catch (RemoteException e) {
Slog.w("Display", "Unable to get real display size", e);
}
@@ -215,7 +218,13 @@ public class Display {
* </p>
* @hide
*/
native public int getRawWidth();
public int getRawWidth() {
int w = getRawWidthNative();
if (DEBUG_DISPLAY_SIZE) Slog.v(
TAG, "Returning raw display width: " + w);
return w;
}
private native int getRawWidthNative();
/**
* Gets the raw height of the display, in pixels.
@@ -224,7 +233,13 @@ public class Display {
* </p>
* @hide
*/
native public int getRawHeight();
public int getRawHeight() {
int h = getRawHeightNative();
if (DEBUG_DISPLAY_SIZE) Slog.v(
TAG, "Returning raw display height: " + h);
return h;
}
private native int getRawHeightNative();
/**
* Returns the rotation of the screen from its "natural" orientation.
@@ -293,8 +308,9 @@ public class Display {
ci.applyToDisplayMetrics(outMetrics);
}
if (DEBUG_COMPAT) Slog.v(TAG, "Returning DisplayMetrics: " + outMetrics.widthPixels
+ "x" + outMetrics.heightPixels + " " + outMetrics.density);
if (DEBUG_DISPLAY_SIZE) Slog.v(TAG, "Returning DisplayMetrics: "
+ outMetrics.widthPixels + "x" + outMetrics.heightPixels
+ " " + outMetrics.density);
}
/**

View File

@@ -63,14 +63,14 @@ static void android_view_Display_init(
env->SetFloatField(clazz, offsets.ydpi, info.ydpi);
}
static jint android_view_Display_getRawWidth(
static jint android_view_Display_getRawWidthNative(
JNIEnv* env, jobject clazz)
{
DisplayID dpy = env->GetIntField(clazz, offsets.display);
return SurfaceComposerClient::getDisplayWidth(dpy);
}
static jint android_view_Display_getRawHeight(
static jint android_view_Display_getRawHeightNative(
JNIEnv* env, jobject clazz)
{
DisplayID dpy = env->GetIntField(clazz, offsets.display);
@@ -103,10 +103,10 @@ static JNINativeMethod gMethods[] = {
(void*)android_view_Display_getDisplayCount },
{ "init", "(I)V",
(void*)android_view_Display_init },
{ "getRawWidth", "()I",
(void*)android_view_Display_getRawWidth },
{ "getRawHeight", "()I",
(void*)android_view_Display_getRawHeight },
{ "getRawWidthNative", "()I",
(void*)android_view_Display_getRawWidthNative },
{ "getRawHeightNative", "()I",
(void*)android_view_Display_getRawHeightNative },
{ "getOrientation", "()I",
(void*)android_view_Display_getOrientation }
};

View File

@@ -1724,6 +1724,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
displayWidth, displayHeight);
if (mNavigationBar.isVisibleLw()) {
mDockBottom = mTmpNavigationFrame.top;
mRestrictedScreenHeight = mDockBottom - mDockTop;
}
} else {
// Landscape screen; nav bar goes to the right.
@@ -1731,6 +1732,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
displayWidth, displayHeight);
if (mNavigationBar.isVisibleLw()) {
mDockRight = mTmpNavigationFrame.left;
mRestrictedScreenWidth = mDockRight - mDockLeft;
}
}
mNavigationBar.computeFrameLw(mTmpNavigationFrame, mTmpNavigationFrame,
@@ -1748,25 +1750,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
mStatusBar.computeFrameLw(pf, df, vf, vf);
// now, let's consider the navigation bar; if it exists, it must be removed from the
// available screen real estate (like an un-hideable status bar)
if (navr != null) {
if (navr.top == 0) {
// Navigation bar is vertical
if (mRestrictedScreenLeft == navr.left) {
mRestrictedScreenLeft = navr.right;
mRestrictedScreenWidth -= (navr.right - navr.left);
} else if ((mRestrictedScreenLeft+mRestrictedScreenWidth) == navr.right) {
mRestrictedScreenWidth -= (navr.right - navr.left);
}
} else {
// Navigation bar horizontal, at bottom
if ((mRestrictedScreenHeight+mRestrictedScreenTop) == navr.bottom) {
mRestrictedScreenHeight -= (navr.bottom-navr.top);
}
}
}
if (mStatusBar.isVisibleLw()) {
// If the status bar is hidden, we don't want to cause
// windows behind it to scroll.