Merge "Fix to avoid a race condition when consuming buffer." into oreo-cts-dev
am: 1304425ec2

Change-Id: Ia1097701068547d3cf87084b435f30d8996ecb23