Add a unique ID to MediaDeviceData

Both InfoMediaDevice and PhoneMediaDevice implement getIcon by calling
mContext.getDrawable and do not cache the result. Each time, they appear
to supply a fresh icon object inside MediaDeviceManager.updateCurrent,
causing it to always update the field MediaDeviceManager.current in its
setter. This resulted in a lot of unnecessary work being sent to the
fgExecutor on every volume change event, causing jank in the volume
dialog. Adding each device's unique ID to the media data and not setting
the field on ID matches eliminates the unnecessary calls.

Fixes: 225624315
Test: Manually tested and verified lack of dropped frames in Perfetto
Change-Id: I5d8fdcdf18c30a87274a8bf07e3f6a07afd650e1
2 files changed