Prevent double-applying transactions

With BLAST, transactions contain buffers. Since we pass the transaction
between processes, its possible to commit the transaction twice. If the
transaction contains buffers, it will confuse surfaceflinger.

Account for this by clearing transactions when they are sent to remotes.
The merge case is non-trivial, though, because the remote may not
actually merge. So, for that, we clear the transaction only when it
is merged.

Fixing this revealed a bug in an edge-case triggered by tapltests, so this
fixes that as well.

Bug: 238328090
Test: atest TaplTestsLauncher3
Change-Id: If30b0bd4e8fad4658365826a25eac38dc06af4c7
3 files changed