Fixed bug with caching buffers
SCC::cacheBuffers checks if the Transaction contains a buffer before
looking through the states. However, the flag mContainsBuffer could be
cleared if a single layer clears the buffer. This isn't correct since
there could be other SC in the Transaction that have a buffer and we
would end up not caching them.
Rename mContainsBuffer to mMayContainBuffer since it's more of a hint
that the Transaction may have a buffer. It's not really worth storing a
count when we're going to check each layer anyway. mMayContainBuffer
just helps optimize in the scenario when we know for sure that no buffer
has even been set before apply was called.
Additionally, remove the code that clears mMayContainBuffer when the
buffer has been removed since there may be a different buffer set for a
different SC.
Because mMayContainBuffer is only used to determine whether to cache,
there's no need to parcel it. When writeToParcel is called, the data is
cached so the other process doesn't need to know about it.
Test: Builds
Bug: 246986005
Change-Id: Id642cba7f13112084d842b1222b2bc7256d2e577
2 files changed