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

Commit bd67cddd authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android (Google) Code Review
Browse files

Merge "Don't report a resize unless the window's surface actually changed."

parents 31f8b628 b961cd2c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ import java.util.List;
 */
final class ActivityStack {
    static final String TAG = ActivityManagerService.TAG;
    static final boolean localLOGV = ActivityManagerService.localLOGV || true;
    static final boolean localLOGV = ActivityManagerService.localLOGV;
    static final boolean DEBUG_SWITCH = ActivityManagerService.DEBUG_SWITCH;
    static final boolean DEBUG_PAUSE = ActivityManagerService.DEBUG_PAUSE;
    static final boolean DEBUG_VISBILITY = ActivityManagerService.DEBUG_VISBILITY;
+5 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.server.wm;

import android.graphics.Rect;
import android.os.Binder;
import android.os.Process;
import android.os.RemoteException;
import android.util.Log;
@@ -152,6 +153,8 @@ final class InputMonitor {
        }
        mUpdateInputWindowsNeeded = false;

        if (false) Slog.d(WindowManagerService.TAG, ">>>>>> ENTERED updateInputWindowsLw");
        
        // Populate the input window list with information about all of the windows that
        // could potentially receive input.
        // As an optimization, we could try to prune the list of windows but this turns
@@ -232,6 +235,8 @@ final class InputMonitor {
        // Clear the list in preparation for the next round.
        // Also avoids keeping InputChannel objects referenced unnecessarily.
        mTempInputWindows.clear();
        
        if (false) Slog.d(WindowManagerService.TAG, "<<<<<<< EXITED updateInputWindowsLw");
    }

    /* Notifies that the input device configuration has changed. */
+4 −2
Original line number Diff line number Diff line
@@ -153,11 +153,13 @@ final class Session extends IWindowSession.Stub
            int requestedWidth, int requestedHeight, int viewFlags,
            boolean insetsPending, Rect outFrame, Rect outContentInsets,
            Rect outVisibleInsets, Configuration outConfig, Surface outSurface) {
        //Log.d(TAG, ">>>>>> ENTERED relayout from " + Binder.getCallingPid());
        if (false) Slog.d(WindowManagerService.TAG, ">>>>>> ENTERED relayout from "
                + Binder.getCallingPid());
        int res = mService.relayoutWindow(this, window, attrs,
                requestedWidth, requestedHeight, viewFlags, insetsPending,
                outFrame, outContentInsets, outVisibleInsets, outConfig, outSurface);
        //Log.d(TAG, "<<<<<< EXITING relayout to " + Binder.getCallingPid());
        if (false) Slog.d(WindowManagerService.TAG, "<<<<<< EXITING relayout to "
                + Binder.getCallingPid());
        return res;
    }

+38 −38
Original line number Diff line number Diff line
@@ -7824,6 +7824,7 @@ public class WindowManagerService extends IWindowManager.Stub
                            TAG, "Placing surface #" + i + " " + w.mSurface
                            + ": new=" + w.mShownFrame);

                    if (w.mSurface != null) {
                        int width, height;
                        if ((w.mAttrs.flags & w.mAttrs.FLAG_SCALED) != 0) {
                            // for a scaled surface, we just want to use
@@ -7835,7 +7836,18 @@ public class WindowManagerService extends IWindowManager.Stub
                            height = w.mCompatFrame.height();
                        }

                    if (w.mSurface != null) {
                        if (width < 1) {
                            width = 1;
                        }
                        if (height < 1) {
                            height = 1;
                        }
                        final boolean surfaceResized = w.mSurfaceW != width || w.mSurfaceH != height;
                        if (surfaceResized) {
                            w.mSurfaceW = width;
                            w.mSurfaceH = height;
                        }

                        if (w.mSurfaceX != w.mShownFrame.left
                                || w.mSurfaceY != w.mShownFrame.top) {
                            try {
@@ -7855,21 +7867,11 @@ public class WindowManagerService extends IWindowManager.Stub
                            }
                        }

                        if (width < 1) {
                            width = 1;
                        }
                        if (height < 1) {
                            height = 1;
                        }

                        if (w.mSurfaceW != width || w.mSurfaceH != height) {
                        if (surfaceResized) {
                            try {
                                if (SHOW_TRANSACTIONS) logSurface(w,
                                        "SIZE " + w.mShownFrame.width() + "x"
                                        + w.mShownFrame.height(), null);
                                        "SIZE " + width + "x" + height, null);
                                w.mSurfaceResized = true;
                                w.mSurfaceW = width;
                                w.mSurfaceH = height;
                                w.mSurface.setSize(width, height);
                            } catch (RuntimeException e) {
                                // If something goes wrong with the surface (such
@@ -7885,9 +7887,9 @@ public class WindowManagerService extends IWindowManager.Stub
                    }

                    if (!w.mAppFreezing && w.mLayoutSeq == mLayoutSeq) {
                        w.mContentInsetsChanged =
                        w.mContentInsetsChanged |=
                            !w.mLastContentInsets.equals(w.mContentInsets);
                        w.mVisibleInsetsChanged =
                        w.mVisibleInsetsChanged |=
                            !w.mLastVisibleInsets.equals(w.mVisibleInsets);
                        boolean configChanged =
                            w.mConfiguration != mCurConfiguration
@@ -7899,24 +7901,20 @@ public class WindowManagerService extends IWindowManager.Stub
                        }
                        if (localLOGV) Slog.v(TAG, "Resizing " + w
                                + ": configChanged=" + configChanged
                                + " last=" + w.mLastCompatFrame + " frame=" + w.mCompatFrame);
                        boolean frameChanged = !w.mLastCompatFrame.equals(w.mCompatFrame);
                        if (frameChanged
                                || w.mContentInsetsChanged
                                + " last=" + w.mLastFrame + " frame=" + w.mFrame);
                        w.mLastFrame.set(w.mFrame);
                        if (w.mContentInsetsChanged
                                || w.mVisibleInsetsChanged
                                || w.mSurfaceResized
                                || configChanged) {
                            if (DEBUG_RESIZE || DEBUG_ORIENTATION) {
                                Slog.v(TAG, "Resize reasons: "
                                        + "frameChanged=" + frameChanged
                                        + " contentInsetsChanged=" + w.mContentInsetsChanged
                                        + " visibleInsetsChanged=" + w.mVisibleInsetsChanged
                                        + " surfaceResized=" + w.mSurfaceResized
                                        + " configChanged=" + configChanged);
                            }

                            w.mLastFrame.set(w.mFrame);
                            w.mLastCompatFrame.set(w.mCompatFrame);
                            w.mLastContentInsets.set(w.mContentInsets);
                            w.mLastVisibleInsets.set(w.mVisibleInsets);
                            // If the screen is currently frozen, then keep
@@ -7951,9 +7949,12 @@ public class WindowManagerService extends IWindowManager.Stub
                                    w.mAppToken.allDrawn = false;
                                }
                            }
                            if (!mResizingWindows.contains(w)) {
                                if (DEBUG_RESIZE || DEBUG_ORIENTATION) Slog.v(TAG,
                                    "Resizing window " + w + " to " + w.mCompatFrame);
                                        "Resizing window " + w + " to " + w.mSurfaceW
                                        + "x" + w.mSurfaceH);
                                mResizingWindows.add(w);
                            }
                        } else if (w.mOrientationChanging) {
                            if (!w.mDrawPending && !w.mCommitDrawPending) {
                                if (DEBUG_ORIENTATION) Slog.v(TAG,
@@ -8248,13 +8249,12 @@ public class WindowManagerService extends IWindowManager.Stub
                    if ((DEBUG_RESIZE || DEBUG_ORIENTATION || DEBUG_CONFIGURATION)
                            && configChanged) {
                        Slog.i(TAG, "Sending new config to window " + win + ": "
                                + win.mCompatFrame.width() + "x" + win.mCompatFrame.height()
                                + win.mSurfaceW + "x" + win.mSurfaceH
                                + " / " + mCurConfiguration + " / 0x"
                                + Integer.toHexString(diff));
                    }
                    win.mConfiguration = mCurConfiguration;
                    win.mClient.resized(win.mCompatFrame.width(),
                            win.mCompatFrame.height(), win.mLastContentInsets,
                    win.mClient.resized(win.mSurfaceW, win.mSurfaceH, win.mLastContentInsets,
                            win.mLastVisibleInsets, win.mDrawPending,
                            configChanged ? win.mConfiguration : null);
                    win.mContentInsetsChanged = false;
+1 −6
Original line number Diff line number Diff line
@@ -111,7 +111,6 @@ final class WindowState implements WindowManagerPolicy.WindowState {
     * applied).
     */
    final Rect mShownFrame = new Rect();
    final Rect mLastShownFrame = new Rect();

    /**
     * Set when we have changed the size of the surface, to know that
@@ -182,7 +181,6 @@ final class WindowState implements WindowManagerPolicy.WindowState {
    // Frame that is scaled to the application's coordinate space when in
    // screen size compatibility mode.
    final Rect mCompatFrame = new Rect();
    final Rect mLastCompatFrame = new Rect();

    final Rect mContainingFrame = new Rect();
    final Rect mDisplayFrame = new Rect();
@@ -1584,15 +1582,12 @@ final class WindowState implements WindowManagerPolicy.WindowState {
        }
        pw.print(prefix); pw.print("mConfiguration="); pw.println(mConfiguration);
        pw.print(prefix); pw.print("mShownFrame=");
                mShownFrame.printShortString(pw);
                pw.print(" last="); mLastShownFrame.printShortString(pw);
                pw.println();
                mShownFrame.printShortString(pw); pw.println();
        pw.print(prefix); pw.print("mFrame="); mFrame.printShortString(pw);
                pw.print(" last="); mLastFrame.printShortString(pw);
                pw.println();
        if (mEnforceSizeCompat) {
            pw.print(prefix); pw.print("mCompatFrame="); mCompatFrame.printShortString(pw);
                    pw.print(" last="); mLastCompatFrame.printShortString(pw);
                    pw.println();
        }
        pw.print(prefix); pw.print("mContainingFrame=");