diff options
| author | Casper Bonde <c.bonde@samsung.com> | 2015-03-19 10:36:45 +0100 |
|---|---|---|
| committer | Andre Eisenbach <eisenbach@google.com> | 2015-04-15 23:45:51 -0700 |
| commit | d8355fbc2eebadece0ee3beae25361be32d9ee34 (patch) | |
| tree | 6ea8b26d7a0391a78d67d05e0a215e40537b32b1 /framework/java/android/bluetooth/BluetoothDevice.java | |
| parent | 7688f220e1dd3457c608aabf39ab900606a387a8 (diff) | |
Add support for Bluetooth Sim Access Profile (2/4)
Change-Id: I6c634aa38d31a7b5a98c9089840557257fd58209
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothDevice.java')
| -rw-r--r-- | framework/java/android/bluetooth/BluetoothDevice.java | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/framework/java/android/bluetooth/BluetoothDevice.java b/framework/java/android/bluetooth/BluetoothDevice.java index 1e82c032bf..bfc374fb91 100644 --- a/framework/java/android/bluetooth/BluetoothDevice.java +++ b/framework/java/android/bluetooth/BluetoothDevice.java @@ -382,6 +382,9 @@ public final class BluetoothDevice implements Parcelable { /**@hide*/ public static final int REQUEST_TYPE_MESSAGE_ACCESS = 3; + /**@hide*/ + public static final int REQUEST_TYPE_SIM_ACCESS = 4; + /** * Used as an extra field in {@link #ACTION_CONNECTION_ACCESS_REQUEST} intents, * Contains package name to return reply intent to. @@ -1270,6 +1273,44 @@ public final class BluetoothDevice implements Parcelable { } /** + * Requires {@link android.Manifest.permission#BLUETOOTH}. + * @return Whether the Sim access is allowed to this device. Can be + * {@link #ACCESS_UNKNOWN}, {@link #ACCESS_ALLOWED} or {@link #ACCESS_REJECTED}. + * @hide + */ + public int getSimAccessPermission() { + if (sService == null) { + return ACCESS_UNKNOWN; + } + try { + return sService.getSimAccessPermission(this); + } catch (RemoteException e) { + Log.e(TAG, "", e); + } + return ACCESS_UNKNOWN; + } + + /** + * Sets whether the Sim access is allowed to this device. + * <p>Requires {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED}. + * @param value Can be {@link #ACCESS_UNKNOWN}, {@link #ACCESS_ALLOWED} or + * {@link #ACCESS_REJECTED}. + * @return Whether the value has been successfully set. + * @hide + */ + public boolean setSimAccessPermission(int value) { + if (sService == null) { + return false; + } + try { + return sService.setSimAccessPermission(this, value); + } catch (RemoteException e) { + Log.e(TAG, "", e); + } + return false; + } + + /** * Create an RFCOMM {@link BluetoothSocket} ready to start a secure * outgoing connection to this remote device on given channel. * <p>The remote device will be authenticated and communication on this |
