AudioService: add missing permission checks in Bluetooth related code

Bug: 181962322
Test: compilation
Change-Id: Ic6401d0577244c0c1fcab6672c93d4e4e6b4e169
This commit is contained in:
Jakub Pawlowski
2021-05-14 22:06:19 +02:00
committed by Hansong Zhang
parent 826bc6bd8b
commit de3a4084b2

View File

@@ -5295,6 +5295,10 @@ public class AudioService extends IAudioService.Stub
// TODO investigate internal users due to deprecation of SDK API // TODO investigate internal users due to deprecation of SDK API
/** @see AudioManager#setBluetoothA2dpOn(boolean) */ /** @see AudioManager#setBluetoothA2dpOn(boolean) */
public void setBluetoothA2dpOn(boolean on) { public void setBluetoothA2dpOn(boolean on) {
if (!checkAudioSettingsPermission("setBluetoothA2dpOn()")) {
return;
}
// for logging only // for logging only
final int uid = Binder.getCallingUid(); final int uid = Binder.getCallingUid();
final int pid = Binder.getCallingPid(); final int pid = Binder.getCallingPid();
@@ -5320,6 +5324,10 @@ public class AudioService extends IAudioService.Stub
/** @see AudioManager#startBluetoothSco() */ /** @see AudioManager#startBluetoothSco() */
public void startBluetoothSco(IBinder cb, int targetSdkVersion) { public void startBluetoothSco(IBinder cb, int targetSdkVersion) {
if (!checkAudioSettingsPermission("startBluetoothSco()")) {
return;
}
final int uid = Binder.getCallingUid(); final int uid = Binder.getCallingUid();
final int pid = Binder.getCallingPid(); final int pid = Binder.getCallingPid();
final int scoAudioMode = final int scoAudioMode =
@@ -5342,6 +5350,10 @@ public class AudioService extends IAudioService.Stub
/** @see AudioManager#startBluetoothScoVirtualCall() */ /** @see AudioManager#startBluetoothScoVirtualCall() */
public void startBluetoothScoVirtualCall(IBinder cb) { public void startBluetoothScoVirtualCall(IBinder cb) {
if (!checkAudioSettingsPermission("startBluetoothScoVirtualCall()")) {
return;
}
final int uid = Binder.getCallingUid(); final int uid = Binder.getCallingUid();
final int pid = Binder.getCallingPid(); final int pid = Binder.getCallingPid();
final String eventSource = new StringBuilder("startBluetoothScoVirtualCall()") final String eventSource = new StringBuilder("startBluetoothScoVirtualCall()")