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
|
// Input channel
|
||||||
InputChannel mInputChannel;
|
InputChannel mInputChannel;
|
||||||
|
|
||||||
|
// Used to improve performance of toString()
|
||||||
|
String mStringNameCache;
|
||||||
|
CharSequence mLastTitle;
|
||||||
|
boolean mWasPaused;
|
||||||
|
|
||||||
WindowState(Session s, IWindow c, WindowToken token,
|
WindowState(Session s, IWindow c, WindowToken token,
|
||||||
WindowState attachedWindow, WindowManager.LayoutParams a,
|
WindowState attachedWindow, WindowManager.LayoutParams a,
|
||||||
int viewVisibility) {
|
int viewVisibility) {
|
||||||
@ -7262,9 +7267,14 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Window{"
|
if (mStringNameCache == null || mLastTitle != mAttrs.getTitle()
|
||||||
+ Integer.toHexString(System.identityHashCode(this))
|
|| mWasPaused != mToken.paused) {
|
||||||
+ " " + mAttrs.getTitle() + " paused=" + 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