From a0c680393f2dd03a937c598b2cb9abf98a58152c Mon Sep 17 00:00:00 2001 From: Matthew Xie Date: Sat, 25 Jun 2011 21:47:07 -0700 Subject: Incoming Bluetooth Connection requests - dialog. This sends the intents to the Settings app to show the dialogs for the incoming connection requests. Includes down merged contributions from Jaikumar Ganesh. Change-Id: Ic8b857aad3554315aae39a0e871eb94d0ac98a91 --- core/java/android/server/BluetoothA2dpService.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'core/java/android/server/BluetoothA2dpService.java') diff --git a/core/java/android/server/BluetoothA2dpService.java b/core/java/android/server/BluetoothA2dpService.java index 8a6fdb4..fd277d0 100644 --- a/core/java/android/server/BluetoothA2dpService.java +++ b/core/java/android/server/BluetoothA2dpService.java @@ -449,6 +449,22 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub { Settings.Secure.getBluetoothA2dpSinkPriorityKey(device.getAddress()), priority); } + public synchronized boolean allowIncomingConnect(BluetoothDevice device, boolean value) { + mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, + "Need BLUETOOTH_ADMIN permission"); + String address = device.getAddress(); + if (!BluetoothAdapter.checkBluetoothAddress(address)) { + return false; + } + Integer data = mBluetoothService.getAuthorizationAgentRequestData(address); + if (data == null) { + Log.w(TAG, "allowIncomingConnect(" + device + ") called but no native data available"); + return false; + } + log("allowIncomingConnect: A2DP: " + device + ":" + value); + return mBluetoothService.setAuthorizationNative(address, value, data.intValue()); + } + /** * Called by native code on a PropertyChanged signal from * org.bluez.AudioSink. -- cgit v1.1