summaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/BluetoothServerSocket.java
diff options
context:
space:
mode:
authorJack He <siyuanh@google.com>2017-08-22 16:06:54 -0700
committerJack He <siyuanh@google.com>2017-08-24 19:09:48 +0000
commit910201beb0bde1dcf6b33e4ec5d1eb60042419d8 (patch)
tree9e7b8aa471daaed62a7e16a6b8cbd10a0a533e8a /framework/java/android/bluetooth/BluetoothServerSocket.java
parent931010f176faa894f06051c57290f7723dfbcd49 (diff)
Fix checkstyle errors (1/2)
* Automatic style corrections through IDE Bug: 63596319 Test: make checkbuild, no manual changes, no functional changes Change-Id: I2397d55abc34c9b7a9b748bec6137778df3421a7
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothServerSocket.java')
-rw-r--r--framework/java/android/bluetooth/BluetoothServerSocket.java69
1 files changed, 36 insertions, 33 deletions
diff --git a/framework/java/android/bluetooth/BluetoothServerSocket.java b/framework/java/android/bluetooth/BluetoothServerSocket.java
index 4860c93840..7b438bdb4e 100644
--- a/framework/java/android/bluetooth/BluetoothServerSocket.java
+++ b/framework/java/android/bluetooth/BluetoothServerSocket.java
@@ -75,12 +75,13 @@ public final class BluetoothServerSocket implements Closeable {
/**
* Construct a socket for incoming connections.
- * @param type type of socket
- * @param auth require the remote device to be authenticated
+ *
+ * @param type type of socket
+ * @param auth require the remote device to be authenticated
* @param encrypt require the connection to be encrypted
- * @param port remote port
- * @throws IOException On error, for example Bluetooth not available, or
- * insufficient privileges
+ * @param port remote port
+ * @throws IOException On error, for example Bluetooth not available, or insufficient
+ * privileges
*/
/*package*/ BluetoothServerSocket(int type, boolean auth, boolean encrypt, int port)
throws IOException {
@@ -93,14 +94,15 @@ public final class BluetoothServerSocket implements Closeable {
/**
* Construct a socket for incoming connections.
- * @param type type of socket
- * @param auth require the remote device to be authenticated
+ *
+ * @param type type of socket
+ * @param auth require the remote device to be authenticated
* @param encrypt require the connection to be encrypted
- * @param port remote port
- * @param mitm enforce man-in-the-middle protection for authentication.
+ * @param port remote port
+ * @param mitm enforce man-in-the-middle protection for authentication.
* @param min16DigitPin enforce a minimum length of 16 digits for a sec mode 2 connection
- * @throws IOException On error, for example Bluetooth not available, or
- * insufficient privileges
+ * @throws IOException On error, for example Bluetooth not available, or insufficient
+ * privileges
*/
/*package*/ BluetoothServerSocket(int type, boolean auth, boolean encrypt, int port,
boolean mitm, boolean min16DigitPin)
@@ -108,19 +110,20 @@ public final class BluetoothServerSocket implements Closeable {
mChannel = port;
mSocket = new BluetoothSocket(type, -1, auth, encrypt, null, port, null, mitm,
min16DigitPin);
- if(port == BluetoothAdapter.SOCKET_CHANNEL_AUTO_STATIC_NO_SDP) {
+ if (port == BluetoothAdapter.SOCKET_CHANNEL_AUTO_STATIC_NO_SDP) {
mSocket.setExcludeSdp(true);
}
}
/**
* Construct a socket for incoming connections.
- * @param type type of socket
- * @param auth require the remote device to be authenticated
+ *
+ * @param type type of socket
+ * @param auth require the remote device to be authenticated
* @param encrypt require the connection to be encrypted
- * @param uuid uuid
- * @throws IOException On error, for example Bluetooth not available, or
- * insufficient privileges
+ * @param uuid uuid
+ * @throws IOException On error, for example Bluetooth not available, or insufficient
+ * privileges
*/
/*package*/ BluetoothServerSocket(int type, boolean auth, boolean encrypt, ParcelUuid uuid)
throws IOException {
@@ -136,9 +139,9 @@ public final class BluetoothServerSocket implements Closeable {
* <p>Once this call returns, it can be called again to accept subsequent
* incoming connections.
* <p>{@link #close} can be used to abort this call from another thread.
+ *
* @return a connected {@link BluetoothSocket}
- * @throws IOException on error, for example this call was aborted, or
- * timeout
+ * @throws IOException on error, for example this call was aborted, or timeout
*/
public BluetoothSocket accept() throws IOException {
return accept(-1);
@@ -150,9 +153,9 @@ public final class BluetoothServerSocket implements Closeable {
* <p>Once this call returns, it can be called again to accept subsequent
* incoming connections.
* <p>{@link #close} can be used to abort this call from another thread.
+ *
* @return a connected {@link BluetoothSocket}
- * @throws IOException on error, for example this call was aborted, or
- * timeout
+ * @throws IOException on error, for example this call was aborted, or timeout
*/
public BluetoothSocket accept(int timeout) throws IOException {
return mSocket.accept(timeout);
@@ -174,16 +177,19 @@ public final class BluetoothServerSocket implements Closeable {
mSocket.close();
}
- /*package*/ synchronized void setCloseHandler(Handler handler, int message) {
+ /*package*/
+ synchronized void setCloseHandler(Handler handler, int message) {
mHandler = handler;
mMessage = message;
}
+
/*package*/ void setServiceName(String ServiceName) {
mSocket.setServiceName(ServiceName);
}
/**
* Returns the channel on which this socket is bound.
+ *
* @hide
*/
public int getChannel() {
@@ -199,10 +205,10 @@ public final class BluetoothServerSocket implements Closeable {
* The bind operation should be conducted through this class
* and the resulting port should be kept in mChannel, and
* not set from BluetoothAdapter. */
- if(mSocket != null) {
- if(mSocket.getPort() != newChannel) {
- Log.w(TAG,"The port set is different that the underlying port. mSocket.getPort(): "
- + mSocket.getPort() + " requested newChannel: " + newChannel);
+ if (mSocket != null) {
+ if (mSocket.getPort() != newChannel) {
+ Log.w(TAG, "The port set is different that the underlying port. mSocket.getPort(): "
+ + mSocket.getPort() + " requested newChannel: " + newChannel);
}
}
mChannel = newChannel;
@@ -212,19 +218,16 @@ public final class BluetoothServerSocket implements Closeable {
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("ServerSocket: Type: ");
- switch(mSocket.getConnectionType()) {
- case BluetoothSocket.TYPE_RFCOMM:
- {
+ switch (mSocket.getConnectionType()) {
+ case BluetoothSocket.TYPE_RFCOMM: {
sb.append("TYPE_RFCOMM");
break;
}
- case BluetoothSocket.TYPE_L2CAP:
- {
+ case BluetoothSocket.TYPE_L2CAP: {
sb.append("TYPE_L2CAP");
break;
}
- case BluetoothSocket.TYPE_SCO:
- {
+ case BluetoothSocket.TYPE_SCO: {
sb.append("TYPE_SCO");
break;
}