Always assign a free ID to the new MediaPlayer

It used current size plus 1 as the new MediaPlayer's ID in previous
design and if a player was removed before, the ID of size+1 maybe was
still in used but a ID < size+1 was freed.

This change finds a free ID by checking if the number is not in the
mMediaPlayerIds so we never use same ID in two player.

Bug: 110511529
Test: manually switching players by force-stop / disabled
runtest bluetooth -c com.android.bluetooth.avrcp.MediaPlayerWrapperTest

Change-Id: Ia9e67a34b5915ad615746e6b334c1596ee639c1a
1 file changed