am 1622eee2
: Improve performance of WindowState.toString()
* commit '1622eee2e48678b17a4668641957f09213f98905': Improve performance of WindowState.toString()
This commit is contained in:
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user