AudioService: fix uid check in setBluetoothScoOn

Calling UID is now checked in setBluetoothScoOn and only allow
route to change if request comes from a system component.

The check was not taking into account secondary users, hence
causing failure to route audio to SCO when secondary users
were active.

This change makes sure we are checking the correct app id,
without taking into account the user id.

Bug: 74057977
Test: SCO call using Guest User

Change-Id: I3e26dedb6333a85b315073fe4830c4d1b8070742
This commit is contained in:
Vitor Albuquerque
2018-03-07 10:39:59 -03:00
committed by Felipe Ramos
parent 85e68063a9
commit c3bb48ccfd

View File

@@ -2928,7 +2928,7 @@ public class AudioService extends IAudioService.Stub
}
// Only enable calls from system components
if (Binder.getCallingUid() >= FIRST_APPLICATION_UID) {
if (UserHandle.getCallingAppId() >= FIRST_APPLICATION_UID) {
mForcedUseForCommExt = on ? AudioSystem.FORCE_BT_SCO : AudioSystem.FORCE_NONE;
return;
}