[MediaProjection] Immediately clean up mirrored surface.

When MediaProjection is stopped, the VirtualDisplay used to capture
content is released. This triggers DisplayContent#remove, for the
DisplayContent associated with that VirtualDisplay.

Clean up the mirrored surface if the DisplayContent is used for
layer mirroring, to prevent an eventual out of memory error
when MediaProjection is started/stopped several times, and the
garbage collection has not yet cleared up unusued surfaces. Note
the surfaces would be removed eventually, since they no longer
have a reference.

Bug: 197576836
Test: manual
Change-Id: Ic28c0b3deeb1c332c36feaf661342c68c28db192
1 file changed