Handles volume for device route and bt routes.
AudioManager#getStreamVolume() is used to get volume info. Which returns device volume or bluetooth volume according to the current active device. The selected route of the system media route provider can be different from the one in AudioManager, which results in having wrong volume in MediaRoute2Info. This CL updates the volume of the correct media route depending on AudioManager#getDevicesForStream. It assumes that there are 3 volumes (device volume, bluetooth volume, and hearing aid volume). The limitation of this CL is that when the user transfers to a route first time, the volume could be 0. About after 4~600ms volume info is updated. This seems inevitable because I couldn't find an API to get the volume of inactive device. Bug: 155279794 Test: manually switching between phone <-> bt route. Reboot multiple times to check "first transfer" Change-Id: I4edcab9e6e436801b64c9434b683ddddbbc02bef
Loading
Please register or sign in to comment