Merge "Fix issue #5155678: Portrait > Landscape full-screen transition..."
This commit is contained in:
committed by
Android (Google) Code Review
commit
d32b472edf
@@ -30,7 +30,7 @@ import android.util.Slog;
|
|||||||
*/
|
*/
|
||||||
public class Display {
|
public class Display {
|
||||||
static final String TAG = "Display";
|
static final String TAG = "Display";
|
||||||
static final boolean DEBUG_COMPAT = false;
|
static final boolean DEBUG_DISPLAY_SIZE = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default Display id.
|
* The default Display id.
|
||||||
@@ -117,7 +117,8 @@ public class Display {
|
|||||||
outSize.x = getRawWidth();
|
outSize.x = getRawWidth();
|
||||||
outSize.y = getRawHeight();
|
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) {
|
} catch (RemoteException e) {
|
||||||
Slog.w("Display", "Unable to get display size", e);
|
Slog.w("Display", "Unable to get display size", e);
|
||||||
}
|
}
|
||||||
@@ -203,6 +204,8 @@ public class Display {
|
|||||||
outSize.x = getRawWidth();
|
outSize.x = getRawWidth();
|
||||||
outSize.y = getRawHeight();
|
outSize.y = getRawHeight();
|
||||||
}
|
}
|
||||||
|
if (DEBUG_DISPLAY_SIZE) Slog.v(
|
||||||
|
TAG, "Returning real display size: " + outSize);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Slog.w("Display", "Unable to get real display size", e);
|
Slog.w("Display", "Unable to get real display size", e);
|
||||||
}
|
}
|
||||||
@@ -215,7 +218,13 @@ public class Display {
|
|||||||
* </p>
|
* </p>
|
||||||
* @hide
|
* @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.
|
* Gets the raw height of the display, in pixels.
|
||||||
@@ -224,7 +233,13 @@ public class Display {
|
|||||||
* </p>
|
* </p>
|
||||||
* @hide
|
* @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.
|
* Returns the rotation of the screen from its "natural" orientation.
|
||||||
@@ -293,8 +308,9 @@ public class Display {
|
|||||||
ci.applyToDisplayMetrics(outMetrics);
|
ci.applyToDisplayMetrics(outMetrics);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DEBUG_COMPAT) Slog.v(TAG, "Returning DisplayMetrics: " + outMetrics.widthPixels
|
if (DEBUG_DISPLAY_SIZE) Slog.v(TAG, "Returning DisplayMetrics: "
|
||||||
+ "x" + outMetrics.heightPixels + " " + outMetrics.density);
|
+ outMetrics.widthPixels + "x" + outMetrics.heightPixels
|
||||||
|
+ " " + outMetrics.density);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -63,14 +63,14 @@ static void android_view_Display_init(
|
|||||||
env->SetFloatField(clazz, offsets.ydpi, info.ydpi);
|
env->SetFloatField(clazz, offsets.ydpi, info.ydpi);
|
||||||
}
|
}
|
||||||
|
|
||||||
static jint android_view_Display_getRawWidth(
|
static jint android_view_Display_getRawWidthNative(
|
||||||
JNIEnv* env, jobject clazz)
|
JNIEnv* env, jobject clazz)
|
||||||
{
|
{
|
||||||
DisplayID dpy = env->GetIntField(clazz, offsets.display);
|
DisplayID dpy = env->GetIntField(clazz, offsets.display);
|
||||||
return SurfaceComposerClient::getDisplayWidth(dpy);
|
return SurfaceComposerClient::getDisplayWidth(dpy);
|
||||||
}
|
}
|
||||||
|
|
||||||
static jint android_view_Display_getRawHeight(
|
static jint android_view_Display_getRawHeightNative(
|
||||||
JNIEnv* env, jobject clazz)
|
JNIEnv* env, jobject clazz)
|
||||||
{
|
{
|
||||||
DisplayID dpy = env->GetIntField(clazz, offsets.display);
|
DisplayID dpy = env->GetIntField(clazz, offsets.display);
|
||||||
@@ -103,10 +103,10 @@ static JNINativeMethod gMethods[] = {
|
|||||||
(void*)android_view_Display_getDisplayCount },
|
(void*)android_view_Display_getDisplayCount },
|
||||||
{ "init", "(I)V",
|
{ "init", "(I)V",
|
||||||
(void*)android_view_Display_init },
|
(void*)android_view_Display_init },
|
||||||
{ "getRawWidth", "()I",
|
{ "getRawWidthNative", "()I",
|
||||||
(void*)android_view_Display_getRawWidth },
|
(void*)android_view_Display_getRawWidthNative },
|
||||||
{ "getRawHeight", "()I",
|
{ "getRawHeightNative", "()I",
|
||||||
(void*)android_view_Display_getRawHeight },
|
(void*)android_view_Display_getRawHeightNative },
|
||||||
{ "getOrientation", "()I",
|
{ "getOrientation", "()I",
|
||||||
(void*)android_view_Display_getOrientation }
|
(void*)android_view_Display_getOrientation }
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1724,6 +1724,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
displayWidth, displayHeight);
|
displayWidth, displayHeight);
|
||||||
if (mNavigationBar.isVisibleLw()) {
|
if (mNavigationBar.isVisibleLw()) {
|
||||||
mDockBottom = mTmpNavigationFrame.top;
|
mDockBottom = mTmpNavigationFrame.top;
|
||||||
|
mRestrictedScreenHeight = mDockBottom - mDockTop;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Landscape screen; nav bar goes to the right.
|
// Landscape screen; nav bar goes to the right.
|
||||||
@@ -1731,6 +1732,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
displayWidth, displayHeight);
|
displayWidth, displayHeight);
|
||||||
if (mNavigationBar.isVisibleLw()) {
|
if (mNavigationBar.isVisibleLw()) {
|
||||||
mDockRight = mTmpNavigationFrame.left;
|
mDockRight = mTmpNavigationFrame.left;
|
||||||
|
mRestrictedScreenWidth = mDockRight - mDockLeft;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mNavigationBar.computeFrameLw(mTmpNavigationFrame, mTmpNavigationFrame,
|
mNavigationBar.computeFrameLw(mTmpNavigationFrame, mTmpNavigationFrame,
|
||||||
@@ -1748,25 +1750,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
|
|
||||||
mStatusBar.computeFrameLw(pf, df, vf, vf);
|
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 (mStatusBar.isVisibleLw()) {
|
||||||
// If the status bar is hidden, we don't want to cause
|
// If the status bar is hidden, we don't want to cause
|
||||||
// windows behind it to scroll.
|
// windows behind it to scroll.
|
||||||
|
|||||||
Reference in New Issue
Block a user