Loading android/app/src/com/android/bluetooth/btservice/AdapterService.java +52 −7 Original line number Diff line number Diff line Loading @@ -3679,9 +3679,17 @@ public class AdapterService extends Service { receiver.propagateException(e); } } @RequiresPermission(allOf = { android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED, }) private boolean allowLowLatencyAudio(boolean allowed, BluetoothDevice device) { AdapterService service = getService(); if (service == null) { if (service == null || !Utils.checkCallerIsSystemOrActiveUser(TAG) || !Utils.checkConnectPermissionForDataDelivery( service, Utils.getCallingAttributionSource(service), "AdapterService allowLowLatencyAudio")) { return false; } enforceBluetoothPrivilegedPermission(service); Loading @@ -3697,12 +3705,24 @@ public class AdapterService extends Service { receiver.propagateException(e); } } public int startRfcommListener( @RequiresPermission(allOf = { android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED, }) private int startRfcommListener( String name, ParcelUuid uuid, PendingIntent pendingIntent, AttributionSource attributionSource) { return mService.startRfcommListener(name, uuid, pendingIntent, attributionSource); AdapterService service = getService(); if (service == null || !Utils.checkCallerIsSystemOrActiveUser(TAG) || !Utils.checkConnectPermissionForDataDelivery( service, attributionSource, "AdapterService startRfcommListener")) { return BluetoothStatusCodes.ERROR_BLUETOOTH_NOT_ALLOWED; } enforceBluetoothPrivilegedPermission(service); return service.startRfcommListener(name, uuid, pendingIntent, attributionSource); } @Override Loading @@ -3714,8 +3734,20 @@ public class AdapterService extends Service { receiver.propagateException(e); } } public int stopRfcommListener(ParcelUuid uuid, AttributionSource attributionSource) { return mService.stopRfcommListener(uuid, attributionSource); @RequiresPermission(allOf = { android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED, }) private int stopRfcommListener(ParcelUuid uuid, AttributionSource attributionSource) { AdapterService service = getService(); if (service == null || !Utils.checkCallerIsSystemOrActiveUser(TAG) || !Utils.checkConnectPermissionForDataDelivery( service, attributionSource, "AdapterService stopRfcommListener")) { return BluetoothStatusCodes.ERROR_BLUETOOTH_NOT_ALLOWED; } enforceBluetoothPrivilegedPermission(service); return service.stopRfcommListener(uuid, attributionSource); } @Override Loading @@ -3727,9 +3759,22 @@ public class AdapterService extends Service { receiver.propagateException(e); } } public IncomingRfcommSocketInfo retrievePendingSocketForServiceRecord( @RequiresPermission(allOf = { android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED, }) private IncomingRfcommSocketInfo retrievePendingSocketForServiceRecord( ParcelUuid uuid, AttributionSource attributionSource) { return mService.retrievePendingSocketForServiceRecord(uuid, attributionSource); AdapterService service = getService(); if (service == null || !Utils.checkCallerIsSystemOrActiveUser(TAG) || !Utils.checkConnectPermissionForDataDelivery( service, attributionSource, "AdapterService retrievePendingSocketForServiceRecord")) { return null; } enforceBluetoothPrivilegedPermission(service); return service.retrievePendingSocketForServiceRecord(uuid, attributionSource); } @Override Loading Loading
android/app/src/com/android/bluetooth/btservice/AdapterService.java +52 −7 Original line number Diff line number Diff line Loading @@ -3679,9 +3679,17 @@ public class AdapterService extends Service { receiver.propagateException(e); } } @RequiresPermission(allOf = { android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED, }) private boolean allowLowLatencyAudio(boolean allowed, BluetoothDevice device) { AdapterService service = getService(); if (service == null) { if (service == null || !Utils.checkCallerIsSystemOrActiveUser(TAG) || !Utils.checkConnectPermissionForDataDelivery( service, Utils.getCallingAttributionSource(service), "AdapterService allowLowLatencyAudio")) { return false; } enforceBluetoothPrivilegedPermission(service); Loading @@ -3697,12 +3705,24 @@ public class AdapterService extends Service { receiver.propagateException(e); } } public int startRfcommListener( @RequiresPermission(allOf = { android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED, }) private int startRfcommListener( String name, ParcelUuid uuid, PendingIntent pendingIntent, AttributionSource attributionSource) { return mService.startRfcommListener(name, uuid, pendingIntent, attributionSource); AdapterService service = getService(); if (service == null || !Utils.checkCallerIsSystemOrActiveUser(TAG) || !Utils.checkConnectPermissionForDataDelivery( service, attributionSource, "AdapterService startRfcommListener")) { return BluetoothStatusCodes.ERROR_BLUETOOTH_NOT_ALLOWED; } enforceBluetoothPrivilegedPermission(service); return service.startRfcommListener(name, uuid, pendingIntent, attributionSource); } @Override Loading @@ -3714,8 +3734,20 @@ public class AdapterService extends Service { receiver.propagateException(e); } } public int stopRfcommListener(ParcelUuid uuid, AttributionSource attributionSource) { return mService.stopRfcommListener(uuid, attributionSource); @RequiresPermission(allOf = { android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED, }) private int stopRfcommListener(ParcelUuid uuid, AttributionSource attributionSource) { AdapterService service = getService(); if (service == null || !Utils.checkCallerIsSystemOrActiveUser(TAG) || !Utils.checkConnectPermissionForDataDelivery( service, attributionSource, "AdapterService stopRfcommListener")) { return BluetoothStatusCodes.ERROR_BLUETOOTH_NOT_ALLOWED; } enforceBluetoothPrivilegedPermission(service); return service.stopRfcommListener(uuid, attributionSource); } @Override Loading @@ -3727,9 +3759,22 @@ public class AdapterService extends Service { receiver.propagateException(e); } } public IncomingRfcommSocketInfo retrievePendingSocketForServiceRecord( @RequiresPermission(allOf = { android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED, }) private IncomingRfcommSocketInfo retrievePendingSocketForServiceRecord( ParcelUuid uuid, AttributionSource attributionSource) { return mService.retrievePendingSocketForServiceRecord(uuid, attributionSource); AdapterService service = getService(); if (service == null || !Utils.checkCallerIsSystemOrActiveUser(TAG) || !Utils.checkConnectPermissionForDataDelivery( service, attributionSource, "AdapterService retrievePendingSocketForServiceRecord")) { return null; } enforceBluetoothPrivilegedPermission(service); return service.retrievePendingSocketForServiceRecord(uuid, attributionSource); } @Override Loading