AudioService: add missing permission checks in Bluetooth related code am: de3a4084b2 am: a8a304da7f am: f69b0c0314

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15600804

Change-Id: I3abc34082e71ee44dfefe7bc37727e43682b597e
This commit is contained in:
Jakub Pawlowski
2021-09-01 00:13:14 +00:00
committed by Automerger Merge Worker

View File

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