BlastBufferQueue: Fix scaling when buffer scaling mode changes

The current logic updates the target size of the buffer when a buffer
arrives with FREEZE scaling mode (target size == buffer size) or when
the target size is set and the previous buffer has a scaling mode
!FREEZE. This is because if the previous scaling mode is freeze, we
do not want to change the target size otherwise we will break the
contract with the client and scale the currently presented buffer.

In the case of YoutubeMusic on TV, the client sets a target size,
then submits a buffer with scaling mode FREEZE, then changes
the target size but submits a buffer with scaling mode
SCALE_TO_WINDOW. The new target size never gets sent to
SurfaceFlinger. To fix this we check if the target size has been
updated when acquiring a buffer and update the target size.

Test: atest BLASTBufferQueueTest SurfaceViewSyncTest
Bug: 196339769
Change-Id: I6db3411b64552e5a4416d60420c92e698beda311
2 files changed