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

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

Fix issue #5445966: WindowManager reporting -long on prime when it shouldn't be.

The window manager now uses the app screen dimensions to compute
the various configuration properties, as it should.

This means that prime is official a "not long" device.  Poor prime.
It probably feels inadequate now.

Because it is.

Oh and all that other stuff?  Debugging logs.  Turned off.  And
why the heck not, debugging logs are great.

Change-Id: Iaaf8ef270d986d34fd046d699ef4c0ecea1981fc
parent 99b70f3f
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -117,6 +117,11 @@ public class Display {
                outSize.x = getRawWidth();
                outSize.y = getRawHeight();
            }
            if (false) {
                RuntimeException here = new RuntimeException("here");
                here.fillInStackTrace();
                Slog.v(TAG, "Returning display size: " + outSize, here);
            }
            if (DEBUG_DISPLAY_SIZE && doCompat) Slog.v(
                    TAG, "Returning display size: " + outSize);
        } catch (RemoteException e) {
+4 −2
Original line number Diff line number Diff line
@@ -274,7 +274,8 @@ class DragState {
        final int myPid = Process.myPid();

        // Move the surface to the given touch
        if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i(WindowManagerService.TAG, ">>> OPEN TRANSACTION notifyMoveLw");
        if (WindowManagerService.SHOW_LIGHT_TRANSACTIONS) Slog.i(
                WindowManagerService.TAG, ">>> OPEN TRANSACTION notifyMoveLw");
        Surface.openTransaction();
        try {
            mSurface.setPosition(x - mThumbOffsetX, y - mThumbOffsetY);
@@ -283,7 +284,8 @@ class DragState {
                    (int)(x - mThumbOffsetX) + "," + (int)(y - mThumbOffsetY) + ")");
        } finally {
            Surface.closeTransaction();
            if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i(WindowManagerService.TAG, "<<< CLOSE TRANSACTION notifyMoveLw");
            if (WindowManagerService.SHOW_LIGHT_TRANSACTIONS) Slog.i(
                    WindowManagerService.TAG, "<<< CLOSE TRANSACTION notifyMoveLw");
        }

        // Tell the affected window
+5 −5
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ class ScreenRotationAnimation {
        mOriginalHeight = originalHeight;

        if (!inTransaction) {
            if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i(WindowManagerService.TAG,
            if (WindowManagerService.SHOW_LIGHT_TRANSACTIONS) Slog.i(WindowManagerService.TAG,
                    ">>> OPEN TRANSACTION ScreenRotationAnimation");
            Surface.openTransaction();
        }
@@ -127,7 +127,7 @@ class ScreenRotationAnimation {
        } finally {
            if (!inTransaction) {
                Surface.closeTransaction();
                if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i(WindowManagerService.TAG,
                if (WindowManagerService.SHOW_LIGHT_TRANSACTIONS) Slog.i(WindowManagerService.TAG,
                        "<<< CLOSE TRANSACTION ScreenRotationAnimation");
            }
    
@@ -254,7 +254,7 @@ class ScreenRotationAnimation {
        mEnterAnimation.restrictDuration(maxAnimationDuration);
        mEnterAnimation.scaleCurrentDuration(animationScale);

        if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i(WindowManagerService.TAG,
        if (WindowManagerService.SHOW_LIGHT_TRANSACTIONS) Slog.i(WindowManagerService.TAG,
                ">>> OPEN TRANSACTION ScreenRotationAnimation.dismiss");
        Surface.openTransaction();

@@ -266,7 +266,7 @@ class ScreenRotationAnimation {
            Slog.w(TAG, "Unable to allocate black surface", e);
        } finally {
            Surface.closeTransaction();
            if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i(WindowManagerService.TAG,
            if (WindowManagerService.SHOW_LIGHT_TRANSACTIONS) Slog.i(WindowManagerService.TAG,
                    "<<< CLOSE TRANSACTION ScreenRotationAnimation.dismiss");
        }

+4 −2
Original line number Diff line number Diff line
@@ -278,7 +278,8 @@ final class Session extends IWindowSession.Stub

            // Make the surface visible at the proper location
            final Surface surface = mService.mDragState.mSurface;
            if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i(WindowManagerService.TAG, ">>> OPEN TRANSACTION performDrag");
            if (WindowManagerService.SHOW_LIGHT_TRANSACTIONS) Slog.i(
                    WindowManagerService.TAG, ">>> OPEN TRANSACTION performDrag");
            Surface.openTransaction();
            try {
                surface.setPosition(touchX - thumbCenterX,
@@ -288,7 +289,8 @@ final class Session extends IWindowSession.Stub
                surface.show();
            } finally {
                Surface.closeTransaction();
                if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i(WindowManagerService.TAG, "<<< CLOSE TRANSACTION performDrag");
                if (WindowManagerService.SHOW_LIGHT_TRANSACTIONS) Slog.i(
                        WindowManagerService.TAG, "<<< CLOSE TRANSACTION performDrag");
            }
        }

+21 −12
Original line number Diff line number Diff line
@@ -169,6 +169,7 @@ public class WindowManagerService extends IWindowManager.Stub
    static final boolean DEBUG_SCREENSHOT = false;
    static final boolean SHOW_SURFACE_ALLOC = false;
    static final boolean SHOW_TRANSACTIONS = false;
    static final boolean SHOW_LIGHT_TRANSACTIONS = false || SHOW_TRANSACTIONS;
    static final boolean HIDE_STACK_CRAWLS = true;

    static final boolean PROFILE_ORIENTATION = false;
@@ -2369,7 +2370,7 @@ public class WindowManagerService extends IWindowManager.Stub
            synchronized (mWindowMap) {
                WindowState w = windowForClientLocked(session, client, false);
                if ((w != null) && (w.mSurface != null)) {
                    if (SHOW_TRANSACTIONS) Slog.i(TAG,
                    if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
                            ">>> OPEN TRANSACTION setTransparentRegion");
                    Surface.openTransaction();
                    try {
@@ -2378,7 +2379,7 @@ public class WindowManagerService extends IWindowManager.Stub
                        w.mSurface.setTransparentRegionHint(region);
                    } finally {
                        Surface.closeTransaction();
                        if (SHOW_TRANSACTIONS) Slog.i(TAG,
                        if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
                                "<<< CLOSE TRANSACTION setTransparentRegion");
                    }
                }
@@ -4905,7 +4906,8 @@ public class WindowManagerService extends IWindowManager.Stub
                }
            }

            if (SHOW_TRANSACTIONS) Slog.i(TAG, ">>> OPEN TRANSACTION showStrictModeViolation");
            if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
                    ">>> OPEN TRANSACTION showStrictModeViolation");
            Surface.openTransaction();
            try {
                if (mStrictModeFlash == null) {
@@ -4914,7 +4916,8 @@ public class WindowManagerService extends IWindowManager.Stub
                mStrictModeFlash.setVisibility(on);
            } finally {
                Surface.closeTransaction();
                if (SHOW_TRANSACTIONS) Slog.i(TAG, "<<< CLOSE TRANSACTION showStrictModeViolation");
                if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
                        "<<< CLOSE TRANSACTION showStrictModeViolation");
            }
        }
    }
@@ -5246,7 +5249,7 @@ public class WindowManagerService extends IWindowManager.Stub
        } finally {
            if (!inTransaction) {
                Surface.closeTransaction();
                if (SHOW_TRANSACTIONS) Slog.i(TAG,
                if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
                        "<<< CLOSE TRANSACTION setRotationUnchecked");
            }
        }
@@ -5843,6 +5846,10 @@ public class WindowManagerService extends IWindowManager.Stub
        final DisplayMetrics dm = mDisplayMetrics;
        mAppDisplayWidth = mPolicy.getNonDecorDisplayWidth(dw, dh, mRotation);
        mAppDisplayHeight = mPolicy.getNonDecorDisplayHeight(dw, dh, mRotation);
        if (false) {
            Slog.i(TAG, "Set app display size: " + mAppDisplayWidth
                    + " x " + mAppDisplayHeight);
        }
        mDisplay.getMetricsWithSize(dm, mAppDisplayWidth, mAppDisplayHeight);

        mCompatibleScreenScale = CompatibilityInfo.computeCompatibleScaling(dm,
@@ -5860,8 +5867,8 @@ public class WindowManagerService extends IWindowManager.Stub

        // Compute the screen layout size class.
        int screenLayout;
        int longSize = dw;
        int shortSize = dh;
        int longSize = mAppDisplayWidth;
        int shortSize = mAppDisplayHeight;
        if (longSize < shortSize) {
            int tmp = longSize;
            longSize = shortSize;
@@ -6847,7 +6854,7 @@ public class WindowManagerService extends IWindowManager.Stub

    private void rebuildBlackFrame(boolean inTransaction) {
        if (!inTransaction) {
            if (SHOW_TRANSACTIONS) Slog.i(TAG,
            if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
                    ">>> OPEN TRANSACTION rebuildBlackFrame");
            Surface.openTransaction();
        }
@@ -6882,7 +6889,7 @@ public class WindowManagerService extends IWindowManager.Stub
        } finally {
            if (!inTransaction) {
                Surface.closeTransaction();
                if (SHOW_TRANSACTIONS) Slog.i(TAG,
                if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
                        "<<< CLOSE TRANSACTION rebuildBlackFrame");
            }
        }
@@ -7354,7 +7361,8 @@ public class WindowManagerService extends IWindowManager.Stub
            createWatermark = true;
        }

        if (SHOW_TRANSACTIONS) Slog.i(TAG, ">>> OPEN TRANSACTION performLayoutAndPlaceSurfaces");
        if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
                ">>> OPEN TRANSACTION performLayoutAndPlaceSurfaces");

        Surface.openTransaction();

@@ -8463,7 +8471,8 @@ public class WindowManagerService extends IWindowManager.Stub

        Surface.closeTransaction();

        if (SHOW_TRANSACTIONS) Slog.i(TAG, "<<< CLOSE TRANSACTION performLayoutAndPlaceSurfaces");
        if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
                "<<< CLOSE TRANSACTION performLayoutAndPlaceSurfaces");

        if (mWatermark != null) {
            mWatermark.drawIfNeeded();
Loading