audiopolicy: Refactor and fix loops in AudioPolicyManager

  -- Use range for loops where possible.

  -- Replace some loops over DeviceVector with a call to already
     existing search function.

  -- Fix unsigned integer overflow in a loop that decrements
     the loop counter.

Change-Id: I2ab544b8176310c15c16c04b72c2800d8526e5a5
Test: compiles
1 file changed