Fix volume not restored when exiting silent mode

The change for volume per device introduced a problem where if a headset
is plugged in while in silent mode, the sound will not be restored
at the first press on volume up key but only at the second press.

This is because when exiting silent mode, AudioService reapplies the
last known volume for all devices in any order and the last volume
applied prevails, even if it is for a device other than currently selected
by audio policy manager.

The fix consists in applying a new volume only if the device indicated
matches currently selected device on an output.

Change-Id: I778b90a9ec5a8b4a15e0333bd045f2dd327f388c
1 file changed