Remove manual GC after unfreezing screen
The modern VM should be efficient enough to do GC automatically on a dedicated thread. The removal can avoid significant random delay by the explicitly GC on display thread. About the legacy comment of "remote references", there is no strong association with display change. There could have other cases to produce many releasable remote references, but so far they are no problem without an explicitly GC. Hence remove the manual GC to be more general. Bug: 255687140 Test: CtsWindowManagerDeviceTestCases Change-Id: Ib620894b103ae33f1859a6e1d9627703eeb7b0ae
This commit is contained in:
@@ -5295,7 +5295,6 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
public static final int WINDOW_FREEZE_TIMEOUT = 11;
|
||||
|
||||
public static final int PERSIST_ANIMATION_SCALE = 14;
|
||||
public static final int FORCE_GC = 15;
|
||||
public static final int ENABLE_SCREEN = 16;
|
||||
public static final int APP_FREEZE_TIMEOUT = 17;
|
||||
public static final int REPORT_WINDOWS_CHANGE = 19;
|
||||
@@ -5386,26 +5385,6 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
break;
|
||||
}
|
||||
|
||||
case FORCE_GC: {
|
||||
synchronized (mGlobalLock) {
|
||||
// Since we're holding both mWindowMap and mAnimator we don't need to
|
||||
// hold mAnimator.mLayoutToAnim.
|
||||
if (mAnimator.isAnimationScheduled()) {
|
||||
// If we are animating, don't do the gc now but
|
||||
// delay a bit so we don't interrupt the animation.
|
||||
sendEmptyMessageDelayed(H.FORCE_GC, 2000);
|
||||
return;
|
||||
}
|
||||
// If we are currently rotating the display, it will
|
||||
// schedule a new message when done.
|
||||
if (mDisplayFrozen) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
Runtime.getRuntime().gc();
|
||||
break;
|
||||
}
|
||||
|
||||
case ENABLE_SCREEN: {
|
||||
performEnableScreen();
|
||||
break;
|
||||
@@ -6264,14 +6243,6 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
// now to catch that.
|
||||
configChanged = displayContent != null && displayContent.updateOrientation();
|
||||
|
||||
// A little kludge: a lot could have happened while the
|
||||
// display was frozen, so now that we are coming back we
|
||||
// do a gc so that any remote references the system
|
||||
// processes holds on others can be released if they are
|
||||
// no longer needed.
|
||||
mH.removeMessages(H.FORCE_GC);
|
||||
mH.sendEmptyMessageDelayed(H.FORCE_GC, 2000);
|
||||
|
||||
mScreenFrozenLock.release();
|
||||
|
||||
if (updateRotation && displayContent != null) {
|
||||
|
||||
Reference in New Issue
Block a user