Loading framework/java/android/bluetooth/BluetoothPbap.java +39 −0 Original line number Diff line number Diff line Loading @@ -16,7 +16,10 @@ package android.bluetooth; import android.Manifest; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresPermission; import android.annotation.SdkConstant; import android.annotation.SuppressLint; import android.annotation.SystemApi; Loading Loading @@ -270,6 +273,42 @@ public class BluetoothPbap implements BluetoothProfile { return new ArrayList<BluetoothDevice>(); } /** * Pbap does not store connection policy, so this function only disconnects Pbap if * connectionPolicy is CONNECTION_POLICY_FORBIDDEN. * * <p> The device should already be paired. * Connection policy can be one of {@link #CONNECTION_POLICY_ALLOWED}, * {@link #CONNECTION_POLICY_FORBIDDEN}, {@link #CONNECTION_POLICY_UNKNOWN} * * @param device Paired bluetooth device * @param connectionPolicy is the connection policy to set to for this profile * @return true if pbap is successfully disconnected, false otherwise * @hide */ @SystemApi @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN) public boolean setConnectionPolicy(@NonNull BluetoothDevice device, @ConnectionPolicy int connectionPolicy) { if (DBG) log("setConnectionPolicy(" + device + ", " + connectionPolicy + ")"); try { final IBluetoothPbap service = mService; if (service != null && isEnabled() && isValidDevice(device)) { if (connectionPolicy != BluetoothProfile.CONNECTION_POLICY_FORBIDDEN && connectionPolicy != BluetoothProfile.CONNECTION_POLICY_ALLOWED) { return false; } return service.setConnectionPolicy(device, connectionPolicy); } if (service == null) Log.w(TAG, "Proxy not attached to service"); return false; } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return false; } } /** * Disconnects the current Pbap client (PCE). Currently this call blocks, * it may soon be made asynchronous. Returns false if this proxy object is Loading Loading
framework/java/android/bluetooth/BluetoothPbap.java +39 −0 Original line number Diff line number Diff line Loading @@ -16,7 +16,10 @@ package android.bluetooth; import android.Manifest; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresPermission; import android.annotation.SdkConstant; import android.annotation.SuppressLint; import android.annotation.SystemApi; Loading Loading @@ -270,6 +273,42 @@ public class BluetoothPbap implements BluetoothProfile { return new ArrayList<BluetoothDevice>(); } /** * Pbap does not store connection policy, so this function only disconnects Pbap if * connectionPolicy is CONNECTION_POLICY_FORBIDDEN. * * <p> The device should already be paired. * Connection policy can be one of {@link #CONNECTION_POLICY_ALLOWED}, * {@link #CONNECTION_POLICY_FORBIDDEN}, {@link #CONNECTION_POLICY_UNKNOWN} * * @param device Paired bluetooth device * @param connectionPolicy is the connection policy to set to for this profile * @return true if pbap is successfully disconnected, false otherwise * @hide */ @SystemApi @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN) public boolean setConnectionPolicy(@NonNull BluetoothDevice device, @ConnectionPolicy int connectionPolicy) { if (DBG) log("setConnectionPolicy(" + device + ", " + connectionPolicy + ")"); try { final IBluetoothPbap service = mService; if (service != null && isEnabled() && isValidDevice(device)) { if (connectionPolicy != BluetoothProfile.CONNECTION_POLICY_FORBIDDEN && connectionPolicy != BluetoothProfile.CONNECTION_POLICY_ALLOWED) { return false; } return service.setConnectionPolicy(device, connectionPolicy); } if (service == null) Log.w(TAG, "Proxy not attached to service"); return false; } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return false; } } /** * Disconnects the current Pbap client (PCE). Currently this call blocks, * it may soon be made asynchronous. Returns false if this proxy object is Loading