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

Commit 2f209e88 authored by Mattias Petersson's avatar Mattias Petersson Committed by Android Git Automerger
Browse files

am 1622eee2: Improve performance of WindowState.toString()

* commit '1622eee2':
  Improve performance of WindowState.toString()
parents 7a9f17c3 1622eee2
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -6005,6 +6005,11 @@ public class WindowManagerService extends IWindowManager.Stub
        // Input channel
        InputChannel mInputChannel;
        
        // Used to improve performance of toString()
        String mStringNameCache;
        CharSequence mLastTitle;
        boolean mWasPaused;

        WindowState(Session s, IWindow c, WindowToken token,
               WindowState attachedWindow, WindowManager.LayoutParams a,
               int viewVisibility) {
@@ -7262,9 +7267,14 @@ public class WindowManagerService extends IWindowManager.Stub

        @Override
        public String toString() {
            return "Window{"
                + Integer.toHexString(System.identityHashCode(this))
                + " " + mAttrs.getTitle() + " paused=" + mToken.paused + "}";
            if (mStringNameCache == null || mLastTitle != mAttrs.getTitle()
                    || mWasPaused != mToken.paused) {
                mLastTitle = mAttrs.getTitle();
                mWasPaused = mToken.paused;
                mStringNameCache = "Window{" + Integer.toHexString(System.identityHashCode(this))
                        + " " + mLastTitle + " paused=" + mWasPaused + "}";
            }
            return mStringNameCache;
        }
    }