Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ec537457 authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

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
parent 1f903c3b
Loading
Loading
Loading
Loading
+22 −6
Original line number Diff line number Diff line
@@ -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);
    }

    /**
+6 −6
Original line number Diff line number Diff line
@@ -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 }
};
+2 −19
Original line number Diff line number Diff line
@@ -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.