aaudio: add tests for device switch detection and refactor
am: 629afae613

Change-Id: If7a456b2f9b3ce7ec551aadc08838764e228ec46