diff options
author | Jeff Sharkey <jsharkey@google.com> | 2021-04-15 13:43:03 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2021-04-15 13:43:03 +0000 |
commit | 02ebd8c09694b85776df068a6036796ae51dbd18 (patch) | |
tree | 8ce7b2edac6abcf2e630c06702d2654527557644 /framework/java/android/bluetooth/BluetoothSocket.java | |
parent | 27250c467be137a697d7396d6a27cdfc219a7531 (diff) | |
parent | 8f80e4a05b3f1b227f40de5ec0e9a6297154ffc0 (diff) |
Merge changes from topic "apr10" into sc-dev
* changes:
Update Bluetooth API annotations.
Error Prone for RequiresPermission across AIDL.
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothSocket.java')
-rw-r--r-- | framework/java/android/bluetooth/BluetoothSocket.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/framework/java/android/bluetooth/BluetoothSocket.java b/framework/java/android/bluetooth/BluetoothSocket.java index 65381dbb23..ef88147a40 100644 --- a/framework/java/android/bluetooth/BluetoothSocket.java +++ b/framework/java/android/bluetooth/BluetoothSocket.java @@ -16,6 +16,8 @@ package android.bluetooth; +import android.annotation.RequiresPermission; +import android.annotation.SuppressLint; import android.compat.annotation.UnsupportedAppUsage; import android.net.LocalSocket; import android.os.Build; @@ -70,9 +72,6 @@ import java.util.UUID; * safe. In particular, {@link #close} will always immediately abort ongoing * operations and close the socket. * - * <p class="note"><strong>Note:</strong> - * Requires the {@link android.Manifest.permission#BLUETOOTH} permission. - * * <div class="special reference"> * <h3>Developer Guides</h3> * <p>For more information about using Bluetooth, read the @@ -199,6 +198,7 @@ public final class BluetoothSocket implements Closeable { * @throws IOException On error, for example Bluetooth not available, or insufficient * privileges */ + @SuppressLint("AndroidFrameworkRequiresPermission") /*package*/ BluetoothSocket(int type, int fd, boolean auth, boolean encrypt, BluetoothDevice device, int port, ParcelUuid uuid, boolean mitm, boolean min16DigitPin) throws IOException { @@ -386,6 +386,7 @@ public final class BluetoothSocket implements Closeable { * * @throws IOException on error, for example connection failure */ + @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public void connect() throws IOException { if (mDevice == null) throw new IOException("Connect is called on null device"); @@ -427,6 +428,7 @@ public final class BluetoothSocket implements Closeable { * Currently returns unix errno instead of throwing IOException, * so that BluetoothAdapter can check the error code for EADDRINUSE */ + @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) /*package*/ int bindListen() { int ret; if (mSocketState == SocketState.CLOSED) return EBADFD; @@ -682,6 +684,7 @@ public final class BluetoothSocket implements Closeable { * connection. This function is currently used for testing only. * @hide */ + @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public void requestMaximumTxDataLength() throws IOException { if (mDevice == null) { throw new IOException("requestMaximumTxDataLength is called on null device"); |