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

Commit 76a3cb97 authored by Jeff Brown's avatar Jeff Brown
Browse files

We don't need black frames for forced display size.

Now that surface flinger lets us set a display projection,
the window manager no longer needs to place a black frame
around the content when simulating a different display size.

Bug: 7139798
Change-Id: I6014390f47444633d434ccf918cee5ff7b502869
parent cdfc56a3
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -611,15 +611,6 @@ public class WindowAnimator {
                        !mService.okToDisplay());
            }

            if (mService.mBlackFrame != null) {
                if (mScreenRotationAnimation != null) {
                    mService.mBlackFrame.setMatrix(
                            mScreenRotationAnimation.getEnterTransformation().getMatrix());
                } else {
                    mService.mBlackFrame.clearMatrix();
                }
            }

            if (mService.mWatermark != null) {
                mService.mWatermark.drawIfNeeded();
            }
+0 −53
Original line number Diff line number Diff line
@@ -430,8 +430,6 @@ public class WindowManagerService extends IWindowManager.Stub
    Watermark mWatermark;
    StrictModeFlash mStrictModeFlash;

    BlackFrame mBlackFrame;

    final float[] mTmpFloats = new float[9];

    boolean mDisplayReady;
@@ -6036,8 +6034,6 @@ public class WindowManagerService extends IWindowManager.Stub
            }
        }

        rebuildBlackFrameLocked();

        final WindowList windows = displayContent.getWindowList();
        for (int i = windows.size() - 1; i >= 0; i--) {
            WindowState w = windows.get(i);
@@ -7854,49 +7850,7 @@ public class WindowManagerService extends IWindowManager.Stub
        }
    }

    private void rebuildBlackFrameLocked() {
        if (mBlackFrame != null) {
            mBlackFrame.kill();
            mBlackFrame = null;
        }
        // TODO(multidisplay): For now rotations are only main screen.
        final DisplayContent displayContent = getDefaultDisplayContentLocked();
        final Display display = displayContent.getDisplay();
        if (displayContent.mBaseDisplayWidth < displayContent.mInitialDisplayWidth
                || displayContent.mBaseDisplayHeight < displayContent.mInitialDisplayHeight) {
            int initW, initH, baseW, baseH;
            final boolean rotated = (mRotation == Surface.ROTATION_90
                    || mRotation == Surface.ROTATION_270);
            if (DEBUG_BOOT) {
                Slog.i(TAG, "BLACK FRAME: rotated=" + rotated + " init="
                        + displayContent.mInitialDisplayWidth + "x"
                        + displayContent.mInitialDisplayHeight + " base="
                        + displayContent.mBaseDisplayWidth + "x"
                        + displayContent.mBaseDisplayHeight);
            }
            if (rotated) {
                initW = displayContent.mInitialDisplayHeight;
                initH = displayContent.mInitialDisplayWidth;
                baseW = displayContent.mBaseDisplayHeight;
                baseH = displayContent.mBaseDisplayWidth;
            } else {
                initW = displayContent.mInitialDisplayWidth;
                initH = displayContent.mInitialDisplayHeight;
                baseW = displayContent.mBaseDisplayWidth;
                baseH = displayContent.mBaseDisplayHeight;
            }
            Rect outer = new Rect(0, 0, initW, initH);
            Rect inner = new Rect(0, 0, baseW, baseH);
            try {
                mBlackFrame = new BlackFrame(mFxSession, outer, inner, MASK_LAYER,
                        display.getLayerStack());
            } catch (Surface.OutOfResourcesException e) {
            }
        }
    }

    private void readForcedDisplaySizeAndDensityLocked(final DisplayContent displayContent) {
        boolean changed = false;
        final String sizeStr = Settings.Global.getString(mContext.getContentResolver(),
                Settings.Global.DISPLAY_SIZE_FORCED);
        if (sizeStr != null && sizeStr.length() > 0) {
@@ -7909,7 +7863,6 @@ public class WindowManagerService extends IWindowManager.Stub
                    synchronized(displayContent.mDisplaySizeLock) {
                        if (displayContent.mBaseDisplayWidth != width
                                || displayContent.mBaseDisplayHeight != height) {
                            changed = true;
                            Slog.i(TAG, "FORCED DISPLAY SIZE: " + width + "x" + height);
                            displayContent.mBaseDisplayWidth = width;
                            displayContent.mBaseDisplayHeight = height;
@@ -7927,7 +7880,6 @@ public class WindowManagerService extends IWindowManager.Stub
                density = Integer.parseInt(densityStr);
                synchronized(displayContent.mDisplaySizeLock) {
                    if (displayContent.mBaseDisplayDensity != density) {
                        changed = true;
                        Slog.i(TAG, "FORCED DISPLAY DENSITY: " + density);
                        displayContent.mBaseDisplayDensity = density;
                    }
@@ -7935,9 +7887,6 @@ public class WindowManagerService extends IWindowManager.Stub
            } catch (NumberFormatException ex) {
            }
        }
        if (changed) {
            rebuildBlackFrameLocked();
        }
    }

    private void setForcedDisplaySizeLocked(DisplayContent displayContent, int width, int height) {
@@ -8011,8 +7960,6 @@ public class WindowManagerService extends IWindowManager.Stub
            mH.sendEmptyMessage(H.SEND_NEW_CONFIGURATION);
        }

        rebuildBlackFrameLocked();

        performLayoutAndPlaceSurfacesLocked();
    }