Skip to content

Commit ec53745

Browse files
author
Dianne Hackborn
committed
Fix issue #5155678: Portrait > Landscape full-screen transition...
...mode cuts off screen rendering The code for limiting application window sizes to not include the navigation bar was dead. Now it is back. Change-Id: Ic0bde56e3300fd0d9d225e19d8de2766d07e8780
1 parent 1f903c3 commit ec53745

File tree

3 files changed

+30
-31
lines changed

3 files changed

+30
-31
lines changed

core/java/android/view/Display.java

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
*/
3131
public class Display {
3232
static final String TAG = "Display";
33-
static final boolean DEBUG_COMPAT = false;
33+
static final boolean DEBUG_DISPLAY_SIZE = false;
3434

3535
/**
3636
* The default Display id.
@@ -117,7 +117,8 @@ private void getSizeInternal(Point outSize, boolean doCompat) {
117117
outSize.x = getRawWidth();
118118
outSize.y = getRawHeight();
119119
}
120-
if (DEBUG_COMPAT && doCompat) Slog.v(TAG, "Returning display size: " + outSize);
120+
if (DEBUG_DISPLAY_SIZE && doCompat) Slog.v(
121+
TAG, "Returning display size: " + outSize);
121122
} catch (RemoteException e) {
122123
Slog.w("Display", "Unable to get display size", e);
123124
}
@@ -203,6 +204,8 @@ public void getRealSize(Point outSize) {
203204
outSize.x = getRawWidth();
204205
outSize.y = getRawHeight();
205206
}
207+
if (DEBUG_DISPLAY_SIZE) Slog.v(
208+
TAG, "Returning real display size: " + outSize);
206209
} catch (RemoteException e) {
207210
Slog.w("Display", "Unable to get real display size", e);
208211
}
@@ -215,7 +218,13 @@ public void getRealSize(Point outSize) {
215218
* </p>
216219
* @hide
217220
*/
218-
native public int getRawWidth();
221+
public int getRawWidth() {
222+
int w = getRawWidthNative();
223+
if (DEBUG_DISPLAY_SIZE) Slog.v(
224+
TAG, "Returning raw display width: " + w);
225+
return w;
226+
}
227+
private native int getRawWidthNative();
219228

220229
/**
221230
* Gets the raw height of the display, in pixels.
@@ -224,7 +233,13 @@ public void getRealSize(Point outSize) {
224233
* </p>
225234
* @hide
226235
*/
227-
native public int getRawHeight();
236+
public int getRawHeight() {
237+
int h = getRawHeightNative();
238+
if (DEBUG_DISPLAY_SIZE) Slog.v(
239+
TAG, "Returning raw display height: " + h);
240+
return h;
241+
}
242+
private native int getRawHeightNative();
228243

229244
/**
230245
* Returns the rotation of the screen from its "natural" orientation.
@@ -293,8 +308,9 @@ public void getMetrics(DisplayMetrics outMetrics) {
293308
ci.applyToDisplayMetrics(outMetrics);
294309
}
295310

296-
if (DEBUG_COMPAT) Slog.v(TAG, "Returning DisplayMetrics: " + outMetrics.widthPixels
297-
+ "x" + outMetrics.heightPixels + " " + outMetrics.density);
311+
if (DEBUG_DISPLAY_SIZE) Slog.v(TAG, "Returning DisplayMetrics: "
312+
+ outMetrics.widthPixels + "x" + outMetrics.heightPixels
313+
+ " " + outMetrics.density);
298314
}
299315

300316
/**

core/jni/android_view_Display.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ static void android_view_Display_init(
6363
env->SetFloatField(clazz, offsets.ydpi, info.ydpi);
6464
}
6565

66-
static jint android_view_Display_getRawWidth(
66+
static jint android_view_Display_getRawWidthNative(
6767
JNIEnv* env, jobject clazz)
6868
{
6969
DisplayID dpy = env->GetIntField(clazz, offsets.display);
7070
return SurfaceComposerClient::getDisplayWidth(dpy);
7171
}
7272

73-
static jint android_view_Display_getRawHeight(
73+
static jint android_view_Display_getRawHeightNative(
7474
JNIEnv* env, jobject clazz)
7575
{
7676
DisplayID dpy = env->GetIntField(clazz, offsets.display);
@@ -103,10 +103,10 @@ static JNINativeMethod gMethods[] = {
103103
(void*)android_view_Display_getDisplayCount },
104104
{ "init", "(I)V",
105105
(void*)android_view_Display_init },
106-
{ "getRawWidth", "()I",
107-
(void*)android_view_Display_getRawWidth },
108-
{ "getRawHeight", "()I",
109-
(void*)android_view_Display_getRawHeight },
106+
{ "getRawWidthNative", "()I",
107+
(void*)android_view_Display_getRawWidthNative },
108+
{ "getRawHeightNative", "()I",
109+
(void*)android_view_Display_getRawHeightNative },
110110
{ "getOrientation", "()I",
111111
(void*)android_view_Display_getOrientation }
112112
};

policy/src/com/android/internal/policy/impl/PhoneWindowManager.java

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1724,13 +1724,15 @@ public void beginLayoutLw(int displayWidth, int displayHeight, int displayRotati
17241724
displayWidth, displayHeight);
17251725
if (mNavigationBar.isVisibleLw()) {
17261726
mDockBottom = mTmpNavigationFrame.top;
1727+
mRestrictedScreenHeight = mDockBottom - mDockTop;
17271728
}
17281729
} else {
17291730
// Landscape screen; nav bar goes to the right.
17301731
mTmpNavigationFrame.set(displayWidth-mNavigationBarWidth, 0,
17311732
displayWidth, displayHeight);
17321733
if (mNavigationBar.isVisibleLw()) {
17331734
mDockRight = mTmpNavigationFrame.left;
1735+
mRestrictedScreenWidth = mDockRight - mDockLeft;
17341736
}
17351737
}
17361738
mNavigationBar.computeFrameLw(mTmpNavigationFrame, mTmpNavigationFrame,
@@ -1748,25 +1750,6 @@ public void beginLayoutLw(int displayWidth, int displayHeight, int displayRotati
17481750

17491751
mStatusBar.computeFrameLw(pf, df, vf, vf);
17501752

1751-
// now, let's consider the navigation bar; if it exists, it must be removed from the
1752-
// available screen real estate (like an un-hideable status bar)
1753-
if (navr != null) {
1754-
if (navr.top == 0) {
1755-
// Navigation bar is vertical
1756-
if (mRestrictedScreenLeft == navr.left) {
1757-
mRestrictedScreenLeft = navr.right;
1758-
mRestrictedScreenWidth -= (navr.right - navr.left);
1759-
} else if ((mRestrictedScreenLeft+mRestrictedScreenWidth) == navr.right) {
1760-
mRestrictedScreenWidth -= (navr.right - navr.left);
1761-
}
1762-
} else {
1763-
// Navigation bar horizontal, at bottom
1764-
if ((mRestrictedScreenHeight+mRestrictedScreenTop) == navr.bottom) {
1765-
mRestrictedScreenHeight -= (navr.bottom-navr.top);
1766-
}
1767-
}
1768-
}
1769-
17701753
if (mStatusBar.isVisibleLw()) {
17711754
// If the status bar is hidden, we don't want to cause
17721755
// windows behind it to scroll.

0 commit comments

Comments
 (0)