ActivityRecordInputSink: Ensure timely release of SurfaceControl

Relying on the garbage collector to release SurfaceControl and trigger
destruction of server-side layers has proven to be unreliable in
monkey testing. In this case it may cause the accumulation of
a large number of InputWindowInfo, leading to oneway binder spam.

Bug: 228810413
Test: Existing tests pass
Change-Id: If961767a1209674f202518f8b8be8f930d1a43e3
This commit is contained in:
Robert Carr
2022-04-11 11:21:33 -07:00
parent a710d8fe63
commit 51ae378da3
2 changed files with 9 additions and 0 deletions

View File

@@ -3967,6 +3967,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
} else {
onRemovedFromDisplay();
}
mActivityRecordInputSink.releaseSurfaceControl();
super.removeImmediately();
}

View File

@@ -99,4 +99,11 @@ class ActivityRecordInputSink {
return inputWindowHandle;
}
void releaseSurfaceControl() {
if (mSurfaceControl != null) {
mSurfaceControl.release();
mSurfaceControl = null;
}
}
}